From 8da3acb8ad4d67759ed8393cfff31da970bd4538 Mon Sep 17 00:00:00 2001 From: thednp Date: Sat, 12 Feb 2022 13:23:29 +0200 Subject: [PATCH] Changes: * updated `shorter-js` * updated `event-listener` * code cleanup --- dist/bootstrap-native-v4-esm.js | 20 +- dist/bootstrap-native-v4-esm.min.js | 4 +- dist/bootstrap-native-v4.js | 20 +- dist/bootstrap-native-v4.min.js | 4 +- dist/bootstrap-native.esm.js | 344 ++++++++++-------------- dist/bootstrap-native.esm.min.js | 4 +- dist/bootstrap-native.js | 344 ++++++++++-------------- dist/bootstrap-native.min.js | 4 +- dist/components/alert-native.esm.js | 69 +---- dist/components/alert-native.js | 69 +---- dist/components/button-native.esm.js | 37 +-- dist/components/button-native.js | 37 +-- dist/components/carousel-native.esm.js | 71 ++--- dist/components/carousel-native.js | 71 ++--- dist/components/collapse-native.esm.js | 69 +---- dist/components/collapse-native.js | 69 +---- dist/components/dropdown-native.esm.js | 39 +-- dist/components/dropdown-native.js | 39 +-- dist/components/modal-native.esm.js | 71 ++--- dist/components/modal-native.js | 71 ++--- dist/components/offcanvas-native.esm.js | 71 ++--- dist/components/offcanvas-native.js | 71 ++--- dist/components/popover-native.esm.js | 77 ++---- dist/components/popover-native.js | 77 ++---- dist/components/scrollspy-native.esm.js | 37 +-- dist/components/scrollspy-native.js | 37 +-- dist/components/tab-native.esm.js | 69 +---- dist/components/tab-native.js | 69 +---- dist/components/toast-native.esm.js | 69 +---- dist/components/toast-native.js | 69 +---- dist/components/tooltip-native.esm.js | 77 ++---- dist/components/tooltip-native.js | 77 ++---- package.json | 6 +- src/components/alert-native.js | 5 +- src/components/button-native.js | 7 +- src/components/carousel-native.js | 9 +- src/components/collapse-native.js | 7 +- src/components/dropdown-native.js | 9 +- src/components/modal-native.js | 9 +- src/components/offcanvas-native.js | 9 +- src/components/scrollspy-native.js | 7 +- src/components/tab-native.js | 7 +- src/components/toast-native.js | 7 +- src/components/tooltip-native.js | 15 +- src/index.js | 3 + src/util/init.js | 5 +- 46 files changed, 691 insertions(+), 1670 deletions(-) diff --git a/dist/bootstrap-native-v4-esm.js b/dist/bootstrap-native-v4-esm.js index 78af2ba2..920bcc4f 100644 --- a/dist/bootstrap-native-v4-esm.js +++ b/dist/bootstrap-native-v4-esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -143,7 +143,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -var parentNodes = [Document, Node, Element, HTMLElement]; +var parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -155,19 +155,17 @@ var elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - var selectorIsString = typeof selector === 'string'; - var lookUp = parent && parentNodes.some(function (x) { return parent instanceof x; }) + var lookUp = parentNodes.some(function (x) { return parent instanceof x; }) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some(function (x) { return selector instanceof x; })) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some(function (x) { return selector instanceof x; }) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** BSN v4 custom event */ @@ -2579,7 +2577,7 @@ function removeDataAPI(context) { }); } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; var Version = version; diff --git a/dist/bootstrap-native-v4-esm.min.js b/dist/bootstrap-native-v4-esm.min.js index cb7e491b..0817b4bd 100644 --- a/dist/bootstrap-native-v4-esm.min.js +++ b/dist/bootstrap-native-v4-esm.min.js @@ -1,2 +1,2 @@ -// Native JavaScript for Bootstrap v4.1.0alpha4 | 2022 © dnp_theme | MIT-License -var t=document.head,e="webkitTransition"in t.style||"transition"in t.style,i="webkitTransition"in t.style?"webkitTransitionEnd":"transitionend",n="webkitTransition"in t.style?"webkitTransitionDelay":"transitionDelay",a="webkitTransition"in t.style?"webkitTransitionProperty":"transitionProperty";function o(t,e){var i=getComputedStyle(t);return e in i?i[e]:""}var s="webkitTransition"in t.style?"webkitTransitionDuration":"transitionDuration";function l(t){var i=o(t,a),n=o(t,s),l=n.includes("ms")?1:1e3,r=e&&i&&"none"!==i?parseFloat(n)*l:0;return Number.isNaN(r)?0:r}function r(t,s){var r=0,c=new Event(i),d=l(t),u=function(t){var i=o(t,a),s=o(t,n),l=s.includes("ms")?1:1e3,r=e&&i&&"none"!==i?parseFloat(s)*l:0;return Number.isNaN(r)?0:r}(t);if(e&&d){var m=function(e){e.target===t&&(s.apply(t,[e]),t.removeEventListener(i,m),r=1)};t.addEventListener(i,m),setTimeout((function(){r||t.dispatchEvent(c)}),d+u+17)}else s.apply(t,[c])}function c(t){return t instanceof HTMLElement?t.ownerDocument:t instanceof Window?t.document:window.document}var d=[Document,Node,Element,HTMLElement],u=[Element,HTMLElement];function m(t,e){var i="string"==typeof t,n=e&&d.some((function(t){return e instanceof t}))?e:c();return!i&&u.some((function(e){return t instanceof e}))?t:i?n.querySelector(t):null}function f(t,e,i){var n=new CustomEvent(t+".bs."+e,{cancelable:!0});return void 0!==i&&Object.keys(i).forEach((function(t){Object.defineProperty(n,t,{value:i[t]})})),n}function h(t){this&&this.dispatchEvent(t)}function g(t){var e,i,n=this,a=f("close","alert"),o=f("closed","alert");function s(t){e[t?"addEventListener":"removeEventListener"]("click",l,!1)}function l(t){i=t&&t.target.closest(".alert"),(e=m('[data-dismiss="alert"]',i))&&i&&(e===t.target||e.contains(t.target))&&n.close()}function c(){s(),i.parentNode.removeChild(i),h.call(i,o)}n.close=function(){if(i&&e&&i.classList.contains("show")){if(h.call(i,a),a.defaultPrevented)return;n.dispose(),i.classList.remove("show"),i.classList.contains("fade")?r(i,c):c()}},n.dispose=function(){s(),delete e.Alert},e=m(t),i=e.closest(".alert"),e.Alert&&e.Alert.dispose(),e.Alert||s(1),n.element=e,e.Alert=n}function p(t){var e,i,n=f("change","button");function a(t){var a=t.target,o=a.closest("LABEL"),s=null;"LABEL"===a.tagName?s=a:o&&(s=o);var l=s&&s.getElementsByTagName("INPUT")[0];if(l){if(h.call(l,n),h.call(e,n),"checkbox"===l.type){if(n.defaultPrevented)return;l.checked?(s.classList.remove("active"),l.getAttribute("checked"),l.removeAttribute("checked"),l.checked=!1):(s.classList.add("active"),l.getAttribute("checked"),l.setAttribute("checked","checked"),l.checked=!0),e.toggled||(e.toggled=!0)}if("radio"===l.type&&!e.toggled){if(n.defaultPrevented)return;(!l.checked||0===t.screenX&&0===t.screenY)&&(s.classList.add("active"),s.classList.add("focus"),l.setAttribute("checked","checked"),l.checked=!0,e.toggled=!0,Array.from(i).forEach((function(t){var e=t.getElementsByTagName("INPUT")[0];t!==s&&t.classList.contains("active")&&(h.call(e,n),t.classList.remove("active"),e.removeAttribute("checked"),e.checked=!1)})))}setTimeout((function(){e.toggled=!1}),50)}}function o(t){32===(t.which||t.keyCode)&&t.target===document.activeElement&&a(t)}function s(t){32===(t.which||t.keyCode)&&t.preventDefault()}function l(t){if("INPUT"===t.target.tagName){var e="focusin"===t.type?"add":"remove";t.target.closest(".btn").classList[e]("focus")}}function r(t){var i=t?"addEventListener":"removeEventListener";e[i]("click",a,!1),e[i]("keyup",o,!1),e[i]("keydown",s,!1),e[i]("focusin",l,!1),e[i]("focusout",l,!1)}this.dispose=function(){r(),delete e.Button},(e=m(t)).Button&&e.Button.dispose(),(i=e.getElementsByClassName("btn")).length&&(e.Button||r(1),e.toggled=!1,e.Button=this,Array.from(i).forEach((function(t){var e=m("input:checked",t);!t.classList.contains("active")&&e&&t.classList.add("active"),t.classList.contains("active")&&!e&&t.classList.remove("active")})))}var v="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],L={passive:!0};var b=function(t){var e=function(t,e){var i=t.getBoundingClientRect(),n=i.width,a=i.height,o=i.top,s=i.right,l=i.bottom,r=i.left,c=1,d=1;if(e&&t instanceof HTMLElement){var u=t.offsetWidth,m=t.offsetHeight;c=u>0&&Math.round(n)/u||1,d=m>0&&Math.round(a)/m||1}return{width:n/c,height:a/d,top:o/d,right:s/c,bottom:l/d,left:r/c,x:r/c,y:o/d}}(t),i=e.top,n=e.bottom;return i<=c(t).documentElement.clientHeight&&n>=0},y=function(t){return t.offsetHeight};function w(t,e){var i,n,a,o,s,c,d,u,g,p,w,A,T,E=e||{},k=this;function x(){!1===c.interval||o.classList.contains("paused")||(o.classList.add("paused"),s.isSliding||(clearInterval(s.timer),s.timer=null))}function N(){!1!==c.interval&&o.classList.contains("paused")&&(o.classList.remove("paused"),s.isSliding||(clearInterval(s.timer),s.timer=null,k.cycle()))}function C(t){if(t.preventDefault(),!s.isSliding){var e=t.target;e&&!e.classList.contains("active")&&e.getAttribute("data-slide-to")&&(s.index=+e.getAttribute("data-slide-to"),k.slideTo(s.index))}}function P(t){if(t.preventDefault(),!s.isSliding){var e=t.currentTarget||t.srcElement;e===w?s.index+=1:e===p&&(s.index-=1),k.slideTo(s.index)}}function H(t){var e=t.which;if(!s.isSliding){switch(e){case 39:s.index+=1;break;case 37:s.index-=1;break;default:return}k.slideTo(s.index)}}function M(t){var e=t?"addEventListener":"removeEventListener";c.pause&&c.interval&&(o[e](v[0],x,!1),o[e](v[1],N,!1),o[e]("touchstart",x,L),o[e]("touchend",N,L)),c.touch&&g.length>1&&o[e]("touchstart",B,L),w&&w[e]("click",P,!1),p&&p[e]("click",P,!1),A&&A[e]("click",C,!1),c.keyboard&&window[e]("keydown",H,!1)}function S(t){var e=t?"addEventListener":"removeEventListener";o[e]("touchmove",I,L),o[e]("touchend",D,L)}function B(t){s.isTouch||(s.touchPosition.startX=t.changedTouches[0].pageX,o.contains(t.target)&&(s.isTouch=!0,S(1)))}function I(t){s.isTouch?(s.touchPosition.currentX=t.changedTouches[0].pageX,"touchmove"===t.type&&t.changedTouches.length>1&&t.preventDefault()):t.preventDefault()}function D(t){if(s.isTouch&&!s.isSliding&&(s.touchPosition.endX=s.touchPosition.currentX||t.changedTouches[0].pageX,s.isTouch)){if((!o.contains(t.target)||!o.contains(t.relatedTarget))&&Math.abs(s.touchPosition.startX-s.touchPosition.endX)<75)return;s.touchPosition.currentXs.touchPosition.startX&&(s.index-=1),s.isTouch=!1,k.slideTo(s.index),S()}}function X(t){Array.from(T).forEach((function(t){return t.classList.remove("active")})),T[t]&&T[t].classList.add("active")}function R(t){if(s.touchPosition){var e=s.index,i=t&&t.target!==g[e]?1e3*t.elapsedTime+100:20,n=k.getActiveIndex(),a="left"===s.direction?"next":"prev";s.isSliding&&setTimeout((function(){s.touchPosition&&(s.isSliding=!1,g[e].classList.add("active"),g[n].classList.remove("active"),g[e].classList.remove("carousel-item-"+a),g[e].classList.remove("carousel-item-"+s.direction),g[n].classList.remove("carousel-item-"+s.direction),h.call(o,u),document.hidden||!c.interval||o.classList.contains("paused")||k.cycle())}),i)}}if(k.cycle=function(){s.timer&&(clearInterval(s.timer),s.timer=null),s.timer=setInterval((function(){var t=s.index||k.getActiveIndex();b(o)&&(t+=1,k.slideTo(t))}),c.interval)},k.slideTo=function(t){if(!s.isSliding){var e=k.getActiveIndex(),i=t;if(e!==i){ei||e===g.length-1&&0===i)&&(s.direction="right"),i<0?i=g.length-1:i>=g.length&&(i=0);var n="left"===s.direction?"next":"prev",a={relatedTarget:g[i],direction:s.direction,from:e,to:i};d=f("slide","carousel",a),u=f("slid","carousel",a),h.call(o,d),d.defaultPrevented||(s.index=i,s.isSliding=!0,clearInterval(s.timer),s.timer=null,X(i),l(g[i])&&o.classList.contains("slide")?(g[i].classList.add("carousel-item-"+n),y(g[i]),g[i].classList.add("carousel-item-"+s.direction),g[e].classList.add("carousel-item-"+s.direction),r(g[i],R)):(g[i].classList.add("active"),y(g[i]),g[e].classList.remove("active"),setTimeout((function(){s.isSliding=!1,c.interval&&o&&!o.classList.contains("paused")&&k.cycle(),h.call(o,u)}),100)))}}},k.getActiveIndex=function(){return Array.from(g).indexOf(o.getElementsByClassName("carousel-item active")[0])||0},k.dispose=function(){var t=["left","right","prev","next"];Array.from(g).forEach((function(e,i){e.classList.contains("active")&&X(i),t.forEach((function(t){return e.classList.remove("carousel-item-"+t)}))})),clearInterval(s.timer),M(),s={},c={},delete o.Carousel},(o=m(t)).Carousel&&o.Carousel.dispose(),g=o.getElementsByClassName("carousel-item"),i=o.getElementsByClassName("carousel-control-prev"),p=i[0],n=o.getElementsByClassName("carousel-control-next"),w=n[0],a=o.getElementsByClassName("carousel-indicators"),A=a[0],T=A&&A.getElementsByTagName("LI")||[],!(g.length<2)){var W=o.getAttribute("data-interval"),O="false"===W?0:+W,j="false"===o.getAttribute("data-touch")?0:1,z="hover"===o.getAttribute("data-pause")||!1,U="true"===o.getAttribute("data-keyboard")||!1,q=E.interval,F=E.touch;(c={}).keyboard=!0===E.keyboard||U,c.pause=!("hover"!==E.pause&&!z)&&"hover",c.touch=F||j,c.interval=5e3,"number"==typeof q?c.interval=q:!1===q||0===O||!1===O?c.interval=0:Number.isNaN(O)||(c.interval=O),k.getActiveIndex()<0&&(g.length&&g[0].classList.add("active"),T.length&&X(0)),(s={}).direction="left",s.index=0,s.timer=null,s.isSliding=!1,s.isTouch=!1,s.touchPosition={startX:0,currentX:0,endX:0},M(1),c.interval&&k.cycle(),o.Carousel=k}}function A(t,e){var i,n,a,o,s,l,c,d=e||{},u=this,g=null,p=null;function v(t,e){h.call(t,l),l.defaultPrevented||(t.isAnimating=!0,t.style.height=t.scrollHeight+"px",t.classList.remove("collapse"),t.classList.remove("show"),t.classList.add("collapsing"),y(t),t.style.height="0px",r(t,(function(){t.isAnimating=!1,t.setAttribute("aria-expanded","false"),e.setAttribute("aria-expanded","false"),t.classList.remove("collapsing"),t.classList.add("collapse"),t.style.height="",h.call(t,c)})))}u.toggle=function(t){(t&&"A"===t.target.tagName||"A"===i.tagName)&&t.preventDefault(),(i.contains(t.target)||t.target===i)&&(p.classList.contains("show")?u.hide():u.show())},u.hide=function(){p.isAnimating||(v(p,i),i.classList.add("collapsed"))},u.show=function(){var t,e,l;g&&(t=g.getElementsByClassName("collapse show"),n=t[0],a=n&&(m('[data-target="#'+n.id+'"]',g)||m('[href="#'+n.id+'"]',g))),p.isAnimating||(a&&n!==p&&(v(n,a),a.classList.add("collapsed")),e=p,l=i,h.call(e,o),o.defaultPrevented||(e.isAnimating=!0,e.classList.add("collapsing"),e.classList.remove("collapse"),e.style.height=e.scrollHeight+"px",r(e,(function(){e.isAnimating=!1,e.setAttribute("aria-expanded","true"),l.setAttribute("aria-expanded","true"),e.classList.remove("collapsing"),e.classList.add("collapse"),e.classList.add("show"),e.style.height="",h.call(e,s)}))),i.classList.remove("collapsed"))},u.dispose=function(){i.removeEventListener("click",u.toggle,!1),delete i.Collapse},(i=m(t)).Collapse&&i.Collapse.dispose();var L=i.getAttribute("data-parent");o=f("show","collapse"),s=f("shown","collapse"),l=f("hide","collapse"),c=f("hidden","collapse"),null!==(p=m(d.target||i.getAttribute("data-target")||i.getAttribute("href")))&&(p.isAnimating=!1);var b=d.parent||L;g=b?i.closest(b):null,i.Collapse||i.addEventListener("click",u.toggle,!1),i.Collapse=u}var T=function(t){return t.focus()};function E(t,e){var i,n,a,o,s,l,r,c,d=this,u=null,g=[];function p(t){(t.hasAttribute("href")&&"#"===t.href.slice(-1)||t.parentNode&&t.parentNode.hasAttribute("href")&&"#"===t.parentNode.href.slice(-1))&&this.preventDefault()}function v(){var t=i.open?"addEventListener":"removeEventListener";document[t]("click",L,!1),document[t]("keydown",y,!1),document[t]("keyup",w,!1),document[t]("focus",L,!1)}function L(t){var e=t.target;if(e.getAttribute){var n=e&&e.getAttribute("data-toggle")||e.parentNode&&e.parentNode.getAttribute&&e.parentNode.getAttribute("data-toggle");("focus"!==t.type||e!==i&&e!==r&&!r.contains(e))&&(e!==r&&!r.contains(e)||!c&&!n)&&(u=e===i||i.contains(e)?i:null,d.hide(),p.call(t,e))}}function b(t){u=i,d.show(),p.call(t,t.target)}function y(t){var e=t.which||t.keyCode;38!==e&&40!==e||t.preventDefault()}function w(t){var e=t.which||t.keyCode,n=document.activeElement,a=n===i,o=r.contains(n),s=n.parentNode===r||n.parentNode.parentNode===r,l=g.indexOf(n);s&&(a?l=0:38===e?l=l>1?l-1:0:40===e&&(l=l=d,w=m.top+c/2+g/2>=u,A=m.top-c<0,T=m.left-r<0,E=m.top+c+g>=u,k=m.left+r+h>=d,x=i;x="right"===(x="left"===(x="bottom"===(x="top"===(x=("left"===x||"right"===x)&&T&&k?"top":x)&&A?"bottom":x)&&E?"top":x)&&T?"right":x)&&k?"left":x,-1===e.className.indexOf(x)&&(e.className=e.className.replace(/\b(top|bottom|left|right)+/,x));var C=v.offsetWidth,P=v.offsetHeight;"left"===x||"right"===x?(o="left"===x?m.left+f.x-r-(p?C:0):m.left+f.x+h,L?(a=m.top+f.y,s=g/2-C):w?(a=m.top+f.y-c+g,s=c-g/2-C):(a=m.top+f.y-c/2+g/2,s=c/2-(p?.9*P:P/2))):"top"!==x&&"bottom"!==x||(a="top"===x?m.top+f.y-c-(p?P:0):m.top+f.y+g,b?(o=0,l=m.left+h/2-C):y?(o=d-1.01*r,l=r-(d-m.left)+h/2-C/2):(o=m.left+f.x-r/2+h/2,l=r/2-(p?C:C/2))),e.style.top=a+"px",e.style.left=o+"px",s&&(v.style.top=s+"px"),l&&(v.style.left=l+"px")}function P(t,e){var i,n,a,o,s,l,c,d,u,g=e||{},p=this,b=null,y=0,w=/(iPhone|iPod|iPad)/.test(navigator.userAgent),A={};function T(t){null!==b&&t.target===m(".close",b)&&p.hide()}function E(t){return g[t]||i.dataset[t]||null}function k(){return E("title")}function N(){return E("content")}function P(){null===b&&i.focus()}function H(t){var e=t?"addEventListener":"removeEventListener";"hover"===A.trigger?(i[e](x,p.show),i[e](v[0],p.show),A.dismissible||i[e](v[1],p.hide)):"click"===A.trigger?i[e](A.trigger,p.toggle):"focus"===A.trigger&&(w&&i[e]("click",P,!1),i[e](A.trigger,p.toggle))}function M(t){b&&b.contains(t.target)||t.target===i||i.contains(t.target)||p.hide()}function S(t){var e=t?"addEventListener":"removeEventListener";A.dismissible?document[e]("click",T,!1):("focus"===A.trigger&&i[e]("blur",p.hide),"hover"===A.trigger&&document[e]("touchstart",M,L)),window[e]("resize",p.hide,L)}function B(){S(1),h.call(i,c)}function I(){S(),A.container.removeChild(b),y=null,b=null,h.call(i,u)}p.toggle=function(){null===b?p.show():p.hide()},p.show=function(){clearTimeout(y),y=setTimeout((function(){if(null===b){if(h.call(i,l),l.defaultPrevented)return;!function(){n=k(),a=(a=N())?a.trim():null,b=document.createElement("div");var t=document.createElement("div");if(t.classList.add("arrow"),b.appendChild(t),null!==a&&null===A.template){if(b.setAttribute("role","tooltip"),null!==n){var e=document.createElement("h3");e.classList.add("popover-header"),e.innerHTML=A.dismissible?n+s:n,b.appendChild(e)}var i=document.createElement("div");i.classList.add("popover-body"),i.innerHTML=A.dismissible&&null===n?a+s:a,b.appendChild(i)}else{var l=document.createElement("div");l.innerHTML=A.template.trim(),b.className=l.firstChild.className,b.innerHTML=l.firstChild.innerHTML;var r=m(".popover-header",b),c=m(".popover-body",b);n&&r&&(r.innerHTML=n.trim()),a&&c&&(c.innerHTML=a.trim())}A.container.appendChild(b),b.style.display="block",b.classList.contains("popover")||b.classList.add("popover"),b.classList.contains(A.animation)||b.classList.add(A.animation),b.classList.contains(o)||b.classList.add(o)}(),C(i,b,A.placement,A.container),b.classList.contains("show")||b.classList.add("show"),A.animation?r(b,B):B()}}),20)},p.hide=function(){clearTimeout(y),y=setTimeout((function(){if(b&&null!==b&&b.classList.contains("show")){if(h.call(i,d),d.defaultPrevented)return;b.classList.remove("show"),A.animation?r(b,I):I()}}),A.delay)},p.dispose=function(){p.hide(),H(),delete i.Popover},(i=m(t)).Popover&&i.Popover.dispose();var D=i.getAttribute("data-trigger"),X=i.getAttribute("data-animation"),R=i.getAttribute("data-placement"),W=i.getAttribute("data-dismissible"),O=i.getAttribute("data-delay"),j=i.getAttribute("data-container");s='',l=f("show","popover"),c=f("shown","popover"),d=f("hide","popover"),u=f("hidden","popover");var z=m(g.container),U=m(j),q=i.closest(".modal"),F=i.closest(".fixed-top"),Y=i.closest(".fixed-bottom");A.template=g.template?g.template:null,A.trigger=g.trigger?g.trigger:D||"hover",A.animation=g.animation&&"fade"!==g.animation?g.animation:X||"fade",A.placement=g.placement?g.placement:R||"top",A.delay=parseInt(g.delay||O,10)||200,A.dismissible=!(!g.dismissible&&"true"!==W),A.container=z||U||F||Y||q||document.body,o="bs-popover-"+A.placement,n=k(),((a=N())||A.template)&&(i.Popover||H(1),i.Popover=p)}function H(t,e){var i,n,a,o,s,l=e||{},r=this,c={};function d(){var t,e,s;(a=o.getElementsByTagName("A"),n.scrollTop=n.isWindow?N().y:i.scrollTop,n.length!==a.length||g()!==n.scrollHeight)&&(n.items=[],n.offsets=[],n.scrollHeight=g(),n.maxScroll=n.scrollHeight-(n.isWindow?window.innerHeight:i.getBoundingClientRect().height),Array.from(a).forEach((function(i){t=i.getAttribute("href"),(e=t&&"#"===t.charAt(0)&&"#"!==t.slice(-1)&&m(t))&&(n.items.push(i),s=e.getBoundingClientRect(),n.offsets.push((n.isWindow?s.top+n.scrollTop:e.offsetTop)-c.offset))})),n.length=n.items.length)}function u(t){var e=t?"addEventListener":"removeEventListener";s[e]("scroll",r.refresh,L),window[e]("resize",r.refresh,L)}function g(){return s.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function p(){Array.from(a).map((function(t){return t.classList.contains("active")&&t.classList.remove("active")}))}function v(t){var e,a=t;p(),n.activeItem=a,a.classList.add("active");for(var o=[];a.parentNode!==document.body;)((e=(a=a.parentNode).classList).contains("dropdown-menu")||e.contains("nav"))&&o.push(a);o.forEach((function(t){var e=t.previousElementSibling;e&&!e.classList.contains("active")&&e.classList.add("active")})),h.call(i,f("activate","scrollspy",{relatedTarget:n.activeItem}))}r.refresh=function(){if(d(),n.scrollTop>=n.maxScroll){var t=n.items[n.length-1];n.activeItem!==t&&v(t)}else{if(n.activeItem&&n.scrollTop0)return n.activeItem=null,void p();for(var e=n.length;e>-1;)n.activeItem!==n.items[e]&&n.scrollTop>=n.offsets[e]&&(void 0===n.offsets[e+1]||n.scrollTop1&&(g=t[t.length-1]):g=t[0],g}function P(){return m(C().getAttribute("href"))}function H(t){t.preventDefault(),u=t.currentTarget,a.isAnimating||T.show()}T.show=function(){if(!(u=u||n).classList.contains("active")){if(v=m(u.getAttribute("href")),g=C(),p=P(),c=f("hide","tab",{relatedTarget:u}),h.call(g,c),c.defaultPrevented)return;a.isAnimating=!0,g.classList.remove("active"),g.setAttribute("aria-selected","false"),u.classList.add("active"),u.setAttribute("aria-selected","true"),o&&(n.parentNode.classList.contains("dropdown-menu")?o.classList.contains("active")||o.classList.add("active"):o.classList.contains("active")&&o.classList.remove("active")),p.classList.contains("fade")?(p.classList.remove("show"),r(p,N)):N()}},T.dispose=function(){n.removeEventListener("click",H,!1),delete n.Tab},(n=m(t)).Tab&&n.Tab.dispose();var M=n.getAttribute("data-height");a=n.closest(".nav"),o=a&&m(".dropdown-toggle",a);var S=!(!e||!1===A.height||"false"===M);a.isAnimating=!1,n.Tab||n.addEventListener("click",H,!1),S&&(E=P().parentNode),n.Tab=T}function S(t,e){var i,n,a,o,s,l,c=e||{},d=this,u=0,g={};function p(){n.classList.remove("showing"),n.classList.add("show"),h.call(n,s),g.autohide&&d.hide()}function v(){n.classList.add("hide"),h.call(n,l)}function L(){n.classList.remove("show"),g.animation?r(n,v):v()}function b(){clearTimeout(u),i.removeEventListener("click",d.hide,!1),delete i.Toast}d.show=function(){if(n&&!n.classList.contains("show")){if(h.call(n,a),a.defaultPrevented)return;g.animation&&n.classList.add("fade"),n.classList.remove("hide"),y(n),n.classList.add("showing"),g.animation?r(n,p):p()}},d.hide=function(t){if(n&&n.classList.contains("show")){if(h.call(n,o),o.defaultPrevented)return;t?L():u=setTimeout(L,g.delay)}},d.dispose=function(){g.animation?r(n,b):b()},(i=m(t)).Toast&&i.Toast.dispose(),n=i.closest(".toast");var w=i.getAttribute("data-animation"),A=i.getAttribute("data-autohide"),T=i.getAttribute("data-delay");a=f("show","toast"),o=f("hide","toast"),s=f("shown","toast"),l=f("hidden","toast"),g.animation=!1===c.animation||"false"===w?0:1,g.autohide=!1===c.autohide||"false"===A?0:1,g.delay=parseInt(c.delay||T,10)||500,i.Toast||i.addEventListener("click",d.hide,!1),i.Toast=d}function B(t,e){var i,n,a,o,s,l,c,d=e||{},u=this,g=null,p=0,b={};function y(){return i.getAttribute("title")||i.getAttribute("data-title")||i.getAttribute("data-original-title")}function w(t){g&&g.contains(t.target)||t.target===i||i.contains(t.target)||u.hide()}function A(t){var e=t?"addEventListener":"removeEventListener";document[e]("touchstart",w,L),window[e]("resize",u.hide,L)}function T(){A(1),h.call(i,s)}function E(){A(),b.container.removeChild(g),g=null,p=null,h.call(i,c)}function k(t){var e=t?"addEventListener":"removeEventListener";i[e](x,u.show,!1),i[e](v[0],u.show,!1),i[e](v[1],u.hide,!1)}u.show=function(){clearTimeout(p),p=setTimeout((function(){if(null===g){if(h.call(i,o),o.defaultPrevented)return;!1!==function(){if(n=y()){if(g=document.createElement("div"),b.template){var t=document.createElement("div");t.innerHTML=b.template.trim(),g.className=t.firstChild.className,g.innerHTML=t.firstChild.innerHTML,m(".tooltip-inner",g).innerHTML=n.trim()}else{var e=document.createElement("div");e.classList.add("arrow"),g.appendChild(e);var i=document.createElement("div");i.classList.add("tooltip-inner"),g.appendChild(i),i.innerHTML=n}g.style.left="0",g.style.top="0",g.setAttribute("role","tooltip"),g.classList.contains("tooltip")||g.classList.add("tooltip"),g.classList.contains(b.animation)||g.classList.add(b.animation),g.classList.contains(a)||g.classList.add(a),b.container.appendChild(g)}}()&&(C(i,g,b.placement,b.container),g.classList.contains("show")||g.classList.add("show"),b.animation?r(g,T):T())}}),20)},u.hide=function(){clearTimeout(p),p=setTimeout((function(){if(g&&g.classList.contains("show")){if(h.call(i,l),l.defaultPrevented)return;g.classList.remove("show"),b.animation?r(g,E):E()}}),b.delay)},u.toggle=function(){g?u.hide():u.show()},u.dispose=function(){k(),u.hide(),i.setAttribute("title",i.getAttribute("data-original-title")),i.removeAttribute("data-original-title"),delete i.Tooltip},(i=m(t)).Tooltip&&i.Tooltip.dispose();var N=i.getAttribute("data-animation"),P=i.getAttribute("data-placement"),H=i.getAttribute("data-delay"),M=i.getAttribute("data-container"),S=m(d.container),B=m(M),I=i.closest(".modal");o=f("show","tooltip"),s=f("shown","tooltip"),l=f("hide","tooltip"),c=f("hidden","tooltip");var D=i.closest(".fixed-top"),X=i.closest(".fixed-bottom");b.animation=d.animation&&"fade"!==d.animation?d.animation:N||"fade",b.placement=d.placement?d.placement:P||"top",b.template=d.template?d.template:null,b.delay=parseInt(d.delay||H,10)||200,b.container=S||B||D||X||I||document.body,a="bs-tooltip-"+b.placement,(n=y())&&(i.Tooltip||(i.setAttribute("data-original-title",n),i.removeAttribute("title"),k(1)),i.Tooltip=u)}var I={};function D(t){var e=t instanceof Element?t:document;Object.keys(I).forEach((function(t){var i,n;i=I[t][0],n=e.querySelectorAll(I[t][1]),Array.from(n).map((function(t){return new i(t)}))}))}I.Alert=[g,'[data-dismiss="alert"]'],I.Button=[p,'[data-toggle="buttons"]'],I.Carousel=[w,'[data-ride="carousel"]'],I.Collapse=[A,'[data-toggle="collapse"]'],I.Dropdown=[E,'[data-toggle="dropdown"]'],I.Modal=[k,'[data-toggle="modal"]'],I.Popover=[P,'[data-toggle="popover"],[data-tip="popover"]'],I.ScrollSpy=[H,'[data-spy="scroll"]'],I.Tab=[M,'[data-toggle="tab"]'],I.Toast=[S,'[data-dismiss="toast"]'],I.Tooltip=[B,'[data-toggle="tooltip"],[data-tip="tooltip"]'],document.body?D():document.addEventListener("DOMContentLoaded",(function t(){D(),document.removeEventListener("DOMContentLoaded",t,!1)}),!1);var X={Alert:g,Button:p,Carousel:w,Collapse:A,Dropdown:E,Modal:k,Popover:P,ScrollSpy:H,Tab:M,Toast:S,Tooltip:B,initCallback:D,removeDataAPI:function(t){var e=t instanceof Element?t:document;Object.keys(I).forEach((function(t){var i,n;i=t,n=e.querySelectorAll(I[t][1]),Array.from(n).map((function(t){return t[i].dispose()}))}))},componentsInit:I,Version:"4.1.0alpha4"};export{X as default}; +// Native JavaScript for Bootstrap v4.1.0alpha5 | 2022 © dnp_theme | MIT-License +var t=document.head,e="webkitTransition"in t.style||"transition"in t.style,i="webkitTransition"in t.style?"webkitTransitionEnd":"transitionend",n="webkitTransition"in t.style?"webkitTransitionDelay":"transitionDelay",a="webkitTransition"in t.style?"webkitTransitionProperty":"transitionProperty";function o(t,e){var i=getComputedStyle(t);return e in i?i[e]:""}var s="webkitTransition"in t.style?"webkitTransitionDuration":"transitionDuration";function l(t){var i=o(t,a),n=o(t,s),l=n.includes("ms")?1:1e3,r=e&&i&&"none"!==i?parseFloat(n)*l:0;return Number.isNaN(r)?0:r}function r(t,s){var r=0,c=new Event(i),d=l(t),u=function(t){var i=o(t,a),s=o(t,n),l=s.includes("ms")?1:1e3,r=e&&i&&"none"!==i?parseFloat(s)*l:0;return Number.isNaN(r)?0:r}(t);if(e&&d){var m=function(e){e.target===t&&(s.apply(t,[e]),t.removeEventListener(i,m),r=1)};t.addEventListener(i,m),setTimeout((function(){r||t.dispatchEvent(c)}),d+u+17)}else s.apply(t,[c])}function c(t){return t instanceof HTMLElement?t.ownerDocument:t instanceof Window?t.document:window.document}var d=[Document,Element,HTMLElement],u=[Element,HTMLElement];function m(t,e){var i=d.some((function(t){return e instanceof t}))?e:c();return u.some((function(e){return t instanceof e}))?t:i.querySelector(t)}function f(t,e,i){var n=new CustomEvent(t+".bs."+e,{cancelable:!0});return void 0!==i&&Object.keys(i).forEach((function(t){Object.defineProperty(n,t,{value:i[t]})})),n}function h(t){this&&this.dispatchEvent(t)}function g(t){var e,i,n=this,a=f("close","alert"),o=f("closed","alert");function s(t){e[t?"addEventListener":"removeEventListener"]("click",l,!1)}function l(t){i=t&&t.target.closest(".alert"),(e=m('[data-dismiss="alert"]',i))&&i&&(e===t.target||e.contains(t.target))&&n.close()}function c(){s(),i.parentNode.removeChild(i),h.call(i,o)}n.close=function(){if(i&&e&&i.classList.contains("show")){if(h.call(i,a),a.defaultPrevented)return;n.dispose(),i.classList.remove("show"),i.classList.contains("fade")?r(i,c):c()}},n.dispose=function(){s(),delete e.Alert},e=m(t),i=e.closest(".alert"),e.Alert&&e.Alert.dispose(),e.Alert||s(1),n.element=e,e.Alert=n}function p(t){var e,i,n=f("change","button");function a(t){var a=t.target,o=a.closest("LABEL"),s=null;"LABEL"===a.tagName?s=a:o&&(s=o);var l=s&&s.getElementsByTagName("INPUT")[0];if(l){if(h.call(l,n),h.call(e,n),"checkbox"===l.type){if(n.defaultPrevented)return;l.checked?(s.classList.remove("active"),l.getAttribute("checked"),l.removeAttribute("checked"),l.checked=!1):(s.classList.add("active"),l.getAttribute("checked"),l.setAttribute("checked","checked"),l.checked=!0),e.toggled||(e.toggled=!0)}if("radio"===l.type&&!e.toggled){if(n.defaultPrevented)return;(!l.checked||0===t.screenX&&0===t.screenY)&&(s.classList.add("active"),s.classList.add("focus"),l.setAttribute("checked","checked"),l.checked=!0,e.toggled=!0,Array.from(i).forEach((function(t){var e=t.getElementsByTagName("INPUT")[0];t!==s&&t.classList.contains("active")&&(h.call(e,n),t.classList.remove("active"),e.removeAttribute("checked"),e.checked=!1)})))}setTimeout((function(){e.toggled=!1}),50)}}function o(t){32===(t.which||t.keyCode)&&t.target===document.activeElement&&a(t)}function s(t){32===(t.which||t.keyCode)&&t.preventDefault()}function l(t){if("INPUT"===t.target.tagName){var e="focusin"===t.type?"add":"remove";t.target.closest(".btn").classList[e]("focus")}}function r(t){var i=t?"addEventListener":"removeEventListener";e[i]("click",a,!1),e[i]("keyup",o,!1),e[i]("keydown",s,!1),e[i]("focusin",l,!1),e[i]("focusout",l,!1)}this.dispose=function(){r(),delete e.Button},(e=m(t)).Button&&e.Button.dispose(),(i=e.getElementsByClassName("btn")).length&&(e.Button||r(1),e.toggled=!1,e.Button=this,Array.from(i).forEach((function(t){var e=m("input:checked",t);!t.classList.contains("active")&&e&&t.classList.add("active"),t.classList.contains("active")&&!e&&t.classList.remove("active")})))}var v="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],L={passive:!0};var b=function(t){var e=function(t,e){var i=t.getBoundingClientRect(),n=i.width,a=i.height,o=i.top,s=i.right,l=i.bottom,r=i.left,c=1,d=1;if(e&&t instanceof HTMLElement){var u=t.offsetWidth,m=t.offsetHeight;c=u>0&&Math.round(n)/u||1,d=m>0&&Math.round(a)/m||1}return{width:n/c,height:a/d,top:o/d,right:s/c,bottom:l/d,left:r/c,x:r/c,y:o/d}}(t),i=e.top,n=e.bottom;return i<=c(t).documentElement.clientHeight&&n>=0},y=function(t){return t.offsetHeight};function w(t,e){var i,n,a,o,s,c,d,u,g,p,w,A,T,E=e||{},k=this;function x(){!1===c.interval||o.classList.contains("paused")||(o.classList.add("paused"),s.isSliding||(clearInterval(s.timer),s.timer=null))}function C(){!1!==c.interval&&o.classList.contains("paused")&&(o.classList.remove("paused"),s.isSliding||(clearInterval(s.timer),s.timer=null,k.cycle()))}function N(t){if(t.preventDefault(),!s.isSliding){var e=t.target;e&&!e.classList.contains("active")&&e.getAttribute("data-slide-to")&&(s.index=+e.getAttribute("data-slide-to"),k.slideTo(s.index))}}function P(t){if(t.preventDefault(),!s.isSliding){var e=t.currentTarget||t.srcElement;e===w?s.index+=1:e===p&&(s.index-=1),k.slideTo(s.index)}}function H(t){var e=t.which;if(!s.isSliding){switch(e){case 39:s.index+=1;break;case 37:s.index-=1;break;default:return}k.slideTo(s.index)}}function M(t){var e=t?"addEventListener":"removeEventListener";c.pause&&c.interval&&(o[e](v[0],x,!1),o[e](v[1],C,!1),o[e]("touchstart",x,L),o[e]("touchend",C,L)),c.touch&&g.length>1&&o[e]("touchstart",B,L),w&&w[e]("click",P,!1),p&&p[e]("click",P,!1),A&&A[e]("click",N,!1),c.keyboard&&window[e]("keydown",H,!1)}function S(t){var e=t?"addEventListener":"removeEventListener";o[e]("touchmove",I,L),o[e]("touchend",D,L)}function B(t){s.isTouch||(s.touchPosition.startX=t.changedTouches[0].pageX,o.contains(t.target)&&(s.isTouch=!0,S(1)))}function I(t){s.isTouch?(s.touchPosition.currentX=t.changedTouches[0].pageX,"touchmove"===t.type&&t.changedTouches.length>1&&t.preventDefault()):t.preventDefault()}function D(t){if(s.isTouch&&!s.isSliding&&(s.touchPosition.endX=s.touchPosition.currentX||t.changedTouches[0].pageX,s.isTouch)){if((!o.contains(t.target)||!o.contains(t.relatedTarget))&&Math.abs(s.touchPosition.startX-s.touchPosition.endX)<75)return;s.touchPosition.currentXs.touchPosition.startX&&(s.index-=1),s.isTouch=!1,k.slideTo(s.index),S()}}function X(t){Array.from(T).forEach((function(t){return t.classList.remove("active")})),T[t]&&T[t].classList.add("active")}function R(t){if(s.touchPosition){var e=s.index,i=t&&t.target!==g[e]?1e3*t.elapsedTime+100:20,n=k.getActiveIndex(),a="left"===s.direction?"next":"prev";s.isSliding&&setTimeout((function(){s.touchPosition&&(s.isSliding=!1,g[e].classList.add("active"),g[n].classList.remove("active"),g[e].classList.remove("carousel-item-"+a),g[e].classList.remove("carousel-item-"+s.direction),g[n].classList.remove("carousel-item-"+s.direction),h.call(o,u),document.hidden||!c.interval||o.classList.contains("paused")||k.cycle())}),i)}}if(k.cycle=function(){s.timer&&(clearInterval(s.timer),s.timer=null),s.timer=setInterval((function(){var t=s.index||k.getActiveIndex();b(o)&&(t+=1,k.slideTo(t))}),c.interval)},k.slideTo=function(t){if(!s.isSliding){var e=k.getActiveIndex(),i=t;if(e!==i){ei||e===g.length-1&&0===i)&&(s.direction="right"),i<0?i=g.length-1:i>=g.length&&(i=0);var n="left"===s.direction?"next":"prev",a={relatedTarget:g[i],direction:s.direction,from:e,to:i};d=f("slide","carousel",a),u=f("slid","carousel",a),h.call(o,d),d.defaultPrevented||(s.index=i,s.isSliding=!0,clearInterval(s.timer),s.timer=null,X(i),l(g[i])&&o.classList.contains("slide")?(g[i].classList.add("carousel-item-"+n),y(g[i]),g[i].classList.add("carousel-item-"+s.direction),g[e].classList.add("carousel-item-"+s.direction),r(g[i],R)):(g[i].classList.add("active"),y(g[i]),g[e].classList.remove("active"),setTimeout((function(){s.isSliding=!1,c.interval&&o&&!o.classList.contains("paused")&&k.cycle(),h.call(o,u)}),100)))}}},k.getActiveIndex=function(){return Array.from(g).indexOf(o.getElementsByClassName("carousel-item active")[0])||0},k.dispose=function(){var t=["left","right","prev","next"];Array.from(g).forEach((function(e,i){e.classList.contains("active")&&X(i),t.forEach((function(t){return e.classList.remove("carousel-item-"+t)}))})),clearInterval(s.timer),M(),s={},c={},delete o.Carousel},(o=m(t)).Carousel&&o.Carousel.dispose(),g=o.getElementsByClassName("carousel-item"),i=o.getElementsByClassName("carousel-control-prev"),p=i[0],n=o.getElementsByClassName("carousel-control-next"),w=n[0],a=o.getElementsByClassName("carousel-indicators"),A=a[0],T=A&&A.getElementsByTagName("LI")||[],!(g.length<2)){var W=o.getAttribute("data-interval"),O="false"===W?0:+W,j="false"===o.getAttribute("data-touch")?0:1,z="hover"===o.getAttribute("data-pause")||!1,U="true"===o.getAttribute("data-keyboard")||!1,q=E.interval,F=E.touch;(c={}).keyboard=!0===E.keyboard||U,c.pause=!("hover"!==E.pause&&!z)&&"hover",c.touch=F||j,c.interval=5e3,"number"==typeof q?c.interval=q:!1===q||0===O||!1===O?c.interval=0:Number.isNaN(O)||(c.interval=O),k.getActiveIndex()<0&&(g.length&&g[0].classList.add("active"),T.length&&X(0)),(s={}).direction="left",s.index=0,s.timer=null,s.isSliding=!1,s.isTouch=!1,s.touchPosition={startX:0,currentX:0,endX:0},M(1),c.interval&&k.cycle(),o.Carousel=k}}function A(t,e){var i,n,a,o,s,l,c,d=e||{},u=this,g=null,p=null;function v(t,e){h.call(t,l),l.defaultPrevented||(t.isAnimating=!0,t.style.height=t.scrollHeight+"px",t.classList.remove("collapse"),t.classList.remove("show"),t.classList.add("collapsing"),y(t),t.style.height="0px",r(t,(function(){t.isAnimating=!1,t.setAttribute("aria-expanded","false"),e.setAttribute("aria-expanded","false"),t.classList.remove("collapsing"),t.classList.add("collapse"),t.style.height="",h.call(t,c)})))}u.toggle=function(t){(t&&"A"===t.target.tagName||"A"===i.tagName)&&t.preventDefault(),(i.contains(t.target)||t.target===i)&&(p.classList.contains("show")?u.hide():u.show())},u.hide=function(){p.isAnimating||(v(p,i),i.classList.add("collapsed"))},u.show=function(){var t,e,l;g&&(t=g.getElementsByClassName("collapse show"),n=t[0],a=n&&(m('[data-target="#'+n.id+'"]',g)||m('[href="#'+n.id+'"]',g))),p.isAnimating||(a&&n!==p&&(v(n,a),a.classList.add("collapsed")),e=p,l=i,h.call(e,o),o.defaultPrevented||(e.isAnimating=!0,e.classList.add("collapsing"),e.classList.remove("collapse"),e.style.height=e.scrollHeight+"px",r(e,(function(){e.isAnimating=!1,e.setAttribute("aria-expanded","true"),l.setAttribute("aria-expanded","true"),e.classList.remove("collapsing"),e.classList.add("collapse"),e.classList.add("show"),e.style.height="",h.call(e,s)}))),i.classList.remove("collapsed"))},u.dispose=function(){i.removeEventListener("click",u.toggle,!1),delete i.Collapse},(i=m(t)).Collapse&&i.Collapse.dispose();var L=i.getAttribute("data-parent");o=f("show","collapse"),s=f("shown","collapse"),l=f("hide","collapse"),c=f("hidden","collapse"),null!==(p=m(d.target||i.getAttribute("data-target")||i.getAttribute("href")))&&(p.isAnimating=!1);var b=d.parent||L;g=b?i.closest(b):null,i.Collapse||i.addEventListener("click",u.toggle,!1),i.Collapse=u}var T=function(t){return t.focus()};function E(t,e){var i,n,a,o,s,l,r,c,d=this,u=null,g=[];function p(t){(t.hasAttribute("href")&&"#"===t.href.slice(-1)||t.parentNode&&t.parentNode.hasAttribute("href")&&"#"===t.parentNode.href.slice(-1))&&this.preventDefault()}function v(){var t=i.open?"addEventListener":"removeEventListener";document[t]("click",L,!1),document[t]("keydown",y,!1),document[t]("keyup",w,!1),document[t]("focus",L,!1)}function L(t){var e=t.target;if(e.getAttribute){var n=e&&e.getAttribute("data-toggle")||e.parentNode&&e.parentNode.getAttribute&&e.parentNode.getAttribute("data-toggle");("focus"!==t.type||e!==i&&e!==r&&!r.contains(e))&&(e!==r&&!r.contains(e)||!c&&!n)&&(u=e===i||i.contains(e)?i:null,d.hide(),p.call(t,e))}}function b(t){u=i,d.show(),p.call(t,t.target)}function y(t){var e=t.which||t.keyCode;38!==e&&40!==e||t.preventDefault()}function w(t){var e=t.which||t.keyCode,n=document.activeElement,a=n===i,o=r.contains(n),s=n.parentNode===r||n.parentNode.parentNode===r,l=g.indexOf(n);s&&(a?l=0:38===e?l=l>1?l-1:0:40===e&&(l=l=d,w=m.top+c/2+g/2>=u,A=m.top-c<0,T=m.left-r<0,E=m.top+c+g>=u,k=m.left+r+h>=d,x=i;x="right"===(x="left"===(x="bottom"===(x="top"===(x=("left"===x||"right"===x)&&T&&k?"top":x)&&A?"bottom":x)&&E?"top":x)&&T?"right":x)&&k?"left":x,-1===e.className.indexOf(x)&&(e.className=e.className.replace(/\b(top|bottom|left|right)+/,x));var N=v.offsetWidth,P=v.offsetHeight;"left"===x||"right"===x?(o="left"===x?m.left+f.x-r-(p?N:0):m.left+f.x+h,L?(a=m.top+f.y,s=g/2-N):w?(a=m.top+f.y-c+g,s=c-g/2-N):(a=m.top+f.y-c/2+g/2,s=c/2-(p?.9*P:P/2))):"top"!==x&&"bottom"!==x||(a="top"===x?m.top+f.y-c-(p?P:0):m.top+f.y+g,b?(o=0,l=m.left+h/2-N):y?(o=d-1.01*r,l=r-(d-m.left)+h/2-N/2):(o=m.left+f.x-r/2+h/2,l=r/2-(p?N:N/2))),e.style.top=a+"px",e.style.left=o+"px",s&&(v.style.top=s+"px"),l&&(v.style.left=l+"px")}function P(t,e){var i,n,a,o,s,l,c,d,u,g=e||{},p=this,b=null,y=0,w=/(iPhone|iPod|iPad)/.test(navigator.userAgent),A={};function T(t){null!==b&&t.target===m(".close",b)&&p.hide()}function E(t){return g[t]||i.dataset[t]||null}function k(){return E("title")}function C(){return E("content")}function P(){null===b&&i.focus()}function H(t){var e=t?"addEventListener":"removeEventListener";"hover"===A.trigger?(i[e](x,p.show),i[e](v[0],p.show),A.dismissible||i[e](v[1],p.hide)):"click"===A.trigger?i[e](A.trigger,p.toggle):"focus"===A.trigger&&(w&&i[e]("click",P,!1),i[e](A.trigger,p.toggle))}function M(t){b&&b.contains(t.target)||t.target===i||i.contains(t.target)||p.hide()}function S(t){var e=t?"addEventListener":"removeEventListener";A.dismissible?document[e]("click",T,!1):("focus"===A.trigger&&i[e]("blur",p.hide),"hover"===A.trigger&&document[e]("touchstart",M,L)),window[e]("resize",p.hide,L)}function B(){S(1),h.call(i,c)}function I(){S(),A.container.removeChild(b),y=null,b=null,h.call(i,u)}p.toggle=function(){null===b?p.show():p.hide()},p.show=function(){clearTimeout(y),y=setTimeout((function(){if(null===b){if(h.call(i,l),l.defaultPrevented)return;!function(){n=k(),a=(a=C())?a.trim():null,b=document.createElement("div");var t=document.createElement("div");if(t.classList.add("arrow"),b.appendChild(t),null!==a&&null===A.template){if(b.setAttribute("role","tooltip"),null!==n){var e=document.createElement("h3");e.classList.add("popover-header"),e.innerHTML=A.dismissible?n+s:n,b.appendChild(e)}var i=document.createElement("div");i.classList.add("popover-body"),i.innerHTML=A.dismissible&&null===n?a+s:a,b.appendChild(i)}else{var l=document.createElement("div");l.innerHTML=A.template.trim(),b.className=l.firstChild.className,b.innerHTML=l.firstChild.innerHTML;var r=m(".popover-header",b),c=m(".popover-body",b);n&&r&&(r.innerHTML=n.trim()),a&&c&&(c.innerHTML=a.trim())}A.container.appendChild(b),b.style.display="block",b.classList.contains("popover")||b.classList.add("popover"),b.classList.contains(A.animation)||b.classList.add(A.animation),b.classList.contains(o)||b.classList.add(o)}(),N(i,b,A.placement,A.container),b.classList.contains("show")||b.classList.add("show"),A.animation?r(b,B):B()}}),20)},p.hide=function(){clearTimeout(y),y=setTimeout((function(){if(b&&null!==b&&b.classList.contains("show")){if(h.call(i,d),d.defaultPrevented)return;b.classList.remove("show"),A.animation?r(b,I):I()}}),A.delay)},p.dispose=function(){p.hide(),H(),delete i.Popover},(i=m(t)).Popover&&i.Popover.dispose();var D=i.getAttribute("data-trigger"),X=i.getAttribute("data-animation"),R=i.getAttribute("data-placement"),W=i.getAttribute("data-dismissible"),O=i.getAttribute("data-delay"),j=i.getAttribute("data-container");s='',l=f("show","popover"),c=f("shown","popover"),d=f("hide","popover"),u=f("hidden","popover");var z=m(g.container),U=m(j),q=i.closest(".modal"),F=i.closest(".fixed-top"),Y=i.closest(".fixed-bottom");A.template=g.template?g.template:null,A.trigger=g.trigger?g.trigger:D||"hover",A.animation=g.animation&&"fade"!==g.animation?g.animation:X||"fade",A.placement=g.placement?g.placement:R||"top",A.delay=parseInt(g.delay||O,10)||200,A.dismissible=!(!g.dismissible&&"true"!==W),A.container=z||U||F||Y||q||document.body,o="bs-popover-"+A.placement,n=k(),((a=C())||A.template)&&(i.Popover||H(1),i.Popover=p)}function H(t,e){var i,n,a,o,s,l=e||{},r=this,c={};function d(){var t,e,s;(a=o.getElementsByTagName("A"),n.scrollTop=n.isWindow?C().y:i.scrollTop,n.length!==a.length||g()!==n.scrollHeight)&&(n.items=[],n.offsets=[],n.scrollHeight=g(),n.maxScroll=n.scrollHeight-(n.isWindow?window.innerHeight:i.getBoundingClientRect().height),Array.from(a).forEach((function(i){t=i.getAttribute("href"),(e=t&&"#"===t.charAt(0)&&"#"!==t.slice(-1)&&m(t))&&(n.items.push(i),s=e.getBoundingClientRect(),n.offsets.push((n.isWindow?s.top+n.scrollTop:e.offsetTop)-c.offset))})),n.length=n.items.length)}function u(t){var e=t?"addEventListener":"removeEventListener";s[e]("scroll",r.refresh,L),window[e]("resize",r.refresh,L)}function g(){return s.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function p(){Array.from(a).map((function(t){return t.classList.contains("active")&&t.classList.remove("active")}))}function v(t){var e,a=t;p(),n.activeItem=a,a.classList.add("active");for(var o=[];a.parentNode!==document.body;)((e=(a=a.parentNode).classList).contains("dropdown-menu")||e.contains("nav"))&&o.push(a);o.forEach((function(t){var e=t.previousElementSibling;e&&!e.classList.contains("active")&&e.classList.add("active")})),h.call(i,f("activate","scrollspy",{relatedTarget:n.activeItem}))}r.refresh=function(){if(d(),n.scrollTop>=n.maxScroll){var t=n.items[n.length-1];n.activeItem!==t&&v(t)}else{if(n.activeItem&&n.scrollTop0)return n.activeItem=null,void p();for(var e=n.length;e>-1;)n.activeItem!==n.items[e]&&n.scrollTop>=n.offsets[e]&&(void 0===n.offsets[e+1]||n.scrollTop1&&(g=t[t.length-1]):g=t[0],g}function P(){return m(N().getAttribute("href"))}function H(t){t.preventDefault(),u=t.currentTarget,a.isAnimating||T.show()}T.show=function(){if(!(u=u||n).classList.contains("active")){if(v=m(u.getAttribute("href")),g=N(),p=P(),c=f("hide","tab",{relatedTarget:u}),h.call(g,c),c.defaultPrevented)return;a.isAnimating=!0,g.classList.remove("active"),g.setAttribute("aria-selected","false"),u.classList.add("active"),u.setAttribute("aria-selected","true"),o&&(n.parentNode.classList.contains("dropdown-menu")?o.classList.contains("active")||o.classList.add("active"):o.classList.contains("active")&&o.classList.remove("active")),p.classList.contains("fade")?(p.classList.remove("show"),r(p,C)):C()}},T.dispose=function(){n.removeEventListener("click",H,!1),delete n.Tab},(n=m(t)).Tab&&n.Tab.dispose();var M=n.getAttribute("data-height");a=n.closest(".nav"),o=a&&m(".dropdown-toggle",a);var S=!(!e||!1===A.height||"false"===M);a.isAnimating=!1,n.Tab||n.addEventListener("click",H,!1),S&&(E=P().parentNode),n.Tab=T}function S(t,e){var i,n,a,o,s,l,c=e||{},d=this,u=0,g={};function p(){n.classList.remove("showing"),n.classList.add("show"),h.call(n,s),g.autohide&&d.hide()}function v(){n.classList.add("hide"),h.call(n,l)}function L(){n.classList.remove("show"),g.animation?r(n,v):v()}function b(){clearTimeout(u),i.removeEventListener("click",d.hide,!1),delete i.Toast}d.show=function(){if(n&&!n.classList.contains("show")){if(h.call(n,a),a.defaultPrevented)return;g.animation&&n.classList.add("fade"),n.classList.remove("hide"),y(n),n.classList.add("showing"),g.animation?r(n,p):p()}},d.hide=function(t){if(n&&n.classList.contains("show")){if(h.call(n,o),o.defaultPrevented)return;t?L():u=setTimeout(L,g.delay)}},d.dispose=function(){g.animation?r(n,b):b()},(i=m(t)).Toast&&i.Toast.dispose(),n=i.closest(".toast");var w=i.getAttribute("data-animation"),A=i.getAttribute("data-autohide"),T=i.getAttribute("data-delay");a=f("show","toast"),o=f("hide","toast"),s=f("shown","toast"),l=f("hidden","toast"),g.animation=!1===c.animation||"false"===w?0:1,g.autohide=!1===c.autohide||"false"===A?0:1,g.delay=parseInt(c.delay||T,10)||500,i.Toast||i.addEventListener("click",d.hide,!1),i.Toast=d}function B(t,e){var i,n,a,o,s,l,c,d=e||{},u=this,g=null,p=0,b={};function y(){return i.getAttribute("title")||i.getAttribute("data-title")||i.getAttribute("data-original-title")}function w(t){g&&g.contains(t.target)||t.target===i||i.contains(t.target)||u.hide()}function A(t){var e=t?"addEventListener":"removeEventListener";document[e]("touchstart",w,L),window[e]("resize",u.hide,L)}function T(){A(1),h.call(i,s)}function E(){A(),b.container.removeChild(g),g=null,p=null,h.call(i,c)}function k(t){var e=t?"addEventListener":"removeEventListener";i[e](x,u.show,!1),i[e](v[0],u.show,!1),i[e](v[1],u.hide,!1)}u.show=function(){clearTimeout(p),p=setTimeout((function(){if(null===g){if(h.call(i,o),o.defaultPrevented)return;!1!==function(){if(n=y()){if(g=document.createElement("div"),b.template){var t=document.createElement("div");t.innerHTML=b.template.trim(),g.className=t.firstChild.className,g.innerHTML=t.firstChild.innerHTML,m(".tooltip-inner",g).innerHTML=n.trim()}else{var e=document.createElement("div");e.classList.add("arrow"),g.appendChild(e);var i=document.createElement("div");i.classList.add("tooltip-inner"),g.appendChild(i),i.innerHTML=n}g.style.left="0",g.style.top="0",g.setAttribute("role","tooltip"),g.classList.contains("tooltip")||g.classList.add("tooltip"),g.classList.contains(b.animation)||g.classList.add(b.animation),g.classList.contains(a)||g.classList.add(a),b.container.appendChild(g)}}()&&(N(i,g,b.placement,b.container),g.classList.contains("show")||g.classList.add("show"),b.animation?r(g,T):T())}}),20)},u.hide=function(){clearTimeout(p),p=setTimeout((function(){if(g&&g.classList.contains("show")){if(h.call(i,l),l.defaultPrevented)return;g.classList.remove("show"),b.animation?r(g,E):E()}}),b.delay)},u.toggle=function(){g?u.hide():u.show()},u.dispose=function(){k(),u.hide(),i.setAttribute("title",i.getAttribute("data-original-title")),i.removeAttribute("data-original-title"),delete i.Tooltip},(i=m(t)).Tooltip&&i.Tooltip.dispose();var C=i.getAttribute("data-animation"),P=i.getAttribute("data-placement"),H=i.getAttribute("data-delay"),M=i.getAttribute("data-container"),S=m(d.container),B=m(M),I=i.closest(".modal");o=f("show","tooltip"),s=f("shown","tooltip"),l=f("hide","tooltip"),c=f("hidden","tooltip");var D=i.closest(".fixed-top"),X=i.closest(".fixed-bottom");b.animation=d.animation&&"fade"!==d.animation?d.animation:C||"fade",b.placement=d.placement?d.placement:P||"top",b.template=d.template?d.template:null,b.delay=parseInt(d.delay||H,10)||200,b.container=S||B||D||X||I||document.body,a="bs-tooltip-"+b.placement,(n=y())&&(i.Tooltip||(i.setAttribute("data-original-title",n),i.removeAttribute("title"),k(1)),i.Tooltip=u)}var I={};function D(t){var e=t instanceof Element?t:document;Object.keys(I).forEach((function(t){var i,n;i=I[t][0],n=e.querySelectorAll(I[t][1]),Array.from(n).map((function(t){return new i(t)}))}))}I.Alert=[g,'[data-dismiss="alert"]'],I.Button=[p,'[data-toggle="buttons"]'],I.Carousel=[w,'[data-ride="carousel"]'],I.Collapse=[A,'[data-toggle="collapse"]'],I.Dropdown=[E,'[data-toggle="dropdown"]'],I.Modal=[k,'[data-toggle="modal"]'],I.Popover=[P,'[data-toggle="popover"],[data-tip="popover"]'],I.ScrollSpy=[H,'[data-spy="scroll"]'],I.Tab=[M,'[data-toggle="tab"]'],I.Toast=[S,'[data-dismiss="toast"]'],I.Tooltip=[B,'[data-toggle="tooltip"],[data-tip="tooltip"]'],document.body?D():document.addEventListener("DOMContentLoaded",(function t(){D(),document.removeEventListener("DOMContentLoaded",t,!1)}),!1);var X={Alert:g,Button:p,Carousel:w,Collapse:A,Dropdown:E,Modal:k,Popover:P,ScrollSpy:H,Tab:M,Toast:S,Tooltip:B,initCallback:D,removeDataAPI:function(t){var e=t instanceof Element?t:document;Object.keys(I).forEach((function(t){var i,n;i=t,n=e.querySelectorAll(I[t][1]),Array.from(n).map((function(t){return t[i].dispose()}))}))},componentsInit:I,Version:"4.1.0alpha5"};export{X as default}; diff --git a/dist/bootstrap-native-v4.js b/dist/bootstrap-native-v4.js index e23af749..e7377355 100644 --- a/dist/bootstrap-native-v4.js +++ b/dist/bootstrap-native-v4.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -149,7 +149,7 @@ /** * A global array of possible `ParentNode`. */ - var parentNodes = [Document, Node, Element, HTMLElement]; + var parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -161,19 +161,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - var selectorIsString = typeof selector === 'string'; - var lookUp = parent && parentNodes.some(function (x) { return parent instanceof x; }) + var lookUp = parentNodes.some(function (x) { return parent instanceof x; }) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some(function (x) { return selector instanceof x; })) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some(function (x) { return selector instanceof x; }) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** BSN v4 custom event */ @@ -2585,7 +2583,7 @@ }); } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; var Version = version; diff --git a/dist/bootstrap-native-v4.min.js b/dist/bootstrap-native-v4.min.js index 07de262d..83c32620 100644 --- a/dist/bootstrap-native-v4.min.js +++ b/dist/bootstrap-native-v4.min.js @@ -1,2 +1,2 @@ -// Native JavaScript for Bootstrap v4.1.0alpha4 | 2022 © dnp_theme | MIT-License -!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).BSN=e()}(this,(function(){"use strict";var t=document.head,e="webkitTransition"in t.style||"transition"in t.style,i="webkitTransition"in t.style?"webkitTransitionEnd":"transitionend",n="webkitTransition"in t.style?"webkitTransitionDelay":"transitionDelay",a="webkitTransition"in t.style?"webkitTransitionProperty":"transitionProperty";function o(t,e){var i=getComputedStyle(t);return e in i?i[e]:""}var s="webkitTransition"in t.style?"webkitTransitionDuration":"transitionDuration";function l(t){var i=o(t,a),n=o(t,s),l=n.includes("ms")?1:1e3,r=e&&i&&"none"!==i?parseFloat(n)*l:0;return Number.isNaN(r)?0:r}function r(t,s){var r=0,c=new Event(i),d=l(t),u=function(t){var i=o(t,a),s=o(t,n),l=s.includes("ms")?1:1e3,r=e&&i&&"none"!==i?parseFloat(s)*l:0;return Number.isNaN(r)?0:r}(t);if(e&&d){var m=function(e){e.target===t&&(s.apply(t,[e]),t.removeEventListener(i,m),r=1)};t.addEventListener(i,m),setTimeout((function(){r||t.dispatchEvent(c)}),d+u+17)}else s.apply(t,[c])}function c(t){return t instanceof HTMLElement?t.ownerDocument:t instanceof Window?t.document:window.document}var d=[Document,Node,Element,HTMLElement],u=[Element,HTMLElement];function m(t,e){var i="string"==typeof t,n=e&&d.some((function(t){return e instanceof t}))?e:c();return!i&&u.some((function(e){return t instanceof e}))?t:i?n.querySelector(t):null}function f(t,e,i){var n=new CustomEvent(t+".bs."+e,{cancelable:!0});return void 0!==i&&Object.keys(i).forEach((function(t){Object.defineProperty(n,t,{value:i[t]})})),n}function h(t){this&&this.dispatchEvent(t)}function g(t){var e,i,n=this,a=f("close","alert"),o=f("closed","alert");function s(t){e[t?"addEventListener":"removeEventListener"]("click",l,!1)}function l(t){i=t&&t.target.closest(".alert"),(e=m('[data-dismiss="alert"]',i))&&i&&(e===t.target||e.contains(t.target))&&n.close()}function c(){s(),i.parentNode.removeChild(i),h.call(i,o)}n.close=function(){if(i&&e&&i.classList.contains("show")){if(h.call(i,a),a.defaultPrevented)return;n.dispose(),i.classList.remove("show"),i.classList.contains("fade")?r(i,c):c()}},n.dispose=function(){s(),delete e.Alert},e=m(t),i=e.closest(".alert"),e.Alert&&e.Alert.dispose(),e.Alert||s(1),n.element=e,e.Alert=n}function p(t){var e,i,n=f("change","button");function a(t){var a=t.target,o=a.closest("LABEL"),s=null;"LABEL"===a.tagName?s=a:o&&(s=o);var l=s&&s.getElementsByTagName("INPUT")[0];if(l){if(h.call(l,n),h.call(e,n),"checkbox"===l.type){if(n.defaultPrevented)return;l.checked?(s.classList.remove("active"),l.getAttribute("checked"),l.removeAttribute("checked"),l.checked=!1):(s.classList.add("active"),l.getAttribute("checked"),l.setAttribute("checked","checked"),l.checked=!0),e.toggled||(e.toggled=!0)}if("radio"===l.type&&!e.toggled){if(n.defaultPrevented)return;(!l.checked||0===t.screenX&&0===t.screenY)&&(s.classList.add("active"),s.classList.add("focus"),l.setAttribute("checked","checked"),l.checked=!0,e.toggled=!0,Array.from(i).forEach((function(t){var e=t.getElementsByTagName("INPUT")[0];t!==s&&t.classList.contains("active")&&(h.call(e,n),t.classList.remove("active"),e.removeAttribute("checked"),e.checked=!1)})))}setTimeout((function(){e.toggled=!1}),50)}}function o(t){32===(t.which||t.keyCode)&&t.target===document.activeElement&&a(t)}function s(t){32===(t.which||t.keyCode)&&t.preventDefault()}function l(t){if("INPUT"===t.target.tagName){var e="focusin"===t.type?"add":"remove";t.target.closest(".btn").classList[e]("focus")}}function r(t){var i=t?"addEventListener":"removeEventListener";e[i]("click",a,!1),e[i]("keyup",o,!1),e[i]("keydown",s,!1),e[i]("focusin",l,!1),e[i]("focusout",l,!1)}this.dispose=function(){r(),delete e.Button},(e=m(t)).Button&&e.Button.dispose(),(i=e.getElementsByClassName("btn")).length&&(e.Button||r(1),e.toggled=!1,e.Button=this,Array.from(i).forEach((function(t){var e=m("input:checked",t);!t.classList.contains("active")&&e&&t.classList.add("active"),t.classList.contains("active")&&!e&&t.classList.remove("active")})))}var v="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],L={passive:!0};var b=function(t){var e=function(t,e){var i=t.getBoundingClientRect(),n=i.width,a=i.height,o=i.top,s=i.right,l=i.bottom,r=i.left,c=1,d=1;if(e&&t instanceof HTMLElement){var u=t.offsetWidth,m=t.offsetHeight;c=u>0&&Math.round(n)/u||1,d=m>0&&Math.round(a)/m||1}return{width:n/c,height:a/d,top:o/d,right:s/c,bottom:l/d,left:r/c,x:r/c,y:o/d}}(t),i=e.top,n=e.bottom;return i<=c(t).documentElement.clientHeight&&n>=0},y=function(t){return t.offsetHeight};function w(t,e){var i,n,a,o,s,c,d,u,g,p,w,A,T,E=e||{},k=this;function x(){!1===c.interval||o.classList.contains("paused")||(o.classList.add("paused"),s.isSliding||(clearInterval(s.timer),s.timer=null))}function N(){!1!==c.interval&&o.classList.contains("paused")&&(o.classList.remove("paused"),s.isSliding||(clearInterval(s.timer),s.timer=null,k.cycle()))}function C(t){if(t.preventDefault(),!s.isSliding){var e=t.target;e&&!e.classList.contains("active")&&e.getAttribute("data-slide-to")&&(s.index=+e.getAttribute("data-slide-to"),k.slideTo(s.index))}}function P(t){if(t.preventDefault(),!s.isSliding){var e=t.currentTarget||t.srcElement;e===w?s.index+=1:e===p&&(s.index-=1),k.slideTo(s.index)}}function H(t){var e=t.which;if(!s.isSliding){switch(e){case 39:s.index+=1;break;case 37:s.index-=1;break;default:return}k.slideTo(s.index)}}function M(t){var e=t?"addEventListener":"removeEventListener";c.pause&&c.interval&&(o[e](v[0],x,!1),o[e](v[1],N,!1),o[e]("touchstart",x,L),o[e]("touchend",N,L)),c.touch&&g.length>1&&o[e]("touchstart",B,L),w&&w[e]("click",P,!1),p&&p[e]("click",P,!1),A&&A[e]("click",C,!1),c.keyboard&&window[e]("keydown",H,!1)}function S(t){var e=t?"addEventListener":"removeEventListener";o[e]("touchmove",I,L),o[e]("touchend",D,L)}function B(t){s.isTouch||(s.touchPosition.startX=t.changedTouches[0].pageX,o.contains(t.target)&&(s.isTouch=!0,S(1)))}function I(t){s.isTouch?(s.touchPosition.currentX=t.changedTouches[0].pageX,"touchmove"===t.type&&t.changedTouches.length>1&&t.preventDefault()):t.preventDefault()}function D(t){if(s.isTouch&&!s.isSliding&&(s.touchPosition.endX=s.touchPosition.currentX||t.changedTouches[0].pageX,s.isTouch)){if((!o.contains(t.target)||!o.contains(t.relatedTarget))&&Math.abs(s.touchPosition.startX-s.touchPosition.endX)<75)return;s.touchPosition.currentXs.touchPosition.startX&&(s.index-=1),s.isTouch=!1,k.slideTo(s.index),S()}}function X(t){Array.from(T).forEach((function(t){return t.classList.remove("active")})),T[t]&&T[t].classList.add("active")}function R(t){if(s.touchPosition){var e=s.index,i=t&&t.target!==g[e]?1e3*t.elapsedTime+100:20,n=k.getActiveIndex(),a="left"===s.direction?"next":"prev";s.isSliding&&setTimeout((function(){s.touchPosition&&(s.isSliding=!1,g[e].classList.add("active"),g[n].classList.remove("active"),g[e].classList.remove("carousel-item-"+a),g[e].classList.remove("carousel-item-"+s.direction),g[n].classList.remove("carousel-item-"+s.direction),h.call(o,u),document.hidden||!c.interval||o.classList.contains("paused")||k.cycle())}),i)}}if(k.cycle=function(){s.timer&&(clearInterval(s.timer),s.timer=null),s.timer=setInterval((function(){var t=s.index||k.getActiveIndex();b(o)&&(t+=1,k.slideTo(t))}),c.interval)},k.slideTo=function(t){if(!s.isSliding){var e=k.getActiveIndex(),i=t;if(e!==i){ei||e===g.length-1&&0===i)&&(s.direction="right"),i<0?i=g.length-1:i>=g.length&&(i=0);var n="left"===s.direction?"next":"prev",a={relatedTarget:g[i],direction:s.direction,from:e,to:i};d=f("slide","carousel",a),u=f("slid","carousel",a),h.call(o,d),d.defaultPrevented||(s.index=i,s.isSliding=!0,clearInterval(s.timer),s.timer=null,X(i),l(g[i])&&o.classList.contains("slide")?(g[i].classList.add("carousel-item-"+n),y(g[i]),g[i].classList.add("carousel-item-"+s.direction),g[e].classList.add("carousel-item-"+s.direction),r(g[i],R)):(g[i].classList.add("active"),y(g[i]),g[e].classList.remove("active"),setTimeout((function(){s.isSliding=!1,c.interval&&o&&!o.classList.contains("paused")&&k.cycle(),h.call(o,u)}),100)))}}},k.getActiveIndex=function(){return Array.from(g).indexOf(o.getElementsByClassName("carousel-item active")[0])||0},k.dispose=function(){var t=["left","right","prev","next"];Array.from(g).forEach((function(e,i){e.classList.contains("active")&&X(i),t.forEach((function(t){return e.classList.remove("carousel-item-"+t)}))})),clearInterval(s.timer),M(),s={},c={},delete o.Carousel},(o=m(t)).Carousel&&o.Carousel.dispose(),g=o.getElementsByClassName("carousel-item"),i=o.getElementsByClassName("carousel-control-prev"),p=i[0],n=o.getElementsByClassName("carousel-control-next"),w=n[0],a=o.getElementsByClassName("carousel-indicators"),A=a[0],T=A&&A.getElementsByTagName("LI")||[],!(g.length<2)){var W=o.getAttribute("data-interval"),O="false"===W?0:+W,j="false"===o.getAttribute("data-touch")?0:1,z="hover"===o.getAttribute("data-pause")||!1,U="true"===o.getAttribute("data-keyboard")||!1,q=E.interval,F=E.touch;(c={}).keyboard=!0===E.keyboard||U,c.pause=!("hover"!==E.pause&&!z)&&"hover",c.touch=F||j,c.interval=5e3,"number"==typeof q?c.interval=q:!1===q||0===O||!1===O?c.interval=0:Number.isNaN(O)||(c.interval=O),k.getActiveIndex()<0&&(g.length&&g[0].classList.add("active"),T.length&&X(0)),(s={}).direction="left",s.index=0,s.timer=null,s.isSliding=!1,s.isTouch=!1,s.touchPosition={startX:0,currentX:0,endX:0},M(1),c.interval&&k.cycle(),o.Carousel=k}}function A(t,e){var i,n,a,o,s,l,c,d=e||{},u=this,g=null,p=null;function v(t,e){h.call(t,l),l.defaultPrevented||(t.isAnimating=!0,t.style.height=t.scrollHeight+"px",t.classList.remove("collapse"),t.classList.remove("show"),t.classList.add("collapsing"),y(t),t.style.height="0px",r(t,(function(){t.isAnimating=!1,t.setAttribute("aria-expanded","false"),e.setAttribute("aria-expanded","false"),t.classList.remove("collapsing"),t.classList.add("collapse"),t.style.height="",h.call(t,c)})))}u.toggle=function(t){(t&&"A"===t.target.tagName||"A"===i.tagName)&&t.preventDefault(),(i.contains(t.target)||t.target===i)&&(p.classList.contains("show")?u.hide():u.show())},u.hide=function(){p.isAnimating||(v(p,i),i.classList.add("collapsed"))},u.show=function(){var t,e,l;g&&(t=g.getElementsByClassName("collapse show"),n=t[0],a=n&&(m('[data-target="#'+n.id+'"]',g)||m('[href="#'+n.id+'"]',g))),p.isAnimating||(a&&n!==p&&(v(n,a),a.classList.add("collapsed")),e=p,l=i,h.call(e,o),o.defaultPrevented||(e.isAnimating=!0,e.classList.add("collapsing"),e.classList.remove("collapse"),e.style.height=e.scrollHeight+"px",r(e,(function(){e.isAnimating=!1,e.setAttribute("aria-expanded","true"),l.setAttribute("aria-expanded","true"),e.classList.remove("collapsing"),e.classList.add("collapse"),e.classList.add("show"),e.style.height="",h.call(e,s)}))),i.classList.remove("collapsed"))},u.dispose=function(){i.removeEventListener("click",u.toggle,!1),delete i.Collapse},(i=m(t)).Collapse&&i.Collapse.dispose();var L=i.getAttribute("data-parent");o=f("show","collapse"),s=f("shown","collapse"),l=f("hide","collapse"),c=f("hidden","collapse"),null!==(p=m(d.target||i.getAttribute("data-target")||i.getAttribute("href")))&&(p.isAnimating=!1);var b=d.parent||L;g=b?i.closest(b):null,i.Collapse||i.addEventListener("click",u.toggle,!1),i.Collapse=u}var T=function(t){return t.focus()};function E(t,e){var i,n,a,o,s,l,r,c,d=this,u=null,g=[];function p(t){(t.hasAttribute("href")&&"#"===t.href.slice(-1)||t.parentNode&&t.parentNode.hasAttribute("href")&&"#"===t.parentNode.href.slice(-1))&&this.preventDefault()}function v(){var t=i.open?"addEventListener":"removeEventListener";document[t]("click",L,!1),document[t]("keydown",y,!1),document[t]("keyup",w,!1),document[t]("focus",L,!1)}function L(t){var e=t.target;if(e.getAttribute){var n=e&&e.getAttribute("data-toggle")||e.parentNode&&e.parentNode.getAttribute&&e.parentNode.getAttribute("data-toggle");("focus"!==t.type||e!==i&&e!==r&&!r.contains(e))&&(e!==r&&!r.contains(e)||!c&&!n)&&(u=e===i||i.contains(e)?i:null,d.hide(),p.call(t,e))}}function b(t){u=i,d.show(),p.call(t,t.target)}function y(t){var e=t.which||t.keyCode;38!==e&&40!==e||t.preventDefault()}function w(t){var e=t.which||t.keyCode,n=document.activeElement,a=n===i,o=r.contains(n),s=n.parentNode===r||n.parentNode.parentNode===r,l=g.indexOf(n);s&&(a?l=0:38===e?l=l>1?l-1:0:40===e&&(l=l=d,w=m.top+c/2+g/2>=u,A=m.top-c<0,T=m.left-r<0,E=m.top+c+g>=u,k=m.left+r+h>=d,x=i;x="right"===(x="left"===(x="bottom"===(x="top"===(x=("left"===x||"right"===x)&&T&&k?"top":x)&&A?"bottom":x)&&E?"top":x)&&T?"right":x)&&k?"left":x,-1===e.className.indexOf(x)&&(e.className=e.className.replace(/\b(top|bottom|left|right)+/,x));var C=v.offsetWidth,P=v.offsetHeight;"left"===x||"right"===x?(o="left"===x?m.left+f.x-r-(p?C:0):m.left+f.x+h,L?(a=m.top+f.y,s=g/2-C):w?(a=m.top+f.y-c+g,s=c-g/2-C):(a=m.top+f.y-c/2+g/2,s=c/2-(p?.9*P:P/2))):"top"!==x&&"bottom"!==x||(a="top"===x?m.top+f.y-c-(p?P:0):m.top+f.y+g,b?(o=0,l=m.left+h/2-C):y?(o=d-1.01*r,l=r-(d-m.left)+h/2-C/2):(o=m.left+f.x-r/2+h/2,l=r/2-(p?C:C/2))),e.style.top=a+"px",e.style.left=o+"px",s&&(v.style.top=s+"px"),l&&(v.style.left=l+"px")}function P(t,e){var i,n,a,o,s,l,c,d,u,g=e||{},p=this,b=null,y=0,w=/(iPhone|iPod|iPad)/.test(navigator.userAgent),A={};function T(t){null!==b&&t.target===m(".close",b)&&p.hide()}function E(t){return g[t]||i.dataset[t]||null}function k(){return E("title")}function N(){return E("content")}function P(){null===b&&i.focus()}function H(t){var e=t?"addEventListener":"removeEventListener";"hover"===A.trigger?(i[e](x,p.show),i[e](v[0],p.show),A.dismissible||i[e](v[1],p.hide)):"click"===A.trigger?i[e](A.trigger,p.toggle):"focus"===A.trigger&&(w&&i[e]("click",P,!1),i[e](A.trigger,p.toggle))}function M(t){b&&b.contains(t.target)||t.target===i||i.contains(t.target)||p.hide()}function S(t){var e=t?"addEventListener":"removeEventListener";A.dismissible?document[e]("click",T,!1):("focus"===A.trigger&&i[e]("blur",p.hide),"hover"===A.trigger&&document[e]("touchstart",M,L)),window[e]("resize",p.hide,L)}function B(){S(1),h.call(i,c)}function I(){S(),A.container.removeChild(b),y=null,b=null,h.call(i,u)}p.toggle=function(){null===b?p.show():p.hide()},p.show=function(){clearTimeout(y),y=setTimeout((function(){if(null===b){if(h.call(i,l),l.defaultPrevented)return;!function(){n=k(),a=(a=N())?a.trim():null,b=document.createElement("div");var t=document.createElement("div");if(t.classList.add("arrow"),b.appendChild(t),null!==a&&null===A.template){if(b.setAttribute("role","tooltip"),null!==n){var e=document.createElement("h3");e.classList.add("popover-header"),e.innerHTML=A.dismissible?n+s:n,b.appendChild(e)}var i=document.createElement("div");i.classList.add("popover-body"),i.innerHTML=A.dismissible&&null===n?a+s:a,b.appendChild(i)}else{var l=document.createElement("div");l.innerHTML=A.template.trim(),b.className=l.firstChild.className,b.innerHTML=l.firstChild.innerHTML;var r=m(".popover-header",b),c=m(".popover-body",b);n&&r&&(r.innerHTML=n.trim()),a&&c&&(c.innerHTML=a.trim())}A.container.appendChild(b),b.style.display="block",b.classList.contains("popover")||b.classList.add("popover"),b.classList.contains(A.animation)||b.classList.add(A.animation),b.classList.contains(o)||b.classList.add(o)}(),C(i,b,A.placement,A.container),b.classList.contains("show")||b.classList.add("show"),A.animation?r(b,B):B()}}),20)},p.hide=function(){clearTimeout(y),y=setTimeout((function(){if(b&&null!==b&&b.classList.contains("show")){if(h.call(i,d),d.defaultPrevented)return;b.classList.remove("show"),A.animation?r(b,I):I()}}),A.delay)},p.dispose=function(){p.hide(),H(),delete i.Popover},(i=m(t)).Popover&&i.Popover.dispose();var D=i.getAttribute("data-trigger"),X=i.getAttribute("data-animation"),R=i.getAttribute("data-placement"),W=i.getAttribute("data-dismissible"),O=i.getAttribute("data-delay"),j=i.getAttribute("data-container");s='',l=f("show","popover"),c=f("shown","popover"),d=f("hide","popover"),u=f("hidden","popover");var z=m(g.container),U=m(j),q=i.closest(".modal"),F=i.closest(".fixed-top"),Y=i.closest(".fixed-bottom");A.template=g.template?g.template:null,A.trigger=g.trigger?g.trigger:D||"hover",A.animation=g.animation&&"fade"!==g.animation?g.animation:X||"fade",A.placement=g.placement?g.placement:R||"top",A.delay=parseInt(g.delay||O,10)||200,A.dismissible=!(!g.dismissible&&"true"!==W),A.container=z||U||F||Y||q||document.body,o="bs-popover-"+A.placement,n=k(),((a=N())||A.template)&&(i.Popover||H(1),i.Popover=p)}function H(t,e){var i,n,a,o,s,l=e||{},r=this,c={};function d(){var t,e,s;(a=o.getElementsByTagName("A"),n.scrollTop=n.isWindow?N().y:i.scrollTop,n.length!==a.length||g()!==n.scrollHeight)&&(n.items=[],n.offsets=[],n.scrollHeight=g(),n.maxScroll=n.scrollHeight-(n.isWindow?window.innerHeight:i.getBoundingClientRect().height),Array.from(a).forEach((function(i){t=i.getAttribute("href"),(e=t&&"#"===t.charAt(0)&&"#"!==t.slice(-1)&&m(t))&&(n.items.push(i),s=e.getBoundingClientRect(),n.offsets.push((n.isWindow?s.top+n.scrollTop:e.offsetTop)-c.offset))})),n.length=n.items.length)}function u(t){var e=t?"addEventListener":"removeEventListener";s[e]("scroll",r.refresh,L),window[e]("resize",r.refresh,L)}function g(){return s.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function p(){Array.from(a).map((function(t){return t.classList.contains("active")&&t.classList.remove("active")}))}function v(t){var e,a=t;p(),n.activeItem=a,a.classList.add("active");for(var o=[];a.parentNode!==document.body;)((e=(a=a.parentNode).classList).contains("dropdown-menu")||e.contains("nav"))&&o.push(a);o.forEach((function(t){var e=t.previousElementSibling;e&&!e.classList.contains("active")&&e.classList.add("active")})),h.call(i,f("activate","scrollspy",{relatedTarget:n.activeItem}))}r.refresh=function(){if(d(),n.scrollTop>=n.maxScroll){var t=n.items[n.length-1];n.activeItem!==t&&v(t)}else{if(n.activeItem&&n.scrollTop0)return n.activeItem=null,void p();for(var e=n.length;e>-1;)n.activeItem!==n.items[e]&&n.scrollTop>=n.offsets[e]&&(void 0===n.offsets[e+1]||n.scrollTop1&&(g=t[t.length-1]):g=t[0],g}function P(){return m(C().getAttribute("href"))}function H(t){t.preventDefault(),u=t.currentTarget,a.isAnimating||T.show()}T.show=function(){if(!(u=u||n).classList.contains("active")){if(v=m(u.getAttribute("href")),g=C(),p=P(),c=f("hide","tab",{relatedTarget:u}),h.call(g,c),c.defaultPrevented)return;a.isAnimating=!0,g.classList.remove("active"),g.setAttribute("aria-selected","false"),u.classList.add("active"),u.setAttribute("aria-selected","true"),o&&(n.parentNode.classList.contains("dropdown-menu")?o.classList.contains("active")||o.classList.add("active"):o.classList.contains("active")&&o.classList.remove("active")),p.classList.contains("fade")?(p.classList.remove("show"),r(p,N)):N()}},T.dispose=function(){n.removeEventListener("click",H,!1),delete n.Tab},(n=m(t)).Tab&&n.Tab.dispose();var M=n.getAttribute("data-height");a=n.closest(".nav"),o=a&&m(".dropdown-toggle",a);var S=!(!e||!1===A.height||"false"===M);a.isAnimating=!1,n.Tab||n.addEventListener("click",H,!1),S&&(E=P().parentNode),n.Tab=T}function S(t,e){var i,n,a,o,s,l,c=e||{},d=this,u=0,g={};function p(){n.classList.remove("showing"),n.classList.add("show"),h.call(n,s),g.autohide&&d.hide()}function v(){n.classList.add("hide"),h.call(n,l)}function L(){n.classList.remove("show"),g.animation?r(n,v):v()}function b(){clearTimeout(u),i.removeEventListener("click",d.hide,!1),delete i.Toast}d.show=function(){if(n&&!n.classList.contains("show")){if(h.call(n,a),a.defaultPrevented)return;g.animation&&n.classList.add("fade"),n.classList.remove("hide"),y(n),n.classList.add("showing"),g.animation?r(n,p):p()}},d.hide=function(t){if(n&&n.classList.contains("show")){if(h.call(n,o),o.defaultPrevented)return;t?L():u=setTimeout(L,g.delay)}},d.dispose=function(){g.animation?r(n,b):b()},(i=m(t)).Toast&&i.Toast.dispose(),n=i.closest(".toast");var w=i.getAttribute("data-animation"),A=i.getAttribute("data-autohide"),T=i.getAttribute("data-delay");a=f("show","toast"),o=f("hide","toast"),s=f("shown","toast"),l=f("hidden","toast"),g.animation=!1===c.animation||"false"===w?0:1,g.autohide=!1===c.autohide||"false"===A?0:1,g.delay=parseInt(c.delay||T,10)||500,i.Toast||i.addEventListener("click",d.hide,!1),i.Toast=d}function B(t,e){var i,n,a,o,s,l,c,d=e||{},u=this,g=null,p=0,b={};function y(){return i.getAttribute("title")||i.getAttribute("data-title")||i.getAttribute("data-original-title")}function w(t){g&&g.contains(t.target)||t.target===i||i.contains(t.target)||u.hide()}function A(t){var e=t?"addEventListener":"removeEventListener";document[e]("touchstart",w,L),window[e]("resize",u.hide,L)}function T(){A(1),h.call(i,s)}function E(){A(),b.container.removeChild(g),g=null,p=null,h.call(i,c)}function k(t){var e=t?"addEventListener":"removeEventListener";i[e](x,u.show,!1),i[e](v[0],u.show,!1),i[e](v[1],u.hide,!1)}u.show=function(){clearTimeout(p),p=setTimeout((function(){if(null===g){if(h.call(i,o),o.defaultPrevented)return;!1!==function(){if(n=y()){if(g=document.createElement("div"),b.template){var t=document.createElement("div");t.innerHTML=b.template.trim(),g.className=t.firstChild.className,g.innerHTML=t.firstChild.innerHTML,m(".tooltip-inner",g).innerHTML=n.trim()}else{var e=document.createElement("div");e.classList.add("arrow"),g.appendChild(e);var i=document.createElement("div");i.classList.add("tooltip-inner"),g.appendChild(i),i.innerHTML=n}g.style.left="0",g.style.top="0",g.setAttribute("role","tooltip"),g.classList.contains("tooltip")||g.classList.add("tooltip"),g.classList.contains(b.animation)||g.classList.add(b.animation),g.classList.contains(a)||g.classList.add(a),b.container.appendChild(g)}}()&&(C(i,g,b.placement,b.container),g.classList.contains("show")||g.classList.add("show"),b.animation?r(g,T):T())}}),20)},u.hide=function(){clearTimeout(p),p=setTimeout((function(){if(g&&g.classList.contains("show")){if(h.call(i,l),l.defaultPrevented)return;g.classList.remove("show"),b.animation?r(g,E):E()}}),b.delay)},u.toggle=function(){g?u.hide():u.show()},u.dispose=function(){k(),u.hide(),i.setAttribute("title",i.getAttribute("data-original-title")),i.removeAttribute("data-original-title"),delete i.Tooltip},(i=m(t)).Tooltip&&i.Tooltip.dispose();var N=i.getAttribute("data-animation"),P=i.getAttribute("data-placement"),H=i.getAttribute("data-delay"),M=i.getAttribute("data-container"),S=m(d.container),B=m(M),I=i.closest(".modal");o=f("show","tooltip"),s=f("shown","tooltip"),l=f("hide","tooltip"),c=f("hidden","tooltip");var D=i.closest(".fixed-top"),X=i.closest(".fixed-bottom");b.animation=d.animation&&"fade"!==d.animation?d.animation:N||"fade",b.placement=d.placement?d.placement:P||"top",b.template=d.template?d.template:null,b.delay=parseInt(d.delay||H,10)||200,b.container=S||B||D||X||I||document.body,a="bs-tooltip-"+b.placement,(n=y())&&(i.Tooltip||(i.setAttribute("data-original-title",n),i.removeAttribute("title"),k(1)),i.Tooltip=u)}var I={};function D(t){var e=t instanceof Element?t:document;Object.keys(I).forEach((function(t){var i,n;i=I[t][0],n=e.querySelectorAll(I[t][1]),Array.from(n).map((function(t){return new i(t)}))}))}I.Alert=[g,'[data-dismiss="alert"]'],I.Button=[p,'[data-toggle="buttons"]'],I.Carousel=[w,'[data-ride="carousel"]'],I.Collapse=[A,'[data-toggle="collapse"]'],I.Dropdown=[E,'[data-toggle="dropdown"]'],I.Modal=[k,'[data-toggle="modal"]'],I.Popover=[P,'[data-toggle="popover"],[data-tip="popover"]'],I.ScrollSpy=[H,'[data-spy="scroll"]'],I.Tab=[M,'[data-toggle="tab"]'],I.Toast=[S,'[data-dismiss="toast"]'],I.Tooltip=[B,'[data-toggle="tooltip"],[data-tip="tooltip"]'],document.body?D():document.addEventListener("DOMContentLoaded",(function t(){D(),document.removeEventListener("DOMContentLoaded",t,!1)}),!1);return{Alert:g,Button:p,Carousel:w,Collapse:A,Dropdown:E,Modal:k,Popover:P,ScrollSpy:H,Tab:M,Toast:S,Tooltip:B,initCallback:D,removeDataAPI:function(t){var e=t instanceof Element?t:document;Object.keys(I).forEach((function(t){var i,n;i=t,n=e.querySelectorAll(I[t][1]),Array.from(n).map((function(t){return t[i].dispose()}))}))},componentsInit:I,Version:"4.1.0alpha4"}})); +// Native JavaScript for Bootstrap v4.1.0alpha5 | 2022 © dnp_theme | MIT-License +!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).BSN=e()}(this,(function(){"use strict";var t=document.head,e="webkitTransition"in t.style||"transition"in t.style,i="webkitTransition"in t.style?"webkitTransitionEnd":"transitionend",n="webkitTransition"in t.style?"webkitTransitionDelay":"transitionDelay",a="webkitTransition"in t.style?"webkitTransitionProperty":"transitionProperty";function o(t,e){var i=getComputedStyle(t);return e in i?i[e]:""}var s="webkitTransition"in t.style?"webkitTransitionDuration":"transitionDuration";function l(t){var i=o(t,a),n=o(t,s),l=n.includes("ms")?1:1e3,r=e&&i&&"none"!==i?parseFloat(n)*l:0;return Number.isNaN(r)?0:r}function r(t,s){var r=0,c=new Event(i),d=l(t),u=function(t){var i=o(t,a),s=o(t,n),l=s.includes("ms")?1:1e3,r=e&&i&&"none"!==i?parseFloat(s)*l:0;return Number.isNaN(r)?0:r}(t);if(e&&d){var m=function(e){e.target===t&&(s.apply(t,[e]),t.removeEventListener(i,m),r=1)};t.addEventListener(i,m),setTimeout((function(){r||t.dispatchEvent(c)}),d+u+17)}else s.apply(t,[c])}function c(t){return t instanceof HTMLElement?t.ownerDocument:t instanceof Window?t.document:window.document}var d=[Document,Element,HTMLElement],u=[Element,HTMLElement];function m(t,e){var i=d.some((function(t){return e instanceof t}))?e:c();return u.some((function(e){return t instanceof e}))?t:i.querySelector(t)}function f(t,e,i){var n=new CustomEvent(t+".bs."+e,{cancelable:!0});return void 0!==i&&Object.keys(i).forEach((function(t){Object.defineProperty(n,t,{value:i[t]})})),n}function h(t){this&&this.dispatchEvent(t)}function g(t){var e,i,n=this,a=f("close","alert"),o=f("closed","alert");function s(t){e[t?"addEventListener":"removeEventListener"]("click",l,!1)}function l(t){i=t&&t.target.closest(".alert"),(e=m('[data-dismiss="alert"]',i))&&i&&(e===t.target||e.contains(t.target))&&n.close()}function c(){s(),i.parentNode.removeChild(i),h.call(i,o)}n.close=function(){if(i&&e&&i.classList.contains("show")){if(h.call(i,a),a.defaultPrevented)return;n.dispose(),i.classList.remove("show"),i.classList.contains("fade")?r(i,c):c()}},n.dispose=function(){s(),delete e.Alert},e=m(t),i=e.closest(".alert"),e.Alert&&e.Alert.dispose(),e.Alert||s(1),n.element=e,e.Alert=n}function p(t){var e,i,n=f("change","button");function a(t){var a=t.target,o=a.closest("LABEL"),s=null;"LABEL"===a.tagName?s=a:o&&(s=o);var l=s&&s.getElementsByTagName("INPUT")[0];if(l){if(h.call(l,n),h.call(e,n),"checkbox"===l.type){if(n.defaultPrevented)return;l.checked?(s.classList.remove("active"),l.getAttribute("checked"),l.removeAttribute("checked"),l.checked=!1):(s.classList.add("active"),l.getAttribute("checked"),l.setAttribute("checked","checked"),l.checked=!0),e.toggled||(e.toggled=!0)}if("radio"===l.type&&!e.toggled){if(n.defaultPrevented)return;(!l.checked||0===t.screenX&&0===t.screenY)&&(s.classList.add("active"),s.classList.add("focus"),l.setAttribute("checked","checked"),l.checked=!0,e.toggled=!0,Array.from(i).forEach((function(t){var e=t.getElementsByTagName("INPUT")[0];t!==s&&t.classList.contains("active")&&(h.call(e,n),t.classList.remove("active"),e.removeAttribute("checked"),e.checked=!1)})))}setTimeout((function(){e.toggled=!1}),50)}}function o(t){32===(t.which||t.keyCode)&&t.target===document.activeElement&&a(t)}function s(t){32===(t.which||t.keyCode)&&t.preventDefault()}function l(t){if("INPUT"===t.target.tagName){var e="focusin"===t.type?"add":"remove";t.target.closest(".btn").classList[e]("focus")}}function r(t){var i=t?"addEventListener":"removeEventListener";e[i]("click",a,!1),e[i]("keyup",o,!1),e[i]("keydown",s,!1),e[i]("focusin",l,!1),e[i]("focusout",l,!1)}this.dispose=function(){r(),delete e.Button},(e=m(t)).Button&&e.Button.dispose(),(i=e.getElementsByClassName("btn")).length&&(e.Button||r(1),e.toggled=!1,e.Button=this,Array.from(i).forEach((function(t){var e=m("input:checked",t);!t.classList.contains("active")&&e&&t.classList.add("active"),t.classList.contains("active")&&!e&&t.classList.remove("active")})))}var v="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],L={passive:!0};var b=function(t){var e=function(t,e){var i=t.getBoundingClientRect(),n=i.width,a=i.height,o=i.top,s=i.right,l=i.bottom,r=i.left,c=1,d=1;if(e&&t instanceof HTMLElement){var u=t.offsetWidth,m=t.offsetHeight;c=u>0&&Math.round(n)/u||1,d=m>0&&Math.round(a)/m||1}return{width:n/c,height:a/d,top:o/d,right:s/c,bottom:l/d,left:r/c,x:r/c,y:o/d}}(t),i=e.top,n=e.bottom;return i<=c(t).documentElement.clientHeight&&n>=0},y=function(t){return t.offsetHeight};function w(t,e){var i,n,a,o,s,c,d,u,g,p,w,A,T,E=e||{},k=this;function x(){!1===c.interval||o.classList.contains("paused")||(o.classList.add("paused"),s.isSliding||(clearInterval(s.timer),s.timer=null))}function N(){!1!==c.interval&&o.classList.contains("paused")&&(o.classList.remove("paused"),s.isSliding||(clearInterval(s.timer),s.timer=null,k.cycle()))}function C(t){if(t.preventDefault(),!s.isSliding){var e=t.target;e&&!e.classList.contains("active")&&e.getAttribute("data-slide-to")&&(s.index=+e.getAttribute("data-slide-to"),k.slideTo(s.index))}}function P(t){if(t.preventDefault(),!s.isSliding){var e=t.currentTarget||t.srcElement;e===w?s.index+=1:e===p&&(s.index-=1),k.slideTo(s.index)}}function H(t){var e=t.which;if(!s.isSliding){switch(e){case 39:s.index+=1;break;case 37:s.index-=1;break;default:return}k.slideTo(s.index)}}function M(t){var e=t?"addEventListener":"removeEventListener";c.pause&&c.interval&&(o[e](v[0],x,!1),o[e](v[1],N,!1),o[e]("touchstart",x,L),o[e]("touchend",N,L)),c.touch&&g.length>1&&o[e]("touchstart",B,L),w&&w[e]("click",P,!1),p&&p[e]("click",P,!1),A&&A[e]("click",C,!1),c.keyboard&&window[e]("keydown",H,!1)}function S(t){var e=t?"addEventListener":"removeEventListener";o[e]("touchmove",I,L),o[e]("touchend",D,L)}function B(t){s.isTouch||(s.touchPosition.startX=t.changedTouches[0].pageX,o.contains(t.target)&&(s.isTouch=!0,S(1)))}function I(t){s.isTouch?(s.touchPosition.currentX=t.changedTouches[0].pageX,"touchmove"===t.type&&t.changedTouches.length>1&&t.preventDefault()):t.preventDefault()}function D(t){if(s.isTouch&&!s.isSliding&&(s.touchPosition.endX=s.touchPosition.currentX||t.changedTouches[0].pageX,s.isTouch)){if((!o.contains(t.target)||!o.contains(t.relatedTarget))&&Math.abs(s.touchPosition.startX-s.touchPosition.endX)<75)return;s.touchPosition.currentXs.touchPosition.startX&&(s.index-=1),s.isTouch=!1,k.slideTo(s.index),S()}}function X(t){Array.from(T).forEach((function(t){return t.classList.remove("active")})),T[t]&&T[t].classList.add("active")}function R(t){if(s.touchPosition){var e=s.index,i=t&&t.target!==g[e]?1e3*t.elapsedTime+100:20,n=k.getActiveIndex(),a="left"===s.direction?"next":"prev";s.isSliding&&setTimeout((function(){s.touchPosition&&(s.isSliding=!1,g[e].classList.add("active"),g[n].classList.remove("active"),g[e].classList.remove("carousel-item-"+a),g[e].classList.remove("carousel-item-"+s.direction),g[n].classList.remove("carousel-item-"+s.direction),h.call(o,u),document.hidden||!c.interval||o.classList.contains("paused")||k.cycle())}),i)}}if(k.cycle=function(){s.timer&&(clearInterval(s.timer),s.timer=null),s.timer=setInterval((function(){var t=s.index||k.getActiveIndex();b(o)&&(t+=1,k.slideTo(t))}),c.interval)},k.slideTo=function(t){if(!s.isSliding){var e=k.getActiveIndex(),i=t;if(e!==i){ei||e===g.length-1&&0===i)&&(s.direction="right"),i<0?i=g.length-1:i>=g.length&&(i=0);var n="left"===s.direction?"next":"prev",a={relatedTarget:g[i],direction:s.direction,from:e,to:i};d=f("slide","carousel",a),u=f("slid","carousel",a),h.call(o,d),d.defaultPrevented||(s.index=i,s.isSliding=!0,clearInterval(s.timer),s.timer=null,X(i),l(g[i])&&o.classList.contains("slide")?(g[i].classList.add("carousel-item-"+n),y(g[i]),g[i].classList.add("carousel-item-"+s.direction),g[e].classList.add("carousel-item-"+s.direction),r(g[i],R)):(g[i].classList.add("active"),y(g[i]),g[e].classList.remove("active"),setTimeout((function(){s.isSliding=!1,c.interval&&o&&!o.classList.contains("paused")&&k.cycle(),h.call(o,u)}),100)))}}},k.getActiveIndex=function(){return Array.from(g).indexOf(o.getElementsByClassName("carousel-item active")[0])||0},k.dispose=function(){var t=["left","right","prev","next"];Array.from(g).forEach((function(e,i){e.classList.contains("active")&&X(i),t.forEach((function(t){return e.classList.remove("carousel-item-"+t)}))})),clearInterval(s.timer),M(),s={},c={},delete o.Carousel},(o=m(t)).Carousel&&o.Carousel.dispose(),g=o.getElementsByClassName("carousel-item"),i=o.getElementsByClassName("carousel-control-prev"),p=i[0],n=o.getElementsByClassName("carousel-control-next"),w=n[0],a=o.getElementsByClassName("carousel-indicators"),A=a[0],T=A&&A.getElementsByTagName("LI")||[],!(g.length<2)){var W=o.getAttribute("data-interval"),O="false"===W?0:+W,j="false"===o.getAttribute("data-touch")?0:1,z="hover"===o.getAttribute("data-pause")||!1,U="true"===o.getAttribute("data-keyboard")||!1,q=E.interval,F=E.touch;(c={}).keyboard=!0===E.keyboard||U,c.pause=!("hover"!==E.pause&&!z)&&"hover",c.touch=F||j,c.interval=5e3,"number"==typeof q?c.interval=q:!1===q||0===O||!1===O?c.interval=0:Number.isNaN(O)||(c.interval=O),k.getActiveIndex()<0&&(g.length&&g[0].classList.add("active"),T.length&&X(0)),(s={}).direction="left",s.index=0,s.timer=null,s.isSliding=!1,s.isTouch=!1,s.touchPosition={startX:0,currentX:0,endX:0},M(1),c.interval&&k.cycle(),o.Carousel=k}}function A(t,e){var i,n,a,o,s,l,c,d=e||{},u=this,g=null,p=null;function v(t,e){h.call(t,l),l.defaultPrevented||(t.isAnimating=!0,t.style.height=t.scrollHeight+"px",t.classList.remove("collapse"),t.classList.remove("show"),t.classList.add("collapsing"),y(t),t.style.height="0px",r(t,(function(){t.isAnimating=!1,t.setAttribute("aria-expanded","false"),e.setAttribute("aria-expanded","false"),t.classList.remove("collapsing"),t.classList.add("collapse"),t.style.height="",h.call(t,c)})))}u.toggle=function(t){(t&&"A"===t.target.tagName||"A"===i.tagName)&&t.preventDefault(),(i.contains(t.target)||t.target===i)&&(p.classList.contains("show")?u.hide():u.show())},u.hide=function(){p.isAnimating||(v(p,i),i.classList.add("collapsed"))},u.show=function(){var t,e,l;g&&(t=g.getElementsByClassName("collapse show"),n=t[0],a=n&&(m('[data-target="#'+n.id+'"]',g)||m('[href="#'+n.id+'"]',g))),p.isAnimating||(a&&n!==p&&(v(n,a),a.classList.add("collapsed")),e=p,l=i,h.call(e,o),o.defaultPrevented||(e.isAnimating=!0,e.classList.add("collapsing"),e.classList.remove("collapse"),e.style.height=e.scrollHeight+"px",r(e,(function(){e.isAnimating=!1,e.setAttribute("aria-expanded","true"),l.setAttribute("aria-expanded","true"),e.classList.remove("collapsing"),e.classList.add("collapse"),e.classList.add("show"),e.style.height="",h.call(e,s)}))),i.classList.remove("collapsed"))},u.dispose=function(){i.removeEventListener("click",u.toggle,!1),delete i.Collapse},(i=m(t)).Collapse&&i.Collapse.dispose();var L=i.getAttribute("data-parent");o=f("show","collapse"),s=f("shown","collapse"),l=f("hide","collapse"),c=f("hidden","collapse"),null!==(p=m(d.target||i.getAttribute("data-target")||i.getAttribute("href")))&&(p.isAnimating=!1);var b=d.parent||L;g=b?i.closest(b):null,i.Collapse||i.addEventListener("click",u.toggle,!1),i.Collapse=u}var T=function(t){return t.focus()};function E(t,e){var i,n,a,o,s,l,r,c,d=this,u=null,g=[];function p(t){(t.hasAttribute("href")&&"#"===t.href.slice(-1)||t.parentNode&&t.parentNode.hasAttribute("href")&&"#"===t.parentNode.href.slice(-1))&&this.preventDefault()}function v(){var t=i.open?"addEventListener":"removeEventListener";document[t]("click",L,!1),document[t]("keydown",y,!1),document[t]("keyup",w,!1),document[t]("focus",L,!1)}function L(t){var e=t.target;if(e.getAttribute){var n=e&&e.getAttribute("data-toggle")||e.parentNode&&e.parentNode.getAttribute&&e.parentNode.getAttribute("data-toggle");("focus"!==t.type||e!==i&&e!==r&&!r.contains(e))&&(e!==r&&!r.contains(e)||!c&&!n)&&(u=e===i||i.contains(e)?i:null,d.hide(),p.call(t,e))}}function b(t){u=i,d.show(),p.call(t,t.target)}function y(t){var e=t.which||t.keyCode;38!==e&&40!==e||t.preventDefault()}function w(t){var e=t.which||t.keyCode,n=document.activeElement,a=n===i,o=r.contains(n),s=n.parentNode===r||n.parentNode.parentNode===r,l=g.indexOf(n);s&&(a?l=0:38===e?l=l>1?l-1:0:40===e&&(l=l=d,w=m.top+c/2+g/2>=u,A=m.top-c<0,T=m.left-r<0,E=m.top+c+g>=u,k=m.left+r+h>=d,x=i;x="right"===(x="left"===(x="bottom"===(x="top"===(x=("left"===x||"right"===x)&&T&&k?"top":x)&&A?"bottom":x)&&E?"top":x)&&T?"right":x)&&k?"left":x,-1===e.className.indexOf(x)&&(e.className=e.className.replace(/\b(top|bottom|left|right)+/,x));var C=v.offsetWidth,P=v.offsetHeight;"left"===x||"right"===x?(o="left"===x?m.left+f.x-r-(p?C:0):m.left+f.x+h,L?(a=m.top+f.y,s=g/2-C):w?(a=m.top+f.y-c+g,s=c-g/2-C):(a=m.top+f.y-c/2+g/2,s=c/2-(p?.9*P:P/2))):"top"!==x&&"bottom"!==x||(a="top"===x?m.top+f.y-c-(p?P:0):m.top+f.y+g,b?(o=0,l=m.left+h/2-C):y?(o=d-1.01*r,l=r-(d-m.left)+h/2-C/2):(o=m.left+f.x-r/2+h/2,l=r/2-(p?C:C/2))),e.style.top=a+"px",e.style.left=o+"px",s&&(v.style.top=s+"px"),l&&(v.style.left=l+"px")}function P(t,e){var i,n,a,o,s,l,c,d,u,g=e||{},p=this,b=null,y=0,w=/(iPhone|iPod|iPad)/.test(navigator.userAgent),A={};function T(t){null!==b&&t.target===m(".close",b)&&p.hide()}function E(t){return g[t]||i.dataset[t]||null}function k(){return E("title")}function N(){return E("content")}function P(){null===b&&i.focus()}function H(t){var e=t?"addEventListener":"removeEventListener";"hover"===A.trigger?(i[e](x,p.show),i[e](v[0],p.show),A.dismissible||i[e](v[1],p.hide)):"click"===A.trigger?i[e](A.trigger,p.toggle):"focus"===A.trigger&&(w&&i[e]("click",P,!1),i[e](A.trigger,p.toggle))}function M(t){b&&b.contains(t.target)||t.target===i||i.contains(t.target)||p.hide()}function S(t){var e=t?"addEventListener":"removeEventListener";A.dismissible?document[e]("click",T,!1):("focus"===A.trigger&&i[e]("blur",p.hide),"hover"===A.trigger&&document[e]("touchstart",M,L)),window[e]("resize",p.hide,L)}function B(){S(1),h.call(i,c)}function I(){S(),A.container.removeChild(b),y=null,b=null,h.call(i,u)}p.toggle=function(){null===b?p.show():p.hide()},p.show=function(){clearTimeout(y),y=setTimeout((function(){if(null===b){if(h.call(i,l),l.defaultPrevented)return;!function(){n=k(),a=(a=N())?a.trim():null,b=document.createElement("div");var t=document.createElement("div");if(t.classList.add("arrow"),b.appendChild(t),null!==a&&null===A.template){if(b.setAttribute("role","tooltip"),null!==n){var e=document.createElement("h3");e.classList.add("popover-header"),e.innerHTML=A.dismissible?n+s:n,b.appendChild(e)}var i=document.createElement("div");i.classList.add("popover-body"),i.innerHTML=A.dismissible&&null===n?a+s:a,b.appendChild(i)}else{var l=document.createElement("div");l.innerHTML=A.template.trim(),b.className=l.firstChild.className,b.innerHTML=l.firstChild.innerHTML;var r=m(".popover-header",b),c=m(".popover-body",b);n&&r&&(r.innerHTML=n.trim()),a&&c&&(c.innerHTML=a.trim())}A.container.appendChild(b),b.style.display="block",b.classList.contains("popover")||b.classList.add("popover"),b.classList.contains(A.animation)||b.classList.add(A.animation),b.classList.contains(o)||b.classList.add(o)}(),C(i,b,A.placement,A.container),b.classList.contains("show")||b.classList.add("show"),A.animation?r(b,B):B()}}),20)},p.hide=function(){clearTimeout(y),y=setTimeout((function(){if(b&&null!==b&&b.classList.contains("show")){if(h.call(i,d),d.defaultPrevented)return;b.classList.remove("show"),A.animation?r(b,I):I()}}),A.delay)},p.dispose=function(){p.hide(),H(),delete i.Popover},(i=m(t)).Popover&&i.Popover.dispose();var D=i.getAttribute("data-trigger"),X=i.getAttribute("data-animation"),R=i.getAttribute("data-placement"),W=i.getAttribute("data-dismissible"),O=i.getAttribute("data-delay"),j=i.getAttribute("data-container");s='',l=f("show","popover"),c=f("shown","popover"),d=f("hide","popover"),u=f("hidden","popover");var z=m(g.container),U=m(j),q=i.closest(".modal"),F=i.closest(".fixed-top"),Y=i.closest(".fixed-bottom");A.template=g.template?g.template:null,A.trigger=g.trigger?g.trigger:D||"hover",A.animation=g.animation&&"fade"!==g.animation?g.animation:X||"fade",A.placement=g.placement?g.placement:R||"top",A.delay=parseInt(g.delay||O,10)||200,A.dismissible=!(!g.dismissible&&"true"!==W),A.container=z||U||F||Y||q||document.body,o="bs-popover-"+A.placement,n=k(),((a=N())||A.template)&&(i.Popover||H(1),i.Popover=p)}function H(t,e){var i,n,a,o,s,l=e||{},r=this,c={};function d(){var t,e,s;(a=o.getElementsByTagName("A"),n.scrollTop=n.isWindow?N().y:i.scrollTop,n.length!==a.length||g()!==n.scrollHeight)&&(n.items=[],n.offsets=[],n.scrollHeight=g(),n.maxScroll=n.scrollHeight-(n.isWindow?window.innerHeight:i.getBoundingClientRect().height),Array.from(a).forEach((function(i){t=i.getAttribute("href"),(e=t&&"#"===t.charAt(0)&&"#"!==t.slice(-1)&&m(t))&&(n.items.push(i),s=e.getBoundingClientRect(),n.offsets.push((n.isWindow?s.top+n.scrollTop:e.offsetTop)-c.offset))})),n.length=n.items.length)}function u(t){var e=t?"addEventListener":"removeEventListener";s[e]("scroll",r.refresh,L),window[e]("resize",r.refresh,L)}function g(){return s.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function p(){Array.from(a).map((function(t){return t.classList.contains("active")&&t.classList.remove("active")}))}function v(t){var e,a=t;p(),n.activeItem=a,a.classList.add("active");for(var o=[];a.parentNode!==document.body;)((e=(a=a.parentNode).classList).contains("dropdown-menu")||e.contains("nav"))&&o.push(a);o.forEach((function(t){var e=t.previousElementSibling;e&&!e.classList.contains("active")&&e.classList.add("active")})),h.call(i,f("activate","scrollspy",{relatedTarget:n.activeItem}))}r.refresh=function(){if(d(),n.scrollTop>=n.maxScroll){var t=n.items[n.length-1];n.activeItem!==t&&v(t)}else{if(n.activeItem&&n.scrollTop0)return n.activeItem=null,void p();for(var e=n.length;e>-1;)n.activeItem!==n.items[e]&&n.scrollTop>=n.offsets[e]&&(void 0===n.offsets[e+1]||n.scrollTop1&&(g=t[t.length-1]):g=t[0],g}function P(){return m(C().getAttribute("href"))}function H(t){t.preventDefault(),u=t.currentTarget,a.isAnimating||T.show()}T.show=function(){if(!(u=u||n).classList.contains("active")){if(v=m(u.getAttribute("href")),g=C(),p=P(),c=f("hide","tab",{relatedTarget:u}),h.call(g,c),c.defaultPrevented)return;a.isAnimating=!0,g.classList.remove("active"),g.setAttribute("aria-selected","false"),u.classList.add("active"),u.setAttribute("aria-selected","true"),o&&(n.parentNode.classList.contains("dropdown-menu")?o.classList.contains("active")||o.classList.add("active"):o.classList.contains("active")&&o.classList.remove("active")),p.classList.contains("fade")?(p.classList.remove("show"),r(p,N)):N()}},T.dispose=function(){n.removeEventListener("click",H,!1),delete n.Tab},(n=m(t)).Tab&&n.Tab.dispose();var M=n.getAttribute("data-height");a=n.closest(".nav"),o=a&&m(".dropdown-toggle",a);var S=!(!e||!1===A.height||"false"===M);a.isAnimating=!1,n.Tab||n.addEventListener("click",H,!1),S&&(E=P().parentNode),n.Tab=T}function S(t,e){var i,n,a,o,s,l,c=e||{},d=this,u=0,g={};function p(){n.classList.remove("showing"),n.classList.add("show"),h.call(n,s),g.autohide&&d.hide()}function v(){n.classList.add("hide"),h.call(n,l)}function L(){n.classList.remove("show"),g.animation?r(n,v):v()}function b(){clearTimeout(u),i.removeEventListener("click",d.hide,!1),delete i.Toast}d.show=function(){if(n&&!n.classList.contains("show")){if(h.call(n,a),a.defaultPrevented)return;g.animation&&n.classList.add("fade"),n.classList.remove("hide"),y(n),n.classList.add("showing"),g.animation?r(n,p):p()}},d.hide=function(t){if(n&&n.classList.contains("show")){if(h.call(n,o),o.defaultPrevented)return;t?L():u=setTimeout(L,g.delay)}},d.dispose=function(){g.animation?r(n,b):b()},(i=m(t)).Toast&&i.Toast.dispose(),n=i.closest(".toast");var w=i.getAttribute("data-animation"),A=i.getAttribute("data-autohide"),T=i.getAttribute("data-delay");a=f("show","toast"),o=f("hide","toast"),s=f("shown","toast"),l=f("hidden","toast"),g.animation=!1===c.animation||"false"===w?0:1,g.autohide=!1===c.autohide||"false"===A?0:1,g.delay=parseInt(c.delay||T,10)||500,i.Toast||i.addEventListener("click",d.hide,!1),i.Toast=d}function B(t,e){var i,n,a,o,s,l,c,d=e||{},u=this,g=null,p=0,b={};function y(){return i.getAttribute("title")||i.getAttribute("data-title")||i.getAttribute("data-original-title")}function w(t){g&&g.contains(t.target)||t.target===i||i.contains(t.target)||u.hide()}function A(t){var e=t?"addEventListener":"removeEventListener";document[e]("touchstart",w,L),window[e]("resize",u.hide,L)}function T(){A(1),h.call(i,s)}function E(){A(),b.container.removeChild(g),g=null,p=null,h.call(i,c)}function k(t){var e=t?"addEventListener":"removeEventListener";i[e](x,u.show,!1),i[e](v[0],u.show,!1),i[e](v[1],u.hide,!1)}u.show=function(){clearTimeout(p),p=setTimeout((function(){if(null===g){if(h.call(i,o),o.defaultPrevented)return;!1!==function(){if(n=y()){if(g=document.createElement("div"),b.template){var t=document.createElement("div");t.innerHTML=b.template.trim(),g.className=t.firstChild.className,g.innerHTML=t.firstChild.innerHTML,m(".tooltip-inner",g).innerHTML=n.trim()}else{var e=document.createElement("div");e.classList.add("arrow"),g.appendChild(e);var i=document.createElement("div");i.classList.add("tooltip-inner"),g.appendChild(i),i.innerHTML=n}g.style.left="0",g.style.top="0",g.setAttribute("role","tooltip"),g.classList.contains("tooltip")||g.classList.add("tooltip"),g.classList.contains(b.animation)||g.classList.add(b.animation),g.classList.contains(a)||g.classList.add(a),b.container.appendChild(g)}}()&&(C(i,g,b.placement,b.container),g.classList.contains("show")||g.classList.add("show"),b.animation?r(g,T):T())}}),20)},u.hide=function(){clearTimeout(p),p=setTimeout((function(){if(g&&g.classList.contains("show")){if(h.call(i,l),l.defaultPrevented)return;g.classList.remove("show"),b.animation?r(g,E):E()}}),b.delay)},u.toggle=function(){g?u.hide():u.show()},u.dispose=function(){k(),u.hide(),i.setAttribute("title",i.getAttribute("data-original-title")),i.removeAttribute("data-original-title"),delete i.Tooltip},(i=m(t)).Tooltip&&i.Tooltip.dispose();var N=i.getAttribute("data-animation"),P=i.getAttribute("data-placement"),H=i.getAttribute("data-delay"),M=i.getAttribute("data-container"),S=m(d.container),B=m(M),I=i.closest(".modal");o=f("show","tooltip"),s=f("shown","tooltip"),l=f("hide","tooltip"),c=f("hidden","tooltip");var D=i.closest(".fixed-top"),X=i.closest(".fixed-bottom");b.animation=d.animation&&"fade"!==d.animation?d.animation:N||"fade",b.placement=d.placement?d.placement:P||"top",b.template=d.template?d.template:null,b.delay=parseInt(d.delay||H,10)||200,b.container=S||B||D||X||I||document.body,a="bs-tooltip-"+b.placement,(n=y())&&(i.Tooltip||(i.setAttribute("data-original-title",n),i.removeAttribute("title"),k(1)),i.Tooltip=u)}var I={};function D(t){var e=t instanceof Element?t:document;Object.keys(I).forEach((function(t){var i,n;i=I[t][0],n=e.querySelectorAll(I[t][1]),Array.from(n).map((function(t){return new i(t)}))}))}I.Alert=[g,'[data-dismiss="alert"]'],I.Button=[p,'[data-toggle="buttons"]'],I.Carousel=[w,'[data-ride="carousel"]'],I.Collapse=[A,'[data-toggle="collapse"]'],I.Dropdown=[E,'[data-toggle="dropdown"]'],I.Modal=[k,'[data-toggle="modal"]'],I.Popover=[P,'[data-toggle="popover"],[data-tip="popover"]'],I.ScrollSpy=[H,'[data-spy="scroll"]'],I.Tab=[M,'[data-toggle="tab"]'],I.Toast=[S,'[data-dismiss="toast"]'],I.Tooltip=[B,'[data-toggle="tooltip"],[data-tip="tooltip"]'],document.body?D():document.addEventListener("DOMContentLoaded",(function t(){D(),document.removeEventListener("DOMContentLoaded",t,!1)}),!1);return{Alert:g,Button:p,Carousel:w,Collapse:A,Dropdown:E,Modal:k,Popover:P,ScrollSpy:H,Tab:M,Toast:S,Tooltip:B,initCallback:D,removeDataAPI:function(t){var e=t instanceof Element?t:document;Object.keys(I).forEach((function(t){var i,n;i=t,n=e.querySelectorAll(I[t][1]),Array.from(n).map((function(t){return t[i].dispose()}))}))},componentsInit:I,Version:"4.1.0alpha5"}})); diff --git a/dist/bootstrap-native.esm.js b/dist/bootstrap-native.esm.js index 558e8158..c337fae5 100644 --- a/dist/bootstrap-native.esm.js +++ b/dist/bootstrap-native.esm.js @@ -1,8 +1,117 @@ /*! - * Native JavaScript for Bootstrap v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ +/** @type {Record} */ +const EventRegistry = {}; + +/** + * The global event listener. + * + * @this {Element | HTMLElement | Window | Document} + * @param {Event} e + * @returns {void} + */ +function globalListener(e) { + const that = this; + const { type } = e; + const oneEvMap = EventRegistry[type] ? [...EventRegistry[type]] : []; + + oneEvMap.forEach((elementsMap) => { + const [element, listenersMap] = elementsMap; + [...listenersMap].forEach((listenerMap) => { + if (element === that) { + const [listener, options] = listenerMap; + listener.apply(element, [e]); + + if (options && options.once) { + removeListener(element, type, listener, options); + } + } + }); + }); +} + +/** + * Register a new listener with its options and attach the `globalListener` + * to the target if this is the first listener. + * + * @param {Element | HTMLElement | Window | Document} element + * @param {string} eventType + * @param {EventListenerObject['handleEvent']} listener + * @param {AddEventListenerOptions=} options + */ +const addListener = (element, eventType, listener, options) => { + // get element listeners first + if (!EventRegistry[eventType]) { + EventRegistry[eventType] = new Map(); + } + const oneEventMap = EventRegistry[eventType]; + + if (!oneEventMap.has(element)) { + oneEventMap.set(element, new Map()); + } + const oneElementMap = oneEventMap.get(element); + + // get listeners size + const { size } = oneElementMap; + + // register listener with its options + if (oneElementMap) { + oneElementMap.set(listener, options); + } + + // add listener last + if (!size) { + element.addEventListener(eventType, globalListener, options); + } +}; + +/** + * Remove a listener from registry and detach the `globalListener` + * if no listeners are found in the registry. + * + * @param {Element | HTMLElement | Window | Document} element + * @param {string} eventType + * @param {EventListenerObject['handleEvent']} listener + * @param {AddEventListenerOptions=} options + */ +const removeListener = (element, eventType, listener, options) => { + // get listener first + const oneEventMap = EventRegistry[eventType]; + const oneElementMap = oneEventMap && oneEventMap.get(element); + const savedOptions = oneElementMap && oneElementMap.get(listener); + + // also recover initial options + const { options: eventOptions } = savedOptions !== undefined + ? savedOptions + : { options }; + + // unsubscribe second, remove from registry + if (oneElementMap && oneElementMap.has(listener)) oneElementMap.delete(listener); + if (oneEventMap && (!oneElementMap || !oneElementMap.size)) oneEventMap.delete(element); + if (!oneEventMap || !oneEventMap.size) delete EventRegistry[eventType]; + + // remove listener last + if (!oneElementMap || !oneElementMap.size) { + element.removeEventListener(eventType, globalListener, eventOptions); + } +}; + +/** + * Advanced event listener based on subscribe / publish pattern. + * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript + * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js + * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 + */ +const EventListener = { + on: addListener, + off: removeListener, + globalListener, + registry: EventRegistry, +}; + /** * A global namespace for `click` event. * @type {string} @@ -90,32 +199,6 @@ function getElementTransitionDuration(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$b(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$b(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -132,16 +215,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$b(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$b(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -165,7 +248,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -177,19 +260,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -337,114 +418,6 @@ function OriginalEvent(EventType, config) { return OriginalCustomEvent; } -/** @type {Record} */ -const EventRegistry = {}; - -/** - * The global event listener. - * - * @this {Element | HTMLElement | Window | Document} - * @param {Event} e - * @returns {void} - */ -function globalListener(e) { - const that = this; - const { type } = e; - const oneEvMap = EventRegistry[type] ? [...EventRegistry[type]] : []; - - oneEvMap.forEach((elementsMap) => { - const [element, listenersMap] = elementsMap; - [...listenersMap].forEach((listenerMap) => { - if (element === that) { - const [listener, options] = listenerMap; - listener.apply(element, [e]); - - if (options && options.once) { - removeListener(element, type, listener, options); - } - } - }); - }); -} - -/** - * Register a new listener with its options and attach the `globalListener` - * to the target if this is the first listener. - * - * @param {Element | HTMLElement | Window | Document} element - * @param {string} eventType - * @param {EventListenerObject['handleEvent']} listener - * @param {AddEventListenerOptions=} options - */ -const addListener = (element, eventType, listener, options) => { - // get element listeners first - if (!EventRegistry[eventType]) { - EventRegistry[eventType] = new Map(); - } - const oneEventMap = EventRegistry[eventType]; - - if (!oneEventMap.has(element)) { - oneEventMap.set(element, new Map()); - } - const oneElementMap = oneEventMap.get(element); - - // get listeners size - const { size } = oneElementMap; - - // register listener with its options - if (oneElementMap) { - oneElementMap.set(listener, options); - } - - // add listener last - if (!size) { - element.addEventListener(eventType, globalListener, options); - } -}; - -/** - * Remove a listener from registry and detach the `globalListener` - * if no listeners are found in the registry. - * - * @param {Element | HTMLElement | Window | Document} element - * @param {string} eventType - * @param {EventListenerObject['handleEvent']} listener - * @param {AddEventListenerOptions=} options - */ -const removeListener = (element, eventType, listener, options) => { - // get listener first - const oneEventMap = EventRegistry[eventType]; - const oneElementMap = oneEventMap && oneEventMap.get(element); - const savedOptions = oneElementMap && oneElementMap.get(listener); - // also recover initial options - const { options: eventOptions } = savedOptions !== undefined - ? savedOptions - : { options }; - - // unsubscribe second, remove from registry - if (oneElementMap && oneElementMap.has(listener)) oneElementMap.delete(listener); - if (oneEventMap && (!oneElementMap || !oneElementMap.size)) oneEventMap.delete(element); - if (!oneEventMap || !oneEventMap.size) delete EventRegistry[eventType]; - - // remove listener last - if (!oneElementMap || !oneElementMap.size) { - element.removeEventListener(eventType, globalListener, eventOptions); - } -}; - -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `fade` class. */ @@ -566,7 +539,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -633,7 +606,6 @@ class BaseComponent { // ================ const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; -const { on: on$a, off: off$a } = EventListener; /** * Static method which returns an existing `Alert` instance associated @@ -678,7 +650,7 @@ function alertTransitionEnd(self) { * @param {boolean=} add when `true`, event listener is added */ function toggleAlertHandler(self, add) { - const action = add ? on$a : off$a; + const action = add ? addListener : removeListener; const { dismiss } = self; if (dismiss) action(dismiss, mouseclickEvent, self.close); } @@ -799,7 +771,6 @@ const buttonComponent = 'Button'; // BUTTON PRIVATE GC // ================= const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; -const { on: on$9, off: off$9 } = EventListener; /** * Static method which returns an existing `Button` instance associated @@ -823,7 +794,7 @@ const buttonInitCallback = (element) => new Button(element); * @param {boolean=} add when `true`, event listener is added */ function toggleButtonHandler(self, add) { - const action = add ? on$9 : off$9; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, self.toggle); } @@ -1196,7 +1167,6 @@ const carouselSelector = `[data-bs-ride="${carouselString}"]`; const carouselItem = `${carouselString}-item`; const dataBsSlideTo = 'data-bs-slide-to'; const dataBsSlide = 'data-bs-slide'; -const { on: on$8, off: off$8 } = EventListener; const pausedClass = 'paused'; const carouselDefaults = { @@ -1458,7 +1428,7 @@ function activateCarouselIndicator(self, pageIndex) { */ function toggleCarouselTouchHandlers(self, add) { const { element } = self; - const action = add ? on$8 : off$8; + const action = add ? addListener : removeListener; action(element, touchmoveEvent, carouselTouchMoveHandler, passiveHandler); action(element, touchendEvent, carouselTouchEndHandler, passiveHandler); } @@ -1475,7 +1445,7 @@ function toggleCarouselHandlers(self, add) { const { touch, pause, interval, keyboard, } = options; - const action = add ? on$8 : off$8; + const action = add ? addListener : removeListener; if (pause && interval) { action(element, mouseenterEvent, carouselPauseHandler); @@ -1779,7 +1749,6 @@ const collapseComponent = 'Collapse'; const collapseSelector = `.${collapseString}`; const collapseToggleSelector = `[${dataBsToggle}="${collapseString}"]`; const collapseDefaults = { parent: null }; -const { on: on$7, off: off$7 } = EventListener; /** * Static method which returns an existing `Collapse` instance associated @@ -1892,7 +1861,7 @@ function collapseContent(self) { * @param {boolean=} add when `true`, the event listener is added */ function toggleCollapseHandler(self, add) { - const action = add ? on$7 : off$7; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { @@ -2132,7 +2101,6 @@ const [ dropendString, ] = dropdownMenuClasses; const dropdownSelector = `[${dataBsToggle}="${dropdownString}"]`; -const { on: on$6, off: off$6 } = EventListener; /** * Static method which returns an existing `Dropdown` instance associated @@ -2308,7 +2276,7 @@ function getMenuItems(menu) { */ function toggleDropdownDismiss(self) { const { element } = self; - const action = self.open ? on$6 : off$6; + const action = self.open ? addListener : removeListener; const doc = getDocument(element); action(doc, mouseclickEvent, dropdownDismissHandler); @@ -2331,7 +2299,7 @@ function toggleDropdownDismiss(self) { * @param {boolean=} add when `true`, it will add the event listener */ function toggleDropdownHandler(self, add) { - const action = add ? on$6 : off$6; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, dropdownClickHandler); } @@ -2927,7 +2895,6 @@ const modalSelector = `.${modalString}`; const modalToggleSelector = `[${dataBsToggle}="${modalString}"]`; const modalDismissSelector = `[${dataBsDismiss}="${modalString}"]`; const modalStaticClass = `${modalString}-static`; -const { on: on$5, off: off$5 } = EventListener; const modalDefaults = { backdrop: true, // boolean|string @@ -2985,7 +2952,7 @@ function setModalScrollbar(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleModalDismiss(self, add) { - const action = add ? on$5 : off$5; + const action = add ? addListener : removeListener; const { element } = self; action(element, mouseclickEvent, modalDismissHandler); // @ts-ignore @@ -2999,7 +2966,7 @@ function toggleModalDismiss(self, add) { * @param {boolean=} add when `true`, event listener is added */ function toggleModalHandler(self, add) { - const action = add ? on$5 : off$5; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { @@ -3345,7 +3312,6 @@ const offcanvasSelector = `.${offcanvasString}`; const offcanvasToggleSelector = `[${dataBsToggle}="${offcanvasString}"]`; const offcanvasDismissSelector = `[${dataBsDismiss}="${offcanvasString}"]`; const offcanvasTogglingClass = `${offcanvasString}-toggling`; -const { on: on$4, off: off$4 } = EventListener; const offcanvasDefaults = { backdrop: true, // boolean @@ -3395,7 +3361,7 @@ function setOffCanvasScrollbar(self) { * @param {boolean=} add when *true*, listeners are added */ function toggleOffcanvasEvents(self, add) { - const action = add ? on$4 : off$4; + const action = add ? addListener : removeListener; self.triggers.forEach((btn) => action(btn, mouseclickEvent, offcanvasTriggerHandler)); } @@ -3406,7 +3372,7 @@ function toggleOffcanvasEvents(self, add) { * @param {boolean=} add when *true* listeners are added */ function toggleOffCanvasDismiss(self, add) { - const action = add ? on$4 : off$4; + const action = add ? addListener : removeListener; const doc = getDocument(self.element); action(doc, keydownEvent, offcanvasKeyDismissHandler); action(doc, mouseclickEvent, offcanvasDismissHandler); @@ -4270,7 +4236,6 @@ function isVisibleTip(tip, container) { // ================== const tooltipSelector = `[${dataBsToggle}="${tooltipString}"],[data-tip="${tooltipString}"]`; const titleAttr = 'title'; -const { on: on$3, off: off$3 } = EventListener; /** * Static method which returns an existing `Tooltip` instance associated @@ -4320,7 +4285,7 @@ function disposeTooltipComplete(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipAction(self, add) { - const action = add ? on$3 : off$3; + const action = add ? addListener : removeListener; const { element } = self; action(getDocument(element), touchstartEvent, tooltipTouchHandler, passiveHandler); @@ -4369,7 +4334,7 @@ function tooltipHiddenAction(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipHandlers(self, add) { - const action = add ? on$3 : off$3; + const action = add ? addListener : removeListener; // @ts-ignore -- btn is only for dismissible popover const { element, options, btn } = self; const { trigger, dismissible } = options; @@ -4414,7 +4379,7 @@ function toggleTooltipHandlers(self, add) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipOpenHandlers(self, add) { - const action = add ? on$3 : off$3; + const action = add ? addListener : removeListener; const { element, options, offsetParent } = self; const { container } = options; const { offsetHeight, scrollHeight } = container; @@ -4431,8 +4396,8 @@ function toggleTooltipOpenHandlers(self, add) { } // dismiss tooltips inside modal / offcanvas - if (parentModal) on$3(parentModal, `hide.bs.${modalString}`, self.hide); - if (parentOffcanvas) on$3(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); + if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.hide); + if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); } /** @@ -4811,7 +4776,6 @@ const scrollspyComponent = 'ScrollSpy'; // SCROLLSPY PRIVATE GC // ==================== const scrollspySelector = '[data-bs-spy="scroll"]'; -const { on: on$2, off: off$2 } = EventListener; const scrollspyDefaults = { offset: 10, @@ -4957,7 +4921,7 @@ function activate(self, item) { * @param {boolean=} add when `true`, listener is added */ function toggleSpyHandlers(self, add) { - const action = add ? on$2 : off$2; + const action = add ? addListener : removeListener; // @ts-ignore action(self.scrollTarget, scrollEvent, self.refresh, passiveHandler); } @@ -5101,7 +5065,6 @@ const tabComponent = 'Tab'; // TAB PRIVATE GC // ================ const tabSelector = `[${dataBsToggle}="${tabString}"]`; -const { on: on$1, off: off$1 } = EventListener; /** * Static method which returns an existing `Tab` instance associated @@ -5250,7 +5213,7 @@ function getActiveTab(self) { * @param {boolean=} add when `true`, event listener is added */ function toggleTabHandler(self, add) { - const action = add ? on$1 : off$1; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, tabClickHandler); } @@ -5382,7 +5345,6 @@ const toastDismissSelector = `[${dataBsDismiss}="${toastString}"]`; const showingClass = 'showing'; /** @deprecated */ const hideClass = 'hide'; -const { on, off } = EventListener; const toastDefaults = { animation: true, @@ -5483,7 +5445,7 @@ function showToast(self) { * @param {boolean=} add when `true`, it will add the listener */ function toggleToastHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, dismiss, options } = self; if (dismiss) { action(dismiss, mouseclickEvent, self.hide); @@ -5615,29 +5577,6 @@ ObjectAssign(Toast, { getInstance: getToastInstance, }); -/** - * Add an `eventListener` to an `Element` | `HTMLElement` | `Document` | `Window` - * target and remove it once callback is called. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function one(element, eventName, handler, options) { -/** - * Wrap the handler for easy on -> off - * @type {EventListenerObject['handleEvent']} - */ - const handlerWrapper = (e) => { - if (e.target === element) { - handler.apply(element, [e]); - off$b(element, eventName, handlerWrapper, options); - } - }; - on$b(element, eventName, handlerWrapper, options); -} - /** * Check if element matches a CSS selector. * @@ -5721,7 +5660,7 @@ function removeDataAPI(context) { // bulk initialize all components if (document.body) initCallback(); else { - one(document, 'DOMContentLoaded', () => initCallback()); + addListener(document, 'DOMContentLoaded', () => initCallback(), { once: true }); } const BSN = { @@ -5741,6 +5680,7 @@ const BSN = { initCallback, removeDataAPI, Version, + EventListener, }; export { BSN as default }; diff --git a/dist/bootstrap-native.esm.min.js b/dist/bootstrap-native.esm.min.js index 69f4cc49..d44b602b 100644 --- a/dist/bootstrap-native.esm.min.js +++ b/dist/bootstrap-native.esm.min.js @@ -1,2 +1,2 @@ -// Native JavaScript for Bootstrap v4.1.0alpha4 | 2022 © dnp_theme | MIT-License -function t(t,e){const n=getComputedStyle(t);return e in n?n[e]:""}function e(e){const n=t(e,"transitionProperty"),o=t(e,"transitionDuration"),s=o.includes("ms")?1:1e3,i=n&&"none"!==n?parseFloat(o)*s:0;return Number.isNaN(i)?0:i}function n(t,e,n,o){const s=o||!1;t.addEventListener(e,n,s)}function o(t,e,n,o){const s=o||!1;t.removeEventListener(e,n,s)}function s(s,i){let a=0;const l=new Event("transitionend"),r=e(s),c=function(e){const n=t(e,"transitionProperty"),o=t(e,"transitionDelay"),s=o.includes("ms")?1:1e3,i=n&&"none"!==n?parseFloat(o)*s:0;return Number.isNaN(i)?0:i}(s);if(r){const t=e=>{e.target===s&&(i.apply(s,[e]),o(s,"transitionend",t),a=1)};n(s,"transitionend",t),setTimeout(()=>{a||s.dispatchEvent(l)},r+c+17)}else i.apply(s,[l])}function i(t){return t instanceof HTMLElement?t.ownerDocument:t instanceof Window?t.document:window.document}const a=[Document,Node,Element,HTMLElement],l=[Element,HTMLElement];function r(t,e){const n="string"==typeof t,o=e&&a.some(t=>e instanceof t)?e:i();return!n&&l.some(e=>t instanceof e)?t:n?o.querySelector(t):null}function c(t,e){return t?t.closest(e)||c(t.getRootNode().host,e):null}const d=(t,e)=>Object.assign(t,e);function h(t,e){return t.classList.contains(e)}function u(t,e){t.classList.remove(e)}const f=(t,e)=>t.dispatchEvent(e),p=new Map,g={set:(t,e,n)=>{const o=r(t);if(!o)return;p.has(e)||p.set(e,new Map);p.get(e).set(o,n)},getAllFor:t=>p.get(t)||null,get:(t,e)=>{const n=r(t),o=g.getAllFor(e);return n&&o&&o.get(n)||null},remove:(t,e)=>{const n=r(t),o=p.get(e);o&&n&&(o.delete(n),0===o.size&&p.delete(e))}},m=(t,e)=>g.get(t,e);function b(t,e){const n=new CustomEvent(t,{cancelable:!0,bubbles:!0});return e instanceof Object&&d(n,e),n}const v={};function w(t){const e=this,{type:n}=t;(v[n]?[...v[n]]:[]).forEach(o=>{const[s,i]=o;[...i].forEach(o=>{if(s===e){const[e,i]=o;e.apply(s,[t]),i&&i.once&&y(s,n,e,i)}})})}const y=(t,e,n,o)=>{const s=v[e],i=s&&s.get(t),a=i&&i.get(n),{options:l}=void 0!==a?a:{options:o};i&&i.has(n)&&i.delete(n),!s||i&&i.size||s.delete(t),s&&s.size||delete v[e],i&&i.size||t.removeEventListener(e,w,l)},T={on:(t,e,n,o)=>{v[e]||(v[e]=new Map);const s=v[e];s.has(t)||s.set(t,new Map);const i=s.get(t),{size:a}=i;i&&i.set(n,o),a||t.addEventListener(e,w,o)},off:y,globalListener:w,registry:v},E=(t,e)=>t.getAttribute(e);function x(t){return"true"===t||"false"!==t&&(Number.isNaN(+t)?""===t||"null"===t?null:t:+t)}const H=t=>Object.keys(t),k=t=>t.toLowerCase();class A{constructor(t,e){const n=this,o=r(t);if(!o)throw Error(`${n.name} Error: "${t}" is not a valid selector.`);n.options={};const s=g.get(o,n.name);s&&s.dispose(),n.element=o,n.defaults&&Object.keys(n.defaults).length&&(n.options=function(t,e,n,o){const s={...t.dataset},i={},a={};return H(s).forEach(t=>{const e=o&&t.includes(o)?t.replace(o,"").replace(/[A-Z]/,t=>k(t)):t;a[e]=x(s[t])}),H(n).forEach(t=>{n[t]=x(n[t])}),H(e).forEach(o=>{i[o]=o in n?n[o]:o in a?a[o]:"title"===o?E(t,"title"):e[o]}),i}(o,n.defaults,e||{},"bs")),g.set(o,n.name,n)}get version(){return"4.1.0alpha4"}get name(){return this.constructor.name}get defaults(){return this.constructor.defaults}dispose(){const t=this;g.remove(t.element,t.name),H(t).forEach(e=>{t[e]=null})}}const{on:P,off:M}=T,N=t=>m(t,"Alert"),L=b("close.bs.alert"),D=b("closed.bs.alert");function C(t){const{element:e}=t;S(t),f(e,D),t.dispose(),e.remove()}function S(t,e){const n=e?P:M,{dismiss:o}=t;o&&n(o,"click",t.close)}class I extends A{constructor(t){super(t);const{element:e}=this;this.dismiss=r('[data-bs-dismiss="alert"]',e),S(this,!0)}get name(){return"Alert"}close(t){const e=t?N(c(this,".alert")):this;if(!e)return;const{element:n}=e;if(h(n,"show")){if(f(n,L),L.defaultPrevented)return;u(n,"show"),h(n,"fade")?s(n,()=>C(e)):C(e)}}dispose(){S(this),super.dispose()}}d(I,{selector:".alert",init:t=>new I(t),getInstance:N});const R=(t,e,n)=>t.setAttribute(e,n);function $(t,e){t.classList.add(e)}const O="data-bs-toggle",{on:W,off:F}=T,B=t=>m(t,"Button");function z(t,e){(e?W:F)(t.element,"click",t.toggle)}class X extends A{constructor(t){super(t);const{element:e}=this;this.isActive=h(e,"active"),R(e,"aria-pressed",""+!!this.isActive),z(this,!0)}get name(){return"Button"}toggle(t){t&&t.preventDefault();const e=t?B(this):this;if(!e)return;const{element:n}=e;if(h(n,"disabled"))return;e.isActive=h(n,"active");const{isActive:o}=e;(o?u:$)(n,"active"),R(n,"aria-pressed",o?"false":"true")}dispose(){z(this),super.dispose()}}d(X,{selector:'[data-bs-toggle="button"]',init:t=>new X(t),getInstance:B});const j="mouseenter",Y="mouseleave";function V(t){if(null==t)return window;if(!(t instanceof Window)){const{ownerDocument:e}=t;return e&&e.defaultView||window}return t}function q(t,e){const{width:n,height:o,top:s,right:i,bottom:a,left:l}=t.getBoundingClientRect();let r=1,c=1;if(e&&t instanceof HTMLElement){const{offsetWidth:e,offsetHeight:s}=t;r=e>0&&Math.round(n)/e||1,c=s>0&&Math.round(o)/s||1}return{width:n/r,height:o/c,top:s/c,right:i/r,bottom:a/c,left:l/r,x:l/r,y:s/c}}function U(t){return i(t).documentElement}const G=t=>{const{top:e,bottom:n}=q(t),{clientHeight:o}=U(t);return e<=o&&n>=0},Z=t=>"rtl"===U(t).dir;function J(t,e){return(e&&a.some(t=>e instanceof t)?e:i()).querySelectorAll(t)}function K(t,e){return(e&&a.some(t=>e instanceof t)?e:i()).getElementsByClassName(t)}const Q=new Map,_=(t,e,n,o)=>{const s=r(t);if(s)if(o&&o.length){Q.has(s)||Q.set(s,new Map);Q.get(s).set(o,setTimeout(e,n))}else Q.set(s,setTimeout(e,n))},tt=(t,e)=>{const n=r(t);if(!n)return null;const o=Q.get(n);return e&&e.length&&o&&o.get?o.get(e)||null:o||null},et=(t,e)=>{const n=r(t);if(n)if(e&&e.length){const t=Q.get(n);t&&t.get&&(clearTimeout(t.get(e)),t.delete(e),0===t.size&&Q.delete(n))}else clearTimeout(Q.get(n)),Q.delete(n)},nt=t=>t.offsetHeight,ot={passive:!0};function st(t){const e=["data-bs-target","data-bs-parent","data-bs-container","href"],n=i(t);return e.map(e=>{const o=E(t,e);return o?"data-bs-parent"===e?c(t,o):r(o,n):null}).filter(t=>t)[0]}const it="carousel-item",{on:at,off:lt}=T,rt={pause:"hover",keyboard:!1,touch:!0,interval:5e3},ct=t=>m(t,"Carousel");let dt=0,ht=0,ut=0;const ft=b("slide.bs.carousel"),pt=b("slid.bs.carousel");function gt(){const t=this,e=ct(t);!e||e.isPaused||tt(t,"paused")||$(t,"paused")}function mt(){const t=ct(this);t&&t.isPaused&&!tt(this,"paused")&&t.cycle()}function bt(t){t.preventDefault();const e=c(this,'[data-bs-ride="carousel"]')||st(this);if(!e)return;const n=ct(e);if(!n||n.isAnimating)return;const o=+E(this,"data-bs-slide-to");!this||h(this,"active")||Number.isNaN(o)||n.to(o)}function vt(t){t.preventDefault();const e=c(this,'[data-bs-ride="carousel"]')||st(this),n=e&&ct(e);if(!n||n.isAnimating)return;const o=E(this,"data-bs-slide");"next"===o?n.next():"prev"===o&&n.prev()}function wt({code:t}){const[e]=[...J('[data-bs-ride="carousel"]')].filter(t=>G(t)),n=ct(e);if(!n)return;const o=Z(),s=o?"ArrowLeft":"ArrowRight";t===(o?"ArrowRight":"ArrowLeft")?n.prev():t===s&&n.next()}function yt(t){const e=ct(this);e&&!e.isTouch&&(dt=t.changedTouches[0].pageX,this.contains(t.target)&&(e.isTouch=!0,Ht(e,!0)))}function Tt(t){const{changedTouches:e,type:n}=t,o=ct(this);o&&o.isTouch&&(ht=e[0].pageX,"touchmove"===n&&e.length>1&&t.preventDefault())}function Et(t){const e=this,n=ct(e);if(n&&n.isTouch&&(ut=ht||t.changedTouches[0].pageX,n.isTouch)){if((!e.contains(t.target)||!e.contains(t.relatedTarget))&&Math.abs(dt-ut)<75)return;htdt&&(n.index-=1),n.isTouch=!1,n.to(n.index),Ht(n)}}function xt(t,e){const{indicators:n}=t;[...n].forEach(t=>u(t,"active")),t.indicators[e]&&$(n[e],"active")}function Ht(t,e){const{element:n}=t,o=e?at:lt;o(n,"touchmove",Tt,ot),o(n,"touchend",Et,ot)}function kt(t,e){const{element:n,options:o,slides:s,controls:i,indicators:a}=t,{touch:l,pause:r,interval:c,keyboard:d}=o,h=e?at:lt;r&&c&&(h(n,j,gt),h(n,Y,mt),h(n,"touchstart",gt,ot),h(n,"touchend",mt,ot)),l&&s.length>1&&h(n,"touchstart",yt,ot),i.length&&i.forEach(t=>{t&&h(t,"click",vt)}),a.length&&a.forEach(t=>{h(t,"click",bt)}),d&&h(V(n),"keydown",wt)}function At(t){const{slides:e,element:n}=t,o=r(".carousel-item.active",n);return[...e].indexOf(o)}class Pt extends A{constructor(t,e){super(t,e);const n=this;n.direction=Z()?"right":"left",n.index=0,n.isTouch=!1;const{element:o}=n;n.slides=K(it,o);const{slides:s}=n;if(s.length<2)return;n.controls=[...J("[data-bs-slide]",o),...J(`[data-bs-slide][data-bs-target="#${o.id}"]`)],n.indicator=r(".carousel-indicators",o),n.indicators=[...n.indicator?J("[data-bs-slide-to]",n.indicator):[],...J(`[data-bs-slide-to][data-bs-target="#${o.id}"]`)];const{options:i}=n;n.options.interval=!0===i.interval?rt.interval:i.interval,At(n)<0&&(s.length&&$(s[0],"active"),n.indicators.length&&xt(n,0)),kt(n,!0),i.interval&&n.cycle()}get name(){return"Carousel"}get defaults(){return rt}get isPaused(){return h(this.element,"paused")}get isAnimating(){return null!==r(".carousel-item-next,.carousel-item-prev",this.element)}cycle(){const t=this,{element:e,options:n,isPaused:o}=t;et(e,"carousel"),o&&(et(e,"paused"),u(e,"paused")),_(e,()=>{!t.isPaused&&G(e)&&(t.index+=1,t.to(t.index))},n.interval,"carousel")}pause(){const{element:t,options:e}=this;!this.isPaused&&e.interval&&($(t,"paused"),_(t,()=>{},1,"paused"))}next(){const t=this;t.isAnimating||(t.index+=1,t.to(t.index))}prev(){const t=this;t.isAnimating||(t.index-=1,t.to(t.index))}to(t){const n=this,{element:o,slides:a,options:l}=n,r=At(n),c=Z();let p=t;if(n.isAnimating||r===p)return;rp||r===a.length-1&&0===p)&&(n.direction=c?"left":"right");const{direction:g}=n;p<0?p=a.length-1:p>=a.length&&(p=0);const m="left"===g?"next":"prev",b="left"===g?"start":"end",v={relatedTarget:a[p],from:r,to:p,direction:g};d(ft,v),d(pt,v),f(o,ft),ft.defaultPrevented||(n.index=p,xt(n,p),e(a[p])&&h(o,"slide")?_(o,()=>{$(a[p],"carousel-item-"+m),nt(a[p]),$(a[p],"carousel-item-"+b),$(a[r],"carousel-item-"+b),s(a[p],()=>function(t){const{index:e,direction:n,element:o,slides:s,options:a}=t;if(t.isAnimating&&ct(o)){const l=At(t),r="left"===n?"next":"prev",c="left"===n?"start":"end";$(s[e],"active"),u(s[e],"carousel-item-"+r),u(s[e],"carousel-item-"+c),u(s[l],"active"),u(s[l],"carousel-item-"+c),f(o,pt),et(o,"data-bs-slide"),i(o).hidden||!a.interval||t.isPaused||t.cycle()}}(n))},17,"data-bs-slide"):($(a[p],"active"),u(a[r],"active"),_(o,()=>{et(o,"data-bs-slide"),o&&l.interval&&!n.isPaused&&n.cycle(),f(o,pt)},17,"data-bs-slide")))}dispose(){const t=this,{slides:e}=t,n=["start","end","prev","next"];[...e].forEach((e,o)=>{h(e,"active")&&xt(t,o),n.forEach(t=>u(e,"carousel-item-"+t))}),kt(t),super.dispose()}}d(Pt,{selector:'[data-bs-ride="carousel"]',init:t=>new Pt(t),getInstance:ct});const Mt={parent:null},{on:Nt,off:Lt}=T,Dt=t=>m(t,"Collapse"),Ct=b("show.bs.collapse"),St=b("shown.bs.collapse"),It=b("hide.bs.collapse"),Rt=b("hidden.bs.collapse");function $t(t){const{element:e,parent:n,triggers:o}=t;f(e,It),It.defaultPrevented||(_(e,()=>{},17),n&&_(n,()=>{},17),e.style.height=e.scrollHeight+"px",u(e,"collapse"),u(e,"show"),$(e,"collapsing"),nt(e),e.style.height="0px",s(e,()=>{et(e),n&&et(n),o.forEach(t=>R(t,"aria-expanded","false")),u(e,"collapsing"),$(e,"collapse"),e.style.height="",f(e,Rt)}))}function Ot(t,e){const n=e?Nt:Lt,{triggers:o}=t;o.length&&o.forEach(t=>n(t,"click",Wt))}function Wt(t){const{target:e}=t,n=e&&c(e,'[data-bs-toggle="collapse"]'),o=n&&st(n),s=o&&Dt(o);s&&s.toggle(),n&&"A"===n.tagName&&t.preventDefault()}class Ft extends A{constructor(t,e){super(t,e);const{element:n,options:o}=this;this.triggers=[...J('[data-bs-toggle="collapse"]')].filter(t=>st(t)===n),this.parent=r(o.parent),Ot(this,!0)}get name(){return"Collapse"}get defaults(){return Mt}toggle(){h(this.element,"show")?this.hide():this.show()}hide(){const{triggers:t,element:e}=this;tt(e)||($t(this),t.length&&t.forEach(t=>$(t,"collapsed")))}show(){const t=this,{element:e,parent:n,triggers:o}=t;let i,a;n&&(i=[...J(".collapse.show",n)].find(t=>Dt(t)),a=i&&Dt(i)),n&&(!n||tt(n))||tt(e)||(a&&i!==e&&($t(a),a.triggers.forEach(t=>{$(t,"collapsed")})),function(t){const{element:e,parent:n,triggers:o}=t;f(e,Ct),Ct.defaultPrevented||(_(e,()=>{},17),n&&_(n,()=>{},17),$(e,"collapsing"),u(e,"collapse"),e.style.height=e.scrollHeight+"px",s(e,()=>{et(e),n&&et(n),o.forEach(t=>R(t,"aria-expanded","true")),u(e,"collapsing"),$(e,"collapse"),$(e,"show"),e.style.height="",f(e,St)}))}(t),o.length&&o.forEach(t=>u(t,"collapsed")))}dispose(){Ot(this),super.dispose()}}d(Ft,{selector:".collapse",init:t=>new Ft(t),getInstance:Dt});const Bt="scroll",zt="resize",Xt="ArrowUp",jt="ArrowDown",Yt=(t,e)=>t.hasAttribute(e),Vt=(t,e)=>{d(t.style,e)},qt=t=>t.focus(),Ut=["dropdown","dropup","dropstart","dropend"];function Gt(t){const e=c(t,"A");return t&&(Yt(t,"href")&&"#"===t.href.slice(-1)||e&&Yt(e,"href")&&"#"===e.href.slice(-1))}const[Zt,Jt,Kt,Qt]=Ut,_t=`[data-bs-toggle="${Zt}"]`,{on:te,off:ee}=T,ne=t=>m(t,"Dropdown"),oe=[Zt,Jt],se=[Kt,Qt],ie=["A","BUTTON"],ae={offset:5,display:"dynamic"},le=b("show.bs."+Zt),re=b("shown.bs."+Zt),ce=b("hide.bs."+Zt),de=b("hidden.bs."+Zt);function he(e){const{element:n,menu:o,parentElement:s,options:i}=e,{offset:a}=i;if("static"===t(o,"position"))return;const l=Z(n),r=h(s,"dropdown-menu-end");["margin","top","bottom","left","right"].forEach(t=>{o.style[t]=""});let c=Ut.find(t=>h(s,t))||Zt,u={dropdown:[a,0,0],dropup:[0,0,a],dropstart:l?[-1,0,0,a]:[-1,a,0],dropend:l?[-1,a,0]:[-1,0,0,a]};const f={dropdown:{top:"100%"},dropup:{top:"auto",bottom:"100%"},dropstart:l?{left:"100%",right:"auto"}:{left:"auto",right:"100%"},dropend:l?{left:"auto",right:"100%"}:{left:"100%",right:"auto"},menuEnd:l?{right:"auto",left:0}:{right:0,left:"auto"}},{offsetWidth:p,offsetHeight:g}=o,{clientWidth:m,clientHeight:b}=U(n),{left:v,top:w,width:y,height:T}=q(n),E=v-p-a<0,x=v+p+y+a>=m,H=w+g+a>=b,k=w+g+T+a>=b,A=w-g-a<0,P=(!l&&r||l&&!r)&&v+y-p<0,M=(l&&r||!l&&!r)&&v+p>=m;se.includes(c)&&E&&x&&(c=Zt),c===Kt&&(l?x:E)&&(c=Qt),c===Qt&&(l?E:x)&&(c=Kt),c===Jt&&A&&!k&&(c=Zt),c===Zt&&k&&!A&&(c=Jt),se.includes(c)&&H&&d(f[c],{top:"auto",bottom:0}),oe.includes(c)&&(P||M)&&v+y+Math.abs(p-y)+at?t+"px":t).join(" "),Vt(o,f[c]),h(o,"dropdown-menu-end")&&Vt(o,f.menuEnd)}function ue(t){const{element:e}=t,n=t.open?te:ee,o=i(e);n(o,"click",ge),n(o,"focus",ge),n(o,"keydown",be),n(o,"keyup",ve),"dynamic"===t.options.display&&[Bt,zt].forEach(t=>{n(V(e),t,we,ot)})}function fe(t,e){(e?te:ee)(t.element,"click",me)}function pe(t){const e=[...Ut,"btn-group","input-group"].map(t=>K(t+" show"),i(t)).find(t=>t.length);return e&&e.length?[...e[0].children].find(t=>Yt(t,O)):null}function ge(t){const{target:e,type:n}=t;if(!e||!e.closest)return;const o=pe(e);if(!o)return;const s=ne(o);if(!s)return;const{parentElement:i,menu:a}=s,l=null!==c(e,_t),r=i&&i.contains(e)&&("form"===e.tagName||null!==c(e,"form"));"click"===n&&Gt(e)&&t.preventDefault(),("focus"!==n||e!==o&&e!==a&&!a.contains(e))&&(r||l||s&&s.hide())}function me(t){const{target:e}=t,n=ne(this);n&&(n.toggle(),e&&Gt(e)&&t.preventDefault())}function be(t){[jt,Xt].includes(t.code)&&t.preventDefault()}function ve(t){const{code:e}=t,n=pe(this),o=n&&ne(n),s=n&&i(n).activeElement;if(!o||!s)return;const{menu:a,open:l}=o,r=function(t){return[...t.children].map(t=>{if(t&&ie.includes(t.tagName))return t;const{firstElementChild:e}=t;return e&&ie.includes(e.tagName)?e:null}).filter(t=>t)}(a);if(r&&r.length&&[jt,Xt].includes(e)){let t=r.indexOf(s);s===n?t=0:e===Xt?t=t>1?t-1:0:e===jt&&(t=t{t.relatedTarget=e}),f(s,le),le.defaultPrevented||($(o,"show"),$(s,"show"),R(e,"aria-expanded","true"),he(t),t.open=!n,setTimeout(()=>{qt(e),ue(t),f(s,re)},1))}hide(){const t=this,{element:e,open:n,menu:o,parentElement:s}=t;[ce,de].forEach(t=>{t.relatedTarget=e}),f(s,ce),ce.defaultPrevented||(u(o,"show"),u(s,"show"),R(e,"aria-expanded","false"),t.open=!n,setTimeout(()=>ue(t),1),f(s,de))}dispose(){const{parentElement:t}=this;h(t,"show")&&this.open&&this.hide(),fe(this),super.dispose()}}d(ye,{selector:_t,init:t=>new ye(t),getInstance:ne});const Te=(t,e)=>t.removeAttribute(e);function Ee(t){return i(t).body}const xe=t=>t instanceof V(t).ShadowRoot||t instanceof ShadowRoot;const He=t=>["TABLE","TD","TH"].includes(t.tagName),ke=t=>t instanceof HTMLElement;function Ae(e,n){const o=["HTML","BODY"];if(n){let{offsetParent:n}=e;const s=V(e);for(;n&&(He(n)||ke(n)&&!["sticky","fixed"].includes(t(n,"position")));)n=n.offsetParent;return(!n||n&&(o.includes(n.tagName)||"static"===t(n,"position")))&&(n=s),n}const s=[];let{parentNode:i}=e;for(;i&&!o.includes(i.nodeName);)i="HTML"===(a=i).nodeName?a:a.assignedSlot||a.parentNode||(xe(a)?a.host:null)||U(a),xe(i)||i.shadowRoot||He(i)||s.push(i);var a;return s.find((e,n)=>"relative"!==t(e,"position")&&s.slice(n+1).every(e=>"static"===t(e,"position"))?e:null)||Ee(e)}const Pe="sticky-top",Me="position-sticky",Ne=t=>[...K("fixed-top",t),...K("fixed-bottom",t),...K(Pe,t),...K(Me,t),...K("is-fixed",t)];function Le(t){const{clientWidth:e}=U(t),{innerWidth:n}=V(t);return Math.abs(n-e)}function De(e,n){const o=Ee(e),s=parseInt(t(o,"paddingRight"),10),i="hidden"===t(o,"overflow")&&s?0:Le(e),a=Ne(o);n&&(Vt(o,{overflow:"hidden",paddingRight:s+i+"px"}),a.length&&a.forEach(e=>{const n=t(e,"paddingRight");if(e.style.paddingRight=parseInt(n,10)+i+"px",[Pe,Me].some(t=>h(e,t))){const n=t(e,"marginRight");e.style.marginRight=parseInt(n,10)-i+"px"}}))}const Ce="modal-backdrop",Se="offcanvas-backdrop",Ie=i().createElement("div");function Re(t){return r(".modal.show,.offcanvas.show",i(t))}function $e(t){const e=t?Ce:Se;[Ce,Se].forEach(t=>{u(Ie,t)}),$(Ie,e)}function Oe(t,e,n){$e(n),t.append(Ie),e&&$(Ie,"fade")}function We(){$(Ie,"show"),nt(Ie)}function Fe(){u(Ie,"show")}function Be(t){Re(t)||(u(Ie,"fade"),Ie.remove(),function(t){const e=Ee(t);Vt(e,{paddingRight:"",overflow:""});const n=Ne(e);n.length&&n.forEach(t=>{Vt(t,{paddingRight:"",marginRight:""})})}(t))}function ze(e){return e&&"hidden"!==t(e,"visibility")&&null!==e.offsetParent}const{on:Xe,off:je}=T,Ye={backdrop:!0,keyboard:!0},Ve=t=>m(t,"Modal"),qe=b("show.bs.modal"),Ue=b("shown.bs.modal"),Ge=b("hide.bs.modal"),Ze=b("hidden.bs.modal");function Je(t){const{element:e}=t,n=Le(e),{clientHeight:o,scrollHeight:s}=U(e),{clientHeight:i,scrollHeight:a}=e,l=i!==a;if(!l&&n){const t=Z(e)?"paddingLeft":"paddingRight";e.style[t]=n+"px"}De(e,l||o!==s)}function Ke(t,e){const n=e?Xe:je,{element:o}=t;n(o,"click",an),n(V(o),zt,t.update,ot),n(i(o),"keydown",sn)}function Qe(t,e){const n=e?Xe:je,{triggers:o}=t;o.length&&o.forEach(t=>n(t,"click",on))}function _e(t){const{triggers:e,element:n}=t;if(Be(n),n.style.paddingRight="",e.length){const t=e.find(t=>ze(t));t&&qt(t)}}function tn(t){const{element:e,relatedTarget:n}=t;qt(e),Ke(t,!0),Ue.relatedTarget=n,f(e,Ue)}function en(t){const{element:e,hasFade:n}=t;e.style.display="block",Je(t),Re(e)||(Ee(e).style.overflow="hidden"),$(e,"show"),Te(e,"aria-hidden"),R(e,"aria-modal","true"),n?s(e,()=>tn(t)):tn(t)}function nn(t,e){const{element:n,options:o,relatedTarget:i,hasFade:a}=t;n.style.display="",o.backdrop&&!e&&a&&h(Ie,"show")&&!Re(n)?(Fe(),s(Ie,()=>_e(t))):_e(t),Ke(t),Ze.relatedTarget=i,f(n,Ze)}function on(t){const{target:e}=t,n=e&&c(this,'[data-bs-toggle="modal"]'),o=n&&st(n),s=o&&Ve(o);s&&(n&&"A"===n.tagName&&t.preventDefault(),s.relatedTarget=n,s.toggle())}function sn({code:t}){const e=r(".modal.show"),n=e&&Ve(e);if(!n)return;const{options:o}=n;o.keyboard&&"Escape"===t&&h(e,"show")&&(n.relatedTarget=null,n.hide())}function an(t){const n=this,o=Ve(n);if(!o||tt(n))return;const{options:a,isStatic:l,modalDialog:r}=o,{backdrop:d}=a,{target:h}=t,f=i(n).getSelection().toString().length,p=r.contains(h),g=h&&c(h,'[data-bs-dismiss="modal"]');l&&!p?_(n,()=>{$(n,"modal-static"),s(r,()=>function(t){const{element:n,modalDialog:o}=t,s=e(o)+17;u(n,"modal-static"),_(n,()=>et(n),s)}(o))},17):(g||!f&&!l&&!p&&d)&&(o.relatedTarget=g||null,o.hide(),t.preventDefault())}class ln extends A{constructor(t,e){super(t,e);const{element:n}=this;this.modalDialog=r(".modal-dialog",n),this.triggers=[...J('[data-bs-toggle="modal"]')].filter(t=>st(t)===n),this.isStatic="static"===this.options.backdrop,this.hasFade=h(n,"fade"),this.relatedTarget=null,this.container=Ae(n),Qe(this,!0),this.update=this.update.bind(this)}get name(){return"Modal"}get defaults(){return Ye}toggle(){h(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:n,options:o,hasFade:s,relatedTarget:i,container:a}=t,{backdrop:l}=o;let r=0;if(h(n,"show"))return;if(qe.relatedTarget=i||null,f(n,qe),qe.defaultPrevented)return;const c=Re(n);if(c&&c!==n){(Ve(c)||m(c,"Offcanvas")).hide()}l?(c||h(Ie,"show")?$e(!0):Oe(a,s,!0),r=e(Ie),h(Ie,"show")||We(),setTimeout(()=>en(t),r)):(en(t),c&&h(Ie,"show")&&Fe())}hide(t){const e=this,{element:n,hasFade:o,relatedTarget:i}=e;h(n,"show")&&(Ge.relatedTarget=i||null,f(n,Ge),Ge.defaultPrevented||(u(n,"show"),R(n,"aria-hidden","true"),Te(n,"aria-modal"),o&&!1!==t?s(n,()=>nn(e)):nn(e,t)))}update(){h(this.element,"show")&&Je(this)}dispose(){this.hide(!0),Qe(this),super.dispose()}}d(ln,{selector:".modal",init:t=>new ln(t),getInstance:Ve});const{on:rn,off:cn}=T,dn={backdrop:!0,keyboard:!0,scroll:!1},hn=t=>m(t,"Offcanvas"),un=b("show.bs.offcanvas"),fn=b("shown.bs.offcanvas"),pn=b("hide.bs.offcanvas"),gn=b("hidden.bs.offcanvas");function mn(t,e){const n=e?rn:cn;t.triggers.forEach(t=>n(t,"click",yn))}function bn(t,e){const n=e?rn:cn,o=i(t.element);n(o,"keydown",En),n(o,"click",Tn)}function vn(t){const{element:e,options:n}=t;n.scroll||(!function(t){const{element:e}=t,{clientHeight:n,scrollHeight:o}=U(e);De(e,n!==o)}(t),Ee(e).style.overflow="hidden"),$(e,"offcanvas-toggling"),$(e,"show"),e.style.visibility="visible",s(e,()=>function(t){const{element:e,triggers:n}=t;u(e,"offcanvas-toggling"),Te(e,"aria-hidden"),R(e,"aria-modal","true"),R(e,"role","dialog"),n.length&&n.forEach(t=>R(t,"aria-expanded","true"));f(e,fn),bn(t,!0),qt(e)}(t))}function wn(t){const{element:e,options:n}=t,o=Re(e);e.blur(),!o&&n.backdrop&&h(Ie,"show")?(Fe(),s(Ie,()=>xn(t))):xn(t)}function yn(t){const e=c(this,'[data-bs-toggle="offcanvas"]'),n=e&&st(e),o=n&&hn(n);o&&(o.relatedTarget=e,o.toggle(),e&&"A"===e.tagName&&t.preventDefault())}function Tn(t){const e=r(".offcanvas.show",this);if(!e)return;const n=r('[data-bs-dismiss="offcanvas"]',e),o=hn(e);if(!o)return;const{options:s,triggers:a}=o,{target:l}=t,d=c(l,'[data-bs-toggle="offcanvas"]'),h=i(e).getSelection();h&&h.toString().length||!(!e.contains(l)&&s.backdrop&&(!d||d&&!a.includes(d))||n&&n.contains(l))||(o.relatedTarget=n&&n.contains(l)?n:null,o.hide()),d&&"A"===d.tagName&&t.preventDefault()}function En({code:t}){const e=r(".offcanvas.show",this);if(!e)return;const n=hn(e);n&&n.options.keyboard&&"Escape"===t&&(n.relatedTarget=null,n.hide())}function xn(t){const{element:e,triggers:n}=t;if(R(e,"aria-hidden","true"),Te(e,"aria-modal"),Te(e,"role"),e.style.visibility="",n.length){n.forEach(t=>R(t,"aria-expanded","false"));const t=n.find(t=>ze(t));t&&qt(t)}Be(e),f(e,gn),u(e,"offcanvas-toggling"),Re(e)||bn(t)}class Hn extends A{constructor(t,e){super(t,e);const{element:n}=this;this.triggers=[...J('[data-bs-toggle="offcanvas"]')].filter(t=>st(t)===n),this.container=Ae(n),this.relatedTarget=null,mn(this,!0)}get name(){return"Offcanvas"}get defaults(){return dn}toggle(){h(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:n,options:o,container:s,relatedTarget:i}=t;let a=0;if(h(n,"show"))return;if(un.relatedTarget=i,fn.relatedTarget=i,f(n,un),un.defaultPrevented)return;const l=Re(n);if(l&&l!==n){(hn(l)||m(l,"Modal")).hide()}o.backdrop?(l?$e():Oe(s,!0),a=e(Ie),h(Ie,"show")||We(),setTimeout(()=>vn(t),a)):(vn(t),l&&h(Ie,"show")&&Fe())}hide(t){const e=this,{element:n,relatedTarget:o}=e;h(n,"show")&&(pn.relatedTarget=o,gn.relatedTarget=o,f(n,pn),pn.defaultPrevented||($(n,"offcanvas-toggling"),u(n,"show"),t?wn(e):s(n,()=>wn(e))))}dispose(){this.hide(!0),mn(this),super.dispose()}}d(Hn,{selector:".offcanvas",init:t=>new Hn(t),getInstance:hn});function kn(t){const e="tooltip"===t;return``}const An=t=>t&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(e=>t instanceof e);function Pn(t,e,n){const o=e instanceof HTMLElement,s=q(t,o&&function(t){const{width:e,height:n}=q(t),{offsetWidth:o,offsetHeight:s}=t;return Math.round(e)!==o||Math.round(n)!==s}(e)),i={x:0,y:0};if(o){const t=q(e,!0);i.x=t.x+e.clientLeft,i.y=t.y+e.clientTop}return{x:s.left+n.x-i.x,y:s.top+n.y-i.y,width:s.width,height:s.height}}var Mn={top:"top",bottom:"bottom",left:"start",right:"end"};function Nn(e,n){const o=/\b(top|bottom|start|end)+/,{element:s,tooltip:i,options:a,arrow:l,offsetParent:r}=e,c={...Mn};Vt(i,{top:"0px",left:"0px",right:""});const d="Popover"===e.name,h=i.offsetWidth,u=i.offsetHeight,f=Z(s);f&&(c.left="end",c.right="start");const p=U(s),g=p.clientWidth,m=p.clientHeight,{container:b}=a;let{placement:v}=a;const{left:w,right:y,top:T}=q(b,!0),E=b.clientWidth,x=Math.abs(E-b.offsetWidth),H=t(b,"position"),k="fixed"===H,A="static"===H,P="sticky"===H&&T===parseFloat(t(b,"top")),M=f&&k?x:0,N=k?E+w+(f?x:0):E+w+(g-y)-1,{width:L,height:D,left:C,right:S,top:I}=q(s,!0),R=function(t){const e="scrollX"in t;return{x:e?t.scrollX:t.scrollLeft,y:e?t.scrollY:t.scrollTop}}(r),{x:$,y:O}=Pn(s,r,R);let W,F,B,z,X,j;Vt(l,{top:"",left:"",right:""});const Y=l.offsetWidth||0,V=l.offsetHeight||0,G=Y/2;let J=I-u-V<0,K=I+u+D+V>=m,Q=C-h-Y=N;const tt=["left","right"],et=["top","bottom"];if(J=tt.includes(v)?I+D/2-u/2-V<0:J,K=tt.includes(v)?I+u/2+D/2+V>=m:K,Q=et.includes(v)?C+L/2-h/2=N:_,v=tt.includes(v)&&Q&&_?"top":v,v="top"===v&&J?"bottom":v,v="bottom"===v&&K?"top":v,v="left"===v&&Q?"right":v,v="right"===v&&_?"left":v,i.className.includes(v)||(i.className=i.className.replace(o,c[v])),tt.includes(v))F="left"===v?$-h-(d?Y:0):$+L+(d?Y:0),J?(W=O,W+=P?-T-R.y:0,z=D/2-Y):K?(W=O-u+D,W+=P?-T-R.y:0,z=u-D/2-Y):(W=O-u/2+D/2,W+=P?-T-R.y:0,z=u/2-V/2);else if(et.includes(v))if(n&&An(s)){let t=0,e=0;A?(t=n.pageX,e=n.pageY):(t=n.clientX-w+(k?R.x:0),e=n.clientY-T+(k?R.y:0)),t-=f&&k&&x?x:0,W="top"===v?e-u-Y:e+Y,n.clientX-h/2N?(F="auto",B=0,j=N-t-G,j-=k?w+(f?x:0):0):(F=t-h/2,X=h/2-G)}else W="top"===v?O-u-(d?V:0):O+D+(d?V:0),Q?(F=0,X=$+L/2-G):_?(F="auto",B=0,j=L/2+N-S-G):(F=$-h/2+L/2,X=h/2-G);Vt(i,{top:W+"px",left:"auto"===F?F:F+"px",right:void 0!==B?B+"px":""}),l instanceof HTMLElement&&(void 0!==z&&(l.style.top=z+"px"),void 0!==X?l.style.left=X+"px":void 0!==j&&(l.style.right=j+"px"))}const Ln={template:kn("tooltip"),title:null,customClass:null,trigger:"hover focus",placement:"top",sanitizeFn:null,animation:!0,delay:200,container:null},Dn="focusin",Cn="focusout",{userAgentData:Sn}=navigator,In=Sn,{userAgent:Rn}=navigator,$n=Rn,On=/(iPhone|iPod|iPad)/,Wn=In?In.brands.some(t=>On.test(t.brand)):On.test($n);let Fn=1;const Bn=new Map;function zn(t,e,n){if("string"!=typeof e||e.length)if("string"==typeof e){let o=e.trim();"function"==typeof n&&(o=n(o));const s=(new DOMParser).parseFromString(o,"text/html"),{body:i}=s,a=i.children.length?"innerHTML":"innerText";t[a]=i[a]}else e instanceof HTMLElement&&t.append(e)}function Xn(t,e){return t instanceof HTMLElement&&e.contains(t)}const{on:jn,off:Yn}=T;let Vn=t=>m(t,"Tooltip");function qn(t){const{element:e}=t;Jn(t),e.hasAttribute("data-original-title")&&"tooltip"===t.name&&Qn(t)}function Un(t,e){const n=e?jn:Yn,{element:o}=t;n(i(o),"touchstart",_n,ot),An(o)||[Bt,zt].forEach(e=>{n(V(o),e,t.update,ot)})}function Gn(t){const{element:e}=t,n=b("shown.bs."+k(t.name));Un(t,!0),f(e,n),et(e,"in")}function Zn(t){const{element:e}=t,n=b("hidden.bs."+k(t.name));Un(t),function(t){const{element:e,tooltip:n}=t;Te(e,"aria-describedby"),n.remove()}(t),f(e,n),et(e,"out")}function Jn(t,e){const n=e?jn:Yn,{element:o,options:s,btn:a}=t,{trigger:l,dismissible:r}=s;if(l.includes("manual"))return;t.enabled=!!e;const c=l.split(" "),d=An(o);d&&n(o,"mousemove",t.update,ot),c.forEach(e=>{d||"hover"===e?(n(o,"mousedown",t.show),n(o,j,t.show),r&&a?n(a,"click",t.hide):(n(o,Y,t.hide),n(i(o),"touchstart",_n,ot))):"click"===e?n(o,e,r?t.show:t.toggle):"focus"===e&&(n(o,Dn,t.show),r||n(o,Cn,t.hide),Wn&&n(o,"click",()=>qt(o)))})}function Kn(t,e){const n=e?jn:Yn,{element:o,options:s,offsetParent:i}=t,{container:a}=s,{offsetHeight:l,scrollHeight:r}=a,d=c(o,".modal"),h=c(o,".offcanvas");if(!An(o)){const e=V(o),s=l!==r||i!==e?a:e;n(e,zt,t.update,ot),n(s,Bt,t.update,ot)}d&&jn(d,"hide.bs.modal",t.hide),h&&jn(h,"hide.bs.offcanvas",t.hide)}function Qn(t,e){const n=["data-original-title","title"],{element:o}=t;R(o,n[e?0:1],e||E(o,n[0])),Te(o,n[e?1:0])}function _n({target:t}){const{tooltip:e,element:n}=this;e.contains(t)||t===n||n.contains(t)||this.hide()}class to extends A{constructor(e,n){super(e,n);const o=this,{element:s}=o,a="Tooltip"===o.name,l=a?"tooltip":"popover",c=a?"Tooltip":"Popover";Vn=t=>m(t,c),o.tooltip={},a||(o.btn=null),o.arrow={},o.offsetParent={},o.enabled=!0,o.id=`${l}-${function(t,e){Fn+=1;let n=Bn.get(t),o=Fn;if(e&&e.length)if(n){const t=n.get(e);Number.isNaN(t)?n.set(e,o):o=t}else Bn.set(t,new Map),n=Bn.get(t),n.set(e,o);else Number.isNaN(n)?Bn.set(t,o):o=n;return o}(s,l)}`;const{options:d}=o;if(!d.title&&a||!a&&!d.content)return;const u=r(d.container),f=Ae(s);o.options.container=!u||u&&["static","relative"].includes(t(u,"position"))?f:u||Ee(s),Ln.title=null,_n.bind(o),o.update=o.update.bind(o),o.show=o.show.bind(o),o.hide=o.hide.bind(o),o.toggle=o.toggle.bind(o),s.hasAttribute("title")&&a&&Qn(o,d.title),function(t){const{id:e,element:n,options:o}=t,{animation:s,customClass:a,sanitizeFn:l,placement:c,dismissible:d}=o;let{title:u,content:f}=o;const p="Tooltip"===t.name,g=p?"tooltip":"popover",{template:m,btnClose:b}=o,v={...Mn};Z(n)&&(v.left="end",v.right="start");const w=`bs-${g}-${v[c]}`;let y;if([Element,HTMLElement].some(t=>m instanceof t))y=m;else{const t=i(n).createElement("div");zn(t,m,l),y=t.firstElementChild}t.tooltip=y&&y.cloneNode(!0);const{tooltip:T}=t;R(T,"id",e),R(T,"role","tooltip");const E=p?"tooltip-inner":"popover-body",x=p?null:r(".popover-header",T),H=r("."+E,T);t.arrow=r(`.${g}-arrow`,T),d&&(u?u instanceof HTMLElement?zn(u,b,l):u+=b:(x&&x.remove(),f instanceof HTMLElement?zn(f,b,l):f+=b)),p?u&&H&&zn(H,u,l):(u&&x&&zn(x,u,l),f&&H&&zn(H,f,l),t.btn=r(".btn-close",T)),h(T,g)||$(T,g),s&&!h(T,"fade")&&$(T,"fade"),a&&!h(T,a)&&$(T,a),h(T,w)||$(T,w)}(o),Jn(o,!0)}get name(){return"Tooltip"}get defaults(){return Ln}show(t){const e=this,{options:n,tooltip:o,element:i,id:a}=e,{container:l,animation:r}=n,c=tt(i,"out");et(i,"out"),!o||c||Xn(o,l)||_(i,()=>{const n=b("show.bs."+k(e.name));f(i,n),n.defaultPrevented||(l.append(o),R(i,"aria-describedby","#"+a),e.offsetParent=Ae(o,!0),e.update(t),Kn(e,!0),h(o,"show")||$(o,"show"),r?s(o,()=>Gn(e)):Gn(e))},17,"in")}hide(){const t=this,{options:e,tooltip:n,element:o}=t,{container:i,animation:a,delay:l}=e;et(o,"in"),n&&Xn(n,i)&&_(o,()=>{const e=b("hide.bs."+k(t.name));f(o,e),e.defaultPrevented||(u(n,"show"),Kn(t),a?s(n,()=>Zn(t)):Zn(t))},l+17,"out")}update(t){Nn(this,t)}toggle(t){const{tooltip:e,options:n}=this;Xn(e,n.container)?this.hide():this.show(t)}enable(){const t=this,{enabled:e}=t;e||(Jn(t,!0),t.enabled=!e)}disable(){const t=this,{element:n,tooltip:o,options:s,enabled:i}=t,{animation:a,container:l,delay:r}=s;i&&(Xn(o,l)&&a?(t.hide(),_(n,()=>{Jn(t),et(n,"tooltip")},e(o)+r+17,"tooltip")):Jn(t),t.enabled=!i)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{tooltip:e,options:n}=t;n.animation&&Xn(e,n.container)?(n.delay=0,t.hide(),s(e,()=>qn(t))):qn(t),super.dispose()}}d(to,{selector:'[data-bs-toggle="tooltip"],[data-tip="tooltip"]',init:t=>new to(t),getInstance:Vn,styleTip:Nn});const eo={...Ln,template:kn("popover"),btnClose:'',dismissible:!1,content:null};class no extends to{constructor(t,e){super(t,e)}get name(){return"Popover"}get defaults(){return eo}show(){super.show();const{options:t,btn:e}=this;t.dismissible&&e&&setTimeout(()=>qt(e),17)}}function oo(t,e){return(e&&a.some(t=>e instanceof t)?e:i()).getElementsByTagName(t)}d(no,{selector:'[data-bs-toggle="popover"],[data-tip="popover"]',init:t=>new no(t),getInstance:t=>m(t,"Popover"),styleTip:Nn});const{on:so,off:io}=T,ao={offset:10,target:null},lo=b("activate.bs.scrollspy");function ro(t){const{target:e,scrollTarget:n,options:o,itemsLength:s,scrollHeight:a,element:l}=t,{offset:c}=o,d=n instanceof Window,h=e&&oo("A",e),u=n&&function(t){return t instanceof HTMLElement?t.scrollHeight:U(t).scrollHeight}(n);if(t.scrollTop=d?n.scrollY:n.scrollTop,h&&(s!==h.length||u!==a)){let e,n,o;t.items=[],t.offsets=[],t.scrollHeight=u,t.maxScroll=t.scrollHeight-function({element:t,scrollTarget:e}){return e instanceof Window?e.innerHeight:q(t).height}(t),[...h].forEach(s=>{e=E(s,"href"),n=e&&"#"===e.charAt(0)&&"#"!==e.slice(-1)&&r(e,i(l)),n&&(t.items.push(s),o=q(n),t.offsets.push((d?o.top+t.scrollTop:n.offsetTop)-c))}),t.itemsLength=t.items.length}}function co(t){[...oo("A",t)].forEach(t=>{h(t,"active")&&u(t,"active")})}function ho(t,e){const{target:n,element:o}=t;co(n),t.activeItem=e,$(e,"active");const s=[];let i=e;for(;i!==Ee(o);)i=i.parentElement,(h(i,"nav")||h(i,"dropdown-menu"))&&s.push(i);s.forEach(t=>{const e=t.previousElementSibling;e&&!h(e,"active")&&$(e,"active")}),lo.relatedTarget=e,f(o,lo)}function uo(t,e){(e?so:io)(t.scrollTarget,Bt,t.refresh,ot)}class fo extends A{constructor(t,e){super(t,e);const{element:n,options:o}=this;if(this.target=r(o.target,i(n)),!this.target)return;const s=V(n);this.scrollTarget=n.clientHeight=o){const e=i[s-1];return void(a!==e&&ho(t,e))}const{offsets:l}=t;if(a&&n0)return t.activeItem=null,void co(e);i.forEach((e,o)=>{a!==e&&n>=l[o]&&(void 0===l[o+1]||nnew fo(t),getInstance:t=>m(t,"ScrollSpy")});const{on:po,off:go}=T,mo=t=>m(t,"Tab"),bo=b("show.bs.tab"),vo=b("shown.bs.tab"),wo=b("hide.bs.tab"),yo=b("hidden.bs.tab"),To=new Map;function Eo(t){const{tabContent:e,nav:n}=t;e&&(e.style.height="",u(e,"collapsing")),n&&et(n)}function xo(t){const{element:e,tabContent:n,nav:o}=t,{currentHeight:i,nextHeight:a}=To.get(e),{tab:l}=o&&To.get(o);n?i===a?Eo(t):setTimeout(()=>{n.style.height=a+"px",nt(n),s(n,()=>Eo(t))},50):o&&et(o),vo.relatedTarget=l,f(e,vo)}function Ho(t){const{element:e,content:n,tabContent:o,nav:i}=t,{tab:a,content:l}=i&&To.get(i);let r=0;if(o&&([l,n].forEach(t=>$(t,"overflow-hidden")),r=l.scrollHeight),bo.relatedTarget=a,yo.relatedTarget=e,f(e,bo),!bo.defaultPrevented){if($(n,"active"),u(l,"active"),o){const t=n.scrollHeight;To.set(e,{currentHeight:r,nextHeight:t}),$(o,"collapsing"),o.style.height=r+"px",nt(o),[l,n].forEach(t=>u(t,"overflow-hidden"))}n&&h(n,"fade")?setTimeout(()=>{$(n,"show"),s(n,()=>{xo(t)})},17):xo(t),f(a,yo)}}function ko(t,e){(e?po:go)(t.element,"click",Ao)}function Ao(t){const e=mo(this);e&&(t.preventDefault(),e.show())}class Po extends A{constructor(t){super(t);const{element:e}=this,n=st(e);if(!n)return;const o=c(e,".nav"),s=c(n,".tab-content");this.nav=o,this.content=n,this.tabContent=s,this.dropdown=o&&r(`.${Ut[0]}-toggle`,o),ko(this,!0)}get name(){return"Tab"}show(){const t=this,{element:e,nav:n,dropdown:o}=t;if(!(n&&tt(n)||h(e,"active"))){const{tab:i,content:a}=function(t){const{nav:e}=t,n=K("active",e);let o;return 1!==n.length||Ut.some(t=>h(n[0].parentElement,t))?n.length>1&&(o=n[n.length-1]):[o]=n,{tab:o,content:o?st(o):null}}(t);if(n&&To.set(n,{tab:i,content:a}),wo.relatedTarget=e,f(i,wo),wo.defaultPrevented)return;n&&_(n,()=>{},17),u(i,"active"),R(i,"aria-selected","false"),$(e,"active"),R(e,"aria-selected","true"),o&&(h(e.parentNode,"dropdown-menu")?h(o,"active")||$(o,"active"):h(o,"active")&&u(o,"active")),h(a,"fade")?(u(a,"show"),s(a,()=>Ho(t))):Ho(t)}}dispose(){ko(this),super.dispose()}}d(Po,{selector:'[data-bs-toggle="tab"]',init:t=>new Po(t),getInstance:mo});const{on:Mo,off:No}=T,Lo={animation:!0,autohide:!0,delay:5e3},Do=t=>m(t,"Toast"),Co=b("show.bs.toast"),So=b("shown.bs.toast"),Io=b("hide.bs.toast"),Ro=b("hidden.bs.toast");function $o(t){const{element:e,options:n}=t;u(e,"showing"),et(e,"showing"),f(e,So),n.autohide&&_(e,()=>t.hide(),n.delay,"toast")}function Oo(t){const{element:e}=t;u(e,"showing"),u(e,"show"),$(e,"hide"),et(e,"toast"),f(e,Ro)}function Wo(t,e){const n=e?Mo:No,{element:o,dismiss:s,options:i}=t;s&&n(s,"click",t.hide),i.autohide&&[Dn,Cn,j,Y].forEach(t=>n(o,t,Fo))}function Fo(t){const e=this,n=Do(e),{type:o,relatedTarget:s}=t;n&&e!==s&&!e.contains(s)&&([j,Dn].includes(o)?et(e,"toast"):_(e,()=>n.hide(),n.options.delay,"toast"))}class Bo extends A{constructor(t,e){super(t,e);const{element:n,options:o}=this;o.animation&&!h(n,"fade")?$(n,"fade"):!o.animation&&h(n,"fade")&&u(n,"fade"),this.dismiss=r('[data-bs-dismiss="toast"]',n),this.show=this.show.bind(this),this.hide=this.hide.bind(this),Wo(this,!0)}get name(){return"Toast"}get defaults(){return Lo}show(){const t=this,{element:e}=t;if(e&&!h(e,"show")){if(f(e,Co),Co.defaultPrevented)return;!function(t){const{element:e,options:n}=t;_(e,()=>{u(e,"hide"),nt(e),$(e,"show"),$(e,"showing"),n.animation?s(e,()=>$o(t)):$o(t)},17,"showing")}(t)}}hide(){const t=this,{element:e}=t;if(e&&h(e,"show")){if(f(e,Io),Io.defaultPrevented)return;!function(t){const{element:e,options:n}=t;$(e,"showing"),n.animation?(nt(e),s(e,()=>Oo(t))):Oo(t)}(t)}}dispose(){const{element:t}=this;h(t,"show")&&u(t,"show"),function(t){et(t.element,"toast"),Wo(t)}(this),super.dispose()}}d(Bo,{selector:".toast",init:t=>new Bo(t),getInstance:Do});const zo={Alert:I,Button:X,Carousel:Pt,Collapse:Ft,Dropdown:ye,Modal:ln,Offcanvas:Hn,Popover:no,ScrollSpy:fo,Tab:Po,Toast:Bo,Tooltip:to};function Xo(t){const e=[...oo("*",t&&a.some(e=>t instanceof e)?t:void 0)];H(zo).forEach(t=>{const{init:n,selector:o}=zo[t];var s,i;s=n,i=e.filter(t=>function(t,e){return t.matches(e)}(t,o)),[...i].forEach(t=>s(t))})}document.body?Xo():function(t,e,s,i){const a=n=>{n.target===t&&(s.apply(t,[n]),o(t,e,a,i))};n(t,e,a,i)}(document,"DOMContentLoaded",()=>Xo());const jo={Alert:I,Button:X,Carousel:Pt,Collapse:Ft,Dropdown:ye,Modal:ln,Offcanvas:Hn,Popover:no,ScrollSpy:fo,Tab:Po,Toast:Bo,Tooltip:to,initCallback:Xo,removeDataAPI:function(t){const e=t&&a.some(e=>t instanceof e)?t:void 0;H(zo).forEach(t=>{!function(t,e){const n=g.getAllFor(t);n&&[...n].forEach(t=>{const[n,o]=t;e&&e.contains(n)&&o.dispose()})}(t,e)})},Version:"4.1.0alpha4"};export{jo as default}; +// Native JavaScript for Bootstrap v4.1.0alpha5 | 2022 © dnp_theme | MIT-License +const t={};function e(e){const n=this,{type:s}=e;(t[s]?[...t[s]]:[]).forEach(t=>{const[i,a]=t;[...a].forEach(t=>{if(i===n){const[n,a]=t;n.apply(i,[e]),a&&a.once&&o(i,s,n,a)}})})}const n=(n,o,s,i)=>{t[o]||(t[o]=new Map);const a=t[o];a.has(n)||a.set(n,new Map);const l=a.get(n),{size:r}=l;l&&l.set(s,i),r||n.addEventListener(o,e,i)},o=(n,o,s,i)=>{const a=t[o],l=a&&a.get(n),r=l&&l.get(s),{options:c}=void 0!==r?r:{options:i};l&&l.has(s)&&l.delete(s),!a||l&&l.size||a.delete(n),a&&a.size||delete t[o],l&&l.size||n.removeEventListener(o,e,c)},s={on:n,off:o,globalListener:e,registry:t};function i(t,e){const n=getComputedStyle(t);return e in n?n[e]:""}function a(t){const e=i(t,"transitionProperty"),n=i(t,"transitionDuration"),o=n.includes("ms")?1:1e3,s=e&&"none"!==e?parseFloat(n)*o:0;return Number.isNaN(s)?0:s}function l(t,e){let n=0;const o=new Event("transitionend"),s=a(t),l=function(t){const e=i(t,"transitionProperty"),n=i(t,"transitionDelay"),o=n.includes("ms")?1:1e3,s=e&&"none"!==e?parseFloat(n)*o:0;return Number.isNaN(s)?0:s}(t);if(s){const i=o=>{o.target===t&&(e.apply(t,[o]),t.removeEventListener("transitionend",i),n=1)};t.addEventListener("transitionend",i),setTimeout(()=>{n||t.dispatchEvent(o)},s+l+17)}else e.apply(t,[o])}function r(t){return t instanceof HTMLElement?t.ownerDocument:t instanceof Window?t.document:window.document}const c=[Document,Element,HTMLElement],d=[Element,HTMLElement];function h(t,e){const n=c.some(t=>e instanceof t)?e:r();return d.some(e=>t instanceof e)?t:n.querySelector(t)}function u(t,e){return t?t.closest(e)||u(t.getRootNode().host,e):null}const f=(t,e)=>Object.assign(t,e);function p(t,e){return t.classList.contains(e)}function g(t,e){t.classList.remove(e)}const m=(t,e)=>t.dispatchEvent(e),b=new Map,v={set:(t,e,n)=>{const o=h(t);if(!o)return;b.has(e)||b.set(e,new Map);b.get(e).set(o,n)},getAllFor:t=>b.get(t)||null,get:(t,e)=>{const n=h(t),o=v.getAllFor(e);return n&&o&&o.get(n)||null},remove:(t,e)=>{const n=h(t),o=b.get(e);o&&n&&(o.delete(n),0===o.size&&b.delete(e))}},w=(t,e)=>v.get(t,e);function y(t,e){const n=new CustomEvent(t,{cancelable:!0,bubbles:!0});return e instanceof Object&&f(n,e),n}const T=(t,e)=>t.getAttribute(e);function E(t){return"true"===t||"false"!==t&&(Number.isNaN(+t)?""===t||"null"===t?null:t:+t)}const x=t=>Object.keys(t),H=t=>t.toLowerCase();class k{constructor(t,e){const n=this,o=h(t);if(!o)throw Error(`${n.name} Error: "${t}" is not a valid selector.`);n.options={};const s=v.get(o,n.name);s&&s.dispose(),n.element=o,n.defaults&&Object.keys(n.defaults).length&&(n.options=function(t,e,n,o){const s={...t.dataset},i={},a={};return x(s).forEach(t=>{const e=o&&t.includes(o)?t.replace(o,"").replace(/[A-Z]/,t=>H(t)):t;a[e]=E(s[t])}),x(n).forEach(t=>{n[t]=E(n[t])}),x(e).forEach(o=>{i[o]=o in n?n[o]:o in a?a[o]:"title"===o?T(t,"title"):e[o]}),i}(o,n.defaults,e||{},"bs")),v.set(o,n.name,n)}get version(){return"4.1.0alpha5"}get name(){return this.constructor.name}get defaults(){return this.constructor.defaults}dispose(){const t=this;v.remove(t.element,t.name),x(t).forEach(e=>{t[e]=null})}}const A=t=>w(t,"Alert"),P=y("close.bs.alert"),M=y("closed.bs.alert");function N(t){const{element:e}=t;L(t),m(e,M),t.dispose(),e.remove()}function L(t,e){const s=e?n:o,{dismiss:i}=t;i&&s(i,"click",t.close)}class D extends k{constructor(t){super(t);const{element:e}=this;this.dismiss=h('[data-bs-dismiss="alert"]',e),L(this,!0)}get name(){return"Alert"}close(t){const e=t?A(u(this,".alert")):this;if(!e)return;const{element:n}=e;if(p(n,"show")){if(m(n,P),P.defaultPrevented)return;g(n,"show"),p(n,"fade")?l(n,()=>N(e)):N(e)}}dispose(){L(this),super.dispose()}}f(D,{selector:".alert",init:t=>new D(t),getInstance:A});const C=(t,e,n)=>t.setAttribute(e,n);function S(t,e){t.classList.add(e)}const I="data-bs-toggle",R=t=>w(t,"Button");function $(t,e){(e?n:o)(t.element,"click",t.toggle)}class O extends k{constructor(t){super(t);const{element:e}=this;this.isActive=p(e,"active"),C(e,"aria-pressed",""+!!this.isActive),$(this,!0)}get name(){return"Button"}toggle(t){t&&t.preventDefault();const e=t?R(this):this;if(!e)return;const{element:n}=e;if(p(n,"disabled"))return;e.isActive=p(n,"active");const{isActive:o}=e;(o?g:S)(n,"active"),C(n,"aria-pressed",o?"false":"true")}dispose(){$(this),super.dispose()}}f(O,{selector:'[data-bs-toggle="button"]',init:t=>new O(t),getInstance:R});const W="mouseenter",F="mouseleave";function B(t){if(null==t)return window;if(!(t instanceof Window)){const{ownerDocument:e}=t;return e&&e.defaultView||window}return t}function z(t,e){const{width:n,height:o,top:s,right:i,bottom:a,left:l}=t.getBoundingClientRect();let r=1,c=1;if(e&&t instanceof HTMLElement){const{offsetWidth:e,offsetHeight:s}=t;r=e>0&&Math.round(n)/e||1,c=s>0&&Math.round(o)/s||1}return{width:n/r,height:o/c,top:s/c,right:i/r,bottom:a/c,left:l/r,x:l/r,y:s/c}}function X(t){return r(t).documentElement}const j=t=>{const{top:e,bottom:n}=z(t),{clientHeight:o}=X(t);return e<=o&&n>=0},Y=t=>"rtl"===X(t).dir;function V(t,e){return(e&&c.some(t=>e instanceof t)?e:r()).querySelectorAll(t)}function q(t,e){return(e&&c.some(t=>e instanceof t)?e:r()).getElementsByClassName(t)}const U=new Map,G=(t,e,n,o)=>{const s=h(t);if(s)if(o&&o.length){U.has(s)||U.set(s,new Map);U.get(s).set(o,setTimeout(e,n))}else U.set(s,setTimeout(e,n))},Z=(t,e)=>{const n=h(t);if(!n)return null;const o=U.get(n);return e&&e.length&&o&&o.get?o.get(e)||null:o||null},J=(t,e)=>{const n=h(t);if(n)if(e&&e.length){const t=U.get(n);t&&t.get&&(clearTimeout(t.get(e)),t.delete(e),0===t.size&&U.delete(n))}else clearTimeout(U.get(n)),U.delete(n)},K=t=>t.offsetHeight,Q={passive:!0};function _(t){const e=["data-bs-target","data-bs-parent","data-bs-container","href"],n=r(t);return e.map(e=>{const o=T(t,e);return o?"data-bs-parent"===e?u(t,o):h(o,n):null}).filter(t=>t)[0]}const tt="carousel-item",et={pause:"hover",keyboard:!1,touch:!0,interval:5e3},nt=t=>w(t,"Carousel");let ot=0,st=0,it=0;const at=y("slide.bs.carousel"),lt=y("slid.bs.carousel");function rt(){const t=this,e=nt(t);!e||e.isPaused||Z(t,"paused")||S(t,"paused")}function ct(){const t=nt(this);t&&t.isPaused&&!Z(this,"paused")&&t.cycle()}function dt(t){t.preventDefault();const e=u(this,'[data-bs-ride="carousel"]')||_(this);if(!e)return;const n=nt(e);if(!n||n.isAnimating)return;const o=+T(this,"data-bs-slide-to");!this||p(this,"active")||Number.isNaN(o)||n.to(o)}function ht(t){t.preventDefault();const e=u(this,'[data-bs-ride="carousel"]')||_(this),n=e&&nt(e);if(!n||n.isAnimating)return;const o=T(this,"data-bs-slide");"next"===o?n.next():"prev"===o&&n.prev()}function ut({code:t}){const[e]=[...V('[data-bs-ride="carousel"]')].filter(t=>j(t)),n=nt(e);if(!n)return;const o=Y(),s=o?"ArrowLeft":"ArrowRight";t===(o?"ArrowRight":"ArrowLeft")?n.prev():t===s&&n.next()}function ft(t){const e=nt(this);e&&!e.isTouch&&(ot=t.changedTouches[0].pageX,this.contains(t.target)&&(e.isTouch=!0,bt(e,!0)))}function pt(t){const{changedTouches:e,type:n}=t,o=nt(this);o&&o.isTouch&&(st=e[0].pageX,"touchmove"===n&&e.length>1&&t.preventDefault())}function gt(t){const e=this,n=nt(e);if(n&&n.isTouch&&(it=st||t.changedTouches[0].pageX,n.isTouch)){if((!e.contains(t.target)||!e.contains(t.relatedTarget))&&Math.abs(ot-it)<75)return;stot&&(n.index-=1),n.isTouch=!1,n.to(n.index),bt(n)}}function mt(t,e){const{indicators:n}=t;[...n].forEach(t=>g(t,"active")),t.indicators[e]&&S(n[e],"active")}function bt(t,e){const{element:s}=t,i=e?n:o;i(s,"touchmove",pt,Q),i(s,"touchend",gt,Q)}function vt(t,e){const{element:s,options:i,slides:a,controls:l,indicators:r}=t,{touch:c,pause:d,interval:h,keyboard:u}=i,f=e?n:o;d&&h&&(f(s,W,rt),f(s,F,ct),f(s,"touchstart",rt,Q),f(s,"touchend",ct,Q)),c&&a.length>1&&f(s,"touchstart",ft,Q),l.length&&l.forEach(t=>{t&&f(t,"click",ht)}),r.length&&r.forEach(t=>{f(t,"click",dt)}),u&&f(B(s),"keydown",ut)}function wt(t){const{slides:e,element:n}=t,o=h(".carousel-item.active",n);return[...e].indexOf(o)}class yt extends k{constructor(t,e){super(t,e);const n=this;n.direction=Y()?"right":"left",n.index=0,n.isTouch=!1;const{element:o}=n;n.slides=q(tt,o);const{slides:s}=n;if(s.length<2)return;n.controls=[...V("[data-bs-slide]",o),...V(`[data-bs-slide][data-bs-target="#${o.id}"]`)],n.indicator=h(".carousel-indicators",o),n.indicators=[...n.indicator?V("[data-bs-slide-to]",n.indicator):[],...V(`[data-bs-slide-to][data-bs-target="#${o.id}"]`)];const{options:i}=n;n.options.interval=!0===i.interval?et.interval:i.interval,wt(n)<0&&(s.length&&S(s[0],"active"),n.indicators.length&&mt(n,0)),vt(n,!0),i.interval&&n.cycle()}get name(){return"Carousel"}get defaults(){return et}get isPaused(){return p(this.element,"paused")}get isAnimating(){return null!==h(".carousel-item-next,.carousel-item-prev",this.element)}cycle(){const t=this,{element:e,options:n,isPaused:o}=t;J(e,"carousel"),o&&(J(e,"paused"),g(e,"paused")),G(e,()=>{!t.isPaused&&j(e)&&(t.index+=1,t.to(t.index))},n.interval,"carousel")}pause(){const{element:t,options:e}=this;!this.isPaused&&e.interval&&(S(t,"paused"),G(t,()=>{},1,"paused"))}next(){const t=this;t.isAnimating||(t.index+=1,t.to(t.index))}prev(){const t=this;t.isAnimating||(t.index-=1,t.to(t.index))}to(t){const e=this,{element:n,slides:o,options:s}=e,i=wt(e),c=Y();let d=t;if(e.isAnimating||i===d)return;id||i===o.length-1&&0===d)&&(e.direction=c?"left":"right");const{direction:h}=e;d<0?d=o.length-1:d>=o.length&&(d=0);const u="left"===h?"next":"prev",b="left"===h?"start":"end",v={relatedTarget:o[d],from:i,to:d,direction:h};f(at,v),f(lt,v),m(n,at),at.defaultPrevented||(e.index=d,mt(e,d),a(o[d])&&p(n,"slide")?G(n,()=>{S(o[d],"carousel-item-"+u),K(o[d]),S(o[d],"carousel-item-"+b),S(o[i],"carousel-item-"+b),l(o[d],()=>function(t){const{index:e,direction:n,element:o,slides:s,options:i}=t;if(t.isAnimating&&nt(o)){const a=wt(t),l="left"===n?"next":"prev",c="left"===n?"start":"end";S(s[e],"active"),g(s[e],"carousel-item-"+l),g(s[e],"carousel-item-"+c),g(s[a],"active"),g(s[a],"carousel-item-"+c),m(o,lt),J(o,"data-bs-slide"),r(o).hidden||!i.interval||t.isPaused||t.cycle()}}(e))},17,"data-bs-slide"):(S(o[d],"active"),g(o[i],"active"),G(n,()=>{J(n,"data-bs-slide"),n&&s.interval&&!e.isPaused&&e.cycle(),m(n,lt)},17,"data-bs-slide")))}dispose(){const t=this,{slides:e}=t,n=["start","end","prev","next"];[...e].forEach((e,o)=>{p(e,"active")&&mt(t,o),n.forEach(t=>g(e,"carousel-item-"+t))}),vt(t),super.dispose()}}f(yt,{selector:'[data-bs-ride="carousel"]',init:t=>new yt(t),getInstance:nt});const Tt={parent:null},Et=t=>w(t,"Collapse"),xt=y("show.bs.collapse"),Ht=y("shown.bs.collapse"),kt=y("hide.bs.collapse"),At=y("hidden.bs.collapse");function Pt(t){const{element:e,parent:n,triggers:o}=t;m(e,kt),kt.defaultPrevented||(G(e,()=>{},17),n&&G(n,()=>{},17),e.style.height=e.scrollHeight+"px",g(e,"collapse"),g(e,"show"),S(e,"collapsing"),K(e),e.style.height="0px",l(e,()=>{J(e),n&&J(n),o.forEach(t=>C(t,"aria-expanded","false")),g(e,"collapsing"),S(e,"collapse"),e.style.height="",m(e,At)}))}function Mt(t,e){const s=e?n:o,{triggers:i}=t;i.length&&i.forEach(t=>s(t,"click",Nt))}function Nt(t){const{target:e}=t,n=e&&u(e,'[data-bs-toggle="collapse"]'),o=n&&_(n),s=o&&Et(o);s&&s.toggle(),n&&"A"===n.tagName&&t.preventDefault()}class Lt extends k{constructor(t,e){super(t,e);const{element:n,options:o}=this;this.triggers=[...V('[data-bs-toggle="collapse"]')].filter(t=>_(t)===n),this.parent=h(o.parent),Mt(this,!0)}get name(){return"Collapse"}get defaults(){return Tt}toggle(){p(this.element,"show")?this.hide():this.show()}hide(){const{triggers:t,element:e}=this;Z(e)||(Pt(this),t.length&&t.forEach(t=>S(t,"collapsed")))}show(){const t=this,{element:e,parent:n,triggers:o}=t;let s,i;n&&(s=[...V(".collapse.show",n)].find(t=>Et(t)),i=s&&Et(s)),n&&(!n||Z(n))||Z(e)||(i&&s!==e&&(Pt(i),i.triggers.forEach(t=>{S(t,"collapsed")})),function(t){const{element:e,parent:n,triggers:o}=t;m(e,xt),xt.defaultPrevented||(G(e,()=>{},17),n&&G(n,()=>{},17),S(e,"collapsing"),g(e,"collapse"),e.style.height=e.scrollHeight+"px",l(e,()=>{J(e),n&&J(n),o.forEach(t=>C(t,"aria-expanded","true")),g(e,"collapsing"),S(e,"collapse"),S(e,"show"),e.style.height="",m(e,Ht)}))}(t),o.length&&o.forEach(t=>g(t,"collapsed")))}dispose(){Mt(this),super.dispose()}}f(Lt,{selector:".collapse",init:t=>new Lt(t),getInstance:Et});const Dt="scroll",Ct="resize",St="ArrowUp",It="ArrowDown",Rt=(t,e)=>t.hasAttribute(e),$t=(t,e)=>{f(t.style,e)},Ot=t=>t.focus(),Wt=["dropdown","dropup","dropstart","dropend"];function Ft(t){const e=u(t,"A");return t&&(Rt(t,"href")&&"#"===t.href.slice(-1)||e&&Rt(e,"href")&&"#"===e.href.slice(-1))}const[Bt,zt,Xt,jt]=Wt,Yt=`[data-bs-toggle="${Bt}"]`,Vt=t=>w(t,"Dropdown"),qt=[Bt,zt],Ut=[Xt,jt],Gt=["A","BUTTON"],Zt={offset:5,display:"dynamic"},Jt=y("show.bs."+Bt),Kt=y("shown.bs."+Bt),Qt=y("hide.bs."+Bt),_t=y("hidden.bs."+Bt);function te(t){const{element:e,menu:n,parentElement:o,options:s}=t,{offset:a}=s;if("static"===i(n,"position"))return;const l=Y(e),r=p(o,"dropdown-menu-end");["margin","top","bottom","left","right"].forEach(t=>{n.style[t]=""});let c=Wt.find(t=>p(o,t))||Bt,d={dropdown:[a,0,0],dropup:[0,0,a],dropstart:l?[-1,0,0,a]:[-1,a,0],dropend:l?[-1,a,0]:[-1,0,0,a]};const h={dropdown:{top:"100%"},dropup:{top:"auto",bottom:"100%"},dropstart:l?{left:"100%",right:"auto"}:{left:"auto",right:"100%"},dropend:l?{left:"auto",right:"100%"}:{left:"100%",right:"auto"},menuEnd:l?{right:"auto",left:0}:{right:0,left:"auto"}},{offsetWidth:u,offsetHeight:g}=n,{clientWidth:m,clientHeight:b}=X(e),{left:v,top:w,width:y,height:T}=z(e),E=v-u-a<0,x=v+u+y+a>=m,H=w+g+a>=b,k=w+g+T+a>=b,A=w-g-a<0,P=(!l&&r||l&&!r)&&v+y-u<0,M=(l&&r||!l&&!r)&&v+u>=m;Ut.includes(c)&&E&&x&&(c=Bt),c===Xt&&(l?x:E)&&(c=jt),c===jt&&(l?E:x)&&(c=Xt),c===zt&&A&&!k&&(c=Bt),c===Bt&&k&&!A&&(c=zt),Ut.includes(c)&&H&&f(h[c],{top:"auto",bottom:0}),qt.includes(c)&&(P||M)&&v+y+Math.abs(u-y)+at?t+"px":t).join(" "),$t(n,h[c]),p(n,"dropdown-menu-end")&&$t(n,h.menuEnd)}function ee(t){const{element:e}=t,s=t.open?n:o,i=r(e);s(i,"click",se),s(i,"focus",se),s(i,"keydown",ae),s(i,"keyup",le),"dynamic"===t.options.display&&[Dt,Ct].forEach(t=>{s(B(e),t,re,Q)})}function ne(t,e){(e?n:o)(t.element,"click",ie)}function oe(t){const e=[...Wt,"btn-group","input-group"].map(t=>q(t+" show"),r(t)).find(t=>t.length);return e&&e.length?[...e[0].children].find(t=>Rt(t,I)):null}function se(t){const{target:e,type:n}=t;if(!e||!e.closest)return;const o=oe(e);if(!o)return;const s=Vt(o);if(!s)return;const{parentElement:i,menu:a}=s,l=null!==u(e,Yt),r=i&&i.contains(e)&&("form"===e.tagName||null!==u(e,"form"));"click"===n&&Ft(e)&&t.preventDefault(),("focus"!==n||e!==o&&e!==a&&!a.contains(e))&&(r||l||s&&s.hide())}function ie(t){const{target:e}=t,n=Vt(this);n&&(n.toggle(),e&&Ft(e)&&t.preventDefault())}function ae(t){[It,St].includes(t.code)&&t.preventDefault()}function le(t){const{code:e}=t,n=oe(this),o=n&&Vt(n),s=n&&r(n).activeElement;if(!o||!s)return;const{menu:i,open:a}=o,l=function(t){return[...t.children].map(t=>{if(t&&Gt.includes(t.tagName))return t;const{firstElementChild:e}=t;return e&&Gt.includes(e.tagName)?e:null}).filter(t=>t)}(i);if(l&&l.length&&[It,St].includes(e)){let t=l.indexOf(s);s===n?t=0:e===St?t=t>1?t-1:0:e===It&&(t=t{t.relatedTarget=e}),m(s,Jt),Jt.defaultPrevented||(S(o,"show"),S(s,"show"),C(e,"aria-expanded","true"),te(t),t.open=!n,setTimeout(()=>{Ot(e),ee(t),m(s,Kt)},1))}hide(){const t=this,{element:e,open:n,menu:o,parentElement:s}=t;[Qt,_t].forEach(t=>{t.relatedTarget=e}),m(s,Qt),Qt.defaultPrevented||(g(o,"show"),g(s,"show"),C(e,"aria-expanded","false"),t.open=!n,setTimeout(()=>ee(t),1),m(s,_t))}dispose(){const{parentElement:t}=this;p(t,"show")&&this.open&&this.hide(),ne(this),super.dispose()}}f(ce,{selector:Yt,init:t=>new ce(t),getInstance:Vt});const de=(t,e)=>t.removeAttribute(e);function he(t){return r(t).body}const ue=t=>t instanceof B(t).ShadowRoot||t instanceof ShadowRoot;const fe=t=>["TABLE","TD","TH"].includes(t.tagName),pe=t=>t instanceof HTMLElement;function ge(t,e){const n=["HTML","BODY"];if(e){let{offsetParent:e}=t;const o=B(t);for(;e&&(fe(e)||pe(e)&&!["sticky","fixed"].includes(i(e,"position")));)e=e.offsetParent;return(!e||e&&(n.includes(e.tagName)||"static"===i(e,"position")))&&(e=o),e}const o=[];let{parentNode:s}=t;for(;s&&!n.includes(s.nodeName);)s="HTML"===(a=s).nodeName?a:a.assignedSlot||a.parentNode||(ue(a)?a.host:null)||X(a),ue(s)||s.shadowRoot||fe(s)||o.push(s);var a;return o.find((t,e)=>"relative"!==i(t,"position")&&o.slice(e+1).every(t=>"static"===i(t,"position"))?t:null)||he(t)}const me="sticky-top",be="position-sticky",ve=t=>[...q("fixed-top",t),...q("fixed-bottom",t),...q(me,t),...q(be,t),...q("is-fixed",t)];function we(t){const{clientWidth:e}=X(t),{innerWidth:n}=B(t);return Math.abs(n-e)}function ye(t,e){const n=he(t),o=parseInt(i(n,"paddingRight"),10),s="hidden"===i(n,"overflow")&&o?0:we(t),a=ve(n);e&&($t(n,{overflow:"hidden",paddingRight:o+s+"px"}),a.length&&a.forEach(t=>{const e=i(t,"paddingRight");if(t.style.paddingRight=parseInt(e,10)+s+"px",[me,be].some(e=>p(t,e))){const e=i(t,"marginRight");t.style.marginRight=parseInt(e,10)-s+"px"}}))}const Te="modal-backdrop",Ee="offcanvas-backdrop",xe=r().createElement("div");function He(t){return h(".modal.show,.offcanvas.show",r(t))}function ke(t){const e=t?Te:Ee;[Te,Ee].forEach(t=>{g(xe,t)}),S(xe,e)}function Ae(t,e,n){ke(n),t.append(xe),e&&S(xe,"fade")}function Pe(){S(xe,"show"),K(xe)}function Me(){g(xe,"show")}function Ne(t){He(t)||(g(xe,"fade"),xe.remove(),function(t){const e=he(t);$t(e,{paddingRight:"",overflow:""});const n=ve(e);n.length&&n.forEach(t=>{$t(t,{paddingRight:"",marginRight:""})})}(t))}function Le(t){return t&&"hidden"!==i(t,"visibility")&&null!==t.offsetParent}const De={backdrop:!0,keyboard:!0},Ce=t=>w(t,"Modal"),Se=y("show.bs.modal"),Ie=y("shown.bs.modal"),Re=y("hide.bs.modal"),$e=y("hidden.bs.modal");function Oe(t){const{element:e}=t,n=we(e),{clientHeight:o,scrollHeight:s}=X(e),{clientHeight:i,scrollHeight:a}=e,l=i!==a;if(!l&&n){const t=Y(e)?"paddingLeft":"paddingRight";e.style[t]=n+"px"}ye(e,l||o!==s)}function We(t,e){const s=e?n:o,{element:i}=t;s(i,"click",qe),s(B(i),Ct,t.update,Q),s(r(i),"keydown",Ve)}function Fe(t,e){const s=e?n:o,{triggers:i}=t;i.length&&i.forEach(t=>s(t,"click",Ye))}function Be(t){const{triggers:e,element:n}=t;if(Ne(n),n.style.paddingRight="",e.length){const t=e.find(t=>Le(t));t&&Ot(t)}}function ze(t){const{element:e,relatedTarget:n}=t;Ot(e),We(t,!0),Ie.relatedTarget=n,m(e,Ie)}function Xe(t){const{element:e,hasFade:n}=t;e.style.display="block",Oe(t),He(e)||(he(e).style.overflow="hidden"),S(e,"show"),de(e,"aria-hidden"),C(e,"aria-modal","true"),n?l(e,()=>ze(t)):ze(t)}function je(t,e){const{element:n,options:o,relatedTarget:s,hasFade:i}=t;n.style.display="",o.backdrop&&!e&&i&&p(xe,"show")&&!He(n)?(Me(),l(xe,()=>Be(t))):Be(t),We(t),$e.relatedTarget=s,m(n,$e)}function Ye(t){const{target:e}=t,n=e&&u(this,'[data-bs-toggle="modal"]'),o=n&&_(n),s=o&&Ce(o);s&&(n&&"A"===n.tagName&&t.preventDefault(),s.relatedTarget=n,s.toggle())}function Ve({code:t}){const e=h(".modal.show"),n=e&&Ce(e);if(!n)return;const{options:o}=n;o.keyboard&&"Escape"===t&&p(e,"show")&&(n.relatedTarget=null,n.hide())}function qe(t){const e=this,n=Ce(e);if(!n||Z(e))return;const{options:o,isStatic:s,modalDialog:i}=n,{backdrop:c}=o,{target:d}=t,h=r(e).getSelection().toString().length,f=i.contains(d),p=d&&u(d,'[data-bs-dismiss="modal"]');s&&!f?G(e,()=>{S(e,"modal-static"),l(i,()=>function(t){const{element:e,modalDialog:n}=t,o=a(n)+17;g(e,"modal-static"),G(e,()=>J(e),o)}(n))},17):(p||!h&&!s&&!f&&c)&&(n.relatedTarget=p||null,n.hide(),t.preventDefault())}class Ue extends k{constructor(t,e){super(t,e);const{element:n}=this;this.modalDialog=h(".modal-dialog",n),this.triggers=[...V('[data-bs-toggle="modal"]')].filter(t=>_(t)===n),this.isStatic="static"===this.options.backdrop,this.hasFade=p(n,"fade"),this.relatedTarget=null,this.container=ge(n),Fe(this,!0),this.update=this.update.bind(this)}get name(){return"Modal"}get defaults(){return De}toggle(){p(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:e,options:n,hasFade:o,relatedTarget:s,container:i}=t,{backdrop:l}=n;let r=0;if(p(e,"show"))return;if(Se.relatedTarget=s||null,m(e,Se),Se.defaultPrevented)return;const c=He(e);if(c&&c!==e){(Ce(c)||w(c,"Offcanvas")).hide()}l?(c||p(xe,"show")?ke(!0):Ae(i,o,!0),r=a(xe),p(xe,"show")||Pe(),setTimeout(()=>Xe(t),r)):(Xe(t),c&&p(xe,"show")&&Me())}hide(t){const e=this,{element:n,hasFade:o,relatedTarget:s}=e;p(n,"show")&&(Re.relatedTarget=s||null,m(n,Re),Re.defaultPrevented||(g(n,"show"),C(n,"aria-hidden","true"),de(n,"aria-modal"),o&&!1!==t?l(n,()=>je(e)):je(e,t)))}update(){p(this.element,"show")&&Oe(this)}dispose(){this.hide(!0),Fe(this),super.dispose()}}f(Ue,{selector:".modal",init:t=>new Ue(t),getInstance:Ce});const Ge={backdrop:!0,keyboard:!0,scroll:!1},Ze=t=>w(t,"Offcanvas"),Je=y("show.bs.offcanvas"),Ke=y("shown.bs.offcanvas"),Qe=y("hide.bs.offcanvas"),_e=y("hidden.bs.offcanvas");function tn(t,e){const s=e?n:o;t.triggers.forEach(t=>s(t,"click",sn))}function en(t,e){const s=e?n:o,i=r(t.element);s(i,"keydown",ln),s(i,"click",an)}function nn(t){const{element:e,options:n}=t;n.scroll||(!function(t){const{element:e}=t,{clientHeight:n,scrollHeight:o}=X(e);ye(e,n!==o)}(t),he(e).style.overflow="hidden"),S(e,"offcanvas-toggling"),S(e,"show"),e.style.visibility="visible",l(e,()=>function(t){const{element:e,triggers:n}=t;g(e,"offcanvas-toggling"),de(e,"aria-hidden"),C(e,"aria-modal","true"),C(e,"role","dialog"),n.length&&n.forEach(t=>C(t,"aria-expanded","true"));m(e,Ke),en(t,!0),Ot(e)}(t))}function on(t){const{element:e,options:n}=t,o=He(e);e.blur(),!o&&n.backdrop&&p(xe,"show")?(Me(),l(xe,()=>rn(t))):rn(t)}function sn(t){const e=u(this,'[data-bs-toggle="offcanvas"]'),n=e&&_(e),o=n&&Ze(n);o&&(o.relatedTarget=e,o.toggle(),e&&"A"===e.tagName&&t.preventDefault())}function an(t){const e=h(".offcanvas.show",this);if(!e)return;const n=h('[data-bs-dismiss="offcanvas"]',e),o=Ze(e);if(!o)return;const{options:s,triggers:i}=o,{target:a}=t,l=u(a,'[data-bs-toggle="offcanvas"]'),c=r(e).getSelection();c&&c.toString().length||!(!e.contains(a)&&s.backdrop&&(!l||l&&!i.includes(l))||n&&n.contains(a))||(o.relatedTarget=n&&n.contains(a)?n:null,o.hide()),l&&"A"===l.tagName&&t.preventDefault()}function ln({code:t}){const e=h(".offcanvas.show",this);if(!e)return;const n=Ze(e);n&&n.options.keyboard&&"Escape"===t&&(n.relatedTarget=null,n.hide())}function rn(t){const{element:e,triggers:n}=t;if(C(e,"aria-hidden","true"),de(e,"aria-modal"),de(e,"role"),e.style.visibility="",n.length){n.forEach(t=>C(t,"aria-expanded","false"));const t=n.find(t=>Le(t));t&&Ot(t)}Ne(e),m(e,_e),g(e,"offcanvas-toggling"),He(e)||en(t)}class cn extends k{constructor(t,e){super(t,e);const{element:n}=this;this.triggers=[...V('[data-bs-toggle="offcanvas"]')].filter(t=>_(t)===n),this.container=ge(n),this.relatedTarget=null,tn(this,!0)}get name(){return"Offcanvas"}get defaults(){return Ge}toggle(){p(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:e,options:n,container:o,relatedTarget:s}=t;let i=0;if(p(e,"show"))return;if(Je.relatedTarget=s,Ke.relatedTarget=s,m(e,Je),Je.defaultPrevented)return;const l=He(e);if(l&&l!==e){(Ze(l)||w(l,"Modal")).hide()}n.backdrop?(l?ke():Ae(o,!0),i=a(xe),p(xe,"show")||Pe(),setTimeout(()=>nn(t),i)):(nn(t),l&&p(xe,"show")&&Me())}hide(t){const e=this,{element:n,relatedTarget:o}=e;p(n,"show")&&(Qe.relatedTarget=o,_e.relatedTarget=o,m(n,Qe),Qe.defaultPrevented||(S(n,"offcanvas-toggling"),g(n,"show"),t?on(e):l(n,()=>on(e))))}dispose(){this.hide(!0),tn(this),super.dispose()}}f(cn,{selector:".offcanvas",init:t=>new cn(t),getInstance:Ze});function dn(t){const e="tooltip"===t;return``}const hn=t=>t&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(e=>t instanceof e);function un(t,e,n){const o=e instanceof HTMLElement,s=z(t,o&&function(t){const{width:e,height:n}=z(t),{offsetWidth:o,offsetHeight:s}=t;return Math.round(e)!==o||Math.round(n)!==s}(e)),i={x:0,y:0};if(o){const t=z(e,!0);i.x=t.x+e.clientLeft,i.y=t.y+e.clientTop}return{x:s.left+n.x-i.x,y:s.top+n.y-i.y,width:s.width,height:s.height}}var fn={top:"top",bottom:"bottom",left:"start",right:"end"};function pn(t,e){const n=/\b(top|bottom|start|end)+/,{element:o,tooltip:s,options:a,arrow:l,offsetParent:r}=t,c={...fn};$t(s,{top:"0px",left:"0px",right:""});const d="Popover"===t.name,h=s.offsetWidth,u=s.offsetHeight,f=Y(o);f&&(c.left="end",c.right="start");const p=X(o),g=p.clientWidth,m=p.clientHeight,{container:b}=a;let{placement:v}=a;const{left:w,right:y,top:T}=z(b,!0),E=b.clientWidth,x=Math.abs(E-b.offsetWidth),H=i(b,"position"),k="fixed"===H,A="static"===H,P="sticky"===H&&T===parseFloat(i(b,"top")),M=f&&k?x:0,N=k?E+w+(f?x:0):E+w+(g-y)-1,{width:L,height:D,left:C,right:S,top:I}=z(o,!0),R=function(t){const e="scrollX"in t;return{x:e?t.scrollX:t.scrollLeft,y:e?t.scrollY:t.scrollTop}}(r),{x:$,y:O}=un(o,r,R);let W,F,B,j,V,q;$t(l,{top:"",left:"",right:""});const U=l.offsetWidth||0,G=l.offsetHeight||0,Z=U/2;let J=I-u-G<0,K=I+u+D+G>=m,Q=C-h-U=N;const tt=["left","right"],et=["top","bottom"];if(J=tt.includes(v)?I+D/2-u/2-G<0:J,K=tt.includes(v)?I+u/2+D/2+G>=m:K,Q=et.includes(v)?C+L/2-h/2=N:_,v=tt.includes(v)&&Q&&_?"top":v,v="top"===v&&J?"bottom":v,v="bottom"===v&&K?"top":v,v="left"===v&&Q?"right":v,v="right"===v&&_?"left":v,s.className.includes(v)||(s.className=s.className.replace(n,c[v])),tt.includes(v))F="left"===v?$-h-(d?U:0):$+L+(d?U:0),J?(W=O,W+=P?-T-R.y:0,j=D/2-U):K?(W=O-u+D,W+=P?-T-R.y:0,j=u-D/2-U):(W=O-u/2+D/2,W+=P?-T-R.y:0,j=u/2-G/2);else if(et.includes(v))if(e&&hn(o)){let t=0,n=0;A?(t=e.pageX,n=e.pageY):(t=e.clientX-w+(k?R.x:0),n=e.clientY-T+(k?R.y:0)),t-=f&&k&&x?x:0,W="top"===v?n-u-U:n+U,e.clientX-h/2N?(F="auto",B=0,q=N-t-Z,q-=k?w+(f?x:0):0):(F=t-h/2,V=h/2-Z)}else W="top"===v?O-u-(d?G:0):O+D+(d?G:0),Q?(F=0,V=$+L/2-Z):_?(F="auto",B=0,q=L/2+N-S-Z):(F=$-h/2+L/2,V=h/2-Z);$t(s,{top:W+"px",left:"auto"===F?F:F+"px",right:void 0!==B?B+"px":""}),l instanceof HTMLElement&&(void 0!==j&&(l.style.top=j+"px"),void 0!==V?l.style.left=V+"px":void 0!==q&&(l.style.right=q+"px"))}const gn={template:dn("tooltip"),title:null,customClass:null,trigger:"hover focus",placement:"top",sanitizeFn:null,animation:!0,delay:200,container:null},mn="focusin",bn="focusout",{userAgentData:vn}=navigator,wn=vn,{userAgent:yn}=navigator,Tn=yn,En=/(iPhone|iPod|iPad)/,xn=wn?wn.brands.some(t=>En.test(t.brand)):En.test(Tn);let Hn=1;const kn=new Map;function An(t,e,n){if("string"!=typeof e||e.length)if("string"==typeof e){let o=e.trim();"function"==typeof n&&(o=n(o));const s=(new DOMParser).parseFromString(o,"text/html"),{body:i}=s,a=i.children.length?"innerHTML":"innerText";t[a]=i[a]}else e instanceof HTMLElement&&t.append(e)}function Pn(t,e){return t instanceof HTMLElement&&e.contains(t)}let Mn=t=>w(t,"Tooltip");function Nn(t){const{element:e}=t;Sn(t),e.hasAttribute("data-original-title")&&"tooltip"===t.name&&Rn(t)}function Ln(t,e){const s=e?n:o,{element:i}=t;s(r(i),"touchstart",$n,Q),hn(i)||[Dt,Ct].forEach(e=>{s(B(i),e,t.update,Q)})}function Dn(t){const{element:e}=t,n=y("shown.bs."+H(t.name));Ln(t,!0),m(e,n),J(e,"in")}function Cn(t){const{element:e}=t,n=y("hidden.bs."+H(t.name));Ln(t),function(t){const{element:e,tooltip:n}=t;de(e,"aria-describedby"),n.remove()}(t),m(e,n),J(e,"out")}function Sn(t,e){const s=e?n:o,{element:i,options:a,btn:l}=t,{trigger:c,dismissible:d}=a;if(c.includes("manual"))return;t.enabled=!!e;const h=c.split(" "),u=hn(i);u&&s(i,"mousemove",t.update,Q),h.forEach(e=>{u||"hover"===e?(s(i,"mousedown",t.show),s(i,W,t.show),d&&l?s(l,"click",t.hide):(s(i,F,t.hide),s(r(i),"touchstart",$n,Q))):"click"===e?s(i,e,d?t.show:t.toggle):"focus"===e&&(s(i,mn,t.show),d||s(i,bn,t.hide),xn&&s(i,"click",()=>Ot(i)))})}function In(t,e){const s=e?n:o,{element:i,options:a,offsetParent:l}=t,{container:r}=a,{offsetHeight:c,scrollHeight:d}=r,h=u(i,".modal"),f=u(i,".offcanvas");if(!hn(i)){const e=B(i),n=c!==d||l!==e?r:e;s(e,Ct,t.update,Q),s(n,Dt,t.update,Q)}h&&s(h,"hide.bs.modal",t.hide),f&&s(f,"hide.bs.offcanvas",t.hide)}function Rn(t,e){const n=["data-original-title","title"],{element:o}=t;C(o,n[e?0:1],e||T(o,n[0])),de(o,n[e?1:0])}function $n({target:t}){const{tooltip:e,element:n}=this;e.contains(t)||t===n||n.contains(t)||this.hide()}class On extends k{constructor(t,e){super(t,e);const n=this,{element:o}=n,s="Tooltip"===n.name,a=s?"tooltip":"popover",l=s?"Tooltip":"Popover";Mn=t=>w(t,l),n.tooltip={},s||(n.btn=null),n.arrow={},n.offsetParent={},n.enabled=!0,n.id=`${a}-${function(t,e){Hn+=1;let n=kn.get(t),o=Hn;if(e&&e.length)if(n){const t=n.get(e);Number.isNaN(t)?n.set(e,o):o=t}else kn.set(t,new Map),n=kn.get(t),n.set(e,o);else Number.isNaN(n)?kn.set(t,o):o=n;return o}(o,a)}`;const{options:c}=n;if(!c.title&&s||!s&&!c.content)return;const d=h(c.container),u=ge(o);n.options.container=!d||d&&["static","relative"].includes(i(d,"position"))?u:d||he(o),gn.title=null,$n.bind(n),n.update=n.update.bind(n),n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.toggle=n.toggle.bind(n),o.hasAttribute("title")&&s&&Rn(n,c.title),function(t){const{id:e,element:n,options:o}=t,{animation:s,customClass:i,sanitizeFn:a,placement:l,dismissible:c}=o;let{title:d,content:u}=o;const f="Tooltip"===t.name,g=f?"tooltip":"popover",{template:m,btnClose:b}=o,v={...fn};Y(n)&&(v.left="end",v.right="start");const w=`bs-${g}-${v[l]}`;let y;if([Element,HTMLElement].some(t=>m instanceof t))y=m;else{const t=r(n).createElement("div");An(t,m,a),y=t.firstElementChild}t.tooltip=y&&y.cloneNode(!0);const{tooltip:T}=t;C(T,"id",e),C(T,"role","tooltip");const E=f?"tooltip-inner":"popover-body",x=f?null:h(".popover-header",T),H=h("."+E,T);t.arrow=h(`.${g}-arrow`,T),c&&(d?d instanceof HTMLElement?An(d,b,a):d+=b:(x&&x.remove(),u instanceof HTMLElement?An(u,b,a):u+=b)),f?d&&H&&An(H,d,a):(d&&x&&An(x,d,a),u&&H&&An(H,u,a),t.btn=h(".btn-close",T)),p(T,g)||S(T,g),s&&!p(T,"fade")&&S(T,"fade"),i&&!p(T,i)&&S(T,i),p(T,w)||S(T,w)}(n),Sn(n,!0)}get name(){return"Tooltip"}get defaults(){return gn}show(t){const e=this,{options:n,tooltip:o,element:s,id:i}=e,{container:a,animation:r}=n,c=Z(s,"out");J(s,"out"),!o||c||Pn(o,a)||G(s,()=>{const n=y("show.bs."+H(e.name));m(s,n),n.defaultPrevented||(a.append(o),C(s,"aria-describedby","#"+i),e.offsetParent=ge(o,!0),e.update(t),In(e,!0),p(o,"show")||S(o,"show"),r?l(o,()=>Dn(e)):Dn(e))},17,"in")}hide(){const t=this,{options:e,tooltip:n,element:o}=t,{container:s,animation:i,delay:a}=e;J(o,"in"),n&&Pn(n,s)&&G(o,()=>{const e=y("hide.bs."+H(t.name));m(o,e),e.defaultPrevented||(g(n,"show"),In(t),i?l(n,()=>Cn(t)):Cn(t))},a+17,"out")}update(t){pn(this,t)}toggle(t){const{tooltip:e,options:n}=this;Pn(e,n.container)?this.hide():this.show(t)}enable(){const t=this,{enabled:e}=t;e||(Sn(t,!0),t.enabled=!e)}disable(){const t=this,{element:e,tooltip:n,options:o,enabled:s}=t,{animation:i,container:l,delay:r}=o;s&&(Pn(n,l)&&i?(t.hide(),G(e,()=>{Sn(t),J(e,"tooltip")},a(n)+r+17,"tooltip")):Sn(t),t.enabled=!s)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{tooltip:e,options:n}=t;n.animation&&Pn(e,n.container)?(n.delay=0,t.hide(),l(e,()=>Nn(t))):Nn(t),super.dispose()}}f(On,{selector:'[data-bs-toggle="tooltip"],[data-tip="tooltip"]',init:t=>new On(t),getInstance:Mn,styleTip:pn});const Wn={...gn,template:dn("popover"),btnClose:'',dismissible:!1,content:null};class Fn extends On{constructor(t,e){super(t,e)}get name(){return"Popover"}get defaults(){return Wn}show(){super.show();const{options:t,btn:e}=this;t.dismissible&&e&&setTimeout(()=>Ot(e),17)}}function Bn(t,e){return(e&&c.some(t=>e instanceof t)?e:r()).getElementsByTagName(t)}f(Fn,{selector:'[data-bs-toggle="popover"],[data-tip="popover"]',init:t=>new Fn(t),getInstance:t=>w(t,"Popover"),styleTip:pn});const zn={offset:10,target:null},Xn=y("activate.bs.scrollspy");function jn(t){const{target:e,scrollTarget:n,options:o,itemsLength:s,scrollHeight:i,element:a}=t,{offset:l}=o,c=n instanceof Window,d=e&&Bn("A",e),u=n&&function(t){return t instanceof HTMLElement?t.scrollHeight:X(t).scrollHeight}(n);if(t.scrollTop=c?n.scrollY:n.scrollTop,d&&(s!==d.length||u!==i)){let e,n,o;t.items=[],t.offsets=[],t.scrollHeight=u,t.maxScroll=t.scrollHeight-function({element:t,scrollTarget:e}){return e instanceof Window?e.innerHeight:z(t).height}(t),[...d].forEach(s=>{e=T(s,"href"),n=e&&"#"===e.charAt(0)&&"#"!==e.slice(-1)&&h(e,r(a)),n&&(t.items.push(s),o=z(n),t.offsets.push((c?o.top+t.scrollTop:n.offsetTop)-l))}),t.itemsLength=t.items.length}}function Yn(t){[...Bn("A",t)].forEach(t=>{p(t,"active")&&g(t,"active")})}function Vn(t,e){const{target:n,element:o}=t;Yn(n),t.activeItem=e,S(e,"active");const s=[];let i=e;for(;i!==he(o);)i=i.parentElement,(p(i,"nav")||p(i,"dropdown-menu"))&&s.push(i);s.forEach(t=>{const e=t.previousElementSibling;e&&!p(e,"active")&&S(e,"active")}),Xn.relatedTarget=e,m(o,Xn)}function qn(t,e){(e?n:o)(t.scrollTarget,Dt,t.refresh,Q)}class Un extends k{constructor(t,e){super(t,e);const{element:n,options:o}=this;if(this.target=h(o.target,r(n)),!this.target)return;const s=B(n);this.scrollTarget=n.clientHeight=o){const e=i[s-1];return void(a!==e&&Vn(t,e))}const{offsets:l}=t;if(a&&n0)return t.activeItem=null,void Yn(e);i.forEach((e,o)=>{a!==e&&n>=l[o]&&(void 0===l[o+1]||nnew Un(t),getInstance:t=>w(t,"ScrollSpy")});const Gn=t=>w(t,"Tab"),Zn=y("show.bs.tab"),Jn=y("shown.bs.tab"),Kn=y("hide.bs.tab"),Qn=y("hidden.bs.tab"),_n=new Map;function to(t){const{tabContent:e,nav:n}=t;e&&(e.style.height="",g(e,"collapsing")),n&&J(n)}function eo(t){const{element:e,tabContent:n,nav:o}=t,{currentHeight:s,nextHeight:i}=_n.get(e),{tab:a}=o&&_n.get(o);n?s===i?to(t):setTimeout(()=>{n.style.height=i+"px",K(n),l(n,()=>to(t))},50):o&&J(o),Jn.relatedTarget=a,m(e,Jn)}function no(t){const{element:e,content:n,tabContent:o,nav:s}=t,{tab:i,content:a}=s&&_n.get(s);let r=0;if(o&&([a,n].forEach(t=>S(t,"overflow-hidden")),r=a.scrollHeight),Zn.relatedTarget=i,Qn.relatedTarget=e,m(e,Zn),!Zn.defaultPrevented){if(S(n,"active"),g(a,"active"),o){const t=n.scrollHeight;_n.set(e,{currentHeight:r,nextHeight:t}),S(o,"collapsing"),o.style.height=r+"px",K(o),[a,n].forEach(t=>g(t,"overflow-hidden"))}n&&p(n,"fade")?setTimeout(()=>{S(n,"show"),l(n,()=>{eo(t)})},17):eo(t),m(i,Qn)}}function oo(t,e){(e?n:o)(t.element,"click",so)}function so(t){const e=Gn(this);e&&(t.preventDefault(),e.show())}class io extends k{constructor(t){super(t);const{element:e}=this,n=_(e);if(!n)return;const o=u(e,".nav"),s=u(n,".tab-content");this.nav=o,this.content=n,this.tabContent=s,this.dropdown=o&&h(`.${Wt[0]}-toggle`,o),oo(this,!0)}get name(){return"Tab"}show(){const t=this,{element:e,nav:n,dropdown:o}=t;if(!(n&&Z(n)||p(e,"active"))){const{tab:s,content:i}=function(t){const{nav:e}=t,n=q("active",e);let o;return 1!==n.length||Wt.some(t=>p(n[0].parentElement,t))?n.length>1&&(o=n[n.length-1]):[o]=n,{tab:o,content:o?_(o):null}}(t);if(n&&_n.set(n,{tab:s,content:i}),Kn.relatedTarget=e,m(s,Kn),Kn.defaultPrevented)return;n&&G(n,()=>{},17),g(s,"active"),C(s,"aria-selected","false"),S(e,"active"),C(e,"aria-selected","true"),o&&(p(e.parentNode,"dropdown-menu")?p(o,"active")||S(o,"active"):p(o,"active")&&g(o,"active")),p(i,"fade")?(g(i,"show"),l(i,()=>no(t))):no(t)}}dispose(){oo(this),super.dispose()}}f(io,{selector:'[data-bs-toggle="tab"]',init:t=>new io(t),getInstance:Gn});const ao={animation:!0,autohide:!0,delay:5e3},lo=t=>w(t,"Toast"),ro=y("show.bs.toast"),co=y("shown.bs.toast"),ho=y("hide.bs.toast"),uo=y("hidden.bs.toast");function fo(t){const{element:e,options:n}=t;g(e,"showing"),J(e,"showing"),m(e,co),n.autohide&&G(e,()=>t.hide(),n.delay,"toast")}function po(t){const{element:e}=t;g(e,"showing"),g(e,"show"),S(e,"hide"),J(e,"toast"),m(e,uo)}function go(t,e){const s=e?n:o,{element:i,dismiss:a,options:l}=t;a&&s(a,"click",t.hide),l.autohide&&[mn,bn,W,F].forEach(t=>s(i,t,mo))}function mo(t){const e=this,n=lo(e),{type:o,relatedTarget:s}=t;n&&e!==s&&!e.contains(s)&&([W,mn].includes(o)?J(e,"toast"):G(e,()=>n.hide(),n.options.delay,"toast"))}class bo extends k{constructor(t,e){super(t,e);const{element:n,options:o}=this;o.animation&&!p(n,"fade")?S(n,"fade"):!o.animation&&p(n,"fade")&&g(n,"fade"),this.dismiss=h('[data-bs-dismiss="toast"]',n),this.show=this.show.bind(this),this.hide=this.hide.bind(this),go(this,!0)}get name(){return"Toast"}get defaults(){return ao}show(){const t=this,{element:e}=t;if(e&&!p(e,"show")){if(m(e,ro),ro.defaultPrevented)return;!function(t){const{element:e,options:n}=t;G(e,()=>{g(e,"hide"),K(e),S(e,"show"),S(e,"showing"),n.animation?l(e,()=>fo(t)):fo(t)},17,"showing")}(t)}}hide(){const t=this,{element:e}=t;if(e&&p(e,"show")){if(m(e,ho),ho.defaultPrevented)return;!function(t){const{element:e,options:n}=t;S(e,"showing"),n.animation?(K(e),l(e,()=>po(t))):po(t)}(t)}}dispose(){const{element:t}=this;p(t,"show")&&g(t,"show"),function(t){J(t.element,"toast"),go(t)}(this),super.dispose()}}f(bo,{selector:".toast",init:t=>new bo(t),getInstance:lo});const vo={Alert:D,Button:O,Carousel:yt,Collapse:Lt,Dropdown:ce,Modal:Ue,Offcanvas:cn,Popover:Fn,ScrollSpy:Un,Tab:io,Toast:bo,Tooltip:On};function wo(t){const e=[...Bn("*",t&&c.some(e=>t instanceof e)?t:void 0)];x(vo).forEach(t=>{const{init:n,selector:o}=vo[t];var s,i;s=n,i=e.filter(t=>function(t,e){return t.matches(e)}(t,o)),[...i].forEach(t=>s(t))})}document.body?wo():n(document,"DOMContentLoaded",()=>wo(),{once:!0});const yo={Alert:D,Button:O,Carousel:yt,Collapse:Lt,Dropdown:ce,Modal:Ue,Offcanvas:cn,Popover:Fn,ScrollSpy:Un,Tab:io,Toast:bo,Tooltip:On,initCallback:wo,removeDataAPI:function(t){const e=t&&c.some(e=>t instanceof e)?t:void 0;x(vo).forEach(t=>{!function(t,e){const n=v.getAllFor(t);n&&[...n].forEach(t=>{const[n,o]=t;e&&e.contains(n)&&o.dispose()})}(t,e)})},Version:"4.1.0alpha5",EventListener:s};export{yo as default}; diff --git a/dist/bootstrap-native.js b/dist/bootstrap-native.js index 2dc1e8b5..fb798696 100644 --- a/dist/bootstrap-native.js +++ b/dist/bootstrap-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -9,6 +9,115 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BSN = factory()); })(this, (function () { 'use strict'; + /** @type {Record} */ + const EventRegistry = {}; + + /** + * The global event listener. + * + * @this {Element | HTMLElement | Window | Document} + * @param {Event} e + * @returns {void} + */ + function globalListener(e) { + const that = this; + const { type } = e; + const oneEvMap = EventRegistry[type] ? [...EventRegistry[type]] : []; + + oneEvMap.forEach((elementsMap) => { + const [element, listenersMap] = elementsMap; + [...listenersMap].forEach((listenerMap) => { + if (element === that) { + const [listener, options] = listenerMap; + listener.apply(element, [e]); + + if (options && options.once) { + removeListener(element, type, listener, options); + } + } + }); + }); + } + + /** + * Register a new listener with its options and attach the `globalListener` + * to the target if this is the first listener. + * + * @param {Element | HTMLElement | Window | Document} element + * @param {string} eventType + * @param {EventListenerObject['handleEvent']} listener + * @param {AddEventListenerOptions=} options + */ + const addListener = (element, eventType, listener, options) => { + // get element listeners first + if (!EventRegistry[eventType]) { + EventRegistry[eventType] = new Map(); + } + const oneEventMap = EventRegistry[eventType]; + + if (!oneEventMap.has(element)) { + oneEventMap.set(element, new Map()); + } + const oneElementMap = oneEventMap.get(element); + + // get listeners size + const { size } = oneElementMap; + + // register listener with its options + if (oneElementMap) { + oneElementMap.set(listener, options); + } + + // add listener last + if (!size) { + element.addEventListener(eventType, globalListener, options); + } + }; + + /** + * Remove a listener from registry and detach the `globalListener` + * if no listeners are found in the registry. + * + * @param {Element | HTMLElement | Window | Document} element + * @param {string} eventType + * @param {EventListenerObject['handleEvent']} listener + * @param {AddEventListenerOptions=} options + */ + const removeListener = (element, eventType, listener, options) => { + // get listener first + const oneEventMap = EventRegistry[eventType]; + const oneElementMap = oneEventMap && oneEventMap.get(element); + const savedOptions = oneElementMap && oneElementMap.get(listener); + + // also recover initial options + const { options: eventOptions } = savedOptions !== undefined + ? savedOptions + : { options }; + + // unsubscribe second, remove from registry + if (oneElementMap && oneElementMap.has(listener)) oneElementMap.delete(listener); + if (oneEventMap && (!oneElementMap || !oneElementMap.size)) oneEventMap.delete(element); + if (!oneEventMap || !oneEventMap.size) delete EventRegistry[eventType]; + + // remove listener last + if (!oneElementMap || !oneElementMap.size) { + element.removeEventListener(eventType, globalListener, eventOptions); + } + }; + + /** + * Advanced event listener based on subscribe / publish pattern. + * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript + * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js + * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 + */ + const EventListener = { + on: addListener, + off: removeListener, + globalListener, + registry: EventRegistry, + }; + /** * A global namespace for `click` event. * @type {string} @@ -96,32 +205,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$b(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$b(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -138,16 +221,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$b(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$b(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -171,7 +254,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -183,19 +266,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -343,114 +424,6 @@ return OriginalCustomEvent; } - /** @type {Record} */ - const EventRegistry = {}; - - /** - * The global event listener. - * - * @this {Element | HTMLElement | Window | Document} - * @param {Event} e - * @returns {void} - */ - function globalListener(e) { - const that = this; - const { type } = e; - const oneEvMap = EventRegistry[type] ? [...EventRegistry[type]] : []; - - oneEvMap.forEach((elementsMap) => { - const [element, listenersMap] = elementsMap; - [...listenersMap].forEach((listenerMap) => { - if (element === that) { - const [listener, options] = listenerMap; - listener.apply(element, [e]); - - if (options && options.once) { - removeListener(element, type, listener, options); - } - } - }); - }); - } - - /** - * Register a new listener with its options and attach the `globalListener` - * to the target if this is the first listener. - * - * @param {Element | HTMLElement | Window | Document} element - * @param {string} eventType - * @param {EventListenerObject['handleEvent']} listener - * @param {AddEventListenerOptions=} options - */ - const addListener = (element, eventType, listener, options) => { - // get element listeners first - if (!EventRegistry[eventType]) { - EventRegistry[eventType] = new Map(); - } - const oneEventMap = EventRegistry[eventType]; - - if (!oneEventMap.has(element)) { - oneEventMap.set(element, new Map()); - } - const oneElementMap = oneEventMap.get(element); - - // get listeners size - const { size } = oneElementMap; - - // register listener with its options - if (oneElementMap) { - oneElementMap.set(listener, options); - } - - // add listener last - if (!size) { - element.addEventListener(eventType, globalListener, options); - } - }; - - /** - * Remove a listener from registry and detach the `globalListener` - * if no listeners are found in the registry. - * - * @param {Element | HTMLElement | Window | Document} element - * @param {string} eventType - * @param {EventListenerObject['handleEvent']} listener - * @param {AddEventListenerOptions=} options - */ - const removeListener = (element, eventType, listener, options) => { - // get listener first - const oneEventMap = EventRegistry[eventType]; - const oneElementMap = oneEventMap && oneEventMap.get(element); - const savedOptions = oneElementMap && oneElementMap.get(listener); - // also recover initial options - const { options: eventOptions } = savedOptions !== undefined - ? savedOptions - : { options }; - - // unsubscribe second, remove from registry - if (oneElementMap && oneElementMap.has(listener)) oneElementMap.delete(listener); - if (oneEventMap && (!oneElementMap || !oneElementMap.size)) oneEventMap.delete(element); - if (!oneEventMap || !oneEventMap.size) delete EventRegistry[eventType]; - - // remove listener last - if (!oneElementMap || !oneElementMap.size) { - element.removeEventListener(eventType, globalListener, eventOptions); - } - }; - - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `fade` class. */ @@ -572,7 +545,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -639,7 +612,6 @@ // ================ const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; - const { on: on$a, off: off$a } = EventListener; /** * Static method which returns an existing `Alert` instance associated @@ -684,7 +656,7 @@ * @param {boolean=} add when `true`, event listener is added */ function toggleAlertHandler(self, add) { - const action = add ? on$a : off$a; + const action = add ? addListener : removeListener; const { dismiss } = self; if (dismiss) action(dismiss, mouseclickEvent, self.close); } @@ -805,7 +777,6 @@ // BUTTON PRIVATE GC // ================= const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; - const { on: on$9, off: off$9 } = EventListener; /** * Static method which returns an existing `Button` instance associated @@ -829,7 +800,7 @@ * @param {boolean=} add when `true`, event listener is added */ function toggleButtonHandler(self, add) { - const action = add ? on$9 : off$9; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, self.toggle); } @@ -1202,7 +1173,6 @@ const carouselItem = `${carouselString}-item`; const dataBsSlideTo = 'data-bs-slide-to'; const dataBsSlide = 'data-bs-slide'; - const { on: on$8, off: off$8 } = EventListener; const pausedClass = 'paused'; const carouselDefaults = { @@ -1464,7 +1434,7 @@ */ function toggleCarouselTouchHandlers(self, add) { const { element } = self; - const action = add ? on$8 : off$8; + const action = add ? addListener : removeListener; action(element, touchmoveEvent, carouselTouchMoveHandler, passiveHandler); action(element, touchendEvent, carouselTouchEndHandler, passiveHandler); } @@ -1481,7 +1451,7 @@ const { touch, pause, interval, keyboard, } = options; - const action = add ? on$8 : off$8; + const action = add ? addListener : removeListener; if (pause && interval) { action(element, mouseenterEvent, carouselPauseHandler); @@ -1785,7 +1755,6 @@ const collapseSelector = `.${collapseString}`; const collapseToggleSelector = `[${dataBsToggle}="${collapseString}"]`; const collapseDefaults = { parent: null }; - const { on: on$7, off: off$7 } = EventListener; /** * Static method which returns an existing `Collapse` instance associated @@ -1898,7 +1867,7 @@ * @param {boolean=} add when `true`, the event listener is added */ function toggleCollapseHandler(self, add) { - const action = add ? on$7 : off$7; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { @@ -2138,7 +2107,6 @@ dropendString, ] = dropdownMenuClasses; const dropdownSelector = `[${dataBsToggle}="${dropdownString}"]`; - const { on: on$6, off: off$6 } = EventListener; /** * Static method which returns an existing `Dropdown` instance associated @@ -2314,7 +2282,7 @@ */ function toggleDropdownDismiss(self) { const { element } = self; - const action = self.open ? on$6 : off$6; + const action = self.open ? addListener : removeListener; const doc = getDocument(element); action(doc, mouseclickEvent, dropdownDismissHandler); @@ -2337,7 +2305,7 @@ * @param {boolean=} add when `true`, it will add the event listener */ function toggleDropdownHandler(self, add) { - const action = add ? on$6 : off$6; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, dropdownClickHandler); } @@ -2933,7 +2901,6 @@ const modalToggleSelector = `[${dataBsToggle}="${modalString}"]`; const modalDismissSelector = `[${dataBsDismiss}="${modalString}"]`; const modalStaticClass = `${modalString}-static`; - const { on: on$5, off: off$5 } = EventListener; const modalDefaults = { backdrop: true, // boolean|string @@ -2991,7 +2958,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleModalDismiss(self, add) { - const action = add ? on$5 : off$5; + const action = add ? addListener : removeListener; const { element } = self; action(element, mouseclickEvent, modalDismissHandler); // @ts-ignore @@ -3005,7 +2972,7 @@ * @param {boolean=} add when `true`, event listener is added */ function toggleModalHandler(self, add) { - const action = add ? on$5 : off$5; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { @@ -3351,7 +3318,6 @@ const offcanvasToggleSelector = `[${dataBsToggle}="${offcanvasString}"]`; const offcanvasDismissSelector = `[${dataBsDismiss}="${offcanvasString}"]`; const offcanvasTogglingClass = `${offcanvasString}-toggling`; - const { on: on$4, off: off$4 } = EventListener; const offcanvasDefaults = { backdrop: true, // boolean @@ -3401,7 +3367,7 @@ * @param {boolean=} add when *true*, listeners are added */ function toggleOffcanvasEvents(self, add) { - const action = add ? on$4 : off$4; + const action = add ? addListener : removeListener; self.triggers.forEach((btn) => action(btn, mouseclickEvent, offcanvasTriggerHandler)); } @@ -3412,7 +3378,7 @@ * @param {boolean=} add when *true* listeners are added */ function toggleOffCanvasDismiss(self, add) { - const action = add ? on$4 : off$4; + const action = add ? addListener : removeListener; const doc = getDocument(self.element); action(doc, keydownEvent, offcanvasKeyDismissHandler); action(doc, mouseclickEvent, offcanvasDismissHandler); @@ -4276,7 +4242,6 @@ // ================== const tooltipSelector = `[${dataBsToggle}="${tooltipString}"],[data-tip="${tooltipString}"]`; const titleAttr = 'title'; - const { on: on$3, off: off$3 } = EventListener; /** * Static method which returns an existing `Tooltip` instance associated @@ -4326,7 +4291,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipAction(self, add) { - const action = add ? on$3 : off$3; + const action = add ? addListener : removeListener; const { element } = self; action(getDocument(element), touchstartEvent, tooltipTouchHandler, passiveHandler); @@ -4375,7 +4340,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipHandlers(self, add) { - const action = add ? on$3 : off$3; + const action = add ? addListener : removeListener; // @ts-ignore -- btn is only for dismissible popover const { element, options, btn } = self; const { trigger, dismissible } = options; @@ -4420,7 +4385,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipOpenHandlers(self, add) { - const action = add ? on$3 : off$3; + const action = add ? addListener : removeListener; const { element, options, offsetParent } = self; const { container } = options; const { offsetHeight, scrollHeight } = container; @@ -4437,8 +4402,8 @@ } // dismiss tooltips inside modal / offcanvas - if (parentModal) on$3(parentModal, `hide.bs.${modalString}`, self.hide); - if (parentOffcanvas) on$3(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); + if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.hide); + if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); } /** @@ -4817,7 +4782,6 @@ // SCROLLSPY PRIVATE GC // ==================== const scrollspySelector = '[data-bs-spy="scroll"]'; - const { on: on$2, off: off$2 } = EventListener; const scrollspyDefaults = { offset: 10, @@ -4963,7 +4927,7 @@ * @param {boolean=} add when `true`, listener is added */ function toggleSpyHandlers(self, add) { - const action = add ? on$2 : off$2; + const action = add ? addListener : removeListener; // @ts-ignore action(self.scrollTarget, scrollEvent, self.refresh, passiveHandler); } @@ -5107,7 +5071,6 @@ // TAB PRIVATE GC // ================ const tabSelector = `[${dataBsToggle}="${tabString}"]`; - const { on: on$1, off: off$1 } = EventListener; /** * Static method which returns an existing `Tab` instance associated @@ -5256,7 +5219,7 @@ * @param {boolean=} add when `true`, event listener is added */ function toggleTabHandler(self, add) { - const action = add ? on$1 : off$1; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, tabClickHandler); } @@ -5388,7 +5351,6 @@ const showingClass = 'showing'; /** @deprecated */ const hideClass = 'hide'; - const { on, off } = EventListener; const toastDefaults = { animation: true, @@ -5489,7 +5451,7 @@ * @param {boolean=} add when `true`, it will add the listener */ function toggleToastHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, dismiss, options } = self; if (dismiss) { action(dismiss, mouseclickEvent, self.hide); @@ -5621,29 +5583,6 @@ getInstance: getToastInstance, }); - /** - * Add an `eventListener` to an `Element` | `HTMLElement` | `Document` | `Window` - * target and remove it once callback is called. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function one(element, eventName, handler, options) { - /** - * Wrap the handler for easy on -> off - * @type {EventListenerObject['handleEvent']} - */ - const handlerWrapper = (e) => { - if (e.target === element) { - handler.apply(element, [e]); - off$b(element, eventName, handlerWrapper, options); - } - }; - on$b(element, eventName, handlerWrapper, options); - } - /** * Check if element matches a CSS selector. * @@ -5727,7 +5666,7 @@ // bulk initialize all components if (document.body) initCallback(); else { - one(document, 'DOMContentLoaded', () => initCallback()); + addListener(document, 'DOMContentLoaded', () => initCallback(), { once: true }); } const BSN = { @@ -5747,6 +5686,7 @@ initCallback, removeDataAPI, Version, + EventListener, }; return BSN; diff --git a/dist/bootstrap-native.min.js b/dist/bootstrap-native.min.js index 40ebc04f..80025c37 100644 --- a/dist/bootstrap-native.min.js +++ b/dist/bootstrap-native.min.js @@ -1,2 +1,2 @@ -// Native JavaScript for Bootstrap v4.1.0alpha4 | 2022 © dnp_theme | MIT-License -!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).BSN=e()}(this,(function(){"use strict";function t(t,e){const n=getComputedStyle(t);return e in n?n[e]:""}function e(e){const n=t(e,"transitionProperty"),o=t(e,"transitionDuration"),s=o.includes("ms")?1:1e3,i=n&&"none"!==n?parseFloat(o)*s:0;return Number.isNaN(i)?0:i}function n(t,e,n,o){const s=o||!1;t.addEventListener(e,n,s)}function o(t,e,n,o){const s=o||!1;t.removeEventListener(e,n,s)}function s(s,i){let a=0;const r=new Event("transitionend"),l=e(s),c=function(e){const n=t(e,"transitionProperty"),o=t(e,"transitionDelay"),s=o.includes("ms")?1:1e3,i=n&&"none"!==n?parseFloat(o)*s:0;return Number.isNaN(i)?0:i}(s);if(l){const t=e=>{e.target===s&&(i.apply(s,[e]),o(s,"transitionend",t),a=1)};n(s,"transitionend",t),setTimeout(()=>{a||s.dispatchEvent(r)},l+c+17)}else i.apply(s,[r])}function i(t){return t instanceof HTMLElement?t.ownerDocument:t instanceof Window?t.document:window.document}const a=[Document,Node,Element,HTMLElement],r=[Element,HTMLElement];function l(t,e){const n="string"==typeof t,o=e&&a.some(t=>e instanceof t)?e:i();return!n&&r.some(e=>t instanceof e)?t:n?o.querySelector(t):null}function c(t,e){return t?t.closest(e)||c(t.getRootNode().host,e):null}const d=(t,e)=>Object.assign(t,e);function h(t,e){return t.classList.contains(e)}function u(t,e){t.classList.remove(e)}const f=(t,e)=>t.dispatchEvent(e),p=new Map,g={set:(t,e,n)=>{const o=l(t);if(!o)return;p.has(e)||p.set(e,new Map);p.get(e).set(o,n)},getAllFor:t=>p.get(t)||null,get:(t,e)=>{const n=l(t),o=g.getAllFor(e);return n&&o&&o.get(n)||null},remove:(t,e)=>{const n=l(t),o=p.get(e);o&&n&&(o.delete(n),0===o.size&&p.delete(e))}},m=(t,e)=>g.get(t,e);function b(t,e){const n=new CustomEvent(t,{cancelable:!0,bubbles:!0});return e instanceof Object&&d(n,e),n}const v={};function w(t){const e=this,{type:n}=t;(v[n]?[...v[n]]:[]).forEach(o=>{const[s,i]=o;[...i].forEach(o=>{if(s===e){const[e,i]=o;e.apply(s,[t]),i&&i.once&&y(s,n,e,i)}})})}const y=(t,e,n,o)=>{const s=v[e],i=s&&s.get(t),a=i&&i.get(n),{options:r}=void 0!==a?a:{options:o};i&&i.has(n)&&i.delete(n),!s||i&&i.size||s.delete(t),s&&s.size||delete v[e],i&&i.size||t.removeEventListener(e,w,r)},T={on:(t,e,n,o)=>{v[e]||(v[e]=new Map);const s=v[e];s.has(t)||s.set(t,new Map);const i=s.get(t),{size:a}=i;i&&i.set(n,o),a||t.addEventListener(e,w,o)},off:y,globalListener:w,registry:v},E=(t,e)=>t.getAttribute(e);function x(t){return"true"===t||"false"!==t&&(Number.isNaN(+t)?""===t||"null"===t?null:t:+t)}const H=t=>Object.keys(t),k=t=>t.toLowerCase();class A{constructor(t,e){const n=this,o=l(t);if(!o)throw Error(`${n.name} Error: "${t}" is not a valid selector.`);n.options={};const s=g.get(o,n.name);s&&s.dispose(),n.element=o,n.defaults&&Object.keys(n.defaults).length&&(n.options=function(t,e,n,o){const s={...t.dataset},i={},a={};return H(s).forEach(t=>{const e=o&&t.includes(o)?t.replace(o,"").replace(/[A-Z]/,t=>k(t)):t;a[e]=x(s[t])}),H(n).forEach(t=>{n[t]=x(n[t])}),H(e).forEach(o=>{i[o]=o in n?n[o]:o in a?a[o]:"title"===o?E(t,"title"):e[o]}),i}(o,n.defaults,e||{},"bs")),g.set(o,n.name,n)}get version(){return"4.1.0alpha4"}get name(){return this.constructor.name}get defaults(){return this.constructor.defaults}dispose(){const t=this;g.remove(t.element,t.name),H(t).forEach(e=>{t[e]=null})}}const{on:P,off:M}=T,N=t=>m(t,"Alert"),$=b("close.bs.alert"),L=b("closed.bs.alert");function D(t){const{element:e}=t;S(t),f(e,L),t.dispose(),e.remove()}function S(t,e){const n=e?P:M,{dismiss:o}=t;o&&n(o,"click",t.close)}class C extends A{constructor(t){super(t);const{element:e}=this;this.dismiss=l('[data-bs-dismiss="alert"]',e),S(this,!0)}get name(){return"Alert"}close(t){const e=t?N(c(this,".alert")):this;if(!e)return;const{element:n}=e;if(h(n,"show")){if(f(n,$),$.defaultPrevented)return;u(n,"show"),h(n,"fade")?s(n,()=>D(e)):D(e)}}dispose(){S(this),super.dispose()}}d(C,{selector:".alert",init:t=>new C(t),getInstance:N});const I=(t,e,n)=>t.setAttribute(e,n);function R(t,e){t.classList.add(e)}const O="data-bs-toggle",W=`[${O}="button"]`,{on:F,off:B}=T,z=t=>m(t,"Button");function X(t,e){(e?F:B)(t.element,"click",t.toggle)}class j extends A{constructor(t){super(t);const{element:e}=this;this.isActive=h(e,"active"),I(e,"aria-pressed",""+!!this.isActive),X(this,!0)}get name(){return"Button"}toggle(t){t&&t.preventDefault();const e=t?z(this):this;if(!e)return;const{element:n}=e;if(h(n,"disabled"))return;e.isActive=h(n,"active");const{isActive:o}=e;(o?u:R)(n,"active"),I(n,"aria-pressed",o?"false":"true")}dispose(){X(this),super.dispose()}}d(j,{selector:W,init:t=>new j(t),getInstance:z});const Y="mouseenter",V="mouseleave";function q(t){if(null==t)return window;if(!(t instanceof Window)){const{ownerDocument:e}=t;return e&&e.defaultView||window}return t}function U(t,e){const{width:n,height:o,top:s,right:i,bottom:a,left:r}=t.getBoundingClientRect();let l=1,c=1;if(e&&t instanceof HTMLElement){const{offsetWidth:e,offsetHeight:s}=t;l=e>0&&Math.round(n)/e||1,c=s>0&&Math.round(o)/s||1}return{width:n/l,height:o/c,top:s/c,right:i/l,bottom:a/c,left:r/l,x:r/l,y:s/c}}function G(t){return i(t).documentElement}const Z=t=>{const{top:e,bottom:n}=U(t),{clientHeight:o}=G(t);return e<=o&&n>=0},J=t=>"rtl"===G(t).dir;function K(t,e){return(e&&a.some(t=>e instanceof t)?e:i()).querySelectorAll(t)}function Q(t,e){return(e&&a.some(t=>e instanceof t)?e:i()).getElementsByClassName(t)}const _=new Map,tt=(t,e,n,o)=>{const s=l(t);if(s)if(o&&o.length){_.has(s)||_.set(s,new Map);_.get(s).set(o,setTimeout(e,n))}else _.set(s,setTimeout(e,n))},et=(t,e)=>{const n=l(t);if(!n)return null;const o=_.get(n);return e&&e.length&&o&&o.get?o.get(e)||null:o||null},nt=(t,e)=>{const n=l(t);if(n)if(e&&e.length){const t=_.get(n);t&&t.get&&(clearTimeout(t.get(e)),t.delete(e),0===t.size&&_.delete(n))}else clearTimeout(_.get(n)),_.delete(n)},ot=t=>t.offsetHeight,st={passive:!0};function it(t){const e=["data-bs-target","data-bs-parent","data-bs-container","href"],n=i(t);return e.map(e=>{const o=E(t,e);return o?"data-bs-parent"===e?c(t,o):l(o,n):null}).filter(t=>t)[0]}const at="carousel-item",{on:rt,off:lt}=T,ct={pause:"hover",keyboard:!1,touch:!0,interval:5e3},dt=t=>m(t,"Carousel");let ht=0,ut=0,ft=0;const pt=b("slide.bs.carousel"),gt=b("slid.bs.carousel");function mt(){const t=this,e=dt(t);!e||e.isPaused||et(t,"paused")||R(t,"paused")}function bt(){const t=dt(this);t&&t.isPaused&&!et(this,"paused")&&t.cycle()}function vt(t){t.preventDefault();const e=c(this,'[data-bs-ride="carousel"]')||it(this);if(!e)return;const n=dt(e);if(!n||n.isAnimating)return;const o=+E(this,"data-bs-slide-to");!this||h(this,"active")||Number.isNaN(o)||n.to(o)}function wt(t){t.preventDefault();const e=c(this,'[data-bs-ride="carousel"]')||it(this),n=e&&dt(e);if(!n||n.isAnimating)return;const o=E(this,"data-bs-slide");"next"===o?n.next():"prev"===o&&n.prev()}function yt({code:t}){const[e]=[...K('[data-bs-ride="carousel"]')].filter(t=>Z(t)),n=dt(e);if(!n)return;const o=J(),s=o?"ArrowLeft":"ArrowRight";t===(o?"ArrowRight":"ArrowLeft")?n.prev():t===s&&n.next()}function Tt(t){const e=dt(this);e&&!e.isTouch&&(ht=t.changedTouches[0].pageX,this.contains(t.target)&&(e.isTouch=!0,kt(e,!0)))}function Et(t){const{changedTouches:e,type:n}=t,o=dt(this);o&&o.isTouch&&(ut=e[0].pageX,"touchmove"===n&&e.length>1&&t.preventDefault())}function xt(t){const e=this,n=dt(e);if(n&&n.isTouch&&(ft=ut||t.changedTouches[0].pageX,n.isTouch)){if((!e.contains(t.target)||!e.contains(t.relatedTarget))&&Math.abs(ht-ft)<75)return;utht&&(n.index-=1),n.isTouch=!1,n.to(n.index),kt(n)}}function Ht(t,e){const{indicators:n}=t;[...n].forEach(t=>u(t,"active")),t.indicators[e]&&R(n[e],"active")}function kt(t,e){const{element:n}=t,o=e?rt:lt;o(n,"touchmove",Et,st),o(n,"touchend",xt,st)}function At(t,e){const{element:n,options:o,slides:s,controls:i,indicators:a}=t,{touch:r,pause:l,interval:c,keyboard:d}=o,h=e?rt:lt;l&&c&&(h(n,Y,mt),h(n,V,bt),h(n,"touchstart",mt,st),h(n,"touchend",bt,st)),r&&s.length>1&&h(n,"touchstart",Tt,st),i.length&&i.forEach(t=>{t&&h(t,"click",wt)}),a.length&&a.forEach(t=>{h(t,"click",vt)}),d&&h(q(n),"keydown",yt)}function Pt(t){const{slides:e,element:n}=t,o=l(`.${at}.active`,n);return[...e].indexOf(o)}class Mt extends A{constructor(t,e){super(t,e);const n=this;n.direction=J()?"right":"left",n.index=0,n.isTouch=!1;const{element:o}=n;n.slides=Q(at,o);const{slides:s}=n;if(s.length<2)return;n.controls=[...K("[data-bs-slide]",o),...K(`[data-bs-slide][data-bs-target="#${o.id}"]`)],n.indicator=l(".carousel-indicators",o),n.indicators=[...n.indicator?K("[data-bs-slide-to]",n.indicator):[],...K(`[data-bs-slide-to][data-bs-target="#${o.id}"]`)];const{options:i}=n;n.options.interval=!0===i.interval?ct.interval:i.interval,Pt(n)<0&&(s.length&&R(s[0],"active"),n.indicators.length&&Ht(n,0)),At(n,!0),i.interval&&n.cycle()}get name(){return"Carousel"}get defaults(){return ct}get isPaused(){return h(this.element,"paused")}get isAnimating(){return null!==l(`.${at}-next,.${at}-prev`,this.element)}cycle(){const t=this,{element:e,options:n,isPaused:o}=t;nt(e,"carousel"),o&&(nt(e,"paused"),u(e,"paused")),tt(e,()=>{!t.isPaused&&Z(e)&&(t.index+=1,t.to(t.index))},n.interval,"carousel")}pause(){const{element:t,options:e}=this;!this.isPaused&&e.interval&&(R(t,"paused"),tt(t,()=>{},1,"paused"))}next(){const t=this;t.isAnimating||(t.index+=1,t.to(t.index))}prev(){const t=this;t.isAnimating||(t.index-=1,t.to(t.index))}to(t){const n=this,{element:o,slides:a,options:r}=n,l=Pt(n),c=J();let p=t;if(n.isAnimating||l===p)return;lp||l===a.length-1&&0===p)&&(n.direction=c?"left":"right");const{direction:g}=n;p<0?p=a.length-1:p>=a.length&&(p=0);const m="left"===g?"next":"prev",b="left"===g?"start":"end",v={relatedTarget:a[p],from:l,to:p,direction:g};d(pt,v),d(gt,v),f(o,pt),pt.defaultPrevented||(n.index=p,Ht(n,p),e(a[p])&&h(o,"slide")?tt(o,()=>{R(a[p],`${at}-${m}`),ot(a[p]),R(a[p],`${at}-${b}`),R(a[l],`${at}-${b}`),s(a[p],()=>function(t){const{index:e,direction:n,element:o,slides:s,options:a}=t;if(t.isAnimating&&dt(o)){const r=Pt(t),l="left"===n?"next":"prev",c="left"===n?"start":"end";R(s[e],"active"),u(s[e],`${at}-${l}`),u(s[e],`${at}-${c}`),u(s[r],"active"),u(s[r],`${at}-${c}`),f(o,gt),nt(o,"data-bs-slide"),i(o).hidden||!a.interval||t.isPaused||t.cycle()}}(n))},17,"data-bs-slide"):(R(a[p],"active"),u(a[l],"active"),tt(o,()=>{nt(o,"data-bs-slide"),o&&r.interval&&!n.isPaused&&n.cycle(),f(o,gt)},17,"data-bs-slide")))}dispose(){const t=this,{slides:e}=t,n=["start","end","prev","next"];[...e].forEach((e,o)=>{h(e,"active")&&Ht(t,o),n.forEach(t=>u(e,`${at}-${t}`))}),At(t),super.dispose()}}d(Mt,{selector:'[data-bs-ride="carousel"]',init:t=>new Mt(t),getInstance:dt});const Nt=`[${O}="collapse"]`,$t={parent:null},{on:Lt,off:Dt}=T,St=t=>m(t,"Collapse"),Ct=b("show.bs.collapse"),It=b("shown.bs.collapse"),Rt=b("hide.bs.collapse"),Ot=b("hidden.bs.collapse");function Wt(t){const{element:e,parent:n,triggers:o}=t;f(e,Rt),Rt.defaultPrevented||(tt(e,()=>{},17),n&&tt(n,()=>{},17),e.style.height=e.scrollHeight+"px",u(e,"collapse"),u(e,"show"),R(e,"collapsing"),ot(e),e.style.height="0px",s(e,()=>{nt(e),n&&nt(n),o.forEach(t=>I(t,"aria-expanded","false")),u(e,"collapsing"),R(e,"collapse"),e.style.height="",f(e,Ot)}))}function Ft(t,e){const n=e?Lt:Dt,{triggers:o}=t;o.length&&o.forEach(t=>n(t,"click",Bt))}function Bt(t){const{target:e}=t,n=e&&c(e,Nt),o=n&&it(n),s=o&&St(o);s&&s.toggle(),n&&"A"===n.tagName&&t.preventDefault()}class zt extends A{constructor(t,e){super(t,e);const{element:n,options:o}=this;this.triggers=[...K(Nt)].filter(t=>it(t)===n),this.parent=l(o.parent),Ft(this,!0)}get name(){return"Collapse"}get defaults(){return $t}toggle(){h(this.element,"show")?this.hide():this.show()}hide(){const{triggers:t,element:e}=this;et(e)||(Wt(this),t.length&&t.forEach(t=>R(t,"collapsed")))}show(){const t=this,{element:e,parent:n,triggers:o}=t;let i,a;n&&(i=[...K(".collapse.show",n)].find(t=>St(t)),a=i&&St(i)),n&&(!n||et(n))||et(e)||(a&&i!==e&&(Wt(a),a.triggers.forEach(t=>{R(t,"collapsed")})),function(t){const{element:e,parent:n,triggers:o}=t;f(e,Ct),Ct.defaultPrevented||(tt(e,()=>{},17),n&&tt(n,()=>{},17),R(e,"collapsing"),u(e,"collapse"),e.style.height=e.scrollHeight+"px",s(e,()=>{nt(e),n&&nt(n),o.forEach(t=>I(t,"aria-expanded","true")),u(e,"collapsing"),R(e,"collapse"),R(e,"show"),e.style.height="",f(e,It)}))}(t),o.length&&o.forEach(t=>u(t,"collapsed")))}dispose(){Ft(this),super.dispose()}}d(zt,{selector:".collapse",init:t=>new zt(t),getInstance:St});const Xt="scroll",jt="resize",Yt="ArrowUp",Vt="ArrowDown",qt=(t,e)=>t.hasAttribute(e),Ut=(t,e)=>{d(t.style,e)},Gt=t=>t.focus(),Zt=["dropdown","dropup","dropstart","dropend"];function Jt(t){const e=c(t,"A");return t&&(qt(t,"href")&&"#"===t.href.slice(-1)||e&&qt(e,"href")&&"#"===e.href.slice(-1))}const[Kt,Qt,_t,te]=Zt,ee=`[${O}="${Kt}"]`,{on:ne,off:oe}=T,se=t=>m(t,"Dropdown"),ie=[Kt,Qt],ae=[_t,te],re=["A","BUTTON"],le={offset:5,display:"dynamic"},ce=b("show.bs."+Kt),de=b("shown.bs."+Kt),he=b("hide.bs."+Kt),ue=b("hidden.bs."+Kt);function fe(e){const{element:n,menu:o,parentElement:s,options:i}=e,{offset:a}=i;if("static"===t(o,"position"))return;const r=J(n),l=h(s,"dropdown-menu-end");["margin","top","bottom","left","right"].forEach(t=>{o.style[t]=""});let c=Zt.find(t=>h(s,t))||Kt,u={dropdown:[a,0,0],dropup:[0,0,a],dropstart:r?[-1,0,0,a]:[-1,a,0],dropend:r?[-1,a,0]:[-1,0,0,a]};const f={dropdown:{top:"100%"},dropup:{top:"auto",bottom:"100%"},dropstart:r?{left:"100%",right:"auto"}:{left:"auto",right:"100%"},dropend:r?{left:"auto",right:"100%"}:{left:"100%",right:"auto"},menuEnd:r?{right:"auto",left:0}:{right:0,left:"auto"}},{offsetWidth:p,offsetHeight:g}=o,{clientWidth:m,clientHeight:b}=G(n),{left:v,top:w,width:y,height:T}=U(n),E=v-p-a<0,x=v+p+y+a>=m,H=w+g+a>=b,k=w+g+T+a>=b,A=w-g-a<0,P=(!r&&l||r&&!l)&&v+y-p<0,M=(r&&l||!r&&!l)&&v+p>=m;ae.includes(c)&&E&&x&&(c=Kt),c===_t&&(r?x:E)&&(c=te),c===te&&(r?E:x)&&(c=_t),c===Qt&&A&&!k&&(c=Kt),c===Kt&&k&&!A&&(c=Qt),ae.includes(c)&&H&&d(f[c],{top:"auto",bottom:0}),ie.includes(c)&&(P||M)&&v+y+Math.abs(p-y)+at?t+"px":t).join(" "),Ut(o,f[c]),h(o,"dropdown-menu-end")&&Ut(o,f.menuEnd)}function pe(t){const{element:e}=t,n=t.open?ne:oe,o=i(e);n(o,"click",be),n(o,"focus",be),n(o,"keydown",we),n(o,"keyup",ye),"dynamic"===t.options.display&&[Xt,jt].forEach(t=>{n(q(e),t,Te,st)})}function ge(t,e){(e?ne:oe)(t.element,"click",ve)}function me(t){const e=[...Zt,"btn-group","input-group"].map(t=>Q(t+" show"),i(t)).find(t=>t.length);return e&&e.length?[...e[0].children].find(t=>qt(t,O)):null}function be(t){const{target:e,type:n}=t;if(!e||!e.closest)return;const o=me(e);if(!o)return;const s=se(o);if(!s)return;const{parentElement:i,menu:a}=s,r=null!==c(e,ee),l=i&&i.contains(e)&&("form"===e.tagName||null!==c(e,"form"));"click"===n&&Jt(e)&&t.preventDefault(),("focus"!==n||e!==o&&e!==a&&!a.contains(e))&&(l||r||s&&s.hide())}function ve(t){const{target:e}=t,n=se(this);n&&(n.toggle(),e&&Jt(e)&&t.preventDefault())}function we(t){[Vt,Yt].includes(t.code)&&t.preventDefault()}function ye(t){const{code:e}=t,n=me(this),o=n&&se(n),s=n&&i(n).activeElement;if(!o||!s)return;const{menu:a,open:r}=o,l=function(t){return[...t.children].map(t=>{if(t&&re.includes(t.tagName))return t;const{firstElementChild:e}=t;return e&&re.includes(e.tagName)?e:null}).filter(t=>t)}(a);if(l&&l.length&&[Vt,Yt].includes(e)){let t=l.indexOf(s);s===n?t=0:e===Yt?t=t>1?t-1:0:e===Vt&&(t=t{t.relatedTarget=e}),f(s,ce),ce.defaultPrevented||(R(o,"show"),R(s,"show"),I(e,"aria-expanded","true"),fe(t),t.open=!n,setTimeout(()=>{Gt(e),pe(t),f(s,de)},1))}hide(){const t=this,{element:e,open:n,menu:o,parentElement:s}=t;[he,ue].forEach(t=>{t.relatedTarget=e}),f(s,he),he.defaultPrevented||(u(o,"show"),u(s,"show"),I(e,"aria-expanded","false"),t.open=!n,setTimeout(()=>pe(t),1),f(s,ue))}dispose(){const{parentElement:t}=this;h(t,"show")&&this.open&&this.hide(),ge(this),super.dispose()}}d(Ee,{selector:ee,init:t=>new Ee(t),getInstance:se});const xe=(t,e)=>t.removeAttribute(e);function He(t){return i(t).body}const ke=t=>t instanceof q(t).ShadowRoot||t instanceof ShadowRoot;const Ae=t=>["TABLE","TD","TH"].includes(t.tagName),Pe=t=>t instanceof HTMLElement;function Me(e,n){const o=["HTML","BODY"];if(n){let{offsetParent:n}=e;const s=q(e);for(;n&&(Ae(n)||Pe(n)&&!["sticky","fixed"].includes(t(n,"position")));)n=n.offsetParent;return(!n||n&&(o.includes(n.tagName)||"static"===t(n,"position")))&&(n=s),n}const s=[];let{parentNode:i}=e;for(;i&&!o.includes(i.nodeName);)i="HTML"===(a=i).nodeName?a:a.assignedSlot||a.parentNode||(ke(a)?a.host:null)||G(a),ke(i)||i.shadowRoot||Ae(i)||s.push(i);var a;return s.find((e,n)=>"relative"!==t(e,"position")&&s.slice(n+1).every(e=>"static"===t(e,"position"))?e:null)||He(e)}const Ne="sticky-top",$e="position-sticky",Le=t=>[...Q("fixed-top",t),...Q("fixed-bottom",t),...Q(Ne,t),...Q($e,t),...Q("is-fixed",t)];function De(t){const{clientWidth:e}=G(t),{innerWidth:n}=q(t);return Math.abs(n-e)}function Se(e,n){const o=He(e),s=parseInt(t(o,"paddingRight"),10),i="hidden"===t(o,"overflow")&&s?0:De(e),a=Le(o);n&&(Ut(o,{overflow:"hidden",paddingRight:s+i+"px"}),a.length&&a.forEach(e=>{const n=t(e,"paddingRight");if(e.style.paddingRight=parseInt(n,10)+i+"px",[Ne,$e].some(t=>h(e,t))){const n=t(e,"marginRight");e.style.marginRight=parseInt(n,10)-i+"px"}}))}const Ce="modal-backdrop",Ie="offcanvas-backdrop",Re=i().createElement("div");function Oe(t){return l(".modal.show,.offcanvas.show",i(t))}function We(t){const e=t?Ce:Ie;[Ce,Ie].forEach(t=>{u(Re,t)}),R(Re,e)}function Fe(t,e,n){We(n),t.append(Re),e&&R(Re,"fade")}function Be(){R(Re,"show"),ot(Re)}function ze(){u(Re,"show")}function Xe(t){Oe(t)||(u(Re,"fade"),Re.remove(),function(t){const e=He(t);Ut(e,{paddingRight:"",overflow:""});const n=Le(e);n.length&&n.forEach(t=>{Ut(t,{paddingRight:"",marginRight:""})})}(t))}function je(e){return e&&"hidden"!==t(e,"visibility")&&null!==e.offsetParent}const Ye=`[${O}="modal"]`,{on:Ve,off:qe}=T,Ue={backdrop:!0,keyboard:!0},Ge=t=>m(t,"Modal"),Ze=b("show.bs.modal"),Je=b("shown.bs.modal"),Ke=b("hide.bs.modal"),Qe=b("hidden.bs.modal");function _e(t){const{element:e}=t,n=De(e),{clientHeight:o,scrollHeight:s}=G(e),{clientHeight:i,scrollHeight:a}=e,r=i!==a;if(!r&&n){const t=J(e)?"paddingLeft":"paddingRight";e.style[t]=n+"px"}Se(e,r||o!==s)}function tn(t,e){const n=e?Ve:qe,{element:o}=t;n(o,"click",cn),n(q(o),jt,t.update,st),n(i(o),"keydown",ln)}function en(t,e){const n=e?Ve:qe,{triggers:o}=t;o.length&&o.forEach(t=>n(t,"click",rn))}function nn(t){const{triggers:e,element:n}=t;if(Xe(n),n.style.paddingRight="",e.length){const t=e.find(t=>je(t));t&&Gt(t)}}function on(t){const{element:e,relatedTarget:n}=t;Gt(e),tn(t,!0),Je.relatedTarget=n,f(e,Je)}function sn(t){const{element:e,hasFade:n}=t;e.style.display="block",_e(t),Oe(e)||(He(e).style.overflow="hidden"),R(e,"show"),xe(e,"aria-hidden"),I(e,"aria-modal","true"),n?s(e,()=>on(t)):on(t)}function an(t,e){const{element:n,options:o,relatedTarget:i,hasFade:a}=t;n.style.display="",o.backdrop&&!e&&a&&h(Re,"show")&&!Oe(n)?(ze(),s(Re,()=>nn(t))):nn(t),tn(t),Qe.relatedTarget=i,f(n,Qe)}function rn(t){const{target:e}=t,n=e&&c(this,Ye),o=n&&it(n),s=o&&Ge(o);s&&(n&&"A"===n.tagName&&t.preventDefault(),s.relatedTarget=n,s.toggle())}function ln({code:t}){const e=l(".modal.show"),n=e&&Ge(e);if(!n)return;const{options:o}=n;o.keyboard&&"Escape"===t&&h(e,"show")&&(n.relatedTarget=null,n.hide())}function cn(t){const n=this,o=Ge(n);if(!o||et(n))return;const{options:a,isStatic:r,modalDialog:l}=o,{backdrop:d}=a,{target:h}=t,f=i(n).getSelection().toString().length,p=l.contains(h),g=h&&c(h,'[data-bs-dismiss="modal"]');r&&!p?tt(n,()=>{R(n,"modal-static"),s(l,()=>function(t){const{element:n,modalDialog:o}=t,s=e(o)+17;u(n,"modal-static"),tt(n,()=>nt(n),s)}(o))},17):(g||!f&&!r&&!p&&d)&&(o.relatedTarget=g||null,o.hide(),t.preventDefault())}class dn extends A{constructor(t,e){super(t,e);const{element:n}=this;this.modalDialog=l(".modal-dialog",n),this.triggers=[...K(Ye)].filter(t=>it(t)===n),this.isStatic="static"===this.options.backdrop,this.hasFade=h(n,"fade"),this.relatedTarget=null,this.container=Me(n),en(this,!0),this.update=this.update.bind(this)}get name(){return"Modal"}get defaults(){return Ue}toggle(){h(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:n,options:o,hasFade:s,relatedTarget:i,container:a}=t,{backdrop:r}=o;let l=0;if(h(n,"show"))return;if(Ze.relatedTarget=i||null,f(n,Ze),Ze.defaultPrevented)return;const c=Oe(n);if(c&&c!==n){(Ge(c)||m(c,"Offcanvas")).hide()}r?(c||h(Re,"show")?We(!0):Fe(a,s,!0),l=e(Re),h(Re,"show")||Be(),setTimeout(()=>sn(t),l)):(sn(t),c&&h(Re,"show")&&ze())}hide(t){const e=this,{element:n,hasFade:o,relatedTarget:i}=e;h(n,"show")&&(Ke.relatedTarget=i||null,f(n,Ke),Ke.defaultPrevented||(u(n,"show"),I(n,"aria-hidden","true"),xe(n,"aria-modal"),o&&!1!==t?s(n,()=>an(e)):an(e,t)))}update(){h(this.element,"show")&&_e(this)}dispose(){this.hide(!0),en(this),super.dispose()}}d(dn,{selector:".modal",init:t=>new dn(t),getInstance:Ge});const hn=`[${O}="offcanvas"]`,{on:un,off:fn}=T,pn={backdrop:!0,keyboard:!0,scroll:!1},gn=t=>m(t,"Offcanvas"),mn=b("show.bs.offcanvas"),bn=b("shown.bs.offcanvas"),vn=b("hide.bs.offcanvas"),wn=b("hidden.bs.offcanvas");function yn(t,e){const n=e?un:fn;t.triggers.forEach(t=>n(t,"click",Hn))}function Tn(t,e){const n=e?un:fn,o=i(t.element);n(o,"keydown",An),n(o,"click",kn)}function En(t){const{element:e,options:n}=t;n.scroll||(!function(t){const{element:e}=t,{clientHeight:n,scrollHeight:o}=G(e);Se(e,n!==o)}(t),He(e).style.overflow="hidden"),R(e,"offcanvas-toggling"),R(e,"show"),e.style.visibility="visible",s(e,()=>function(t){const{element:e,triggers:n}=t;u(e,"offcanvas-toggling"),xe(e,"aria-hidden"),I(e,"aria-modal","true"),I(e,"role","dialog"),n.length&&n.forEach(t=>I(t,"aria-expanded","true"));f(e,bn),Tn(t,!0),Gt(e)}(t))}function xn(t){const{element:e,options:n}=t,o=Oe(e);e.blur(),!o&&n.backdrop&&h(Re,"show")?(ze(),s(Re,()=>Pn(t))):Pn(t)}function Hn(t){const e=c(this,hn),n=e&&it(e),o=n&&gn(n);o&&(o.relatedTarget=e,o.toggle(),e&&"A"===e.tagName&&t.preventDefault())}function kn(t){const e=l(".offcanvas.show",this);if(!e)return;const n=l('[data-bs-dismiss="offcanvas"]',e),o=gn(e);if(!o)return;const{options:s,triggers:a}=o,{target:r}=t,d=c(r,hn),h=i(e).getSelection();h&&h.toString().length||!(!e.contains(r)&&s.backdrop&&(!d||d&&!a.includes(d))||n&&n.contains(r))||(o.relatedTarget=n&&n.contains(r)?n:null,o.hide()),d&&"A"===d.tagName&&t.preventDefault()}function An({code:t}){const e=l(".offcanvas.show",this);if(!e)return;const n=gn(e);n&&n.options.keyboard&&"Escape"===t&&(n.relatedTarget=null,n.hide())}function Pn(t){const{element:e,triggers:n}=t;if(I(e,"aria-hidden","true"),xe(e,"aria-modal"),xe(e,"role"),e.style.visibility="",n.length){n.forEach(t=>I(t,"aria-expanded","false"));const t=n.find(t=>je(t));t&&Gt(t)}Xe(e),f(e,wn),u(e,"offcanvas-toggling"),Oe(e)||Tn(t)}class Mn extends A{constructor(t,e){super(t,e);const{element:n}=this;this.triggers=[...K(hn)].filter(t=>it(t)===n),this.container=Me(n),this.relatedTarget=null,yn(this,!0)}get name(){return"Offcanvas"}get defaults(){return pn}toggle(){h(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:n,options:o,container:s,relatedTarget:i}=t;let a=0;if(h(n,"show"))return;if(mn.relatedTarget=i,bn.relatedTarget=i,f(n,mn),mn.defaultPrevented)return;const r=Oe(n);if(r&&r!==n){(gn(r)||m(r,"Modal")).hide()}o.backdrop?(r?We():Fe(s,!0),a=e(Re),h(Re,"show")||Be(),setTimeout(()=>En(t),a)):(En(t),r&&h(Re,"show")&&ze())}hide(t){const e=this,{element:n,relatedTarget:o}=e;h(n,"show")&&(vn.relatedTarget=o,wn.relatedTarget=o,f(n,vn),vn.defaultPrevented||(R(n,"offcanvas-toggling"),u(n,"show"),t?xn(e):s(n,()=>xn(e))))}dispose(){this.hide(!0),yn(this),super.dispose()}}d(Mn,{selector:".offcanvas",init:t=>new Mn(t),getInstance:gn});function Nn(t){const e="tooltip"===t;return``}const $n=t=>t&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(e=>t instanceof e);function Ln(t,e,n){const o=e instanceof HTMLElement,s=U(t,o&&function(t){const{width:e,height:n}=U(t),{offsetWidth:o,offsetHeight:s}=t;return Math.round(e)!==o||Math.round(n)!==s}(e)),i={x:0,y:0};if(o){const t=U(e,!0);i.x=t.x+e.clientLeft,i.y=t.y+e.clientTop}return{x:s.left+n.x-i.x,y:s.top+n.y-i.y,width:s.width,height:s.height}}var Dn={top:"top",bottom:"bottom",left:"start",right:"end"};function Sn(e,n){const o=/\b(top|bottom|start|end)+/,{element:s,tooltip:i,options:a,arrow:r,offsetParent:l}=e,c={...Dn};Ut(i,{top:"0px",left:"0px",right:""});const d="Popover"===e.name,h=i.offsetWidth,u=i.offsetHeight,f=J(s);f&&(c.left="end",c.right="start");const p=G(s),g=p.clientWidth,m=p.clientHeight,{container:b}=a;let{placement:v}=a;const{left:w,right:y,top:T}=U(b,!0),E=b.clientWidth,x=Math.abs(E-b.offsetWidth),H=t(b,"position"),k="fixed"===H,A="static"===H,P="sticky"===H&&T===parseFloat(t(b,"top")),M=f&&k?x:0,N=k?E+w+(f?x:0):E+w+(g-y)-1,{width:$,height:L,left:D,right:S,top:C}=U(s,!0),I=function(t){const e="scrollX"in t;return{x:e?t.scrollX:t.scrollLeft,y:e?t.scrollY:t.scrollTop}}(l),{x:R,y:O}=Ln(s,l,I);let W,F,B,z,X,j;Ut(r,{top:"",left:"",right:""});const Y=r.offsetWidth||0,V=r.offsetHeight||0,q=Y/2;let Z=C-u-V<0,K=C+u+L+V>=m,Q=D-h-Y=N;const tt=["left","right"],et=["top","bottom"];if(Z=tt.includes(v)?C+L/2-u/2-V<0:Z,K=tt.includes(v)?C+u/2+L/2+V>=m:K,Q=et.includes(v)?D+$/2-h/2=N:_,v=tt.includes(v)&&Q&&_?"top":v,v="top"===v&&Z?"bottom":v,v="bottom"===v&&K?"top":v,v="left"===v&&Q?"right":v,v="right"===v&&_?"left":v,i.className.includes(v)||(i.className=i.className.replace(o,c[v])),tt.includes(v))F="left"===v?R-h-(d?Y:0):R+$+(d?Y:0),Z?(W=O,W+=P?-T-I.y:0,z=L/2-Y):K?(W=O-u+L,W+=P?-T-I.y:0,z=u-L/2-Y):(W=O-u/2+L/2,W+=P?-T-I.y:0,z=u/2-V/2);else if(et.includes(v))if(n&&$n(s)){let t=0,e=0;A?(t=n.pageX,e=n.pageY):(t=n.clientX-w+(k?I.x:0),e=n.clientY-T+(k?I.y:0)),t-=f&&k&&x?x:0,W="top"===v?e-u-Y:e+Y,n.clientX-h/2N?(F="auto",B=0,j=N-t-q,j-=k?w+(f?x:0):0):(F=t-h/2,X=h/2-q)}else W="top"===v?O-u-(d?V:0):O+L+(d?V:0),Q?(F=0,X=R+$/2-q):_?(F="auto",B=0,j=$/2+N-S-q):(F=R-h/2+$/2,X=h/2-q);Ut(i,{top:W+"px",left:"auto"===F?F:F+"px",right:void 0!==B?B+"px":""}),r instanceof HTMLElement&&(void 0!==z&&(r.style.top=z+"px"),void 0!==X?r.style.left=X+"px":void 0!==j&&(r.style.right=j+"px"))}const Cn={template:Nn("tooltip"),title:null,customClass:null,trigger:"hover focus",placement:"top",sanitizeFn:null,animation:!0,delay:200,container:null},In="focusin",Rn="focusout",{userAgentData:On}=navigator,Wn=On,{userAgent:Fn}=navigator,Bn=Fn,zn=/(iPhone|iPod|iPad)/,Xn=Wn?Wn.brands.some(t=>zn.test(t.brand)):zn.test(Bn);let jn=1;const Yn=new Map;function Vn(t,e,n){if("string"!=typeof e||e.length)if("string"==typeof e){let o=e.trim();"function"==typeof n&&(o=n(o));const s=(new DOMParser).parseFromString(o,"text/html"),{body:i}=s,a=i.children.length?"innerHTML":"innerText";t[a]=i[a]}else e instanceof HTMLElement&&t.append(e)}function qn(t,e){return t instanceof HTMLElement&&e.contains(t)}const Un=`[${O}="tooltip"],[data-tip="tooltip"]`,{on:Gn,off:Zn}=T;let Jn=t=>m(t,"Tooltip");function Kn(t){const{element:e}=t;eo(t),e.hasAttribute("data-original-title")&&"tooltip"===t.name&&oo(t)}function Qn(t,e){const n=e?Gn:Zn,{element:o}=t;n(i(o),"touchstart",so,st),$n(o)||[Xt,jt].forEach(e=>{n(q(o),e,t.update,st)})}function _n(t){const{element:e}=t,n=b("shown.bs."+k(t.name));Qn(t,!0),f(e,n),nt(e,"in")}function to(t){const{element:e}=t,n=b("hidden.bs."+k(t.name));Qn(t),function(t){const{element:e,tooltip:n}=t;xe(e,"aria-describedby"),n.remove()}(t),f(e,n),nt(e,"out")}function eo(t,e){const n=e?Gn:Zn,{element:o,options:s,btn:a}=t,{trigger:r,dismissible:l}=s;if(r.includes("manual"))return;t.enabled=!!e;const c=r.split(" "),d=$n(o);d&&n(o,"mousemove",t.update,st),c.forEach(e=>{d||"hover"===e?(n(o,"mousedown",t.show),n(o,Y,t.show),l&&a?n(a,"click",t.hide):(n(o,V,t.hide),n(i(o),"touchstart",so,st))):"click"===e?n(o,e,l?t.show:t.toggle):"focus"===e&&(n(o,In,t.show),l||n(o,Rn,t.hide),Xn&&n(o,"click",()=>Gt(o)))})}function no(t,e){const n=e?Gn:Zn,{element:o,options:s,offsetParent:i}=t,{container:a}=s,{offsetHeight:r,scrollHeight:l}=a,d=c(o,".modal"),h=c(o,".offcanvas");if(!$n(o)){const e=q(o),s=r!==l||i!==e?a:e;n(e,jt,t.update,st),n(s,Xt,t.update,st)}d&&Gn(d,"hide.bs.modal",t.hide),h&&Gn(h,"hide.bs.offcanvas",t.hide)}function oo(t,e){const n=["data-original-title","title"],{element:o}=t;I(o,n[e?0:1],e||E(o,n[0])),xe(o,n[e?1:0])}function so({target:t}){const{tooltip:e,element:n}=this;e.contains(t)||t===n||n.contains(t)||this.hide()}class io extends A{constructor(e,n){super(e,n);const o=this,{element:s}=o,a="Tooltip"===o.name,r=a?"tooltip":"popover",c=a?"Tooltip":"Popover";Jn=t=>m(t,c),o.tooltip={},a||(o.btn=null),o.arrow={},o.offsetParent={},o.enabled=!0,o.id=`${r}-${function(t,e){jn+=1;let n=Yn.get(t),o=jn;if(e&&e.length)if(n){const t=n.get(e);Number.isNaN(t)?n.set(e,o):o=t}else Yn.set(t,new Map),n=Yn.get(t),n.set(e,o);else Number.isNaN(n)?Yn.set(t,o):o=n;return o}(s,r)}`;const{options:d}=o;if(!d.title&&a||!a&&!d.content)return;const u=l(d.container),f=Me(s);o.options.container=!u||u&&["static","relative"].includes(t(u,"position"))?f:u||He(s),Cn.title=null,so.bind(o),o.update=o.update.bind(o),o.show=o.show.bind(o),o.hide=o.hide.bind(o),o.toggle=o.toggle.bind(o),s.hasAttribute("title")&&a&&oo(o,d.title),function(t){const{id:e,element:n,options:o}=t,{animation:s,customClass:a,sanitizeFn:r,placement:c,dismissible:d}=o;let{title:u,content:f}=o;const p="Tooltip"===t.name,g=p?"tooltip":"popover",{template:m,btnClose:b}=o,v={...Dn};J(n)&&(v.left="end",v.right="start");const w=`bs-${g}-${v[c]}`;let y;if([Element,HTMLElement].some(t=>m instanceof t))y=m;else{const t=i(n).createElement("div");Vn(t,m,r),y=t.firstElementChild}t.tooltip=y&&y.cloneNode(!0);const{tooltip:T}=t;I(T,"id",e),I(T,"role","tooltip");const E=p?"tooltip-inner":"popover-body",x=p?null:l(".popover-header",T),H=l("."+E,T);t.arrow=l(`.${g}-arrow`,T),d&&(u?u instanceof HTMLElement?Vn(u,b,r):u+=b:(x&&x.remove(),f instanceof HTMLElement?Vn(f,b,r):f+=b)),p?u&&H&&Vn(H,u,r):(u&&x&&Vn(x,u,r),f&&H&&Vn(H,f,r),t.btn=l(".btn-close",T)),h(T,g)||R(T,g),s&&!h(T,"fade")&&R(T,"fade"),a&&!h(T,a)&&R(T,a),h(T,w)||R(T,w)}(o),eo(o,!0)}get name(){return"Tooltip"}get defaults(){return Cn}show(t){const e=this,{options:n,tooltip:o,element:i,id:a}=e,{container:r,animation:l}=n,c=et(i,"out");nt(i,"out"),!o||c||qn(o,r)||tt(i,()=>{const n=b("show.bs."+k(e.name));f(i,n),n.defaultPrevented||(r.append(o),I(i,"aria-describedby","#"+a),e.offsetParent=Me(o,!0),e.update(t),no(e,!0),h(o,"show")||R(o,"show"),l?s(o,()=>_n(e)):_n(e))},17,"in")}hide(){const t=this,{options:e,tooltip:n,element:o}=t,{container:i,animation:a,delay:r}=e;nt(o,"in"),n&&qn(n,i)&&tt(o,()=>{const e=b("hide.bs."+k(t.name));f(o,e),e.defaultPrevented||(u(n,"show"),no(t),a?s(n,()=>to(t)):to(t))},r+17,"out")}update(t){Sn(this,t)}toggle(t){const{tooltip:e,options:n}=this;qn(e,n.container)?this.hide():this.show(t)}enable(){const t=this,{enabled:e}=t;e||(eo(t,!0),t.enabled=!e)}disable(){const t=this,{element:n,tooltip:o,options:s,enabled:i}=t,{animation:a,container:r,delay:l}=s;i&&(qn(o,r)&&a?(t.hide(),tt(n,()=>{eo(t),nt(n,"tooltip")},e(o)+l+17,"tooltip")):eo(t),t.enabled=!i)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{tooltip:e,options:n}=t;n.animation&&qn(e,n.container)?(n.delay=0,t.hide(),s(e,()=>Kn(t))):Kn(t),super.dispose()}}d(io,{selector:Un,init:t=>new io(t),getInstance:Jn,styleTip:Sn});const ao=`[${O}="popover"],[data-tip="popover"]`,ro={...Cn,template:Nn("popover"),btnClose:'',dismissible:!1,content:null};class lo extends io{constructor(t,e){super(t,e)}get name(){return"Popover"}get defaults(){return ro}show(){super.show();const{options:t,btn:e}=this;t.dismissible&&e&&setTimeout(()=>Gt(e),17)}}function co(t,e){return(e&&a.some(t=>e instanceof t)?e:i()).getElementsByTagName(t)}d(lo,{selector:ao,init:t=>new lo(t),getInstance:t=>m(t,"Popover"),styleTip:Sn});const{on:ho,off:uo}=T,fo={offset:10,target:null},po=b("activate.bs.scrollspy");function go(t){const{target:e,scrollTarget:n,options:o,itemsLength:s,scrollHeight:a,element:r}=t,{offset:c}=o,d=n instanceof Window,h=e&&co("A",e),u=n&&function(t){return t instanceof HTMLElement?t.scrollHeight:G(t).scrollHeight}(n);if(t.scrollTop=d?n.scrollY:n.scrollTop,h&&(s!==h.length||u!==a)){let e,n,o;t.items=[],t.offsets=[],t.scrollHeight=u,t.maxScroll=t.scrollHeight-function({element:t,scrollTarget:e}){return e instanceof Window?e.innerHeight:U(t).height}(t),[...h].forEach(s=>{e=E(s,"href"),n=e&&"#"===e.charAt(0)&&"#"!==e.slice(-1)&&l(e,i(r)),n&&(t.items.push(s),o=U(n),t.offsets.push((d?o.top+t.scrollTop:n.offsetTop)-c))}),t.itemsLength=t.items.length}}function mo(t){[...co("A",t)].forEach(t=>{h(t,"active")&&u(t,"active")})}function bo(t,e){const{target:n,element:o}=t;mo(n),t.activeItem=e,R(e,"active");const s=[];let i=e;for(;i!==He(o);)i=i.parentElement,(h(i,"nav")||h(i,"dropdown-menu"))&&s.push(i);s.forEach(t=>{const e=t.previousElementSibling;e&&!h(e,"active")&&R(e,"active")}),po.relatedTarget=e,f(o,po)}function vo(t,e){(e?ho:uo)(t.scrollTarget,Xt,t.refresh,st)}class wo extends A{constructor(t,e){super(t,e);const{element:n,options:o}=this;if(this.target=l(o.target,i(n)),!this.target)return;const s=q(n);this.scrollTarget=n.clientHeight=o){const e=i[s-1];return void(a!==e&&bo(t,e))}const{offsets:r}=t;if(a&&n0)return t.activeItem=null,void mo(e);i.forEach((e,o)=>{a!==e&&n>=r[o]&&(void 0===r[o+1]||nnew wo(t),getInstance:t=>m(t,"ScrollSpy")});const yo=`[${O}="tab"]`,{on:To,off:Eo}=T,xo=t=>m(t,"Tab"),Ho=b("show.bs.tab"),ko=b("shown.bs.tab"),Ao=b("hide.bs.tab"),Po=b("hidden.bs.tab"),Mo=new Map;function No(t){const{tabContent:e,nav:n}=t;e&&(e.style.height="",u(e,"collapsing")),n&&nt(n)}function $o(t){const{element:e,tabContent:n,nav:o}=t,{currentHeight:i,nextHeight:a}=Mo.get(e),{tab:r}=o&&Mo.get(o);n?i===a?No(t):setTimeout(()=>{n.style.height=a+"px",ot(n),s(n,()=>No(t))},50):o&&nt(o),ko.relatedTarget=r,f(e,ko)}function Lo(t){const{element:e,content:n,tabContent:o,nav:i}=t,{tab:a,content:r}=i&&Mo.get(i);let l=0;if(o&&([r,n].forEach(t=>R(t,"overflow-hidden")),l=r.scrollHeight),Ho.relatedTarget=a,Po.relatedTarget=e,f(e,Ho),!Ho.defaultPrevented){if(R(n,"active"),u(r,"active"),o){const t=n.scrollHeight;Mo.set(e,{currentHeight:l,nextHeight:t}),R(o,"collapsing"),o.style.height=l+"px",ot(o),[r,n].forEach(t=>u(t,"overflow-hidden"))}n&&h(n,"fade")?setTimeout(()=>{R(n,"show"),s(n,()=>{$o(t)})},17):$o(t),f(a,Po)}}function Do(t,e){(e?To:Eo)(t.element,"click",So)}function So(t){const e=xo(this);e&&(t.preventDefault(),e.show())}class Co extends A{constructor(t){super(t);const{element:e}=this,n=it(e);if(!n)return;const o=c(e,".nav"),s=c(n,".tab-content");this.nav=o,this.content=n,this.tabContent=s,this.dropdown=o&&l(`.${Zt[0]}-toggle`,o),Do(this,!0)}get name(){return"Tab"}show(){const t=this,{element:e,nav:n,dropdown:o}=t;if(!(n&&et(n)||h(e,"active"))){const{tab:i,content:a}=function(t){const{nav:e}=t,n=Q("active",e);let o;return 1!==n.length||Zt.some(t=>h(n[0].parentElement,t))?n.length>1&&(o=n[n.length-1]):[o]=n,{tab:o,content:o?it(o):null}}(t);if(n&&Mo.set(n,{tab:i,content:a}),Ao.relatedTarget=e,f(i,Ao),Ao.defaultPrevented)return;n&&tt(n,()=>{},17),u(i,"active"),I(i,"aria-selected","false"),R(e,"active"),I(e,"aria-selected","true"),o&&(h(e.parentNode,"dropdown-menu")?h(o,"active")||R(o,"active"):h(o,"active")&&u(o,"active")),h(a,"fade")?(u(a,"show"),s(a,()=>Lo(t))):Lo(t)}}dispose(){Do(this),super.dispose()}}d(Co,{selector:yo,init:t=>new Co(t),getInstance:xo});const{on:Io,off:Ro}=T,Oo={animation:!0,autohide:!0,delay:5e3},Wo=t=>m(t,"Toast"),Fo=b("show.bs.toast"),Bo=b("shown.bs.toast"),zo=b("hide.bs.toast"),Xo=b("hidden.bs.toast");function jo(t){const{element:e,options:n}=t;u(e,"showing"),nt(e,"showing"),f(e,Bo),n.autohide&&tt(e,()=>t.hide(),n.delay,"toast")}function Yo(t){const{element:e}=t;u(e,"showing"),u(e,"show"),R(e,"hide"),nt(e,"toast"),f(e,Xo)}function Vo(t,e){const n=e?Io:Ro,{element:o,dismiss:s,options:i}=t;s&&n(s,"click",t.hide),i.autohide&&[In,Rn,Y,V].forEach(t=>n(o,t,qo))}function qo(t){const e=this,n=Wo(e),{type:o,relatedTarget:s}=t;n&&e!==s&&!e.contains(s)&&([Y,In].includes(o)?nt(e,"toast"):tt(e,()=>n.hide(),n.options.delay,"toast"))}class Uo extends A{constructor(t,e){super(t,e);const{element:n,options:o}=this;o.animation&&!h(n,"fade")?R(n,"fade"):!o.animation&&h(n,"fade")&&u(n,"fade"),this.dismiss=l('[data-bs-dismiss="toast"]',n),this.show=this.show.bind(this),this.hide=this.hide.bind(this),Vo(this,!0)}get name(){return"Toast"}get defaults(){return Oo}show(){const t=this,{element:e}=t;if(e&&!h(e,"show")){if(f(e,Fo),Fo.defaultPrevented)return;!function(t){const{element:e,options:n}=t;tt(e,()=>{u(e,"hide"),ot(e),R(e,"show"),R(e,"showing"),n.animation?s(e,()=>jo(t)):jo(t)},17,"showing")}(t)}}hide(){const t=this,{element:e}=t;if(e&&h(e,"show")){if(f(e,zo),zo.defaultPrevented)return;!function(t){const{element:e,options:n}=t;R(e,"showing"),n.animation?(ot(e),s(e,()=>Yo(t))):Yo(t)}(t)}}dispose(){const{element:t}=this;h(t,"show")&&u(t,"show"),function(t){nt(t.element,"toast"),Vo(t)}(this),super.dispose()}}d(Uo,{selector:".toast",init:t=>new Uo(t),getInstance:Wo});const Go={Alert:C,Button:j,Carousel:Mt,Collapse:zt,Dropdown:Ee,Modal:dn,Offcanvas:Mn,Popover:lo,ScrollSpy:wo,Tab:Co,Toast:Uo,Tooltip:io};function Zo(t){const e=[...co("*",t&&a.some(e=>t instanceof e)?t:void 0)];H(Go).forEach(t=>{const{init:n,selector:o}=Go[t];var s,i;s=n,i=e.filter(t=>function(t,e){return t.matches(e)}(t,o)),[...i].forEach(t=>s(t))})}document.body?Zo():function(t,e,s,i){const a=n=>{n.target===t&&(s.apply(t,[n]),o(t,e,a,i))};n(t,e,a,i)}(document,"DOMContentLoaded",()=>Zo());return{Alert:C,Button:j,Carousel:Mt,Collapse:zt,Dropdown:Ee,Modal:dn,Offcanvas:Mn,Popover:lo,ScrollSpy:wo,Tab:Co,Toast:Uo,Tooltip:io,initCallback:Zo,removeDataAPI:function(t){const e=t&&a.some(e=>t instanceof e)?t:void 0;H(Go).forEach(t=>{!function(t,e){const n=g.getAllFor(t);n&&[...n].forEach(t=>{const[n,o]=t;e&&e.contains(n)&&o.dispose()})}(t,e)})},Version:"4.1.0alpha4"}})); +// Native JavaScript for Bootstrap v4.1.0alpha5 | 2022 © dnp_theme | MIT-License +!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).BSN=e()}(this,(function(){"use strict";const t={};function e(e){const n=this,{type:s}=e;(t[s]?[...t[s]]:[]).forEach(t=>{const[i,a]=t;[...a].forEach(t=>{if(i===n){const[n,a]=t;n.apply(i,[e]),a&&a.once&&o(i,s,n,a)}})})}const n=(n,o,s,i)=>{t[o]||(t[o]=new Map);const a=t[o];a.has(n)||a.set(n,new Map);const r=a.get(n),{size:l}=r;r&&r.set(s,i),l||n.addEventListener(o,e,i)},o=(n,o,s,i)=>{const a=t[o],r=a&&a.get(n),l=r&&r.get(s),{options:c}=void 0!==l?l:{options:i};r&&r.has(s)&&r.delete(s),!a||r&&r.size||a.delete(n),a&&a.size||delete t[o],r&&r.size||n.removeEventListener(o,e,c)},s={on:n,off:o,globalListener:e,registry:t};function i(t,e){const n=getComputedStyle(t);return e in n?n[e]:""}function a(t){const e=i(t,"transitionProperty"),n=i(t,"transitionDuration"),o=n.includes("ms")?1:1e3,s=e&&"none"!==e?parseFloat(n)*o:0;return Number.isNaN(s)?0:s}function r(t,e){let n=0;const o=new Event("transitionend"),s=a(t),r=function(t){const e=i(t,"transitionProperty"),n=i(t,"transitionDelay"),o=n.includes("ms")?1:1e3,s=e&&"none"!==e?parseFloat(n)*o:0;return Number.isNaN(s)?0:s}(t);if(s){const i=o=>{o.target===t&&(e.apply(t,[o]),t.removeEventListener("transitionend",i),n=1)};t.addEventListener("transitionend",i),setTimeout(()=>{n||t.dispatchEvent(o)},s+r+17)}else e.apply(t,[o])}function l(t){return t instanceof HTMLElement?t.ownerDocument:t instanceof Window?t.document:window.document}const c=[Document,Element,HTMLElement],d=[Element,HTMLElement];function h(t,e){const n=c.some(t=>e instanceof t)?e:l();return d.some(e=>t instanceof e)?t:n.querySelector(t)}function u(t,e){return t?t.closest(e)||u(t.getRootNode().host,e):null}const f=(t,e)=>Object.assign(t,e);function p(t,e){return t.classList.contains(e)}function g(t,e){t.classList.remove(e)}const m=(t,e)=>t.dispatchEvent(e),b=new Map,v={set:(t,e,n)=>{const o=h(t);if(!o)return;b.has(e)||b.set(e,new Map);b.get(e).set(o,n)},getAllFor:t=>b.get(t)||null,get:(t,e)=>{const n=h(t),o=v.getAllFor(e);return n&&o&&o.get(n)||null},remove:(t,e)=>{const n=h(t),o=b.get(e);o&&n&&(o.delete(n),0===o.size&&b.delete(e))}},w=(t,e)=>v.get(t,e);function y(t,e){const n=new CustomEvent(t,{cancelable:!0,bubbles:!0});return e instanceof Object&&f(n,e),n}const T=(t,e)=>t.getAttribute(e);function E(t){return"true"===t||"false"!==t&&(Number.isNaN(+t)?""===t||"null"===t?null:t:+t)}const x=t=>Object.keys(t),H=t=>t.toLowerCase();class k{constructor(t,e){const n=this,o=h(t);if(!o)throw Error(`${n.name} Error: "${t}" is not a valid selector.`);n.options={};const s=v.get(o,n.name);s&&s.dispose(),n.element=o,n.defaults&&Object.keys(n.defaults).length&&(n.options=function(t,e,n,o){const s={...t.dataset},i={},a={};return x(s).forEach(t=>{const e=o&&t.includes(o)?t.replace(o,"").replace(/[A-Z]/,t=>H(t)):t;a[e]=E(s[t])}),x(n).forEach(t=>{n[t]=E(n[t])}),x(e).forEach(o=>{i[o]=o in n?n[o]:o in a?a[o]:"title"===o?T(t,"title"):e[o]}),i}(o,n.defaults,e||{},"bs")),v.set(o,n.name,n)}get version(){return"4.1.0alpha5"}get name(){return this.constructor.name}get defaults(){return this.constructor.defaults}dispose(){const t=this;v.remove(t.element,t.name),x(t).forEach(e=>{t[e]=null})}}const A=t=>w(t,"Alert"),P=y("close.bs.alert"),M=y("closed.bs.alert");function N(t){const{element:e}=t;$(t),m(e,M),t.dispose(),e.remove()}function $(t,e){const s=e?n:o,{dismiss:i}=t;i&&s(i,"click",t.close)}class L extends k{constructor(t){super(t);const{element:e}=this;this.dismiss=h('[data-bs-dismiss="alert"]',e),$(this,!0)}get name(){return"Alert"}close(t){const e=t?A(u(this,".alert")):this;if(!e)return;const{element:n}=e;if(p(n,"show")){if(m(n,P),P.defaultPrevented)return;g(n,"show"),p(n,"fade")?r(n,()=>N(e)):N(e)}}dispose(){$(this),super.dispose()}}f(L,{selector:".alert",init:t=>new L(t),getInstance:A});const D=(t,e,n)=>t.setAttribute(e,n);function S(t,e){t.classList.add(e)}const C="data-bs-toggle",I=`[${C}="button"]`,R=t=>w(t,"Button");function O(t,e){(e?n:o)(t.element,"click",t.toggle)}class W extends k{constructor(t){super(t);const{element:e}=this;this.isActive=p(e,"active"),D(e,"aria-pressed",""+!!this.isActive),O(this,!0)}get name(){return"Button"}toggle(t){t&&t.preventDefault();const e=t?R(this):this;if(!e)return;const{element:n}=e;if(p(n,"disabled"))return;e.isActive=p(n,"active");const{isActive:o}=e;(o?g:S)(n,"active"),D(n,"aria-pressed",o?"false":"true")}dispose(){O(this),super.dispose()}}f(W,{selector:I,init:t=>new W(t),getInstance:R});const F="mouseenter",B="mouseleave";function z(t){if(null==t)return window;if(!(t instanceof Window)){const{ownerDocument:e}=t;return e&&e.defaultView||window}return t}function X(t,e){const{width:n,height:o,top:s,right:i,bottom:a,left:r}=t.getBoundingClientRect();let l=1,c=1;if(e&&t instanceof HTMLElement){const{offsetWidth:e,offsetHeight:s}=t;l=e>0&&Math.round(n)/e||1,c=s>0&&Math.round(o)/s||1}return{width:n/l,height:o/c,top:s/c,right:i/l,bottom:a/c,left:r/l,x:r/l,y:s/c}}function j(t){return l(t).documentElement}const Y=t=>{const{top:e,bottom:n}=X(t),{clientHeight:o}=j(t);return e<=o&&n>=0},V=t=>"rtl"===j(t).dir;function q(t,e){return(e&&c.some(t=>e instanceof t)?e:l()).querySelectorAll(t)}function U(t,e){return(e&&c.some(t=>e instanceof t)?e:l()).getElementsByClassName(t)}const G=new Map,Z=(t,e,n,o)=>{const s=h(t);if(s)if(o&&o.length){G.has(s)||G.set(s,new Map);G.get(s).set(o,setTimeout(e,n))}else G.set(s,setTimeout(e,n))},J=(t,e)=>{const n=h(t);if(!n)return null;const o=G.get(n);return e&&e.length&&o&&o.get?o.get(e)||null:o||null},K=(t,e)=>{const n=h(t);if(n)if(e&&e.length){const t=G.get(n);t&&t.get&&(clearTimeout(t.get(e)),t.delete(e),0===t.size&&G.delete(n))}else clearTimeout(G.get(n)),G.delete(n)},Q=t=>t.offsetHeight,_={passive:!0};function tt(t){const e=["data-bs-target","data-bs-parent","data-bs-container","href"],n=l(t);return e.map(e=>{const o=T(t,e);return o?"data-bs-parent"===e?u(t,o):h(o,n):null}).filter(t=>t)[0]}const et="carousel-item",nt={pause:"hover",keyboard:!1,touch:!0,interval:5e3},ot=t=>w(t,"Carousel");let st=0,it=0,at=0;const rt=y("slide.bs.carousel"),lt=y("slid.bs.carousel");function ct(){const t=this,e=ot(t);!e||e.isPaused||J(t,"paused")||S(t,"paused")}function dt(){const t=ot(this);t&&t.isPaused&&!J(this,"paused")&&t.cycle()}function ht(t){t.preventDefault();const e=u(this,'[data-bs-ride="carousel"]')||tt(this);if(!e)return;const n=ot(e);if(!n||n.isAnimating)return;const o=+T(this,"data-bs-slide-to");!this||p(this,"active")||Number.isNaN(o)||n.to(o)}function ut(t){t.preventDefault();const e=u(this,'[data-bs-ride="carousel"]')||tt(this),n=e&&ot(e);if(!n||n.isAnimating)return;const o=T(this,"data-bs-slide");"next"===o?n.next():"prev"===o&&n.prev()}function ft({code:t}){const[e]=[...q('[data-bs-ride="carousel"]')].filter(t=>Y(t)),n=ot(e);if(!n)return;const o=V(),s=o?"ArrowLeft":"ArrowRight";t===(o?"ArrowRight":"ArrowLeft")?n.prev():t===s&&n.next()}function pt(t){const e=ot(this);e&&!e.isTouch&&(st=t.changedTouches[0].pageX,this.contains(t.target)&&(e.isTouch=!0,vt(e,!0)))}function gt(t){const{changedTouches:e,type:n}=t,o=ot(this);o&&o.isTouch&&(it=e[0].pageX,"touchmove"===n&&e.length>1&&t.preventDefault())}function mt(t){const e=this,n=ot(e);if(n&&n.isTouch&&(at=it||t.changedTouches[0].pageX,n.isTouch)){if((!e.contains(t.target)||!e.contains(t.relatedTarget))&&Math.abs(st-at)<75)return;itst&&(n.index-=1),n.isTouch=!1,n.to(n.index),vt(n)}}function bt(t,e){const{indicators:n}=t;[...n].forEach(t=>g(t,"active")),t.indicators[e]&&S(n[e],"active")}function vt(t,e){const{element:s}=t,i=e?n:o;i(s,"touchmove",gt,_),i(s,"touchend",mt,_)}function wt(t,e){const{element:s,options:i,slides:a,controls:r,indicators:l}=t,{touch:c,pause:d,interval:h,keyboard:u}=i,f=e?n:o;d&&h&&(f(s,F,ct),f(s,B,dt),f(s,"touchstart",ct,_),f(s,"touchend",dt,_)),c&&a.length>1&&f(s,"touchstart",pt,_),r.length&&r.forEach(t=>{t&&f(t,"click",ut)}),l.length&&l.forEach(t=>{f(t,"click",ht)}),u&&f(z(s),"keydown",ft)}function yt(t){const{slides:e,element:n}=t,o=h(`.${et}.active`,n);return[...e].indexOf(o)}class Tt extends k{constructor(t,e){super(t,e);const n=this;n.direction=V()?"right":"left",n.index=0,n.isTouch=!1;const{element:o}=n;n.slides=U(et,o);const{slides:s}=n;if(s.length<2)return;n.controls=[...q("[data-bs-slide]",o),...q(`[data-bs-slide][data-bs-target="#${o.id}"]`)],n.indicator=h(".carousel-indicators",o),n.indicators=[...n.indicator?q("[data-bs-slide-to]",n.indicator):[],...q(`[data-bs-slide-to][data-bs-target="#${o.id}"]`)];const{options:i}=n;n.options.interval=!0===i.interval?nt.interval:i.interval,yt(n)<0&&(s.length&&S(s[0],"active"),n.indicators.length&&bt(n,0)),wt(n,!0),i.interval&&n.cycle()}get name(){return"Carousel"}get defaults(){return nt}get isPaused(){return p(this.element,"paused")}get isAnimating(){return null!==h(`.${et}-next,.${et}-prev`,this.element)}cycle(){const t=this,{element:e,options:n,isPaused:o}=t;K(e,"carousel"),o&&(K(e,"paused"),g(e,"paused")),Z(e,()=>{!t.isPaused&&Y(e)&&(t.index+=1,t.to(t.index))},n.interval,"carousel")}pause(){const{element:t,options:e}=this;!this.isPaused&&e.interval&&(S(t,"paused"),Z(t,()=>{},1,"paused"))}next(){const t=this;t.isAnimating||(t.index+=1,t.to(t.index))}prev(){const t=this;t.isAnimating||(t.index-=1,t.to(t.index))}to(t){const e=this,{element:n,slides:o,options:s}=e,i=yt(e),c=V();let d=t;if(e.isAnimating||i===d)return;id||i===o.length-1&&0===d)&&(e.direction=c?"left":"right");const{direction:h}=e;d<0?d=o.length-1:d>=o.length&&(d=0);const u="left"===h?"next":"prev",b="left"===h?"start":"end",v={relatedTarget:o[d],from:i,to:d,direction:h};f(rt,v),f(lt,v),m(n,rt),rt.defaultPrevented||(e.index=d,bt(e,d),a(o[d])&&p(n,"slide")?Z(n,()=>{S(o[d],`${et}-${u}`),Q(o[d]),S(o[d],`${et}-${b}`),S(o[i],`${et}-${b}`),r(o[d],()=>function(t){const{index:e,direction:n,element:o,slides:s,options:i}=t;if(t.isAnimating&&ot(o)){const a=yt(t),r="left"===n?"next":"prev",c="left"===n?"start":"end";S(s[e],"active"),g(s[e],`${et}-${r}`),g(s[e],`${et}-${c}`),g(s[a],"active"),g(s[a],`${et}-${c}`),m(o,lt),K(o,"data-bs-slide"),l(o).hidden||!i.interval||t.isPaused||t.cycle()}}(e))},17,"data-bs-slide"):(S(o[d],"active"),g(o[i],"active"),Z(n,()=>{K(n,"data-bs-slide"),n&&s.interval&&!e.isPaused&&e.cycle(),m(n,lt)},17,"data-bs-slide")))}dispose(){const t=this,{slides:e}=t,n=["start","end","prev","next"];[...e].forEach((e,o)=>{p(e,"active")&&bt(t,o),n.forEach(t=>g(e,`${et}-${t}`))}),wt(t),super.dispose()}}f(Tt,{selector:'[data-bs-ride="carousel"]',init:t=>new Tt(t),getInstance:ot});const Et=`[${C}="collapse"]`,xt={parent:null},Ht=t=>w(t,"Collapse"),kt=y("show.bs.collapse"),At=y("shown.bs.collapse"),Pt=y("hide.bs.collapse"),Mt=y("hidden.bs.collapse");function Nt(t){const{element:e,parent:n,triggers:o}=t;m(e,Pt),Pt.defaultPrevented||(Z(e,()=>{},17),n&&Z(n,()=>{},17),e.style.height=e.scrollHeight+"px",g(e,"collapse"),g(e,"show"),S(e,"collapsing"),Q(e),e.style.height="0px",r(e,()=>{K(e),n&&K(n),o.forEach(t=>D(t,"aria-expanded","false")),g(e,"collapsing"),S(e,"collapse"),e.style.height="",m(e,Mt)}))}function $t(t,e){const s=e?n:o,{triggers:i}=t;i.length&&i.forEach(t=>s(t,"click",Lt))}function Lt(t){const{target:e}=t,n=e&&u(e,Et),o=n&&tt(n),s=o&&Ht(o);s&&s.toggle(),n&&"A"===n.tagName&&t.preventDefault()}class Dt extends k{constructor(t,e){super(t,e);const{element:n,options:o}=this;this.triggers=[...q(Et)].filter(t=>tt(t)===n),this.parent=h(o.parent),$t(this,!0)}get name(){return"Collapse"}get defaults(){return xt}toggle(){p(this.element,"show")?this.hide():this.show()}hide(){const{triggers:t,element:e}=this;J(e)||(Nt(this),t.length&&t.forEach(t=>S(t,"collapsed")))}show(){const t=this,{element:e,parent:n,triggers:o}=t;let s,i;n&&(s=[...q(".collapse.show",n)].find(t=>Ht(t)),i=s&&Ht(s)),n&&(!n||J(n))||J(e)||(i&&s!==e&&(Nt(i),i.triggers.forEach(t=>{S(t,"collapsed")})),function(t){const{element:e,parent:n,triggers:o}=t;m(e,kt),kt.defaultPrevented||(Z(e,()=>{},17),n&&Z(n,()=>{},17),S(e,"collapsing"),g(e,"collapse"),e.style.height=e.scrollHeight+"px",r(e,()=>{K(e),n&&K(n),o.forEach(t=>D(t,"aria-expanded","true")),g(e,"collapsing"),S(e,"collapse"),S(e,"show"),e.style.height="",m(e,At)}))}(t),o.length&&o.forEach(t=>g(t,"collapsed")))}dispose(){$t(this),super.dispose()}}f(Dt,{selector:".collapse",init:t=>new Dt(t),getInstance:Ht});const St="scroll",Ct="resize",It="ArrowUp",Rt="ArrowDown",Ot=(t,e)=>t.hasAttribute(e),Wt=(t,e)=>{f(t.style,e)},Ft=t=>t.focus(),Bt=["dropdown","dropup","dropstart","dropend"];function zt(t){const e=u(t,"A");return t&&(Ot(t,"href")&&"#"===t.href.slice(-1)||e&&Ot(e,"href")&&"#"===e.href.slice(-1))}const[Xt,jt,Yt,Vt]=Bt,qt=`[${C}="${Xt}"]`,Ut=t=>w(t,"Dropdown"),Gt=[Xt,jt],Zt=[Yt,Vt],Jt=["A","BUTTON"],Kt={offset:5,display:"dynamic"},Qt=y("show.bs."+Xt),_t=y("shown.bs."+Xt),te=y("hide.bs."+Xt),ee=y("hidden.bs."+Xt);function ne(t){const{element:e,menu:n,parentElement:o,options:s}=t,{offset:a}=s;if("static"===i(n,"position"))return;const r=V(e),l=p(o,"dropdown-menu-end");["margin","top","bottom","left","right"].forEach(t=>{n.style[t]=""});let c=Bt.find(t=>p(o,t))||Xt,d={dropdown:[a,0,0],dropup:[0,0,a],dropstart:r?[-1,0,0,a]:[-1,a,0],dropend:r?[-1,a,0]:[-1,0,0,a]};const h={dropdown:{top:"100%"},dropup:{top:"auto",bottom:"100%"},dropstart:r?{left:"100%",right:"auto"}:{left:"auto",right:"100%"},dropend:r?{left:"auto",right:"100%"}:{left:"100%",right:"auto"},menuEnd:r?{right:"auto",left:0}:{right:0,left:"auto"}},{offsetWidth:u,offsetHeight:g}=n,{clientWidth:m,clientHeight:b}=j(e),{left:v,top:w,width:y,height:T}=X(e),E=v-u-a<0,x=v+u+y+a>=m,H=w+g+a>=b,k=w+g+T+a>=b,A=w-g-a<0,P=(!r&&l||r&&!l)&&v+y-u<0,M=(r&&l||!r&&!l)&&v+u>=m;Zt.includes(c)&&E&&x&&(c=Xt),c===Yt&&(r?x:E)&&(c=Vt),c===Vt&&(r?E:x)&&(c=Yt),c===jt&&A&&!k&&(c=Xt),c===Xt&&k&&!A&&(c=jt),Zt.includes(c)&&H&&f(h[c],{top:"auto",bottom:0}),Gt.includes(c)&&(P||M)&&v+y+Math.abs(u-y)+at?t+"px":t).join(" "),Wt(n,h[c]),p(n,"dropdown-menu-end")&&Wt(n,h.menuEnd)}function oe(t){const{element:e}=t,s=t.open?n:o,i=l(e);s(i,"click",ae),s(i,"focus",ae),s(i,"keydown",le),s(i,"keyup",ce),"dynamic"===t.options.display&&[St,Ct].forEach(t=>{s(z(e),t,de,_)})}function se(t,e){(e?n:o)(t.element,"click",re)}function ie(t){const e=[...Bt,"btn-group","input-group"].map(t=>U(t+" show"),l(t)).find(t=>t.length);return e&&e.length?[...e[0].children].find(t=>Ot(t,C)):null}function ae(t){const{target:e,type:n}=t;if(!e||!e.closest)return;const o=ie(e);if(!o)return;const s=Ut(o);if(!s)return;const{parentElement:i,menu:a}=s,r=null!==u(e,qt),l=i&&i.contains(e)&&("form"===e.tagName||null!==u(e,"form"));"click"===n&&zt(e)&&t.preventDefault(),("focus"!==n||e!==o&&e!==a&&!a.contains(e))&&(l||r||s&&s.hide())}function re(t){const{target:e}=t,n=Ut(this);n&&(n.toggle(),e&&zt(e)&&t.preventDefault())}function le(t){[Rt,It].includes(t.code)&&t.preventDefault()}function ce(t){const{code:e}=t,n=ie(this),o=n&&Ut(n),s=n&&l(n).activeElement;if(!o||!s)return;const{menu:i,open:a}=o,r=function(t){return[...t.children].map(t=>{if(t&&Jt.includes(t.tagName))return t;const{firstElementChild:e}=t;return e&&Jt.includes(e.tagName)?e:null}).filter(t=>t)}(i);if(r&&r.length&&[Rt,It].includes(e)){let t=r.indexOf(s);s===n?t=0:e===It?t=t>1?t-1:0:e===Rt&&(t=t{t.relatedTarget=e}),m(s,Qt),Qt.defaultPrevented||(S(o,"show"),S(s,"show"),D(e,"aria-expanded","true"),ne(t),t.open=!n,setTimeout(()=>{Ft(e),oe(t),m(s,_t)},1))}hide(){const t=this,{element:e,open:n,menu:o,parentElement:s}=t;[te,ee].forEach(t=>{t.relatedTarget=e}),m(s,te),te.defaultPrevented||(g(o,"show"),g(s,"show"),D(e,"aria-expanded","false"),t.open=!n,setTimeout(()=>oe(t),1),m(s,ee))}dispose(){const{parentElement:t}=this;p(t,"show")&&this.open&&this.hide(),se(this),super.dispose()}}f(he,{selector:qt,init:t=>new he(t),getInstance:Ut});const ue=(t,e)=>t.removeAttribute(e);function fe(t){return l(t).body}const pe=t=>t instanceof z(t).ShadowRoot||t instanceof ShadowRoot;const ge=t=>["TABLE","TD","TH"].includes(t.tagName),me=t=>t instanceof HTMLElement;function be(t,e){const n=["HTML","BODY"];if(e){let{offsetParent:e}=t;const o=z(t);for(;e&&(ge(e)||me(e)&&!["sticky","fixed"].includes(i(e,"position")));)e=e.offsetParent;return(!e||e&&(n.includes(e.tagName)||"static"===i(e,"position")))&&(e=o),e}const o=[];let{parentNode:s}=t;for(;s&&!n.includes(s.nodeName);)s="HTML"===(a=s).nodeName?a:a.assignedSlot||a.parentNode||(pe(a)?a.host:null)||j(a),pe(s)||s.shadowRoot||ge(s)||o.push(s);var a;return o.find((t,e)=>"relative"!==i(t,"position")&&o.slice(e+1).every(t=>"static"===i(t,"position"))?t:null)||fe(t)}const ve="sticky-top",we="position-sticky",ye=t=>[...U("fixed-top",t),...U("fixed-bottom",t),...U(ve,t),...U(we,t),...U("is-fixed",t)];function Te(t){const{clientWidth:e}=j(t),{innerWidth:n}=z(t);return Math.abs(n-e)}function Ee(t,e){const n=fe(t),o=parseInt(i(n,"paddingRight"),10),s="hidden"===i(n,"overflow")&&o?0:Te(t),a=ye(n);e&&(Wt(n,{overflow:"hidden",paddingRight:o+s+"px"}),a.length&&a.forEach(t=>{const e=i(t,"paddingRight");if(t.style.paddingRight=parseInt(e,10)+s+"px",[ve,we].some(e=>p(t,e))){const e=i(t,"marginRight");t.style.marginRight=parseInt(e,10)-s+"px"}}))}const xe="modal-backdrop",He="offcanvas-backdrop",ke=l().createElement("div");function Ae(t){return h(".modal.show,.offcanvas.show",l(t))}function Pe(t){const e=t?xe:He;[xe,He].forEach(t=>{g(ke,t)}),S(ke,e)}function Me(t,e,n){Pe(n),t.append(ke),e&&S(ke,"fade")}function Ne(){S(ke,"show"),Q(ke)}function $e(){g(ke,"show")}function Le(t){Ae(t)||(g(ke,"fade"),ke.remove(),function(t){const e=fe(t);Wt(e,{paddingRight:"",overflow:""});const n=ye(e);n.length&&n.forEach(t=>{Wt(t,{paddingRight:"",marginRight:""})})}(t))}function De(t){return t&&"hidden"!==i(t,"visibility")&&null!==t.offsetParent}const Se=`[${C}="modal"]`,Ce={backdrop:!0,keyboard:!0},Ie=t=>w(t,"Modal"),Re=y("show.bs.modal"),Oe=y("shown.bs.modal"),We=y("hide.bs.modal"),Fe=y("hidden.bs.modal");function Be(t){const{element:e}=t,n=Te(e),{clientHeight:o,scrollHeight:s}=j(e),{clientHeight:i,scrollHeight:a}=e,r=i!==a;if(!r&&n){const t=V(e)?"paddingLeft":"paddingRight";e.style[t]=n+"px"}Ee(e,r||o!==s)}function ze(t,e){const s=e?n:o,{element:i}=t;s(i,"click",Ze),s(z(i),Ct,t.update,_),s(l(i),"keydown",Ge)}function Xe(t,e){const s=e?n:o,{triggers:i}=t;i.length&&i.forEach(t=>s(t,"click",Ue))}function je(t){const{triggers:e,element:n}=t;if(Le(n),n.style.paddingRight="",e.length){const t=e.find(t=>De(t));t&&Ft(t)}}function Ye(t){const{element:e,relatedTarget:n}=t;Ft(e),ze(t,!0),Oe.relatedTarget=n,m(e,Oe)}function Ve(t){const{element:e,hasFade:n}=t;e.style.display="block",Be(t),Ae(e)||(fe(e).style.overflow="hidden"),S(e,"show"),ue(e,"aria-hidden"),D(e,"aria-modal","true"),n?r(e,()=>Ye(t)):Ye(t)}function qe(t,e){const{element:n,options:o,relatedTarget:s,hasFade:i}=t;n.style.display="",o.backdrop&&!e&&i&&p(ke,"show")&&!Ae(n)?($e(),r(ke,()=>je(t))):je(t),ze(t),Fe.relatedTarget=s,m(n,Fe)}function Ue(t){const{target:e}=t,n=e&&u(this,Se),o=n&&tt(n),s=o&&Ie(o);s&&(n&&"A"===n.tagName&&t.preventDefault(),s.relatedTarget=n,s.toggle())}function Ge({code:t}){const e=h(".modal.show"),n=e&&Ie(e);if(!n)return;const{options:o}=n;o.keyboard&&"Escape"===t&&p(e,"show")&&(n.relatedTarget=null,n.hide())}function Ze(t){const e=this,n=Ie(e);if(!n||J(e))return;const{options:o,isStatic:s,modalDialog:i}=n,{backdrop:c}=o,{target:d}=t,h=l(e).getSelection().toString().length,f=i.contains(d),p=d&&u(d,'[data-bs-dismiss="modal"]');s&&!f?Z(e,()=>{S(e,"modal-static"),r(i,()=>function(t){const{element:e,modalDialog:n}=t,o=a(n)+17;g(e,"modal-static"),Z(e,()=>K(e),o)}(n))},17):(p||!h&&!s&&!f&&c)&&(n.relatedTarget=p||null,n.hide(),t.preventDefault())}class Je extends k{constructor(t,e){super(t,e);const{element:n}=this;this.modalDialog=h(".modal-dialog",n),this.triggers=[...q(Se)].filter(t=>tt(t)===n),this.isStatic="static"===this.options.backdrop,this.hasFade=p(n,"fade"),this.relatedTarget=null,this.container=be(n),Xe(this,!0),this.update=this.update.bind(this)}get name(){return"Modal"}get defaults(){return Ce}toggle(){p(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:e,options:n,hasFade:o,relatedTarget:s,container:i}=t,{backdrop:r}=n;let l=0;if(p(e,"show"))return;if(Re.relatedTarget=s||null,m(e,Re),Re.defaultPrevented)return;const c=Ae(e);if(c&&c!==e){(Ie(c)||w(c,"Offcanvas")).hide()}r?(c||p(ke,"show")?Pe(!0):Me(i,o,!0),l=a(ke),p(ke,"show")||Ne(),setTimeout(()=>Ve(t),l)):(Ve(t),c&&p(ke,"show")&&$e())}hide(t){const e=this,{element:n,hasFade:o,relatedTarget:s}=e;p(n,"show")&&(We.relatedTarget=s||null,m(n,We),We.defaultPrevented||(g(n,"show"),D(n,"aria-hidden","true"),ue(n,"aria-modal"),o&&!1!==t?r(n,()=>qe(e)):qe(e,t)))}update(){p(this.element,"show")&&Be(this)}dispose(){this.hide(!0),Xe(this),super.dispose()}}f(Je,{selector:".modal",init:t=>new Je(t),getInstance:Ie});const Ke=`[${C}="offcanvas"]`,Qe={backdrop:!0,keyboard:!0,scroll:!1},_e=t=>w(t,"Offcanvas"),tn=y("show.bs.offcanvas"),en=y("shown.bs.offcanvas"),nn=y("hide.bs.offcanvas"),on=y("hidden.bs.offcanvas");function sn(t,e){const s=e?n:o;t.triggers.forEach(t=>s(t,"click",cn))}function an(t,e){const s=e?n:o,i=l(t.element);s(i,"keydown",hn),s(i,"click",dn)}function rn(t){const{element:e,options:n}=t;n.scroll||(!function(t){const{element:e}=t,{clientHeight:n,scrollHeight:o}=j(e);Ee(e,n!==o)}(t),fe(e).style.overflow="hidden"),S(e,"offcanvas-toggling"),S(e,"show"),e.style.visibility="visible",r(e,()=>function(t){const{element:e,triggers:n}=t;g(e,"offcanvas-toggling"),ue(e,"aria-hidden"),D(e,"aria-modal","true"),D(e,"role","dialog"),n.length&&n.forEach(t=>D(t,"aria-expanded","true"));m(e,en),an(t,!0),Ft(e)}(t))}function ln(t){const{element:e,options:n}=t,o=Ae(e);e.blur(),!o&&n.backdrop&&p(ke,"show")?($e(),r(ke,()=>un(t))):un(t)}function cn(t){const e=u(this,Ke),n=e&&tt(e),o=n&&_e(n);o&&(o.relatedTarget=e,o.toggle(),e&&"A"===e.tagName&&t.preventDefault())}function dn(t){const e=h(".offcanvas.show",this);if(!e)return;const n=h('[data-bs-dismiss="offcanvas"]',e),o=_e(e);if(!o)return;const{options:s,triggers:i}=o,{target:a}=t,r=u(a,Ke),c=l(e).getSelection();c&&c.toString().length||!(!e.contains(a)&&s.backdrop&&(!r||r&&!i.includes(r))||n&&n.contains(a))||(o.relatedTarget=n&&n.contains(a)?n:null,o.hide()),r&&"A"===r.tagName&&t.preventDefault()}function hn({code:t}){const e=h(".offcanvas.show",this);if(!e)return;const n=_e(e);n&&n.options.keyboard&&"Escape"===t&&(n.relatedTarget=null,n.hide())}function un(t){const{element:e,triggers:n}=t;if(D(e,"aria-hidden","true"),ue(e,"aria-modal"),ue(e,"role"),e.style.visibility="",n.length){n.forEach(t=>D(t,"aria-expanded","false"));const t=n.find(t=>De(t));t&&Ft(t)}Le(e),m(e,on),g(e,"offcanvas-toggling"),Ae(e)||an(t)}class fn extends k{constructor(t,e){super(t,e);const{element:n}=this;this.triggers=[...q(Ke)].filter(t=>tt(t)===n),this.container=be(n),this.relatedTarget=null,sn(this,!0)}get name(){return"Offcanvas"}get defaults(){return Qe}toggle(){p(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:e,options:n,container:o,relatedTarget:s}=t;let i=0;if(p(e,"show"))return;if(tn.relatedTarget=s,en.relatedTarget=s,m(e,tn),tn.defaultPrevented)return;const r=Ae(e);if(r&&r!==e){(_e(r)||w(r,"Modal")).hide()}n.backdrop?(r?Pe():Me(o,!0),i=a(ke),p(ke,"show")||Ne(),setTimeout(()=>rn(t),i)):(rn(t),r&&p(ke,"show")&&$e())}hide(t){const e=this,{element:n,relatedTarget:o}=e;p(n,"show")&&(nn.relatedTarget=o,on.relatedTarget=o,m(n,nn),nn.defaultPrevented||(S(n,"offcanvas-toggling"),g(n,"show"),t?ln(e):r(n,()=>ln(e))))}dispose(){this.hide(!0),sn(this),super.dispose()}}f(fn,{selector:".offcanvas",init:t=>new fn(t),getInstance:_e});function pn(t){const e="tooltip"===t;return``}const gn=t=>t&&[SVGElement,HTMLImageElement,HTMLVideoElement].some(e=>t instanceof e);function mn(t,e,n){const o=e instanceof HTMLElement,s=X(t,o&&function(t){const{width:e,height:n}=X(t),{offsetWidth:o,offsetHeight:s}=t;return Math.round(e)!==o||Math.round(n)!==s}(e)),i={x:0,y:0};if(o){const t=X(e,!0);i.x=t.x+e.clientLeft,i.y=t.y+e.clientTop}return{x:s.left+n.x-i.x,y:s.top+n.y-i.y,width:s.width,height:s.height}}var bn={top:"top",bottom:"bottom",left:"start",right:"end"};function vn(t,e){const n=/\b(top|bottom|start|end)+/,{element:o,tooltip:s,options:a,arrow:r,offsetParent:l}=t,c={...bn};Wt(s,{top:"0px",left:"0px",right:""});const d="Popover"===t.name,h=s.offsetWidth,u=s.offsetHeight,f=V(o);f&&(c.left="end",c.right="start");const p=j(o),g=p.clientWidth,m=p.clientHeight,{container:b}=a;let{placement:v}=a;const{left:w,right:y,top:T}=X(b,!0),E=b.clientWidth,x=Math.abs(E-b.offsetWidth),H=i(b,"position"),k="fixed"===H,A="static"===H,P="sticky"===H&&T===parseFloat(i(b,"top")),M=f&&k?x:0,N=k?E+w+(f?x:0):E+w+(g-y)-1,{width:$,height:L,left:D,right:S,top:C}=X(o,!0),I=function(t){const e="scrollX"in t;return{x:e?t.scrollX:t.scrollLeft,y:e?t.scrollY:t.scrollTop}}(l),{x:R,y:O}=mn(o,l,I);let W,F,B,z,Y,q;Wt(r,{top:"",left:"",right:""});const U=r.offsetWidth||0,G=r.offsetHeight||0,Z=U/2;let J=C-u-G<0,K=C+u+L+G>=m,Q=D-h-U=N;const tt=["left","right"],et=["top","bottom"];if(J=tt.includes(v)?C+L/2-u/2-G<0:J,K=tt.includes(v)?C+u/2+L/2+G>=m:K,Q=et.includes(v)?D+$/2-h/2=N:_,v=tt.includes(v)&&Q&&_?"top":v,v="top"===v&&J?"bottom":v,v="bottom"===v&&K?"top":v,v="left"===v&&Q?"right":v,v="right"===v&&_?"left":v,s.className.includes(v)||(s.className=s.className.replace(n,c[v])),tt.includes(v))F="left"===v?R-h-(d?U:0):R+$+(d?U:0),J?(W=O,W+=P?-T-I.y:0,z=L/2-U):K?(W=O-u+L,W+=P?-T-I.y:0,z=u-L/2-U):(W=O-u/2+L/2,W+=P?-T-I.y:0,z=u/2-G/2);else if(et.includes(v))if(e&&gn(o)){let t=0,n=0;A?(t=e.pageX,n=e.pageY):(t=e.clientX-w+(k?I.x:0),n=e.clientY-T+(k?I.y:0)),t-=f&&k&&x?x:0,W="top"===v?n-u-U:n+U,e.clientX-h/2N?(F="auto",B=0,q=N-t-Z,q-=k?w+(f?x:0):0):(F=t-h/2,Y=h/2-Z)}else W="top"===v?O-u-(d?G:0):O+L+(d?G:0),Q?(F=0,Y=R+$/2-Z):_?(F="auto",B=0,q=$/2+N-S-Z):(F=R-h/2+$/2,Y=h/2-Z);Wt(s,{top:W+"px",left:"auto"===F?F:F+"px",right:void 0!==B?B+"px":""}),r instanceof HTMLElement&&(void 0!==z&&(r.style.top=z+"px"),void 0!==Y?r.style.left=Y+"px":void 0!==q&&(r.style.right=q+"px"))}const wn={template:pn("tooltip"),title:null,customClass:null,trigger:"hover focus",placement:"top",sanitizeFn:null,animation:!0,delay:200,container:null},yn="focusin",Tn="focusout",{userAgentData:En}=navigator,xn=En,{userAgent:Hn}=navigator,kn=Hn,An=/(iPhone|iPod|iPad)/,Pn=xn?xn.brands.some(t=>An.test(t.brand)):An.test(kn);let Mn=1;const Nn=new Map;function $n(t,e,n){if("string"!=typeof e||e.length)if("string"==typeof e){let o=e.trim();"function"==typeof n&&(o=n(o));const s=(new DOMParser).parseFromString(o,"text/html"),{body:i}=s,a=i.children.length?"innerHTML":"innerText";t[a]=i[a]}else e instanceof HTMLElement&&t.append(e)}function Ln(t,e){return t instanceof HTMLElement&&e.contains(t)}const Dn=`[${C}="tooltip"],[data-tip="tooltip"]`;let Sn=t=>w(t,"Tooltip");function Cn(t){const{element:e}=t;Wn(t),e.hasAttribute("data-original-title")&&"tooltip"===t.name&&Bn(t)}function In(t,e){const s=e?n:o,{element:i}=t;s(l(i),"touchstart",zn,_),gn(i)||[St,Ct].forEach(e=>{s(z(i),e,t.update,_)})}function Rn(t){const{element:e}=t,n=y("shown.bs."+H(t.name));In(t,!0),m(e,n),K(e,"in")}function On(t){const{element:e}=t,n=y("hidden.bs."+H(t.name));In(t),function(t){const{element:e,tooltip:n}=t;ue(e,"aria-describedby"),n.remove()}(t),m(e,n),K(e,"out")}function Wn(t,e){const s=e?n:o,{element:i,options:a,btn:r}=t,{trigger:c,dismissible:d}=a;if(c.includes("manual"))return;t.enabled=!!e;const h=c.split(" "),u=gn(i);u&&s(i,"mousemove",t.update,_),h.forEach(e=>{u||"hover"===e?(s(i,"mousedown",t.show),s(i,F,t.show),d&&r?s(r,"click",t.hide):(s(i,B,t.hide),s(l(i),"touchstart",zn,_))):"click"===e?s(i,e,d?t.show:t.toggle):"focus"===e&&(s(i,yn,t.show),d||s(i,Tn,t.hide),Pn&&s(i,"click",()=>Ft(i)))})}function Fn(t,e){const s=e?n:o,{element:i,options:a,offsetParent:r}=t,{container:l}=a,{offsetHeight:c,scrollHeight:d}=l,h=u(i,".modal"),f=u(i,".offcanvas");if(!gn(i)){const e=z(i),n=c!==d||r!==e?l:e;s(e,Ct,t.update,_),s(n,St,t.update,_)}h&&s(h,"hide.bs.modal",t.hide),f&&s(f,"hide.bs.offcanvas",t.hide)}function Bn(t,e){const n=["data-original-title","title"],{element:o}=t;D(o,n[e?0:1],e||T(o,n[0])),ue(o,n[e?1:0])}function zn({target:t}){const{tooltip:e,element:n}=this;e.contains(t)||t===n||n.contains(t)||this.hide()}class Xn extends k{constructor(t,e){super(t,e);const n=this,{element:o}=n,s="Tooltip"===n.name,a=s?"tooltip":"popover",r=s?"Tooltip":"Popover";Sn=t=>w(t,r),n.tooltip={},s||(n.btn=null),n.arrow={},n.offsetParent={},n.enabled=!0,n.id=`${a}-${function(t,e){Mn+=1;let n=Nn.get(t),o=Mn;if(e&&e.length)if(n){const t=n.get(e);Number.isNaN(t)?n.set(e,o):o=t}else Nn.set(t,new Map),n=Nn.get(t),n.set(e,o);else Number.isNaN(n)?Nn.set(t,o):o=n;return o}(o,a)}`;const{options:c}=n;if(!c.title&&s||!s&&!c.content)return;const d=h(c.container),u=be(o);n.options.container=!d||d&&["static","relative"].includes(i(d,"position"))?u:d||fe(o),wn.title=null,zn.bind(n),n.update=n.update.bind(n),n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.toggle=n.toggle.bind(n),o.hasAttribute("title")&&s&&Bn(n,c.title),function(t){const{id:e,element:n,options:o}=t,{animation:s,customClass:i,sanitizeFn:a,placement:r,dismissible:c}=o;let{title:d,content:u}=o;const f="Tooltip"===t.name,g=f?"tooltip":"popover",{template:m,btnClose:b}=o,v={...bn};V(n)&&(v.left="end",v.right="start");const w=`bs-${g}-${v[r]}`;let y;if([Element,HTMLElement].some(t=>m instanceof t))y=m;else{const t=l(n).createElement("div");$n(t,m,a),y=t.firstElementChild}t.tooltip=y&&y.cloneNode(!0);const{tooltip:T}=t;D(T,"id",e),D(T,"role","tooltip");const E=f?"tooltip-inner":"popover-body",x=f?null:h(".popover-header",T),H=h("."+E,T);t.arrow=h(`.${g}-arrow`,T),c&&(d?d instanceof HTMLElement?$n(d,b,a):d+=b:(x&&x.remove(),u instanceof HTMLElement?$n(u,b,a):u+=b)),f?d&&H&&$n(H,d,a):(d&&x&&$n(x,d,a),u&&H&&$n(H,u,a),t.btn=h(".btn-close",T)),p(T,g)||S(T,g),s&&!p(T,"fade")&&S(T,"fade"),i&&!p(T,i)&&S(T,i),p(T,w)||S(T,w)}(n),Wn(n,!0)}get name(){return"Tooltip"}get defaults(){return wn}show(t){const e=this,{options:n,tooltip:o,element:s,id:i}=e,{container:a,animation:l}=n,c=J(s,"out");K(s,"out"),!o||c||Ln(o,a)||Z(s,()=>{const n=y("show.bs."+H(e.name));m(s,n),n.defaultPrevented||(a.append(o),D(s,"aria-describedby","#"+i),e.offsetParent=be(o,!0),e.update(t),Fn(e,!0),p(o,"show")||S(o,"show"),l?r(o,()=>Rn(e)):Rn(e))},17,"in")}hide(){const t=this,{options:e,tooltip:n,element:o}=t,{container:s,animation:i,delay:a}=e;K(o,"in"),n&&Ln(n,s)&&Z(o,()=>{const e=y("hide.bs."+H(t.name));m(o,e),e.defaultPrevented||(g(n,"show"),Fn(t),i?r(n,()=>On(t)):On(t))},a+17,"out")}update(t){vn(this,t)}toggle(t){const{tooltip:e,options:n}=this;Ln(e,n.container)?this.hide():this.show(t)}enable(){const t=this,{enabled:e}=t;e||(Wn(t,!0),t.enabled=!e)}disable(){const t=this,{element:e,tooltip:n,options:o,enabled:s}=t,{animation:i,container:r,delay:l}=o;s&&(Ln(n,r)&&i?(t.hide(),Z(e,()=>{Wn(t),K(e,"tooltip")},a(n)+l+17,"tooltip")):Wn(t),t.enabled=!s)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{tooltip:e,options:n}=t;n.animation&&Ln(e,n.container)?(n.delay=0,t.hide(),r(e,()=>Cn(t))):Cn(t),super.dispose()}}f(Xn,{selector:Dn,init:t=>new Xn(t),getInstance:Sn,styleTip:vn});const jn=`[${C}="popover"],[data-tip="popover"]`,Yn={...wn,template:pn("popover"),btnClose:'',dismissible:!1,content:null};class Vn extends Xn{constructor(t,e){super(t,e)}get name(){return"Popover"}get defaults(){return Yn}show(){super.show();const{options:t,btn:e}=this;t.dismissible&&e&&setTimeout(()=>Ft(e),17)}}function qn(t,e){return(e&&c.some(t=>e instanceof t)?e:l()).getElementsByTagName(t)}f(Vn,{selector:jn,init:t=>new Vn(t),getInstance:t=>w(t,"Popover"),styleTip:vn});const Un={offset:10,target:null},Gn=y("activate.bs.scrollspy");function Zn(t){const{target:e,scrollTarget:n,options:o,itemsLength:s,scrollHeight:i,element:a}=t,{offset:r}=o,c=n instanceof Window,d=e&&qn("A",e),u=n&&function(t){return t instanceof HTMLElement?t.scrollHeight:j(t).scrollHeight}(n);if(t.scrollTop=c?n.scrollY:n.scrollTop,d&&(s!==d.length||u!==i)){let e,n,o;t.items=[],t.offsets=[],t.scrollHeight=u,t.maxScroll=t.scrollHeight-function({element:t,scrollTarget:e}){return e instanceof Window?e.innerHeight:X(t).height}(t),[...d].forEach(s=>{e=T(s,"href"),n=e&&"#"===e.charAt(0)&&"#"!==e.slice(-1)&&h(e,l(a)),n&&(t.items.push(s),o=X(n),t.offsets.push((c?o.top+t.scrollTop:n.offsetTop)-r))}),t.itemsLength=t.items.length}}function Jn(t){[...qn("A",t)].forEach(t=>{p(t,"active")&&g(t,"active")})}function Kn(t,e){const{target:n,element:o}=t;Jn(n),t.activeItem=e,S(e,"active");const s=[];let i=e;for(;i!==fe(o);)i=i.parentElement,(p(i,"nav")||p(i,"dropdown-menu"))&&s.push(i);s.forEach(t=>{const e=t.previousElementSibling;e&&!p(e,"active")&&S(e,"active")}),Gn.relatedTarget=e,m(o,Gn)}function Qn(t,e){(e?n:o)(t.scrollTarget,St,t.refresh,_)}class _n extends k{constructor(t,e){super(t,e);const{element:n,options:o}=this;if(this.target=h(o.target,l(n)),!this.target)return;const s=z(n);this.scrollTarget=n.clientHeight=o){const e=i[s-1];return void(a!==e&&Kn(t,e))}const{offsets:r}=t;if(a&&n0)return t.activeItem=null,void Jn(e);i.forEach((e,o)=>{a!==e&&n>=r[o]&&(void 0===r[o+1]||nnew _n(t),getInstance:t=>w(t,"ScrollSpy")});const to=`[${C}="tab"]`,eo=t=>w(t,"Tab"),no=y("show.bs.tab"),oo=y("shown.bs.tab"),so=y("hide.bs.tab"),io=y("hidden.bs.tab"),ao=new Map;function ro(t){const{tabContent:e,nav:n}=t;e&&(e.style.height="",g(e,"collapsing")),n&&K(n)}function lo(t){const{element:e,tabContent:n,nav:o}=t,{currentHeight:s,nextHeight:i}=ao.get(e),{tab:a}=o&&ao.get(o);n?s===i?ro(t):setTimeout(()=>{n.style.height=i+"px",Q(n),r(n,()=>ro(t))},50):o&&K(o),oo.relatedTarget=a,m(e,oo)}function co(t){const{element:e,content:n,tabContent:o,nav:s}=t,{tab:i,content:a}=s&&ao.get(s);let l=0;if(o&&([a,n].forEach(t=>S(t,"overflow-hidden")),l=a.scrollHeight),no.relatedTarget=i,io.relatedTarget=e,m(e,no),!no.defaultPrevented){if(S(n,"active"),g(a,"active"),o){const t=n.scrollHeight;ao.set(e,{currentHeight:l,nextHeight:t}),S(o,"collapsing"),o.style.height=l+"px",Q(o),[a,n].forEach(t=>g(t,"overflow-hidden"))}n&&p(n,"fade")?setTimeout(()=>{S(n,"show"),r(n,()=>{lo(t)})},17):lo(t),m(i,io)}}function ho(t,e){(e?n:o)(t.element,"click",uo)}function uo(t){const e=eo(this);e&&(t.preventDefault(),e.show())}class fo extends k{constructor(t){super(t);const{element:e}=this,n=tt(e);if(!n)return;const o=u(e,".nav"),s=u(n,".tab-content");this.nav=o,this.content=n,this.tabContent=s,this.dropdown=o&&h(`.${Bt[0]}-toggle`,o),ho(this,!0)}get name(){return"Tab"}show(){const t=this,{element:e,nav:n,dropdown:o}=t;if(!(n&&J(n)||p(e,"active"))){const{tab:s,content:i}=function(t){const{nav:e}=t,n=U("active",e);let o;return 1!==n.length||Bt.some(t=>p(n[0].parentElement,t))?n.length>1&&(o=n[n.length-1]):[o]=n,{tab:o,content:o?tt(o):null}}(t);if(n&&ao.set(n,{tab:s,content:i}),so.relatedTarget=e,m(s,so),so.defaultPrevented)return;n&&Z(n,()=>{},17),g(s,"active"),D(s,"aria-selected","false"),S(e,"active"),D(e,"aria-selected","true"),o&&(p(e.parentNode,"dropdown-menu")?p(o,"active")||S(o,"active"):p(o,"active")&&g(o,"active")),p(i,"fade")?(g(i,"show"),r(i,()=>co(t))):co(t)}}dispose(){ho(this),super.dispose()}}f(fo,{selector:to,init:t=>new fo(t),getInstance:eo});const po={animation:!0,autohide:!0,delay:5e3},go=t=>w(t,"Toast"),mo=y("show.bs.toast"),bo=y("shown.bs.toast"),vo=y("hide.bs.toast"),wo=y("hidden.bs.toast");function yo(t){const{element:e,options:n}=t;g(e,"showing"),K(e,"showing"),m(e,bo),n.autohide&&Z(e,()=>t.hide(),n.delay,"toast")}function To(t){const{element:e}=t;g(e,"showing"),g(e,"show"),S(e,"hide"),K(e,"toast"),m(e,wo)}function Eo(t,e){const s=e?n:o,{element:i,dismiss:a,options:r}=t;a&&s(a,"click",t.hide),r.autohide&&[yn,Tn,F,B].forEach(t=>s(i,t,xo))}function xo(t){const e=this,n=go(e),{type:o,relatedTarget:s}=t;n&&e!==s&&!e.contains(s)&&([F,yn].includes(o)?K(e,"toast"):Z(e,()=>n.hide(),n.options.delay,"toast"))}class Ho extends k{constructor(t,e){super(t,e);const{element:n,options:o}=this;o.animation&&!p(n,"fade")?S(n,"fade"):!o.animation&&p(n,"fade")&&g(n,"fade"),this.dismiss=h('[data-bs-dismiss="toast"]',n),this.show=this.show.bind(this),this.hide=this.hide.bind(this),Eo(this,!0)}get name(){return"Toast"}get defaults(){return po}show(){const t=this,{element:e}=t;if(e&&!p(e,"show")){if(m(e,mo),mo.defaultPrevented)return;!function(t){const{element:e,options:n}=t;Z(e,()=>{g(e,"hide"),Q(e),S(e,"show"),S(e,"showing"),n.animation?r(e,()=>yo(t)):yo(t)},17,"showing")}(t)}}hide(){const t=this,{element:e}=t;if(e&&p(e,"show")){if(m(e,vo),vo.defaultPrevented)return;!function(t){const{element:e,options:n}=t;S(e,"showing"),n.animation?(Q(e),r(e,()=>To(t))):To(t)}(t)}}dispose(){const{element:t}=this;p(t,"show")&&g(t,"show"),function(t){K(t.element,"toast"),Eo(t)}(this),super.dispose()}}f(Ho,{selector:".toast",init:t=>new Ho(t),getInstance:go});const ko={Alert:L,Button:W,Carousel:Tt,Collapse:Dt,Dropdown:he,Modal:Je,Offcanvas:fn,Popover:Vn,ScrollSpy:_n,Tab:fo,Toast:Ho,Tooltip:Xn};function Ao(t){const e=[...qn("*",t&&c.some(e=>t instanceof e)?t:void 0)];x(ko).forEach(t=>{const{init:n,selector:o}=ko[t];var s,i;s=n,i=e.filter(t=>function(t,e){return t.matches(e)}(t,o)),[...i].forEach(t=>s(t))})}document.body?Ao():n(document,"DOMContentLoaded",()=>Ao(),{once:!0});return{Alert:L,Button:W,Carousel:Tt,Collapse:Dt,Dropdown:he,Modal:Je,Offcanvas:fn,Popover:Vn,ScrollSpy:_n,Tab:fo,Toast:Ho,Tooltip:Xn,initCallback:Ao,removeDataAPI:function(t){const e=t&&c.some(e=>t instanceof e)?t:void 0;x(ko).forEach(t=>{!function(t,e){const n=v.getAllFor(t);n&&[...n].forEach(t=>{const[n,o]=t;e&&e.contains(n)&&o.dispose()})}(t,e)})},Version:"4.1.0alpha5",EventListener:s}})); diff --git a/dist/components/alert-native.esm.js b/dist/components/alert-native.esm.js index 66bbf996..8f15408c 100644 --- a/dist/components/alert-native.esm.js +++ b/dist/components/alert-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Alert v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Alert v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -90,32 +90,6 @@ function getElementTransitionDuration(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -132,16 +106,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -165,7 +139,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -177,19 +151,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -416,6 +388,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -432,19 +405,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `fade` class. */ @@ -566,7 +526,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -633,7 +593,6 @@ class BaseComponent { // ================ const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; -const { on, off } = EventListener; /** * Static method which returns an existing `Alert` instance associated @@ -678,7 +637,7 @@ function alertTransitionEnd(self) { * @param {boolean=} add when `true`, event listener is added */ function toggleAlertHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { dismiss } = self; if (dismiss) action(dismiss, mouseclickEvent, self.close); } diff --git a/dist/components/alert-native.js b/dist/components/alert-native.js index 2a565ccd..5045d7c2 100644 --- a/dist/components/alert-native.js +++ b/dist/components/alert-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Alert v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Alert v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -96,32 +96,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -138,16 +112,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -171,7 +145,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -183,19 +157,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -422,6 +394,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -438,19 +411,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `fade` class. */ @@ -572,7 +532,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -639,7 +599,6 @@ // ================ const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; - const { on, off } = EventListener; /** * Static method which returns an existing `Alert` instance associated @@ -684,7 +643,7 @@ * @param {boolean=} add when `true`, event listener is added */ function toggleAlertHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { dismiss } = self; if (dismiss) action(dismiss, mouseclickEvent, self.close); } diff --git a/dist/components/button-native.esm.js b/dist/components/button-native.esm.js index ad71c9c7..853532ea 100644 --- a/dist/components/button-native.esm.js +++ b/dist/components/button-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Button v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Button v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -76,7 +76,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -88,19 +88,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @type {Map>>} */ @@ -257,6 +255,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -273,19 +272,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components active class. */ @@ -402,7 +388,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -468,7 +454,6 @@ class BaseComponent { // BUTTON PRIVATE GC // ================= const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; -const { on, off } = EventListener; /** * Static method which returns an existing `Button` instance associated @@ -492,7 +477,7 @@ const buttonInitCallback = (element) => new Button(element); * @param {boolean=} add when `true`, event listener is added */ function toggleButtonHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, self.toggle); } diff --git a/dist/components/button-native.js b/dist/components/button-native.js index b143cc74..7408404c 100644 --- a/dist/components/button-native.js +++ b/dist/components/button-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Button v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Button v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -82,7 +82,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -94,19 +94,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @type {Map>>} */ @@ -263,6 +261,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -279,19 +278,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components active class. */ @@ -408,7 +394,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -474,7 +460,6 @@ // BUTTON PRIVATE GC // ================= const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; - const { on, off } = EventListener; /** * Static method which returns an existing `Button` instance associated @@ -498,7 +483,7 @@ * @param {boolean=} add when `true`, event listener is added */ function toggleButtonHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, self.toggle); } diff --git a/dist/components/carousel-native.esm.js b/dist/components/carousel-native.esm.js index 36f21901..86a39561 100644 --- a/dist/components/carousel-native.esm.js +++ b/dist/components/carousel-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Carousel v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Carousel v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -226,7 +226,7 @@ function closest(element, selector) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -238,19 +238,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -408,32 +406,6 @@ function getElementTransitionDelay(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -450,16 +422,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -685,6 +657,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -701,19 +674,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components active class. */ @@ -853,7 +813,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -922,7 +882,6 @@ const carouselSelector = `[data-bs-ride="${carouselString}"]`; const carouselItem = `${carouselString}-item`; const dataBsSlideTo = 'data-bs-slide-to'; const dataBsSlide = 'data-bs-slide'; -const { on, off } = EventListener; const pausedClass = 'paused'; const carouselDefaults = { @@ -1184,7 +1143,7 @@ function activateCarouselIndicator(self, pageIndex) { */ function toggleCarouselTouchHandlers(self, add) { const { element } = self; - const action = add ? on : off; + const action = add ? addListener : removeListener; action(element, touchmoveEvent, carouselTouchMoveHandler, passiveHandler); action(element, touchendEvent, carouselTouchEndHandler, passiveHandler); } @@ -1201,7 +1160,7 @@ function toggleCarouselHandlers(self, add) { const { touch, pause, interval, keyboard, } = options; - const action = add ? on : off; + const action = add ? addListener : removeListener; if (pause && interval) { action(element, mouseenterEvent, carouselPauseHandler); diff --git a/dist/components/carousel-native.js b/dist/components/carousel-native.js index cb6261b4..12448792 100644 --- a/dist/components/carousel-native.js +++ b/dist/components/carousel-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Carousel v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Carousel v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -232,7 +232,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -244,19 +244,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -414,32 +412,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -456,16 +428,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -691,6 +663,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -707,19 +680,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components active class. */ @@ -859,7 +819,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -928,7 +888,6 @@ const carouselItem = `${carouselString}-item`; const dataBsSlideTo = 'data-bs-slide-to'; const dataBsSlide = 'data-bs-slide'; - const { on, off } = EventListener; const pausedClass = 'paused'; const carouselDefaults = { @@ -1190,7 +1149,7 @@ */ function toggleCarouselTouchHandlers(self, add) { const { element } = self; - const action = add ? on : off; + const action = add ? addListener : removeListener; action(element, touchmoveEvent, carouselTouchMoveHandler, passiveHandler); action(element, touchendEvent, carouselTouchEndHandler, passiveHandler); } @@ -1207,7 +1166,7 @@ const { touch, pause, interval, keyboard, } = options; - const action = add ? on : off; + const action = add ? addListener : removeListener; if (pause && interval) { action(element, mouseenterEvent, carouselPauseHandler); diff --git a/dist/components/collapse-native.esm.js b/dist/components/collapse-native.esm.js index d66b13fa..57c29848 100644 --- a/dist/components/collapse-native.esm.js +++ b/dist/components/collapse-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Collapse v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Collapse v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -92,32 +92,6 @@ function getElementTransitionDuration(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -134,16 +108,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -184,7 +158,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -196,19 +170,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -538,6 +510,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -554,19 +527,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `toggle` option. */ @@ -724,7 +684,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -792,7 +752,6 @@ class BaseComponent { const collapseSelector = `.${collapseString}`; const collapseToggleSelector = `[${dataBsToggle}="${collapseString}"]`; const collapseDefaults = { parent: null }; -const { on, off } = EventListener; /** * Static method which returns an existing `Collapse` instance associated @@ -905,7 +864,7 @@ function collapseContent(self) { * @param {boolean=} add when `true`, the event listener is added */ function toggleCollapseHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { diff --git a/dist/components/collapse-native.js b/dist/components/collapse-native.js index dbeaf0f4..d726b217 100644 --- a/dist/components/collapse-native.js +++ b/dist/components/collapse-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Collapse v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Collapse v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -98,32 +98,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -140,16 +114,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -190,7 +164,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -202,19 +176,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -544,6 +516,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -560,19 +533,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `toggle` option. */ @@ -730,7 +690,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -798,7 +758,6 @@ const collapseSelector = `.${collapseString}`; const collapseToggleSelector = `[${dataBsToggle}="${collapseString}"]`; const collapseDefaults = { parent: null }; - const { on, off } = EventListener; /** * Static method which returns an existing `Collapse` instance associated @@ -911,7 +870,7 @@ * @param {boolean=} add when `true`, the event listener is added */ function toggleCollapseHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { diff --git a/dist/components/dropdown-native.esm.js b/dist/components/dropdown-native.esm.js index fb3c9ac4..e1d42d59 100644 --- a/dist/components/dropdown-native.esm.js +++ b/dist/components/dropdown-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Dropdown v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Dropdown v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -110,7 +110,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -122,19 +122,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -481,6 +479,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -497,19 +496,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `show` class. */ @@ -649,7 +635,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -721,7 +707,6 @@ const [ dropendString, ] = dropdownMenuClasses; const dropdownSelector = `[${dataBsToggle}="${dropdownString}"]`; -const { on, off } = EventListener; /** * Static method which returns an existing `Dropdown` instance associated @@ -897,7 +882,7 @@ function getMenuItems(menu) { */ function toggleDropdownDismiss(self) { const { element } = self; - const action = self.open ? on : off; + const action = self.open ? addListener : removeListener; const doc = getDocument(element); action(doc, mouseclickEvent, dropdownDismissHandler); @@ -920,7 +905,7 @@ function toggleDropdownDismiss(self) { * @param {boolean=} add when `true`, it will add the event listener */ function toggleDropdownHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, dropdownClickHandler); } diff --git a/dist/components/dropdown-native.js b/dist/components/dropdown-native.js index 001a6d0c..23bf58e7 100644 --- a/dist/components/dropdown-native.js +++ b/dist/components/dropdown-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Dropdown v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Dropdown v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -116,7 +116,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -128,19 +128,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -487,6 +485,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -503,19 +502,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `show` class. */ @@ -655,7 +641,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -727,7 +713,6 @@ dropendString, ] = dropdownMenuClasses; const dropdownSelector = `[${dataBsToggle}="${dropdownString}"]`; - const { on, off } = EventListener; /** * Static method which returns an existing `Dropdown` instance associated @@ -903,7 +888,7 @@ */ function toggleDropdownDismiss(self) { const { element } = self; - const action = self.open ? on : off; + const action = self.open ? addListener : removeListener; const doc = getDocument(element); action(doc, mouseclickEvent, dropdownDismissHandler); @@ -926,7 +911,7 @@ * @param {boolean=} add when `true`, it will add the event listener */ function toggleDropdownHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, dropdownClickHandler); } diff --git a/dist/components/modal-native.esm.js b/dist/components/modal-native.esm.js index 67424986..9480e2cc 100644 --- a/dist/components/modal-native.esm.js +++ b/dist/components/modal-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Modal v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Modal v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -161,7 +161,7 @@ function getDocumentElement(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -173,19 +173,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -466,32 +464,6 @@ function getElementTransitionDelay(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -508,16 +480,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -622,6 +594,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -638,19 +611,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `toggle` option. */ @@ -1131,7 +1091,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -1200,7 +1160,6 @@ const modalSelector = `.${modalString}`; const modalToggleSelector = `[${dataBsToggle}="${modalString}"]`; const modalDismissSelector = `[${dataBsDismiss}="${modalString}"]`; const modalStaticClass = `${modalString}-static`; -const { on, off } = EventListener; const modalDefaults = { backdrop: true, // boolean|string @@ -1258,7 +1217,7 @@ function setModalScrollbar(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleModalDismiss(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element } = self; action(element, mouseclickEvent, modalDismissHandler); // @ts-ignore @@ -1272,7 +1231,7 @@ function toggleModalDismiss(self, add) { * @param {boolean=} add when `true`, event listener is added */ function toggleModalHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { diff --git a/dist/components/modal-native.js b/dist/components/modal-native.js index 5fdbabea..1c3030a9 100644 --- a/dist/components/modal-native.js +++ b/dist/components/modal-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Modal v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Modal v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -167,7 +167,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -179,19 +179,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -472,32 +470,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -514,16 +486,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -628,6 +600,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -644,19 +617,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `toggle` option. */ @@ -1137,7 +1097,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -1206,7 +1166,6 @@ const modalToggleSelector = `[${dataBsToggle}="${modalString}"]`; const modalDismissSelector = `[${dataBsDismiss}="${modalString}"]`; const modalStaticClass = `${modalString}-static`; - const { on, off } = EventListener; const modalDefaults = { backdrop: true, // boolean|string @@ -1264,7 +1223,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleModalDismiss(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element } = self; action(element, mouseclickEvent, modalDismissHandler); // @ts-ignore @@ -1278,7 +1237,7 @@ * @param {boolean=} add when `true`, event listener is added */ function toggleModalHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { diff --git a/dist/components/offcanvas-native.esm.js b/dist/components/offcanvas-native.esm.js index f35f79fc..c4a6dff1 100644 --- a/dist/components/offcanvas-native.esm.js +++ b/dist/components/offcanvas-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Offcanvas v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Offcanvas v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -69,7 +69,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -81,19 +81,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -267,32 +265,6 @@ function getElementTransitionDelay(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -309,16 +281,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -513,6 +485,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -529,19 +502,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `dismiss` option. */ @@ -1043,7 +1003,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -1112,7 +1072,6 @@ const offcanvasSelector = `.${offcanvasString}`; const offcanvasToggleSelector = `[${dataBsToggle}="${offcanvasString}"]`; const offcanvasDismissSelector = `[${dataBsDismiss}="${offcanvasString}"]`; const offcanvasTogglingClass = `${offcanvasString}-toggling`; -const { on, off } = EventListener; const offcanvasDefaults = { backdrop: true, // boolean @@ -1162,7 +1121,7 @@ function setOffCanvasScrollbar(self) { * @param {boolean=} add when *true*, listeners are added */ function toggleOffcanvasEvents(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; self.triggers.forEach((btn) => action(btn, mouseclickEvent, offcanvasTriggerHandler)); } @@ -1173,7 +1132,7 @@ function toggleOffcanvasEvents(self, add) { * @param {boolean=} add when *true* listeners are added */ function toggleOffCanvasDismiss(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const doc = getDocument(self.element); action(doc, keydownEvent, offcanvasKeyDismissHandler); action(doc, mouseclickEvent, offcanvasDismissHandler); diff --git a/dist/components/offcanvas-native.js b/dist/components/offcanvas-native.js index 02ef01cc..496caddc 100644 --- a/dist/components/offcanvas-native.js +++ b/dist/components/offcanvas-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Offcanvas v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Offcanvas v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -75,7 +75,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -87,19 +87,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -273,32 +271,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -315,16 +287,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -519,6 +491,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -535,19 +508,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `dismiss` option. */ @@ -1049,7 +1009,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -1118,7 +1078,6 @@ const offcanvasToggleSelector = `[${dataBsToggle}="${offcanvasString}"]`; const offcanvasDismissSelector = `[${dataBsDismiss}="${offcanvasString}"]`; const offcanvasTogglingClass = `${offcanvasString}-toggling`; - const { on, off } = EventListener; const offcanvasDefaults = { backdrop: true, // boolean @@ -1168,7 +1127,7 @@ * @param {boolean=} add when *true*, listeners are added */ function toggleOffcanvasEvents(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; self.triggers.forEach((btn) => action(btn, mouseclickEvent, offcanvasTriggerHandler)); } @@ -1179,7 +1138,7 @@ * @param {boolean=} add when *true* listeners are added */ function toggleOffCanvasDismiss(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const doc = getDocument(self.element); action(doc, keydownEvent, offcanvasKeyDismissHandler); action(doc, mouseclickEvent, offcanvasDismissHandler); diff --git a/dist/components/popover-native.esm.js b/dist/components/popover-native.esm.js index 4039c235..d9376d80 100644 --- a/dist/components/popover-native.esm.js +++ b/dist/components/popover-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Popover v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Popover v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -33,7 +33,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -45,19 +45,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @type {Map>>} */ @@ -827,32 +825,6 @@ function getElementTransitionDelay(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -869,16 +841,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -1102,6 +1074,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -1118,19 +1091,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for `data-bs-title` attribute. */ @@ -1462,7 +1422,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -1529,7 +1489,6 @@ class BaseComponent { // ================== const tooltipSelector = `[${dataBsToggle}="${tooltipString}"],[data-tip="${tooltipString}"]`; const titleAttr = 'title'; -const { on, off } = EventListener; /** * Static method which returns an existing `Tooltip` instance associated @@ -1579,7 +1538,7 @@ function disposeTooltipComplete(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipAction(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element } = self; action(getDocument(element), touchstartEvent, tooltipTouchHandler, passiveHandler); @@ -1628,7 +1587,7 @@ function tooltipHiddenAction(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; // @ts-ignore -- btn is only for dismissible popover const { element, options, btn } = self; const { trigger, dismissible } = options; @@ -1673,7 +1632,7 @@ function toggleTooltipHandlers(self, add) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipOpenHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, options, offsetParent } = self; const { container } = options; const { offsetHeight, scrollHeight } = container; @@ -1690,8 +1649,8 @@ function toggleTooltipOpenHandlers(self, add) { } // dismiss tooltips inside modal / offcanvas - if (parentModal) on(parentModal, `hide.bs.${modalString}`, self.hide); - if (parentOffcanvas) on(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); + if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.hide); + if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); } /** diff --git a/dist/components/popover-native.js b/dist/components/popover-native.js index 26f349aa..ce42827c 100644 --- a/dist/components/popover-native.js +++ b/dist/components/popover-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Popover v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Popover v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -39,7 +39,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -51,19 +51,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @type {Map>>} */ @@ -833,32 +831,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -875,16 +847,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -1108,6 +1080,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -1124,19 +1097,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for `data-bs-title` attribute. */ @@ -1468,7 +1428,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -1535,7 +1495,6 @@ // ================== const tooltipSelector = `[${dataBsToggle}="${tooltipString}"],[data-tip="${tooltipString}"]`; const titleAttr = 'title'; - const { on, off } = EventListener; /** * Static method which returns an existing `Tooltip` instance associated @@ -1585,7 +1544,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipAction(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element } = self; action(getDocument(element), touchstartEvent, tooltipTouchHandler, passiveHandler); @@ -1634,7 +1593,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; // @ts-ignore -- btn is only for dismissible popover const { element, options, btn } = self; const { trigger, dismissible } = options; @@ -1679,7 +1638,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipOpenHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, options, offsetParent } = self; const { container } = options; const { offsetHeight, scrollHeight } = container; @@ -1696,8 +1655,8 @@ } // dismiss tooltips inside modal / offcanvas - if (parentModal) on(parentModal, `hide.bs.${modalString}`, self.hide); - if (parentOffcanvas) on(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); + if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.hide); + if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); } /** diff --git a/dist/components/scrollspy-native.esm.js b/dist/components/scrollspy-native.esm.js index 3cad85f9..bcc45712 100644 --- a/dist/components/scrollspy-native.esm.js +++ b/dist/components/scrollspy-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - ScrollSpy v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - ScrollSpy v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -25,7 +25,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -37,19 +37,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -370,6 +368,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -386,19 +385,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components active class. */ @@ -503,7 +489,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -571,7 +557,6 @@ class BaseComponent { // SCROLLSPY PRIVATE GC // ==================== const scrollspySelector = '[data-bs-spy="scroll"]'; -const { on, off } = EventListener; const scrollspyDefaults = { offset: 10, @@ -717,7 +702,7 @@ function activate(self, item) { * @param {boolean=} add when `true`, listener is added */ function toggleSpyHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; // @ts-ignore action(self.scrollTarget, scrollEvent, self.refresh, passiveHandler); } diff --git a/dist/components/scrollspy-native.js b/dist/components/scrollspy-native.js index 53b1c6ec..a2d40d29 100644 --- a/dist/components/scrollspy-native.js +++ b/dist/components/scrollspy-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - ScrollSpy v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - ScrollSpy v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -31,7 +31,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -43,19 +43,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -376,6 +374,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -392,19 +391,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components active class. */ @@ -509,7 +495,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -577,7 +563,6 @@ // SCROLLSPY PRIVATE GC // ==================== const scrollspySelector = '[data-bs-spy="scroll"]'; - const { on, off } = EventListener; const scrollspyDefaults = { offset: 10, @@ -723,7 +708,7 @@ * @param {boolean=} add when `true`, listener is added */ function toggleSpyHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; // @ts-ignore action(self.scrollTarget, scrollEvent, self.refresh, passiveHandler); } diff --git a/dist/components/tab-native.esm.js b/dist/components/tab-native.esm.js index 26b3c811..b5d91b4e 100644 --- a/dist/components/tab-native.esm.js +++ b/dist/components/tab-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Tab v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Tab v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -55,7 +55,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * Shortcut for `HTMLElement.getElementsByClassName` method. Some `Node` elements @@ -81,19 +81,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -216,32 +214,6 @@ function getElementTransitionDuration(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -258,16 +230,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -538,6 +510,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -554,19 +527,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `collapsing` class. * As used by `Collapse` / `Tab`. @@ -744,7 +704,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -810,7 +770,6 @@ class BaseComponent { // TAB PRIVATE GC // ================ const tabSelector = `[${dataBsToggle}="${tabString}"]`; -const { on, off } = EventListener; /** * Static method which returns an existing `Tab` instance associated @@ -959,7 +918,7 @@ function getActiveTab(self) { * @param {boolean=} add when `true`, event listener is added */ function toggleTabHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, tabClickHandler); } diff --git a/dist/components/tab-native.js b/dist/components/tab-native.js index 4f84b2a2..96e9d7ce 100644 --- a/dist/components/tab-native.js +++ b/dist/components/tab-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Tab v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Tab v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -61,7 +61,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * Shortcut for `HTMLElement.getElementsByClassName` method. Some `Node` elements @@ -87,19 +87,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -222,32 +220,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -264,16 +236,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -544,6 +516,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -560,19 +533,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `collapsing` class. * As used by `Collapse` / `Tab`. @@ -750,7 +710,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -816,7 +776,6 @@ // TAB PRIVATE GC // ================ const tabSelector = `[${dataBsToggle}="${tabString}"]`; - const { on, off } = EventListener; /** * Static method which returns an existing `Tab` instance associated @@ -965,7 +924,7 @@ * @param {boolean=} add when `true`, event listener is added */ function toggleTabHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, tabClickHandler); } diff --git a/dist/components/toast-native.esm.js b/dist/components/toast-native.esm.js index 45cf840b..f2018992 100644 --- a/dist/components/toast-native.esm.js +++ b/dist/components/toast-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Toast v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Toast v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -79,7 +79,7 @@ function getDocument(node) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -91,19 +91,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -195,32 +193,6 @@ function getElementTransitionDuration(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -237,16 +209,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -517,6 +489,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -533,19 +506,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `fade` class. */ @@ -667,7 +627,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -737,7 +697,6 @@ const toastDismissSelector = `[${dataBsDismiss}="${toastString}"]`; const showingClass = 'showing'; /** @deprecated */ const hideClass = 'hide'; -const { on, off } = EventListener; const toastDefaults = { animation: true, @@ -838,7 +797,7 @@ function showToast(self) { * @param {boolean=} add when `true`, it will add the listener */ function toggleToastHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, dismiss, options } = self; if (dismiss) { action(dismiss, mouseclickEvent, self.hide); diff --git a/dist/components/toast-native.js b/dist/components/toast-native.js index 978516fc..086e45a6 100644 --- a/dist/components/toast-native.js +++ b/dist/components/toast-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Toast v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Toast v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -85,7 +85,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -97,19 +97,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -201,32 +199,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -243,16 +215,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -523,6 +495,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -539,19 +512,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `fade` class. */ @@ -673,7 +633,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -743,7 +703,6 @@ const showingClass = 'showing'; /** @deprecated */ const hideClass = 'hide'; - const { on, off } = EventListener; const toastDefaults = { animation: true, @@ -844,7 +803,7 @@ * @param {boolean=} add when `true`, it will add the listener */ function toggleToastHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, dismiss, options } = self; if (dismiss) { action(dismiss, mouseclickEvent, self.hide); diff --git a/dist/components/tooltip-native.esm.js b/dist/components/tooltip-native.esm.js index db36a6ef..39c6fa96 100644 --- a/dist/components/tooltip-native.esm.js +++ b/dist/components/tooltip-native.esm.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Tooltip v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Tooltip v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -217,7 +217,7 @@ function closest(element, selector) { /** * A global array of possible `ParentNode`. */ -const parentNodes = [Document, Node, Element, HTMLElement]; +const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -229,19 +229,17 @@ const elementNodes = [Element, HTMLElement]; * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -437,32 +435,6 @@ function getElementTransitionDelay(element) { return !Number.isNaN(duration) ? duration : 0; } -/** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); -} - -/** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ -function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); -} - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -479,16 +451,16 @@ function emulateTransitionEnd(element, handler) { if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -720,6 +692,7 @@ const removeListener = (element, eventType, listener, options) => { const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -736,19 +709,6 @@ const removeListener = (element, eventType, listener, options) => { } }; -/** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ -const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, -}; - /** * Global namespace for most components `toggle` option. */ @@ -1462,7 +1422,7 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } -var version = "4.1.0alpha4"; +var version = "4.1.0alpha5"; const Version = version; @@ -1529,7 +1489,6 @@ class BaseComponent { // ================== const tooltipSelector = `[${dataBsToggle}="${tooltipString}"],[data-tip="${tooltipString}"]`; const titleAttr = 'title'; -const { on, off } = EventListener; /** * Static method which returns an existing `Tooltip` instance associated @@ -1579,7 +1538,7 @@ function disposeTooltipComplete(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipAction(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element } = self; action(getDocument(element), touchstartEvent, tooltipTouchHandler, passiveHandler); @@ -1628,7 +1587,7 @@ function tooltipHiddenAction(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; // @ts-ignore -- btn is only for dismissible popover const { element, options, btn } = self; const { trigger, dismissible } = options; @@ -1673,7 +1632,7 @@ function toggleTooltipHandlers(self, add) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipOpenHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, options, offsetParent } = self; const { container } = options; const { offsetHeight, scrollHeight } = container; @@ -1690,8 +1649,8 @@ function toggleTooltipOpenHandlers(self, add) { } // dismiss tooltips inside modal / offcanvas - if (parentModal) on(parentModal, `hide.bs.${modalString}`, self.hide); - if (parentOffcanvas) on(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); + if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.hide); + if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); } /** diff --git a/dist/components/tooltip-native.js b/dist/components/tooltip-native.js index 6dc7cdf9..adf0b00f 100644 --- a/dist/components/tooltip-native.js +++ b/dist/components/tooltip-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap - Tooltip v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap - Tooltip v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2022 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -223,7 +223,7 @@ /** * A global array of possible `ParentNode`. */ - const parentNodes = [Document, Node, Element, HTMLElement]; + const parentNodes = [Document, Element, HTMLElement]; /** * A global array with `Element` | `HTMLElement`. @@ -235,19 +235,17 @@ * or find one that matches a selector. * * @param {HTMLElement | Element | string} selector the input selector or target element - * @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into + * @param {(HTMLElement | Element | Document)=} parent optional node to look into * @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result */ function querySelector(selector, parent) { - const selectorIsString = typeof selector === 'string'; - const lookUp = parent && parentNodes.some((x) => parent instanceof x) + const lookUp = parentNodes.some((x) => parent instanceof x) ? parent : getDocument(); - if (!selectorIsString && elementNodes.some((x) => selector instanceof x)) { - return selector; - } - // @ts-ignore -- `ShadowRoot` is also a node - return selectorIsString ? lookUp.querySelector(selector) : null; + // @ts-ignore + return elementNodes.some((x) => selector instanceof x) + // @ts-ignore + ? selector : lookUp.querySelector(selector); } /** @@ -443,32 +441,6 @@ return !Number.isNaN(duration) ? duration : 0; } - /** - * Add eventListener to an `Element` | `HTMLElement` | `Document` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function on$1(element, eventName, handler, options) { - const ops = options || false; - element.addEventListener(eventName, handler, ops); - } - - /** - * Remove eventListener from an `Element` | `HTMLElement` | `Document` | `Window` target. - * - * @param {HTMLElement | Element | Document | Window} element event.target - * @param {string} eventName event.type - * @param {EventListenerObject['handleEvent']} handler callback - * @param {(EventListenerOptions | boolean)=} options other event options - */ - function off$1(element, eventName, handler, options) { - const ops = options || false; - element.removeEventListener(eventName, handler, ops); - } - /** * Utility to make sure callbacks are consistently * called when transition ends. @@ -485,16 +457,16 @@ if (duration) { /** * Wrap the handler in on -> off callback - * @param {TransitionEvent} e Event object + * @type {EventListenerObject['handleEvent']} e Event object */ const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); - off$1(element, transitionEndEvent, transitionEndWrapper); + element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } }; - on$1(element, transitionEndEvent, transitionEndWrapper); + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); }, duration + delay + 17); @@ -726,6 +698,7 @@ const oneEventMap = EventRegistry[eventType]; const oneElementMap = oneEventMap && oneEventMap.get(element); const savedOptions = oneElementMap && oneElementMap.get(listener); + // also recover initial options const { options: eventOptions } = savedOptions !== undefined ? savedOptions @@ -742,19 +715,6 @@ } }; - /** - * Advanced event listener based on subscribe / publish pattern. - * @see https://www.patterns.dev/posts/classic-design-patterns/#observerpatternjavascript - * @see https://gist.github.com/shystruk/d16c0ee7ac7d194da9644e5d740c8338#file-subpub-js - * @see https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8 - */ - const EventListener = { - on: addListener, - off: removeListener, - globalListener, - registry: EventRegistry, - }; - /** * Global namespace for most components `toggle` option. */ @@ -1468,7 +1428,7 @@ return normalOps; } - var version = "4.1.0alpha4"; + var version = "4.1.0alpha5"; const Version = version; @@ -1535,7 +1495,6 @@ // ================== const tooltipSelector = `[${dataBsToggle}="${tooltipString}"],[data-tip="${tooltipString}"]`; const titleAttr = 'title'; - const { on, off } = EventListener; /** * Static method which returns an existing `Tooltip` instance associated @@ -1585,7 +1544,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipAction(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element } = self; action(getDocument(element), touchstartEvent, tooltipTouchHandler, passiveHandler); @@ -1634,7 +1593,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; // @ts-ignore -- btn is only for dismissible popover const { element, options, btn } = self; const { trigger, dismissible } = options; @@ -1679,7 +1638,7 @@ * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipOpenHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, options, offsetParent } = self; const { container } = options; const { offsetHeight, scrollHeight } = container; @@ -1696,8 +1655,8 @@ } // dismiss tooltips inside modal / offcanvas - if (parentModal) on(parentModal, `hide.bs.${modalString}`, self.hide); - if (parentOffcanvas) on(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); + if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.hide); + if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); } /** diff --git a/package.json b/package.json index 9b834b96..8f8c1cb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap.native", - "version": "4.1.0alpha4", + "version": "4.1.0alpha5", "description": "Native JavaScript for Bootstrap, the sweetest JavaScript library without jQuery.", "main": "dist/bootstrap-native.min.js", "types": "src/index.d.ts", @@ -81,8 +81,8 @@ "homepage": "https://thednp.github.io/bootstrap.native/", "dependencies": { "minifill": "^0.0.17", - "event-listener.js": "^0.0.4", - "shorter-js": "^0.3.0-alpha22" + "event-listener.js": "^0.0.5", + "shorter-js": "^0.3.0-alpha24" }, "devDependencies": { "@rollup/plugin-buble": "^0.21.3", diff --git a/src/components/alert-native.js b/src/components/alert-native.js index 8c982a34..81851907 100644 --- a/src/components/alert-native.js +++ b/src/components/alert-native.js @@ -12,7 +12,7 @@ import { getInstance } from 'shorter-js/src/misc/data'; import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; // import on from 'shorter-js/src/event/on'; // import off from 'shorter-js/src/event/off'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import fadeClass from '../strings/fadeClass'; import showClass from '../strings/showClass'; @@ -26,7 +26,6 @@ import BaseComponent from './base-component'; // ================ const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; -const { on, off } = EventListener; /** * Static method which returns an existing `Alert` instance associated @@ -71,7 +70,7 @@ function alertTransitionEnd(self) { * @param {boolean=} add when `true`, event listener is added */ function toggleAlertHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { dismiss } = self; if (dismiss) action(dismiss, mouseclickEvent, self.close); } diff --git a/src/components/button-native.js b/src/components/button-native.js index 78bee3dc..2edb9ef5 100644 --- a/src/components/button-native.js +++ b/src/components/button-native.js @@ -9,9 +9,7 @@ import hasClass from 'shorter-js/src/class/hasClass'; import removeClass from 'shorter-js/src/class/removeClass'; import { getInstance } from 'shorter-js/src/misc/data'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import activeClass from '../strings/activeClass'; import dataBsToggle from '../strings/dataBsToggle'; @@ -23,7 +21,6 @@ import BaseComponent from './base-component'; // BUTTON PRIVATE GC // ================= const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; -const { on, off } = EventListener; /** * Static method which returns an existing `Button` instance associated @@ -47,7 +44,7 @@ const buttonInitCallback = (element) => new Button(element); * @param {boolean=} add when `true`, event listener is added */ function toggleButtonHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, self.toggle); } diff --git a/src/components/carousel-native.js b/src/components/carousel-native.js index c970ae7b..baec5ade 100644 --- a/src/components/carousel-native.js +++ b/src/components/carousel-native.js @@ -9,8 +9,6 @@ import touchendEvent from 'shorter-js/src/strings/touchendEvent'; import touchstartEvent from 'shorter-js/src/strings/touchstartEvent'; import keyArrowLeft from 'shorter-js/src/strings/keyArrowLeft'; import keyArrowRight from 'shorter-js/src/strings/keyArrowRight'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; import getWindow from 'shorter-js/src/get/getWindow'; import getDocument from 'shorter-js/src/get/getDocument'; import getElementTransitionDuration from 'shorter-js/src/get/getElementTransitionDuration'; @@ -34,7 +32,7 @@ import addClass from 'shorter-js/src/class/addClass'; import hasClass from 'shorter-js/src/class/hasClass'; import removeClass from 'shorter-js/src/class/removeClass'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import activeClass from '../strings/activeClass'; import dataBsTarget from '../strings/dataBsTarget'; @@ -49,7 +47,6 @@ const carouselSelector = `[data-bs-ride="${carouselString}"]`; const carouselItem = `${carouselString}-item`; const dataBsSlideTo = 'data-bs-slide-to'; const dataBsSlide = 'data-bs-slide'; -const { on, off } = EventListener; const pausedClass = 'paused'; const carouselDefaults = { @@ -311,7 +308,7 @@ function activateCarouselIndicator(self, pageIndex) { */ function toggleCarouselTouchHandlers(self, add) { const { element } = self; - const action = add ? on : off; + const action = add ? addListener : removeListener; action(element, touchmoveEvent, carouselTouchMoveHandler, passiveHandler); action(element, touchendEvent, carouselTouchEndHandler, passiveHandler); } @@ -328,7 +325,7 @@ function toggleCarouselHandlers(self, add) { const { touch, pause, interval, keyboard, } = options; - const action = add ? on : off; + const action = add ? addListener : removeListener; if (pause && interval) { action(element, mouseenterEvent, carouselPauseHandler); diff --git a/src/components/collapse-native.js b/src/components/collapse-native.js index 843067ba..fbe71366 100644 --- a/src/components/collapse-native.js +++ b/src/components/collapse-native.js @@ -9,8 +9,6 @@ import reflow from 'shorter-js/src/misc/reflow'; import addClass from 'shorter-js/src/class/addClass'; import hasClass from 'shorter-js/src/class/hasClass'; import removeClass from 'shorter-js/src/class/removeClass'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; import mouseclickEvent from 'shorter-js/src/strings/mouseclickEvent'; import ariaExpanded from 'shorter-js/src/strings/ariaExpanded'; import ObjectAssign from 'shorter-js/src/misc/ObjectAssign'; @@ -19,7 +17,7 @@ import { getInstance } from 'shorter-js/src/misc/data'; import Timer from 'shorter-js/src/misc/timer'; import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import dataBsToggle from '../strings/dataBsToggle'; import collapsingClass from '../strings/collapsingClass'; @@ -35,7 +33,6 @@ import BaseComponent from './base-component'; const collapseSelector = `.${collapseString}`; const collapseToggleSelector = `[${dataBsToggle}="${collapseString}"]`; const collapseDefaults = { parent: null }; -const { on, off } = EventListener; /** * Static method which returns an existing `Collapse` instance associated @@ -148,7 +145,7 @@ function collapseContent(self) { * @param {boolean=} add when `true`, the event listener is added */ function toggleCollapseHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { diff --git a/src/components/dropdown-native.js b/src/components/dropdown-native.js index 13e3db79..8e4d8030 100644 --- a/src/components/dropdown-native.js +++ b/src/components/dropdown-native.js @@ -25,8 +25,6 @@ import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; import addClass from 'shorter-js/src/class/addClass'; import hasClass from 'shorter-js/src/class/hasClass'; import removeClass from 'shorter-js/src/class/removeClass'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; import isRTL from 'shorter-js/src/is/isRTL'; import getElementStyle from 'shorter-js/src/get/getElementStyle'; import getDocumentElement from 'shorter-js/src/get/getDocumentElement'; @@ -34,7 +32,7 @@ import getBoundingClientRect from 'shorter-js/src/get/getBoundingClientRect'; import getDocument from 'shorter-js/src/get/getDocument'; import getWindow from 'shorter-js/src/get/getWindow'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import showClass from '../strings/showClass'; import dataBsToggle from '../strings/dataBsToggle'; @@ -54,7 +52,6 @@ const [ dropendString, ] = dropdownClasses; const dropdownSelector = `[${dataBsToggle}="${dropdownString}"]`; -const { on, off } = EventListener; /** * Static method which returns an existing `Dropdown` instance associated @@ -230,7 +227,7 @@ function getMenuItems(menu) { */ function toggleDropdownDismiss(self) { const { element } = self; - const action = self.open ? on : off; + const action = self.open ? addListener : removeListener; const doc = getDocument(element); action(doc, mouseclickEvent, dropdownDismissHandler); @@ -253,7 +250,7 @@ function toggleDropdownDismiss(self) { * @param {boolean=} add when `true`, it will add the event listener */ function toggleDropdownHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, dropdownClickHandler); } diff --git a/src/components/modal-native.js b/src/components/modal-native.js index eab8b5fd..b70b8f0a 100644 --- a/src/components/modal-native.js +++ b/src/components/modal-native.js @@ -19,8 +19,6 @@ import closest from 'shorter-js/src/selectors/closest'; import addClass from 'shorter-js/src/class/addClass'; import hasClass from 'shorter-js/src/class/hasClass'; import removeClass from 'shorter-js/src/class/removeClass'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; import isRTL from 'shorter-js/src/is/isRTL'; import { getInstance } from 'shorter-js/src/misc/data'; import Timer from 'shorter-js/src/misc/timer'; @@ -31,7 +29,7 @@ import passiveHandler from 'shorter-js/src/misc/passiveHandler'; import emulateTransitionEnd from 'shorter-js/src/misc/emulateTransitionEnd'; import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import dataBsToggle from '../strings/dataBsToggle'; import dataBsDismiss from '../strings/dataBsDismiss'; @@ -62,7 +60,6 @@ const modalSelector = `.${modalString}`; const modalToggleSelector = `[${dataBsToggle}="${modalString}"]`; const modalDismissSelector = `[${dataBsDismiss}="${modalString}"]`; const modalStaticClass = `${modalString}-static`; -const { on, off } = EventListener; const modalDefaults = { backdrop: true, // boolean|string @@ -120,7 +117,7 @@ function setModalScrollbar(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleModalDismiss(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element } = self; action(element, mouseclickEvent, modalDismissHandler); // @ts-ignore @@ -134,7 +131,7 @@ function toggleModalDismiss(self, add) { * @param {boolean=} add when `true`, event listener is added */ function toggleModalHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { triggers } = self; if (triggers.length) { diff --git a/src/components/offcanvas-native.js b/src/components/offcanvas-native.js index 9a80a0a8..43de4fe3 100644 --- a/src/components/offcanvas-native.js +++ b/src/components/offcanvas-native.js @@ -11,8 +11,6 @@ import removeAttribute from 'shorter-js/src/attr/removeAttribute'; import querySelector from 'shorter-js/src/selectors/querySelector'; import querySelectorAll from 'shorter-js/src/selectors/querySelectorAll'; import closest from 'shorter-js/src/selectors/closest'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; import hasClass from 'shorter-js/src/class/hasClass'; import addClass from 'shorter-js/src/class/addClass'; import removeClass from 'shorter-js/src/class/removeClass'; @@ -27,7 +25,7 @@ import { getInstance } from 'shorter-js/src/misc/data'; import focus from 'shorter-js/src/misc/focus'; import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import dataBsDismiss from '../strings/dataBsDismiss'; import dataBsToggle from '../strings/dataBsToggle'; @@ -57,7 +55,6 @@ const offcanvasSelector = `.${offcanvasString}`; const offcanvasToggleSelector = `[${dataBsToggle}="${offcanvasString}"]`; const offcanvasDismissSelector = `[${dataBsDismiss}="${offcanvasString}"]`; const offcanvasTogglingClass = `${offcanvasString}-toggling`; -const { on, off } = EventListener; const offcanvasDefaults = { backdrop: true, // boolean @@ -107,7 +104,7 @@ function setOffCanvasScrollbar(self) { * @param {boolean=} add when *true*, listeners are added */ function toggleOffcanvasEvents(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; self.triggers.forEach((btn) => action(btn, mouseclickEvent, offcanvasTriggerHandler)); } @@ -118,7 +115,7 @@ function toggleOffcanvasEvents(self, add) { * @param {boolean=} add when *true* listeners are added */ function toggleOffCanvasDismiss(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const doc = getDocument(self.element); action(doc, keydownEvent, offcanvasKeyDismissHandler); action(doc, mouseclickEvent, offcanvasDismissHandler); diff --git a/src/components/scrollspy-native.js b/src/components/scrollspy-native.js index effe3ccc..81d889d3 100644 --- a/src/components/scrollspy-native.js +++ b/src/components/scrollspy-native.js @@ -11,8 +11,6 @@ import getDocument from 'shorter-js/src/get/getDocument'; import getDocumentElement from 'shorter-js/src/get/getDocumentElement'; import getDocumentBody from 'shorter-js/src/get/getDocumentBody'; import getBoundingClientRect from 'shorter-js/src/get/getBoundingClientRect'; -// import off from 'shorter-js/src/event/off'; -// import on from 'shorter-js/src/event/on'; import dispatchEvent from 'shorter-js/src/misc/dispatchEvent'; import passiveHandler from 'shorter-js/src/misc/passiveHandler'; import ObjectAssign from 'shorter-js/src/misc/ObjectAssign'; @@ -20,7 +18,7 @@ import scrollEvent from 'shorter-js/src/strings/scrollEvent'; import { getInstance } from 'shorter-js/src/misc/data'; import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import activeClass from '../strings/activeClass'; import scrollspyString from '../strings/scrollspyString'; @@ -33,7 +31,6 @@ import BaseComponent from './base-component'; // SCROLLSPY PRIVATE GC // ==================== const scrollspySelector = '[data-bs-spy="scroll"]'; -const { on, off } = EventListener; const scrollspyDefaults = { offset: 10, @@ -179,7 +176,7 @@ function activate(self, item) { * @param {boolean=} add when `true`, listener is added */ function toggleSpyHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; // @ts-ignore action(self.scrollTarget, scrollEvent, self.refresh, passiveHandler); } diff --git a/src/components/tab-native.js b/src/components/tab-native.js index ef027a85..93af76a5 100644 --- a/src/components/tab-native.js +++ b/src/components/tab-native.js @@ -9,8 +9,6 @@ import querySelector from 'shorter-js/src/selectors/querySelector'; import addClass from 'shorter-js/src/class/addClass'; import hasClass from 'shorter-js/src/class/hasClass'; import removeClass from 'shorter-js/src/class/removeClass'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; import dispatchEvent from 'shorter-js/src/misc/dispatchEvent'; import emulateTransitionEnd from 'shorter-js/src/misc/emulateTransitionEnd'; import reflow from 'shorter-js/src/misc/reflow'; @@ -19,7 +17,7 @@ import { getInstance } from 'shorter-js/src/misc/data'; import Timer from 'shorter-js/src/misc/timer'; import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import collapsingClass from '../strings/collapsingClass'; import activeClass from '../strings/activeClass'; @@ -37,7 +35,6 @@ import BaseComponent from './base-component'; // TAB PRIVATE GC // ================ const tabSelector = `[${dataBsToggle}="${tabString}"]`; -const { on, off } = EventListener; /** * Static method which returns an existing `Tab` instance associated @@ -186,7 +183,7 @@ function getActiveTab(self) { * @param {boolean=} add when `true`, event listener is added */ function toggleTabHandler(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; action(self.element, mouseclickEvent, tabClickHandler); } diff --git a/src/components/toast-native.js b/src/components/toast-native.js index 382770f9..ec0423eb 100644 --- a/src/components/toast-native.js +++ b/src/components/toast-native.js @@ -8,8 +8,6 @@ import focusoutEvent from 'shorter-js/src/strings/focusoutEvent'; import addClass from 'shorter-js/src/class/addClass'; import hasClass from 'shorter-js/src/class/hasClass'; import removeClass from 'shorter-js/src/class/removeClass'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; import querySelector from 'shorter-js/src/selectors/querySelector'; import dispatchEvent from 'shorter-js/src/misc/dispatchEvent'; import emulateTransitionEnd from 'shorter-js/src/misc/emulateTransitionEnd'; @@ -19,7 +17,7 @@ import { getInstance } from 'shorter-js/src/misc/data'; import Timer from 'shorter-js/src/misc/timer'; import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import fadeClass from '../strings/fadeClass'; import showClass from '../strings/showClass'; @@ -36,7 +34,6 @@ const toastDismissSelector = `[${dataBsDismiss}="${toastString}"]`; const showingClass = 'showing'; /** @deprecated */ const hideClass = 'hide'; -const { on, off } = EventListener; const toastDefaults = { animation: true, @@ -137,7 +134,7 @@ function showToast(self) { * @param {boolean=} add when `true`, it will add the listener */ function toggleToastHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, dismiss, options } = self; if (dismiss) { action(dismiss, mouseclickEvent, self.hide); diff --git a/src/components/tooltip-native.js b/src/components/tooltip-native.js index 8f19f726..ebc2af11 100644 --- a/src/components/tooltip-native.js +++ b/src/components/tooltip-native.js @@ -26,8 +26,6 @@ import querySelector from 'shorter-js/src/selectors/querySelector'; import addClass from 'shorter-js/src/class/addClass'; import hasClass from 'shorter-js/src/class/hasClass'; import removeClass from 'shorter-js/src/class/removeClass'; -// import on from 'shorter-js/src/event/on'; -// import off from 'shorter-js/src/event/off'; import ObjectAssign from 'shorter-js/src/misc/ObjectAssign'; import { getInstance } from 'shorter-js/src/misc/data'; import isMedia from 'shorter-js/src/is/isMedia'; @@ -41,7 +39,7 @@ import focus from 'shorter-js/src/misc/focus'; import OriginalEvent from 'shorter-js/src/misc/OriginalEvent'; import toLowerCase from 'shorter-js/src/misc/toLowerCase'; -import EventListener from 'event-listener.js'; +import { addListener, removeListener } from 'event-listener.js'; import dataBsToggle from '../strings/dataBsToggle'; import dataOriginalTitle from '../strings/dataOriginalTitle'; @@ -64,7 +62,6 @@ import BaseComponent from './base-component'; // ================== const tooltipSelector = `[${dataBsToggle}="${tooltipString}"],[data-tip="${tooltipString}"]`; const titleAttr = 'title'; -const { on, off } = EventListener; /** * Static method which returns an existing `Tooltip` instance associated @@ -114,7 +111,7 @@ function disposeTooltipComplete(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipAction(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element } = self; action(getDocument(element), touchstartEvent, tooltipTouchHandler, passiveHandler); @@ -163,7 +160,7 @@ function tooltipHiddenAction(self) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; // @ts-ignore -- btn is only for dismissible popover const { element, options, btn } = self; const { trigger, dismissible } = options; @@ -208,7 +205,7 @@ function toggleTooltipHandlers(self, add) { * @param {boolean=} add when `true`, event listeners are added */ function toggleTooltipOpenHandlers(self, add) { - const action = add ? on : off; + const action = add ? addListener : removeListener; const { element, options, offsetParent } = self; const { container } = options; const { offsetHeight, scrollHeight } = container; @@ -225,8 +222,8 @@ function toggleTooltipOpenHandlers(self, add) { } // dismiss tooltips inside modal / offcanvas - if (parentModal) on(parentModal, `hide.bs.${modalString}`, self.hide); - if (parentOffcanvas) on(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); + if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.hide); + if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); } /** diff --git a/src/index.js b/src/index.js index 287f2329..0c91df5c 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ +import EventListener from 'event-listener.js/src/event-listener'; + import Alert from './components/alert-native'; import Button from './components/button-native'; import Carousel from './components/carousel-native'; @@ -31,6 +33,7 @@ const BSN = { initCallback, removeDataAPI, Version, + EventListener, }; export default BSN; diff --git a/src/util/init.js b/src/util/init.js index 8598c046..9ff416d8 100644 --- a/src/util/init.js +++ b/src/util/init.js @@ -1,10 +1,11 @@ -import one from 'shorter-js/src/event/one'; import Data from 'shorter-js/src/misc/data'; import ObjectKeys from 'shorter-js/src/misc/ObjectKeys'; import parentNodes from 'shorter-js/src/selectors/parentNodes'; import getElementsByTagName from 'shorter-js/src/selectors/getElementsByTagName'; import matches from 'shorter-js/src/selectors/matches'; +import { addListener } from 'event-listener.js'; + import Alert from '../components/alert-native'; import Button from '../components/button-native'; import Carousel from '../components/carousel-native'; @@ -90,5 +91,5 @@ export function removeDataAPI(context) { // bulk initialize all components if (document.body) initCallback(); else { - one(document, 'DOMContentLoaded', () => initCallback()); + addListener(document, 'DOMContentLoaded', () => initCallback(), { once: true }); }