fwtrash/public/js/bootstrap-native.min.js

3 lines
39 KiB
JavaScript
Raw Normal View History

2022-12-20 11:21:31 +00:00
// Native JavaScript for Bootstrap v4.2.0 | 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]].forEach(t=>{const[i,a]=t;i===n&&[...a].forEach(t=>{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.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.includes("--")?n.getPropertyValue(e):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}const r=(t,e)=>t.dispatchEvent(e);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||r(t,o)},s+l+17)}else e.apply(t,[o])}const c=t=>t&&[1,2,3,4,5,6,7,8,9,10,11].some(e=>+t.nodeType===e)||!1,d=t=>t&&"Window"===t.constructor.name||!1,h=t=>t&&9===t.nodeType||!1;function u(t){return h(t)?t:c(t)?t.ownerDocument:d(t)?t.document:window.document}function f(t,e){if(c(t))return t;return(c(e)?e:u()).querySelector(t)}function p(t,e){return t?t.closest(e)||p(t.getRootNode().host,e):null}const g=(t,e)=>Object.assign(t,e);function m(t,e){return t.classList.contains(e)}function v(t,e){t.classList.remove(e)}const b=t=>t&&1===t.nodeType||!1,w=new Map,y={set:(t,e,n)=>{if(!b(t))return;w.has(e)||w.set(e,new Map);w.get(e).set(t,n)},getAllFor:t=>w.get(t)||null,get:(t,e)=>{if(!b(t)||!e)return null;const n=y.getAllFor(e);return t&&n&&n.get(t)||null},remove:(t,e)=>{const n=w.get(e);n&&b(t)&&(n.delete(t),0===n.size&&w.delete(e))}},T=(t,e)=>y.get(t,e);function x(t,e){const n=new CustomEvent(t,{cancelable:!0,bubbles:!0});return"object"==typeof e&&g(n,e),n}const E=(t,e)=>t.getAttribute(e);function A(t){return!!["true",!0].includes(t)||!["false",!1].includes(t)&&(""===t||"null"===t?null:""===t||Number.isNaN(+t)?t:+t)}const N=t=>Object.keys(t),k=t=>t.toLowerCase();class P{constructor(t,e){const n=this,o=f(t);if(!o)throw Error(`${n.name} Error: "${t}" is not a valid selector.`);n.options={};const s=y.get(o,n.name);s&&s.dispose(),n.element=o,n.defaults&&N(n.defaults).length&&(n.options=function(t,e,n,o){const s={...t.dataset},i={},a={};return N(s).forEach(t=>{const e=o&&t.includes(o)?t.replace(o,"").replace(/[A-Z]/,t=>k(t)):t;a[e]=A(s[t])}),N(n).forEach(t=>{n[t]=A(n[t])}),N(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")),y.set(o,n.name,n)}get version(){return"4.2.0"}get name(){return this.constructor.name}get defaults(){return this.constructor.defaults}dispose(){const t=this;y.remove(t.element,t.name),N(t).forEach(e=>{t[e]=null})}}const $=t=>T(t,"Alert"),H=x("close.bs.alert"),S=x("closed.bs.alert");function D(t){const{element:e}=t;C(t),r(e,S),t.dispose(),e.remove()}function C(t,e){const s=e?n:o,{dismiss:i}=t;i&&s(i,"click",t.close)}class M extends P{constructor(t){super(t);const{element:e}=this;this.dismiss=f('[data-bs-dismiss="alert"]',e),C(this,!0)}get name(){return"Alert"}close(t){const e=t?$(p(this,".alert")):this,{element:n}=e;if(n&&m(n,"show")){if(r(n,H),H.defaultPrevented)return;v(n,"show"),m(n,"fade")?l(n,()=>D(e)):D(e)}}dispose(){C(this),super.dispose()}}g(M,{selector:".alert",init:t=>new M(t),getInstance:$});const L=(t,e,n)=>t.setAttribute(e,n);function I(t,e){t.classList.add(e)}const R="data-bs-toggle",F=`[${R}="button"]`,O=t=>T(t,"B