UNPKG

@trumpetstech/bootwind

Version:

Utility and component-centric design system based on Bootstrap for fast, responsive UI development.

1,252 lines (1,228 loc) 285 kB
// modules are defined as an array // [ module function, map of requires ] // // map of requires is short require name -> numeric require // // anything defined in a previous bundle is accessed via the // orig method which is the require for previous bundles (function (modules, entry, mainEntry, parcelRequireName, globalName) { /* eslint-disable no-undef */ var globalObject = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; /* eslint-enable no-undef */ // Save the require from previous bundle to this closure if any var previousRequire = typeof globalObject[parcelRequireName] === 'function' && globalObject[parcelRequireName]; var cache = previousRequire.cache || {}; // Do not use `require` to prevent Webpack from trying to bundle this call var nodeRequire = typeof module !== 'undefined' && typeof module.require === 'function' && module.require.bind(module); function newRequire(name, jumped) { if (!cache[name]) { if (!modules[name]) { // if we cannot find the module within our internal map or // cache jump to the current global require ie. the last bundle // that was added to the page. var currentRequire = typeof globalObject[parcelRequireName] === 'function' && globalObject[parcelRequireName]; if (!jumped && currentRequire) { return currentRequire(name, true); } // If there are other bundles on this page the require from the // previous one is saved to 'previousRequire'. Repeat this as // many times as there are bundles until the module is found or // we exhaust the require chain. if (previousRequire) { return previousRequire(name, true); } // Try the node require function if it exists. if (nodeRequire && typeof name === 'string') { return nodeRequire(name); } var err = new Error("Cannot find module '" + name + "'"); err.code = 'MODULE_NOT_FOUND'; throw err; } localRequire.resolve = resolve; localRequire.cache = {}; var module = (cache[name] = new newRequire.Module(name)); modules[name][0].call( module.exports, localRequire, module, module.exports, this ); } return cache[name].exports; function localRequire(x) { var res = localRequire.resolve(x); return res === false ? {} : newRequire(res); } function resolve(x) { var id = modules[name][1][x]; return id != null ? id : x; } } function Module(moduleName) { this.id = moduleName; this.bundle = newRequire; this.exports = {}; } newRequire.isParcelRequire = true; newRequire.Module = Module; newRequire.modules = modules; newRequire.cache = cache; newRequire.parent = previousRequire; newRequire.register = function (id, exports) { modules[id] = [ function (require, module) { module.exports = exports; }, {}, ]; }; Object.defineProperty(newRequire, 'root', { get: function () { return globalObject[parcelRequireName]; }, }); globalObject[parcelRequireName] = newRequire; for (var i = 0; i < entry.length; i++) { newRequire(entry[i]); } if (mainEntry) { // Expose entry point to Node, AMD or browser globals // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js var mainExports = newRequire(mainEntry); // CommonJS if (typeof exports === 'object' && typeof module !== 'undefined') { module.exports = mainExports; // RequireJS } else if (typeof define === 'function' && define.amd) { define(function () { return mainExports; }); // <script> } else if (globalName) { this[globalName] = mainExports; } } })({"jQVXF":[function(require,module,exports) { "use strict"; var global = arguments[3]; var HMR_HOST = null; var HMR_PORT = null; var HMR_SECURE = false; var HMR_ENV_HASH = "d6ea1d42532a7575"; module.bundle.HMR_BUNDLE_ID = "0bcb44a518dbc454"; /* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, chrome, browser, globalThis, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ /*:: import type { HMRAsset, HMRMessage, } from '@parcel/reporter-dev-server/src/HMRServer.js'; interface ParcelRequire { (string): mixed; cache: {|[string]: ParcelModule|}; hotData: mixed; Module: any; parent: ?ParcelRequire; isParcelRequire: true; modules: {|[string]: [Function, {|[string]: string|}]|}; HMR_BUNDLE_ID: string; root: ParcelRequire; } interface ParcelModule { hot: {| data: mixed, accept(cb: (Function) => void): void, dispose(cb: (mixed) => void): void, // accept(deps: Array<string> | string, cb: (Function) => void): void, // decline(): void, _acceptCallbacks: Array<(Function) => void>, _disposeCallbacks: Array<(mixed) => void>, |}; } interface ExtensionContext { runtime: {| reload(): void, getURL(url: string): string; getManifest(): {manifest_version: number, ...}; |}; } declare var module: {bundle: ParcelRequire, ...}; declare var HMR_HOST: string; declare var HMR_PORT: string; declare var HMR_ENV_HASH: string; declare var HMR_SECURE: boolean; declare var chrome: ExtensionContext; declare var browser: ExtensionContext; declare var __parcel__import__: (string) => Promise<void>; declare var __parcel__importScripts__: (string) => Promise<void>; declare var globalThis: typeof self; declare var ServiceWorkerGlobalScope: Object; */ var OVERLAY_ID = "__parcel__error__overlay__"; var OldModule = module.bundle.Module; function Module(moduleName) { OldModule.call(this, moduleName); this.hot = { data: module.bundle.hotData, _acceptCallbacks: [], _disposeCallbacks: [], accept: function(fn) { this._acceptCallbacks.push(fn || function() {}); }, dispose: function(fn) { this._disposeCallbacks.push(fn); } }; module.bundle.hotData = undefined; } module.bundle.Module = Module; var checkedAssets, acceptedAssets, assetsToAccept /*: Array<[ParcelRequire, string]> */ ; function getHostname() { return HMR_HOST || (location.protocol.indexOf("http") === 0 ? location.hostname : "localhost"); } function getPort() { return HMR_PORT || location.port; } // eslint-disable-next-line no-redeclare var parent = module.bundle.parent; if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== "undefined") { var hostname = getHostname(); var port = getPort(); var protocol = HMR_SECURE || location.protocol == "https:" && !/localhost|127.0.0.1|0.0.0.0/.test(hostname) ? "wss" : "ws"; var ws = new WebSocket(protocol + "://" + hostname + (port ? ":" + port : "") + "/"); // Web extension context var extCtx = typeof chrome === "undefined" ? typeof browser === "undefined" ? null : browser : chrome; // Safari doesn't support sourceURL in error stacks. // eval may also be disabled via CSP, so do a quick check. var supportsSourceURL = false; try { (0, eval)('throw new Error("test"); //# sourceURL=test.js'); } catch (err) { supportsSourceURL = err.stack.includes("test.js"); } // $FlowFixMe ws.onmessage = async function(event) { checkedAssets = {} /*: {|[string]: boolean|} */ ; acceptedAssets = {} /*: {|[string]: boolean|} */ ; assetsToAccept = []; var data = JSON.parse(event.data); if (data.type === "update") { // Remove error overlay if there is one if (typeof document !== "undefined") removeErrorOverlay(); let assets = data.assets.filter((asset)=>asset.envHash === HMR_ENV_HASH); // Handle HMR Update let handled = assets.every((asset)=>{ return asset.type === "css" || asset.type === "js" && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle); }); if (handled) { console.clear(); // Dispatch custom event so other runtimes (e.g React Refresh) are aware. if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") window.dispatchEvent(new CustomEvent("parcelhmraccept")); await hmrApplyUpdates(assets); for(var i = 0; i < assetsToAccept.length; i++){ var id = assetsToAccept[i][1]; if (!acceptedAssets[id]) hmrAcceptRun(assetsToAccept[i][0], id); } } else fullReload(); } if (data.type === "error") { // Log parcel errors to console for (let ansiDiagnostic of data.diagnostics.ansi){ let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack; console.error("\uD83D\uDEA8 [parcel]: " + ansiDiagnostic.message + "\n" + stack + "\n\n" + ansiDiagnostic.hints.join("\n")); } if (typeof document !== "undefined") { // Render the fancy html overlay removeErrorOverlay(); var overlay = createErrorOverlay(data.diagnostics.html); // $FlowFixMe document.body.appendChild(overlay); } } }; ws.onerror = function(e) { console.error(e.message); }; ws.onclose = function() { console.warn("[parcel] \uD83D\uDEA8 Connection to the HMR server was lost"); }; } function removeErrorOverlay() { var overlay = document.getElementById(OVERLAY_ID); if (overlay) { overlay.remove(); console.log("[parcel] ✨ Error resolved"); } } function createErrorOverlay(diagnostics) { var overlay = document.createElement("div"); overlay.id = OVERLAY_ID; let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">'; for (let diagnostic of diagnostics){ let stack = diagnostic.frames.length ? diagnostic.frames.reduce((p, frame)=>{ return `${p} <a href="/__parcel_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a> ${frame.code}`; }, "") : diagnostic.stack; errorHTML += ` <div> <div style="font-size: 18px; font-weight: bold; margin-top: 20px;"> 🚨 ${diagnostic.message} </div> <pre>${stack}</pre> <div> ${diagnostic.hints.map((hint)=>"<div>\uD83D\uDCA1 " + hint + "</div>").join("")} </div> ${diagnostic.documentation ? `<div>📝 <a style="color: violet" href="${diagnostic.documentation}" target="_blank">Learn more</a></div>` : ""} </div> `; } errorHTML += "</div>"; overlay.innerHTML = errorHTML; return overlay; } function fullReload() { if ("reload" in location) location.reload(); else if (extCtx && extCtx.runtime && extCtx.runtime.reload) extCtx.runtime.reload(); } function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ { var modules = bundle.modules; if (!modules) return []; var parents = []; var k, d, dep; for(k in modules)for(d in modules[k][1]){ dep = modules[k][1][d]; if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) parents.push([ bundle, k ]); } if (bundle.parent) parents = parents.concat(getParents(bundle.parent, id)); return parents; } function updateLink(link) { var newLink = link.cloneNode(); newLink.onload = function() { if (link.parentNode !== null) // $FlowFixMe link.parentNode.removeChild(link); }; newLink.setAttribute("href", link.getAttribute("href").split("?")[0] + "?" + Date.now()); // $FlowFixMe link.parentNode.insertBefore(newLink, link.nextSibling); } var cssTimeout = null; function reloadCSS() { if (cssTimeout) return; cssTimeout = setTimeout(function() { var links = document.querySelectorAll('link[rel="stylesheet"]'); for(var i = 0; i < links.length; i++){ // $FlowFixMe[incompatible-type] var href = links[i].getAttribute("href"); var hostname = getHostname(); var servedFromHMRServer = hostname === "localhost" ? new RegExp("^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):" + getPort()).test(href) : href.indexOf(hostname + ":" + getPort()); var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer; if (!absolute) updateLink(links[i]); } cssTimeout = null; }, 50); } function hmrDownload(asset) { if (asset.type === "js") { if (typeof document !== "undefined") { let script = document.createElement("script"); script.src = asset.url + "?t=" + Date.now(); if (asset.outputFormat === "esmodule") script.type = "module"; return new Promise((resolve, reject)=>{ var _document$head; script.onload = ()=>resolve(script); script.onerror = reject; (_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script); }); } else if (typeof importScripts === "function") { // Worker scripts if (asset.outputFormat === "esmodule") return import(asset.url + "?t=" + Date.now()); else return new Promise((resolve, reject)=>{ try { importScripts(asset.url + "?t=" + Date.now()); resolve(); } catch (err) { reject(err); } }); } } } async function hmrApplyUpdates(assets) { global.parcelHotUpdate = Object.create(null); let scriptsToRemove; try { // If sourceURL comments aren't supported in eval, we need to load // the update from the dev server over HTTP so that stack traces // are correct in errors/logs. This is much slower than eval, so // we only do it if needed (currently just Safari). // https://bugs.webkit.org/show_bug.cgi?id=137297 // This path is also taken if a CSP disallows eval. if (!supportsSourceURL) { let promises = assets.map((asset)=>{ var _hmrDownload; return (_hmrDownload = hmrDownload(asset)) === null || _hmrDownload === void 0 ? void 0 : _hmrDownload.catch((err)=>{ // Web extension bugfix for Chromium // https://bugs.chromium.org/p/chromium/issues/detail?id=1255412#c12 if (extCtx && extCtx.runtime && extCtx.runtime.getManifest().manifest_version == 3) { if (typeof ServiceWorkerGlobalScope != "undefined" && global instanceof ServiceWorkerGlobalScope) { extCtx.runtime.reload(); return; } asset.url = extCtx.runtime.getURL("/__parcel_hmr_proxy__?url=" + encodeURIComponent(asset.url + "?t=" + Date.now())); return hmrDownload(asset); } throw err; }); }); scriptsToRemove = await Promise.all(promises); } assets.forEach(function(asset) { hmrApply(module.bundle.root, asset); }); } finally{ delete global.parcelHotUpdate; if (scriptsToRemove) scriptsToRemove.forEach((script)=>{ if (script) { var _document$head2; (_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script); } }); } } function hmrApply(bundle, asset) { var modules = bundle.modules; if (!modules) return; if (asset.type === "css") reloadCSS(); else if (asset.type === "js") { let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID]; if (deps) { if (modules[asset.id]) { // Remove dependencies that are removed and will become orphaned. // This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload. let oldDeps = modules[asset.id][1]; for(let dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) { let id = oldDeps[dep]; let parents = getParents(module.bundle.root, id); if (parents.length === 1) hmrDelete(module.bundle.root, id); } } if (supportsSourceURL) // Global eval. We would use `new Function` here but browser // support for source maps is better with eval. (0, eval)(asset.output); // $FlowFixMe let fn = global.parcelHotUpdate[asset.id]; modules[asset.id] = [ fn, deps ]; } else if (bundle.parent) hmrApply(bundle.parent, asset); } } function hmrDelete(bundle, id) { let modules = bundle.modules; if (!modules) return; if (modules[id]) { // Collect dependencies that will become orphaned when this module is deleted. let deps = modules[id][1]; let orphans = []; for(let dep in deps){ let parents = getParents(module.bundle.root, deps[dep]); if (parents.length === 1) orphans.push(deps[dep]); } // Delete the module. This must be done before deleting dependencies in case of circular dependencies. delete modules[id]; delete bundle.cache[id]; // Now delete the orphans. orphans.forEach((id)=>{ hmrDelete(module.bundle.root, id); }); } else if (bundle.parent) hmrDelete(bundle.parent, id); } function hmrAcceptCheck(bundle, id, depsByBundle) { if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true; // Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload. let parents = getParents(module.bundle.root, id); let accepted = false; while(parents.length > 0){ let v = parents.shift(); let a = hmrAcceptCheckOne(v[0], v[1], null); if (a) // If this parent accepts, stop traversing upward, but still consider siblings. accepted = true; else { // Otherwise, queue the parents in the next level upward. let p = getParents(module.bundle.root, v[1]); if (p.length === 0) { // If there are no parents, then we've reached an entry without accepting. Reload. accepted = false; break; } parents.push(...p); } } return accepted; } function hmrAcceptCheckOne(bundle, id, depsByBundle) { var modules = bundle.modules; if (!modules) return; if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) { // If we reached the root bundle without finding where the asset should go, // there's nothing to do. Mark as "accepted" so we don't reload the page. if (!bundle.parent) return true; return hmrAcceptCheck(bundle.parent, id, depsByBundle); } if (checkedAssets[id]) return true; checkedAssets[id] = true; var cached = bundle.cache[id]; assetsToAccept.push([ bundle, id ]); if (!cached || cached.hot && cached.hot._acceptCallbacks.length) return true; } function hmrAcceptRun(bundle, id) { var cached = bundle.cache[id]; bundle.hotData = {}; if (cached && cached.hot) cached.hot.data = bundle.hotData; if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) { cb(bundle.hotData); }); delete bundle.cache[id]; bundle(id); cached = bundle.cache[id]; if (cached && cached.hot && cached.hot._acceptCallbacks.length) cached.hot._acceptCallbacks.forEach(function(cb) { var assetsToAlsoAccept = cb(function() { return getParents(module.bundle.root, id); }); if (assetsToAlsoAccept && assetsToAccept.length) // $FlowFixMe[method-unbinding] assetsToAccept.push.apply(assetsToAccept, assetsToAlsoAccept); }); acceptedAssets[id] = true; } },{}],"1SICI":[function(require,module,exports) { // Import only the Bootstrap components we need var _bootstrap = require("bootstrap"); // Create an example popover document.querySelectorAll('[data-bs-toggle="popover"]').forEach((popover)=>{ new (0, _bootstrap.Popover)(popover); }); },{"bootstrap":"h36JB"}],"h36JB":[function(require,module,exports) { var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); parcelHelpers.defineInteropFlag(exports); parcelHelpers.export(exports, "Alert", ()=>Alert); parcelHelpers.export(exports, "Button", ()=>Button); parcelHelpers.export(exports, "Carousel", ()=>Carousel); parcelHelpers.export(exports, "Collapse", ()=>Collapse); parcelHelpers.export(exports, "Dropdown", ()=>Dropdown); parcelHelpers.export(exports, "Modal", ()=>Modal); parcelHelpers.export(exports, "Offcanvas", ()=>Offcanvas); parcelHelpers.export(exports, "Popover", ()=>Popover); parcelHelpers.export(exports, "ScrollSpy", ()=>ScrollSpy); parcelHelpers.export(exports, "Tab", ()=>Tab); parcelHelpers.export(exports, "Toast", ()=>Toast); parcelHelpers.export(exports, "Tooltip", ()=>Tooltip); /*! * Bootstrap v5.2.2 (https://getbootstrap.com/) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ var _core = require("@popperjs/core"); /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): util/index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const MAX_UID = 1000000; const MILLISECONDS_MULTIPLIER = 1000; const TRANSITION_END = "transitionend"; // Shout-out Angus Croll (https://goo.gl/pxwQGp) const toType = (object)=>{ if (object === null || object === undefined) return `${object}`; return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase(); }; /** * Public Util API */ const getUID = (prefix)=>{ do prefix += Math.floor(Math.random() * MAX_UID); while (document.getElementById(prefix)); return prefix; }; const getSelector = (element)=>{ let selector = element.getAttribute("data-bs-target"); if (!selector || selector === "#") { let hrefAttribute = element.getAttribute("href"); // The only valid content that could double as a selector are IDs or classes, // so everything starting with `#` or `.`. If a "real" URL is used as the selector, // `document.querySelector` will rightfully complain it is invalid. // See https://github.com/twbs/bootstrap/issues/32273 if (!hrefAttribute || !hrefAttribute.includes("#") && !hrefAttribute.startsWith(".")) return null; // Just in case some CMS puts out a full URL with the anchor appended if (hrefAttribute.includes("#") && !hrefAttribute.startsWith("#")) hrefAttribute = `#${hrefAttribute.split("#")[1]}`; selector = hrefAttribute && hrefAttribute !== "#" ? hrefAttribute.trim() : null; } return selector; }; const getSelectorFromElement = (element)=>{ const selector = getSelector(element); if (selector) return document.querySelector(selector) ? selector : null; return null; }; const getElementFromSelector = (element)=>{ const selector = getSelector(element); return selector ? document.querySelector(selector) : null; }; const getTransitionDurationFromElement = (element)=>{ if (!element) return 0; // Get transition-duration of the element let { transitionDuration , transitionDelay } = window.getComputedStyle(element); const floatTransitionDuration = Number.parseFloat(transitionDuration); const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found if (!floatTransitionDuration && !floatTransitionDelay) return 0; // If multiple durations are defined, take the first transitionDuration = transitionDuration.split(",")[0]; transitionDelay = transitionDelay.split(",")[0]; return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; }; const triggerTransitionEnd = (element)=>{ element.dispatchEvent(new Event(TRANSITION_END)); }; const isElement = (object)=>{ if (!object || typeof object !== "object") return false; if (typeof object.jquery !== "undefined") object = object[0]; return typeof object.nodeType !== "undefined"; }; const getElement = (object)=>{ // it's a jQuery object or a node element if (isElement(object)) return object.jquery ? object[0] : object; if (typeof object === "string" && object.length > 0) return document.querySelector(object); return null; }; const isVisible = (element)=>{ if (!isElement(element) || element.getClientRects().length === 0) return false; const elementIsVisible = getComputedStyle(element).getPropertyValue("visibility") === "visible"; // Handle `details` element as its content may falsie appear visible when it is closed const closedDetails = element.closest("details:not([open])"); if (!closedDetails) return elementIsVisible; if (closedDetails !== element) { const summary = element.closest("summary"); if (summary && summary.parentNode !== closedDetails) return false; if (summary === null) return false; } return elementIsVisible; }; const isDisabled = (element)=>{ if (!element || element.nodeType !== Node.ELEMENT_NODE) return true; if (element.classList.contains("disabled")) return true; if (typeof element.disabled !== "undefined") return element.disabled; return element.hasAttribute("disabled") && element.getAttribute("disabled") !== "false"; }; const findShadowRoot = (element)=>{ if (!document.documentElement.attachShadow) return null; // Can find the shadow root otherwise it'll return the document if (typeof element.getRootNode === "function") { const root = element.getRootNode(); return root instanceof ShadowRoot ? root : null; } if (element instanceof ShadowRoot) return element; // when we don't find a shadow root if (!element.parentNode) return null; return findShadowRoot(element.parentNode); }; const noop = ()=>{}; /** * Trick to restart an element's animation * * @param {HTMLElement} element * @return void * * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation */ const reflow = (element)=>{ element.offsetHeight; // eslint-disable-line no-unused-expressions }; const getjQuery = ()=>{ if (window.jQuery && !document.body.hasAttribute("data-bs-no-jquery")) return window.jQuery; return null; }; const DOMContentLoadedCallbacks = []; const onDOMContentLoaded = (callback)=>{ if (document.readyState === "loading") { // add listener on the first call when the document is in loading state if (!DOMContentLoadedCallbacks.length) document.addEventListener("DOMContentLoaded", ()=>{ for (const callback of DOMContentLoadedCallbacks)callback(); }); DOMContentLoadedCallbacks.push(callback); } else callback(); }; const isRTL = ()=>document.documentElement.dir === "rtl"; const defineJQueryPlugin = (plugin)=>{ onDOMContentLoaded(()=>{ const $ = getjQuery(); /* istanbul ignore if */ if ($) { const name = plugin.NAME; const JQUERY_NO_CONFLICT = $.fn[name]; $.fn[name] = plugin.jQueryInterface; $.fn[name].Constructor = plugin; $.fn[name].noConflict = ()=>{ $.fn[name] = JQUERY_NO_CONFLICT; return plugin.jQueryInterface; }; } }); }; const execute = (callback)=>{ if (typeof callback === "function") callback(); }; const executeAfterTransition = (callback, transitionElement, waitForTransition = true)=>{ if (!waitForTransition) { execute(callback); return; } const durationPadding = 5; const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding; let called = false; const handler = ({ target })=>{ if (target !== transitionElement) return; called = true; transitionElement.removeEventListener(TRANSITION_END, handler); execute(callback); }; transitionElement.addEventListener(TRANSITION_END, handler); setTimeout(()=>{ if (!called) triggerTransitionEnd(transitionElement); }, emulatedDuration); }; /** * Return the previous/next element of a list. * * @param {array} list The list of elements * @param activeElement The active element * @param shouldGetNext Choose to get next or previous element * @param isCycleAllowed * @return {Element|elem} The proper element */ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed)=>{ const listLength = list.length; let index = list.indexOf(activeElement); // if the element does not exist in the list return an element // depending on the direction and if cycle is allowed if (index === -1) return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]; index += shouldGetNext ? 1 : -1; if (isCycleAllowed) index = (index + listLength) % listLength; return list[Math.max(0, Math.min(index, listLength - 1))]; }; /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): dom/event-handler.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * Constants */ const namespaceRegex = /[^.]*(?=\..*)\.|.*/; const stripNameRegex = /\..*/; const stripUidRegex = /::\d+$/; const eventRegistry = {}; // Events storage let uidEvent = 1; const customEvents = { mouseenter: "mouseover", mouseleave: "mouseout" }; const nativeEvents = new Set([ "click", "dblclick", "mouseup", "mousedown", "contextmenu", "mousewheel", "DOMMouseScroll", "mouseover", "mouseout", "mousemove", "selectstart", "selectend", "keydown", "keypress", "keyup", "orientationchange", "touchstart", "touchmove", "touchend", "touchcancel", "pointerdown", "pointermove", "pointerup", "pointerleave", "pointercancel", "gesturestart", "gesturechange", "gestureend", "focus", "blur", "change", "reset", "select", "submit", "focusin", "focusout", "load", "unload", "beforeunload", "resize", "move", "DOMContentLoaded", "readystatechange", "error", "abort", "scroll" ]); /** * Private methods */ function makeEventUid(element, uid) { return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; } function getElementEvents(element) { const uid = makeEventUid(element); element.uidEvent = uid; eventRegistry[uid] = eventRegistry[uid] || {}; return eventRegistry[uid]; } function bootstrapHandler(element, fn) { return function handler(event) { hydrateObj(event, { delegateTarget: element }); if (handler.oneOff) EventHandler.off(element, event.type, fn); return fn.apply(element, [ event ]); }; } function bootstrapDelegationHandler(element, selector, fn) { return function handler(event) { const domElements = element.querySelectorAll(selector); for(let { target } = event; target && target !== this; target = target.parentNode)for (const domElement of domElements){ if (domElement !== target) continue; hydrateObj(event, { delegateTarget: target }); if (handler.oneOff) EventHandler.off(element, event.type, selector, fn); return fn.apply(target, [ event ]); } }; } function findHandler(events, callable, delegationSelector = null) { return Object.values(events).find((event)=>event.callable === callable && event.delegationSelector === delegationSelector); } function normalizeParameters(originalTypeEvent, handler, delegationFunction) { const isDelegated = typeof handler === "string"; // todo: tooltip passes `false` instead of selector, so we need to check const callable = isDelegated ? delegationFunction : handler || delegationFunction; let typeEvent = getTypeEvent(originalTypeEvent); if (!nativeEvents.has(typeEvent)) typeEvent = originalTypeEvent; return [ isDelegated, callable, typeEvent ]; } function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { if (typeof originalTypeEvent !== "string" || !element) return; let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position // this prevents the handler from being dispatched the same way as mouseover or mouseout does if (originalTypeEvent in customEvents) { const wrapFunction = (fn)=>{ return function(event) { if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) return fn.call(this, event); }; }; callable = wrapFunction(callable); } const events = getElementEvents(element); const handlers = events[typeEvent] || (events[typeEvent] = {}); const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null); if (previousFunction) { previousFunction.oneOff = previousFunction.oneOff && oneOff; return; } const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, "")); const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable); fn.delegationSelector = isDelegated ? handler : null; fn.callable = callable; fn.oneOff = oneOff; fn.uidEvent = uid; handlers[uid] = fn; element.addEventListener(typeEvent, fn, isDelegated); } function removeHandler(element, events, typeEvent, handler, delegationSelector) { const fn = findHandler(events[typeEvent], handler, delegationSelector); if (!fn) return; element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); delete events[typeEvent][fn.uidEvent]; } function removeNamespacedHandlers(element, events, typeEvent, namespace) { const storeElementEvent = events[typeEvent] || {}; for (const handlerKey of Object.keys(storeElementEvent))if (handlerKey.includes(namespace)) { const event = storeElementEvent[handlerKey]; removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); } } function getTypeEvent(event) { // allow to get the native events from namespaced events ('click.bs.button' --> 'click') event = event.replace(stripNameRegex, ""); return customEvents[event] || event; } const EventHandler = { on (element, event, handler, delegationFunction) { addHandler(element, event, handler, delegationFunction, false); }, one (element, event, handler, delegationFunction) { addHandler(element, event, handler, delegationFunction, true); }, off (element, originalTypeEvent, handler, delegationFunction) { if (typeof originalTypeEvent !== "string" || !element) return; const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); const inNamespace = typeEvent !== originalTypeEvent; const events = getElementEvents(element); const storeElementEvent = events[typeEvent] || {}; const isNamespace = originalTypeEvent.startsWith("."); if (typeof callable !== "undefined") { // Simplest case: handler is passed, remove that listener ONLY. if (!Object.keys(storeElementEvent).length) return; removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null); return; } if (isNamespace) for (const elementEvent of Object.keys(events))removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); for (const keyHandlers of Object.keys(storeElementEvent)){ const handlerKey = keyHandlers.replace(stripUidRegex, ""); if (!inNamespace || originalTypeEvent.includes(handlerKey)) { const event = storeElementEvent[keyHandlers]; removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); } } }, trigger (element, event, args) { if (typeof event !== "string" || !element) return null; const $ = getjQuery(); const typeEvent = getTypeEvent(event); const inNamespace = event !== typeEvent; let jQueryEvent = null; let bubbles = true; let nativeDispatch = true; let defaultPrevented = false; if (inNamespace && $) { jQueryEvent = $.Event(event, args); $(element).trigger(jQueryEvent); bubbles = !jQueryEvent.isPropagationStopped(); nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); defaultPrevented = jQueryEvent.isDefaultPrevented(); } let evt = new Event(event, { bubbles, cancelable: true }); evt = hydrateObj(evt, args); if (defaultPrevented) evt.preventDefault(); if (nativeDispatch) element.dispatchEvent(evt); if (evt.defaultPrevented && jQueryEvent) jQueryEvent.preventDefault(); return evt; } }; function hydrateObj(obj, meta) { for (const [key, value] of Object.entries(meta || {}))try { obj[key] = value; } catch (_unused) { Object.defineProperty(obj, key, { configurable: true, get () { return value; } }); } return obj; } /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): dom/data.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * Constants */ const elementMap = new Map(); const Data = { set (element, key, instance) { if (!elementMap.has(element)) elementMap.set(element, new Map()); const instanceMap = elementMap.get(element); // make it clear we only want one instance per element // can be removed later when multiple key/instances are fine to be used if (!instanceMap.has(key) && instanceMap.size !== 0) { // eslint-disable-next-line no-console console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); return; } instanceMap.set(key, instance); }, get (element, key) { if (elementMap.has(element)) return elementMap.get(element).get(key) || null; return null; }, remove (element, key) { if (!elementMap.has(element)) return; const instanceMap = elementMap.get(element); instanceMap.delete(key); // free up element references if there are no instances left for an element if (instanceMap.size === 0) elementMap.delete(element); } }; /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): dom/manipulator.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ function normalizeData(value) { if (value === "true") return true; if (value === "false") return false; if (value === Number(value).toString()) return Number(value); if (value === "" || value === "null") return null; if (typeof value !== "string") return value; try { return JSON.parse(decodeURIComponent(value)); } catch (_unused) { return value; } } function normalizeDataKey(key) { return key.replace(/[A-Z]/g, (chr)=>`-${chr.toLowerCase()}`); } const Manipulator = { setDataAttribute (element, key, value) { element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); }, removeDataAttribute (element, key) { element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); }, getDataAttributes (element) { if (!element) return {}; const attributes = {}; const bsKeys = Object.keys(element.dataset).filter((key)=>key.startsWith("bs") && !key.startsWith("bsConfig")); for (const key of bsKeys){ let pureKey = key.replace(/^bs/, ""); pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); attributes[pureKey] = normalizeData(element.dataset[key]); } return attributes; }, getDataAttribute (element, key) { return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); } }; /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): util/config.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * Class definition */ class Config { // Getters static get Default() { return {}; } static get DefaultType() { return {}; } static get NAME() { throw new Error('You have to implement the static method "NAME", for each component!'); } _getConfig(config) { config = this._mergeConfigObj(config); config = this._configAfterMerge(config); this._typeCheckConfig(config); return config; } _configAfterMerge(config) { return config; } _mergeConfigObj(config, element) { const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, "config") : {}; // try to parse return { ...this.constructor.Default, ...typeof jsonConfig === "object" ? jsonConfig : {}, ...isElement(element) ? Manipulator.getDataAttributes(element) : {}, ...typeof config === "object" ? config : {} }; } _typeCheckConfig(config, configTypes = this.constructor.DefaultType) { for (const property of Object.keys(configTypes)){ const expectedTypes = configTypes[property]; const value = config[property]; const valueType = isElement(value) ? "element" : toType(value); if (!new RegExp(expectedTypes).test(valueType)) throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); } } } /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * Constants */ const VERSION = "5.2.2"; /** * Class definition */ class BaseComponent extends Config { constructor(element, config){ super(); element = getElement(element); if (!element) return; this._element = element; this._config = this._getConfig(config); Data.set(this._element, this.constructor.DATA_KEY, this); } dispose() { Data.remove(this._element, this.constructor.DATA_KEY); EventHandler.off(this._element, this.constructor.EVENT_KEY); for (const propertyName of Object.getOwnPropertyNames(this))this[propertyName] = null; } _queueCallback(callback, element, isAnimated = true) { executeAfterTransition(callback, element, isAnimated); } _getConfig(config) { config = this._mergeConfigObj(config, this._element); config = this._configAfterMerge(config); this._typeCheckConfig(config); return config; } static getInstance(element) { return Data.get(getElement(element), this.DATA_KEY); } static getOrCreateInstance(element, config = {}) { return this.getInstance(element) || new this(element, typeof config === "object" ? config : null); } static get VERSION() { return VERSION; } static get DATA_KEY() { return `bs.${this.NAME}`; } static get EVENT_KEY() { return `.${this.DATA_KEY}`; } static eventName(name) { return `${name}${this.EVENT_KEY}`; } } /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): util/component-functions.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ const enableDismissTrigger = (component, method = "hide")=>{ const clickEvent = `click.dismiss${component.EVENT_KEY}`; const name = component.NAME; EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function(event) { if ([ "A", "AREA" ].includes(this.tagName)) event.preventDefault(); if (isDisabled(this)) return; const target = getElementFromSelector(this) || this.closest(`.${name}`); const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method instance[method](); }); }; /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): alert.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * Constants */ const NAME$f = "alert"; const DATA_KEY$a = "bs.alert"; const EVENT_KEY$b = `.${DATA_KEY$a}`; const EVENT_CLOSE = `close${EVENT_KEY$b}`; const EVENT_CLOSED = `closed${EVENT_KEY$b}`; const CLASS_NAME_FADE$5 = "fade"; const CLASS_NAME_SHOW$8 = "show"; /** * Class definition */ class Alert extends BaseComponent { // Getters static get NAME() { return NAME$f; } close() { const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); if (closeEvent.defaultPrevented) return; this._element.classList.remove(CLASS_NAME_SHOW$8); const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5); this._queueCallback(()=>this._destroyElement(), this._element, isAnimated); } _destroyElement() { this._element.remove(); EventHandler.trigger(this._element, EVENT_CLOSED); this.dispose(); } static jQueryInterface(config) { return this.each(function() { const data = Alert.getOrCreateInstance(this); if (typeof config !== "string") return; if (data[config] === undefined || config.startsWith("_") || config === "constructor") throw new TypeError(`No method named "${config}"`); data[config](this); }); } } /** * Data API implementation */ enableDismissTrigger(Alert, "close"); /** * jQuery */ defineJQueryPlugin(Alert); /** * -------------------------------------------------------------------------- * Bootstrap (v5.2.2): button.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * Constants */ const NAME$e = "button"; const DATA_KEY$9 = "bs.button"; const EVENT_KEY$a = `.${DATA_KEY$9}`; const DATA_API_KEY$6 = ".data-api"; const CLASS_NAME_ACTIVE$3 = "active"; const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`; /** * Class definition */ class Button extends BaseComponent { // Getters static get NAME() { return NAME$e; } toggle() { // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method this._element.setAttribute("aria-pressed", this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); } static jQueryInterface(config) { return this.each(function() { const data = Button.getOrCreateInstance(this); if (config === "toggle") data[config](); }); } } /** * Data API implementation */ EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, (event)=>{ event.preventDefault(); const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); const data = Button.getOrCreateInstance(button); data.toggle(); }); /** * jQuery */ defineJQueryPlugin(Button); /** * -------------------------------------------------------------------------- * Bootstrap