1 2 3/****************** Cookie Functions **************/ 4 5(function () { 6 7 //-- Create and Store(Set) a Cookie --// 8 if (typeof window['setCookie'] === "function") return false; 9 const setCookie = function (c_name, value, exdays) { 10 setcookieWithPath(c_name, value, exdays, "/"); 11 }; 12 13 window['setCookie'] = setCookie; 14 15 const setcookieWithPath = function (c_name, value, exdays, currentPath) { 16 let exdate = new Date(); 17 exdate.setDate(exdate.getDate() + exdays); 18 let c_value = encodeURIComponent(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString()); 19 document.cookie = c_name + "=" + c_value + "; path=" + currentPath; 20 }; 21 22 window['setcookieWithPath'] = setcookieWithPath; 23 24 //-- Get a Cookie --// 25 if (typeof window['getCookie'] === "function") return false; 26 const getCookie = function (c_name) { 27 const ARRcookies = document.cookie.split(";"); 28 let i; 29 let x; 30 let y; 31 for (i = 0; i < ARRcookies.length; i++) { 32 x = ARRcookies[i].substring(0, ARRcookies[i].indexOf("=")); 33 y = ARRcookies[i].substring(ARRcookies[i].indexOf("=") + 1); 34 x = x.replace(/^\s+|\s+$/g, ""); 35 if (x == c_name) { 36 return decodeURIComponent(y); 37 } 38 } 39 }; 40 41 window['getCookie'] = getCookie; 42 43 //-- Check if a Cookie exists, if exist send the cookie value --// 44 if (typeof window['checkCookie'] === "function") return false; 45 const checkCookie = function (c_name) { 46 const cookieName = getCookie(c_name); 47 if (cookieName != null && cookieName != "") { 48 return cookieName; 49 } 50 }; 51 window['checkCookie'] = checkCookie; 52 53 //-- Delete a Cookie --// 54 if (typeof window['deleteCookie'] === "function") return false; 55 const deleteCookie = function (c_name) { 56 document.cookie = c_name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; 57 }; 58 window['deleteCookie'] = deleteCookie; 59})(); 60 61/****************** Set cookie for brand boost campaign (2026) **************/ 62// If site contains embed component with class js-site-market-language-cookie, the siteMarketLanguage cookie will be created. 63function setSiteMarketLanguageCookieWithDomain(cookieValue) { 64 const hostname = window.location.hostname; 65 const domain = (hostname === "scania.com" || hostname.endsWith(".scania.com")) ? ".scania.com" : ""; 66 let exdate = new Date(); 67 68 exdate.setDate(exdate.getDate() + 30); 69 70 //Before setting the new cookie, expire any existing host-only siteMarketLanguage cookie to clean up the previous wrong-domain cookie (NOE-13174) 71 document.cookie = "siteMarketLanguage=; Max-Age=0; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; 72 document.cookie = "siteMarketLanguage=" + encodeURIComponent(cookieValue) + "; expires=" + exdate.toUTCString() + "; path=/" + (domain ? "; domain=" + domain : ""); 73} 74 75function setSiteMarketLanguageCookie() { 76 const siteMarketCookieTrigger = document.querySelector(".js-site-market-language-cookie"); 77 78 if (!siteMarketCookieTrigger || !window.adobeDataLayer || !window.adobeDataLayer.length) { 79 return; 80 } 81 82 const pageViewEvent = window.adobeDataLayer.find(function (item) { 83 return item && item.event === "pageView" && item.pageInfo; 84 }); 85 86 if (!pageViewEvent || !pageViewEvent.pageInfo) { 87 return; 88 } 89 90 const countryCode = pageViewEvent.pageInfo.market; 91 const languageCode = pageViewEvent.pageInfo.language; 92 93 if (!countryCode || !languageCode) { 94 return; 95 } 96 97 const cookieValue = JSON.stringify({ 98 countryCode: countryCode.toLowerCase(), 99 languageCode: languageCode.toLowerCase(), 100 }); 101 102 setSiteMarketLanguageCookieWithDomain(cookieValue); 103} 104 105window["setSiteMarketLanguageCookie"] = setSiteMarketLanguageCookie; 106 107/****************** Environment Functions **************/ 108 109//-- Get current environment domain name --// 110const getCurrentEnvironmentDomain = function () { 111 return window.location.hostname; 112}; 113 114window['getCurrentEnvironmentDomain'] = getCurrentEnvironmentDomain; 115 116//-- Delete prod specific OneTrust cookies for stage/dev environments --// 117const deleteOneTrustCookiesForNonProd = function () { 118 const domain = getCurrentEnvironmentDomain(); 119 if (domain.includes('publish-stage.') || domain.includes('publish-dev.') || domain.includes('localhost') || domain.includes('aemdev.')) { 120 document.cookie = 'OptanonAlertBoxClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.scania.com;'; 121 document.cookie = 'OptanonConsent=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.scania.com;'; 122 } else if (domain.includes('author-p122210-e1195350.') || domain.includes('author-p122210-e1298807.') || domain.includes('author-p122210-e1298788.')) { 123 document.cookie = 'OptanonAlertBoxClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.adobeaemcloud.com;'; 124 document.cookie = 'OptanonConsent=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.adobeaemcloud.com;'; 125 } 126}; 127 128window['deleteOneTrustCookiesForNonProd'] = deleteOneTrustCookiesForNonProd; 129 130//-- Hide the cookie banner on the policy page for mobile users so that the content can be read. --// 131function waitForOneTrust(attemptsLeft, interval, callback) { 132 if (typeof OneTrust !== "undefined" && typeof OneTrust.Close === "function") { 133 callback(); // Execute callback when OneTrust is ready 134 } else if (attemptsLeft > 0) { 135 setTimeout(() => waitForOneTrust(attemptsLeft - 1, interval, callback), interval); 136 } 137} 138 139function hideCookieBanner() { 140 waitForOneTrust(15, 300, () => { 141 const isPolicyPage = document.getElementById("ot-sdk-cookie-policy"); 142 const cookieBanner = document.getElementById("onetrust-banner-sdk"); 143 const screenXsMax = 767; 144 const isMobile = window.innerWidth <= screenXsMax; 145 if (isPolicyPage && cookieBanner && isMobile) { 146 cookieBanner.style.display = "none"; 147 } 148 }); 149}; 150 151//-- Generate dynamic consent ID --// 152function generateConsentId() { 153 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 154 const r = Math.random() * 16 | 0; 155 const v = c == 'x' ? r : (r & 0x3 | 0x8); 156 return v.toString(16); 157 }); 158} 159 160//-- Set cookies by default on all author instances including localhost --// 161function setCookiesByDefaultInEditor() { 162 const domain = getCurrentEnvironmentDomain(); 163 164 // Generate or use existing consent ID 165 let consentId = getCookie('temp_consent_id'); 166 if (!consentId) { 167 consentId = generateConsentId();
168 setCookie('temp_consent_id', consentId, 365); 169 } 170 171 if (domain.includes('localhost') || domain.includes('aemdev.') || domain.includes('author-')) { 172 const qs = "isGpcEnabled=0" + 173 "&datestamp=" + encodeURIComponent(new Date().toString()).replace(/%20/g, '+') + 174 "&version=202501.1.0" + 175 "&browserGpcFlag=0" + 176 "&isIABGlobal=false" + 177 "&hosts=" + 178 "&consentId=" + consentId + 179 "&interactionCount=1" + 180 "&isAnonUser=1" + 181 "&landingPath=NotLandingPage" + 182 "&groups=C0001:1,C0002:1,C0003:1,C0004:1" + 183 "&intType=1"; 184 setcookieWithPath('OptanonAlertBoxClosed', new Date().toUTCString(), 365, "/"); 185 setcookieWithPath('OptanonConsent', qs, 365, "/"); 186 } 187} 188 189window['setCookiesByDefaultInEditor'] = setCookiesByDefaultInEditor; 190 191// Set cookies immediately for author instances 192setCookiesByDefaultInEditor(); 193 194// DOMContentLoaded event listener 195document.addEventListener('DOMContentLoaded', function () { 196 deleteOneTrustCookiesForNonProd(); 197 hideCookieBanner(); 198 setCookiesByDefaultInEditor(); 199 setSiteMarketLanguageCookie(); 200}); 201 202/****************** Cookie Model Functions **************/ 203 204(function () { 205 if (typeof window.getCookieModelData === 'function') return; 206 207 // Reads the JSON blob generated by the AEM cookie model in order to reduce number of server calls. 208 window.getCookieModelData = function () { 209 const cookieDataScript = document.getElementById("cookie-model-data"); 210 if (!cookieDataScript) return null; 211 212 try { 213 return JSON.parse(cookieDataScript.textContent); 214 } catch (e) { 215 console.error("Failed to parse cookie model JSON: ", e); 216 return null; 217 } 218 }; 219 220 // Populates a single nocookie placeholder element with cookie model data from a shared JSON blob. 221 window.populateNocookiePlaceholderLabels = function (element) { 222 if (element.dataset.populated === "true") return; 223 element.dataset.populated = "true"; 224 225 const cookieModelData = window.getCookieModelData(); 226 if (!cookieModelData || !element) return; 227 228 const nocookieMessageEl = element.querySelector(".js-cookie-nocookie-message"); 229 const boxTitleEl = element.querySelector(".js-cookie-box-title"); 230 const policyPageLabelEl = element.querySelector(".js-cookie-policy-page-label"); 231 232 if (nocookieMessageEl) nocookieMessageEl.textContent = cookieModelData.nocookieMessage; 233 if (boxTitleEl) boxTitleEl.textContent = cookieModelData.boxTitle; 234 235 if (policyPageLabelEl) { 236 policyPageLabelEl.textContent = cookieModelData.cookiePageLabel; 237 policyPageLabelEl.title = cookieModelData.cookiePageLabel; 238 policyPageLabelEl.href = cookieModelData.cookiePageUrl; 239 } 240 } 241 242 // Populates the cookie settings link element cookie model data from a shared JSON blob. 243 window.populateFooterCookieSettingsLabelContent = function (footerEl) { 244 const cookieModelData = window.getCookieModelData(); 245 if (!cookieModelData || !footerEl) return; 246 247 const boxTitleEl = footerEl.querySelector(".js-cookie-box-title"); 248 if (boxTitleEl) { 249 boxTitleEl.textContent = cookieModelData.boxTitle; 250 boxTitleEl.title = cookieModelData.boxTitle; 251 } 252 }; 253})(); 254 255/****************** Device Detection Functions **************/ 256/*** Sniff the UA of the client ***/ 257let isMobile = false; //Initiate as false 258isMobile = { 259 Android: function () { 260 return navigator.userAgent.match(/Android/i); 261 }, 262 BlackBerry: function () { 263 return navigator.userAgent.match(/BlackBerry/i); 264 }, 265 iOS: function () { 266 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 267 }, 268 iPhone: function () { 269 return navigator.userAgent.match(/iPhone/i); 270 }, 271 iPad: function () { 272 return navigator.userAgent.match(/iPad/i); 273 }, 274 iPod: function () { 275 return navigator.userAgent.match(/iPod/i); 276 }, 277 WindowsPhone: function () { 278 return navigator.userAgent.match(/Windows Phone/i); 279 }, 280 ZuneWP7: function () { 281 return navigator.userAgent.match(/ZuneWP7/i); 282 }, 283 Opera: function () { 284 return navigator.userAgent.match(/Opera Mini/i); 285 }, 286 Windows: function () { 287 return navigator.userAgent.match(/IEMobile/i); 288 }, 289 any: function () { 290 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.iPhone() || isMobile.iPad() || isMobile.iPod() || isMobile.WindowsPhone() || isMobile.ZuneWP7() || isMobile.Opera() || isMobile.Windows()); 291 } 292}; 293 294//-- Detect Portrait or Landscape --// 295const getOrientation = function () { 296 if (window.innerHeight > window.innerWidth) { 297 return "portrait"; 298 } else { 299 return "landscape"; 300 } 301}; 302
303//-- Viewport Height --// 304const getViewportHeight = function () { 305 let height; 306 if (window.innerHeight !== undefined) { 307 height = window.innerHeight; 308 } else { 309 height = document.documentElement.clientHeight; 310 } 311 return height; 312}; 313 314//-- Viewport Width --// 315const getViewportWidth = function () { 316 let width; 317 if (window.innerWidth !== undefined) { 318 width = window.innerWidth; 319 } else { 320 width = document.documentElement.clientWidth; 321 } 322 return width; 323}; 324 325 326/****************** Array Functions **************/ 327//-- Get Highest value from an array --// 328Array.max = function (array) { 329 return Math.max.apply(Math, array); 330}; 331 332//-- Get Lowest value from an array --// 333Array.min = function (array) { 334 return Math.min.apply(Math, array); 335}; 336 337//-- Remove duplicates from an array --// 338Array.prototype.unique = function () { 339 return this.filter(function (value, index, self) { 340 return self.indexOf(value) === index; 341 }); 342} 343 344/****************** String Functions **************/ 345//-- Truncate text to a given length and add ellipsis at the end --// 346String.prototype.truncateTextWithEllipsis = function (length) { 347 return this.length > length ? this.substring(0, length) + "..." : this; 348} 349 350//-- Check if element in view --// 351const Utils = { 352 IsElementInViewport: function (el) { 353 if (typeof jQuery === "function" && el instanceof jQuery) el = el[0]; 354 if (typeof el === "undefined") { 355 return false; 356 } 357 const rect = el.getBoundingClientRect(); 358 return ( 359 rect.top >= 0 && 360 rect.left >= 0 && 361 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && 362 rect.right <= (window.innerWidth || document.documentElement.clientWidth) 363 ); 364 } 365 366}; 367 368 369//-- Get the parameter in the url --// 370const getQueryParameter = function (paramName) { 371 const query = window.location.search.substring(1); 372 const vars = query.split("&"); 373 for (let i = 0; i < vars.length; i++) { 374 const pair = vars[i].split("="); 375 if (pair[0] == paramName) { 376 return decodeURI(pair[1]); 377 } 378 } 379 return false; 380}; 381 382//-- Add a parameter to the url --// 383const addParameterToURL = function (key, value) { 384 const url = window.location.href; 385 let params = new URLSearchParams(window.location.search); 386 params.set(key, value); 387 const newUrl = url.split('?')[0] + '?' + params.toString(); 388 window.history.pushState({}, '', newUrl); 389}; 390 391 392 393//-- Custom Event for Analytics --// 394//-- Donot modify! This is a global function --// 395(function () { 396 if (typeof window.CustomEvent === "function") return false; 397 398 function CustomEvent(event, params) { 399 params = params || { 400 bubbles: false, 401 cancelable: false, 402 detail: null 403 }; 404 let evt = document.createEvent('CustomEvent'); 405 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 406 return evt; 407 } 408 CustomEvent.prototype = window.Event.prototype; 409 window.CustomEvent = CustomEvent; 410})(); 411 412 413//-- Check if the browser is IE (Doesn't apply for edge) --// 414var isIE = function () { 415 const userAgent = window.navigator.userAgent; 416 if (/MSIE|Trident/.test(userAgent)) { 417 return true; 418 } else { 419 return false; 420 } 421} 422 423$.urlParam = function (name) { 424 const results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.search); 425 return results !== null ? results[1] || 0 : false; 426}; 427 428 429$(document).ready(function () { 430 const showMoreSessionsButton = document.querySelector('.show-more-sessions'); 431 if (showMoreSessionsButton) { 432 showMoreSessionsButton.addEventListener('click', function(e) { 433 e.preventDefault(); 434 435 var hiddenContainers = document.querySelectorAll('.responsivegrid.responsivegrid-hide'); 436 437 hiddenContainers.forEach(function(container) { 438 container.classList.remove('responsivegrid-hide'); 439 }); 440 441 this.style.display = 'none'; 442 }); 443 } 444 445});
vendor: 44,683 bytes, lines 446-1989
446/*! picturefill - v3.0.2 - 2016-02-12 447 * https://scottjehl.github.io/picturefill/ 448 * Copyright (c) 2016 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT 449 */ 450/*! Gecko-Picture - v1.0 451 * https://github.com/scottjehl/picturefill/tree/3.0/src/plugins/gecko-picture 452 * Firefox's early picture implementation (prior to FF41) is static and does 453 * not react to viewport changes. This tiny module fixes this. 454 */ 455(function(window) { 456 /*jshint eqnull:true */ 457 var ua = navigator.userAgent; 458 459 if ( window.HTMLPictureElement && ((/ecko/).test(ua) && ua.match(/rv\:(\d+)/) && RegExp.$1 < 45) ) { 460 addEventListener("resize", (function() { 461 var timer; 462 463 var dummySrc = document.createElement("source"); 464 465 var fixRespimg = function(img) { 466 var source, sizes; 467 var picture = img.parentNode; 468 469 if (picture.nodeName.toUpperCase() === "PICTURE") { 470 source = dummySrc.cloneNode(); 471 472 picture.insertBefore(source, picture.firstElementChild); 473 setTimeout(function() { 474 picture.removeChild(source); 475 }); 476 } else if (!img._pfLastSize || img.offsetWidth > img._pfLastSize) { 477 img._pfLastSize = img.offsetWidth; 478 sizes = img.sizes; 479 img.sizes += ",100vw"; 480 setTimeout(function() { 481 img.sizes = sizes; 482 }); 483 } 484 }; 485 486 var findPictureImgs = function() { 487 var i; 488 var imgs = document.querySelectorAll("picture > img, img[srcset][sizes]"); 489 for (i = 0; i < imgs.length; i++) { 490 fixRespimg(imgs[i]); 491 } 492 }; 493 var onResize = function() { 494 clearTimeout(timer); 495 timer = setTimeout(findPictureImgs, 99); 496 }; 497 var mq = window.matchMedia && matchMedia("(orientation: landscape)"); 498 var init = function() { 499 onResize(); 500 501 if (mq && mq.addListener) { 502 mq.addListener(onResize); 503 } 504 }; 505 506 dummySrc.srcset = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; 507 508 if (/^[c|i]|d$/.test(document.readyState || "")) { 509 init(); 510 } else { 511 document.addEventListener("DOMContentLoaded", init); 512 } 513 514 return onResize; 515 })()); 516 } 517})(window); 518 519/*! Picturefill - v3.0.2 520 * http://scottjehl.github.io/picturefill 521 * Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; 522 * License: MIT 523 */ 524 525(function( window, document, undefined ) { 526 // Enable strict mode 527 "use strict"; 528 529 // HTML shim|v it for old IE (IE9 will still need the HTML video tag workaround) 530 document.createElement( "picture" ); 531 532 var warn, eminpx, alwaysCheckWDescriptor, evalId; 533 // local object for method references and testing exposure 534 var pf = {}; 535 var isSupportTestReady = false; 536 var noop = function() {}; 537 var image = document.createElement( "img" ); 538 var getImgAttr = image.getAttribute; 539 var setImgAttr = image.setAttribute; 540 var removeImgAttr = image.removeAttribute; 541 var docElem = document.documentElement; 542 var types = {}; 543 var cfg = { 544 //resource selection: 545 algorithm: "" 546 }; 547 var srcAttr = "data-pfsrc"; 548 var srcsetAttr = srcAttr + "set"; 549 // ua sniffing is done for undetectable img loading features, 550 // to do some non crucial perf optimizations 551 var ua = navigator.userAgent; 552 var supportAbort = (/rident/).test(ua) || ((/ecko/).test(ua) && ua.match(/rv\:(\d+)/) && RegExp.$1 > 35 ); 553 var curSrcProp = "currentSrc"; 554 var regWDesc = /\s+\+?\d+(e\d+)?w/; 555 var regSize = /(\([^)]+\))?\s*(.+)/; 556 var setOptions = window.picturefillCFG; 557 /** 558 * Shortcut property for https://w3c.github.io/webappsec/specs/mixedcontent/#restricts-mixed-content ( for easy overriding in tests ) 559 */ 560 // baseStyle also used by getEmValue (i.e.: width: 1em is important) 561 var baseStyle = "position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)"; 562 var fsCss = "font-size:100%!important;"; 563 var isVwDirty = true; 564 565 var cssCache = {}; 566 var sizeLengthCache = {}; 567 var DPR = window.devicePixelRatio; 568 var units = { 569 px: 1, 570 "in": 96 571 }; 572 var anchor = document.createElement( "a" ); 573 /** 574 * alreadyRun flag used for setOptions. is it true setOptions will reevaluate 575 * @type {boolean} 576 */ 577 var alreadyRun = false; 578 579 // Reusable, non-"g" Regexes 580 581 // (Don't use \s, to avoid matching non-breaking space.) 582 var regexLeadingSpaces = /^[ \t\n\r\u000c]+/, 583 regexLeadingCommasOrSpaces = /^[, \t\n\r\u000c]+/, 584 regexLeadingNotSpaces = /^[^ \t\n\r\u000c]+/, 585 regexTrailingCommas = /[,]+$/, 586 regexNonNegativeInteger = /^\d+$/, 587 588 // ( Positive or negative or unsigned integers or decimals, without or without exponents. 589 // Must include at least one digit. 590 // According to spec tests any decimal point must be followed by a digit. 591 // No leading plus sign is allowed.) 592 // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-floating-point-number 593 regexFloatingPoint = /^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/; 594 595 var on = function(obj, evt, fn, capture) { 596 if ( obj.addEventListener ) { 597 obj.addEventListener(evt, fn, capture || false); 598 } else if ( obj.attachEvent ) { 599 obj.attachEvent( "on" + evt, fn); 600 } 601 }; 602 603 /** 604 * simple memoize function: 605 */ 606 607 var memoize = function(fn) { 608 var cache = {}; 609 return function(input) { 610 if ( !(input in cache) ) { 611 cache[ input ] = fn(input); 612 } 613 return cache[ input ]; 614 }; 615 }; 616 617 // UTILITY FUNCTIONS 618 619 // Manual is faster than RegEx 620 // http://jsperf.com/whitespace-character/5 621 function isSpace(c) { 622 return (c === "\u0020" || // space 623 c === "\u0009" || // horizontal tab 624 c === "\u000A" || // new line 625 c === "\u000C" || // form feed 626 c === "\u000D"); // carriage return 627 } 628 629 /** 630 * gets a mediaquery and returns a boolean or gets a css length and returns a number 631 * @param css mediaqueries or css length 632 * @returns {boolean|number} 633 * 634 * based on: https://gist.github.com/jonathantneal/db4f77009b155f083738 635 */ 636 var evalCSS = (function() { 637 638 var regLength = /^([\d\.]+)(em|vw|px)$/; 639 var replace = function() { 640 var args = arguments, index = 0, string = args[0]; 641 while (++index in args) { 642 string = string.replace(args[index], args[++index]); 643 } 644 return string; 645 }; 646 647 var buildStr = memoize(function(css) { 648 649 return "return " + replace((css || "").toLowerCase(), 650 // interpret `and` 651 /\band\b/g, "&&", 652 653 // interpret `,` 654 /,/g, "||", 655 656 // interpret `min-` as >= 657 /min-([a-z-\s]+):/g, "e.$1>=", 658 659 // interpret `max-` as <= 660 /max-([a-z-\s]+):/g, "e.$1<=", 661 662 //calc value 663 /calc([^)]+)/g, "($1)", 664 665 // interpret css values 666 /(\d+[\.]*[\d]*)([a-z]+)/g, "($1 * e.$2)", 667 //make eval less evil 668 /^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/ig, "" 669 ) + ";"; 670 }); 671 672 return function(css, length) { 673 var parsedLength; 674 if (!(css in cssCache)) { 675 cssCache[css] = false; 676 if (length && (parsedLength = css.match( regLength ))) { 677 cssCache[css] = parsedLength[ 1 ] * units[parsedLength[ 2 ]]; 678 } else { 679 /*jshint evil:true */ 680 try{ 681 cssCache[css] = new Function("e", buildStr(css))(units); 682 } catch(e) {} 683 /*jshint evil:false */ 684 } 685 } 686 return cssCache[css]; 687 }; 688 })(); 689 690 var setResolution = function( candidate, sizesattr ) { 691 if ( candidate.w ) { // h = means height: || descriptor.type === 'h' do not handle yet... 692 candidate.cWidth = pf.calcListLength( sizesattr || "100vw" ); 693 candidate.res = candidate.w / candidate.cWidth ; 694 } else { 695 candidate.res = candidate.d; 696 } 697 return candidate; 698 }; 699 700 /** 701 * 702 * @param opt 703 */ 704 var picturefill = function( opt ) { 705 706 if (!isSupportTestReady) {return;} 707 708 var elements, i, plen; 709 710 var options = opt || {}; 711 712 if ( options.elements && options.elements.nodeType === 1 ) { 713 if ( options.elements.nodeName.toUpperCase() === "IMG" ) { 714 options.elements = [ options.elements ]; 715 } else { 716 options.context = options.elements; 717 options.elements = null; 718 } 719 } 720 721 elements = options.elements || pf.qsa( (options.context || document), ( options.reevaluate || options.reselect ) ? pf.sel : pf.selShort ); 722 723 if ( (plen = elements.length) ) { 724 725 pf.setupRun( options ); 726 alreadyRun = true; 727 728 // Loop through all elements 729 for ( i = 0; i < plen; i++ ) { 730 pf.fillImg(elements[ i ], options); 731 } 732 733 pf.teardownRun( options ); 734 } 735 }; 736 737 /** 738 * outputs a warning for the developer 739 * @param {message} 740 * @type {Function} 741 */ 742 warn = ( window.console && console.warn ) ? 743 function( message ) { 744 console.warn( message ); 745 } : 746 noop 747 ; 748 749 if ( !(curSrcProp in image) ) { 750 curSrcProp = "src"; 751 } 752 753 // Add support for standard mime types. 754 types[ "image/jpeg" ] = true; 755 types[ "image/gif" ] = true; 756 types[ "image/png" ] = true; 757 758 function detectTypeSupport( type, typeUri ) { 759 // based on Modernizr's lossless img-webp test 760 // note: asynchronous 761 var image = new window.Image(); 762 image.onerror = function() { 763 types[ type ] = false; 764 picturefill(); 765 }; 766 image.onload = function() { 767 types[ type ] = image.width === 1; 768 picturefill(); 769 }; 770 image.src = typeUri; 771 return "pending"; 772 } 773 774 // test svg support 775 types[ "image/svg+xml" ] = document.implementation.hasFeature( "http://www.w3.org/TR/SVG11/feature#Image", "1.1" ); 776 777 /** 778 * updates the internal vW property with the current viewport width in px 779 */ 780 function updateMetrics() { 781 782 isVwDirty = false; 783 DPR = window.devicePixelRatio; 784 cssCache = {}; 785 sizeLengthCache = {}; 786 787 pf.DPR = DPR || 1; 788 789 units.width = Math.max(window.innerWidth || 0, docElem.clientWidth); 790 units.height = Math.max(window.innerHeight || 0, docElem.clientHeight); 791 792 units.vw = units.width / 100; 793 units.vh = units.height / 100; 794 795 evalId = [ units.height, units.width, DPR ].join("-"); 796 797 units.em = pf.getEmValue(); 798 units.rem = units.em; 799 } 800 801 function chooseLowRes( lowerValue, higherValue, dprValue, isCached ) { 802 var bonusFactor, tooMuch, bonus, meanDensity; 803 804 //experimental 805 if (cfg.algorithm === "saveData" ){ 806 if ( lowerValue > 2.7 ) { 807 meanDensity = dprValue + 1; 808 } else { 809 tooMuch = higherValue - dprValue; 810 bonusFactor = Math.pow(lowerValue - 0.6, 1.5); 811 812 bonus = tooMuch * bonusFactor; 813 814 if (isCached) { 815 bonus += 0.1 * bonusFactor; 816 } 817 818 meanDensity = lowerValue + bonus; 819 } 820 } else { 821 meanDensity = (dprValue > 1) ? 822 Math.sqrt(lowerValue * higherValue) : 823 lowerValue; 824 } 825 826 return meanDensity > dprValue; 827 } 828 829 function applyBestCandidate( img ) { 830 var srcSetCandidates; 831 var matchingSet = pf.getSet( img ); 832 var evaluated = false; 833 if ( matchingSet !== "pending" ) { 834 evaluated = evalId; 835 if ( matchingSet ) { 836 srcSetCandidates = pf.setRes( matchingSet ); 837 pf.applySetCandidate( srcSetCandidates, img ); 838 } 839 } 840 img[ pf.ns ].evaled = evaluated; 841 } 842 843 function ascendingSort( a, b ) { 844 return a.res - b.res; 845 } 846 847 function setSrcToCur( img, src, set ) { 848 var candidate; 849 if ( !set && src ) { 850 set = img[ pf.ns ].sets; 851 set = set && set[set.length - 1]; 852 } 853 854 candidate = getCandidateForSrc(src, set); 855 856 if ( candidate ) { 857 src = pf.makeUrl(src); 858 img[ pf.ns ].curSrc = src; 859 img[ pf.ns ].curCan = candidate; 860 861 if ( !candidate.res ) { 862 setResolution( candidate, candidate.set.sizes ); 863 } 864 } 865 return candidate; 866 } 867 868 function getCandidateForSrc( src, set ) { 869 var i, candidate, candidates; 870 if ( src && set ) { 871 candidates = pf.parseSet( set ); 872 src = pf.makeUrl(src); 873 for ( i = 0; i < candidates.length; i++ ) { 874 if ( src === pf.makeUrl(candidates[ i ].url) ) { 875 candidate = candidates[ i ]; 876 break; 877 } 878 } 879 } 880 return candidate; 881 } 882 883 function getAllSourceElements( picture, candidates ) { 884 var i, len, source, srcset; 885 886 // SPEC mismatch intended for size and perf: 887 // actually only source elements preceding the img should be used 888 // also note: don't use qsa here, because IE8 sometimes doesn't like source as the key part in a selector 889 var sources = picture.getElementsByTagName( "source" ); 890 891 for ( i = 0, len = sources.length; i < len; i++ ) { 892 source = sources[ i ]; 893 source[ pf.ns ] = true; 894 srcset = source.getAttribute( "srcset" ); 895 896 // if source does not have a srcset attribute, skip 897 if ( srcset ) { 898 candidates.push( { 899 srcset: srcset, 900 media: source.getAttribute( "media" ), 901 type: source.getAttribute( "type" ), 902 sizes: source.getAttribute( "sizes" ) 903 } ); 904 } 905 } 906 } 907 908 /** 909 * Srcset Parser 910 * By Alex Bell | MIT License 911 * 912 * @returns Array [{url: _, d: _, w: _, h:_, set:_(????)}, ...] 913 * 914 * Based super duper closely on the reference algorithm at: 915 * https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-srcset-attribute 916 */ 917 918 // 1. Let input be the value passed to this algorithm. 919 // (TO-DO : Explain what "set" argument is here. Maybe choose a more 920 // descriptive & more searchable name. Since passing the "set" in really has 921 // nothing to do with parsing proper, I would prefer this assignment eventually 922 // go in an external fn.) 923 function parseSrcset(input, set) { 924 925 function collectCharacters(regEx) { 926 var chars, 927 match = regEx.exec(input.substring(pos)); 928 if (match) { 929 chars = match[ 0 ]; 930 pos += chars.length; 931 return chars; 932 } 933 } 934 935 var inputLength = input.length, 936 url, 937 descriptors, 938 currentDescriptor, 939 state, 940 c, 941 942 // 2. Let position be a pointer into input, initially pointing at the start 943 // of the string. 944 pos = 0, 945 946 // 3. Let candidates be an initially empty source set. 947 candidates = []; 948 949 /** 950 * Adds descriptor properties to a candidate, pushes to the candidates array 951 * @return undefined 952 */ 953 // (Declared outside of the while loop so that it's only created once. 954 // (This fn is defined before it is used, in order to pass JSHINT. 955 // Unfortunately this breaks the sequencing of the spec comments. :/ ) 956 function parseDescriptors() { 957 958 // 9. Descriptor parser: Let error be no. 959 var pError = false, 960 961 // 10. Let width be absent. 962 // 11. Let density be absent. 963 // 12. Let future-compat-h be absent. (We're implementing it now as h) 964 w, d, h, i, 965 candidate = {}, 966 desc, lastChar, value, intVal, floatVal; 967 968 // 13. For each descriptor in descriptors, run the appropriate set of steps 969 // from the following list: 970 for (i = 0 ; i < descriptors.length; i++) { 971 desc = descriptors[ i ]; 972 973 lastChar = desc[ desc.length - 1 ]; 974 value = desc.substring(0, desc.length - 1); 975 intVal = parseInt(value, 10); 976 floatVal = parseFloat(value); 977 978 // If the descriptor consists of a valid non-negative integer followed by 979 // a U+0077 LATIN SMALL LETTER W character 980 if (regexNonNegativeInteger.test(value) && (lastChar === "w")) { 981 982 // If width and density are not both absent, then let error be yes. 983 if (w || d) {pError = true;} 984 985 // Apply the rules for parsing non-negative integers to the descriptor. 986 // If the result is zero, let error be yes. 987 // Otherwise, let width be the result. 988 if (intVal === 0) {pError = true;} else {w = intVal;} 989 990 // If the descriptor consists of a valid floating-point number followed by 991 // a U+0078 LATIN SMALL LETTER X character 992 } else if (regexFloatingPoint.test(value) && (lastChar === "x")) { 993 994 // If width, density and future-compat-h are not all absent, then let error 995 // be yes. 996 if (w || d || h) {pError = true;} 997 998 // Apply the rules for parsing floating-point number values to the descriptor. 999 // If the result is less than zero, let error be yes. Otherwise, let density 1000 // be the result. 1001 if (floatVal < 0) {pError = true;} else {d = floatVal;} 1002 1003 // If the descriptor consists of a valid non-negative integer followed by 1004 // a U+0068 LATIN SMALL LETTER H character 1005 } else if (regexNonNegativeInteger.test(value) && (lastChar === "h")) { 1006 1007 // If height and density are not both absent, then let error be yes. 1008 if (h || d) {pError = true;} 1009 1010 // Apply the rules for parsing non-negative integers to the descriptor. 1011 // If the result is zero, let error be yes. Otherwise, let future-compat-h 1012 // be the result. 1013 if (intVal === 0) {pError = true;} else {h = intVal;} 1014 1015 // Anything else, Let error be yes. 1016 } else {pError = true;} 1017 } // (close step 13 for loop) 1018 1019 // 15. If error is still no, then append a new image source to candidates whose 1020 // URL is url, associated with a width width if not absent and a pixel 1021 // density density if not absent. Otherwise, there is a parse error. 1022 if (!pError) { 1023 candidate.url = url; 1024 1025 if (w) { candidate.w = w;} 1026 if (d) { candidate.d = d;} 1027 if (h) { candidate.h = h;} 1028 if (!h && !d && !w) {candidate.d = 1;} 1029 if (candidate.d === 1) {set.has1x = true;} 1030 candidate.set = set; 1031 1032 candidates.push(candidate); 1033 } 1034 } // (close parseDescriptors fn) 1035 1036 /** 1037 * Tokenizes descriptor properties prior to parsing 1038 * Returns undefined. 1039 * (Again, this fn is defined before it is used, in order to pass JSHINT. 1040 * Unfortunately this breaks the logical sequencing of the spec comments. :/ ) 1041 */ 1042 function tokenize() { 1043 1044 // 8.1. Descriptor tokeniser: Skip whitespace 1045 collectCharacters(regexLeadingSpaces); 1046 1047 // 8.2. Let current descriptor be the empty string. 1048 currentDescriptor = ""; 1049 1050 // 8.3. Let state be in descriptor. 1051 state = "in descriptor"; 1052 1053 while (true) { 1054 1055 // 8.4. Let c be the character at position. 1056 c = input.charAt(pos); 1057 1058 // Do the following depending on the value of state. 1059 // For the purpose of this step, "EOF" is a special character representing 1060 // that position is past the end of input. 1061 1062 // In descriptor 1063 if (state === "in descriptor") { 1064 // Do the following, depending on the value of c: 1065 1066 // Space character 1067 // If current descriptor is not empty, append current descriptor to 1068 // descriptors and let current descriptor be the empty string. 1069 // Set state to after descriptor. 1070 if (isSpace(c)) { 1071 if (currentDescriptor) { 1072 descriptors.push(currentDescriptor); 1073 currentDescriptor = ""; 1074 state = "after descriptor"; 1075 } 1076 1077 // U+002C COMMA (,) 1078 // Advance position to the next character in input. If current descriptor 1079 // is not empty, append current descriptor to descriptors. Jump to the step 1080 // labeled descriptor parser. 1081 } else if (c === ",") { 1082 pos += 1; 1083 if (currentDescriptor) { 1084 descriptors.push(currentDescriptor); 1085 } 1086 parseDescriptors(); 1087 return; 1088 1089 // U+0028 LEFT PARENTHESIS (() 1090 // Append c to current descriptor. Set state to in parens. 1091 } else if (c === "\u0028") { 1092 currentDescriptor = currentDescriptor + c; 1093 state = "in parens"; 1094 1095 // EOF 1096 // If current descriptor is not empty, append current descriptor to 1097 // descriptors. Jump to the step labeled descriptor parser. 1098 } else if (c === "") { 1099 if (currentDescriptor) { 1100 descriptors.push(currentDescriptor); 1101 } 1102 parseDescriptors(); 1103 return; 1104 1105 // Anything else 1106 // Append c to current descriptor. 1107 } else { 1108 currentDescriptor = currentDescriptor + c; 1109 } 1110 // (end "in descriptor" 1111 1112 // In parens 1113 } else if (state === "in parens") { 1114 1115 // U+0029 RIGHT PARENTHESIS ()) 1116 // Append c to current descriptor. Set state to in descriptor. 1117 if (c === ")") { 1118 currentDescriptor = currentDescriptor + c; 1119 state = "in descriptor"; 1120 1121 // EOF 1122 // Append current descriptor to descriptors. Jump to the step labeled 1123 // descriptor parser. 1124 } else if (c === "") { 1125 descriptors.push(currentDescriptor); 1126 parseDescriptors(); 1127 return; 1128 1129 // Anything else 1130 // Append c to current descriptor. 1131 } else { 1132 currentDescriptor = currentDescriptor + c; 1133 } 1134 1135 // After descriptor 1136 } else if (state === "after descriptor") { 1137 1138 // Do the following, depending on the value of c: 1139 // Space character: Stay in this state. 1140 if (isSpace(c)) { 1141 1142 // EOF: Jump to the step labeled descriptor parser. 1143 } else if (c === "") { 1144 parseDescriptors(); 1145 return; 1146 1147 // Anything else 1148 // Set state to in descriptor. Set position to the previous character in input. 1149 } else { 1150 state = "in descriptor"; 1151 pos -= 1; 1152 1153 } 1154 } 1155 1156 // Advance position to the next character in input. 1157 pos += 1; 1158 1159 // Repeat this step. 1160 } // (close while true loop) 1161 } 1162 1163 // 4. Splitting loop: Collect a sequence of characters that are space 1164 // characters or U+002C COMMA characters. If any U+002C COMMA characters 1165 // were collected, that is a parse error. 1166 while (true) { 1167 collectCharacters(regexLeadingCommasOrSpaces); 1168 1169 // 5. If position is past the end of input, return candidates and abort these steps. 1170 if (pos >= inputLength) { 1171 return candidates; // (we're done, this is the sole return path) 1172 } 1173 1174 // 6. Collect a sequence of characters that are not space characters, 1175 // and let that be url. 1176 url = collectCharacters(regexLeadingNotSpaces); 1177 1178 // 7. Let descriptors be a new empty list. 1179 descriptors = []; 1180 1181 // 8. If url ends with a U+002C COMMA character (,), follow these substeps: 1182 // (1). Remove all trailing U+002C COMMA characters from url. If this removed 1183 // more than one character, that is a parse error. 1184 if (url.slice(-1) === ",") { 1185 url = url.replace(regexTrailingCommas, ""); 1186 // (Jump ahead to step 9 to skip tokenization and just push the candidate). 1187 parseDescriptors(); 1188 1189 // Otherwise, follow these substeps: 1190 } else { 1191 tokenize(); 1192 } // (close else of step 8) 1193 1194 // 16. Return to the step labeled splitting loop. 1195 } // (Close of big while loop.) 1196 } 1197 1198 /* 1199 * Sizes Parser 1200 * 1201 * By Alex Bell | MIT License 1202 * 1203 * Non-strict but accurate and lightweight JS Parser for the string value <img sizes="here"> 1204 * 1205 * Reference algorithm at: 1206 * https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-sizes-attribute 1207 * 1208 * Most comments are copied in directly from the spec 1209 * (except for comments in parens). 1210 * 1211 * Grammar is: 1212 * <source-size-list> = <source-size># [ , <source-size-value> ]? | <source-size-value> 1213 * <source-size> = <media-condition> <source-size-value> 1214 * <source-size-value> = <length> 1215 * http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#attr-img-sizes 1216 * 1217 * E.g. "(max-width: 30em) 100vw, (max-width: 50em) 70vw, 100vw" 1218 * or "(min-width: 30em), calc(30vw - 15px)" or just "30vw" 1219 * 1220 * Returns the first valid <css-length> with a media condition that evaluates to true, 1221 * or "100vw" if all valid media conditions evaluate to false. 1222 * 1223 */ 1224 1225 function parseSizes(strValue) { 1226 1227 // (Percentage CSS lengths are not allowed in this case, to avoid confusion: 1228 // https://html.spec.whatwg.org/multipage/embedded-content.html#valid-source-size-list 1229 // CSS allows a single optional plus or minus sign: 1230 // http://www.w3.org/TR/CSS2/syndata.html#numbers 1231 // CSS is ASCII case-insensitive: 1232 // http://www.w3.org/TR/CSS2/syndata.html#characters ) 1233 // Spec allows exponential notation for <number> type: 1234 // http://dev.w3.org/csswg/css-values/#numbers 1235 var regexCssLengthWithUnits = /^(?:[+-]?[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?(?:ch|cm|em|ex|in|mm|pc|pt|px|rem|vh|vmin|vmax|vw)$/i; 1236 1237 // (This is a quick and lenient test. Because of optional unlimited-depth internal 1238 // grouping parens and strict spacing rules, this could get very complicated.) 1239 var regexCssCalc = /^calc\((?:[0-9a-z \.\+\-\*\/\(\)]+)\)$/i; 1240 1241 var i; 1242 var unparsedSizesList; 1243 var unparsedSizesListLength; 1244 var unparsedSize; 1245 var lastComponentValue; 1246 var size; 1247 1248 // UTILITY FUNCTIONS 1249 1250 // (Toy CSS parser. The goals here are: 1251 // 1) expansive test coverage without the weight of a full CSS parser. 1252 // 2) Avoiding regex wherever convenient. 1253 // Quick tests: http://jsfiddle.net/gtntL4gr/3/ 1254 // Returns an array of arrays.) 1255 function parseComponentValues(str) { 1256 var chrctr; 1257 var component = ""; 1258 var componentArray = []; 1259 var listArray = []; 1260 var parenDepth = 0; 1261 var pos = 0; 1262 var inComment = false; 1263 1264 function pushComponent() { 1265 if (component) { 1266 componentArray.push(component); 1267 component = ""; 1268 } 1269 } 1270 1271 function pushComponentArray() { 1272 if (componentArray[0]) { 1273 listArray.push(componentArray); 1274 componentArray = []; 1275 } 1276 } 1277 1278 // (Loop forwards from the beginning of the string.) 1279 while (true) { 1280 chrctr = str.charAt(pos); 1281 1282 if (chrctr === "") { // ( End of string reached.) 1283 pushComponent(); 1284 pushComponentArray(); 1285 return listArray; 1286 } else if (inComment) { 1287 if ((chrctr === "*") && (str[pos + 1] === "/")) { // (At end of a comment.) 1288 inComment = false; 1289 pos += 2; 1290 pushComponent(); 1291 continue; 1292 } else { 1293 pos += 1; // (Skip all characters inside comments.) 1294 continue; 1295 } 1296 } else if (isSpace(chrctr)) { 1297 // (If previous character in loop was also a space, or if 1298 // at the beginning of the string, do not add space char to 1299 // component.) 1300 if ( (str.charAt(pos - 1) && isSpace( str.charAt(pos - 1) ) ) || !component ) { 1301 pos += 1; 1302 continue; 1303 } else if (parenDepth === 0) { 1304 pushComponent(); 1305 pos +=1; 1306 continue; 1307 } else { 1308 // (Replace any space character with a plain space for legibility.) 1309 chrctr = " "; 1310 } 1311 } else if (chrctr === "(") { 1312 parenDepth += 1; 1313 } else if (chrctr === ")") { 1314 parenDepth -= 1; 1315 } else if (chrctr === ",") { 1316 pushComponent(); 1317 pushComponentArray(); 1318 pos += 1; 1319 continue; 1320 } else if ( (chrctr === "/") && (str.charAt(pos + 1) === "*") ) { 1321 inComment = true; 1322 pos += 2; 1323 continue; 1324 } 1325 1326 component = component + chrctr; 1327 pos += 1; 1328 } 1329 } 1330 1331 function isValidNonNegativeSourceSizeValue(s) { 1332 if (regexCssLengthWithUnits.test(s) && (parseFloat(s) >= 0)) {return true;} 1333 if (regexCssCalc.test(s)) {return true;} 1334 // ( http://www.w3.org/TR/CSS2/syndata.html#numbers says: 1335 // "-0 is equivalent to 0 and is not a negative number." which means that 1336 // unitless zero and unitless negative zero must be accepted as special cases.) 1337 if ((s === "0") || (s === "-0") || (s === "+0")) {return true;} 1338 return false; 1339 } 1340 1341 // When asked to parse a sizes attribute from an element, parse a 1342 // comma-separated list of component values from the value of the element's 1343 // sizes attribute (or the empty string, if the attribute is absent), and let 1344 // unparsed sizes list be the result. 1345 // http://dev.w3.org/csswg/css-syntax/#parse-comma-separated-list-of-component-values 1346 1347 unparsedSizesList = parseComponentValues(strValue); 1348 unparsedSizesListLength = unparsedSizesList.length; 1349 1350 // For each unparsed size in unparsed sizes list: 1351 for (i = 0; i < unparsedSizesListLength; i++) { 1352 unparsedSize = unparsedSizesList[i]; 1353 1354 // 1. Remove all consecutive <whitespace-token>s from the end of unparsed size. 1355 // ( parseComponentValues() already omits spaces outside of parens. ) 1356 1357 // If unparsed size is now empty, that is a parse error; continue to the next 1358 // iteration of this algorithm. 1359 // ( parseComponentValues() won't push an empty array. ) 1360 1361 // 2. If the last component value in unparsed size is a valid non-negative 1362 // <source-size-value>, let size be its value and remove the component value 1363 // from unparsed size. Any CSS function other than the calc() function is 1364 // invalid. Otherwise, there is a parse error; continue to the next iteration 1365 // of this algorithm. 1366 // http://dev.w3.org/csswg/css-syntax/#parse-component-value 1367 lastComponentValue = unparsedSize[unparsedSize.length - 1]; 1368 1369 if (isValidNonNegativeSourceSizeValue(lastComponentValue)) { 1370 size = lastComponentValue; 1371 unparsedSize.pop(); 1372 } else { 1373 continue; 1374 } 1375 1376 // 3. Remove all consecutive <whitespace-token>s from the end of unparsed 1377 // size. If unparsed size is now empty, return size and exit this algorithm. 1378 // If this was not the last item in unparsed sizes list, that is a parse error. 1379 if (unparsedSize.length === 0) { 1380 return size; 1381 } 1382 1383 // 4. Parse the remaining component values in unparsed size as a 1384 // <media-condition>. If it does not parse correctly, or it does parse 1385 // correctly but the <media-condition> evaluates to false, continue to the 1386 // next iteration of this algorithm. 1387 // (Parsing all possible compound media conditions in JS is heavy, complicated, 1388 // and the payoff is unclear. Is there ever an situation where the 1389 // media condition parses incorrectly but still somehow evaluates to true? 1390 // Can we just rely on the browser/polyfill to do it?) 1391 unparsedSize = unparsedSize.join(" "); 1392 if (!(pf.matchesMedia( unparsedSize ) ) ) { 1393 continue; 1394 } 1395 1396 // 5. Return size and exit this algorithm. 1397 return size; 1398 } 1399 1400 // If the above algorithm exhausts unparsed sizes list without returning a 1401 // size value, return 100vw. 1402 return "100vw"; 1403 } 1404 1405 // namespace 1406 pf.ns = ("pf" + new Date().getTime()).substr(0, 9); 1407 1408 // srcset support test 1409 pf.supSrcset = "srcset" in image; 1410 pf.supSizes = "sizes" in image; 1411 pf.supPicture = !!window.HTMLPictureElement; 1412 1413 // UC browser does claim to support srcset and picture, but not sizes, 1414 // this extended test reveals the browser does support nothing 1415 if (pf.supSrcset && pf.supPicture && !pf.supSizes) { 1416 (function(image2) { 1417 image.srcset = "data:,a"; 1418 image2.src = "data:,a"; 1419 pf.supSrcset = image.complete === image2.complete; 1420 pf.supPicture = pf.supSrcset && pf.supPicture; 1421 })(document.createElement("img")); 1422 } 1423 1424 // Safari9 has basic support for sizes, but does't expose the `sizes` idl attribute 1425 if (pf.supSrcset && !pf.supSizes) { 1426 1427 (function() { 1428 var width2 = "data:image/gif;base64,R0lGODlhAgABAPAAAP///wAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw=="; 1429 var width1 = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; 1430 var img = document.createElement("img"); 1431 var test = function() { 1432 var width = img.width; 1433 1434 if (width === 2) { 1435 pf.supSizes = true; 1436 } 1437 1438 alwaysCheckWDescriptor = pf.supSrcset && !pf.supSizes; 1439 1440 isSupportTestReady = true; 1441 // force async 1442 setTimeout(picturefill); 1443 }; 1444 1445 img.onload = test; 1446 img.onerror = test; 1447 img.setAttribute("sizes", "9px"); 1448 1449 img.srcset = width1 + " 1w," + width2 + " 9w"; 1450 img.src = width1; 1451 })(); 1452 1453 } else { 1454 isSupportTestReady = true; 1455 } 1456 1457 // using pf.qsa instead of dom traversing does scale much better, 1458 // especially on sites mixing responsive and non-responsive images 1459 pf.selShort = "picture>img,img[srcset]"; 1460 pf.sel = pf.selShort; 1461 pf.cfg = cfg; 1462 1463 /** 1464 * Shortcut property for `devicePixelRatio` ( for easy overriding in tests ) 1465 */ 1466 pf.DPR = (DPR || 1 ); 1467 pf.u = units; 1468 1469 // container of supported mime types that one might need to qualify before using 1470 pf.types = types; 1471 1472 pf.setSize = noop; 1473 1474 /** 1475 * Gets a string and returns the absolute URL 1476 * @param src 1477 * @returns {String} absolute URL 1478 */ 1479 1480 pf.makeUrl = memoize(function(src) { 1481 anchor.href = src; 1482 return anchor.href; 1483 }); 1484 1485 /** 1486 * Gets a DOM element or document and a selctor and returns the found matches 1487 * Can be extended with jQuery/Sizzle for IE7 support 1488 * @param context 1489 * @param sel 1490 * @returns {NodeList|Array} 1491 */ 1492 pf.qsa = function(context, sel) { 1493 return ( "querySelector" in context ) ? context.querySelectorAll(sel) : []; 1494 }; 1495 1496 /** 1497 * Shortcut method for matchMedia ( for easy overriding in tests ) 1498 * wether native or pf.mMQ is used will be decided lazy on first call 1499 * @returns {boolean} 1500 */ 1501 pf.matchesMedia = function() { 1502 if ( window.matchMedia && (matchMedia( "(min-width: 0.1em)" ) || {}).matches ) { 1503 pf.matchesMedia = function( media ) { 1504 return !media || ( matchMedia( media ).matches ); 1505 }; 1506 } else { 1507 pf.matchesMedia = pf.mMQ; 1508 } 1509 1510 return pf.matchesMedia.apply( this, arguments ); 1511 }; 1512 1513 /** 1514 * A simplified matchMedia implementation for IE8 and IE9 1515 * handles only min-width/max-width with px or em values 1516 * @param media 1517 * @returns {boolean} 1518 */ 1519 pf.mMQ = function( media ) { 1520 return media ? evalCSS(media) : true; 1521 }; 1522 1523 /** 1524 * Returns the calculated length in css pixel from the given sourceSizeValue 1525 * http://dev.w3.org/csswg/css-values-3/#length-value 1526 * intended Spec mismatches: 1527 * * Does not check for invalid use of CSS functions 1528 * * Does handle a computed length of 0 the same as a negative and therefore invalid value 1529 * @param sourceSizeValue 1530 * @returns {Number} 1531 */ 1532 pf.calcLength = function( sourceSizeValue ) { 1533 1534 var value = evalCSS(sourceSizeValue, true) || false; 1535 if (value < 0) { 1536 value = false; 1537 } 1538 1539 return value; 1540 }; 1541 1542 /** 1543 * Takes a type string and checks if its supported 1544 */ 1545 1546 pf.supportsType = function( type ) { 1547 return ( type ) ? types[ type ] : true; 1548 }; 1549 1550 /** 1551 * Parses a sourceSize into mediaCondition (media) and sourceSizeValue (length) 1552 * @param sourceSizeStr 1553 * @returns {*} 1554 */ 1555 pf.parseSize = memoize(function( sourceSizeStr ) { 1556 var match = ( sourceSizeStr || "" ).match(regSize); 1557 return { 1558 media: match && match[1], 1559 length: match && match[2] 1560 }; 1561 }); 1562 1563 pf.parseSet = function( set ) { 1564 if ( !set.cands ) { 1565 set.cands = parseSrcset(set.srcset, set); 1566 } 1567 return set.cands; 1568 }; 1569 1570 /** 1571 * returns 1em in css px for html/body default size 1572 * function taken from respondjs 1573 * @returns {*|number} 1574 */ 1575 pf.getEmValue = function() { 1576 var body; 1577 if ( !eminpx && (body = document.body) ) { 1578 var div = document.createElement( "div" ), 1579 originalHTMLCSS = docElem.style.cssText, 1580 originalBodyCSS = body.style.cssText; 1581 1582 div.style.cssText = baseStyle; 1583 1584 // 1em in a media query is the value of the default font size of the browser 1585 // reset docElem and body to ensure the correct value is returned 1586 docElem.style.cssText = fsCss; 1587 body.style.cssText = fsCss; 1588 1589 body.appendChild( div ); 1590 eminpx = div.offsetWidth; 1591 body.removeChild( div ); 1592 1593 //also update eminpx before returning 1594 eminpx = parseFloat( eminpx, 10 ); 1595 1596 // restore the original values 1597 docElem.style.cssText = originalHTMLCSS; 1598 body.style.cssText = originalBodyCSS; 1599 1600 } 1601 return eminpx || 16; 1602 }; 1603 1604 /** 1605 * Takes a string of sizes and returns the width in pixels as a number 1606 */ 1607 pf.calcListLength = function( sourceSizeListStr ) { 1608 // Split up source size list, ie ( max-width: 30em ) 100%, ( max-width: 50em ) 50%, 33% 1609 // 1610 // or (min-width:30em) calc(30% - 15px) 1611 if ( !(sourceSizeListStr in sizeLengthCache) || cfg.uT ) { 1612 var winningLength = pf.calcLength( parseSizes( sourceSizeListStr ) ); 1613 1614 sizeLengthCache[ sourceSizeListStr ] = !winningLength ? units.width : winningLength; 1615 } 1616 1617 return sizeLengthCache[ sourceSizeListStr ]; 1618 }; 1619 1620 /** 1621 * Takes a candidate object with a srcset property in the form of url/ 1622 * ex. "images/pic-medium.png 1x, images/pic-medium-2x.png 2x" or 1623 * "images/pic-medium.png 400w, images/pic-medium-2x.png 800w" or 1624 * "images/pic-small.png" 1625 * Get an array of image candidates in the form of 1626 * {url: "/foo/bar.png", resolution: 1} 1627 * where resolution is http://dev.w3.org/csswg/css-values-3/#resolution-value 1628 * If sizes is specified, res is calculated 1629 */ 1630 pf.setRes = function( set ) { 1631 var candidates; 1632 if ( set ) { 1633 1634 candidates = pf.parseSet( set ); 1635 1636 for ( var i = 0, len = candidates.length; i < len; i++ ) { 1637 setResolution( candidates[ i ], set.sizes ); 1638 } 1639 } 1640 return candidates; 1641 }; 1642 1643 pf.setRes.res = setResolution; 1644 1645 pf.applySetCandidate = function( candidates, img ) { 1646 if ( !candidates.length ) {return;} 1647 var candidate, 1648 i, 1649 j, 1650 length, 1651 bestCandidate, 1652 curSrc, 1653 curCan, 1654 candidateSrc, 1655 abortCurSrc; 1656 1657 var imageData = img[ pf.ns ]; 1658 var dpr = pf.DPR; 1659 1660 curSrc = imageData.curSrc || img[curSrcProp]; 1661 1662 curCan = imageData.curCan || setSrcToCur(img, curSrc, candidates[0].set); 1663 1664 // if we have a current source, we might either become lazy or give this source some advantage 1665 if ( curCan && curCan.set === candidates[ 0 ].set ) { 1666 1667 // if browser can abort image request and the image has a higher pixel density than needed 1668 // and this image isn't downloaded yet, we skip next part and try to save bandwidth 1669 abortCurSrc = (supportAbort && !img.complete && curCan.res - 0.1 > dpr); 1670 1671 if ( !abortCurSrc ) { 1672 curCan.cached = true; 1673 1674 // if current candidate is "best", "better" or "okay", 1675 // set it to bestCandidate 1676 if ( curCan.res >= dpr ) { 1677 bestCandidate = curCan; 1678 } 1679 } 1680 } 1681 1682 if ( !bestCandidate ) { 1683 1684 candidates.sort( ascendingSort ); 1685 1686 length = candidates.length; 1687 bestCandidate = candidates[ length - 1 ]; 1688 1689 for ( i = 0; i < length; i++ ) { 1690 candidate = candidates[ i ]; 1691 if ( candidate.res >= dpr ) { 1692 j = i - 1; 1693 1694 // we have found the perfect candidate, 1695 // but let's improve this a little bit with some assumptions ;-) 1696 if (candidates[ j ] && 1697 (abortCurSrc || curSrc !== pf.makeUrl( candidate.url )) && 1698 chooseLowRes(candidates[ j ].res, candidate.res, dpr, candidates[ j ].cached)) { 1699 1700 bestCandidate = candidates[ j ]; 1701 1702 } else { 1703 bestCandidate = candidate; 1704 } 1705 break; 1706 } 1707 } 1708 } 1709 1710 if ( bestCandidate ) { 1711 1712 candidateSrc = pf.makeUrl( bestCandidate.url ); 1713 1714 imageData.curSrc = candidateSrc; 1715 imageData.curCan = bestCandidate; 1716 1717 if ( candidateSrc !== curSrc ) { 1718 pf.setSrc( img, bestCandidate ); 1719 } 1720 pf.setSize( img ); 1721 } 1722 }; 1723 1724 pf.setSrc = function( img, bestCandidate ) { 1725 var origWidth; 1726 img.src = bestCandidate.url; 1727 1728 // although this is a specific Safari issue, we don't want to take too much different code paths 1729 if ( bestCandidate.set.type === "image/svg+xml" ) { 1730 origWidth = img.style.width; 1731 img.style.width = (img.offsetWidth + 1) + "px"; 1732 1733 // next line only should trigger a repaint 1734 // if... is only done to trick dead code removal 1735 if ( img.offsetWidth + 1 ) { 1736 img.style.width = origWidth; 1737 } 1738 } 1739 }; 1740 1741 pf.getSet = function( img ) { 1742 var i, set, supportsType; 1743 var match = false; 1744 var sets = img [ pf.ns ].sets; 1745 1746 for ( i = 0; i < sets.length && !match; i++ ) { 1747 set = sets[i]; 1748 1749 if ( !set.srcset || !pf.matchesMedia( set.media ) || !(supportsType = pf.supportsType( set.type )) ) { 1750 continue; 1751 } 1752 1753 if ( supportsType === "pending" ) { 1754 set = supportsType; 1755 } 1756 1757 match = set; 1758 break; 1759 } 1760 1761 return match; 1762 }; 1763 1764 pf.parseSets = function( element, parent, options ) { 1765 var srcsetAttribute, imageSet, isWDescripor, srcsetParsed; 1766 1767 var hasPicture = parent && parent.nodeName.toUpperCase() === "PICTURE"; 1768 var imageData = element[ pf.ns ]; 1769 1770 if ( imageData.src === undefined || options.src ) { 1771 imageData.src = getImgAttr.call( element, "src" ); 1772 if ( imageData.src ) { 1773 setImgAttr.call( element, srcAttr, imageData.src ); 1774 } else { 1775 removeImgAttr.call( element, srcAttr ); 1776 } 1777 } 1778 1779 if ( imageData.srcset === undefined || options.srcset || !pf.supSrcset || element.srcset ) { 1780 srcsetAttribute = getImgAttr.call( element, "srcset" ); 1781 imageData.srcset = srcsetAttribute; 1782 srcsetParsed = true; 1783 } 1784 1785 imageData.sets = []; 1786 1787 if ( hasPicture ) { 1788 imageData.pic = true; 1789 getAllSourceElements( parent, imageData.sets ); 1790 } 1791 1792 if ( imageData.srcset ) { 1793 imageSet = { 1794 srcset: imageData.srcset, 1795 sizes: getImgAttr.call( element, "sizes" ) 1796 }; 1797 1798 imageData.sets.push( imageSet ); 1799 1800 isWDescripor = (alwaysCheckWDescriptor || imageData.src) && regWDesc.test(imageData.srcset || ""); 1801 1802 // add normal src as candidate, if source has no w descriptor 1803 if ( !isWDescripor && imageData.src && !getCandidateForSrc(imageData.src, imageSet) && !imageSet.has1x ) { 1804 imageSet.srcset += ", " + imageData.src; 1805 imageSet.cands.push({ 1806 url: imageData.src, 1807 d: 1, 1808 set: imageSet 1809 }); 1810 } 1811 1812 } else if ( imageData.src ) { 1813 imageData.sets.push( { 1814 srcset: imageData.src, 1815 sizes: null 1816 } ); 1817 } 1818 1819 imageData.curCan = null; 1820 imageData.curSrc = undefined; 1821 1822 // if img has picture or the srcset was removed or has a srcset and does not support srcset at all 1823 // or has a w descriptor (and does not support sizes) set support to false to evaluate 1824 imageData.supported = !( hasPicture || ( imageSet && !pf.supSrcset ) || (isWDescripor && !pf.supSizes) ); 1825 1826 if ( srcsetParsed && pf.supSrcset && !imageData.supported ) { 1827 if ( srcsetAttribute ) { 1828 setImgAttr.call( element, srcsetAttr, srcsetAttribute ); 1829 element.srcset = ""; 1830 } else { 1831 removeImgAttr.call( element, srcsetAttr ); 1832 } 1833 } 1834 1835 if (imageData.supported && !imageData.srcset && ((!imageData.src && element.src) || element.src !== pf.makeUrl(imageData.src))) { 1836 if (imageData.src === null) { 1837 element.removeAttribute("src"); 1838 } else { 1839 element.src = imageData.src; 1840 } 1841 } 1842 1843 imageData.parsed = true; 1844 }; 1845 1846 pf.fillImg = function(element, options) { 1847 var imageData; 1848 var extreme = options.reselect || options.reevaluate; 1849 1850 // expando for caching data on the img 1851 if ( !element[ pf.ns ] ) { 1852 element[ pf.ns ] = {}; 1853 } 1854 1855 imageData = element[ pf.ns ]; 1856 1857 // if the element has already been evaluated, skip it 1858 // unless `options.reevaluate` is set to true ( this, for example, 1859 // is set to true when running `picturefill` on `resize` ). 1860 if ( !extreme && imageData.evaled === evalId ) { 1861 return; 1862 } 1863 1864 if ( !imageData.parsed || options.reevaluate ) { 1865 pf.parseSets( element, element.parentNode, options ); 1866 } 1867 1868 if ( !imageData.supported ) { 1869 applyBestCandidate( element ); 1870 } else { 1871 imageData.evaled = evalId; 1872 } 1873 }; 1874 1875 pf.setupRun = function() { 1876 if ( !alreadyRun || isVwDirty || (DPR !== window.devicePixelRatio) ) { 1877 updateMetrics(); 1878 } 1879 }; 1880 1881 // If picture is supported, well, that's awesome. 1882 if ( pf.supPicture ) { 1883 picturefill = noop; 1884 pf.fillImg = noop; 1885 } else { 1886 1887 // Set up picture polyfill by polling the document 1888 (function() { 1889 var isDomReady; 1890 var regReady = window.attachEvent ? /d$|^c/ : /d$|^c|^i/; 1891 1892 var run = function() { 1893 var readyState = document.readyState || ""; 1894 1895 timerId = setTimeout(run, readyState === "loading" ? 200 : 999); 1896 if ( document.body ) { 1897 pf.fillImgs(); 1898 isDomReady = isDomReady || regReady.test(readyState); 1899 if ( isDomReady ) { 1900 clearTimeout( timerId ); 1901 } 1902 1903 } 1904 }; 1905 1906 var timerId = setTimeout(run, document.body ? 9 : 99); 1907 1908 // Also attach picturefill on resize and readystatechange 1909 // http://modernjavascript.blogspot.com/2013/08/building-better-debounce.html 1910 var debounce = function(func, wait) { 1911 var timeout, timestamp; 1912 var later = function() { 1913 var last = (new Date()) - timestamp; 1914 1915 if (last < wait) { 1916 timeout = setTimeout(later, wait - last); 1917 } else { 1918 timeout = null; 1919 func(); 1920 } 1921 }; 1922 1923 return function() { 1924 timestamp = new Date(); 1925 1926 if (!timeout) { 1927 timeout = setTimeout(later, wait); 1928 } 1929 }; 1930 }; 1931 var lastClientWidth = docElem.clientHeight; 1932 var onResize = function() { 1933 isVwDirty = Math.max(window.innerWidth || 0, docElem.clientWidth) !== units.width || docElem.clientHeight !== lastClientWidth; 1934 lastClientWidth = docElem.clientHeight; 1935 if ( isVwDirty ) { 1936 pf.fillImgs(); 1937 } 1938 }; 1939 1940 on( window, "resize", debounce(onResize, 99 ) ); 1941 on( document, "readystatechange", run ); 1942 })(); 1943 } 1944 1945 pf.picturefill = picturefill; 1946 //use this internally for easy monkey patching/performance testing 1947 pf.fillImgs = picturefill; 1948 pf.teardownRun = noop; 1949 1950 /* expose methods for testing */ 1951 picturefill._ = pf; 1952 1953 window.picturefillCFG = { 1954 pf: pf, 1955 push: function(args) { 1956 var name = args.shift(); 1957 if (typeof pf[name] === "function") { 1958 pf[name].apply(pf, args); 1959 } else { 1960 cfg[name] = args[0]; 1961 if (alreadyRun) { 1962 pf.fillImgs( { reselect: true } ); 1963 } 1964 } 1965 } 1966 }; 1967 1968 while (setOptions && setOptions.length) { 1969 window.picturefillCFG.push(setOptions.shift()); 1970 } 1971 1972 /* expose picturefill */ 1973 window.picturefill = picturefill; 1974 1975 /* expose picturefill */ 1976 if ( typeof module === "object" && typeof module.exports === "object" ) { 1977 // CommonJS, just export 1978 module.exports = picturefill; 1979 } else if ( typeof define === "function" && define.amd ) { 1980 // AMD support 1981 define( "picturefill", function() { return picturefill; } ); 1982 } 1983 1984 // IE8 evals this sync, so it must be the last thing we do 1985 if ( !pf.supPicture ) { 1986 types[ "image/webp" ] = detectTypeSupport("image/webp", "data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==" ); 1987 } 1988 1989} )( window, document );
1990 1991$.fn.extend({ 1992 runFirstOnce: function(t, i) { 1993 "use strict"; 1994 var n = "data-initialized-" + t, 1995 a = !1; 1996 return this.each(function() { 1997 var t = $(this), 1998 r = t.attr(n); 1999 a || void 0 === r && (t.attr(n, "initialized"), i.call(this), a = !0) 2000 }) 2001 } 2002}); 2003 2004/* 2005 _ _ _ _ 2006 ___| (_) ___| | __ (_)___ 2007/ __| | |/ __| |/ / | / __| 2008\__ \ | | (__| < _ | \__ \ 2009|___/_|_|\___|_|\_(_)/ |___/ 2010 |__/ 2011 2012 Version: 1.8.1 2013 Author: Ken Wheeler 2014 Website: http://kenwheeler.github.io 2015 Docs: http://kenwheeler.github.io/slick 2016 Repo: http://github.com/kenwheeler/slick 2017 Issues: http://github.com/kenwheeler/slick/issues 2018 2019 */ 2020/* global window, document, define, jQuery, setInterval, clearInterval */ 2021;(function(factory) { 2022 'use strict'; 2023 if (typeof define === 'function' && define.amd) { 2024 define(['jquery'], factory); 2025 } else if (typeof exports !== 'undefined') { 2026 module.exports = factory(require('jquery')); 2027 } else { 2028 factory(jQuery); 2029 } 2030 2031}(function($) { 2032 'use strict'; 2033 var Slick = window.Slick || {}; 2034 2035 Slick = (function() { 2036 2037 var instanceUid = 0; 2038 2039 function Slick(element, settings) { 2040 2041 var _ = this, dataSettings; 2042 2043 _.defaults = { 2044 accessibility: true, 2045 adaptiveHeight: false, 2046 appendArrows: $(element), 2047 appendDots: $(element), 2048 arrows: true, 2049 asNavFor: null, 2050 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 2051 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 2052 autoplay: false, 2053 autoplaySpeed: 3000, 2054 centerMode: false, 2055 centerPadding: '50px', 2056 cssEase: 'ease', 2057 customPaging: function(slider, i) { 2058 return $('<button type="button" />').text(i + 1); 2059 }, 2060 dots: false, 2061 dotsClass: 'slick-dots', 2062 draggable: true, 2063 easing: 'linear', 2064 edgeFriction: 0.35, 2065 fade: false, 2066 focusOnSelect: false, 2067 focusOnChange: false, 2068 infinite: true, 2069 initialSlide: 0, 2070 lazyLoad: 'ondemand', 2071 mobileFirst: false, 2072 pauseOnHover: true, 2073 pauseOnFocus: true, 2074 pauseOnDotsHover: false, 2075 respondTo: 'window', 2076 responsive: null, 2077 rows: 1, 2078 rtl: false, 2079 slide: '', 2080 slidesPerRow: 1, 2081 slidesToShow: 1, 2082 slidesToScroll: 1, 2083 speed: 500, 2084 swipe: true, 2085 swipeToSlide: false, 2086 touchMove: true, 2087 touchThreshold: 5, 2088 useCSS: true, 2089 useTransform: true, 2090 variableWidth: false, 2091 vertical: false, 2092 verticalSwiping: false, 2093 waitForAnimate: true, 2094 zIndex: 1000 2095 }; 2096 2097 _.initials = { 2098 animating: false, 2099 dragging: false, 2100 autoPlayTimer: null, 2101 currentDirection: 0, 2102 currentLeft: null, 2103 currentSlide: 0, 2104 direction: 1, 2105 $dots: null, 2106 listWidth: null, 2107 listHeight: null, 2108 loadIndex: 0, 2109 $nextArrow: null, 2110 $prevArrow: null, 2111 scrolling: false, 2112 slideCount: null, 2113 slideWidth: null, 2114 $slideTrack: null, 2115 $slides: null, 2116 sliding: false, 2117 slideOffset: 0, 2118 swipeLeft: null, 2119 swiping: false, 2120 $list: null, 2121 touchObject: {}, 2122 transformsEnabled: false,
2123 unslicked: false 2124 }; 2125 2126 $.extend(_, _.initials); 2127 2128 _.activeBreakpoint = null; 2129 _.animType = null; 2130 _.animProp = null; 2131 _.breakpoints = []; 2132 _.breakpointSettings = []; 2133 _.cssTransitions = false; 2134 _.focussed = false; 2135 _.interrupted = false; 2136 _.hidden = 'hidden'; 2137 _.paused = true; 2138 _.positionProp = null; 2139 _.respondTo = null; 2140 _.rowCount = 1; 2141 _.shouldClick = true; 2142 _.$slider = $(element); 2143 _.$slidesCache = null; 2144 _.transformType = null; 2145 _.transitionType = null; 2146 _.visibilityChange = 'visibilitychange'; 2147 _.windowWidth = 0; 2148 _.windowTimer = null; 2149 2150 dataSettings = $(element).data('slick') || {}; 2151 2152 _.options = $.extend({}, _.defaults, settings, dataSettings); 2153 2154 _.currentSlide = _.options.initialSlide; 2155 2156 _.originalSettings = _.options; 2157 2158 if (typeof document.mozHidden !== 'undefined') { 2159 _.hidden = 'mozHidden'; 2160 _.visibilityChange = 'mozvisibilitychange'; 2161 } else if (typeof document.webkitHidden !== 'undefined') { 2162 _.hidden = 'webkitHidden'; 2163 _.visibilityChange = 'webkitvisibilitychange'; 2164 } 2165 2166 _.autoPlay = $.proxy(_.autoPlay, _); 2167 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 2168 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 2169 _.changeSlide = $.proxy(_.changeSlide, _); 2170 _.clickHandler = $.proxy(_.clickHandler, _); 2171 _.selectHandler = $.proxy(_.selectHandler, _); 2172 _.setPosition = $.proxy(_.setPosition, _); 2173 _.swipeHandler = $.proxy(_.swipeHandler, _); 2174 _.dragHandler = $.proxy(_.dragHandler, _); 2175 _.keyHandler = $.proxy(_.keyHandler, _); 2176 2177 _.instanceUid = instanceUid++; 2178 2179 // A simple way to check for HTML strings 2180 // Strict HTML recognition (must start with <) 2181 // Extracted from jQuery v1.11 source 2182 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 2183 2184 2185 _.registerBreakpoints(); 2186 _.init(true); 2187 2188 } 2189 2190 return Slick; 2191 2192 }()); 2193 2194 Slick.prototype.activateADA = function() { 2195 var _ = this; 2196 2197 _.$slideTrack.find('.slick-active').attr({ 2198 'aria-hidden': 'false' 2199 }).find('a, input, button, select').attr({ 2200 'tabindex': '0' 2201 }); 2202 2203 }; 2204 2205 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 2206 2207 var _ = this; 2208 2209 if (typeof(index) === 'boolean') { 2210 addBefore = index; 2211 index = null; 2212 } else if (index < 0 || (index >= _.slideCount)) { 2213 return false; 2214 } 2215 2216 _.unload(); 2217 2218 if (typeof(index) === 'number') { 2219 if (index === 0 && _.$slides.length === 0) { 2220 $(markup).appendTo(_.$slideTrack); 2221 } else if (addBefore) { 2222 $(markup).insertBefore(_.$slides.eq(index)); 2223 } else { 2224 $(markup).insertAfter(_.$slides.eq(index)); 2225 } 2226 } else { 2227 if (addBefore === true) { 2228 $(markup).prependTo(_.$slideTrack); 2229 } else { 2230 $(markup).appendTo(_.$slideTrack); 2231 } 2232 } 2233 2234 _.$slides = _.$slideTrack.children(this.options.slide); 2235 2236 _.$slideTrack.children(this.options.slide).detach(); 2237 2238 _.$slideTrack.append(_.$slides); 2239 2240 _.$slides.each(function(index, element) { 2241 $(element).attr('data-slick-index', index); 2242 }); 2243 2244 _.$slidesCache = _.$slides; 2245 2246 _.reinit(); 2247 2248 }; 2249 2250 Slick.prototype.animateHeight = function() { 2251 var _ = this; 2252 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 2253 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 2254 _.$list.animate({ 2255 height: targetHeight 2256 }, _.options.speed); 2257 } 2258 }; 2259 2260 Slick.prototype.animateSlide = function(targetLeft, callback) { 2261 2262 var animProps = {}, 2263 _ = this; 2264 2265 _.animateHeight(); 2266 2267 if (_.options.rtl === true && _.options.vertical === false) { 2268 targetLeft = -targetLeft; 2269 } 2270 if (_.transformsEnabled === false) { 2271 if (_.options.vertical === false) { 2272 _.$slideTrack.animate({ 2273 left: targetLeft 2274 }, _.options.speed, _.options.easing, callback); 2275 } else { 2276 _.$slideTrack.animate({ 2277 top: targetLeft 2278 }, _.options.speed, _.options.easing, callback); 2279 } 2280 2281 } else { 2282 2283 if (_.cssTransitions === false) { 2284 if (_.options.rtl === true) { 2285 _.currentLeft = -(_.currentLeft); 2286 } 2287 $({ 2288 animStart: _.currentLeft 2289 }).animate({ 2290 animStart: targetLeft 2291 }, { 2292 duration: _.options.speed, 2293 easing: _.options.easing, 2294 step: function(now) { 2295 now = Math.ceil(now); 2296 if (_.options.vertical === false) { 2297 animProps[_.animType] = 'translate(' + 2298 now + 'px, 0px)'; 2299 _.$slideTrack.css(animProps); 2300 } else { 2301 animProps[_.animType] = 'translate(0px,' + 2302 now + 'px)'; 2303 _.$slideTrack.css(animProps); 2304 } 2305 }, 2306 complete: function() { 2307 if (callback) { 2308 callback.call(); 2309 } 2310 } 2311 }); 2312 2313 } else { 2314 2315 _.applyTransition();
2316 targetLeft = Math.ceil(targetLeft); 2317 2318 if (_.options.vertical === false) { 2319 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 2320 } else { 2321 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 2322 } 2323 _.$slideTrack.css(animProps); 2324 2325 if (callback) { 2326 setTimeout(function() { 2327 2328 _.disableTransition(); 2329 2330 callback.call(); 2331 }, _.options.speed); 2332 } 2333 2334 } 2335 2336 } 2337 2338 }; 2339 2340 Slick.prototype.getNavTarget = function() { 2341 2342 var _ = this, 2343 asNavFor = _.options.asNavFor; 2344 2345 if ( asNavFor && asNavFor !== null ) { 2346 asNavFor = $(asNavFor).not(_.$slider); 2347 } 2348 2349 return asNavFor; 2350 2351 }; 2352 2353 Slick.prototype.asNavFor = function(index) { 2354 2355 var _ = this, 2356 asNavFor = _.getNavTarget(); 2357 2358 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 2359 asNavFor.each(function() { 2360 var target = $(this).slick('getSlick'); 2361 if(!target.unslicked) { 2362 target.slideHandler(index, true); 2363 } 2364 }); 2365 } 2366 2367 }; 2368 2369 Slick.prototype.applyTransition = function(slide) { 2370 2371 var _ = this, 2372 transition = {}; 2373 2374 if (_.options.fade === false) { 2375 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 2376 } else { 2377 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 2378 } 2379 2380 if (_.options.fade === false) { 2381 _.$slideTrack.css(transition); 2382 } else { 2383 _.$slides.eq(slide).css(transition); 2384 } 2385 2386 }; 2387 2388 Slick.prototype.autoPlay = function() { 2389 2390 var _ = this; 2391 2392 _.autoPlayClear(); 2393 2394 if ( _.slideCount > _.options.slidesToShow ) { 2395 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 2396 } 2397 2398 }; 2399 2400 Slick.prototype.autoPlayClear = function() { 2401 2402 var _ = this; 2403 2404 if (_.autoPlayTimer) { 2405 clearInterval(_.autoPlayTimer); 2406 } 2407 2408 }; 2409 2410 Slick.prototype.autoPlayIterator = function() { 2411 2412 var _ = this, 2413 slideTo = _.currentSlide + _.options.slidesToScroll; 2414 2415 if ( !_.paused && !_.interrupted && !_.focussed ) { 2416 2417 if ( _.options.infinite === false ) { 2418 2419 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 2420 _.direction = 0; 2421 } 2422 2423 else if ( _.direction === 0 ) { 2424 2425 slideTo = _.currentSlide - _.options.slidesToScroll; 2426 2427 if ( _.currentSlide - 1 === 0 ) { 2428 _.direction = 1; 2429 } 2430 2431 } 2432 2433 } 2434 2435 _.slideHandler( slideTo ); 2436 2437 } 2438 2439 }; 2440 2441 Slick.prototype.buildArrows = function() { 2442 2443 var _ = this; 2444 2445 if (_.options.arrows === true ) { 2446 2447 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 2448 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 2449 2450 if( _.slideCount > _.options.slidesToShow ) { 2451 2452 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 2453 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 2454 2455 if (_.htmlExpr.test(_.options.prevArrow)) { 2456 _.$prevArrow.prependTo(_.options.appendArrows); 2457 } 2458 2459 if (_.htmlExpr.test(_.options.nextArrow)) { 2460 _.$nextArrow.appendTo(_.options.appendArrows); 2461 } 2462 2463 if (_.options.infinite !== true) { 2464 _.$prevArrow 2465 .addClass('slick-disabled') 2466 .attr('aria-disabled', 'true'); 2467 } 2468 2469 } else { 2470 2471 _.$prevArrow.add( _.$nextArrow ) 2472 2473 .addClass('slick-hidden') 2474 .attr({ 2475 'aria-disabled': 'true', 2476 'tabindex': '-1' 2477 }); 2478 2479 } 2480 2481 } 2482 2483 }; 2484 2485 Slick.prototype.buildDots = function() { 2486 2487 var _ = this, 2488 i, dot; 2489 2490 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2491 2492 _.$slider.addClass('slick-dotted'); 2493 2494 dot = $('<ul />').addClass(_.options.dotsClass); 2495 2496 for (i = 0; i <= _.getDotCount(); i += 1) { 2497 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 2498 } 2499 2500 _.$dots = dot.appendTo(_.options.appendDots); 2501 2502 _.$dots.find('li').first().addClass('slick-active'); 2503 2504 } 2505 2506 }; 2507 2508 Slick.prototype.buildOut = function() { 2509 2510 var _ = this; 2511 2512 _.$slides = 2513 _.$slider 2514 .children( _.options.slide + ':not(.slick-cloned)') 2515 .addClass('slick-slide'); 2516 2517 _.slideCount = _.$slides.length; 2518 2519 _.$slides.each(function(index, element) { 2520 $(element) 2521 .attr('data-slick-index', index) 2522 .data('originalStyling', $(element).attr('style') || ''); 2523 }); 2524 2525 _.$slider.addClass('slick-slider'); 2526 2527 _.$slideTrack = (_.slideCount === 0) ? 2528 $('<div class="slick-track"/>').appendTo(_.$slider) : 2529 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 2530 2531 _.$list = _.$slideTrack.wrap( 2532 '<div class="slick-list"/>').parent(); 2533 _.$slideTrack.css('opacity', 0); 2534 2535 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
2536 _.options.slidesToScroll = 1; 2537 } 2538 2539 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 2540 2541 _.setupInfinite(); 2542 2543 _.buildArrows(); 2544 2545 _.buildDots(); 2546 2547 _.updateDots(); 2548 2549 2550 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 2551 2552 if (_.options.draggable === true) { 2553 _.$list.addClass('draggable'); 2554 } 2555 2556 }; 2557 2558 Slick.prototype.buildRows = function() { 2559 2560 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 2561 2562 newSlides = document.createDocumentFragment(); 2563 originalSlides = _.$slider.children(); 2564 2565 if(_.options.rows > 0) { 2566 2567 slidesPerSection = _.options.slidesPerRow * _.options.rows; 2568 numOfSlides = Math.ceil( 2569 originalSlides.length / slidesPerSection 2570 ); 2571 2572 for(a = 0; a < numOfSlides; a++){ 2573 var slide = document.createElement('div'); 2574 for(b = 0; b < _.options.rows; b++) { 2575 var row = document.createElement('div'); 2576 for(c = 0; c < _.options.slidesPerRow; c++) { 2577 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 2578 if (originalSlides.get(target)) { 2579 row.appendChild(originalSlides.get(target)); 2580 } 2581 } 2582 slide.appendChild(row); 2583 } 2584 newSlides.appendChild(slide); 2585 } 2586 2587 _.$slider.empty().append(newSlides); 2588 _.$slider.children().children().children() 2589 .css({ 2590 'width':(100 / _.options.slidesPerRow) + '%', 2591 'display': 'inline-block' 2592 }); 2593 2594 } 2595 2596 }; 2597 2598 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 2599 2600 var _ = this, 2601 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 2602 var sliderWidth = _.$slider.width(); 2603 var windowWidth = window.innerWidth || $(window).width(); 2604 2605 if (_.respondTo === 'window') { 2606 respondToWidth = windowWidth; 2607 } else if (_.respondTo === 'slider') { 2608 respondToWidth = sliderWidth; 2609 } else if (_.respondTo === 'min') { 2610 respondToWidth = Math.min(windowWidth, sliderWidth); 2611 } 2612 2613 if ( _.options.responsive && 2614 _.options.responsive.length && 2615 _.options.responsive !== null) { 2616 2617 targetBreakpoint = null; 2618 2619 for (breakpoint in _.breakpoints) { 2620 if (_.breakpoints.hasOwnProperty(breakpoint)) { 2621 if (_.originalSettings.mobileFirst === false) { 2622 if (respondToWidth < _.breakpoints[breakpoint]) { 2623 targetBreakpoint = _.breakpoints[breakpoint]; 2624 } 2625 } else { 2626 if (respondToWidth > _.breakpoints[breakpoint]) { 2627 targetBreakpoint = _.breakpoints[breakpoint]; 2628 } 2629 } 2630 } 2631 } 2632 2633 if (targetBreakpoint !== null) { 2634 if (_.activeBreakpoint !== null) { 2635 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 2636 _.activeBreakpoint = 2637 targetBreakpoint; 2638 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 2639 _.unslick(targetBreakpoint); 2640 } else { 2641 _.options = $.extend({}, _.originalSettings, 2642 _.breakpointSettings[ 2643 targetBreakpoint]); 2644 if (initial === true) { 2645 _.currentSlide = _.options.initialSlide; 2646 } 2647 _.refresh(initial); 2648 }
2649 triggerBreakpoint = targetBreakpoint; 2650 } 2651 } else { 2652 _.activeBreakpoint = targetBreakpoint; 2653 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 2654 _.unslick(targetBreakpoint); 2655 } else { 2656 _.options = $.extend({}, _.originalSettings, 2657 _.breakpointSettings[ 2658 targetBreakpoint]); 2659 if (initial === true) { 2660 _.currentSlide = _.options.initialSlide; 2661 } 2662 _.refresh(initial); 2663 } 2664 triggerBreakpoint = targetBreakpoint; 2665 } 2666 } else { 2667 if (_.activeBreakpoint !== null) { 2668 _.activeBreakpoint = null; 2669 _.options = _.originalSettings; 2670 if (initial === true) { 2671 _.currentSlide = _.options.initialSlide; 2672 } 2673 _.refresh(initial); 2674 triggerBreakpoint = targetBreakpoint; 2675 } 2676 } 2677 2678 // only trigger breakpoints during an actual break. not on initialize. 2679 if( !initial && triggerBreakpoint !== false ) { 2680 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 2681 } 2682 } 2683 2684 }; 2685 2686 Slick.prototype.changeSlide = function(event, dontAnimate) { 2687 2688 var _ = this, 2689 $target = $(event.currentTarget), 2690 indexOffset, slideOffset, unevenOffset; 2691 2692 // If target is a link, prevent default action. 2693 if($target.is('a')) { 2694 event.preventDefault(); 2695 } 2696 2697 // If target is not the <li> element (ie: a child), find the <li>. 2698 if(!$target.is('li')) { 2699 $target = $target.closest('li'); 2700 } 2701 2702 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 2703 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 2704 2705 switch (event.data.message) { 2706 2707 case 'previous': 2708 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 2709 if (_.slideCount > _.options.slidesToShow) { 2710 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 2711 } 2712 break; 2713 2714 case 'next': 2715 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 2716 if (_.slideCount > _.options.slidesToShow) { 2717 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 2718 } 2719 break; 2720 2721 case 'index': 2722 var index = event.data.index === 0 ? 0 : 2723 event.data.index || $target.index() * _.options.slidesToScroll; 2724 2725 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 2726 $target.children().trigger('focus'); 2727 break; 2728 2729 default: 2730 return; 2731 } 2732 2733 }; 2734 2735 Slick.prototype.checkNavigable = function(index) { 2736 2737 var _ = this, 2738 navigables, prevNavigable; 2739 2740 navigables = _.getNavigableIndexes(); 2741 prevNavigable = 0; 2742 if (index > navigables[navigables.length - 1]) { 2743 index = navigables[navigables.length - 1]; 2744 } else { 2745 for (var n in navigables) { 2746 if (index < navigables[n]) { 2747 index = prevNavigable; 2748 break; 2749 } 2750 prevNavigable = navigables[n]; 2751 } 2752 } 2753 2754 return index; 2755 }; 2756 2757 Slick.prototype.cleanUpEvents = function() { 2758 2759 var _ = this; 2760 2761 if (_.options.dots && _.$dots !== null) { 2762 2763 $('li', _.$dots) 2764 .off('click.slick', _.changeSlide) 2765 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 2766 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 2767 2768 if (_.options.accessibility === true) { 2769 _.$dots.off('keydown.slick', _.keyHandler); 2770 } 2771 } 2772 2773 _.$slider.off('focus.slick blur.slick'); 2774 2775 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2776 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 2777 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 2778 2779 if (_.options.accessibility === true) { 2780 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 2781 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 2782 } 2783 } 2784 2785 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 2786 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 2787 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
2788 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 2789 2790 _.$list.off('click.slick', _.clickHandler); 2791 2792 $(document).off(_.visibilityChange, _.visibility); 2793 2794 _.cleanUpSlideEvents(); 2795 2796 if (_.options.accessibility === true) { 2797 _.$list.off('keydown.slick', _.keyHandler); 2798 } 2799 2800 if (_.options.focusOnSelect === true) { 2801 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 2802 } 2803 2804 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 2805 2806 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 2807 2808 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 2809 2810 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 2811 2812 }; 2813 2814 Slick.prototype.cleanUpSlideEvents = function() { 2815 2816 var _ = this; 2817 2818 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 2819 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 2820 2821 }; 2822 2823 Slick.prototype.cleanUpRows = function() { 2824 2825 var _ = this, originalSlides; 2826 2827 if(_.options.rows > 0) { 2828 originalSlides = _.$slides.children().children(); 2829 originalSlides.removeAttr('style'); 2830 _.$slider.empty().append(originalSlides); 2831 } 2832 2833 }; 2834 2835 Slick.prototype.clickHandler = function(event) { 2836 2837 var _ = this; 2838 2839 if (_.shouldClick === false) { 2840 event.stopImmediatePropagation(); 2841 event.stopPropagation(); 2842 event.preventDefault(); 2843 } 2844 2845 }; 2846 2847 Slick.prototype.destroy = function(refresh) { 2848 2849 var _ = this; 2850 2851 _.autoPlayClear(); 2852 2853 _.touchObject = {}; 2854 2855 _.cleanUpEvents(); 2856 2857 $('.slick-cloned', _.$slider).detach(); 2858 2859 if (_.$dots) { 2860 _.$dots.remove(); 2861 } 2862 2863 if ( _.$prevArrow && _.$prevArrow.length ) { 2864 2865 _.$prevArrow 2866 .removeClass('slick-disabled slick-arrow slick-hidden') 2867 .removeAttr('aria-hidden aria-disabled tabindex') 2868 .css('display',''); 2869 2870 if ( _.htmlExpr.test( _.options.prevArrow )) { 2871 _.$prevArrow.remove(); 2872 } 2873 } 2874 2875 if ( _.$nextArrow && _.$nextArrow.length ) { 2876 2877 _.$nextArrow 2878 .removeClass('slick-disabled slick-arrow slick-hidden') 2879 .removeAttr('aria-hidden aria-disabled tabindex') 2880 .css('display',''); 2881 2882 if ( _.htmlExpr.test( _.options.nextArrow )) { 2883 _.$nextArrow.remove(); 2884 } 2885 } 2886 2887 2888 if (_.$slides) { 2889 2890 _.$slides 2891 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 2892 .removeAttr('aria-hidden') 2893 .removeAttr('data-slick-index') 2894 .each(function(){ 2895 $(this).attr('style', $(this).data('originalStyling')); 2896 }); 2897 2898 _.$slideTrack.children(this.options.slide).detach(); 2899 2900 _.$slideTrack.detach(); 2901 2902 _.$list.detach(); 2903 2904 _.$slider.append(_.$slides); 2905 } 2906 2907 _.cleanUpRows(); 2908 2909 _.$slider.removeClass('slick-slider'); 2910 _.$slider.removeClass('slick-initialized'); 2911 _.$slider.removeClass('slick-dotted'); 2912 2913 _.unslicked = true; 2914 2915 if(!refresh) { 2916 _.$slider.trigger('destroy', [_]); 2917 } 2918 2919 }; 2920 2921 Slick.prototype.disableTransition = function(slide) { 2922 2923 var _ = this, 2924 transition = {}; 2925 2926 transition[_.transitionType] = ''; 2927 2928 if (_.options.fade === false) { 2929 _.$slideTrack.css(transition); 2930 } else { 2931 _.$slides.eq(slide).css(transition); 2932 } 2933 2934 }; 2935 2936 Slick.prototype.fadeSlide = function(slideIndex, callback) { 2937 2938 var _ = this; 2939 2940 if (_.cssTransitions === false) { 2941 2942 _.$slides.eq(slideIndex).css({ 2943 zIndex: _.options.zIndex 2944 }); 2945 2946 _.$slides.eq(slideIndex).animate({ 2947 opacity: 1 2948 }, _.options.speed, _.options.easing, callback); 2949 2950 } else { 2951 2952 _.applyTransition(slideIndex); 2953 2954 _.$slides.eq(slideIndex).css({ 2955 opacity: 1, 2956 zIndex: _.options.zIndex 2957 }); 2958 2959 if (callback) { 2960 setTimeout(function() { 2961 2962 _.disableTransition(slideIndex); 2963 2964 callback.call(); 2965 }, _.options.speed); 2966 } 2967 2968 } 2969 2970 }; 2971 2972 Slick.prototype.fadeSlideOut = function(slideIndex) { 2973 2974 var _ = this; 2975 2976 if (_.cssTransitions === false) { 2977 2978 _.$slides.eq(slideIndex).animate({ 2979 opacity: 0, 2980 zIndex: _.options.zIndex - 2 2981 }, _.options.speed, _.options.easing); 2982 2983 } else { 2984 2985 _.applyTransition(slideIndex); 2986 2987 _.$slides.eq(slideIndex).css({ 2988 opacity: 0, 2989 zIndex: _.options.zIndex - 2 2990 }); 2991 2992 } 2993 2994 }; 2995
2996 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 2997 2998 var _ = this; 2999 3000 if (filter !== null) { 3001 3002 _.$slidesCache = _.$slides; 3003 3004 _.unload(); 3005 3006 _.$slideTrack.children(this.options.slide).detach(); 3007 3008 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 3009 3010 _.reinit(); 3011 3012 } 3013 3014 }; 3015 3016 Slick.prototype.focusHandler = function() { 3017 3018 var _ = this; 3019 3020 // If any child element receives focus within the slider we need to pause the autoplay 3021 _.$slider 3022 .off('focus.slick blur.slick') 3023 .on( 3024 'focus.slick', 3025 '*', 3026 function(event) { 3027 var $sf = $(this); 3028 3029 setTimeout(function() { 3030 if( _.options.pauseOnFocus ) { 3031 if ($sf.is(':focus')) { 3032 _.focussed = true; 3033 _.autoPlay(); 3034 } 3035 } 3036 }, 0); 3037 } 3038 ).on( 3039 'blur.slick', 3040 '*', 3041 function(event) { 3042 var $sf = $(this); 3043 3044 // When a blur occurs on any elements within the slider we become unfocused 3045 if( _.options.pauseOnFocus ) { 3046 _.focussed = false; 3047 _.autoPlay(); 3048 } 3049 } 3050 ); 3051 }; 3052 3053 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 3054 3055 var _ = this; 3056 return _.currentSlide; 3057 3058 }; 3059 3060 Slick.prototype.getDotCount = function() { 3061 3062 var _ = this; 3063 3064 var breakPoint = 0; 3065 var counter = 0; 3066 var pagerQty = 0; 3067 3068 if (_.options.infinite === true) { 3069 if (_.slideCount <= _.options.slidesToShow) { 3070 ++pagerQty; 3071 } else { 3072 while (breakPoint < _.slideCount) { 3073 ++pagerQty; 3074 breakPoint = counter + _.options.slidesToScroll; 3075 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 3076 } 3077 } 3078 } else if (_.options.centerMode === true) { 3079 pagerQty = _.slideCount; 3080 } else if(!_.options.asNavFor) { 3081 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 3082 }else { 3083 while (breakPoint < _.slideCount) { 3084 ++pagerQty; 3085 breakPoint = counter + _.options.slidesToScroll; 3086 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 3087 } 3088 } 3089 3090 return pagerQty - 1; 3091 3092 }; 3093 3094 Slick.prototype.getLeft = function(slideIndex) { 3095 3096 var _ = this, 3097 targetLeft, 3098 verticalHeight, 3099 verticalOffset = 0, 3100 targetSlide, 3101 coef; 3102 3103 _.slideOffset = 0; 3104 verticalHeight = _.$slides.first().outerHeight(true); 3105 3106 if (_.options.infinite === true) { 3107 if (_.slideCount > _.options.slidesToShow) { 3108 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 3109 coef = -1 3110 3111 if (_.options.vertical === true && _.options.centerMode === true) { 3112 if (_.options.slidesToShow === 2) { 3113 coef = -1.5; 3114 } else if (_.options.slidesToShow === 1) { 3115 coef = -2 3116 } 3117 } 3118 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 3119 } 3120 if (_.slideCount % _.options.slidesToScroll !== 0) { 3121 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 3122 if (slideIndex > _.slideCount) { 3123 _.slideOffset = ((_.options.slidesToShow - (sl
3123ideIndex - _.slideCount)) * _.slideWidth) * -1; 3124 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 3125 } else { 3126 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 3127 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 3128 } 3129 } 3130 } 3131 } else { 3132 if (slideIndex + _.options.slidesToShow > _.slideCount) { 3133 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 3134 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 3135 } 3136 } 3137 3138 if (_.slideCount <= _.options.slidesToShow) { 3139 _.slideOffset = 0; 3140 verticalOffset = 0; 3141 } 3142 3143 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 3144 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 3145 } else if (_.options.centerMode === true && _.options.infinite === true) { 3146 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 3147 } else if (_.options.centerMode === true) { 3148 _.slideOffset = 0; 3149 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 3150 } 3151 3152 if (_.options.vertical === false) { 3153 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 3154 } else { 3155 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 3156 } 3157 3158 if (_.options.variableWidth === true) { 3159
3160 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 3161 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 3162 } else { 3163 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 3164 } 3165 3166 if (_.options.rtl === true) { 3167 if (targetSlide[0]) { 3168 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 3169 } else { 3170 targetLeft = 0; 3171 } 3172 } else { 3173 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 3174 } 3175 3176 if (_.options.centerMode === true) { 3177 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 3178 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 3179 } else { 3180 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 3181 } 3182 3183 if (_.options.rtl === true) { 3184 if (targetSlide[0]) { 3185 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 3186 } else { 3187 targetLeft = 0; 3188 } 3189 } else { 3190 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 3191 } 3192 3193 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 3194 } 3195 } 3196 3197 return targetLeft; 3198 3199 }; 3200 3201 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 3202 3203 var _ = this; 3204 3205 return _.options[option]; 3206 3207 }; 3208 3209 Slick.prototype.getNavigableIndexes = function() { 3210 3211 var _ = this, 3212 breakPoint = 0, 3213 counter = 0, 3214 indexes = [], 3215 max; 3216 3217 if (_.options.infinite === false) { 3218 max = _.slideCount; 3219 } else { 3220 breakPoint = _.options.slidesToScroll * -1; 3221 counter = _.options.slidesToScroll * -1; 3222 max = _.slideCount * 2; 3223 } 3224 3225 while (breakPoint < max) { 3226 indexes.push(breakPoint); 3227 breakPoint = counter + _.options.slidesToScroll; 3228 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 3229 } 3230 3231 return indexes; 3232 3233 }; 3234 3235 Slick.prototype.getSlick = function() { 3236 3237 return this; 3238 3239 }; 3240 3241 Slick.prototype.getSlideCount = function() { 3242 3243 var _ = this, 3244 slidesTraversed, swipedSlide, swipeTarget, centerOffset; 3245 3246 centerOffset = _.options.centerMode === true ? Math.floor(_.$list.width() / 2) : 0; 3247 swipeTarget = (_.swipeLeft * -1) + centerOffset; 3248 3249 if (_.options.swipeToSlide === true) { 3250 3251 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 3252 3253 var slideOuterWidth, slideOffset, slideRightBoundary; 3254 slideOuterWidth = $(slide).outerWidth(); 3255 slideOffset = slide.offsetLeft; 3256 if (_.options.centerMode !== true) { 3257 slideOffset += (slideOuterWidth / 2); 3258 } 3259 3260 slideRightBoundary = slideOffset + (slideOuterWidth); 3261 3262 if (swipeTarget < slideRightBoundary) { 3263 swipedSlide = slide; 3264 return false; 3265 } 3266 }); 3267 3268 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 3269 3270 return slidesTraversed; 3271 3272 } else { 3273 return _.options.slidesToScroll; 3274 } 3275 3276 }; 3277 3278 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 3279 3280 var _ = this; 3281 3282 _.changeSlide({ 3283 data: { 3284 message: 'index', 3285 index: parseInt(slide) 3286 } 3287 }, dontAnimate); 3288 3289 }; 3290 3291 Slick.prototype.init = function(creation) { 3292 3293 var _ = this; 3294 3295 if (!$(_.$slider).hasClass('slick-initialized')) { 3296 3297 $(_.$slider).addClass('slick-initialized'); 3298 3299 _.buildRows(); 3300 _.buildOut(); 3301 _.setProps(); 3302 _.startLoad(); 3303 _.loadSlider(); 3304 _.initializeEvents(); 3305 _.updateArrows(); 3306 _.updateDots(); 3307 _.checkResponsive(true); 3308 _.focusHandler(); 3309 3310 } 3311 3312 if (creation) { 3313 _.$slider.trigger('init', [_]); 3314 } 3315 3316 if (_.options.accessibility === true) { 3317 _.initADA(); 3318 } 3319 3320 if ( _.options.autoplay ) { 3321 3322 _.paused = false;
3323 _.autoPlay(); 3324 3325 } 3326 3327 }; 3328 3329 Slick.prototype.initADA = function() { 3330 var _ = this, 3331 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 3332 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 3333 return (val >= 0) && (val < _.slideCount); 3334 }); 3335 3336 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 3337 'aria-hidden': 'true', 3338 'tabindex': '-1' 3339 }).find('a, input, button, select').attr({ 3340 'tabindex': '-1' 3341 }); 3342 3343 if (_.$dots !== null) { 3344 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 3345 var slideControlIndex = tabControlIndexes.indexOf(i); 3346 3347 $(this).attr({ 3348 'role': 'tabpanel', 3349 'id': 'slick-slide' + _.instanceUid + i, 3350 'tabindex': -1 3351 }); 3352 3353 if (slideControlIndex !== -1) { 3354 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex 3355 if ($('#' + ariaButtonControl).length) { 3356 $(this).attr({ 3357 'aria-describedby': ariaButtonControl 3358 }); 3359 } 3360 } 3361 }); 3362 3363 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 3364 var mappedSlideIndex = tabControlIndexes[i]; 3365 3366 $(this).attr({ 3367 'role': 'presentation' 3368 }); 3369 3370 $(this).find('button').first().attr({ 3371 'role': 'tab', 3372 'id': 'slick-slide-control' + _.instanceUid + i, 3373 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 3374 'aria-label': (i + 1) + ' of ' + numDotGroups, 3375 'aria-selected': null, 3376 'tabindex': '-1' 3377 }); 3378 3379 }).eq(_.currentSlide).find('button').attr({ 3380 'aria-selected': 'true', 3381 'tabindex': '0' 3382 }).end(); 3383 } 3384 3385 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 3386 if (_.options.focusOnChange) { 3387 _.$slides.eq(i).attr({'tabindex': '0'}); 3388 } else { 3389 _.$slides.eq(i).removeAttr('tabindex'); 3390 } 3391 } 3392 3393 _.activateADA(); 3394 3395 }; 3396 3397 Slick.prototype.initArrowEvents = function() { 3398 3399 var _ = this; 3400 3401 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 3402 _.$prevArrow 3403 .off('click.slick') 3404 .on('click.slick', { 3405 message: 'previous' 3406 }, _.changeSlide); 3407 _.$nextArrow 3408 .off('click.slick') 3409 .on('click.slick', { 3410 message: 'next' 3411 }, _.changeSlide); 3412 3413 if (_.options.accessibility === true) { 3414 _.$prevArrow.on('keydown.slick', _.keyHandler); 3415 _.$nextArrow.on('keydown.slick', _.keyHandler); 3416 } 3417 } 3418 3419 }; 3420 3421 Slick.prototype.initDotEvents = function() { 3422 3423 var _ = this; 3424 3425 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 3426 $('li', _.$dots).on('click.slick', { 3427 message: 'index' 3428 }, _.changeSlide); 3429 3430 if (_.options.accessibility === true) { 3431 _.$dots.on('keydown.slick', _.keyHandler); 3432 } 3433 } 3434 3435 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 3436 3437 $('li', _.$dots) 3438 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 3439 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 3440 3441 } 3442 3443 }; 3444 3445 Slick.prototype.initSlideEvents = function() { 3446 3447 var _ = this; 3448 3449 if ( _.options.pauseOnHover ) { 3450 3451 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
3452 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 3453 3454 } 3455 3456 }; 3457 3458 Slick.prototype.initializeEvents = function() { 3459 3460 var _ = this; 3461 3462 _.initArrowEvents(); 3463 3464 _.initDotEvents(); 3465 _.initSlideEvents(); 3466 3467 _.$list.on('touchstart.slick mousedown.slick', { 3468 action: 'start' 3469 }, _.swipeHandler); 3470 _.$list.on('touchmove.slick mousemove.slick', { 3471 action: 'move' 3472 }, _.swipeHandler); 3473 _.$list.on('touchend.slick mouseup.slick', { 3474 action: 'end' 3475 }, _.swipeHandler); 3476 _.$list.on('touchcancel.slick mouseleave.slick', { 3477 action: 'end' 3478 }, _.swipeHandler); 3479 3480 _.$list.on('click.slick', _.clickHandler); 3481 3482 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 3483 3484 if (_.options.accessibility === true) { 3485 _.$list.on('keydown.slick', _.keyHandler); 3486 } 3487 3488 if (_.options.focusOnSelect === true) { 3489 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 3490 } 3491 3492 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 3493 3494 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 3495 3496 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 3497 3498 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 3499 $(_.setPosition); 3500 3501 }; 3502 3503 Slick.prototype.initUI = function() { 3504 3505 var _ = this; 3506 3507 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 3508 3509 _.$prevArrow.show(); 3510 _.$nextArrow.show(); 3511 3512 } 3513 3514 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 3515 3516 _.$dots.show(); 3517 3518 } 3519 3520 }; 3521 3522 Slick.prototype.keyHandler = function(event) { 3523 3524 var _ = this; 3525 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 3526 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 3527 if (event.keyCode === 37 && _.options.accessibility === true) { 3528 _.changeSlide({ 3529 data: { 3530 message: _.options.rtl === true ? 'next' : 'previous' 3531 } 3532 }); 3533 } else if (event.keyCode === 39 && _.options.accessibility === true) { 3534 _.changeSlide({ 3535 data: { 3536 message: _.options.rtl === true ? 'previous' : 'next' 3537 } 3538 }); 3539 } 3540 } 3541 3542 }; 3543 3544 Slick.prototype.lazyLoad = function() { 3545 3546 var _ = this, 3547 loadRange, cloneRange, rangeStart, rangeEnd; 3548 3549 function loadImages(imagesScope) { 3550 3551 $('img[data-lazy]', imagesScope).each(function() { 3552 3553 var image = $(this), 3554 imageSource = $(this).attr('data-lazy'), 3555 imageSrcSet = $(this).attr('data-srcset'), 3556 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 3557 imageToLoad = document.createElement('img'); 3558 3559 imageToLoad.onload = function() { 3560 3561 image 3562 .animate({ opacity: 0 }, 100, function() { 3563 3564 if (imageSrcSet) { 3565 image 3566 .attr('srcset', imageSrcSet ); 3567 3568 if (imageSizes) { 3569 image 3570 .attr('sizes', imageSizes ); 3571 } 3572 } 3573 3574 image 3575 .attr('src', imageSource) 3576 .animate({ opacity: 1 }, 200, function() { 3577 image 3578 .removeAttr('data-lazy data-srcset data-sizes') 3579 .removeClass('slick-loading'); 3580 }); 3581 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 3582 }); 3583 3584 }; 3585 3586 imageToLoad.onerror = function() { 3587 3588 image 3589 .removeAttr( 'data-lazy' ) 3590 .removeClass( 'slick-loading' ) 3591 .addClass( 'slick-lazyload-error' ); 3592 3593 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 3594 3595 }; 3596 3597 imageToLoad.src = imageSource; 3598 3599 }); 3600 3601 } 3602 3603 if (_.options.centerMode === true) { 3604 if (_.options.infinite === true) { 3605 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 3606 rangeEnd = rangeStart + _.options.slidesToShow + 2; 3607 } else { 3608 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 3609 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 3610 } 3611 } else {
3612 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 3613 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 3614 if (_.options.fade === true) { 3615 if (rangeStart > 0) rangeStart--; 3616 if (rangeEnd <= _.slideCount) rangeEnd++; 3617 } 3618 } 3619 3620 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 3621 3622 if (_.options.lazyLoad === 'anticipated') { 3623 var prevSlide = rangeStart - 1, 3624 nextSlide = rangeEnd, 3625 $slides = _.$slider.find('.slick-slide'); 3626 3627 for (var i = 0; i < _.options.slidesToScroll; i++) { 3628 if (prevSlide < 0) prevSlide = _.slideCount - 1; 3629 loadRange = loadRange.add($slides.eq(prevSlide)); 3630 loadRange = loadRange.add($slides.eq(nextSlide)); 3631 prevSlide--; 3632 nextSlide++; 3633 } 3634 } 3635 3636 loadImages(loadRange); 3637 3638 if (_.slideCount <= _.options.slidesToShow) { 3639 cloneRange = _.$slider.find('.slick-slide'); 3640 loadImages(cloneRange); 3641 } else 3642 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 3643 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 3644 loadImages(cloneRange); 3645 } else if (_.currentSlide === 0) { 3646 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 3647 loadImages(cloneRange); 3648 } 3649 3650 }; 3651 3652 Slick.prototype.loadSlider = function() { 3653 3654 var _ = this; 3655 3656 _.setPosition(); 3657 3658 _.$slideTrack.css({ 3659 opacity: 1 3660 }); 3661 3662 _.$slider.removeClass('slick-loading'); 3663 3664 _.initUI(); 3665 3666 if (_.options.lazyLoad === 'progressive') { 3667 _.progressiveLazyLoad(); 3668 } 3669 3670 }; 3671 3672 Slick.prototype.next = Slick.prototype.slickNext = function() { 3673 3674 var _ = this; 3675 3676 _.changeSlide({ 3677 data: { 3678 message: 'next' 3679 } 3680 }); 3681 3682 }; 3683 3684 Slick.prototype.orientationChange = function() { 3685 3686 var _ = this; 3687 3688 _.checkResponsive(); 3689 _.setPosition(); 3690 3691 }; 3692 3693 Slick.prototype.pause = Slick.prototype.slickPause = function() { 3694 3695 var _ = this; 3696 3697 _.autoPlayClear(); 3698 _.paused = true; 3699 3700 }; 3701 3702 Slick.prototype.play = Slick.prototype.slickPlay = function() { 3703 3704 var _ = this; 3705 3706 _.autoPlay(); 3707 _.options.autoplay = true; 3708 _.paused = false; 3709 _.focussed = false; 3710 _.interrupted = false; 3711 3712 }; 3713 3714 Slick.prototype.postSlide = function(index) { 3715 3716 var _ = this; 3717 3718 if( !_.unslicked ) { 3719 3720 _.$slider.trigger('afterChange', [_, index]); 3721 3722 _.animating = false; 3723 3724 if (_.slideCount > _.options.slidesToShow) { 3725 _.setPosition(); 3726 } 3727 3728 _.swipeLeft = null; 3729 3730 if ( _.options.autoplay ) { 3731 _.autoPlay(); 3732 } 3733 3734 if (_.options.accessibility === true) { 3735 _.initADA(); 3736 3737 if (_.options.focusOnChange) { 3738 var $currentSlide = $(_.$slides.get(_.currentSlide)); 3739 $currentSlide.attr('tabindex', 0).focus(); 3740 } 3741 } 3742 3743 } 3744 3745 }; 3746 3747 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 3748 3749 var _ = this; 3750 3751 _.changeSlide({ 3752 data: { 3753 message: 'previous' 3754 } 3755 }); 3756 3757 }; 3758 3759 Slick.prototype.preventDefault = function(event) { 3760 3761 event.preventDefault(); 3762 3763 }; 3764 3765 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 3766 3767 tryCount = tryCount || 1; 3768 3769 var _ = this, 3770 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 3771 image, 3772 imageSource, 3773 imageSrcSet, 3774 imageSizes, 3775 imageToLoad; 3776 3777 if ( $imgsToLoad.length ) { 3778 3779 image = $imgsToLoad.first(); 3780 imageSource = image.attr('data-lazy'); 3781 imageSrcSet = image.attr('data-srcset'); 3782 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 3783 imageToLoad = document.createElement('img'); 3784 3785 imageToLoad.onload = function() { 3786 3787 if (imageSrcSet) { 3788 image 3789 .attr('srcset', imageSrcSet ); 3790 3791 if (imageSizes) { 3792 image 3793 .attr('sizes', imageSizes ); 3794 } 3795 } 3796 3797 image 3798 .attr( 'src', imageSource ) 3799 .removeAttr('data-lazy data-srcset data-sizes') 3800 .removeClass('slick-loading'); 3801 3802 if ( _.options.adaptiveHeight === true ) { 3803 _.setPosition(); 3804 } 3805 3806 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 3807 _.progressiveLazyLoad(); 3808 3809 }; 3810 3811 imageToLoad.onerror = function() { 3812 3813 if ( tryCount < 3 ) { 3814 3815 /** 3816 * try to load the image 3 times, 3817 * leave a slight delay so we don't get 3818 * servers blocking the request. 3819 */ 3820 setTimeout( function() { 3821 _.progressiveLazyLoad( tryCount + 1 ); 3822 }, 500 ); 3823 3824 } else { 3825 3826 image 3827 .removeAttr( 'data-lazy' ) 3828 .removeClass( 'slick-loading' ) 3829 .addClass( 'slick-lazyload-error' ); 3830 3831 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 3832 3833 _.progressiveLazyLoad(); 3834 3835 } 3836 3837 }; 3838 3839 imageToLoad.src = imageSource; 3840 3841 } else { 3842 3843 _.$slider.trigger('allImagesLoaded', [ _ ]); 3844 3845 } 3846 3847 }; 3848 3849 Slick.prototype.refresh = function( initializing ) { 3850 3851 var _ = this, currentSlide, lastVisibleIndex; 3852 3853 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 3854 3855 // in non-infinite sliders, we don't want to go past the 3856 // last visible index. 3857 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 3858 _.currentSlide = lastVisibleIndex; 3859 } 3860 3861 // if less slides than to show, go to start. 3862 if ( _.slideCount <= _.options.slidesToShow ) { 3863 _.currentSlide = 0; 3864 3865 } 3866 3867 currentSlide = _.currentSlide; 3868 3869 _.destroy(true); 3870 3871 $.extend(_, _.initials, { currentSlide: currentSlide }); 3872
3873 _.init(); 3874 3875 if( !initializing ) { 3876 3877 _.changeSlide({ 3878 data: { 3879 message: 'index', 3880 index: currentSlide 3881 } 3882 }, false); 3883 3884 } 3885 3886 }; 3887 3888 Slick.prototype.registerBreakpoints = function() { 3889 3890 var _ = this, breakpoint, currentBreakpoint, l, 3891 responsiveSettings = _.options.responsive || null; 3892 3893 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 3894 3895 _.respondTo = _.options.respondTo || 'window'; 3896 3897 for ( breakpoint in responsiveSettings ) { 3898 3899 l = _.breakpoints.length-1; 3900 3901 if (responsiveSettings.hasOwnProperty(breakpoint)) { 3902 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 3903 3904 // loop through the breakpoints and cut out any existing 3905 // ones with the same breakpoint number, we don't want dupes. 3906 while( l >= 0 ) { 3907 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 3908 _.breakpoints.splice(l,1); 3909 } 3910 l--; 3911 } 3912 3913 _.breakpoints.push(currentBreakpoint); 3914 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 3915 3916 } 3917 3918 } 3919 3920 _.breakpoints.sort(function(a, b) { 3921 return ( _.options.mobileFirst ) ? a-b : b-a; 3922 }); 3923 3924 } 3925 3926 }; 3927 3928 Slick.prototype.reinit = function() { 3929 3930 var _ = this; 3931 3932 _.$slides = 3933 _.$slideTrack 3934 .children(_.options.slide) 3935 .addClass('slick-slide'); 3936 3937 _.slideCount = _.$slides.length; 3938 3939 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 3940 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 3941 } 3942 3943 if (_.slideCount <= _.options.slidesToShow) { 3944 _.currentSlide = 0; 3945 } 3946 3947 _.registerBreakpoints(); 3948 3949 _.setProps(); 3950 _.setupInfinite(); 3951 _.buildArrows(); 3952 _.updateArrows(); 3953 _.initArrowEvents(); 3954 _.buildDots(); 3955 _.updateDots(); 3956 _.initDotEvents(); 3957 _.cleanUpSlideEvents(); 3958 _.initSlideEvents(); 3959 3960 _.checkResponsive(false, true); 3961 3962 if (_.options.focusOnSelect === true) { 3963 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 3964 } 3965 3966 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 3967 3968 _.setPosition(); 3969 _.focusHandler(); 3970 3971 _.paused = !_.options.autoplay; 3972 _.autoPlay(); 3973 3974 _.$slider.trigger('reInit', [_]); 3975 3976 }; 3977 3978 Slick.prototype.resize = function() { 3979 3980 var _ = this; 3981 3982 if ($(window).width() !== _.windowWidth) { 3983 clearTimeout(_.windowDelay); 3984 _.windowDelay = window.setTimeout(function() { 3985 _.windowWidth = $(window).width(); 3986 _.checkResponsive(); 3987 if( !_.unslicked ) { _.setPosition(); } 3988 }, 50); 3989 } 3990 }; 3991 3992 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 3993 3994 var _ = this; 3995 3996 if (typeof(index) === 'boolean') { 3997 removeBefore = index; 3998 index = removeBefore === true ? 0 : _.slideCount - 1; 3999 } else { 4000 index = removeBefore === true ? --index : index; 4001 } 4002 4003 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 4004 return false; 4005 } 4006 4007 _.unload(); 4008 4009 if (removeAll === true) { 4010 _.$slideTrack.children().remove(); 4011 } else { 4012 _.$slideTrack.children(this.options.slide).eq(index).remove(); 4013 } 4014 4015 _.$slides = _.$slideTrack.children(this.options.slide); 4016 4017 _.$slideTrack.children(this.options.slide).detach(); 4018 4019 _.$slideTrack.append(_.$slides); 4020 4021 _.$slidesCache = _.$slides; 4022 4023 _.reinit(); 4024 4025 }; 4026 4027 Slick.prototype.setCSS = function(position) { 4028 4029 var _ = this, 4030 positionProps = {}, 4031 x, y; 4032 4033 if (_.options.rtl === true) { 4034 position = -position; 4035 } 4036 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 4037 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 4038 4039 positionProps[_.positionProp] = position; 4040 4041 if (_.transformsEnabled === false) { 4042 _.$slideTrack.css(positionProps); 4043 } else { 4044 positionProps = {}; 4045 if (_.cssTransitions === false) { 4046 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 4047 _.$slideTrack.css(positionProps); 4048 } else { 4049 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 4050 _.$slideTrack.css(positionProps); 4051 } 4052 } 4053 4054 }; 4055 4056 Slick.prototype.setDimensions = function() { 4057 4058 var _ = this; 4059 4060 if (_.options.vertical === false) { 4061 if (_.options.centerMode === true) { 4062 _.$list.css({ 4063 padding: ('0px ' + _.options.centerPadding) 4064 }); 4065 } 4066 } else { 4067 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 4068 if (_.options.centerMode === true) { 4069 _.$list.css({ 4070 padding: (_.options.centerPadding + ' 0px') 4071 }); 4072 } 4073 } 4074 4075 _.listWidth = _.$list.width(); 4076 _.listHeight = _.$list.height(); 4077 4078 4079 if (_.options.vertical === false && _.options.variableWidth === false) { 4080 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 4081 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 4082 4083 } else if (_.options.variableWidth === true) { 4084 _.$slideTrack.width(5000 * _.slideCount); 4085 } else { 4086 _.slideWidth = Math.ceil(_.listWidth); 4087 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 4088 } 4089 4090 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 4091 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 4092 4093 }; 4094 4095 Slick.prototype.setFade = function() { 4096 4097 var _ = this, 4098 targetLeft; 4099 4100 _.$slides.each(function(index, element) { 4101 targetLeft = (_.slideWidth * index) * -1; 4102 if (_.options.rtl === true) { 4103 $(element).css({ 4104 position: 'relative', 4105 right: targetLeft, 4106 top: 0, 4107 zIndex: _.options.zIndex - 2, 4108 opacity: 0 4109 }); 4110 } else { 4111 $(element).css({ 4112 position: 'relative', 4113 left: targetLeft, 4114 top: 0, 4115 zIndex: _.options.zIndex - 2, 4116 opacity: 0 4117 }); 4118 } 4119 }); 4120 4121 _.$slides.eq(_.currentSlide).css({ 4122 zIndex: _.options.zIndex - 1, 4123 opacity: 1 4124 }); 4125 4126 }; 4127 4128 Slick.prototype.setHeight = function() { 4129 4130 var _ = this; 4131 4132 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 4133 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 4134 _.$list.css('height', targetHeight); 4135 } 4136 4137 }; 4138 4139 Slick.prototype.setOption = 4140 Slick.prototype.slickSetOption = function() { 4141 4142 /** 4143 * accepts arguments in format of: 4144 * 4145 * - for changing a single option's value: 4146 * .slick("setOption", option, value, refresh ) 4147 * 4148 * - for changing a set of responsive options: 4149 * .slick("setOption", 'responsive', [{}, ...], refresh ) 4150 * 4151 * - for updating multiple values at once (not responsive) 4152 * .slick("setOption", { 'option': value, ... }, refresh ) 4153 */ 4154 4155 var _ = this, l, item, option, value, refresh = false, t
4155ype; 4156 4157 if( $.type( arguments[0] ) === 'object' ) { 4158 4159 option = arguments[0]; 4160 refresh = arguments[1]; 4161 type = 'multiple'; 4162 4163 } else if ( $.type( arguments[0] ) === 'string' ) { 4164 4165 option = arguments[0]; 4166 value = arguments[1]; 4167 refresh = arguments[2]; 4168 4169 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 4170 4171 type = 'responsive'; 4172 4173 } else if ( typeof arguments[1] !== 'undefined' ) { 4174 4175 type = 'single'; 4176 4177 } 4178 4179 } 4180 4181 if ( type === 'single' ) { 4182 4183 _.options[option] = value; 4184 4185 4186 } else if ( type === 'multiple' ) { 4187 4188 $.each( option , function( opt, val ) { 4189 4190 _.options[opt] = val; 4191 4192 }); 4193 4194 4195 } else if ( type === 'responsive' ) { 4196 4197 for ( item in value ) { 4198 4199 if( $.type( _.options.responsive ) !== 'array' ) { 4200 4201 _.options.responsive = [ value[item] ]; 4202 4203 } else { 4204 4205 l = _.options.responsive.length-1; 4206 4207 // loop through the responsive object and splice out duplicates. 4208 while( l >= 0 ) { 4209 4210 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 4211 4212 _.options.responsive.splice(l,1); 4213 4214 } 4215 4216 l--; 4217 4218 } 4219 4220 _.options.responsive.push( value[item] ); 4221 4222 } 4223 4224 } 4225 4226 } 4227 4228 if ( refresh ) { 4229 4230 _.unload(); 4231 _.reinit(); 4232 4233 } 4234 4235 }; 4236 4237 Slick.prototype.setPosition = function() { 4238 4239 var _ = this; 4240 4241 _.setDimensions(); 4242 4243 _.setHeight(); 4244 4245 if (_.options.fade === false) { 4246 _.setCSS(_.getLeft(_.currentSlide)); 4247 } else { 4248 _.setFade(); 4249 } 4250 4251 _.$slider.trigger('setPosition', [_]); 4252 4253 }; 4254 4255 Slick.prototype.setProps = function() { 4256 4257 var _ = this, 4258 bodyStyle = document.body.style; 4259 4260 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 4261 4262 if (_.positionProp === 'top') { 4263 _.$slider.addClass('slick-vertical'); 4264 } else { 4265 _.$slider.removeClass('slick-vertical'); 4266 } 4267 4268 if (bodyStyle.WebkitTransition !== undefined || 4269 bodyStyle.MozTransition !== undefined || 4270 bodyStyle.msTransition !== undefined) { 4271 if (_.options.useCSS === true) { 4272 _.cssTransitions = true; 4273 } 4274 } 4275 4276 if ( _.options.fade ) { 4277 if ( typeof _.options.zIndex === 'number' ) { 4278 if( _.options.zIndex < 3 ) { 4279 _.options.zIndex = 3; 4280 } 4281 } else { 4282 _.options.zIndex = _.defaults.zIndex; 4283 } 4284 } 4285 4286 if (bodyStyle.OTransform !== undefined) { 4287 _.animType = 'OTransform'; 4288 _.transformType = '-o-transform'; 4289 _.transitionType = 'OTransition'; 4290 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
4291 } 4292 if (bodyStyle.MozTransform !== undefined) { 4293 _.animType = 'MozTransform'; 4294 _.transformType = '-moz-transform'; 4295 _.transitionType = 'MozTransition'; 4296 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 4297 } 4298 if (bodyStyle.webkitTransform !== undefined) { 4299 _.animType = 'webkitTransform'; 4300 _.transformType = '-webkit-transform'; 4301 _.transitionType = 'webkitTransition'; 4302 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 4303 } 4304 if (bodyStyle.msTransform !== undefined) { 4305 _.animType = 'msTransform'; 4306 _.transformType = '-ms-transform'; 4307 _.transitionType = 'msTransition'; 4308 if (bodyStyle.msTransform === undefined) _.animType = false; 4309 } 4310 if (bodyStyle.transform !== undefined && _.animType !== false) { 4311 _.animType = 'transform'; 4312 _.transformType = 'transform'; 4313 _.transitionType = 'transition'; 4314 } 4315 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 4316 }; 4317 4318 4319 Slick.prototype.setSlideClasses = function(index) { 4320 4321 var _ = this, 4322 centerOffset, allSlides, indexOffset, remainder; 4323 4324 allSlides = _.$slider 4325 .find('.slick-slide') 4326 .removeClass('slick-active slick-center slick-current') 4327 .attr('aria-hidden', 'true'); 4328 4329 _.$slides 4330 .eq(index) 4331 .addClass('slick-current'); 4332 4333 if (_.options.centerMode === true) { 4334 4335 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 4336 4337 centerOffset = Math.floor(_.options.slidesToShow / 2); 4338 4339 if (_.options.infinite === true) { 4340 4341 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 4342 _.$slides 4343 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 4344 .addClass('slick-active') 4345 .attr('aria-hidden', 'false'); 4346 4347 } else { 4348 4349 indexOffset = _.options.slidesToShow + index; 4350 allSlides 4351 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 4352 .addClass('slick-active') 4353 .attr('aria-hidden', 'false'); 4354 4355 } 4356 4357 if (index === 0) { 4358 4359 allSlides 4360 .eq( _.options.slidesToShow + _.slideCount + 1 ) 4361 .addClass('slick-center'); 4362 4363 } else if (index === _.slideCount - 1) { 4364 4365 allSlides 4366 .eq(_.options.slidesToShow) 4367 .addClass('slick-center'); 4368 4369 } 4370 4371 } 4372 4373 _.$slides 4374 .eq(index) 4375 .addClass('slick-center'); 4376 4377 } else { 4378 4379 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 4380 4381 _.$slides 4382 .slice(index, index + _.options.slidesToShow) 4383 .addClass('slick-active') 4384 .attr('aria-hidden', 'false'); 4385 4386 } else if (allSlides.length <= _.options.slidesToShow) { 4387 4388 allSlides 4389 .addClass('slick-active') 4390 .attr('aria-hidden', 'false'); 4391 4392 } else { 4393 4394 remainder = _.slideCount % _.options.slidesToShow; 4395 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 4396 4397 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 4398 4399 allSlides 4400 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 4401 .addClass('slick-active') 4402 .attr('aria-hidden', 'false'); 4403 4404 } else { 4405 4406 allSlides 4407 .slice(indexOffset, indexOffset + _.options.slidesToShow) 4408 .addClass('slick-active') 4409 .attr('aria-hidden', 'false'); 4410 4411 } 4412 4413 } 4414 4415 } 4416 4417 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 4418 _.lazyLoad(); 4419 } 4420 }; 4421 4422 Slick.prototype.setupInfinite = function() { 4423 4424 var _ = this, 4425 i, slideIndex, infiniteCount; 4426 4427 if (_.options.fade === true) {
4428 _.options.centerMode = false; 4429 } 4430 4431 if (_.options.infinite === true && _.options.fade === false) { 4432 4433 slideIndex = null; 4434 4435 if (_.slideCount > _.options.slidesToShow) { 4436 4437 if (_.options.centerMode === true) { 4438 infiniteCount = _.options.slidesToShow + 1; 4439 } else { 4440 infiniteCount = _.options.slidesToShow; 4441 } 4442 4443 for (i = _.slideCount; i > (_.slideCount - 4444 infiniteCount); i -= 1) { 4445 slideIndex = i - 1; 4446 $(_.$slides[slideIndex]).clone(true).attr('id', '') 4447 .attr('data-slick-index', slideIndex - _.slideCount) 4448 .prependTo(_.$slideTrack).addClass('slick-cloned'); 4449 } 4450 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 4451 slideIndex = i; 4452 $(_.$slides[slideIndex]).clone(true).attr('id', '') 4453 .attr('data-slick-index', slideIndex + _.slideCount) 4454 .appendTo(_.$slideTrack).addClass('slick-cloned'); 4455 } 4456 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 4457 $(this).attr('id', ''); 4458 }); 4459 4460 } 4461 4462 } 4463 4464 }; 4465 4466 Slick.prototype.interrupt = function( toggle ) { 4467 4468 var _ = this; 4469 4470 if( !toggle ) { 4471 _.autoPlay(); 4472 } 4473 _.interrupted = toggle; 4474 4475 }; 4476 4477 Slick.prototype.selectHandler = function(event) { 4478 4479 var _ = this; 4480 4481 var targetElement = 4482 $(event.target).is('.slick-slide') ? 4483 $(event.target) : 4484 $(event.target).parents('.slick-slide'); 4485 4486 var index = parseInt(targetElement.attr('data-slick-index')); 4487 4488 if (!index) index = 0; 4489 4490 if (_.slideCount <= _.options.slidesToShow) { 4491 4492 _.slideHandler(index, false, true); 4493 return; 4494 4495 } 4496 4497 _.slideHandler(index); 4498 4499 }; 4500 4501 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 4502 4503 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 4504 _ = this, navTarget; 4505 4506 sync = sync || false; 4507 4508 if (_.animating === true && _.options.waitForAnimate === true) { 4509 return; 4510 } 4511 4512 if (_.options.fade === true && _.currentSlide === index) { 4513 return; 4514 } 4515 4516 if (sync === false) { 4517 _.asNavFor(index); 4518 } 4519 4520 targetSlide = index; 4521 targetLeft = _.getLeft(targetSlide); 4522 slideLeft = _.getLeft(_.currentSlide); 4523 4524 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 4525 4526 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 4527 if (_.options.fade === false) { 4528 targetSlide = _.currentSlide; 4529 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 4530 _.animateSlide(slideLeft, function() { 4531 _.postSlide(targetSlide); 4532 }); 4533 } else { 4534 _.postSlide(targetSlide); 4535 } 4536 } 4537 return; 4538 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 4539 if (_.options.fade === false) { 4540 targetSlide = _.currentSlide; 4541 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 4542 _.animateSlide(slideLeft, function() { 4543 _.postSlide(targetSlide); 4544 }); 4545 } else { 4546 _.postSlide(targetSlide); 4547 } 4548 } 4549 return; 4550 } 4551 4552 if ( _.options.autoplay ) { 4553 clearInterval(_.autoPlayTimer); 4554 } 4555 4556 if (targetSlide < 0) { 4557 if (_.slideCount % _.options.slidesToScroll !== 0) { 4558 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 4559 } else { 4560 animSlide = _.slideCount + targetSlide; 4561 } 4562 }
4562 else if (targetSlide >= _.slideCount) { 4563 if (_.slideCount % _.options.slidesToScroll !== 0) { 4564 animSlide = 0; 4565 } else { 4566 animSlide = targetSlide - _.slideCount; 4567 } 4568 } else { 4569 animSlide = targetSlide; 4570 } 4571 4572 _.animating = true; 4573 4574 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 4575 4576 oldSlide = _.currentSlide; 4577 _.currentSlide = animSlide; 4578 4579 _.setSlideClasses(_.currentSlide); 4580 4581 if ( _.options.asNavFor ) { 4582 4583 navTarget = _.getNavTarget(); 4584 navTarget = navTarget.slick('getSlick'); 4585 4586 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 4587 navTarget.setSlideClasses(_.currentSlide); 4588 } 4589 4590 } 4591 4592 _.updateDots(); 4593 _.updateArrows(); 4594 4595 if (_.options.fade === true) { 4596 if (dontAnimate !== true) { 4597 4598 _.fadeSlideOut(oldSlide); 4599 4600 _.fadeSlide(animSlide, function() { 4601 _.postSlide(animSlide); 4602 }); 4603 4604 } else { 4605 _.postSlide(animSlide); 4606 } 4607 _.animateHeight(); 4608 return; 4609 } 4610 4611 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 4612 _.animateSlide(targetLeft, function() { 4613 _.postSlide(animSlide); 4614 }); 4615 } else { 4616 _.postSlide(animSlide); 4617 } 4618 4619 }; 4620 4621 Slick.prototype.startLoad = function() { 4622 4623 var _ = this; 4624 4625 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 4626 4627 _.$prevArrow.hide(); 4628 _.$nextArrow.hide(); 4629 4630 } 4631 4632 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 4633 4634 _.$dots.hide(); 4635 4636 } 4637 4638 _.$slider.addClass('slick-loading'); 4639 4640 }; 4641 4642 Slick.prototype.swipeDirection = function() { 4643 4644 var xDist, yDist, r, swipeAngle, _ = this; 4645 4646 xDist = _.touchObject.startX - _.touchObject.curX; 4647 yDist = _.touchObject.startY - _.touchObject.curY; 4648 r = Math.atan2(yDist, xDist); 4649 4650 swipeAngle = Math.round(r * 180 / Math.PI); 4651 if (swipeAngle < 0) { 4652 swipeAngle = 360 - Math.abs(swipeAngle); 4653 } 4654 4655 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 4656 return (_.options.rtl === false ? 'left' : 'right'); 4657 } 4658 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 4659 return (_.options.rtl === false ? 'left' : 'right'); 4660 } 4661 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 4662 return (_.options.rtl === false ? 'right' : 'left'); 4663 } 4664 if (_.options.verticalSwiping === true) { 4665 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 4666 return 'down'; 4667 } else { 4668 return 'up'; 4669 } 4670 } 4671 4672 return 'vertical'; 4673 4674 }; 4675 4676 Slick.prototype.swipeEnd = function(event) { 4677 4678 var _ = this, 4679 slideCount, 4680 direction; 4681 4682 _.dragging = false; 4683 _.swiping = false; 4684 4685 if (_.scrolling) { 4686 _.scrolling = false; 4687 return false; 4688 } 4689 4690 _.interrupted = false; 4691 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 4692 4693 if ( _.touchObject.curX === undefined ) { 4694 return false; 4695 } 4696 4697 if ( _.touchObject.edgeHit === true ) { 4698 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 4699 } 4700 4701 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 4702 4703 direction = _.swipeDirection(); 4704 4705 switch ( direction ) { 4706 4707 case 'left': 4708 case 'down': 4709 4710 slideCount = 4711 _.options.swipeToSlide ? 4712 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 4713 _.currentSlide + _.getSlideCount(); 4714 4715 _.currentDirection = 0; 4716 4717 break; 4718 4719 case 'right': 4720 case 'up': 4721 4722 slideCount =
4723 _.options.swipeToSlide ? 4724 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 4725 _.currentSlide - _.getSlideCount(); 4726 4727 _.currentDirection = 1; 4728 4729 break; 4730 4731 default: 4732 4733 4734 } 4735 4736 if( direction != 'vertical' ) { 4737 4738 _.slideHandler( slideCount ); 4739 _.touchObject = {}; 4740 _.$slider.trigger('swipe', [_, direction ]); 4741 4742 } 4743 4744 } else { 4745 4746 if ( _.touchObject.startX !== _.touchObject.curX ) { 4747 4748 _.slideHandler( _.currentSlide ); 4749 _.touchObject = {}; 4750 4751 } 4752 4753 } 4754 4755 }; 4756 4757 Slick.prototype.swipeHandler = function(event) { 4758 4759 var _ = this; 4760 4761 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 4762 return; 4763 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 4764 return; 4765 } 4766 4767 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 4768 event.originalEvent.touches.length : 1; 4769 4770 _.touchObject.minSwipe = _.listWidth / _.options 4771 .touchThreshold; 4772 4773 if (_.options.verticalSwiping === true) { 4774 _.touchObject.minSwipe = _.listHeight / _.options 4775 .touchThreshold; 4776 } 4777 4778 switch (event.data.action) { 4779 4780 case 'start': 4781 _.swipeStart(event); 4782 break; 4783 4784 case 'move': 4785 _.swipeMove(event); 4786 break; 4787 4788 case 'end': 4789 _.swipeEnd(event); 4790 break; 4791 4792 } 4793 4794 }; 4795 4796 Slick.prototype.swipeMove = function(event) { 4797 4798 var _ = this, 4799 edgeWasHit = false, 4800 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 4801 4802 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 4803 4804 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 4805 return false; 4806 } 4807 4808 curLeft = _.getLeft(_.currentSlide); 4809 4810 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 4811 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 4812 4813 _.touchObject.swipeLength = Math.round(Math.sqrt( 4814 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 4815 4816 verticalSwipeLength = Math.round(Math.sqrt( 4817 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 4818 4819 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 4820 _.scrolling = true; 4821 return false; 4822 } 4823 4824 if (_.options.verticalSwiping === true) { 4825 _.touchObject.swipeLength = verticalSwipeLength; 4826 } 4827 4828 swipeDirection = _.swipeDirection(); 4829 4830 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 4831 _.swiping = true; 4832 event.preventDefault(); 4833 } 4834 4835 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 4836 if (_.options.verticalSwiping === true) { 4837 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 4838 } 4839 4840 4841 swipeLength = _.touchObject.swipeLength; 4842 4843 _.touchObject.edgeHit = false; 4844 4845 if (_.options.infinite === false) { 4846 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 4847 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 4848 _.touchObject.edgeHit = true; 4849 } 4850 } 4851 4852 if (_.options.vertical === false) { 4853 _.swipeLeft = curLeft + swipeLength * positionOffset; 4854 } else { 4855 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 4856 } 4857 if (_.options.verticalSwiping === true) { 4858 _.swipeLeft = curLeft + swipeLength * positionOffset; 4859 } 4860 4861 if (_.options.fade === true || _.options.touchMove === false) { 4862 return false;
4863 } 4864 4865 if (_.animating === true) { 4866 _.swipeLeft = null; 4867 return false; 4868 } 4869 4870 _.setCSS(_.swipeLeft); 4871 4872 }; 4873 4874 Slick.prototype.swipeStart = function(event) { 4875 4876 var _ = this, 4877 touches; 4878 4879 _.interrupted = true; 4880 4881 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 4882 _.touchObject = {}; 4883 return false; 4884 } 4885 4886 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 4887 touches = event.originalEvent.touches[0]; 4888 } 4889 4890 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 4891 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 4892 4893 _.dragging = true; 4894 4895 }; 4896 4897 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 4898 4899 var _ = this; 4900 4901 if (_.$slidesCache !== null) { 4902 4903 _.unload(); 4904 4905 _.$slideTrack.children(this.options.slide).detach(); 4906 4907 _.$slidesCache.appendTo(_.$slideTrack); 4908 4909 _.reinit(); 4910 4911 } 4912 4913 }; 4914 4915 Slick.prototype.unload = function() { 4916 4917 var _ = this; 4918 4919 $('.slick-cloned', _.$slider).remove(); 4920 4921 if (_.$dots) { 4922 _.$dots.remove(); 4923 } 4924 4925 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 4926 _.$prevArrow.remove(); 4927 } 4928 4929 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 4930 _.$nextArrow.remove(); 4931 } 4932 4933 _.$slides 4934 .removeClass('slick-slide slick-active slick-visible slick-current') 4935 .attr('aria-hidden', 'true') 4936 .css('width', ''); 4937 4938 }; 4939 4940 Slick.prototype.unslick = function(fromBreakpoint) { 4941 4942 var _ = this; 4943 _.$slider.trigger('unslick', [_, fromBreakpoint]); 4944 _.destroy(); 4945 4946 }; 4947 4948 Slick.prototype.updateArrows = function() { 4949 4950 var _ = this, 4951 centerOffset; 4952 4953 centerOffset = Math.floor(_.options.slidesToShow / 2); 4954 4955 if ( _.options.arrows === true && 4956 _.slideCount > _.options.slidesToShow && 4957 !_.options.infinite ) { 4958 4959 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4960 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4961 4962 if (_.currentSlide === 0) { 4963 4964 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 4965 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4966 4967 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 4968 4969 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 4970 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4971 4972 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 4973 4974 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 4975 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4976 4977 } 4978 4979 } 4980 4981 }; 4982 4983 Slick.prototype.updateDots = function() { 4984 4985 var _ = this; 4986 4987 if (_.$dots !== null) { 4988 4989 _.$dots 4990 .find('li') 4991 .removeClass('slick-active') 4992 .end(); 4993 4994 _.$dots 4995 .find('li') 4996 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 4997 .addClass('slick-active'); 4998 4999 } 5000 5001 }; 5002 5003 Slick.prototype.visibility = function() { 5004 5005 var _ = this; 5006 5007 if ( _.options.autoplay ) { 5008 5009 if ( document[_.hidden] ) { 5010 5011 _.interrupted = true; 5012 5013 } else { 5014 5015 _.interrupted = false; 5016 5017 } 5018 5019 } 5020 5021 }; 5022 5023 $.fn.slick = function() { 5024 var _ = this, 5025 opt = arguments[0], 5026 args = Array.prototype.slice.call(arguments, 1), 5027 l = _.length, 5028 i, 5029 ret; 5030 for (i = 0; i < l; i++) { 5031 if (typeof opt == 'object' || typeof opt == 'undefined') 5032 _[i].slick = new Slick(_[i], opt); 5033 else 5034 ret = _[i].slick[opt].apply(_[i].slick, args); 5035 if (typeof ret != 'undefined') return ret; 5036 } 5037 return _; 5038 }; 5039 5040})); 5041 5042/*! 5043 * Bootstrap v5.3.2 (https://getbootstrap.com/) 5044 * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 5045 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5046 */ 5047 (function (global, factory) { 5048 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 5049 typeof define === 'function' && define.amd ? define(factory) : 5050 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory()); 5051})(this, (function () { 'use strict'; 5052 5053 /** 5054 * -------------------------------------------------------------------------- 5055 * Bootstrap dom/data.js 5056 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5057 * -------------------------------------------------------------------------- 5058 */ 5059 5060 /** 5061 * Constants 5062 */ 5063 5064 const elementMap = new Map(); 5065 const Data = { 5066 set(element, key, instance) { 5067 if (!elementMap.has(element)) { 5068 elementMap.set(element, new Map()); 5069 } 5070 const instanceMap = elementMap.get(element); 5071 5072 // make it clear we only want one instance per element 5073 // can be removed later when multiple key/instances are fine to be used 5074 if (!instanceMap.has(key) && instanceMap.size !== 0) { 5075 // eslint-disable-next-line no-console 5076 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); 5077 return; 5078 } 5079 instanceMap.set(key, instance); 5080 }, 5081 get(element, key) { 5082 if (elementMap.has(element)) { 5083 return elementMap.get(element).get(key) || null; 5084 } 5085 return null; 5086 }, 5087 remove(element, key) { 5088 if (!elementMap.has(element)) { 5089 return; 5090 } 5091 const instanceMap = elementMap.get(element); 5092 instanceMap.delete(key); 5093 5094 // free up element references if there are no instances left for an element 5095 if (instanceMap.size === 0) { 5096 elementMap.delete(element); 5097 } 5098 } 5099 }; 5100 5101 /** 5102 * -------------------------------------------------------------------------- 5103 * Bootstrap util/index.js 5104 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5105 * -------------------------------------------------------------------------- 5106 */ 5107 5108 const MAX_UID = 1000000; 5109 const MILLISECONDS_MULTIPLIER = 1000; 5110 const TRANSITION_END = 'transitionend'; 5111 5112 /** 5113 * Properly escape IDs selectors to handle weird IDs 5114 * @param {string} selector 5115 * @returns {string} 5116 */ 5117 const parseSelector = selector => { 5118 if (selector && window.CSS && window.CSS.escape) { 5119 // document.querySelector needs escaping to handle IDs (html5+) containing for instance / 5120 selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`); 5121 } 5122 return selector; 5123 }; 5124 5125 // Shout-out Angus Croll (https://goo.gl/pxwQGp) 5126 const toType = object => { 5127 if (object === null || object === undefined) { 5128 return `${object}`; 5129 } 5130 return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase(); 5131 }; 5132 5133 /** 5134 * Public Util API 5135 */ 5136 5137 const getUID = prefix => { 5138 do { 5139 prefix += Math.floor(Math.random() * MAX_UID); 5140 } while (document.getElementById(prefix)); 5141 return prefix; 5142 }; 5143 const getTransitionDurationFromElement = element => { 5144 if (!element) { 5145 return 0; 5146 } 5147 5148 // Get transition-duration of the element 5149 let { 5150 transitionDuration, 5151 transitionDelay 5152 } = window.getComputedStyle(element); 5153 const floatTransitionDuration = Number.parseFloat(transitionDuration); 5154 const floatTransitionDelay = Number.parseFloat(transitionDelay); 5155 5156 // Return 0 if element or transition duration is not found 5157 if (!floatTransitionDuration && !floatTransitionDelay) { 5158 return 0; 5159 } 5160 5161 // If multiple durations are defined, take the first 5162 transitionDuration = transitionDuration.split(',')[0]; 5163 transitionDelay = transitionDelay.split(',')[0]; 5164 return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 5165 }; 5166 const triggerTransitionEnd = element => { 5167 element.dispatchEvent(new Event(TRANSITION_END)); 5168 }; 5169 const isElement$1 = object => { 5170 if (!object || typeof object !== 'object') { 5171 return false;
vendor: 3,863 bytes, lines 5172-5295
5172 } 5173 if (typeof object.jquery !== 'undefined') { 5174 object = object[0]; 5175 } 5176 return typeof object.nodeType !== 'undefined'; 5177 }; 5178 const getElement = object => { 5179 // it's a jQuery object or a node element 5180 if (isElement$1(object)) { 5181 return object.jquery ? object[0] : object; 5182 } 5183 if (typeof object === 'string' && object.length > 0) { 5184 return document.querySelector(parseSelector(object)); 5185 } 5186 return null; 5187 }; 5188 const isVisible = element => { 5189 if (!isElement$1(element) || element.getClientRects().length === 0) { 5190 return false; 5191 } 5192 const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; 5193 // Handle `details` element as its content may falsie appear visible when it is closed 5194 const closedDetails = element.closest('details:not([open])'); 5195 if (!closedDetails) { 5196 return elementIsVisible; 5197 } 5198 if (closedDetails !== element) { 5199 const summary = element.closest('summary'); 5200 if (summary && summary.parentNode !== closedDetails) { 5201 return false; 5202 } 5203 if (summary === null) { 5204 return false; 5205 } 5206 } 5207 return elementIsVisible; 5208 }; 5209 const isDisabled = element => { 5210 if (!element || element.nodeType !== Node.ELEMENT_NODE) { 5211 return true; 5212 } 5213 if (element.classList.contains('disabled')) { 5214 return true; 5215 } 5216 if (typeof element.disabled !== 'undefined') { 5217 return element.disabled; 5218 } 5219 return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; 5220 }; 5221 const findShadowRoot = element => { 5222 if (!document.documentElement.attachShadow) { 5223 return null; 5224 } 5225 5226 // Can find the shadow root otherwise it'll return the document 5227 if (typeof element.getRootNode === 'function') { 5228 const root = element.getRootNode(); 5229 return root instanceof ShadowRoot ? root : null; 5230 } 5231 if (element instanceof ShadowRoot) { 5232 return element; 5233 } 5234 5235 // when we don't find a shadow root 5236 if (!element.parentNode) { 5237 return null; 5238 } 5239 return findShadowRoot(element.parentNode); 5240 }; 5241 const noop = () => {}; 5242 5243 /** 5244 * Trick to restart an element's animation 5245 * 5246 * @param {HTMLElement} element 5247 * @return void 5248 * 5249 * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation 5250 */ 5251 const reflow = element => { 5252 element.offsetHeight; // eslint-disable-line no-unused-expressions 5253 }; 5254 5255 const getjQuery = () => { 5256 if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { 5257 return window.jQuery; 5258 } 5259 return null; 5260 }; 5261 const DOMContentLoadedCallbacks = []; 5262 const onDOMContentLoaded = callback => { 5263 if (document.readyState === 'loading') { 5264 // add listener on the first call when the document is in loading state 5265 if (!DOMContentLoadedCallbacks.length) { 5266 document.addEventListener('DOMContentLoaded', () => { 5267 for (const callback of DOMContentLoadedCallbacks) { 5268 callback(); 5269 } 5270 }); 5271 } 5272 DOMContentLoadedCallbacks.push(callback); 5273 } else { 5274 callback(); 5275 } 5276 }; 5277 const isRTL = () => document.documentElement.dir === 'rtl'; 5278 const defineJQueryPlugin = plugin => { 5279 onDOMContentLoaded(() => { 5280 const $ = getjQuery(); 5281 /* istanbul ignore if */ 5282 if ($) { 5283 const name = plugin.NAME; 5284 const JQUERY_NO_CONFLICT = $.fn[name]; 5285 $.fn[name] = plugin.jQueryInterface; 5286 $.fn[name].Constructor = plugin; 5287 $.fn[name].noConflict = () => { 5288 $.fn[name] = JQUERY_NO_CONFLICT; 5289 return plugin.jQueryInterface; 5290 }; 5291 } 5292 }); 5293 }; 5294 const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => { 5295 return typeof possibleCallback === 'function' ? possibleCallback
vendor: 5,610 bytes, lines 5295-5440
5295(...args) : defaultValue; 5296 }; 5297 const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { 5298 if (!waitForTransition) { 5299 execute(callback); 5300 return; 5301 } 5302 const durationPadding = 5; 5303 const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding; 5304 let called = false; 5305 const handler = ({ 5306 target 5307 }) => { 5308 if (target !== transitionElement) { 5309 return; 5310 } 5311 called = true; 5312 transitionElement.removeEventListener(TRANSITION_END, handler); 5313 execute(callback); 5314 }; 5315 transitionElement.addEventListener(TRANSITION_END, handler); 5316 setTimeout(() => { 5317 if (!called) { 5318 triggerTransitionEnd(transitionElement); 5319 } 5320 }, emulatedDuration); 5321 }; 5322 5323 /** 5324 * Return the previous/next element of a list. 5325 * 5326 * @param {array} list The list of elements 5327 * @param activeElement The active element 5328 * @param shouldGetNext Choose to get next or previous element 5329 * @param isCycleAllowed 5330 * @return {Element|elem} The proper element 5331 */ 5332 const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { 5333 const listLength = list.length; 5334 let index = list.indexOf(activeElement); 5335 5336 // if the element does not exist in the list return an element 5337 // depending on the direction and if cycle is allowed 5338 if (index === -1) { 5339 return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]; 5340 } 5341 index += shouldGetNext ? 1 : -1; 5342 if (isCycleAllowed) { 5343 index = (index + listLength) % listLength; 5344 } 5345 return list[Math.max(0, Math.min(index, listLength - 1))]; 5346 }; 5347 5348 /** 5349 * -------------------------------------------------------------------------- 5350 * Bootstrap dom/event-handler.js 5351 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5352 * -------------------------------------------------------------------------- 5353 */ 5354 5355 5356 /** 5357 * Constants 5358 */ 5359 5360 const namespaceRegex = /[^.]*(?=\..*)\.|.*/; 5361 const stripNameRegex = /\..*/; 5362 const stripUidRegex = /::\d+$/; 5363 const eventRegistry = {}; // Events storage 5364 let uidEvent = 1; 5365 const customEvents = { 5366 mouseenter: 'mouseover', 5367 mouseleave: 'mouseout' 5368 }; 5369 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']); 5370 5371 /** 5372 * Private methods 5373 */ 5374 5375 function makeEventUid(element, uid) { 5376 return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; 5377 } 5378 function getElementEvents(element) { 5379 const uid = makeEventUid(element); 5380 element.uidEvent = uid; 5381 eventRegistry[uid] = eventRegistry[uid] || {}; 5382 return eventRegistry[uid]; 5383 } 5384 function bootstrapHandler(element, fn) { 5385 return function handler(event) { 5386 hydrateObj(event, { 5387 delegateTarget: element 5388 }); 5389 if (handler.oneOff) { 5390 EventHandler.off(element, event.type, fn); 5391 } 5392 return fn.apply(element, [event]); 5393 }; 5394 } 5395 function bootstrapDelegationHandler(element, selector, fn) { 5396 return function handler(event) { 5397 const domElements = element.querySelectorAll(selector); 5398 for (let { 5399 target 5400 } = event; target && target !== this; target = target.parentNode) { 5401 for (const domElement of domElements) { 5402 if (domElement !== target) { 5403 continue; 5404 } 5405 hydrateObj(event, { 5406 delegateTarget: target 5407 }); 5408 if (handler.oneOff) { 5409 EventHandler.off(element, event.type, selector, fn); 5410 } 5411 return fn.apply(target, [event]); 5412 } 5413 } 5414 }; 5415 } 5416 function findHandler(events, callable, delegationSelector = null) { 5417 return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector); 5418 } 5419 function normalizeParameters(originalTypeEvent, handler, delegationFunction) { 5420 const isDelegated = typeof handler === 'string'; 5421 // TODO: tooltip passes `false` instead of selector, so we need to check 5422 const callable = isDelegated ? delegationFunction : handler || delegationFunction; 5423 let typeEvent = getTypeEvent(originalTypeEvent); 5424 if (!nativeEvents.has(typeEvent)) { 5425 typeEvent = originalTypeEvent; 5426 } 5427 return [isDelegated, callable, typeEvent]; 5428 } 5429 function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { 5430 if (typeof originalTypeEvent !== 'string' || !element) { 5431 return; 5432 } 5433 let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 5434 5435 // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position 5436 // this prevents the handler from being dispatched the same way as mouseover or mouseout does 5437 if (originalTypeEvent in customEvents) { 5438 const wrapFunction = fn => { 5439 return function (event) { 5440 if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
vendor: 4,866 bytes, lines 5441-5572
5441 return fn.call(this, event); 5442 } 5443 }; 5444 }; 5445 callable = wrapFunction(callable); 5446 } 5447 const events = getElementEvents(element); 5448 const handlers = events[typeEvent] || (events[typeEvent] = {}); 5449 const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null); 5450 if (previousFunction) { 5451 previousFunction.oneOff = previousFunction.oneOff && oneOff; 5452 return; 5453 } 5454 const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, '')); 5455 const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable); 5456 fn.delegationSelector = isDelegated ? handler : null; 5457 fn.callable = callable; 5458 fn.oneOff = oneOff; 5459 fn.uidEvent = uid; 5460 handlers[uid] = fn; 5461 element.addEventListener(typeEvent, fn, isDelegated); 5462 } 5463 function removeHandler(element, events, typeEvent, handler, delegationSelector) { 5464 const fn = findHandler(events[typeEvent], handler, delegationSelector); 5465 if (!fn) { 5466 return; 5467 } 5468 element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); 5469 delete events[typeEvent][fn.uidEvent]; 5470 } 5471 function removeNamespacedHandlers(element, events, typeEvent, namespace) { 5472 const storeElementEvent = events[typeEvent] || {}; 5473 for (const [handlerKey, event] of Object.entries(storeElementEvent)) { 5474 if (handlerKey.includes(namespace)) { 5475 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 5476 } 5477 } 5478 } 5479 function getTypeEvent(event) { 5480 // allow to get the native events from namespaced events ('click.bs.button' --> 'click') 5481 event = event.replace(stripNameRegex, ''); 5482 return customEvents[event] || event; 5483 } 5484 const EventHandler = { 5485 on(element, event, handler, delegationFunction) { 5486 addHandler(element, event, handler, delegationFunction, false); 5487 }, 5488 one(element, event, handler, delegationFunction) { 5489 addHandler(element, event, handler, delegationFunction, true); 5490 }, 5491 off(element, originalTypeEvent, handler, delegationFunction) { 5492 if (typeof originalTypeEvent !== 'string' || !element) { 5493 return; 5494 } 5495 const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 5496 const inNamespace = typeEvent !== originalTypeEvent; 5497 const events = getElementEvents(element); 5498 const storeElementEvent = events[typeEvent] || {}; 5499 const isNamespace = originalTypeEvent.startsWith('.'); 5500 if (typeof callable !== 'undefined') { 5501 // Simplest case: handler is passed, remove that listener ONLY. 5502 if (!Object.keys(storeElementEvent).length) { 5503 return; 5504 } 5505 removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null); 5506 return; 5507 } 5508 if (isNamespace) { 5509 for (const elementEvent of Object.keys(events)) { 5510 removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); 5511 } 5512 } 5513 for (const [keyHandlers, event] of Object.entries(storeElementEvent)) { 5514 const handlerKey = keyHandlers.replace(stripUidRegex, ''); 5515 if (!inNamespace || originalTypeEvent.includes(handlerKey)) { 5516 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 5517 } 5518 } 5519 }, 5520 trigger(element, event, args) { 5521 if (typeof event !== 'string' || !element) { 5522 return null; 5523 } 5524 const $ = getjQuery(); 5525 const typeEvent = getTypeEvent(event); 5526 const inNamespace = event !== typeEvent; 5527 let jQueryEvent = null; 5528 let bubbles = true; 5529 let nativeDispatch = true; 5530 let defaultPrevented = false; 5531 if (inNamespace && $) { 5532 jQueryEvent = $.Event(event, args); 5533 $(element).trigger(jQueryEvent); 5534 bubbles = !jQueryEvent.isPropagationStopped(); 5535 nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); 5536 defaultPrevented = jQueryEvent.isDefaultPrevented(); 5537 } 5538 const evt = hydrateObj(new Event(event, { 5539 bubbles, 5540 cancelable: true 5541 }), args); 5542 if (defaultPrevented) { 5543 evt.preventDefault(); 5544 } 5545 if (nativeDispatch) { 5546 element.dispatchEvent(evt); 5547 } 5548 if (evt.defaultPrevented && jQueryEvent) { 5549 jQueryEvent.preventDefault(); 5550 } 5551 return evt; 5552 } 5553 }; 5554 function hydrateObj(obj, meta = {}) { 5555 for (const [key, value] of Object.entries(meta)) { 5556 try { 5557 obj[key] = value; 5558 } catch (_unused) { 5559 Object.defineProperty(obj, key, { 5560 configurable: true, 5561 get() { 5562 return value; 5563 } 5564 }); 5565 } 5566 } 5567 return obj; 5568 } 5569 5570 /** 5571 * -------------------------------------------------------------------------- 5572 *
vendor: 4,275 bytes, lines 5572-5713
5572Bootstrap dom/manipulator.js 5573 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5574 * -------------------------------------------------------------------------- 5575 */ 5576 5577 function normalizeData(value) { 5578 if (value === 'true') { 5579 return true; 5580 } 5581 if (value === 'false') { 5582 return false; 5583 } 5584 if (value === Number(value).toString()) { 5585 return Number(value); 5586 } 5587 if (value === '' || value === 'null') { 5588 return null; 5589 } 5590 if (typeof value !== 'string') { 5591 return value; 5592 } 5593 try { 5594 return JSON.parse(decodeURIComponent(value)); 5595 } catch (_unused) { 5596 return value; 5597 } 5598 } 5599 function normalizeDataKey(key) { 5600 return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); 5601 } 5602 const Manipulator = { 5603 setDataAttribute(element, key, value) { 5604 element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); 5605 }, 5606 removeDataAttribute(element, key) { 5607 element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); 5608 }, 5609 getDataAttributes(element) { 5610 if (!element) { 5611 return {}; 5612 } 5613 const attributes = {}; 5614 const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig')); 5615 for (const key of bsKeys) { 5616 let pureKey = key.replace(/^bs/, ''); 5617 pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); 5618 attributes[pureKey] = normalizeData(element.dataset[key]); 5619 } 5620 return attributes; 5621 }, 5622 getDataAttribute(element, key) { 5623 return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); 5624 } 5625 }; 5626 5627 /** 5628 * -------------------------------------------------------------------------- 5629 * Bootstrap util/config.js 5630 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5631 * -------------------------------------------------------------------------- 5632 */ 5633 5634 5635 /** 5636 * Class definition 5637 */ 5638 5639 class Config { 5640 // Getters 5641 static get Default() { 5642 return {}; 5643 } 5644 static get DefaultType() { 5645 return {}; 5646 } 5647 static get NAME() { 5648 throw new Error('You have to implement the static method "NAME", for each component!'); 5649 } 5650 _getConfig(config) { 5651 config = this._mergeConfigObj(config); 5652 config = this._configAfterMerge(config); 5653 this._typeCheckConfig(config); 5654 return config; 5655 } 5656 _configAfterMerge(config) { 5657 return config; 5658 } 5659 _mergeConfigObj(config, element) { 5660 const jsonConfig = isElement$1(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse 5661 5662 return { 5663 ...this.constructor.Default, 5664 ...(typeof jsonConfig === 'object' ? jsonConfig : {}), 5665 ...(isElement$1(element) ? Manipulator.getDataAttributes(element) : {}), 5666 ...(typeof config === 'object' ? config : {}) 5667 }; 5668 } 5669 _typeCheckConfig(config, configTypes = this.constructor.DefaultType) { 5670 for (const [property, expectedTypes] of Object.entries(configTypes)) { 5671 const value = config[property]; 5672 const valueType = isElement$1(value) ? 'element' : toType(value); 5673 if (!new RegExp(expectedTypes).test(valueType)) { 5674 throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 5675 } 5676 } 5677 } 5678 } 5679 5680 /** 5681 * -------------------------------------------------------------------------- 5682 * Bootstrap base-component.js 5683 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5684 * -------------------------------------------------------------------------- 5685 */ 5686 5687 5688 /** 5689 * Constants 5690 */ 5691 5692 const VERSION = '5.3.2'; 5693 5694 /** 5695 * Class definition 5696 */ 5697 5698 class BaseComponent extends Config { 5699 constructor(element, config) { 5700 super(); 5701 element = getElement(element); 5702 if (!element) { 5703 return; 5704 } 5705 this._element = element; 5706 this._config = this._getConfig(config); 5707 Data.set(this._element, this.constructor.DATA_KEY, this); 5708 } 5709 5710 // Public 5711 dispose() { 5712 Data.remove(this._element, this.constructor.DATA_KEY); 5713 EventHandler.off(this._element, this.constructor.EVENT_KEY);
vendor: 2,249 bytes, lines 5714-5775
5714 for (const propertyName of Object.getOwnPropertyNames(this)) { 5715 this[propertyName] = null; 5716 } 5717 } 5718 _queueCallback(callback, element, isAnimated = true) { 5719 executeAfterTransition(callback, element, isAnimated); 5720 } 5721 _getConfig(config) { 5722 config = this._mergeConfigObj(config, this._element); 5723 config = this._configAfterMerge(config); 5724 this._typeCheckConfig(config); 5725 return config; 5726 } 5727 5728 // Static 5729 static getInstance(element) { 5730 return Data.get(getElement(element), this.DATA_KEY); 5731 } 5732 static getOrCreateInstance(element, config = {}) { 5733 return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null); 5734 } 5735 static get VERSION() { 5736 return VERSION; 5737 } 5738 static get DATA_KEY() { 5739 return `bs.${this.NAME}`; 5740 } 5741 static get EVENT_KEY() { 5742 return `.${this.DATA_KEY}`; 5743 } 5744 static eventName(name) { 5745 return `${name}${this.EVENT_KEY}`; 5746 } 5747 } 5748 5749 /** 5750 * -------------------------------------------------------------------------- 5751 * Bootstrap dom/selector-engine.js 5752 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5753 * -------------------------------------------------------------------------- 5754 */ 5755 5756 const getSelector = element => { 5757 let selector = element.getAttribute('data-bs-target'); 5758 if (!selector || selector === '#') { 5759 let hrefAttribute = element.getAttribute('href'); 5760 5761 // The only valid content that could double as a selector are IDs or classes, 5762 // so everything starting with `#` or `.`. If a "real" URL is used as the selector, 5763 // `document.querySelector` will rightfully complain it is invalid. 5764 // See https://github.com/twbs/bootstrap/issues/32273 5765 if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) { 5766 return null; 5767 } 5768 5769 // Just in case some CMS puts out a full URL with the anchor appended 5770 if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) { 5771 hrefAttribute = `#${hrefAttribute.split('#')[1]}`; 5772 } 5773 selector = hrefAttribute && hrefAttribute !== '#' ? parseSelector(hrefAttribute.trim()) : null; 5774 } 5775 return selector
vendor: 27,514 bytes, lines 5775-6643
5775; 5776 }; 5777 const SelectorEngine = { 5778 find(selector, element = document.documentElement) { 5779 return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); 5780 }, 5781 findOne(selector, element = document.documentElement) { 5782 return Element.prototype.querySelector.call(element, selector); 5783 }, 5784 children(element, selector) { 5785 return [].concat(...element.children).filter(child => child.matches(selector)); 5786 }, 5787 parents(element, selector) { 5788 const parents = []; 5789 let ancestor = element.parentNode.closest(selector); 5790 while (ancestor) { 5791 parents.push(ancestor); 5792 ancestor = ancestor.parentNode.closest(selector); 5793 } 5794 return parents; 5795 }, 5796 prev(element, selector) { 5797 let previous = element.previousElementSibling; 5798 while (previous) { 5799 if (previous.matches(selector)) { 5800 return [previous]; 5801 } 5802 previous = previous.previousElementSibling; 5803 } 5804 return []; 5805 }, 5806 // TODO: this is now unused; remove later along with prev() 5807 next(element, selector) { 5808 let next = element.nextElementSibling; 5809 while (next) { 5810 if (next.matches(selector)) { 5811 return [next]; 5812 } 5813 next = next.nextElementSibling; 5814 } 5815 return []; 5816 }, 5817 focusableChildren(element) { 5818 const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(','); 5819 return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)); 5820 }, 5821 getSelectorFromElement(element) { 5822 const selector = getSelector(element); 5823 if (selector) { 5824 return SelectorEngine.findOne(selector) ? selector : null; 5825 } 5826 return null; 5827 }, 5828 getElementFromSelector(element) { 5829 const selector = getSelector(element); 5830 return selector ? SelectorEngine.findOne(selector) : null; 5831 }, 5832 getMultipleElementsFromSelector(element) { 5833 const selector = getSelector(element); 5834 return selector ? SelectorEngine.find(selector) : []; 5835 } 5836 }; 5837 5838 /** 5839 * -------------------------------------------------------------------------- 5840 * Bootstrap util/component-functions.js 5841 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5842 * -------------------------------------------------------------------------- 5843 */ 5844 5845 const enableDismissTrigger = (component, method = 'hide') => { 5846 const clickEvent = `click.dismiss${component.EVENT_KEY}`; 5847 const name = component.NAME; 5848 EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { 5849 if (['A', 'AREA'].includes(this.tagName)) { 5850 event.preventDefault(); 5851 } 5852 if (isDisabled(this)) { 5853 return; 5854 } 5855 const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`); 5856 const instance = component.getOrCreateInstance(target); 5857 5858 // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method 5859 instance[method](); 5860 }); 5861 }; 5862 5863 /** 5864 * -------------------------------------------------------------------------- 5865 * Bootstrap alert.js 5866 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5867 * -------------------------------------------------------------------------- 5868 */ 5869 5870 5871 /** 5872 * Constants 5873 */ 5874 5875 const NAME$f = 'alert'; 5876 const DATA_KEY$a = 'bs.alert'; 5877 const EVENT_KEY$b = `.${DATA_KEY$a}`; 5878 const EVENT_CLOSE = `close${EVENT_KEY$b}`; 5879 const EVENT_CLOSED = `closed${EVENT_KEY$b}`; 5880 const CLASS_NAME_FADE$5 = 'fade'; 5881 const CLASS_NAME_SHOW$8 = 'show'; 5882 5883 /** 5884 * Class definition 5885 */ 5886 5887 class Alert extends BaseComponent { 5888 // Getters 5889 static get NAME() { 5890 return NAME$f; 5891 } 5892 5893 // Public 5894 close() { 5895 const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); 5896 if (closeEvent.defaultPrevented) { 5897 return; 5898 } 5899 this._element.classList.remove(CLASS_NAME_SHOW$8); 5900 const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5); 5901 this._queueCallback(() => this._destroyElement(), this._element, isAnimated); 5902 } 5903 5904 // Private 5905 _destroyElement() { 5906 this._element.remove(); 5907 EventHandler.trigger(this._element, EVENT_CLOSED); 5908 this.dispose(); 5909 } 5910 5911 // Static 5912 static jQueryInterface(config) { 5913 return this.each(function () { 5914 const data = Alert.getOrCreateInstance(this); 5915 if (typeof config !== 'string') { 5916 return; 5917 } 5918 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 5919 throw new TypeError(`No method named "${config}"`); 5920 } 5921 data[config](this); 5922 }); 5923 } 5924 } 5925 5926 /** 5927 * Data API implementation 5928 */ 5929 5930 enableDismissTrigger(Alert, 'close'); 5931 5932 /** 5933 * jQuery 5934 */ 5935 5936 defineJQueryPlugin(Alert); 5937 5938 /** 5939 * -------------------------------------------------------------------------- 5940 * Bootstrap button.js 5941 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5942 * -------------------------------------------------------------------------- 5943 */ 5944 5945 5946 /** 5947 * Constants 5948 */ 5949 5950 const NAME$e = 'button'; 5951 const DATA_KEY$9 = 'bs.button'; 5952 const EVENT_KEY$a = `.${DATA_KEY$9}`; 5953 const DATA_API_KEY$6 = '.data-api'; 5954 const CLASS_NAME_ACTIVE$3 = 'active'; 5955 const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; 5956 const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`; 5957 5958 /** 5959 * Class definition 5960 */ 5961 5962 class Button extends BaseComponent { 5963 // Getters 5964 static get NAME() { 5965 return NAME$e; 5966 } 5967 5968 // Public 5969 toggle() { 5970 // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method 5971 this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); 5972 } 5973 5974 // Static 5975 static jQueryInterface(config) { 5976 return this.each(function () { 5977 const data = Button.getOrCreateInstance(this); 5978 if (config === 'toggle') { 5979 data[config](); 5980 } 5981 }); 5982 } 5983 } 5984 5985 /** 5986 * Data API implementation 5987 */ 5988 5989 EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => { 5990 event.preventDefault(); 5991 const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); 5992 const data = Button.getOrCreateInstance(button); 5993 data.toggle(); 5994 }); 5995 5996 /** 5997 * jQuery 5998 */ 5999 6000 defineJQueryPlugin(Button); 6001 6002 /** 6003 * -------------------------------------------------------------------------- 6004 * Bootstrap util/swipe.js 6005 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6006 * -------------------------------------------------------------------------- 6007 */ 6008 6009 6010 /** 6011 * Constants 6012 */ 6013 6014 const NAME$d = 'swipe'; 6015 const EVENT_KEY$9 = '.bs.swipe'; 6016 const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`; 6017 const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`; 6018 const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`; 6019 const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`; 6020 const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`; 6021 const POINTER_TYPE_TOUCH = 'touch'; 6022 const POINTER_TYPE_PEN = 'pen'; 6023 const CLASS_NAME_POINTER_EVENT = 'pointer-event'; 6024 const SWIPE_THRESHOLD = 40; 6025 const Default$c = { 6026 endCallback: null, 6027 leftCallback: null, 6028 rightCallback: null 6029 }; 6030 const DefaultType$c = { 6031 endCallback: '(function|null)', 6032 leftCallback: '(function|null)', 6033 rightCallback: '(function|null)' 6034 }; 6035 6036 /** 6037 * Class definition 6038 */ 6039 6040 class Swipe extends Config { 6041 constructor(element, config) { 6042 super(); 6043 this._element = element; 6044 if (!element || !Swipe.isSupported()) { 6045 return; 6046 } 6047 this._config = this._getConfig(config); 6048 this._deltaX = 0; 6049 this._supportPointerEvents = Boolean(window.PointerEvent); 6050 this._initEvents(); 6051 } 6052 6053 // Getters 6054 static get Default() { 6055 return Default$c; 6056 } 6057 static get DefaultType() { 6058 return DefaultType$c; 6059 } 6060 static get NAME() { 6061 return NAME$d; 6062 } 6063 6064 // Public 6065 dispose() { 6066 EventHandler.off(this._element, EVENT_KEY$9); 6067 } 6068 6069 // Private 6070 _start(event) { 6071 if (!this._supportPointerEvents) { 6072 this._deltaX = event.touches[0].clientX; 6073 return; 6074 } 6075 if (this._eventIsPointerPenTouch(event)) { 6076 this._deltaX = event.clientX; 6077 } 6078 } 6079 _end(event) { 6080 if (this._eventIsPointerPenTouch(event)) { 6081 this._deltaX = event.clientX - this._deltaX; 6082 } 6083 this._handleSwipe(); 6084 execute(this._config.endCallback); 6085 } 6086 _move(event) { 6087 this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX; 6088 } 6089 _handleSwipe() { 6090 const absDeltaX = Math.abs(this._deltaX); 6091 if (absDeltaX <= SWIPE_THRESHOLD) { 6092 return; 6093 } 6094 const direction = absDeltaX / this._deltaX; 6095 this._deltaX = 0; 6096 if (!direction) { 6097 return; 6098 } 6099 execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback); 6100 } 6101 _initEvents() { 6102 if (this._supportPointerEvents) { 6103 EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event)); 6104 EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event)); 6105 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 6106 } else { 6107 EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event)); 6108 EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event)); 6109 EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event)); 6110 } 6111 } 6112 _eventIsPointerPenTouch(event) { 6113 return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); 6114 } 6115 6116 // Static 6117 static isSupported() { 6118 return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 6119 } 6120 } 6121 6122 /** 6123 * -------------------------------------------------------------------------- 6124 * Bootstrap carousel.js 6125 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6126 * -------------------------------------------------------------------------- 6127 */ 6128 6129 6130 /** 6131 * Constants 6132 */ 6133 6134 const NAME$c = 'carousel'; 6135 const DATA_KEY$8 = 'bs.carousel'; 6136 const EVENT_KEY$8 = `.${DATA_KEY$8}`; 6137 const DATA_API_KEY$5 = '.data-api'; 6138 const ARROW_LEFT_KEY$1 = 'ArrowLeft'; 6139 const ARROW_RIGHT_KEY$1 = 'ArrowRight'; 6140 const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 6141 6142 const ORDER_NEXT = 'next'; 6143 const ORDER_PREV = 'prev'; 6144 const DIRECTION_LEFT = 'left'; 6145 const DIRECTION_RIGHT = 'right'; 6146 const EVENT_SLIDE = `slide${EVENT_KEY$8}`; 6147 const EVENT_SLID = `slid${EVENT_KEY$8}`; 6148 const EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`; 6149 const EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`; 6150 const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`; 6151 const EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`; 6152 const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`; 6153 const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; 6154 const CLASS_NAME_CAROUSEL = 'carousel'; 6155 const CLASS_NAME_ACTIVE$2 = 'active'; 6156 const CLASS_NAME_SLIDE = 'slide'; 6157 const CLASS_NAME_END = 'carousel-item-end'; 6158 const CLASS_NAME_START = 'carousel-item-start'; 6159 const CLASS_NAME_NEXT = 'carousel-item-next'; 6160 const CLASS_NAME_PREV = 'carousel-item-prev'; 6161 const SELECTOR_ACTIVE = '.active'; 6162 const SELECTOR_ITEM = '.carousel-item'; 6163 const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM; 6164 const SELECTOR_ITEM_IMG = '.carousel-item img'; 6165 const SELECTOR_INDICATORS = '.carousel-indicators'; 6166 const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; 6167 const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; 6168 const KEY_TO_DIRECTION = { 6169 [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT, 6170 [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT 6171 }; 6172 const Default$b = { 6173 interval: 5000, 6174 keyboard: true, 6175 pause: 'hover', 6176 ride: false, 6177 touch: true, 6178 wrap: true 6179 }; 6180 const DefaultType$b = { 6181 interval: '(number|boolean)', 6182 // TODO:v6 remove boolean support 6183 keyboard: 'boolean', 6184 pause: '(string|boolean)', 6185 ride: '(boolean|string)', 6186 touch: 'boolean', 6187 wrap: 'boolean' 6188 }; 6189 6190 /** 6191 * Class definition 6192 */ 6193 6194 class Carousel extends BaseComponent { 6195 constructor(element, config) { 6196 super(element, config); 6197 this._interval = null; 6198 this._activeElement = null; 6199 this._isSliding = false; 6200 this.touchTimeout = null; 6201 this._swipeHelper = null; 6202 this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); 6203 this._addEventListeners(); 6204 if (this._config.ride === CLASS_NAME_CAROUSEL) { 6205 this.cycle(); 6206 } 6207 } 6208 6209 // Getters 6210 static get Default() { 6211 return Default$b; 6212 } 6213 static get DefaultType() { 6214 return DefaultType$b; 6215 } 6216 static get NAME() { 6217 return NAME$c; 6218 } 6219 6220 // Public 6221 next() { 6222 this._slide(ORDER_NEXT); 6223 } 6224 nextWhenVisible() { 6225 // FIXME TODO use `document.visibilityState` 6226 // Don't call next when the page isn't visible 6227 // or the carousel or its parent isn't visible 6228 if (!document.hidden && isVisible(this._element)) { 6229 this.next(); 6230 } 6231 } 6232 prev() { 6233 this._slide(ORDER_PREV); 6234 } 6235 pause() { 6236 if (this._isSliding) { 6237 triggerTransitionEnd(this._element); 6238 } 6239 this._clearInterval(); 6240 } 6241 cycle() { 6242 this._clearInterval(); 6243 this._updateInterval(); 6244 this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval); 6245 } 6246 _maybeEnableCycle() { 6247 if (!this._config.ride) { 6248 return; 6249 } 6250 if (this._isSliding) { 6251 EventHandler.one(this._element, EVENT_SLID, () => this.cycle()); 6252 return; 6253 } 6254 this.cycle(); 6255 } 6256 to(index) { 6257 const items = this._getItems(); 6258 if (index > items.length - 1 || index < 0) { 6259 return; 6260 } 6261 if (this._isSliding) { 6262 EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); 6263 return; 6264 } 6265 const activeIndex = this._getItemIndex(this._getActive()); 6266 if (activeIndex === index) { 6267 return; 6268 } 6269 const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV; 6270 this._slide(order, items[index]); 6271 } 6272 dispose() { 6273 if (this._swipeHelper) { 6274 this._swipeHelper.dispose(); 6275 } 6276 super.dispose(); 6277 } 6278 6279 // Private 6280 _configAfterMerge(config) { 6281 config.defaultInterval = config.interval; 6282 return config; 6283 } 6284 _addEventListeners() { 6285 if (this._config.keyboard) { 6286 EventHandler.on(this._element, EVENT_KEYDOWN$1, event => this._keydown(event)); 6287 } 6288 if (this._config.pause === 'hover') { 6289 EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause()); 6290 EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle()); 6291 } 6292 if (this._config.touch && Swipe.isSupported()) { 6293 this._addTouchEventListeners(); 6294 } 6295 } 6296 _addTouchEventListeners() { 6297 for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) { 6298 EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault()); 6299 } 6300 const endCallBack = () => { 6301 if (this._config.pause !== 'hover') { 6302 return; 6303 } 6304 6305 // If it's a touch-enabled device, mouseenter/leave are fired as 6306 // part of the mouse compatibility events on first tap - the carousel 6307 // would stop cycling until user tapped out of it; 6308 // here, we listen for touchend, explicitly pause the carousel 6309 // (as if it's the second time we tap on it, mouseenter compat event 6310 // is NOT fired) and after a timeout (to allow for mouse compatibility 6311 // events to fire) we explicitly restart cycling 6312 6313 this.pause(); 6314 if (this.touchTimeout) { 6315 clearTimeout(this.touchTimeout); 6316 } 6317 this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval); 6318 }; 6319 const swipeConfig = { 6320 leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)), 6321 rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)), 6322 endCallback: endCallBack 6323 }; 6324 this._swipeHelper = new Swipe(this._element, swipeConfig); 6325 } 6326 _keydown(event) { 6327 if (/input|textarea/i.test(event.target.tagName)) { 6328 return; 6329 } 6330 const direction = KEY_TO_DIRECTION[event.key]; 6331 if (direction) { 6332 event.preventDefault(); 6333 this._slide(this._directionToOrder(direction)); 6334 } 6335 } 6336 _getItemIndex(element) { 6337 return this._getItems().indexOf(element); 6338 } 6339 _setActiveIndicatorElement(index) { 6340 if (!this._indicatorsElement) { 6341 return; 6342 } 6343 const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement); 6344 activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2); 6345 activeIndicator.removeAttribute('aria-current'); 6346 const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement); 6347 if (newActiveIndicator) { 6348 newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2); 6349 newActiveIndicator.setAttribute('aria-current', 'true'); 6350 } 6351 } 6352 _updateInterval() { 6353 const element = this._activeElement || this._getActive(); 6354 if (!element) { 6355 return; 6356 } 6357 const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); 6358 this._config.interval = elementInterval || this._config.defaultInterval; 6359 } 6360 _slide(order, element = null) { 6361 if (this._isSliding) { 6362 return; 6363 } 6364 const activeElement = this._getActive(); 6365 const isNext = order === ORDER_NEXT; 6366 const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap); 6367 if (nextElement === activeElement) { 6368 return; 6369 } 6370 const nextElementIndex = this._getItemIndex(nextElement); 6371 const triggerEvent = eventName => { 6372 return EventHandler.trigger(this._element, eventName, { 6373 relatedTarget: nextElement, 6374 direction: this._orderToDirection(order), 6375 from: this._getItemIndex(activeElement), 6376 to: nextElementIndex 6377 }); 6378 }; 6379 const slideEvent = triggerEvent(EVENT_SLIDE); 6380 if (slideEvent.defaultPrevented) { 6381 return; 6382 } 6383 if (!activeElement || !nextElement) { 6384 // Some weirdness is happening, so we bail 6385 // TODO: change tests that use empty divs to avoid this check 6386 return; 6387 } 6388 const isCycling = Boolean(this._interval); 6389 this.pause(); 6390 this._isSliding = true; 6391 this._setActiveIndicatorElement(nextElementIndex); 6392 this._activeElement = nextElement; 6393 const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END; 6394 const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV; 6395 nextElement.classList.add(orderClassName); 6396 reflow(nextElement); 6397 activeElement.classList.add(directionalClassName); 6398 nextElement.classList.add(directionalClassName); 6399 const completeCallBack = () => { 6400 nextElement.classList.remove(directionalClassName, orderClassName); 6401 nextElement.classList.add(CLASS_NAME_ACTIVE$2); 6402 activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName); 6403 this._isSliding = false; 6404 triggerEvent(EVENT_SLID); 6405 }; 6406 this._queueCallback(completeCallBack, activeElement, this._isAnimated()); 6407 if (isCycling) { 6408 this.cycle(); 6409 } 6410 } 6411 _isAnimated() { 6412 return this._element.classList.contains(CLASS_NAME_SLIDE); 6413 } 6414 _getActive() { 6415 return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); 6416 } 6417 _getItems() { 6418 return SelectorEngine.find(SELECTOR_ITEM, this._element); 6419 } 6420 _clearInterval() { 6421 if (this._interval) { 6422 clearInterval(this._interval); 6423 this._interval = null; 6424 } 6425 } 6426 _directionToOrder(direction) { 6427 if (isRTL()) { 6428 return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT; 6429 } 6430 return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV; 6431 } 6432 _orderToDirection(order) { 6433 if (isRTL()) { 6434 return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT; 6435 } 6436 return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT; 6437 } 6438 6439 // Static 6440 static jQueryInterface(config) { 6441 return this.each(function () { 6442 const data = Carousel.getOrCreateInstance(this, config); 6443 if (typeof config === 'number') { 6444 data.to(config); 6445 return; 6446 } 6447 if (typeof config === 'string') { 6448 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 6449 throw new TypeError(`No method named "${config}"`); 6450 } 6451 data[config](); 6452 } 6453 }); 6454 } 6455 } 6456 6457 /** 6458 * Data API implementation 6459 */ 6460 6461 EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function (event) { 6462 const target = SelectorEngine.getElementFromSelector(this); 6463 if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { 6464 return; 6465 } 6466 event.preventDefault(); 6467 const carousel = Carousel.getOrCreateInstance(target); 6468 const slideIndex = this.getAttribute('data-bs-slide-to'); 6469 if (slideIndex) { 6470 carousel.to(slideIndex); 6471 carousel._maybeEnableCycle(); 6472 return; 6473 } 6474 if (Manipulator.getDataAttribute(this, 'slide') === 'next') { 6475 carousel.next(); 6476 carousel._maybeEnableCycle(); 6477 return; 6478 } 6479 carousel.prev(); 6480 carousel._maybeEnableCycle(); 6481 }); 6482 EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => { 6483 const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); 6484 for (const carousel of carousels) { 6485 Carousel.getOrCreateInstance(carousel); 6486 } 6487 }); 6488 6489 /** 6490 * jQuery 6491 */ 6492 6493 defineJQueryPlugin(Carousel); 6494 6495 /** 6496 * -------------------------------------------------------------------------- 6497 * Bootstrap collapse.js 6498 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6499 * -------------------------------------------------------------------------- 6500 */ 6501 6502 6503 /** 6504 * Constants 6505 */ 6506 6507 const NAME$b = 'collapse'; 6508 const DATA_KEY$7 = 'bs.collapse'; 6509 const EVENT_KEY$7 = `.${DATA_KEY$7}`; 6510 const DATA_API_KEY$4 = '.data-api'; 6511 const EVENT_SHOW$6 = `show${EVENT_KEY$7}`; 6512 const EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`; 6513 const EVENT_HIDE$6 = `hide${EVENT_KEY$7}`; 6514 const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`; 6515 const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; 6516 const CLASS_NAME_SHOW$7 = 'show'; 6517 const CLASS_NAME_COLLAPSE = 'collapse'; 6518 const CLASS_NAME_COLLAPSING = 'collapsing'; 6519 const CLASS_NAME_COLLAPSED = 'collapsed'; 6520 const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; 6521 const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; 6522 const WIDTH = 'width'; 6523 const HEIGHT = 'height'; 6524 const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; 6525 const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; 6526 const Default$a = { 6527 parent: null, 6528 toggle: true 6529 }; 6530 const DefaultType$a = { 6531 parent: '(null|element)', 6532 toggle: 'boolean' 6533 }; 6534 6535 /** 6536 * Class definition 6537 */ 6538 6539 class Collapse extends BaseComponent { 6540 constructor(element, config) { 6541 super(element, config); 6542 this._isTransitioning = false; 6543 this._triggerArray = []; 6544 const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); 6545 for (const elem of toggleList) { 6546 const selector = SelectorEngine.getSelectorFromElement(elem); 6547 const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element); 6548 if (selector !== null && filterElement.length) { 6549 this._triggerArray.push(elem); 6550 } 6551 } 6552 this._initializeChildren(); 6553 if (!this._config.parent) { 6554 this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); 6555 } 6556 if (this._config.toggle) { 6557 this.toggle(); 6558 } 6559 } 6560 6561 // Getters 6562 static get Default() { 6563 return Default$a; 6564 } 6565 static get DefaultType() { 6566 return DefaultType$a; 6567 } 6568 static get NAME() { 6569 return NAME$b; 6570 } 6571 6572 // Public 6573 toggle() { 6574 if (this._isShown()) { 6575 this.hide(); 6576 } else { 6577 this.show(); 6578 } 6579 } 6580 show() { 6581 if (this._isTransitioning || this._isShown()) { 6582 return; 6583 } 6584 let activeChildren = []; 6585 6586 // find active children 6587 if (this._config.parent) { 6588 activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, { 6589 toggle: false 6590 })); 6591 } 6592 if (activeChildren.length && activeChildren[0]._isTransitioning) { 6593 return; 6594 } 6595 const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6); 6596 if (startEvent.defaultPrevented) { 6597 return; 6598 } 6599 for (const activeInstance of activeChildren) { 6600 activeInstance.hide(); 6601 } 6602 const dimension = this._getDimension(); 6603 this._element.classList.remove(CLASS_NAME_COLLAPSE); 6604 this._element.classList.add(CLASS_NAME_COLLAPSING); 6605 this._element.style[dimension] = 0; 6606 this._addAriaAndCollapsedClass(this._triggerArray, true); 6607 this._isTransitioning = true; 6608 const complete = () => { 6609 this._isTransitioning = false; 6610 this._element.classList.remove(CLASS_NAME_COLLAPSING); 6611 this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 6612 this._element.style[dimension] = ''; 6613 EventHandler.trigger(this._element, EVENT_SHOWN$6); 6614 }; 6615 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 6616 const scrollSize = `scroll${capitalizedDimension}`; 6617 this._queueCallback(complete, this._element, true); 6618 this._element.style[dimension] = `${this._element[scrollSize]}px`; 6619 } 6620 hide() { 6621 if (this._isTransitioning || !this._isShown()) { 6622 return; 6623 } 6624 const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6); 6625 if (startEvent.defaultPrevented) { 6626 return; 6627 } 6628 const dimension = this._getDimension(); 6629 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; 6630 reflow(this._element); 6631 this._element.classList.add(CLASS_NAME_COLLAPSING); 6632 this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 6633 for (const trigger of this._triggerArray) { 6634 const element = SelectorEngine.getElementFromSelector(trigger); 6635 if (element && !this._isShown(element)) { 6636 this._addAriaAndCollapsedClass([trigger], false); 6637 } 6638 } 6639 this._isTransitioning = true; 6640 const complete = () => { 6641 this._isTransitioning = false; 6642 this._element.classList.remove(CLASS_NAME_COLLAPSING); 6643 this._element.classList.
vendor: 2,269 bytes, lines 6643-6712
6643remove(CLASS_NAME_SHOW$7); 6644 this._element.classList.add(CLASS_NAME_COLLAPSE); 6645 EventHandler.trigger(this._element, EVENT_HIDDEN$6); 6646 }; 6647 this._element.style[dimension] = ''; 6648 this._queueCallback(complete, this._element, true); 6649 } 6650 _isShown(element = this._element) { 6651 return element.classList.contains(CLASS_NAME_SHOW$7); 6652 } 6653 6654 // Private 6655 _configAfterMerge(config) { 6656 config.toggle = Boolean(config.toggle); // Coerce string values 6657 config.parent = getElement(config.parent); 6658 return config; 6659 } 6660 _getDimension() { 6661 return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; 6662 } 6663 _initializeChildren() { 6664 if (!this._config.parent) { 6665 return; 6666 } 6667 const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4); 6668 for (const element of children) { 6669 const selected = SelectorEngine.getElementFromSelector(element); 6670 if (selected) { 6671 this._addAriaAndCollapsedClass([element], this._isShown(selected)); 6672 } 6673 } 6674 } 6675 _getFirstLevelChildren(selector) { 6676 const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); 6677 // remove children if greater depth 6678 return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element)); 6679 } 6680 _addAriaAndCollapsedClass(triggerArray, isOpen) { 6681 if (!triggerArray.length) { 6682 return; 6683 } 6684 for (const element of triggerArray) { 6685 element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen); 6686 element.setAttribute('aria-expanded', isOpen); 6687 } 6688 } 6689 6690 // Static 6691 static jQueryInterface(config) { 6692 const _config = {}; 6693 if (typeof config === 'string' && /show|hide/.test(config)) { 6694 _config.toggle = false; 6695 } 6696 return this.each(function () { 6697 const data = Collapse.getOrCreateInstance(this, _config); 6698 if (typeof config === 'string') { 6699 if (typeof data[config] === 'undefined') { 6700 throw new TypeError(`No method named "${config}"`); 6701 } 6702 data[config](); 6703 } 6704 }); 6705 } 6706 } 6707 6708 /** 6709 * Data API implementation 6710 */ 6711 6712 EventHandler.on(document, EVENT_CLICK_DATA_API$4
vendor: 17,041 bytes, lines 6712-7257
6712, SELECTOR_DATA_TOGGLE$4, function (event) { 6713 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 6714 if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { 6715 event.preventDefault(); 6716 } 6717 for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) { 6718 Collapse.getOrCreateInstance(element, { 6719 toggle: false 6720 }).toggle(); 6721 } 6722 }); 6723 6724 /** 6725 * jQuery 6726 */ 6727 6728 defineJQueryPlugin(Collapse); 6729 6730 var top = 'top'; 6731 var bottom = 'bottom'; 6732 var right = 'right'; 6733 var left = 'left'; 6734 var auto = 'auto'; 6735 var basePlacements = [top, bottom, right, left]; 6736 var start = 'start'; 6737 var end = 'end'; 6738 var clippingParents = 'clippingParents'; 6739 var viewport = 'viewport'; 6740 var popper = 'popper'; 6741 var reference = 'reference'; 6742 var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) { 6743 return acc.concat([placement + "-" + start, placement + "-" + end]); 6744 }, []); 6745 var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) { 6746 return acc.concat([placement, placement + "-" + start, placement + "-" + end]); 6747 }, []); // modifiers that need to read the DOM 6748 6749 var beforeRead = 'beforeRead'; 6750 var read = 'read'; 6751 var afterRead = 'afterRead'; // pure-logic modifiers 6752 6753 var beforeMain = 'beforeMain'; 6754 var main = 'main'; 6755 var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) 6756 6757 var beforeWrite = 'beforeWrite'; 6758 var write = 'write'; 6759 var afterWrite = 'afterWrite'; 6760 var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite]; 6761 6762 function getNodeName(element) { 6763 return element ? (element.nodeName || '').toLowerCase() : null; 6764 } 6765 6766 function getWindow(node) { 6767 if (node == null) { 6768 return window; 6769 } 6770 6771 if (node.toString() !== '[object Window]') { 6772 var ownerDocument = node.ownerDocument; 6773 return ownerDocument ? ownerDocument.defaultView || window : window; 6774 } 6775 6776 return node; 6777 } 6778 6779 function isElement(node) { 6780 var OwnElement = getWindow(node).Element; 6781 return node instanceof OwnElement || node instanceof Element; 6782 } 6783 6784 function isHTMLElement(node) { 6785 var OwnElement = getWindow(node).HTMLElement; 6786 return node instanceof OwnElement || node instanceof HTMLElement; 6787 } 6788 6789 function isShadowRoot(node) { 6790 // IE 11 has no ShadowRoot 6791 if (typeof ShadowRoot === 'undefined') { 6792 return false; 6793 } 6794 6795 var OwnElement = getWindow(node).ShadowRoot; 6796 return node instanceof OwnElement || node instanceof ShadowRoot; 6797 } 6798 6799 // and applies them to the HTMLElements such as popper and arrow 6800 6801 function applyStyles(_ref) { 6802 var state = _ref.state; 6803 Object.keys(state.elements).forEach(function (name) { 6804 var style = state.styles[name] || {}; 6805 var attributes = state.attributes[name] || {}; 6806 var element = state.elements[name]; // arrow is optional + virtual elements 6807 6808 if (!isHTMLElement(element) || !getNodeName(element)) { 6809 return; 6810 } // Flow doesn't support to extend this property, but it's the most 6811 // effective way to apply styles to an HTMLElement 6812 // $FlowFixMe[cannot-write] 6813 6814 6815 Object.assign(element.style, style); 6816 Object.keys(attributes).forEach(function (name) { 6817 var value = attributes[name]; 6818 6819 if (value === false) { 6820 element.removeAttribute(name); 6821 } else { 6822 element.setAttribute(name, value === true ? '' : value); 6823 } 6824 }); 6825 }); 6826 } 6827 6828 function effect$2(_ref2) { 6829 var state = _ref2.state; 6830 var initialStyles = { 6831 popper: { 6832 position: state.options.strategy, 6833 left: '0', 6834 top: '0', 6835 margin: '0' 6836 }, 6837 arrow: { 6838 position: 'absolute' 6839 }, 6840 reference: {} 6841 }; 6842 Object.assign(state.elements.popper.style, initialStyles.popper); 6843 state.styles = initialStyles; 6844 6845 if (state.elements.arrow) { 6846 Object.assign(state.elements.arrow.style, initialStyles.arrow); 6847 } 6848 6849 return function () { 6850 Object.keys(state.elements).forEach(function (name) { 6851 var element = state.elements[name]; 6852 var attributes = state.attributes[name] || {}; 6853 var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them 6854 6855 var style = styleProperties.reduce(function (style, property) { 6856 style[property] = ''; 6857 return style; 6858 }, {}); // arrow is optional + virtual elements 6859 6860 if (!isHTMLElement(element) || !getNodeName(element)) { 6861 return; 6862 } 6863 6864 Object.assign(element.style, style); 6865 Object.keys(attributes).forEach(function (attribute) { 6866 element.removeAttribute(attribute); 6867 }); 6868 }); 6869 }; 6870 } // eslint-disable-next-line import/no-unused-modules 6871 6872 6873 const applyStyles$1 = { 6874 name: 'applyStyles', 6875 enabled: true, 6876 phase: 'write', 6877 fn: applyStyles, 6878 effect: effect$2, 6879 requires: ['computeStyles'] 6880 }; 6881 6882 function getBasePlacement(placement) { 6883 return placement.split('-')[0]; 6884 } 6885 6886 var max = Math.max; 6887 var min = Math.min; 6888 var round = Math.round; 6889 6890 function getUAString() { 6891 var uaData = navigator.userAgentData; 6892 6893 if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) { 6894 return uaData.brands.map(function (item) { 6895 return item.brand + "/" + item.version; 6896 }).join(' '); 6897 } 6898 6899 return navigator.userAgent; 6900 } 6901 6902 function isLayoutViewport() { 6903 return !/^((?!chrome|android).)*safari/i.test(getUAString()); 6904 } 6905 6906 function getBoundingClientRect(element, includeScale, isFixedStrategy) { 6907 if (includeScale === void 0) { 6908 includeScale = false; 6909 } 6910 6911 if (isFixedStrategy === void 0) { 6912 isFixedStrategy = false; 6913 } 6914 6915 var clientRect = element.getBoundingClientRect(); 6916 var scaleX = 1; 6917 var scaleY = 1; 6918 6919 if (includeScale && isHTMLElement(element)) { 6920 scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1; 6921 scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1; 6922 } 6923 6924 var _ref = isElement(element) ? getWindow(element) : window, 6925 visualViewport = _ref.visualViewport; 6926 6927 var addVisualOffsets = !isLayoutViewport() && isFixedStrategy; 6928 var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX; 6929 var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY; 6930 var width = clientRect.width / scaleX; 6931 var height = clientRect.height / scaleY; 6932 return { 6933 width: width, 6934 height: height, 6935 top: y, 6936 right: x + width, 6937 bottom: y + height, 6938 left: x, 6939 x: x, 6940 y: y 6941 }; 6942 } 6943 6944 // means it doesn't take into account transforms. 6945 6946 function getLayoutRect(element) { 6947 var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed. 6948 // Fixes https://github.com/popperjs/popper-core/issues/1223 6949 6950 var width = element.offsetWidth; 6951 var height = element.offsetHeight; 6952 6953 if (Math.abs(clientRect.width - width) <= 1) { 6954 width = clientRect.width; 6955 } 6956 6957 if (Math.abs(clientRect.height - height) <= 1) { 6958 height = clientRect.height; 6959 } 6960 6961 return { 6962 x: element.offsetLeft, 6963 y: element.offsetTop, 6964 width: width, 6965 height: height 6966 }; 6967 } 6968 6969 function contains(parent, child) { 6970 var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method 6971 6972 if (parent.contains(child)) { 6973 return true; 6974 } // then fallback to custom implementation with Shadow DOM support 6975 else if (rootNode && isShadowRoot(rootNode)) { 6976 var next = child; 6977 6978 do { 6979 if (next && parent.isSameNode(next)) { 6980 return true; 6981 } // $FlowFixMe[prop-missing]: need a better way to handle this... 6982 6983 6984 next = next.parentNode || next.host; 6985 } while (next); 6986 } // Give up, the result is false 6987 6988 6989 return false; 6990 } 6991 6992 function getComputedStyle$1(element) { 6993 return getWindow(element).getComputedStyle(element); 6994 } 6995 6996 function isTableElement(element) { 6997 return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0; 6998 } 6999 7000 function getDocumentElement(element) { 7001 // $FlowFixMe[incompatible-return]: assume body is always available 7002 return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing] 7003 element.document) || window.document).documentElement; 7004 } 7005 7006 function getParentNode(element) { 7007 if (getNodeName(element) === 'html') { 7008 return element; 7009 } 7010 7011 return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle 7012 // $FlowFixMe[incompatible-return] 7013 // $FlowFixMe[prop-missing] 7014 element.assignedSlot || // step into the shadow DOM of the parent of a slotted node 7015 element.parentNode || ( // DOM Element detected 7016 isShadowRoot(element) ? element.host : null) || // ShadowRoot detected 7017 // $FlowFixMe[incompatible-call]: HTMLElement is a Node 7018 getDocumentElement(element) // fallback 7019 7020 ); 7021 } 7022 7023 function getTrueOffsetParent(element) { 7024 if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837 7025 getComputedStyle$1(element).position === 'fixed') { 7026 return null; 7027 } 7028 7029 return element.offsetParent; 7030 } // `.offsetParent` reports `null` for fixed elements, while absolute elements 7031 // return the containing block 7032 7033 7034 function getContainingBlock(element) { 7035 var isFirefox = /firefox/i.test(getUAString()); 7036 var isIE = /Trident/i.test(getUAString()); 7037 7038 if (isIE && isHTMLElement(element)) { 7039 // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport 7040 var elementCss = getComputedStyle$1(element); 7041 7042 if (elementCss.position === 'fixed') { 7043 return null; 7044 } 7045 } 7046 7047 var currentNode = getParentNode(element); 7048 7049 if (isShadowRoot(currentNode)) { 7050 currentNode = currentNode.host; 7051 } 7052 7053 while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) { 7054 var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that 7055 // create a containing block. 7056 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 7057 7058 if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') { 7059 return currentNode; 7060 } else { 7061 currentNode = currentNode.parentNode; 7062 } 7063 } 7064 7065 return null; 7066 } // Gets the closest ancestor positioned element. Handles some edge cases, 7067 // such as table ancestors and cross browser bugs. 7068 7069 7070 function getOffsetParent(element) { 7071 var window = getWindow(element); 7072 var offsetParent = getTrueOffsetParent(element); 7073 7074 while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') { 7075 offsetParent = getTrueOffsetParent(offsetParent); 7076 } 7077 7078 if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) { 7079 return window; 7080 } 7081 7082 return offsetParent || getContainingBlock(element) || window; 7083 } 7084 7085 function getMainAxisFromPlacement(placement) { 7086 return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; 7087 } 7088 7089 function within(min$1, value, max$1) { 7090 return max(min$1, min(value, max$1)); 7091 } 7092 function withinMaxClamp(min, value, max) { 7093 var v = within(min, value, max); 7094 return v > max ? max : v; 7095 } 7096 7097 function getFreshSideObject() { 7098 return { 7099 top: 0, 7100 right: 0, 7101 bottom: 0, 7102 left: 0 7103 }; 7104 } 7105 7106 function mergePaddingObject(paddingObject) { 7107 return Object.assign({}, getFreshSideObject(), paddingObject); 7108 } 7109 7110 function expandToHashMap(value, keys) { 7111 return keys.reduce(function (hashMap, key) { 7112 hashMap[key] = value; 7113 return hashMap; 7114 }, {}); 7115 } 7116 7117 var toPaddingObject = function toPaddingObject(padding, state) { 7118 padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, { 7119 placement: state.placement 7120 })) : padding; 7121 return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); 7122 }; 7123 7124 function arrow(_ref) { 7125 var _state$modifiersData$; 7126 7127 var state = _ref.state, 7128 name = _ref.name, 7129 options = _ref.options; 7130 var arrowElement = state.elements.arrow; 7131 var popperOffsets = state.modifiersData.popperOffsets; 7132 var basePlacement = getBasePlacement(state.placement); 7133 var axis = getMainAxisFromPlacement(basePlacement); 7134 var isVertical = [left, right].indexOf(basePlacement) >= 0; 7135 var len = isVertical ? 'height' : 'width'; 7136 7137 if (!arrowElement || !popperOffsets) { 7138 return; 7139 } 7140 7141 var paddingObject = toPaddingObject(options.padding, state); 7142 var arrowRect = getLayoutRect(arrowElement); 7143 var minProp = axis === 'y' ? top : left; 7144 var maxProp = axis === 'y' ? bottom : right; 7145 var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; 7146 var startDiff = popperOffsets[axis] - state.rects.reference[axis]; 7147 var arrowOffsetParent = getOffsetParent(arrowElement); 7148 var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; 7149 var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is 7150 // outside of the popper bounds 7151 7152 var min = paddingObject[minProp]; 7153 var max = clientSize - arrowRect[len] - paddingObject[maxProp]; 7154 var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; 7155 var offset = within(min, center, max); // Prevents breaking syntax highlighting... 7156 7157 var axisProp = axis; 7158 state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); 7159 } 7160 7161 function effect$1(_ref2) { 7162 var state = _ref2.state, 7163 options = _ref2.options; 7164 var _options$element = options.element, 7165 arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element; 7166 7167 if (arrowElement == null) { 7168 return; 7169 } // CSS selector 7170 7171 7172 if (typeof arrowElement === 'string') { 7173 arrowElement = state.elements.popper.querySelector(arrowElement); 7174 7175 if (!arrowElement) { 7176 return; 7177 } 7178 } 7179 7180 if (!contains(state.elements.popper, arrowElement)) { 7181 return; 7182 } 7183 7184 state.elements.arrow = arrowElement; 7185 } // eslint-disable-next-line import/no-unused-modules 7186 7187 7188 const arrow$1 = { 7189 name: 'arrow', 7190 enabled: true, 7191 phase: 'main', 7192 fn: arrow, 7193 effect: effect$1, 7194 requires: ['popperOffsets'], 7195 requiresIfExists: ['preventOverflow'] 7196 }; 7197 7198 function getVariation(placement) { 7199 return placement.split('-')[1]; 7200 } 7201 7202 var unsetSides = { 7203 top: 'auto', 7204 right: 'auto', 7205 bottom: 'auto', 7206 left: 'auto' 7207 }; // Round the offsets to the nearest suitable subpixel based on the DPR. 7208 // Zooming can change the DPR, but it seems to report a value that will 7209 // cleanly divide the values into the appropriate subpixels. 7210 7211 function roundOffsetsByDPR(_ref, win) { 7212 var x = _ref.x, 7213 y = _ref.y; 7214 var dpr = win.devicePixelRatio || 1; 7215 return { 7216 x: round(x * dpr) / dpr || 0, 7217 y: round(y * dpr) / dpr || 0 7218 }; 7219 } 7220 7221 function mapToStyles(_ref2) { 7222 var _Object$assign2; 7223 7224 var popper = _ref2.popper, 7225 popperRect = _ref2.popperRect, 7226 placement = _ref2.placement, 7227 variation = _ref2.variation, 7228 offsets = _ref2.offsets, 7229 position = _ref2.position, 7230 gpuAcceleration = _ref2.gpuAcceleration, 7231 adaptive = _ref2.adaptive, 7232 roundOffsets = _ref2.roundOffsets, 7233 isFixed = _ref2.isFixed; 7234 var _offsets$x = offsets.x, 7235 x = _offsets$x === void 0 ? 0 : _offsets$x, 7236 _offsets$y = offsets.y, 7237 y = _offsets$y === void 0 ? 0 : _offsets$y; 7238 7239 var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({ 7240 x: x, 7241 y: y 7242 }) : { 7243 x: x, 7244 y: y 7245 }; 7246 7247 x = _ref3.x; 7248 y = _ref3.y; 7249 var hasX = offsets.hasOwnProperty('x'); 7250 var hasY = offsets.hasOwnProperty('y'); 7251 var sideX = left; 7252 var sideY = top; 7253 var win = window; 7254 7255 if (adaptive) { 7256 var offsetParent = getOffsetParent(popper); 7257 var heightProp = 'clientHeight';
vendor: 16,161 bytes, lines 7258-7712
7258 var widthProp = 'clientWidth'; 7259 7260 if (offsetParent === getWindow(popper)) { 7261 offsetParent = getDocumentElement(popper); 7262 7263 if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') { 7264 heightProp = 'scrollHeight'; 7265 widthProp = 'scrollWidth'; 7266 } 7267 } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it 7268 7269 7270 offsetParent = offsetParent; 7271 7272 if (placement === top || (placement === left || placement === right) && variation === end) { 7273 sideY = bottom; 7274 var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing] 7275 offsetParent[heightProp]; 7276 y -= offsetY - popperRect.height; 7277 y *= gpuAcceleration ? 1 : -1; 7278 } 7279 7280 if (placement === left || (placement === top || placement === bottom) && variation === end) { 7281 sideX = right; 7282 var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing] 7283 offsetParent[widthProp]; 7284 x -= offsetX - popperRect.width; 7285 x *= gpuAcceleration ? 1 : -1; 7286 } 7287 } 7288 7289 var commonStyles = Object.assign({ 7290 position: position 7291 }, adaptive && unsetSides); 7292 7293 var _ref4 = roundOffsets === true ? roundOffsetsByDPR({ 7294 x: x, 7295 y: y 7296 }, getWindow(popper)) : { 7297 x: x, 7298 y: y 7299 }; 7300 7301 x = _ref4.x; 7302 y = _ref4.y; 7303 7304 if (gpuAcceleration) { 7305 var _Object$assign; 7306 7307 return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); 7308 } 7309 7310 return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); 7311 } 7312 7313 function computeStyles(_ref5) { 7314 var state = _ref5.state, 7315 options = _ref5.options; 7316 var _options$gpuAccelerat = options.gpuAcceleration, 7317 gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, 7318 _options$adaptive = options.adaptive, 7319 adaptive = _options$adaptive === void 0 ? true : _options$adaptive, 7320 _options$roundOffsets = options.roundOffsets, 7321 roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets; 7322 var commonStyles = { 7323 placement: getBasePlacement(state.placement), 7324 variation: getVariation(state.placement), 7325 popper: state.elements.popper, 7326 popperRect: state.rects.popper, 7327 gpuAcceleration: gpuAcceleration, 7328 isFixed: state.options.strategy === 'fixed' 7329 }; 7330 7331 if (state.modifiersData.popperOffsets != null) { 7332 state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, { 7333 offsets: state.modifiersData.popperOffsets, 7334 position: state.options.strategy, 7335 adaptive: adaptive, 7336 roundOffsets: roundOffsets 7337 }))); 7338 } 7339 7340 if (state.modifiersData.arrow != null) { 7341 state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, { 7342 offsets: state.modifiersData.arrow, 7343 position: 'absolute', 7344 adaptive: false, 7345 roundOffsets: roundOffsets 7346 }))); 7347 } 7348 7349 state.attributes.popper = Object.assign({}, state.attributes.popper, { 7350 'data-popper-placement': state.placement 7351 }); 7352 } // eslint-disable-next-line import/no-unused-modules 7353 7354 7355 const computeStyles$1 = { 7356 name: 'computeStyles', 7357 enabled: true, 7358 phase: 'beforeWrite', 7359 fn: computeStyles, 7360 data: {} 7361 }; 7362 7363 var passive = { 7364 passive: true 7365 }; 7366 7367 function effect(_ref) { 7368 var state = _ref.state, 7369 instance = _ref.instance, 7370 options = _ref.options; 7371 var _options$scroll = options.scroll, 7372 scroll = _options$scroll === void 0 ? true : _options$scroll, 7373 _options$resize = options.resize, 7374 resize = _options$resize === void 0 ? true : _options$resize; 7375 var window = getWindow(state.elements.popper); 7376 var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); 7377 7378 if (scroll) { 7379 scrollParents.forEach(function (scrollParent) { 7380 scrollParent.addEventListener('scroll', instance.update, passive); 7381 }); 7382 } 7383 7384 if (resize) { 7385 window.addEventListener('resize', instance.update, passive); 7386 } 7387 7388 return function () { 7389 if (scroll) { 7390 scrollParents.forEach(function (scrollParent) { 7391 scrollParent.removeEventListener('scroll', instance.update, passive); 7392 }); 7393 } 7394 7395 if (resize) { 7396 window.removeEventListener('resize', instance.update, passive); 7397 } 7398 }; 7399 } // eslint-disable-next-line import/no-unused-modules 7400 7401 7402 const eventListeners = { 7403 name: 'eventListeners', 7404 enabled: true, 7405 phase: 'write', 7406 fn: function fn() {}, 7407 effect: effect, 7408 data: {} 7409 }; 7410 7411 var hash$1 = { 7412 left: 'right', 7413 right: 'left', 7414 bottom: 'top', 7415 top: 'bottom' 7416 }; 7417 function getOppositePlacement(placement) { 7418 return placement.replace(/left|right|bottom|top/g, function (matched) { 7419 return hash$1[matched]; 7420 }); 7421 } 7422 7423 var hash = { 7424 start: 'end', 7425 end: 'start' 7426 }; 7427 function getOppositeVariationPlacement(placement) { 7428 return placement.replace(/start|end/g, function (matched) { 7429 return hash[matched]; 7430 }); 7431 } 7432 7433 function getWindowScroll(node) { 7434 var win = getWindow(node); 7435 var scrollLeft = win.pageXOffset; 7436 var scrollTop = win.pageYOffset; 7437 return { 7438 scrollLeft: scrollLeft, 7439 scrollTop: scrollTop 7440 }; 7441 } 7442 7443 function getWindowScrollBarX(element) { 7444 // If <html> has a CSS width greater than the viewport, then this will be 7445 // incorrect for RTL. 7446 // Popper 1 is broken in this case and never had a bug report so let's assume 7447 // it's not an issue. I don't think anyone ever specifies width on <html> 7448 // anyway. 7449 // Browsers where the left scrollbar doesn't cause an issue report `0` for 7450 // this (e.g. Edge 2019, IE11, Safari) 7451 return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft; 7452 } 7453 7454 function getViewportRect(element, strategy) { 7455 var win = getWindow(element); 7456 var html = getDocumentElement(element); 7457 var visualViewport = win.visualViewport; 7458 var width = html.clientWidth; 7459 var height = html.clientHeight; 7460 var x = 0; 7461 var y = 0; 7462 7463 if (visualViewport) { 7464 width = visualViewport.width; 7465 height = visualViewport.height; 7466 var layoutViewport = isLayoutViewport(); 7467 7468 if (layoutViewport || !layoutViewport && strategy === 'fixed') { 7469 x = visualViewport.offsetLeft; 7470 y = visualViewport.offsetTop; 7471 } 7472 } 7473 7474 return { 7475 width: width, 7476 height: height, 7477 x: x + getWindowScrollBarX(element), 7478 y: y 7479 }; 7480 } 7481 7482 // of the `<html>` and `<body>` rect bounds if horizontally scrollable 7483 7484 function getDocumentRect(element) { 7485 var _element$ownerDocumen; 7486 7487 var html = getDocumentElement(element); 7488 var winScroll = getWindowScroll(element); 7489 var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; 7490 var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); 7491 var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); 7492 var x = -winScroll.scrollLeft + getWindowScrollBarX(element); 7493 var y = -winScroll.scrollTop; 7494 7495 if (getComputedStyle$1(body || html).direction === 'rtl') { 7496 x += max(html.clientWidth, body ? body.clientWidth : 0) - width; 7497 } 7498 7499 return { 7500 width: width, 7501 height: height, 7502 x: x, 7503 y: y 7504 }; 7505 } 7506 7507 function isScrollParent(element) { 7508 // Firefox wants us to check `-x` and `-y` variations as well 7509 var _getComputedStyle = getComputedStyle$1(element), 7510 overflow = _getComputedStyle.overflow, 7511 overflowX = _getComputedStyle.overflowX, 7512 overflowY = _getComputedStyle.overflowY; 7513 7514 return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); 7515 } 7516 7517 function getScrollParent(node) { 7518 if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) { 7519 // $FlowFixMe[incompatible-return]: assume body is always available 7520 return node.ownerDocument.body; 7521 } 7522 7523 if (isHTMLElement(node) && isScrollParent(node)) { 7524 return node; 7525 } 7526 7527 return getScrollParent(getParentNode(node)); 7528 } 7529 7530 /* 7531 given a DOM element, return the list of all scroll parents, up the list of ancesors 7532 until we get to the top window object. This list is what we attach scroll listeners 7533 to, because if any of these parent elements scroll, we'll need to re-calculate the 7534 reference element's position. 7535 */ 7536 7537 function listScrollParents(element, list) { 7538 var _element$ownerDocumen; 7539 7540 if (list === void 0) { 7541 list = []; 7542 } 7543 7544 var scrollParent = getScrollParent(element); 7545 var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body); 7546 var win = getWindow(scrollParent); 7547 var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent; 7548 var updatedList = list.concat(target); 7549 return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here 7550 updatedList.concat(listScrollParents(getParentNode(target))); 7551 } 7552 7553 function rectToClientRect(rect) { 7554 return Object.assign({}, rect, { 7555 left: rect.x, 7556 top: rect.y, 7557 right: rect.x + rect.width, 7558 bottom: rect.y + rect.height 7559 }); 7560 } 7561 7562 function getInnerBoundingClientRect(element, strategy) { 7563 var rect = getBoundingClientRect(element, false, strategy === 'fixed'); 7564 rect.top = rect.top + element.clientTop; 7565 rect.left = rect.left + element.clientLeft; 7566 rect.bottom = rect.top + element.clientHeight; 7567 rect.right = rect.left + element.clientWidth; 7568 rect.width = element.clientWidth; 7569 rect.height = element.clientHeight; 7570 rect.x = rect.left; 7571 rect.y = rect.top; 7572 return rect; 7573 } 7574 7575 function getClientRectFromMixedType(element, clippingParent, strategy) { 7576 return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element))); 7577 } // A "clipping parent" is an overflowable container with the characteristic of 7578 // clipping (or hiding) overflowing elements with a position different from 7579 // `initial` 7580 7581 7582 function getClippingParents(element) { 7583 var clippingParents = listScrollParents(getParentNode(element)); 7584 var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0; 7585 var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; 7586 7587 if (!isElement(clipperElement)) { 7588 return []; 7589 } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414 7590 7591 7592 return clippingParents.filter(function (clippingParent) { 7593 return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'; 7594 }); 7595 } // Gets the maximum area that the element is visible in due to any number of 7596 // clipping parents 7597 7598 7599 function getClippingRect(element, boundary, rootBoundary, strategy) { 7600 var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary); 7601 var clippingParents = [].concat(mainClippingParents, [rootBoundary]); 7602 var firstClippingParent = clippingParents[0]; 7603 var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { 7604 var rect = getClientRectFromMixedType(element, clippingParent, strategy); 7605 accRect.top = max(rect.top, accRect.top); 7606 accRect.right = min(rect.right, accRect.right); 7607 accRect.bottom = min(rect.bottom, accRect.bottom); 7608 accRect.left = max(rect.left, accRect.left); 7609 return accRect; 7610 }, getClientRectFromMixedType(element, firstClippingParent, strategy)); 7611 clippingRect.width = clippingRect.right - clippingRect.left; 7612 clippingRect.height = clippingRect.bottom - clippingRect.top; 7613 clippingRect.x = clippingRect.left; 7614 clippingRect.y = clippingRect.top; 7615 return clippingRect; 7616 } 7617 7618 function computeOffsets(_ref) { 7619 var reference = _ref.reference, 7620 element = _ref.element, 7621 placement = _ref.placement; 7622 var basePlacement = placement ? getBasePlacement(placement) : null; 7623 var variation = placement ? getVariation(placement) : null; 7624 var commonX = reference.x + reference.width / 2 - element.width / 2; 7625 var commonY = reference.y + reference.height / 2 - element.height / 2; 7626 var offsets; 7627 7628 switch (basePlacement) { 7629 case top: 7630 offsets = { 7631 x: commonX, 7632 y: reference.y - element.height 7633 }; 7634 break; 7635 7636 case bottom: 7637 offsets = { 7638 x: commonX, 7639 y: reference.y + reference.height 7640 }; 7641 break; 7642 7643 case right: 7644 offsets = { 7645 x: reference.x + reference.width, 7646 y: commonY 7647 }; 7648 break; 7649 7650 case left: 7651 offsets = { 7652 x: reference.x - element.width, 7653 y: commonY 7654 }; 7655 break; 7656 7657 default: 7658 offsets = { 7659 x: reference.x, 7660 y: reference.y 7661 }; 7662 } 7663 7664 var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; 7665 7666 if (mainAxis != null) { 7667 var len = mainAxis === 'y' ? 'height' : 'width'; 7668 7669 switch (variation) { 7670 case start: 7671 offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2); 7672 break; 7673 7674 case end: 7675 offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2); 7676 break; 7677 } 7678 } 7679 7680 return offsets; 7681 } 7682 7683 function detectOverflow(state, options) { 7684 if (options === void 0) { 7685 options = {}; 7686 } 7687 7688 var _options = options, 7689 _options$placement = _options.placement, 7690 placement = _options$placement === void 0 ? state.placement : _options$placement, 7691 _options$strategy = _options.strategy, 7692 strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, 7693 _options$boundary = _options.boundary, 7694 boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, 7695 _options$rootBoundary = _options.rootBoundary, 7696 rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, 7697 _options$elementConte = _options.elementContext, 7698 elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, 7699 _options$altBoundary = _options.altBoundary, 7700 altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, 7701 _options$padding = _options.padding, 7702 padding = _options$padding === void 0 ? 0 : _options$padding; 7703 var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); 7704 var altContext = elementContext === popper ? reference : popper; 7705 var popperRect = state.rects.popper; 7706 var element = state.elements[altBoundary ? altContext : elementContext]; 7707 var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy); 7708 var referenceClientRect = getBoundingClientRect(state.elements.reference); 7709 var popperOffsets = computeOffsets({ 7710 reference: referenceClientRect, 7711 element: popperRect, 7712
7712strategy: 'absolute'
vendor: 11,222 bytes, lines 7712-8040
7712, 7713 placement: placement 7714 }); 7715 var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets)); 7716 var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect 7717 // 0 or negative = within the clipping rect 7718 7719 var overflowOffsets = { 7720 top: clippingClientRect.top - elementClientRect.top + paddingObject.top, 7721 bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, 7722 left: clippingClientRect.left - elementClientRect.left + paddingObject.left, 7723 right: elementClientRect.right - clippingClientRect.right + paddingObject.right 7724 }; 7725 var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element 7726 7727 if (elementContext === popper && offsetData) { 7728 var offset = offsetData[placement]; 7729 Object.keys(overflowOffsets).forEach(function (key) { 7730 var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; 7731 var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x'; 7732 overflowOffsets[key] += offset[axis] * multiply; 7733 }); 7734 } 7735 7736 return overflowOffsets; 7737 } 7738 7739 function computeAutoPlacement(state, options) { 7740 if (options === void 0) { 7741 options = {}; 7742 } 7743 7744 var _options = options, 7745 placement = _options.placement, 7746 boundary = _options.boundary, 7747 rootBoundary = _options.rootBoundary, 7748 padding = _options.padding, 7749 flipVariations = _options.flipVariations, 7750 _options$allowedAutoP = _options.allowedAutoPlacements, 7751 allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP; 7752 var variation = getVariation(placement); 7753 var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) { 7754 return getVariation(placement) === variation; 7755 }) : basePlacements; 7756 var allowedPlacements = placements$1.filter(function (placement) { 7757 return allowedAutoPlacements.indexOf(placement) >= 0; 7758 }); 7759 7760 if (allowedPlacements.length === 0) { 7761 allowedPlacements = placements$1; 7762 } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions... 7763 7764 7765 var overflows = allowedPlacements.reduce(function (acc, placement) { 7766 acc[placement] = detectOverflow(state, { 7767 placement: placement, 7768 boundary: boundary, 7769 rootBoundary: rootBoundary, 7770 padding: padding 7771 })[getBasePlacement(placement)]; 7772 return acc; 7773 }, {}); 7774 return Object.keys(overflows).sort(function (a, b) { 7775 return overflows[a] - overflows[b]; 7776 }); 7777 } 7778 7779 function getExpandedFallbackPlacements(placement) { 7780 if (getBasePlacement(placement) === auto) { 7781 return []; 7782 } 7783 7784 var oppositePlacement = getOppositePlacement(placement); 7785 return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)]; 7786 } 7787 7788 function flip(_ref) { 7789 var state = _ref.state, 7790 options = _ref.options, 7791 name = _ref.name; 7792 7793 if (state.modifiersData[name]._skip) { 7794 return; 7795 } 7796 7797 var _options$mainAxis = options.mainAxis, 7798 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, 7799 _options$altAxis = options.altAxis, 7800 checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, 7801 specifiedFallbackPlacements = options.fallbackPlacements, 7802 padding = options.padding, 7803 boundary = options.boundary, 7804 rootBoundary = options.rootBoundary, 7805 altBoundary = options.altBoundary, 7806 _options$flipVariatio = options.flipVariations, 7807 flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, 7808 allowedAutoPlacements = options.allowedAutoPlacements; 7809 var preferredPlacement = state.options.placement; 7810 var basePlacement = getBasePlacement(preferredPlacement); 7811 var isBasePlacement = basePlacement === preferredPlacement; 7812 var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); 7813 var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { 7814 return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, { 7815 placement: placement, 7816 boundary: boundary, 7817 rootBoundary: rootBoundary, 7818 padding: padding, 7819 flipVariations: flipVariations, 7820 allowedAutoPlacements: allowedAutoPlacements 7821 }) : placement); 7822 }, []); 7823 var referenceRect = state.rects.reference; 7824 var popperRect = state.rects.popper; 7825 var checksMap = new Map(); 7826 var makeFallbackChecks = true; 7827 var firstFittingPlacement = placements[0]; 7828 7829 for (var i = 0; i < placements.length; i++) { 7830 var placement = placements[i]; 7831 7832 var _basePlacement = getBasePlacement(placement); 7833 7834 var isStartVariation = getVariation(placement) === start; 7835 var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; 7836 var len = isVertical ? 'width' : 'height'; 7837 var overflow = detectOverflow(state, { 7838 placement: placement, 7839 boundary: boundary, 7840 rootBoundary: rootBoundary, 7841 altBoundary: altBoundary, 7842 padding: padding 7843 }); 7844 var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top; 7845 7846 if (referenceRect[len] > popperRect[len]) { 7847 mainVariationSide = getOppositePlacement(mainVariationSide); 7848 } 7849 7850 var altVariationSide = getOppositePlacement(mainVariationSide); 7851 var checks = []; 7852 7853 if (checkMainAxis) { 7854 checks.push(overflow[_basePlacement] <= 0); 7855 } 7856 7857 if (checkAltAxis) { 7858 checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); 7859 } 7860 7861 if (checks.every(function (check) { 7862 return check; 7863 })) { 7864 firstFittingPlacement = placement; 7865 makeFallbackChecks = false; 7866 break; 7867 } 7868 7869 checksMap.set(placement, checks); 7870 } 7871 7872 if (makeFallbackChecks) { 7873 // `2` may be desired in some cases – research later 7874 var numberOfChecks = flipVariations ? 3 : 1; 7875 7876 var _loop = function _loop(_i) { 7877 var fittingPlacement = placements.find(function (placement) { 7878 var checks = checksMap.get(placement); 7879 7880 if (checks) { 7881 return checks.slice(0, _i).every(function (check) { 7882 return check; 7883 }); 7884 } 7885 }); 7886 7887 if (fittingPlacement) { 7888 firstFittingPlacement = fittingPlacement; 7889 return "break"; 7890 } 7891 }; 7892 7893 for (var _i = numberOfChecks; _i > 0; _i--) { 7894 var _ret = _loop(_i); 7895 7896 if (_ret === "break") break; 7897 } 7898 } 7899 7900 if (state.placement !== firstFittingPlacement) { 7901 state.modifiersData[name]._skip = true; 7902 state.placement = firstFittingPlacement; 7903 state.reset = true; 7904 } 7905 } // eslint-disable-next-line import/no-unused-modules 7906 7907 7908 const flip$1 = { 7909 name: 'flip', 7910 enabled: true, 7911 phase: 'main', 7912 fn: flip, 7913 requiresIfExists: ['offset'], 7914 data: { 7915 _skip: false 7916 } 7917 }; 7918 7919 function getSideOffsets(overflow, rect, preventedOffsets) { 7920 if (preventedOffsets === void 0) { 7921 preventedOffsets = { 7922 x: 0, 7923 y: 0 7924 }; 7925 } 7926 7927 return { 7928 top: overflow.top - rect.height - preventedOffsets.y, 7929 right: overflow.right - rect.width + preventedOffsets.x, 7930 bottom: overflow.bottom - rect.height + preventedOffsets.y, 7931 left: overflow.left - rect.width - preventedOffsets.x 7932 }; 7933 } 7934 7935 function isAnySideFullyClipped(overflow) { 7936 return [top, right, bottom, left].some(function (side) { 7937 return overflow[side] >= 0; 7938 }); 7939 } 7940 7941 function hide(_ref) { 7942 var state = _ref.state, 7943 name = _ref.name; 7944 var referenceRect = state.rects.reference; 7945 var popperRect = state.rects.popper; 7946 var preventedOffsets = state.modifiersData.preventOverflow; 7947 var referenceOverflow = detectOverflow(state, { 7948 elementContext: 'reference' 7949 }); 7950 var popperAltOverflow = detectOverflow(state, { 7951 altBoundary: true 7952 }); 7953 var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); 7954 var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); 7955 var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); 7956 var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); 7957 state.modifiersData[name] = { 7958 referenceClippingOffsets: referenceClippingOffsets, 7959 popperEscapeOffsets: popperEscapeOffsets, 7960 isReferenceHidden: isReferenceHidden, 7961 hasPopperEscaped: hasPopperEscaped 7962 }; 7963 state.attributes.popper = Object.assign({}, state.attributes.popper, { 7964 'data-popper-reference-hidden': isReferenceHidden, 7965 'data-popper-escaped': hasPopperEscaped 7966 }); 7967 } // eslint-disable-next-line import/no-unused-modules 7968 7969 7970 const hide$1 = { 7971 name: 'hide', 7972 enabled: true, 7973 phase: 'main', 7974 requiresIfExists: ['preventOverflow'], 7975 fn: hide 7976 }; 7977 7978 function distanceAndSkiddingToXY(placement, rects, offset) { 7979 var basePlacement = getBasePlacement(placement); 7980 var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1; 7981 7982 var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, { 7983 placement: placement 7984 })) : offset, 7985 skidding = _ref[0], 7986 distance = _ref[1]; 7987 7988 skidding = skidding || 0; 7989 distance = (distance || 0) * invertDistance; 7990 return [left, right].indexOf(basePlacement) >= 0 ? { 7991 x: distance, 7992 y: skidding 7993 } : { 7994 x: skidding, 7995 y: distance 7996 }; 7997 } 7998 7999 function offset(_ref2) { 8000 var state = _ref2.state, 8001 options = _ref2.options, 8002 name = _ref2.name; 8003 var _options$offset = options.offset, 8004 offset = _options$offset === void 0 ? [0, 0] : _options$offset; 8005 var data = placements.reduce(function (acc, placement) { 8006 acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset); 8007 return acc; 8008 }, {}); 8009 var _data$state$placement = data[state.placement], 8010 x = _data$state$placement.x, 8011 y = _data$state$placement.y; 8012 8013 if (state.modifiersData.popperOffsets != null) { 8014 state.modifiersData.popperOffsets.x += x; 8015 state.modifiersData.popperOffsets.y += y; 8016 } 8017 8018 state.modifiersData[name] = data; 8019 } // eslint-disable-next-line import/no-unused-modules 8020 8021 8022 const offset$1 = { 8023 name: 'offset', 8024 enabled: true, 8025 phase: 'main', 8026 requires: ['popperOffsets'], 8027 fn: offset 8028 }; 8029 8030 function popperOffsets(_ref) { 8031 var state = _ref.state, 8032 name = _ref.name; 8033 // Offsets are the actual position the popper needs to have to be 8034 // properly positioned near its reference element 8035 // This is the most basic placement, and will be adjusted by 8036 // the modifiers in the next step 8037 state.modifiersData[name] = computeOffsets({ 8038 reference: state.rects.reference, 8039 element: state.rects.popper, 8040
8040strategy: 'absolute'
vendor: 16,789 bytes, lines 8040-8483
8040, 8041 placement: state.placement 8042 }); 8043 } // eslint-disable-next-line import/no-unused-modules 8044 8045 8046 const popperOffsets$1 = { 8047 name: 'popperOffsets', 8048 enabled: true, 8049 phase: 'read', 8050 fn: popperOffsets, 8051 data: {} 8052 }; 8053 8054 function getAltAxis(axis) { 8055 return axis === 'x' ? 'y' : 'x'; 8056 } 8057 8058 function preventOverflow(_ref) { 8059 var state = _ref.state, 8060 options = _ref.options, 8061 name = _ref.name; 8062 var _options$mainAxis = options.mainAxis, 8063 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, 8064 _options$altAxis = options.altAxis, 8065 checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, 8066 boundary = options.boundary, 8067 rootBoundary = options.rootBoundary, 8068 altBoundary = options.altBoundary, 8069 padding = options.padding, 8070 _options$tether = options.tether, 8071 tether = _options$tether === void 0 ? true : _options$tether, 8072 _options$tetherOffset = options.tetherOffset, 8073 tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; 8074 var overflow = detectOverflow(state, { 8075 boundary: boundary, 8076 rootBoundary: rootBoundary, 8077 padding: padding, 8078 altBoundary: altBoundary 8079 }); 8080 var basePlacement = getBasePlacement(state.placement); 8081 var variation = getVariation(state.placement); 8082 var isBasePlacement = !variation; 8083 var mainAxis = getMainAxisFromPlacement(basePlacement); 8084 var altAxis = getAltAxis(mainAxis); 8085 var popperOffsets = state.modifiersData.popperOffsets; 8086 var referenceRect = state.rects.reference; 8087 var popperRect = state.rects.popper; 8088 var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, { 8089 placement: state.placement 8090 })) : tetherOffset; 8091 var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? { 8092 mainAxis: tetherOffsetValue, 8093 altAxis: tetherOffsetValue 8094 } : Object.assign({ 8095 mainAxis: 0, 8096 altAxis: 0 8097 }, tetherOffsetValue); 8098 var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null; 8099 var data = { 8100 x: 0, 8101 y: 0 8102 }; 8103 8104 if (!popperOffsets) { 8105 return; 8106 } 8107 8108 if (checkMainAxis) { 8109 var _offsetModifierState$; 8110 8111 var mainSide = mainAxis === 'y' ? top : left; 8112 var altSide = mainAxis === 'y' ? bottom : right; 8113 var len = mainAxis === 'y' ? 'height' : 'width'; 8114 var offset = popperOffsets[mainAxis]; 8115 var min$1 = offset + overflow[mainSide]; 8116 var max$1 = offset - overflow[altSide]; 8117 var additive = tether ? -popperRect[len] / 2 : 0; 8118 var minLen = variation === start ? referenceRect[len] : popperRect[len]; 8119 var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go 8120 // outside the reference bounds 8121 8122 var arrowElement = state.elements.arrow; 8123 var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { 8124 width: 0, 8125 height: 0 8126 }; 8127 var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject(); 8128 var arrowPaddingMin = arrowPaddingObject[mainSide]; 8129 var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want 8130 // to include its full size in the calculation. If the reference is small 8131 // and near the edge of a boundary, the popper can overflow even if the 8132 // reference is not overflowing as well (e.g. virtual elements with no 8133 // width or height) 8134 8135 var arrowLen = within(0, referenceRect[len], arrowRect[len]); 8136 var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis; 8137 var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis; 8138 var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); 8139 var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; 8140 var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0; 8141 var tetherMin = offset + minOffset - offsetModifierValue - clientOffset; 8142 var tetherMax = offset + maxOffset - offsetModifierValue; 8143 var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1); 8144 popperOffsets[mainAxis] = preventedOffset; 8145 data[mainAxis] = preventedOffset - offset; 8146 } 8147 8148 if (checkAltAxis) { 8149 var _offsetModifierState$2; 8150 8151 var _mainSide = mainAxis === 'x' ? top : left; 8152 8153 var _altSide = mainAxis === 'x' ? bottom : right; 8154 8155 var _offset = popperOffsets[altAxis]; 8156 8157 var _len = altAxis === 'y' ? 'height' : 'width'; 8158 8159 var _min = _offset + overflow[_mainSide]; 8160 8161 var _max = _offset - overflow[_altSide]; 8162 8163 var isOriginSide = [top, left].indexOf(basePlacement) !== -1; 8164 8165 var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0; 8166 8167 var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis; 8168 8169 var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max; 8170 8171 var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max); 8172 8173 popperOffsets[altAxis] = _preventedOffset; 8174 data[altAxis] = _preventedOffset - _offset; 8175 } 8176 8177 state.modifiersData[name] = data; 8178 } // eslint-disable-next-line import/no-unused-modules 8179 8180 8181 const preventOverflow$1 = { 8182 name: 'preventOverflow', 8183 enabled: true, 8184 phase: 'main', 8185 fn: preventOverflow, 8186 requiresIfExists: ['offset'] 8187 }; 8188 8189 function getHTMLElementScroll(element) { 8190 return { 8191 scrollLeft: element.scrollLeft, 8192 scrollTop: element.scrollTop 8193 }; 8194 } 8195 8196 function getNodeScroll(node) { 8197 if (node === getWindow(node) || !isHTMLElement(node)) { 8198 return getWindowScroll(node); 8199 } else { 8200 return getHTMLElementScroll(node); 8201 } 8202 } 8203 8204 function isElementScaled(element) { 8205 var rect = element.getBoundingClientRect(); 8206 var scaleX = round(rect.width) / element.offsetWidth || 1; 8207 var scaleY = round(rect.height) / element.offsetHeight || 1; 8208 return scaleX !== 1 || scaleY !== 1; 8209 } // Returns the composite rect of an element relative to its offsetParent. 8210 // Composite means it takes into account transforms as well as layout. 8211 8212 8213 function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { 8214 if (isFixed === void 0) { 8215 isFixed = false; 8216 } 8217 8218 var isOffsetParentAnElement = isHTMLElement(offsetParent); 8219 var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent); 8220 var documentElement = getDocumentElement(offsetParent); 8221 var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed); 8222 var scroll = { 8223 scrollLeft: 0, 8224 scrollTop: 0 8225 }; 8226 var offsets = { 8227 x: 0, 8228 y: 0 8229 }; 8230 8231 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 8232 if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 8233 isScrollParent(documentElement)) { 8234 scroll = getNodeScroll(offsetParent); 8235 } 8236 8237 if (isHTMLElement(offsetParent)) { 8238 offsets = getBoundingClientRect(offsetParent, true); 8239 offsets.x += offsetParent.clientLeft; 8240 offsets.y += offsetParent.clientTop; 8241 } else if (documentElement) { 8242 offsets.x = getWindowScrollBarX(documentElement); 8243 } 8244 } 8245 8246 return { 8247 x: rect.left + scroll.scrollLeft - offsets.x, 8248 y: rect.top + scroll.scrollTop - offsets.y, 8249 width: rect.width, 8250 height: rect.height 8251 }; 8252 } 8253 8254 function order(modifiers) { 8255 var map = new Map(); 8256 var visited = new Set(); 8257 var result = []; 8258 modifiers.forEach(function (modifier) { 8259 map.set(modifier.name, modifier); 8260 }); // On visiting object, check for its dependencies and visit them recursively 8261 8262 function sort(modifier) { 8263 visited.add(modifier.name); 8264 var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); 8265 requires.forEach(function (dep) { 8266 if (!visited.has(dep)) { 8267 var depModifier = map.get(dep); 8268 8269 if (depModifier) { 8270 sort(depModifier); 8271 } 8272 } 8273 }); 8274 result.push(modifier); 8275 } 8276 8277 modifiers.forEach(function (modifier) { 8278 if (!visited.has(modifier.name)) { 8279 // check for visited object 8280 sort(modifier); 8281 } 8282 }); 8283 return result; 8284 } 8285 8286 function orderModifiers(modifiers) { 8287 // order based on dependencies 8288 var orderedModifiers = order(modifiers); // order based on phase 8289 8290 return modifierPhases.reduce(function (acc, phase) { 8291 return acc.concat(orderedModifiers.filter(function (modifier) { 8292 return modifier.phase === phase; 8293 })); 8294 }, []); 8295 } 8296 8297 function debounce(fn) { 8298 var pending; 8299 return function () { 8300 if (!pending) { 8301 pending = new Promise(function (resolve) { 8302 Promise.resolve().then(function () { 8303 pending = undefined; 8304 resolve(fn()); 8305 }); 8306 }); 8307 } 8308 8309 return pending; 8310 }; 8311 } 8312 8313 function mergeByName(modifiers) { 8314 var merged = modifiers.reduce(function (merged, current) { 8315 var existing = merged[current.name]; 8316 merged[current.name] = existing ? Object.assign({}, existing, current, { 8317 options: Object.assign({}, existing.options, current.options), 8318 data: Object.assign({}, existing.data, current.data) 8319 }) : current; 8320 return merged; 8321 }, {}); // IE11 does not support Object.values 8322 8323 return Object.keys(merged).map(function (key) { 8324 return merged[key]; 8325 }); 8326 } 8327 8328 var DEFAULT_OPTIONS = { 8329 placement: 'bottom', 8330 modifiers: [], 8331 strategy: 'absolute' 8332 }; 8333 8334 function areValidElements() { 8335 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 8336 args[_key] = arguments[_key]; 8337 } 8338 8339 return !args.some(function (element) { 8340 return !(element && typeof element.getBoundingClientRect === 'function'); 8341 }); 8342 } 8343 8344 function popperGenerator(generatorOptions) { 8345 if (generatorOptions === void 0) { 8346 generatorOptions = {}; 8347 } 8348 8349 var _generatorOptions = generatorOptions, 8350 _generatorOptions$def = _generatorOptions.defaultModifiers, 8351 defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, 8352 _generatorOptions$def2 = _generatorOptions.defaultOptions, 8353 defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; 8354 return function createPopper(reference, popper, options) { 8355 if (options === void 0) { 8356 options = defaultOptions; 8357 } 8358 8359 var state = { 8360 placement: 'bottom', 8361 orderedModifiers: [], 8362 options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions), 8363 modifiersData: {}, 8364 elements: { 8365 reference: reference, 8366 popper: popper 8367 }, 8368 attributes: {}, 8369 styles: {} 8370 }; 8371 var effectCleanupFns = []; 8372 var isDestroyed = false; 8373 var instance = { 8374 state: state, 8375 setOptions: function setOptions(setOptionsAction) { 8376 var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction; 8377 cleanupModifierEffects(); 8378 state.options = Object.assign({}, defaultOptions, state.options, options); 8379 state.scrollParents = { 8380 reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [], 8381 popper: listScrollParents(popper) 8382 }; // Orders the modifiers based on their dependencies and `phase` 8383 // properties 8384 8385 var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers 8386 8387 state.orderedModifiers = orderedModifiers.filter(function (m) { 8388 return m.enabled; 8389 }); 8390 runModifierEffects(); 8391 return instance.update(); 8392 }, 8393 // Sync update – it will always be executed, even if not necessary. This 8394 // is useful for low frequency updates where sync behavior simplifies the 8395 // logic. 8396 // For high frequency updates (e.g. `resize` and `scroll` events), always 8397 // prefer the async Popper#update method 8398 forceUpdate: function forceUpdate() { 8399 if (isDestroyed) { 8400 return; 8401 } 8402 8403 var _state$elements = state.elements, 8404 reference = _state$elements.reference, 8405 popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements 8406 // anymore 8407 8408 if (!areValidElements(reference, popper)) { 8409 return; 8410 } // Store the reference and popper rects to be read by modifiers 8411 8412 8413 state.rects = { 8414 reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'), 8415 popper: getLayoutRect(popper) 8416 }; // Modifiers have the ability to reset the current update cycle. The 8417 // most common use case for this is the `flip` modifier changing the 8418 // placement, which then needs to re-run all the modifiers, because the 8419 // logic was previously ran for the previous placement and is therefore 8420 // stale/incorrect 8421 8422 state.reset = false; 8423 state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier 8424 // is filled with the initial data specified by the modifier. This means 8425 // it doesn't persist and is fresh on each update. 8426 // To ensure persistent data, use `${name}#persistent` 8427 8428 state.orderedModifiers.forEach(function (modifier) { 8429 return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); 8430 }); 8431 8432 for (var index = 0; index < state.orderedModifiers.length; index++) { 8433 if (state.reset === true) { 8434 state.reset = false; 8435 index = -1; 8436 continue; 8437 } 8438 8439 var _state$orderedModifie = state.orderedModifiers[index], 8440 fn = _state$orderedModifie.fn, 8441 _state$orderedModifie2 = _state$orderedModifie.options, 8442 _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, 8443 name = _state$orderedModifie.name; 8444 8445 if (typeof fn === 'function') { 8446 state = fn({ 8447 state: state, 8448 options: _options, 8449 name: name, 8450 instance: instance 8451 }) || state; 8452 } 8453 } 8454 }, 8455 // Async and optimistically optimized update – it will not be executed if 8456 // not necessary (debounced to run at most once-per-tick) 8457 update: debounce(function () { 8458 return new Promise(function (resolve) { 8459 instance.forceUpdate(); 8460 resolve(state); 8461 }); 8462 }), 8463 destroy: function destroy() { 8464 cleanupModifierEffects(); 8465 isDestroyed = true; 8466 } 8467 }; 8468 8469 if (!areValidElements(reference, popper)) { 8470 return instance; 8471 } 8472 8473 instance.setOptions(options).then(function (state) { 8474 if (!isDestroyed && options.onFirstUpdate) { 8475 options.onFirstUpdate(state); 8476 } 8477 }); // Modifiers have the ability to execute arbitrary code before the first 8478 // update cycle runs. They will be executed in the same order as the update 8479 // cycle. This is useful when a modifier adds some persistent data that 8480 // other modifiers need to use, but the modifier is run after the dependent 8481 // one. 8482 8483 function runModifierEffects() {
vendor: 8,963 bytes, lines 8484-8747
8484 state.orderedModifiers.forEach(function (_ref) { 8485 var name = _ref.name, 8486 _ref$options = _ref.options, 8487 options = _ref$options === void 0 ? {} : _ref$options, 8488 effect = _ref.effect; 8489 8490 if (typeof effect === 'function') { 8491 var cleanupFn = effect({ 8492 state: state, 8493 name: name, 8494 instance: instance, 8495 options: options 8496 }); 8497 8498 var noopFn = function noopFn() {}; 8499 8500 effectCleanupFns.push(cleanupFn || noopFn); 8501 } 8502 }); 8503 } 8504 8505 function cleanupModifierEffects() { 8506 effectCleanupFns.forEach(function (fn) { 8507 return fn(); 8508 }); 8509 effectCleanupFns = []; 8510 } 8511 8512 return instance; 8513 }; 8514 } 8515 var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules 8516 8517 var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1]; 8518 var createPopper$1 = /*#__PURE__*/popperGenerator({ 8519 defaultModifiers: defaultModifiers$1 8520 }); // eslint-disable-next-line import/no-unused-modules 8521 8522 var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1]; 8523 var createPopper = /*#__PURE__*/popperGenerator({ 8524 defaultModifiers: defaultModifiers 8525 }); // eslint-disable-next-line import/no-unused-modules 8526 8527 const Popper = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8528 __proto__: null, 8529 afterMain, 8530 afterRead, 8531 afterWrite, 8532 applyStyles: applyStyles$1, 8533 arrow: arrow$1, 8534 auto, 8535 basePlacements, 8536 beforeMain, 8537 beforeRead, 8538 beforeWrite, 8539 bottom, 8540 clippingParents, 8541 computeStyles: computeStyles$1, 8542 createPopper, 8543 createPopperBase: createPopper$2, 8544 createPopperLite: createPopper$1, 8545 detectOverflow, 8546 end, 8547 eventListeners, 8548 flip: flip$1, 8549 hide: hide$1, 8550 left, 8551 main, 8552 modifierPhases, 8553 offset: offset$1, 8554 placements, 8555 popper, 8556 popperGenerator, 8557 popperOffsets: popperOffsets$1, 8558 preventOverflow: preventOverflow$1, 8559 read, 8560 reference, 8561 right, 8562 start, 8563 top, 8564 variationPlacements, 8565 viewport, 8566 write 8567 }, Symbol.toStringTag, { value: 'Module' })); 8568 8569 /** 8570 * -------------------------------------------------------------------------- 8571 * Bootstrap dropdown.js 8572 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 8573 * -------------------------------------------------------------------------- 8574 */ 8575 8576 8577 /** 8578 * Constants 8579 */ 8580 8581 const NAME$a = 'dropdown'; 8582 const DATA_KEY$6 = 'bs.dropdown'; 8583 const EVENT_KEY$6 = `.${DATA_KEY$6}`; 8584 const DATA_API_KEY$3 = '.data-api'; 8585 const ESCAPE_KEY$2 = 'Escape'; 8586 const TAB_KEY$1 = 'Tab'; 8587 const ARROW_UP_KEY$1 = 'ArrowUp'; 8588 const ARROW_DOWN_KEY$1 = 'ArrowDown'; 8589 const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button 8590 8591 const EVENT_HIDE$5 = `hide${EVENT_KEY$6}`; 8592 const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`; 8593 const EVENT_SHOW$5 = `show${EVENT_KEY$6}`; 8594 const EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`; 8595 const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; 8596 const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`; 8597 const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`; 8598 const CLASS_NAME_SHOW$6 = 'show'; 8599 const CLASS_NAME_DROPUP = 'dropup'; 8600 const CLASS_NAME_DROPEND = 'dropend'; 8601 const CLASS_NAME_DROPSTART = 'dropstart'; 8602 const CLASS_NAME_DROPUP_CENTER = 'dropup-center'; 8603 const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'; 8604 const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)'; 8605 const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`; 8606 const SELECTOR_MENU = '.dropdown-menu'; 8607 const SELECTOR_NAVBAR = '.navbar'; 8608 const SELECTOR_NAVBAR_NAV = '.navbar-nav'; 8609 const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 8610 const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; 8611 const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; 8612 const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; 8613 const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; 8614 const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; 8615 const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; 8616 const PLACEMENT_TOPCENTER = 'top'; 8617 const PLACEMENT_BOTTOMCENTER = 'bottom'; 8618 const Default$9 = { 8619 autoClose: true, 8620 boundary: 'clippingParents', 8621 display: 'dynamic', 8622 offset: [0, 2], 8623 popperConfig: null, 8624 reference: 'toggle' 8625 }; 8626 const DefaultType$9 = { 8627 autoClose: '(boolean|string)', 8628 boundary: '(string|element)', 8629 display: 'string', 8630 offset: '(array|string|function)', 8631 popperConfig: '(null|object|function)', 8632 reference: '(string|element|object)' 8633 }; 8634 8635 /** 8636 * Class definition 8637 */ 8638 8639 class Dropdown extends BaseComponent { 8640 constructor(element, config) { 8641 super(element, config); 8642 this._popper = null; 8643 this._parent = this._element.parentNode; // dropdown wrapper 8644 // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ 8645 this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent); 8646 this._inNavbar = this._detectNavbar(); 8647 } 8648 8649 // Getters 8650 static get Default() { 8651 return Default$9; 8652 } 8653 static get DefaultType() { 8654 return DefaultType$9; 8655 } 8656 static get NAME() { 8657 return NAME$a; 8658 } 8659 8660 // Public 8661 toggle() { 8662 return this._isShown() ? this.hide() : this.show(); 8663 } 8664 show() { 8665 if (isDisabled(this._element) || this._isShown()) { 8666 return; 8667 } 8668 const relatedTarget = { 8669 relatedTarget: this._element 8670 }; 8671 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget); 8672 if (showEvent.defaultPrevented) { 8673 return; 8674 } 8675 this._createPopper(); 8676 8677 // If this is a touch-enabled device we add extra 8678 // empty mouseover listeners to the body's immediate children; 8679 // only needed because of broken event delegation on iOS 8680 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 8681 if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) { 8682 for (const element of [].concat(...document.body.children)) { 8683 EventHandler.on(element, 'mouseover', noop); 8684 } 8685 } 8686 this._element.focus(); 8687 this._element.setAttribute('aria-expanded', true); 8688 this._menu.classList.add(CLASS_NAME_SHOW$6); 8689 this._element.classList.add(CLASS_NAME_SHOW$6); 8690 EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget); 8691 } 8692 hide() { 8693 if (isDisabled(this._element) || !this._isShown()) { 8694 return; 8695 } 8696 const relatedTarget = { 8697 relatedTarget: this._element 8698 }; 8699 this._completeHide(relatedTarget); 8700 } 8701 dispose() { 8702 if (this._popper) { 8703 this._popper.destroy(); 8704 } 8705 super.dispose(); 8706 } 8707 update() { 8708 this._inNavbar = this._detectNavbar(); 8709 if (this._popper) { 8710 this._popper.update(); 8711 } 8712 } 8713 8714 // Private 8715 _completeHide(relatedTarget) { 8716 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget); 8717 if (hideEvent.defaultPrevented) { 8718 return; 8719 } 8720 8721 // If this is a touch-enabled device we remove the extra 8722 // empty mouseover listeners we added for iOS support 8723 if ('ontouchstart' in document.documentElement) { 8724 for (const element of [].concat(...document.body.children)) { 8725 EventHandler.off(element, 'mouseover', noop); 8726 } 8727 } 8728 if (this._popper) { 8729 this._popper.destroy(); 8730 } 8731 this._menu.classList.remove(CLASS_NAME_SHOW$6); 8732 this._element.classList.remove(CLASS_NAME_SHOW$6); 8733 this._element.setAttribute('aria-expanded', 'false'); 8734 Manipulator.removeDataAttribute(this._menu, 'popper'); 8735 EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget); 8736 } 8737 _getConfig(config) { 8738 config = super._getConfig(config); 8739 if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { 8740 // Popper virtual elements require a getBoundingClientRect method 8741 throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); 8742 } 8743 return config; 8744 } 8745 _createPopper() { 8746 if (typeof Popper === 'undefined') { 8747 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org
vendor: 2,758 bytes, lines 8747-8826
8747)'); 8748 } 8749 let referenceElement = this._element; 8750 if (this._config.reference === 'parent') { 8751 referenceElement = this._parent; 8752 } else if (isElement$1(this._config.reference)) { 8753 referenceElement = getElement(this._config.reference); 8754 } else if (typeof this._config.reference === 'object') { 8755 referenceElement = this._config.reference; 8756 } 8757 const popperConfig = this._getPopperConfig(); 8758 this._popper = createPopper(referenceElement, this._menu, popperConfig); 8759 } 8760 _isShown() { 8761 return this._menu.classList.contains(CLASS_NAME_SHOW$6); 8762 } 8763 _getPlacement() { 8764 const parentDropdown = this._parent; 8765 if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { 8766 return PLACEMENT_RIGHT; 8767 } 8768 if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { 8769 return PLACEMENT_LEFT; 8770 } 8771 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) { 8772 return PLACEMENT_TOPCENTER; 8773 } 8774 if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) { 8775 return PLACEMENT_BOTTOMCENTER; 8776 } 8777 8778 // We need to trim the value because custom properties can also include spaces 8779 const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; 8780 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { 8781 return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; 8782 } 8783 return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; 8784 } 8785 _detectNavbar() { 8786 return this._element.closest(SELECTOR_NAVBAR) !== null; 8787 } 8788 _getOffset() { 8789 const { 8790 offset 8791 } = this._config; 8792 if (typeof offset === 'string') { 8793 return offset.split(',').map(value => Number.parseInt(value, 10)); 8794 } 8795 if (typeof offset === 'function') { 8796 return popperData => offset(popperData, this._element); 8797 } 8798 return offset; 8799 } 8800 _getPopperConfig() { 8801 const defaultBsPopperConfig = { 8802 placement: this._getPlacement(), 8803 modifiers: [{ 8804 name: 'preventOverflow', 8805 options: { 8806 boundary: this._config.boundary 8807 } 8808 }, { 8809 name: 'offset', 8810 options: { 8811 offset: this._getOffset() 8812 } 8813 }] 8814 }; 8815 8816 // Disable Popper if we have a static display or Dropdown is in Navbar 8817 if (this._inNavbar || this._config.display === 'static') { 8818 Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // TODO: v6 remove 8819 defaultBsPopperConfig.modifiers = [{ 8820 name: 'applyStyles', 8821 enabled: false 8822 }]; 8823 } 8824 return { 8825 ...defaultBsPopperConfig, 8826 ...execute(this._config.popperConfig, [
vendor: 4,959 bytes, lines 8826-8960
8826defaultBsPopperConfig]) 8827 }; 8828 } 8829 _selectMenuItem({ 8830 key, 8831 target 8832 }) { 8833 const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element)); 8834 if (!items.length) { 8835 return; 8836 } 8837 8838 // if target isn't included in items (e.g. when expanding the dropdown) 8839 // allow cycling to get the last item in case key equals ARROW_UP_KEY 8840 getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus(); 8841 } 8842 8843 // Static 8844 static jQueryInterface(config) { 8845 return this.each(function () { 8846 const data = Dropdown.getOrCreateInstance(this, config); 8847 if (typeof config !== 'string') { 8848 return; 8849 } 8850 if (typeof data[config] === 'undefined') { 8851 throw new TypeError(`No method named "${config}"`); 8852 } 8853 data[config](); 8854 }); 8855 } 8856 static clearMenus(event) { 8857 if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) { 8858 return; 8859 } 8860 const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN); 8861 for (const toggle of openToggles) { 8862 const context = Dropdown.getInstance(toggle); 8863 if (!context || context._config.autoClose === false) { 8864 continue; 8865 } 8866 const composedPath = event.composedPath(); 8867 const isMenuTarget = composedPath.includes(context._menu); 8868 if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { 8869 continue; 8870 } 8871 8872 // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu 8873 if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) { 8874 continue; 8875 } 8876 const relatedTarget = { 8877 relatedTarget: context._element 8878 }; 8879 if (event.type === 'click') { 8880 relatedTarget.clickEvent = event; 8881 } 8882 context._completeHide(relatedTarget); 8883 } 8884 } 8885 static dataApiKeydownHandler(event) { 8886 // If not an UP | DOWN | ESCAPE key => not a dropdown command 8887 // If input/textarea && if key is other than ESCAPE => not a dropdown command 8888 8889 const isInput = /input|textarea/i.test(event.target.tagName); 8890 const isEscapeEvent = event.key === ESCAPE_KEY$2; 8891 const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key); 8892 if (!isUpOrDownEvent && !isEscapeEvent) { 8893 return; 8894 } 8895 if (isInput && !isEscapeEvent) { 8896 return; 8897 } 8898 event.preventDefault(); 8899 8900 // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ 8901 const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode); 8902 const instance = Dropdown.getOrCreateInstance(getToggleButton); 8903 if (isUpOrDownEvent) { 8904 event.stopPropagation(); 8905 instance.show(); 8906 instance._selectMenuItem(event); 8907 return; 8908 } 8909 if (instance._isShown()) { 8910 // else is escape and we check if it is shown 8911 event.stopPropagation(); 8912 instance.hide(); 8913 getToggleButton.focus(); 8914 } 8915 } 8916 } 8917 8918 /** 8919 * Data API implementation 8920 */ 8921 8922 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); 8923 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); 8924 EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); 8925 EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); 8926 EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 8927 event.preventDefault(); 8928 Dropdown.getOrCreateInstance(this).toggle(); 8929 }); 8930 8931 /** 8932 * jQuery 8933 */ 8934 8935 defineJQueryPlugin(Dropdown); 8936 8937 /** 8938 * -------------------------------------------------------------------------- 8939 * Bootstrap util/backdrop.js 8940 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 8941 * -------------------------------------------------------------------------- 8942 */ 8943 8944 8945 /** 8946 * Constants 8947 */ 8948 8949 const NAME$9 = 'backdrop'; 8950 const CLASS_NAME_FADE$4 = 'fade'; 8951 const CLASS_NAME_SHOW$5 = 'show'; 8952 const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`; 8953 const Default$8 = { 8954 className: 'modal-backdrop', 8955 clickCallback: null, 8956 isAnimated: false, 8957 isVisible: true, 8958 // if false, we use the backdrop helper without adding any element to the dom 8959 rootElement: 'body' // give the choice to place backdrop under different elements 8960 };
vendor: 3,192 bytes, lines 8961-9085
8961 8962 const DefaultType$8 = { 8963 className: 'string', 8964 clickCallback: '(function|null)', 8965 isAnimated: 'boolean', 8966 isVisible: 'boolean', 8967 rootElement: '(element|string)' 8968 }; 8969 8970 /** 8971 * Class definition 8972 */ 8973 8974 class Backdrop extends Config { 8975 constructor(config) { 8976 super(); 8977 this._config = this._getConfig(config); 8978 this._isAppended = false; 8979 this._element = null; 8980 } 8981 8982 // Getters 8983 static get Default() { 8984 return Default$8; 8985 } 8986 static get DefaultType() { 8987 return DefaultType$8; 8988 } 8989 static get NAME() { 8990 return NAME$9; 8991 } 8992 8993 // Public 8994 show(callback) { 8995 if (!this._config.isVisible) { 8996 execute(callback); 8997 return; 8998 } 8999 this._append(); 9000 const element = this._getElement(); 9001 if (this._config.isAnimated) { 9002 reflow(element); 9003 } 9004 element.classList.add(CLASS_NAME_SHOW$5); 9005 this._emulateAnimation(() => { 9006 execute(callback); 9007 }); 9008 } 9009 hide(callback) { 9010 if (!this._config.isVisible) { 9011 execute(callback); 9012 return; 9013 } 9014 this._getElement().classList.remove(CLASS_NAME_SHOW$5); 9015 this._emulateAnimation(() => { 9016 this.dispose(); 9017 execute(callback); 9018 }); 9019 } 9020 dispose() { 9021 if (!this._isAppended) { 9022 return; 9023 } 9024 EventHandler.off(this._element, EVENT_MOUSEDOWN); 9025 this._element.remove(); 9026 this._isAppended = false; 9027 } 9028 9029 // Private 9030 _getElement() { 9031 if (!this._element) { 9032 const backdrop = document.createElement('div'); 9033 backdrop.className = this._config.className; 9034 if (this._config.isAnimated) { 9035 backdrop.classList.add(CLASS_NAME_FADE$4); 9036 } 9037 this._element = backdrop; 9038 } 9039 return this._element; 9040 } 9041 _configAfterMerge(config) { 9042 // use getElement() with the default "body" to get a fresh Element on each instantiation 9043 config.rootElement = getElement(config.rootElement); 9044 return config; 9045 } 9046 _append() { 9047 if (this._isAppended) { 9048 return; 9049 } 9050 const element = this._getElement(); 9051 this._config.rootElement.append(element); 9052 EventHandler.on(element, EVENT_MOUSEDOWN, () => { 9053 execute(this._config.clickCallback); 9054 }); 9055 this._isAppended = true; 9056 } 9057 _emulateAnimation(callback) { 9058 executeAfterTransition(callback, this._getElement(), this._config.isAnimated); 9059 } 9060 } 9061 9062 /** 9063 * -------------------------------------------------------------------------- 9064 * Bootstrap util/focustrap.js 9065 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 9066 * -------------------------------------------------------------------------- 9067 */ 9068 9069 9070 /** 9071 * Constants 9072 */ 9073 9074 const NAME$8 = 'focustrap'; 9075 const DATA_KEY$5 = 'bs.focustrap'; 9076 const EVENT_KEY$5 = `.${DATA_KEY$5}`; 9077 const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`; 9078 const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`; 9079 const TAB_KEY = 'Tab'; 9080 const TAB_NAV_FORWARD = 'forward'; 9081 const TAB_NAV_BACKWARD = 'backward'; 9082 const Default$7 = { 9083 autofocus: true, 9084 trapElement: null // The element to trap focus inside of 9085 };
vendor: 6,117 bytes, lines 9086-9275
9086 9087 const DefaultType$7 = { 9088 autofocus: 'boolean', 9089 trapElement: 'element' 9090 }; 9091 9092 /** 9093 * Class definition 9094 */ 9095 9096 class FocusTrap extends Config { 9097 constructor(config) { 9098 super(); 9099 this._config = this._getConfig(config); 9100 this._isActive = false; 9101 this._lastTabNavDirection = null; 9102 } 9103 9104 // Getters 9105 static get Default() { 9106 return Default$7; 9107 } 9108 static get DefaultType() { 9109 return DefaultType$7; 9110 } 9111 static get NAME() { 9112 return NAME$8; 9113 } 9114 9115 // Public 9116 activate() { 9117 if (this._isActive) { 9118 return; 9119 } 9120 if (this._config.autofocus) { 9121 this._config.trapElement.focus(); 9122 } 9123 EventHandler.off(document, EVENT_KEY$5); // guard against infinite focus loop 9124 EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event)); 9125 EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event)); 9126 this._isActive = true; 9127 } 9128 deactivate() { 9129 if (!this._isActive) { 9130 return; 9131 } 9132 this._isActive = false; 9133 EventHandler.off(document, EVENT_KEY$5); 9134 } 9135 9136 // Private 9137 _handleFocusin(event) { 9138 const { 9139 trapElement 9140 } = this._config; 9141 if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) { 9142 return; 9143 } 9144 const elements = SelectorEngine.focusableChildren(trapElement); 9145 if (elements.length === 0) { 9146 trapElement.focus(); 9147 } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { 9148 elements[elements.length - 1].focus(); 9149 } else { 9150 elements[0].focus(); 9151 } 9152 } 9153 _handleKeydown(event) { 9154 if (event.key !== TAB_KEY) { 9155 return; 9156 } 9157 this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; 9158 } 9159 } 9160 9161 /** 9162 * -------------------------------------------------------------------------- 9163 * Bootstrap util/scrollBar.js 9164 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 9165 * -------------------------------------------------------------------------- 9166 */ 9167 9168 9169 /** 9170 * Constants 9171 */ 9172 9173 const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 9174 const SELECTOR_STICKY_CONTENT = '.sticky-top'; 9175 const PROPERTY_PADDING = 'padding-right'; 9176 const PROPERTY_MARGIN = 'margin-right'; 9177 9178 /** 9179 * Class definition 9180 */ 9181 9182 class ScrollBarHelper { 9183 constructor() { 9184 this._element = document.body; 9185 } 9186 9187 // Public 9188 getWidth() { 9189 // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes 9190 const documentWidth = document.documentElement.clientWidth; 9191 return Math.abs(window.innerWidth - documentWidth); 9192 } 9193 hide() { 9194 const width = this.getWidth(); 9195 this._disableOverFlow(); 9196 // give padding to element to balance the hidden scrollbar width 9197 this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width); 9198 // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth 9199 this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width); 9200 this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width); 9201 } 9202 reset() { 9203 this._resetElementAttributes(this._element, 'overflow'); 9204 this._resetElementAttributes(this._element, PROPERTY_PADDING); 9205 this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING); 9206 this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN); 9207 } 9208 isOverflowing() { 9209 return this.getWidth() > 0; 9210 } 9211 9212 // Private 9213 _disableOverFlow() { 9214 this._saveInitialAttribute(this._element, 'overflow'); 9215 this._element.style.overflow = 'hidden'; 9216 } 9217 _setElementAttributes(selector, styleProperty, callback) { 9218 const scrollbarWidth = this.getWidth(); 9219 const manipulationCallBack = element => { 9220 if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { 9221 return; 9222 } 9223 this._saveInitialAttribute(element, styleProperty); 9224 const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty); 9225 element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`); 9226 }; 9227 this._applyManipulationCallback(selector, manipulationCallBack); 9228 } 9229 _saveInitialAttribute(element, styleProperty) { 9230 const actualValue = element.style.getPropertyValue(styleProperty); 9231 if (actualValue) { 9232 Manipulator.setDataAttribute(element, styleProperty, actualValue); 9233 } 9234 } 9235 _resetElementAttributes(selector, styleProperty) { 9236 const manipulationCallBack = element => { 9237 const value = Manipulator.getDataAttribute(element, styleProperty); 9238 // We only want to remove the property if the value is `null`; the value can also be zero 9239 if (value === null) { 9240 element.style.removeProperty(styleProperty); 9241 return; 9242 } 9243 Manipulator.removeDataAttribute(element, styleProperty); 9244 element.style.setProperty(styleProperty, value); 9245 }; 9246 this._applyManipulationCallback(selector, manipulationCallBack); 9247 } 9248 _applyManipulationCallback(selector, callBack) { 9249 if (isElement$1(selector)) { 9250 callBack(selector); 9251 return; 9252 } 9253 for (const sel of SelectorEngine.find(selector, this._element)) { 9254 callBack(sel); 9255 } 9256 } 9257 } 9258 9259 /** 9260 * -------------------------------------------------------------------------- 9261 * Bootstrap modal.js 9262 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 9263 * -------------------------------------------------------------------------- 9264 */ 9265 9266 9267 /** 9268 * Constants 9269 */ 9270 9271 const NAME$7 = 'modal'; 9272 const DATA_KEY$4 = 'bs.modal'; 9273 const EVENT_KEY$4 = `.${DATA_KEY$4}`; 9274 const DATA_API_KEY$2 = '.data-api'; 9275 const ESCAPE_KEY$1 = 'Escape';
vendor: 16,991 bytes, lines 9276-9813
9276 const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`; 9277 const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`; 9278 const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`; 9279 const EVENT_SHOW$4 = `show${EVENT_KEY$4}`; 9280 const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`; 9281 const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`; 9282 const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`; 9283 const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`; 9284 const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`; 9285 const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`; 9286 const CLASS_NAME_OPEN = 'modal-open'; 9287 const CLASS_NAME_FADE$3 = 'fade'; 9288 const CLASS_NAME_SHOW$4 = 'show'; 9289 const CLASS_NAME_STATIC = 'modal-static'; 9290 const OPEN_SELECTOR$1 = '.modal.show'; 9291 const SELECTOR_DIALOG = '.modal-dialog'; 9292 const SELECTOR_MODAL_BODY = '.modal-body'; 9293 const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; 9294 const Default$6 = { 9295 backdrop: true, 9296 focus: true, 9297 keyboard: true 9298 }; 9299 const DefaultType$6 = { 9300 backdrop: '(boolean|string)', 9301 focus: 'boolean', 9302 keyboard: 'boolean' 9303 }; 9304 9305 /** 9306 * Class definition 9307 */ 9308 9309 class Modal extends BaseComponent { 9310 constructor(element, config) { 9311 super(element, config); 9312 this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); 9313 this._backdrop = this._initializeBackDrop(); 9314 this._focustrap = this._initializeFocusTrap(); 9315 this._isShown = false; 9316 this._isTransitioning = false; 9317 this._scrollBar = new ScrollBarHelper(); 9318 this._addEventListeners(); 9319 } 9320 9321 // Getters 9322 static get Default() { 9323 return Default$6; 9324 } 9325 static get DefaultType() { 9326 return DefaultType$6; 9327 } 9328 static get NAME() { 9329 return NAME$7; 9330 } 9331 9332 // Public 9333 toggle(relatedTarget) { 9334 return this._isShown ? this.hide() : this.show(relatedTarget); 9335 } 9336 show(relatedTarget) { 9337 if (this._isShown || this._isTransitioning) { 9338 return; 9339 } 9340 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, { 9341 relatedTarget 9342 }); 9343 if (showEvent.defaultPrevented) { 9344 return; 9345 } 9346 this._isShown = true; 9347 this._isTransitioning = true; 9348 this._scrollBar.hide(); 9349 document.body.classList.add(CLASS_NAME_OPEN); 9350 this._adjustDialog(); 9351 this._backdrop.show(() => this._showElement(relatedTarget)); 9352 } 9353 hide() { 9354 if (!this._isShown || this._isTransitioning) { 9355 return; 9356 } 9357 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4); 9358 if (hideEvent.defaultPrevented) { 9359 return; 9360 } 9361 this._isShown = false; 9362 this._isTransitioning = true; 9363 this._focustrap.deactivate(); 9364 this._element.classList.remove(CLASS_NAME_SHOW$4); 9365 this._queueCallback(() => this._hideModal(), this._element, this._isAnimated()); 9366 } 9367 dispose() { 9368 EventHandler.off(window, EVENT_KEY$4); 9369 EventHandler.off(this._dialog, EVENT_KEY$4); 9370 this._backdrop.dispose(); 9371 this._focustrap.deactivate(); 9372 super.dispose(); 9373 } 9374 handleUpdate() { 9375 this._adjustDialog(); 9376 } 9377 9378 // Private 9379 _initializeBackDrop() { 9380 return new Backdrop({ 9381 isVisible: Boolean(this._config.backdrop), 9382 // 'static' option will be translated to true, and booleans will keep their value, 9383 isAnimated: this._isAnimated() 9384 }); 9385 } 9386 _initializeFocusTrap() { 9387 return new FocusTrap({ 9388 trapElement: this._element 9389 }); 9390 } 9391 _showElement(relatedTarget) { 9392 // try to append dynamic modal 9393 if (!document.body.contains(this._element)) { 9394 document.body.append(this._element); 9395 } 9396 this._element.style.display = 'block'; 9397 this._element.removeAttribute('aria-hidden'); 9398 this._element.setAttribute('aria-modal', true); 9399 this._element.setAttribute('role', 'dialog'); 9400 this._element.scrollTop = 0; 9401 const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); 9402 if (modalBody) { 9403 modalBody.scrollTop = 0; 9404 } 9405 reflow(this._element); 9406 this._element.classList.add(CLASS_NAME_SHOW$4); 9407 const transitionComplete = () => { 9408 if (this._config.focus) { 9409 this._focustrap.activate(); 9410 } 9411 this._isTransitioning = false; 9412 EventHandler.trigger(this._element, EVENT_SHOWN$4, { 9413 relatedTarget 9414 }); 9415 }; 9416 this._queueCallback(transitionComplete, this._dialog, this._isAnimated()); 9417 } 9418 _addEventListeners() { 9419 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => { 9420 if (event.key !== ESCAPE_KEY$1) { 9421 return; 9422 } 9423 if (this._config.keyboard) { 9424 this.hide(); 9425 return; 9426 } 9427 this._triggerBackdropTransition(); 9428 }); 9429 EventHandler.on(window, EVENT_RESIZE$1, () => { 9430 if (this._isShown && !this._isTransitioning) { 9431 this._adjustDialog(); 9432 } 9433 }); 9434 EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => { 9435 // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks 9436 EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => { 9437 if (this._element !== event.target || this._element !== event2.target) { 9438 return; 9439 } 9440 if (this._config.backdrop === 'static') { 9441 this._triggerBackdropTransition(); 9442 return; 9443 } 9444 if (this._config.backdrop) { 9445 this.hide(); 9446 } 9447 }); 9448 }); 9449 } 9450 _hideModal() { 9451 this._element.style.display = 'none'; 9452 this._element.setAttribute('aria-hidden', true); 9453 this._element.removeAttribute('aria-modal'); 9454 this._element.removeAttribute('role'); 9455 this._isTransitioning = false; 9456 this._backdrop.hide(() => { 9457 document.body.classList.remove(CLASS_NAME_OPEN); 9458 this._resetAdjustments(); 9459 this._scrollBar.reset(); 9460 EventHandler.trigger(this._element, EVENT_HIDDEN$4); 9461 }); 9462 } 9463 _isAnimated() { 9464 return this._element.classList.contains(CLASS_NAME_FADE$3); 9465 } 9466 _triggerBackdropTransition() { 9467 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1); 9468 if (hideEvent.defaultPrevented) { 9469 return; 9470 } 9471 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 9472 const initialOverflowY = this._element.style.overflowY; 9473 // return if the following background transition hasn't yet completed 9474 if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) { 9475 return; 9476 } 9477 if (!isModalOverflowing) { 9478 this._element.style.overflowY = 'hidden'; 9479 } 9480 this._element.classList.add(CLASS_NAME_STATIC); 9481 this._queueCallback(() => { 9482 this._element.classList.remove(CLASS_NAME_STATIC); 9483 this._queueCallback(() => { 9484 this._element.style.overflowY = initialOverflowY; 9485 }, this._dialog); 9486 }, this._dialog); 9487 this._element.focus(); 9488 } 9489 9490 /** 9491 * The following methods are used to handle overflowing modals 9492 */ 9493 9494 _adjustDialog() { 9495 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 9496 const scrollbarWidth = this._scrollBar.getWidth(); 9497 const isBodyOverflowing = scrollbarWidth > 0; 9498 if (isBodyOverflowing && !isModalOverflowing) { 9499 const property = isRTL() ? 'paddingLeft' : 'paddingRight'; 9500 this._element.style[property] = `${scrollbarWidth}px`; 9501 } 9502 if (!isBodyOverflowing && isModalOverflowing) { 9503 const property = isRTL() ? 'paddingRight' : 'paddingLeft'; 9504 this._element.style[property] = `${scrollbarWidth}px`; 9505 } 9506 } 9507 _resetAdjustments() { 9508 this._element.style.paddingLeft = ''; 9509 this._element.style.paddingRight = ''; 9510 } 9511 9512 // Static 9513 static jQueryInterface(config, relatedTarget) { 9514 return this.each(function () { 9515 const data = Modal.getOrCreateInstance(this, config); 9516 if (typeof config !== 'string') { 9517 return; 9518 } 9519 if (typeof data[config] === 'undefined') { 9520 throw new TypeError(`No method named "${config}"`); 9521 } 9522 data[config](relatedTarget); 9523 }); 9524 } 9525 } 9526 9527 /** 9528 * Data API implementation 9529 */ 9530 9531 EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 9532 const target = SelectorEngine.getElementFromSelector(this); 9533 if (['A', 'AREA'].includes(this.tagName)) { 9534 event.preventDefault(); 9535 } 9536 EventHandler.one(target, EVENT_SHOW$4, showEvent => { 9537 if (showEvent.defaultPrevented) { 9538 // only register focus restorer if modal will actually get shown 9539 return; 9540 } 9541 EventHandler.one(target, EVENT_HIDDEN$4, () => { 9542 if (isVisible(this)) { 9543 this.focus(); 9544 } 9545 }); 9546 }); 9547 9548 // avoid conflict when clicking modal toggler while another one is open 9549 const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1); 9550 if (alreadyOpen) { 9551 Modal.getInstance(alreadyOpen).hide(); 9552 } 9553 const data = Modal.getOrCreateInstance(target); 9554 data.toggle(this); 9555 }); 9556 enableDismissTrigger(Modal); 9557 9558 /** 9559 * jQuery 9560 */ 9561 9562 defineJQueryPlugin(Modal); 9563 9564 /** 9565 * -------------------------------------------------------------------------- 9566 * Bootstrap offcanvas.js 9567 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 9568 * -------------------------------------------------------------------------- 9569 */ 9570 9571 9572 /** 9573 * Constants 9574 */ 9575 9576 const NAME$6 = 'offcanvas'; 9577 const DATA_KEY$3 = 'bs.offcanvas'; 9578 const EVENT_KEY$3 = `.${DATA_KEY$3}`; 9579 const DATA_API_KEY$1 = '.data-api'; 9580 const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`; 9581 const ESCAPE_KEY = 'Escape'; 9582 const CLASS_NAME_SHOW$3 = 'show'; 9583 const CLASS_NAME_SHOWING$1 = 'showing'; 9584 const CLASS_NAME_HIDING = 'hiding'; 9585 const CLASS_NAME_BACKDROP = 'offcanvas-backdrop'; 9586 const OPEN_SELECTOR = '.offcanvas.show'; 9587 const EVENT_SHOW$3 = `show${EVENT_KEY$3}`; 9588 const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`; 9589 const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`; 9590 const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`; 9591 const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`; 9592 const EVENT_RESIZE = `resize${EVENT_KEY$3}`; 9593 const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`; 9594 const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`; 9595 const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; 9596 const Default$5 = { 9597 backdrop: true, 9598 keyboard: true, 9599 scroll: false 9600 }; 9601 const DefaultType$5 = { 9602 backdrop: '(boolean|string)', 9603 keyboard: 'boolean', 9604 scroll: 'boolean' 9605 }; 9606 9607 /** 9608 * Class definition 9609 */ 9610 9611 class Offcanvas extends BaseComponent { 9612 constructor(element, config) { 9613 super(element, config); 9614 this._isShown = false; 9615 this._backdrop = this._initializeBackDrop(); 9616 this._focustrap = this._initializeFocusTrap(); 9617 this._addEventListeners(); 9618 } 9619 9620 // Getters 9621 static get Default() { 9622 return Default$5; 9623 } 9624 static get DefaultType() { 9625 return DefaultType$5; 9626 } 9627 static get NAME() { 9628 return NAME$6; 9629 } 9630 9631 // Public 9632 toggle(relatedTarget) { 9633 return this._isShown ? this.hide() : this.show(relatedTarget); 9634 } 9635 show(relatedTarget) { 9636 if (this._isShown) { 9637 return; 9638 } 9639 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { 9640 relatedTarget 9641 }); 9642 if (showEvent.defaultPrevented) { 9643 return; 9644 } 9645 this._isShown = true; 9646 this._backdrop.show(); 9647 if (!this._config.scroll) { 9648 new ScrollBarHelper().hide(); 9649 } 9650 this._element.setAttribute('aria-modal', true); 9651 this._element.setAttribute('role', 'dialog'); 9652 this._element.classList.add(CLASS_NAME_SHOWING$1); 9653 const completeCallBack = () => { 9654 if (!this._config.scroll || this._config.backdrop) { 9655 this._focustrap.activate(); 9656 } 9657 this._element.classList.add(CLASS_NAME_SHOW$3); 9658 this._element.classList.remove(CLASS_NAME_SHOWING$1); 9659 EventHandler.trigger(this._element, EVENT_SHOWN$3, { 9660 relatedTarget 9661 }); 9662 }; 9663 this._queueCallback(completeCallBack, this._element, true); 9664 } 9665 hide() { 9666 if (!this._isShown) { 9667 return; 9668 } 9669 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); 9670 if (hideEvent.defaultPrevented) { 9671 return; 9672 } 9673 this._focustrap.deactivate(); 9674 this._element.blur(); 9675 this._isShown = false; 9676 this._element.classList.add(CLASS_NAME_HIDING); 9677 this._backdrop.hide(); 9678 const completeCallback = () => { 9679 this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING); 9680 this._element.removeAttribute('aria-modal'); 9681 this._element.removeAttribute('role'); 9682 if (!this._config.scroll) { 9683 new ScrollBarHelper().reset(); 9684 } 9685 EventHandler.trigger(this._element, EVENT_HIDDEN$3); 9686 }; 9687 this._queueCallback(completeCallback, this._element, true); 9688 } 9689 dispose() { 9690 this._backdrop.dispose(); 9691 this._focustrap.deactivate(); 9692 super.dispose(); 9693 } 9694 9695 // Private 9696 _initializeBackDrop() { 9697 const clickCallback = () => { 9698 if (this._config.backdrop === 'static') { 9699 EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 9700 return; 9701 } 9702 this.hide(); 9703 }; 9704 9705 // 'static' option will be translated to true, and booleans will keep their value 9706 const isVisible = Boolean(this._config.backdrop); 9707 return new Backdrop({ 9708 className: CLASS_NAME_BACKDROP, 9709 isVisible, 9710 isAnimated: true, 9711 rootElement: this._element.parentNode, 9712 clickCallback: isVisible ? clickCallback : null 9713 }); 9714 } 9715 _initializeFocusTrap() { 9716 return new FocusTrap({ 9717 trapElement: this._element 9718 }); 9719 } 9720 _addEventListeners() { 9721 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { 9722 if (event.key !== ESCAPE_KEY) { 9723 return; 9724 } 9725 if (this._config.keyboard) { 9726 this.hide(); 9727 return; 9728 } 9729 EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 9730 }); 9731 } 9732 9733 // Static 9734 static jQueryInterface(config) { 9735 return this.each(function () { 9736 const data = Offcanvas.getOrCreateInstance(this, config); 9737 if (typeof config !== 'string') { 9738 return; 9739 } 9740 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 9741 throw new TypeError(`No method named "${config}"`); 9742 } 9743 data[config](this); 9744 }); 9745 } 9746 } 9747 9748 /** 9749 * Data API implementation 9750 */ 9751 9752 EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 9753 const target = SelectorEngine.getElementFromSelector(this); 9754 if (['A', 'AREA'].includes(this.tagName)) { 9755 event.preventDefault(); 9756 } 9757 if (isDisabled(this)) { 9758 return; 9759 } 9760 EventHandler.one(target, EVENT_HIDDEN$3, () => { 9761 // focus on trigger when it is closed 9762 if (isVisible(this)) { 9763 this.focus(); 9764 } 9765 }); 9766 9767 // avoid conflict when clicking a toggler of an offcanvas, while another is open 9768 const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); 9769 if (alreadyOpen && alreadyOpen !== target) { 9770 Offcanvas.getInstance(alreadyOpen).hide(); 9771 } 9772 const data = Offcanvas.getOrCreateInstance(target); 9773 data.toggle(this); 9774 }); 9775 EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => { 9776 for (const selector of SelectorEngine.find(OPEN_SELECTOR)) { 9777 Offcanvas.getOrCreateInstance(selector).show(); 9778 } 9779 }); 9780 EventHandler.on(window, EVENT_RESIZE, () => { 9781 for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) { 9782 if (getComputedStyle(element).position !== 'fixed') { 9783 Offcanvas.getOrCreateInstance(element).hide(); 9784 } 9785 } 9786 }); 9787 enableDismissTrigger(Offcanvas); 9788 9789 /** 9790 * jQuery 9791 */ 9792 9793 defineJQueryPlugin(Offcanvas); 9794 9795 /** 9796 * -------------------------------------------------------------------------- 9797 * Bootstrap util/sanitizer.js 9798 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 9799 * -------------------------------------------------------------------------- 9800 */ 9801 9802 // js-docs-start allow-list 9803 const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 9804 const DefaultAllowlist = { 9805 // Global attributes allowed on any supplied element below. 9806 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 9807 a: ['target', 'href', 'title', 'rel'], 9808 area: [], 9809 b: [], 9810 br: [], 9811 col: [], 9812 code: [], 9813 d
vendor: 6,570 bytes, lines 9813-10038
9813iv: [], 9814 em: [], 9815 hr: [], 9816 h1: [], 9817 h2: [], 9818 h3: [], 9819 h4: [], 9820 h5: [], 9821 h6: [], 9822 i: [], 9823 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 9824 li: [], 9825 ol: [], 9826 p: [], 9827 pre: [], 9828 s: [], 9829 small: [], 9830 span: [], 9831 sub: [], 9832 sup: [], 9833 strong: [], 9834 u: [], 9835 ul: [] 9836 }; 9837 // js-docs-end allow-list 9838 9839 const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); 9840 9841 /** 9842 * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation 9843 * contexts. 9844 * 9845 * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38 9846 */ 9847 // eslint-disable-next-line unicorn/better-regex 9848 const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i; 9849 const allowedAttribute = (attribute, allowedAttributeList) => { 9850 const attributeName = attribute.nodeName.toLowerCase(); 9851 if (allowedAttributeList.includes(attributeName)) { 9852 if (uriAttributes.has(attributeName)) { 9853 return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue)); 9854 } 9855 return true; 9856 } 9857 9858 // Check if a regular expression validates the attribute. 9859 return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName)); 9860 }; 9861 function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) { 9862 if (!unsafeHtml.length) { 9863 return unsafeHtml; 9864 } 9865 if (sanitizeFunction && typeof sanitizeFunction === 'function') { 9866 return sanitizeFunction(unsafeHtml); 9867 } 9868 const domParser = new window.DOMParser(); 9869 const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 9870 const elements = [].concat(...createdDocument.body.querySelectorAll('*')); 9871 for (const element of elements) { 9872 const elementName = element.nodeName.toLowerCase(); 9873 if (!Object.keys(allowList).includes(elementName)) { 9874 element.remove(); 9875 continue; 9876 } 9877 const attributeList = [].concat(...element.attributes); 9878 const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); 9879 for (const attribute of attributeList) { 9880 if (!allowedAttribute(attribute, allowedAttributes)) { 9881 element.removeAttribute(attribute.nodeName); 9882 } 9883 } 9884 } 9885 return createdDocument.body.innerHTML; 9886 } 9887 9888 /** 9889 * -------------------------------------------------------------------------- 9890 * Bootstrap util/template-factory.js 9891 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 9892 * -------------------------------------------------------------------------- 9893 */ 9894 9895 9896 /** 9897 * Constants 9898 */ 9899 9900 const NAME$5 = 'TemplateFactory'; 9901 const Default$4 = { 9902 allowList: DefaultAllowlist, 9903 content: {}, 9904 // { selector : text , selector2 : text2 , } 9905 extraClass: '', 9906 html: false, 9907 sanitize: true, 9908 sanitizeFn: null, 9909 template: '<div></div>' 9910 }; 9911 const DefaultType$4 = { 9912 allowList: 'object', 9913 content: 'object', 9914 extraClass: '(string|function)', 9915 html: 'boolean', 9916 sanitize: 'boolean', 9917 sanitizeFn: '(null|function)', 9918 template: 'string' 9919 }; 9920 const DefaultContentType = { 9921 entry: '(string|element|function|null)', 9922 selector: '(string|element)' 9923 }; 9924 9925 /** 9926 * Class definition 9927 */ 9928 9929 class TemplateFactory extends Config { 9930 constructor(config) { 9931 super(); 9932 this._config = this._getConfig(config); 9933 } 9934 9935 // Getters 9936 static get Default() { 9937 return Default$4; 9938 } 9939 static get DefaultType() { 9940 return DefaultType$4; 9941 } 9942 static get NAME() { 9943 return NAME$5; 9944 } 9945 9946 // Public 9947 getContent() { 9948 return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean); 9949 } 9950 hasContent() { 9951 return this.getContent().length > 0; 9952 } 9953 changeContent(content) { 9954 this._checkContent(content); 9955 this._config.content = { 9956 ...this._config.content, 9957 ...content 9958 }; 9959 return this; 9960 } 9961 toHtml() { 9962 const templateWrapper = document.createElement('div'); 9963 templateWrapper.innerHTML = this._maybeSanitize(this._config.template); 9964 for (const [selector, text] of Object.entries(this._config.content)) { 9965 this._setContent(templateWrapper, text, selector); 9966 } 9967 const template = templateWrapper.children[0]; 9968 const extraClass = this._resolvePossibleFunction(this._config.extraClass); 9969 if (extraClass) { 9970 template.classList.add(...extraClass.split(' ')); 9971 } 9972 return template; 9973 } 9974 9975 // Private 9976 _typeCheckConfig(config) { 9977 super._typeCheckConfig(config); 9978 this._checkContent(config.content); 9979 } 9980 _checkContent(arg) { 9981 for (const [selector, content] of Object.entries(arg)) { 9982 super._typeCheckConfig({ 9983 selector, 9984 entry: content 9985 }, DefaultContentType); 9986 } 9987 } 9988 _setContent(template, content, selector) { 9989 const templateElement = SelectorEngine.findOne(selector, template); 9990 if (!templateElement) { 9991 return; 9992 } 9993 content = this._resolvePossibleFunction(content); 9994 if (!content) { 9995 templateElement.remove(); 9996 return; 9997 } 9998 if (isElement$1(content)) { 9999 this._putElementInTemplate(getElement(content), templateElement); 10000 return; 10001 } 10002 if (this._config.html) { 10003 templateElement.innerHTML = this._maybeSanitize(content); 10004 return; 10005 } 10006 templateElement.textContent = content; 10007 } 10008 _maybeSanitize(arg) { 10009 return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg; 10010 } 10011 _resolvePossibleFunction(arg) { 10012 return execute(arg, [this]); 10013 } 10014 _putElementInTemplate(element, templateElement) { 10015 if (this._config.html) { 10016 templateElement.innerHTML = ''; 10017 templateElement.append(element); 10018 return; 10019 } 10020 templateElement.textContent = element.textContent; 10021 } 10022 } 10023 10024 /** 10025 * -------------------------------------------------------------------------- 10026 * Bootstrap tooltip.js 10027 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 10028 * -------------------------------------------------------------------------- 10029 */ 10030 10031 10032 /** 10033 * Constants 10034 */ 10035 10036 const NAME$4 = 'tooltip'; 10037 const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); 10038 const CLASS_NAME_FADE$2 = 'fade';
vendor: 3,180 bytes, lines 10039-10157
10039 const CLASS_NAME_MODAL = 'modal'; 10040 const CLASS_NAME_SHOW$2 = 'show'; 10041 const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 10042 const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; 10043 const EVENT_MODAL_HIDE = 'hide.bs.modal'; 10044 const TRIGGER_HOVER = 'hover'; 10045 const TRIGGER_FOCUS = 'focus'; 10046 const TRIGGER_CLICK = 'click'; 10047 const TRIGGER_MANUAL = 'manual'; 10048 const EVENT_HIDE$2 = 'hide'; 10049 const EVENT_HIDDEN$2 = 'hidden'; 10050 const EVENT_SHOW$2 = 'show'; 10051 const EVENT_SHOWN$2 = 'shown'; 10052 const EVENT_INSERTED = 'inserted'; 10053 const EVENT_CLICK$1 = 'click'; 10054 const EVENT_FOCUSIN$1 = 'focusin'; 10055 const EVENT_FOCUSOUT$1 = 'focusout'; 10056 const EVENT_MOUSEENTER = 'mouseenter'; 10057 const EVENT_MOUSELEAVE = 'mouseleave'; 10058 const AttachmentMap = { 10059 AUTO: 'auto', 10060 TOP: 'top', 10061 RIGHT: isRTL() ? 'left' : 'right', 10062 BOTTOM: 'bottom', 10063 LEFT: isRTL() ? 'right' : 'left' 10064 }; 10065 const Default$3 = { 10066 allowList: DefaultAllowlist, 10067 animation: true, 10068 boundary: 'clippingParents', 10069 container: false, 10070 customClass: '', 10071 delay: 0, 10072 fallbackPlacements: ['top', 'right', 'bottom', 'left'], 10073 html: false, 10074 offset: [0, 6], 10075 placement: 'top', 10076 popperConfig: null, 10077 sanitize: true, 10078 sanitizeFn: null, 10079 selector: false, 10080 template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', 10081 title: '', 10082 trigger: 'hover focus' 10083 }; 10084 const DefaultType$3 = { 10085 allowList: 'object', 10086 animation: 'boolean', 10087 boundary: '(string|element)', 10088 container: '(string|element|boolean)', 10089 customClass: '(string|function)', 10090 delay: '(number|object)', 10091 fallbackPlacements: 'array', 10092 html: 'boolean', 10093 offset: '(array|string|function)', 10094 placement: '(string|function)', 10095 popperConfig: '(null|object|function)', 10096 sanitize: 'boolean', 10097 sanitizeFn: '(null|function)', 10098 selector: '(string|boolean)', 10099 template: 'string', 10100 title: '(string|element|function)', 10101 trigger: 'string' 10102 }; 10103 10104 /** 10105 * Class definition 10106 */ 10107 10108 class Tooltip extends BaseComponent { 10109 constructor(element, config) { 10110 if (typeof Popper === 'undefined') { 10111 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 10112 } 10113 super(element, config); 10114 10115 // Private 10116 this._isEnabled = true; 10117 this._timeout = 0; 10118 this._isHovered = null; 10119 this._activeTrigger = {}; 10120 this._popper = null; 10121 this._templateFactory = null; 10122 this._newContent = null; 10123 10124 // Protected 10125 this.tip = null; 10126 this._setListeners(); 10127 if (!this._config.selector) { 10128 this._fixTitle(); 10129 } 10130 } 10131 10132 // Getters 10133 static get Default() { 10134 return Default$3; 10135 } 10136 static get DefaultType() { 10137 return DefaultType$3; 10138 } 10139 static get NAME() { 10140 return NAME$4; 10141 } 10142 10143 // Public 10144 enable() { 10145 this._isEnabled = true; 10146 } 10147 disable() { 10148 this._isEnabled = false; 10149 } 10150 toggleEnabled() { 10151 this._isEnabled = !this._isEnabled; 10152 } 10153 toggle() { 10154 if (!this._isEnabled) { 10155 return; 10156 } 10157 this._activeTrigger.click = !this._activeTrigger.click;
vendor: 6,078 bytes, lines 10157-10330
10157 10158 if (this._isShown()) { 10159 this._leave(); 10160 return; 10161 } 10162 this._enter(); 10163 } 10164 dispose() { 10165 clearTimeout(this._timeout); 10166 EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 10167 if (this._element.getAttribute('data-bs-original-title')) { 10168 this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title')); 10169 } 10170 this._disposePopper(); 10171 super.dispose(); 10172 } 10173 show() { 10174 if (this._element.style.display === 'none') { 10175 throw new Error('Please use show on visible elements'); 10176 } 10177 if (!(this._isWithContent() && this._isEnabled)) { 10178 return; 10179 } 10180 const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2)); 10181 const shadowRoot = findShadowRoot(this._element); 10182 const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element); 10183 if (showEvent.defaultPrevented || !isInTheDom) { 10184 return; 10185 } 10186 10187 // TODO: v6 remove this or make it optional 10188 this._disposePopper(); 10189 const tip = this._getTipElement(); 10190 this._element.setAttribute('aria-describedby', tip.getAttribute('id')); 10191 const { 10192 container 10193 } = this._config; 10194 if (!this._element.ownerDocument.documentElement.contains(this.tip)) { 10195 container.append(tip); 10196 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED)); 10197 } 10198 this._popper = this._createPopper(tip); 10199 tip.classList.add(CLASS_NAME_SHOW$2); 10200 10201 // If this is a touch-enabled device we add extra 10202 // empty mouseover listeners to the body's immediate children; 10203 // only needed because of broken event delegation on iOS 10204 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 10205 if ('ontouchstart' in document.documentElement) { 10206 for (const element of [].concat(...document.body.children)) { 10207 EventHandler.on(element, 'mouseover', noop); 10208 } 10209 } 10210 const complete = () => { 10211 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2)); 10212 if (this._isHovered === false) { 10213 this._leave(); 10214 } 10215 this._isHovered = false; 10216 }; 10217 this._queueCallback(complete, this.tip, this._isAnimated()); 10218 } 10219 hide() { 10220 if (!this._isShown()) { 10221 return; 10222 } 10223 const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2)); 10224 if (hideEvent.defaultPrevented) { 10225 return; 10226 } 10227 const tip = this._getTipElement(); 10228 tip.classList.remove(CLASS_NAME_SHOW$2); 10229 10230 // If this is a touch-enabled device we remove the extra 10231 // empty mouseover listeners we added for iOS support 10232 if ('ontouchstart' in document.documentElement) { 10233 for (const element of [].concat(...document.body.children)) { 10234 EventHandler.off(element, 'mouseover', noop); 10235 } 10236 } 10237 this._activeTrigger[TRIGGER_CLICK] = false; 10238 this._activeTrigger[TRIGGER_FOCUS] = false; 10239 this._activeTrigger[TRIGGER_HOVER] = false; 10240 this._isHovered = null; // it is a trick to support manual triggering 10241 10242 const complete = () => { 10243 if (this._isWithActiveTrigger()) { 10244 return; 10245 } 10246 if (!this._isHovered) { 10247 this._disposePopper(); 10248 } 10249 this._element.removeAttribute('aria-describedby'); 10250 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2)); 10251 }; 10252 this._queueCallback(complete, this.tip, this._isAnimated()); 10253 } 10254 update() { 10255 if (this._popper) { 10256 this._popper.update(); 10257 } 10258 } 10259 10260 // Protected 10261 _isWithContent() { 10262 return Boolean(this._getTitle()); 10263 } 10264 _getTipElement() { 10265 if (!this.tip) { 10266 this.tip = this._createTipElement(this._newContent || this._getContentForTemplate()); 10267 } 10268 return this.tip; 10269 } 10270 _createTipElement(content) { 10271 const tip = this._getTemplateFactory(content).toHtml(); 10272 10273 // TODO: remove this check in v6 10274 if (!tip) { 10275 return null; 10276 } 10277 tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); 10278 // TODO: v6 the following can be achieved with CSS only 10279 tip.classList.add(`bs-${this.constructor.NAME}-auto`); 10280 const tipId = getUID(this.constructor.NAME).toString(); 10281 tip.setAttribute('id', tipId); 10282 if (this._isAnimated()) { 10283 tip.classList.add(CLASS_NAME_FADE$2); 10284 } 10285 return tip; 10286 } 10287 setContent(content) { 10288 this._newContent = content; 10289 if (this._isShown()) { 10290 this._disposePopper(); 10291 this.show(); 10292 } 10293 } 10294 _getTemplateFactory(content) { 10295 if (this._templateFactory) { 10296 this._templateFactory.changeContent(content); 10297 } else { 10298 this._templateFactory = new TemplateFactory({ 10299 ...this._config, 10300 // the `content` var has to be after `this._config` 10301 // to override config.content in case of popover 10302 content, 10303 extraClass: this._resolvePossibleFunction(this._config.customClass) 10304 }); 10305 } 10306 return this._templateFactory; 10307 } 10308 _getContentForTemplate() { 10309 return { 10310 [SELECTOR_TOOLTIP_INNER]: this._getTitle() 10311 }; 10312 } 10313 _getTitle() { 10314 return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title'); 10315 } 10316 10317 // Private 10318 _initializeOnDelegatedTarget(event) { 10319 return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); 10320 } 10321 _isAnimated() { 10322 return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2); 10323 } 10324 _isShown() { 10325 return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2); 10326 } 10327 _createPopper(tip) { 10328 const placement = execute(this._config.placement, [this, tip, this._element]); 10329 const attachment = AttachmentMap[placement.toUpperCase()]; 10330 return
vendor: 2,053 bytes, lines 10330-10391
10330createPopper(this._element, tip, this._getPopperConfig(attachment)); 10331 } 10332 _getOffset() { 10333 const { 10334 offset 10335 } = this._config; 10336 if (typeof offset === 'string') { 10337 return offset.split(',').map(value => Number.parseInt(value, 10)); 10338 } 10339 if (typeof offset === 'function') { 10340 return popperData => offset(popperData, this._element); 10341 } 10342 return offset; 10343 } 10344 _resolvePossibleFunction(arg) { 10345 return execute(arg, [this._element]); 10346 } 10347 _getPopperConfig(attachment) { 10348 const defaultBsPopperConfig = { 10349 placement: attachment, 10350 modifiers: [{ 10351 name: 'flip', 10352 options: { 10353 fallbackPlacements: this._config.fallbackPlacements 10354 } 10355 }, { 10356 name: 'offset', 10357 options: { 10358 offset: this._getOffset() 10359 } 10360 }, { 10361 name: 'preventOverflow', 10362 options: { 10363 boundary: this._config.boundary 10364 } 10365 }, { 10366 name: 'arrow', 10367 options: { 10368 element: `.${this.constructor.NAME}-arrow` 10369 } 10370 }, { 10371 name: 'preSetPlacement', 10372 enabled: true, 10373 phase: 'beforeMain', 10374 fn: data => { 10375 // Pre-set Popper's placement attribute in order to read the arrow sizes properly. 10376 // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement 10377 this._getTipElement().setAttribute('data-popper-placement', data.state.placement); 10378 } 10379 }] 10380 }; 10381 return { 10382 ...defaultBsPopperConfig, 10383 ...execute(this._config.popperConfig, [defaultBsPopperConfig]) 10384 }; 10385 } 10386 _setListeners() { 10387 const triggers = this._config.trigger.split(' '); 10388 for (const trigger of triggers) { 10389 if (trigger === 'click') { 10390 EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => { 10391 const context = this._initializeOnDelegatedTarget(event
vendor: 11,862 bytes, lines 10391-10770
10391); 10392 context.toggle(); 10393 }); 10394 } else if (trigger !== TRIGGER_MANUAL) { 10395 const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1); 10396 const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1); 10397 EventHandler.on(this._element, eventIn, this._config.selector, event => { 10398 const context = this._initializeOnDelegatedTarget(event); 10399 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 10400 context._enter(); 10401 }); 10402 EventHandler.on(this._element, eventOut, this._config.selector, event => { 10403 const context = this._initializeOnDelegatedTarget(event); 10404 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); 10405 context._leave(); 10406 }); 10407 } 10408 } 10409 this._hideModalHandler = () => { 10410 if (this._element) { 10411 this.hide(); 10412 } 10413 }; 10414 EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 10415 } 10416 _fixTitle() { 10417 const title = this._element.getAttribute('title'); 10418 if (!title) { 10419 return; 10420 } 10421 if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) { 10422 this._element.setAttribute('aria-label', title); 10423 } 10424 this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility 10425 this._element.removeAttribute('title'); 10426 } 10427 _enter() { 10428 if (this._isShown() || this._isHovered) { 10429 this._isHovered = true; 10430 return; 10431 } 10432 this._isHovered = true; 10433 this._setTimeout(() => { 10434 if (this._isHovered) { 10435 this.show(); 10436 } 10437 }, this._config.delay.show); 10438 } 10439 _leave() { 10440 if (this._isWithActiveTrigger()) { 10441 return; 10442 } 10443 this._isHovered = false; 10444 this._setTimeout(() => { 10445 if (!this._isHovered) { 10446 this.hide(); 10447 } 10448 }, this._config.delay.hide); 10449 } 10450 _setTimeout(handler, timeout) { 10451 clearTimeout(this._timeout); 10452 this._timeout = setTimeout(handler, timeout); 10453 } 10454 _isWithActiveTrigger() { 10455 return Object.values(this._activeTrigger).includes(true); 10456 } 10457 _getConfig(config) { 10458 const dataAttributes = Manipulator.getDataAttributes(this._element); 10459 for (const dataAttribute of Object.keys(dataAttributes)) { 10460 if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) { 10461 delete dataAttributes[dataAttribute]; 10462 } 10463 } 10464 config = { 10465 ...dataAttributes, 10466 ...(typeof config === 'object' && config ? config : {}) 10467 }; 10468 config = this._mergeConfigObj(config); 10469 config = this._configAfterMerge(config); 10470 this._typeCheckConfig(config); 10471 return config; 10472 } 10473 _configAfterMerge(config) { 10474 config.container = config.container === false ? document.body : getElement(config.container); 10475 if (typeof config.delay === 'number') { 10476 config.delay = { 10477 show: config.delay, 10478 hide: config.delay 10479 }; 10480 } 10481 if (typeof config.title === 'number') { 10482 config.title = config.title.toString(); 10483 } 10484 if (typeof config.content === 'number') { 10485 config.content = config.content.toString(); 10486 } 10487 return config; 10488 } 10489 _getDelegateConfig() { 10490 const config = {}; 10491 for (const [key, value] of Object.entries(this._config)) { 10492 if (this.constructor.Default[key] !== value) { 10493 config[key] = value; 10494 } 10495 } 10496 config.selector = false; 10497 config.trigger = 'manual'; 10498 10499 // In the future can be replaced with: 10500 // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]]) 10501 // `Object.fromEntries(keysWithDifferentValues)` 10502 return config; 10503 } 10504 _disposePopper() { 10505 if (this._popper) { 10506 this._popper.destroy(); 10507 this._popper = null; 10508 } 10509 if (this.tip) { 10510 this.tip.remove(); 10511 this.tip = null; 10512 } 10513 } 10514 10515 // Static 10516 static jQueryInterface(config) { 10517 return this.each(function () { 10518 const data = Tooltip.getOrCreateInstance(this, config); 10519 if (typeof config !== 'string') { 10520 return; 10521 } 10522 if (typeof data[config] === 'undefined') { 10523 throw new TypeError(`No method named "${config}"`); 10524 } 10525 data[config](); 10526 }); 10527 } 10528 } 10529 10530 /** 10531 * jQuery 10532 */ 10533 10534 defineJQueryPlugin(Tooltip); 10535 10536 /** 10537 * -------------------------------------------------------------------------- 10538 * Bootstrap popover.js 10539 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 10540 * -------------------------------------------------------------------------- 10541 */ 10542 10543 10544 /** 10545 * Constants 10546 */ 10547 10548 const NAME$3 = 'popover'; 10549 const SELECTOR_TITLE = '.popover-header'; 10550 const SELECTOR_CONTENT = '.popover-body'; 10551 const Default$2 = { 10552 ...Tooltip.Default, 10553 content: '', 10554 offset: [0, 8], 10555 placement: 'right', 10556 template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>', 10557 trigger: 'click' 10558 }; 10559 const DefaultType$2 = { 10560 ...Tooltip.DefaultType, 10561 content: '(null|string|element|function)' 10562 }; 10563 10564 /** 10565 * Class definition 10566 */ 10567 10568 class Popover extends Tooltip { 10569 // Getters 10570 static get Default() { 10571 return Default$2; 10572 } 10573 static get DefaultType() { 10574 return DefaultType$2; 10575 } 10576 static get NAME() { 10577 return NAME$3; 10578 } 10579 10580 // Overrides 10581 _isWithContent() { 10582 return this._getTitle() || this._getContent(); 10583 } 10584 10585 // Private 10586 _getContentForTemplate() { 10587 return { 10588 [SELECTOR_TITLE]: this._getTitle(), 10589 [SELECTOR_CONTENT]: this._getContent() 10590 }; 10591 } 10592 _getContent() { 10593 return this._resolvePossibleFunction(this._config.content); 10594 } 10595 10596 // Static 10597 static jQueryInterface(config) { 10598 return this.each(function () { 10599 const data = Popover.getOrCreateInstance(this, config); 10600 if (typeof config !== 'string') { 10601 return; 10602 } 10603 if (typeof data[config] === 'undefined') { 10604 throw new TypeError(`No method named "${config}"`); 10605 } 10606 data[config](); 10607 }); 10608 } 10609 } 10610 10611 /** 10612 * jQuery 10613 */ 10614 10615 defineJQueryPlugin(Popover); 10616 10617 /** 10618 * -------------------------------------------------------------------------- 10619 * Bootstrap scrollspy.js 10620 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 10621 * -------------------------------------------------------------------------- 10622 */ 10623 10624 10625 /** 10626 * Constants 10627 */ 10628 10629 const NAME$2 = 'scrollspy'; 10630 const DATA_KEY$2 = 'bs.scrollspy'; 10631 const EVENT_KEY$2 = `.${DATA_KEY$2}`; 10632 const DATA_API_KEY = '.data-api'; 10633 const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; 10634 const EVENT_CLICK = `click${EVENT_KEY$2}`; 10635 const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`; 10636 const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 10637 const CLASS_NAME_ACTIVE$1 = 'active'; 10638 const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; 10639 const SELECTOR_TARGET_LINKS = '[href]'; 10640 const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 10641 const SELECTOR_NAV_LINKS = '.nav-link'; 10642 const SELECTOR_NAV_ITEMS = '.nav-item'; 10643 const SELECTOR_LIST_ITEMS = '.list-group-item'; 10644 const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`; 10645 const SELECTOR_DROPDOWN = '.dropdown'; 10646 const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 10647 const Default$1 = { 10648 offset: null, 10649 // TODO: v6 @deprecated, keep it for backwards compatibility reasons 10650 rootMargin: '0px 0px -25%', 10651 smoothScroll: false, 10652 target: null, 10653 threshold: [0.1, 0.5, 1] 10654 }; 10655 const DefaultType$1 = { 10656 offset: '(number|null)', 10657 // TODO v6 @deprecated, keep it for backwards compatibility reasons 10658 rootMargin: 'string', 10659 smoothScroll: 'boolean', 10660 target: 'element', 10661 threshold: 'array' 10662 }; 10663 10664 /** 10665 * Class definition 10666 */ 10667 10668 class ScrollSpy extends BaseComponent { 10669 constructor(element, config) { 10670 super(element, config); 10671 10672 // this._element is the observablesContainer and config.target the menu links wrapper 10673 this._targetLinks = new Map(); 10674 this._observableSections = new Map(); 10675 this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element; 10676 this._activeTarget = null; 10677 this._observer = null; 10678 this._previousScrollData = { 10679 visibleEntryTop: 0, 10680 parentScrollTop: 0 10681 }; 10682 this.refresh(); // initialize 10683 } 10684 10685 // Getters 10686 static get Default() { 10687 return Default$1; 10688 } 10689 static get DefaultType() { 10690 return DefaultType$1; 10691 } 10692 static get NAME() { 10693 return NAME$2; 10694 } 10695 10696 // Public 10697 refresh() { 10698 this._initializeTargetsAndObservables(); 10699 this._maybeEnableSmoothScroll(); 10700 if (this._observer) { 10701 this._observer.disconnect(); 10702 } else { 10703 this._observer = this._getNewObserver(); 10704 } 10705 for (const section of this._observableSections.values()) { 10706 this._observer.observe(section); 10707 } 10708 } 10709 dispose() { 10710 this._observer.disconnect(); 10711 super.dispose(); 10712 } 10713 10714 // Private 10715 _configAfterMerge(config) { 10716 // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case 10717 config.target = getElement(config.target) || document.body; 10718 10719 // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only 10720 config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin; 10721 if (typeof config.threshold === 'string') { 10722 config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value)); 10723 } 10724 return config; 10725 } 10726 _maybeEnableSmoothScroll() { 10727 if (!this._config.smoothScroll) { 10728 return; 10729 } 10730 10731 // unregister any previous listeners 10732 EventHandler.off(this._config.target, EVENT_CLICK); 10733 EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => { 10734 const observableSection = this._observableSections.get(event.target.hash); 10735 if (observableSection) { 10736 event.preventDefault(); 10737 const root = this._rootElement || window; 10738 const height = observableSection.offsetTop - this._element.offsetTop; 10739 if (root.scrollTo) { 10740 root.scrollTo({ 10741 top: height, 10742 behavior: 'smooth' 10743 }); 10744 return; 10745 } 10746 10747 // Chrome 60 doesn't support `scrollTo` 10748 root.scrollTop = height; 10749 } 10750 }); 10751 } 10752 _getNewObserver() { 10753 const options = { 10754 root: this._rootElement, 10755 threshold: this._config.threshold, 10756 rootMargin: this._config.rootMargin 10757 }; 10758 return new IntersectionObserver(entries => this._observerCallback(entries), options); 10759 } 10760 10761 // The logic of selection 10762 _observerCallback(entries) { 10763 const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`); 10764 const activate = entry => { 10765 this._previousScrollData.visibleEntryTop = entry.target.offsetTop; 10766 this._process(targetElement(entry)); 10767 }; 10768 const parentScrollTop = (this._rootElement || document.documentElement).scrollTop; 10769 const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop; 10770 this._previousScrollData.parentScrollTop = parentScrollTop;
vendor: 4,660 bytes, lines 10771-10906
10771 for (const entry of entries) { 10772 if (!entry.isIntersecting) { 10773 this._activeTarget = null; 10774 this._clearActiveClass(targetElement(entry)); 10775 continue; 10776 } 10777 const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop; 10778 // if we are scrolling down, pick the bigger offsetTop 10779 if (userScrollsDown && entryIsLowerThanPrevious) { 10780 activate(entry); 10781 // if parent isn't scrolled, let's keep the first visible item, breaking the iteration 10782 if (!parentScrollTop) { 10783 return; 10784 } 10785 continue; 10786 } 10787 10788 // if we are scrolling up, pick the smallest offsetTop 10789 if (!userScrollsDown && !entryIsLowerThanPrevious) { 10790 activate(entry); 10791 } 10792 } 10793 } 10794 _initializeTargetsAndObservables() { 10795 this._targetLinks = new Map(); 10796 this._observableSections = new Map(); 10797 const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target); 10798 for (const anchor of targetLinks) { 10799 // ensure that the anchor has an id and is not disabled 10800 if (!anchor.hash || isDisabled(anchor)) { 10801 continue; 10802 } 10803 const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element); 10804 10805 // ensure that the observableSection exists & is visible 10806 if (isVisible(observableSection)) { 10807 this._targetLinks.set(decodeURI(anchor.hash), anchor); 10808 this._observableSections.set(anchor.hash, observableSection); 10809 } 10810 } 10811 } 10812 _process(target) { 10813 if (this._activeTarget === target) { 10814 return; 10815 } 10816 this._clearActiveClass(this._config.target); 10817 this._activeTarget = target; 10818 target.classList.add(CLASS_NAME_ACTIVE$1); 10819 this._activateParents(target); 10820 EventHandler.trigger(this._element, EVENT_ACTIVATE, { 10821 relatedTarget: target 10822 }); 10823 } 10824 _activateParents(target) { 10825 // Activate dropdown parents 10826 if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { 10827 SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1); 10828 return; 10829 } 10830 for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) { 10831 // Set triggered links parents as active 10832 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 10833 for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) { 10834 item.classList.add(CLASS_NAME_ACTIVE$1); 10835 } 10836 } 10837 } 10838 _clearActiveClass(parent) { 10839 parent.classList.remove(CLASS_NAME_ACTIVE$1); 10840 const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent); 10841 for (const node of activeNodes) { 10842 node.classList.remove(CLASS_NAME_ACTIVE$1); 10843 } 10844 } 10845 10846 // Static 10847 static jQueryInterface(config) { 10848 return this.each(function () { 10849 const data = ScrollSpy.getOrCreateInstance(this, config); 10850 if (typeof config !== 'string') { 10851 return; 10852 } 10853 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 10854 throw new TypeError(`No method named "${config}"`); 10855 } 10856 data[config](); 10857 }); 10858 } 10859 } 10860 10861 /** 10862 * Data API implementation 10863 */ 10864 10865 EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => { 10866 for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) { 10867 ScrollSpy.getOrCreateInstance(spy); 10868 } 10869 }); 10870 10871 /** 10872 * jQuery 10873 */ 10874 10875 defineJQueryPlugin(ScrollSpy); 10876 10877 /** 10878 * -------------------------------------------------------------------------- 10879 * Bootstrap tab.js 10880 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 10881 * -------------------------------------------------------------------------- 10882 */ 10883 10884 10885 /** 10886 * Constants 10887 */ 10888 10889 const NAME$1 = 'tab'; 10890 const DATA_KEY$1 = 'bs.tab'; 10891 const EVENT_KEY$1 = `.${DATA_KEY$1}`; 10892 const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`; 10893 const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`; 10894 const EVENT_SHOW$1 = `show${EVENT_KEY$1}`; 10895 const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`; 10896 const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`; 10897 const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`; 10898 const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`; 10899 const ARROW_LEFT_KEY = 'ArrowLeft'; 10900 const ARROW_RIGHT_KEY = 'ArrowRight'; 10901 const ARROW_UP_KEY = 'ArrowUp'; 10902 const ARROW_DOWN_KEY = 'ArrowDown'; 10903 const HOME_KEY = 'Home'; 10904 const END_KEY = 'End'; 10905 const CLASS_NAME_ACTIVE = 'active'; 10906 const CLASS_NAME_FADE$1 = 'fade';
vendor: 6,276 bytes, lines 10907-11069
10907 const CLASS_NAME_SHOW$1 = 'show'; 10908 const CLASS_DROPDOWN = 'dropdown'; 10909 const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 10910 const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'; 10911 const NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`; 10912 const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; 10913 const SELECTOR_OUTER = '.nav-item, .list-group-item'; 10914 const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; 10915 const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // TODO: could only be `tab` in v6 10916 const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`; 10917 const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`; 10918 10919 /** 10920 * Class definition 10921 */ 10922 10923 class Tab extends BaseComponent { 10924 constructor(element) { 10925 super(element); 10926 this._parent = this._element.closest(SELECTOR_TAB_PANEL); 10927 if (!this._parent) { 10928 return; 10929 // TODO: should throw exception in v6 10930 // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`) 10931 } 10932 10933 // Set up initial aria attributes 10934 this._setInitialAttributes(this._parent, this._getChildren()); 10935 EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); 10936 } 10937 10938 // Getters 10939 static get NAME() { 10940 return NAME$1; 10941 } 10942 10943 // Public 10944 show() { 10945 // Shows this elem and deactivate the active sibling if exists 10946 const innerElem = this._element; 10947 if (this._elemIsActive(innerElem)) { 10948 return; 10949 } 10950 10951 // Search for active tab on same parent to deactivate it 10952 const active = this._getActiveElem(); 10953 const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, { 10954 relatedTarget: innerElem 10955 }) : null; 10956 const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, { 10957 relatedTarget: active 10958 }); 10959 if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) { 10960 return; 10961 } 10962 this._deactivate(active, innerElem); 10963 this._activate(innerElem, active); 10964 } 10965 10966 // Private 10967 _activate(element, relatedElem) { 10968 if (!element) { 10969 return; 10970 } 10971 element.classList.add(CLASS_NAME_ACTIVE); 10972 this._activate(SelectorEngine.getElementFromSelector(element)); // Search and activate/show the proper section 10973 10974 const complete = () => { 10975 if (element.getAttribute('role') !== 'tab') { 10976 element.classList.add(CLASS_NAME_SHOW$1); 10977 return; 10978 } 10979 element.removeAttribute('tabindex'); 10980 element.setAttribute('aria-selected', true); 10981 this._toggleDropDown(element, true); 10982 EventHandler.trigger(element, EVENT_SHOWN$1, { 10983 relatedTarget: relatedElem 10984 }); 10985 }; 10986 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); 10987 } 10988 _deactivate(element, relatedElem) { 10989 if (!element) { 10990 return; 10991 } 10992 element.classList.remove(CLASS_NAME_ACTIVE); 10993 element.blur(); 10994 this._deactivate(SelectorEngine.getElementFromSelector(element)); // Search and deactivate the shown section too 10995 10996 const complete = () => { 10997 if (element.getAttribute('role') !== 'tab') { 10998 element.classList.remove(CLASS_NAME_SHOW$1); 10999 return; 11000 } 11001 element.setAttribute('aria-selected', false); 11002 element.setAttribute('tabindex', '-1'); 11003 this._toggleDropDown(element, false); 11004 EventHandler.trigger(element, EVENT_HIDDEN$1, { 11005 relatedTarget: relatedElem 11006 }); 11007 }; 11008 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); 11009 } 11010 _keydown(event) { 11011 if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) { 11012 return; 11013 } 11014 event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page 11015 event.preventDefault(); 11016 const children = this._getChildren().filter(element => !isDisabled(element)); 11017 let nextActiveElement; 11018 if ([HOME_KEY, END_KEY].includes(event.key)) { 11019 nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1]; 11020 } else { 11021 const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); 11022 nextActiveElement = getNextActiveElement(children, event.target, isNext, true); 11023 } 11024 if (nextActiveElement) { 11025 nextActiveElement.focus({ 11026 preventScroll: true 11027 }); 11028 Tab.getOrCreateInstance(nextActiveElement).show(); 11029 } 11030 } 11031 _getChildren() { 11032 // collection of inner elements 11033 return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent); 11034 } 11035 _getActiveElem() { 11036 return this._getChildren().find(child => this._elemIsActive(child)) || null; 11037 } 11038 _setInitialAttributes(parent, children) { 11039 this._setAttributeIfNotExists(parent, 'role', 'tablist'); 11040 for (const child of children) { 11041 this._setInitialAttributesOnChild(child); 11042 } 11043 } 11044 _setInitialAttributesOnChild(child) { 11045 child = this._getInnerElement(child); 11046 const isActive = this._elemIsActive(child); 11047 const outerElem = this._getOuterElement(child); 11048 child.setAttribute('aria-selected', isActive); 11049 if (outerElem !== child) { 11050 this._setAttributeIfNotExists(outerElem, 'role', 'presentation'); 11051 } 11052 if (!isActive) { 11053 child.setAttribute('tabindex', '-1'); 11054 } 11055 this._setAttributeIfNotExists(child, 'role', 'tab'); 11056 11057 // set attributes to the related panel too 11058 this._setInitialAttributesOnTargetPanel(child); 11059 } 11060 _setInitialAttributesOnTargetPanel(child) { 11061 const target = SelectorEngine.getElementFromSelector(child); 11062 if (!target) { 11063 return; 11064 } 11065 this._setAttributeIfNotExists(target, 'role', 'tabpanel'); 11066 if (child.id) { 11067 this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`); 11068 } 11069 }
vendor: 5,385 bytes, lines 11070-11256
11070 _toggleDropDown(element, open) { 11071 const outerElem = this._getOuterElement(element); 11072 if (!outerElem.classList.contains(CLASS_DROPDOWN)) { 11073 return; 11074 } 11075 const toggle = (selector, className) => { 11076 const element = SelectorEngine.findOne(selector, outerElem); 11077 if (element) { 11078 element.classList.toggle(className, open); 11079 } 11080 }; 11081 toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE); 11082 toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1); 11083 outerElem.setAttribute('aria-expanded', open); 11084 } 11085 _setAttributeIfNotExists(element, attribute, value) { 11086 if (!element.hasAttribute(attribute)) { 11087 element.setAttribute(attribute, value); 11088 } 11089 } 11090 _elemIsActive(elem) { 11091 return elem.classList.contains(CLASS_NAME_ACTIVE); 11092 } 11093 11094 // Try to get the inner element (usually the .nav-link) 11095 _getInnerElement(elem) { 11096 return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem); 11097 } 11098 11099 // Try to get the outer element (usually the .nav-item) 11100 _getOuterElement(elem) { 11101 return elem.closest(SELECTOR_OUTER) || elem; 11102 } 11103 11104 // Static 11105 static jQueryInterface(config) { 11106 return this.each(function () { 11107 const data = Tab.getOrCreateInstance(this); 11108 if (typeof config !== 'string') { 11109 return; 11110 } 11111 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 11112 throw new TypeError(`No method named "${config}"`); 11113 } 11114 data[config](); 11115 }); 11116 } 11117 } 11118 11119 /** 11120 * Data API implementation 11121 */ 11122 11123 EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 11124 if (['A', 'AREA'].includes(this.tagName)) { 11125 event.preventDefault(); 11126 } 11127 if (isDisabled(this)) { 11128 return; 11129 } 11130 Tab.getOrCreateInstance(this).show(); 11131 }); 11132 11133 /** 11134 * Initialize on focus 11135 */ 11136 EventHandler.on(window, EVENT_LOAD_DATA_API, () => { 11137 for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) { 11138 Tab.getOrCreateInstance(element); 11139 } 11140 }); 11141 /** 11142 * jQuery 11143 */ 11144 11145 defineJQueryPlugin(Tab); 11146 11147 /** 11148 * -------------------------------------------------------------------------- 11149 * Bootstrap toast.js 11150 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 11151 * -------------------------------------------------------------------------- 11152 */ 11153 11154 11155 /** 11156 * Constants 11157 */ 11158 11159 const NAME = 'toast'; 11160 const DATA_KEY = 'bs.toast'; 11161 const EVENT_KEY = `.${DATA_KEY}`; 11162 const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`; 11163 const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`; 11164 const EVENT_FOCUSIN = `focusin${EVENT_KEY}`; 11165 const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`; 11166 const EVENT_HIDE = `hide${EVENT_KEY}`; 11167 const EVENT_HIDDEN = `hidden${EVENT_KEY}`; 11168 const EVENT_SHOW = `show${EVENT_KEY}`; 11169 const EVENT_SHOWN = `shown${EVENT_KEY}`; 11170 const CLASS_NAME_FADE = 'fade'; 11171 const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility 11172 const CLASS_NAME_SHOW = 'show'; 11173 const CLASS_NAME_SHOWING = 'showing'; 11174 const DefaultType = { 11175 animation: 'boolean', 11176 autohide: 'boolean', 11177 delay: 'number' 11178 }; 11179 const Default = { 11180 animation: true, 11181 autohide: true, 11182 delay: 5000 11183 }; 11184 11185 /** 11186 * Class definition 11187 */ 11188 11189 class Toast extends BaseComponent { 11190 constructor(element, config) { 11191 super(element, config); 11192 this._timeout = null; 11193 this._hasMouseInteraction = false; 11194 this._hasKeyboardInteraction = false; 11195 this._setListeners(); 11196 } 11197 11198 // Getters 11199 static get Default() { 11200 return Default; 11201 } 11202 static get DefaultType() { 11203 return DefaultType; 11204 } 11205 static get NAME() { 11206 return NAME; 11207 } 11208 11209 // Public 11210 show() { 11211 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW); 11212 if (showEvent.defaultPrevented) { 11213 return; 11214 } 11215 this._clearTimeout(); 11216 if (this._config.animation) { 11217 this._element.classList.add(CLASS_NAME_FADE); 11218 } 11219 const complete = () => { 11220 this._element.classList.remove(CLASS_NAME_SHOWING); 11221 EventHandler.trigger(this._element, EVENT_SHOWN); 11222 this._maybeScheduleHide(); 11223 }; 11224 this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated 11225 reflow(this._element); 11226 this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING); 11227 this._queueCallback(complete, this._element, this._config.animation); 11228 } 11229 hide() { 11230 if (!this.isShown()) { 11231 return; 11232 } 11233 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE); 11234 if (hideEvent.defaultPrevented) { 11235 return; 11236 } 11237 const complete = () => { 11238 this._element.classList.add(CLASS_NAME_HIDE); // @deprecated 11239 this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW); 11240 EventHandler.trigger(this._element, EVENT_HIDDEN); 11241 }; 11242 this._element.classList.add(CLASS_NAME_SHOWING); 11243 this._queueCallback(complete, this._element, this._config.animation); 11244 } 11245 dispose() { 11246 this._clearTimeout(); 11247 if (this.isShown()) { 11248 this._element.classList.remove(CLASS_NAME_SHOW); 11249 } 11250 super.dispose(); 11251 } 11252 isShown() { 11253 return this._element.classList.contains(CLASS_NAME_SHOW); 11254 } 11255 11256 // Private
vendor: 1,687 bytes, lines 11257-11310
11257 11258 _maybeScheduleHide() { 11259 if (!this._config.autohide) { 11260 return; 11261 } 11262 if (this._hasMouseInteraction || this._hasKeyboardInteraction) { 11263 return; 11264 } 11265 this._timeout = setTimeout(() => { 11266 this.hide(); 11267 }, this._config.delay); 11268 } 11269 _onInteraction(event, isInteracting) { 11270 switch (event.type) { 11271 case 'mouseover': 11272 case 'mouseout': 11273 { 11274 this._hasMouseInteraction = isInteracting; 11275 break; 11276 } 11277 case 'focusin': 11278 case 'focusout': 11279 { 11280 this._hasKeyboardInteraction = isInteracting; 11281 break; 11282 } 11283 } 11284 if (isInteracting) { 11285 this._clearTimeout(); 11286 return; 11287 } 11288 const nextElement = event.relatedTarget; 11289 if (this._element === nextElement || this._element.contains(nextElement)) { 11290 return; 11291 } 11292 this._maybeScheduleHide(); 11293 } 11294 _setListeners() { 11295 EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true)); 11296 EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false)); 11297 EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true)); 11298 EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false)); 11299 } 11300 _clearTimeout() { 11301 clearTimeout(this._timeout); 11302 this._timeout = null; 11303 } 11304 11305 // Static 11306 static jQueryInterface(config) { 11307 return this.each(function () { 11308 const data = Toast.getOrCreateInstance(this, config); 11309 if (typeof config === 'string') { 11310 if (typeof data[config] === 'undefined') {
11311 throw new TypeError(`No method named "${config}"`); 11312 } 11313 data[config](this); 11314 } 11315 }); 11316 } 11317 } 11318 11319 /** 11320 * Data API implementation 11321 */ 11322 11323 enableDismissTrigger(Toast); 11324 11325 /** 11326 * jQuery 11327 */ 11328 11329 defineJQueryPlugin(Toast); 11330 11331 /** 11332 * -------------------------------------------------------------------------- 11333 * Bootstrap index.umd.js 11334 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 11335 * -------------------------------------------------------------------------- 11336 */ 11337 11338 const index_umd = { 11339 Alert, 11340 Button, 11341 Carousel, 11342 Collapse, 11343 Dropdown, 11344 Modal, 11345 Offcanvas, 11346 Popover, 11347 ScrollSpy, 11348 Tab, 11349 Toast, 11350 Tooltip 11351 }; 11352 11353 return index_umd; 11354 11355})); 11356/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) 11357 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 11358 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 11359 * 11360 * Version: 1.3.7 11361 * 11362 */ 11363(function($) { 11364 11365 $.fn.extend({ 11366 slimScroll: function(options) { 11367 11368 const defaults = { 11369 11370 // width in pixels of the visible scroll area 11371 width : 'auto', 11372 11373 // height in pixels of the visible scroll area 11374 height : '250px', 11375 11376 // width in pixels of the scrollbar and rail 11377 size : '7px', 11378 11379 // scrollbar color, accepts any hex/color value 11380 color: '#000', 11381 11382 // scrollbar position - left/right 11383 position : 'right', 11384 11385 // distance in pixels between the side edge and the scrollbar 11386 distance : '1px', 11387 11388 // default scroll position on load - top / bottom / $('selector') 11389 start : 'top', 11390 11391 // sets scrollbar opacity 11392 opacity : .4, 11393 11394 // enables always-on mode for the scrollbar 11395 alwaysVisible : false, 11396 11397 // check if we should hide the scrollbar when user is hovering over 11398 disableFadeOut : false, 11399 11400 // sets visibility of the rail 11401 railVisible : false, 11402 11403 // sets rail color 11404 railColor : '#333', 11405 11406 // sets rail opacity 11407 railOpacity : .2, 11408 11409 // whether we should use jQuery UI Draggable to enable bar dragging 11410 railDraggable : true, 11411 11412 // defautlt CSS class of the slimscroll rail 11413 railClass : 'slimScrollRail', 11414 11415 // defautlt CSS class of the slimscroll bar 11416 barClass : 'slimScrollBar', 11417 11418 // defautlt CSS class of the slimscroll wrapper 11419 wrapperClass : 'slimScrollDiv', 11420 11421 // check if mousewheel should scroll the window if we reach top/bottom 11422 allowPageScroll : false, 11423 11424 // scroll amount applied to each mouse wheel step 11425 wheelStep : 20, 11426 11427 // scroll amount applied when user is using gestures 11428 touchScrollStep : 200, 11429 11430 // sets border radius 11431 borderRadius: '7px', 11432 11433 // sets border radius of the rail 11434 railBorderRadius : '7px' 11435 }; 11436 11437 const o = $.extend(defaults, options); 11438 11439 // do it for every element that matches selector 11440 this.each(function(){ 11441 11442 let isOverPanel; 11443 let isOverBar; 11444 let isDragg; 11445 let queueHide; 11446 let touchDif; 11447 let barHeight; 11448 let percentScroll; 11449 let lastScroll; 11450 let divS = '<div></div>'; 11451 let minBarHeight = 30; 11452 let releaseScroll = false; 11453 11454 // used in event handlers and for better minification 11455 const me = $(this); 11456 11457 // ensure we are not binding it again 11458 if (me.parent().hasClass(o.wrapperClass)) 11459 { 11460 // start from last bar position 11461 let offset = me.scrollTop(); 11462 11463 // find bar and rail 11464 const bar = me.siblings('.' + o.barClass); 11465 const rail = me.siblings('.' + o.railClass); 11466 11467 getBarHeight(); 11468 11469 // check if we should scroll existing instance 11470 if ($.isPlainObject(options)) 11471 { 11472 // Pass height: auto to an existing slimscroll object to force a resize after contents have changed 11473 if ( 'height' in options && options.height == 'auto' ) { 11474 me.parent().css('height', 'auto'); 11475 me.css('height', 'auto'); 11476 const height = me.parent().parent().height(); 11477 me.parent().css('height', height); 11478 me.css('height', height); 11479 } else if ('height' in options) { 11480 const h = options.height; 11481 me.parent().css('height', h); 11482 me.css('height', h); 11483 } 11484 11485 if ('scrollTo' in options) 11486 { 11487 // jump to a static point 11488 offset = parseInt(o.scrollTo); 11489 } 11490 else if ('scrollBy' in options) 11491 { 11492 // jump by value pixels 11493 offset += parseInt(o.scrollBy); 11494 } 11495 else if ('destroy' in options) 11496 { 11497 // remove slimscroll elements 11498 bar.remove(); 11499 rail.remove(); 11500 me.unwrap(); 11501 return; 11502 } 11503 11504 // scroll content by the given offset 11505 scrollContent(offset, false, true); 11506 } 11507 11508 return; 11509 } 11510 else if ($.isPlainObject(options)) 11511 { 11512 if ('destroy' in options) 11513 { 11514 return; 11515 } 11516 } 11517 11518 // optionally set height to the parent's height 11519 o.height = (o.height == 'auto') ? me.parent().height() : o.height; 11520 11521 // wrap content 11522 let wrapper = $(divS) 11523 .addClass(o.wrapperClass) 11524 .css({ 11525 position: 'relative', 11526 overflow: 'hidden', 11527 width: o.width, 11528 height: o.height 11529 }); 11530 11531 // update style for the div 11532 me.css({ 11533 overflow: 'hidden', 11534 width: o.width, 11535 height: o.height 11536 }); 11537 11538 // create scrollbar rail 11539 let rail = $(divS) 11540 .addClass(o.railClass) 11541 .css({ 11542 width: o.size, 11543 height: '100%', 11544 position: 'absolute', 11545 top: 0, 11546 display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none', 11547 'border-radius': o.railBorderRadius, 11548 background: o.railColor, 11549 opacity: o.railOpacity, 11550 zIndex: 90 11551 }); 11552 11553 // create scrollbar 11554 let bar = $(divS) 11555 .addClass(o.barClass) 11556 .css({ 11557 background: o.color, 11558 width: o.size, 11559 position: 'absolute', 11560 top: 0, 11561 opacity: o.opacity, 11562 display: o.alwaysVisible ? 'block' : 'none', 11563 'border-radius' : o.borderRadius, 11564 BorderRadius: o.borderRadius, 11565 MozBorderRadius: o.borderRadius, 11566 WebkitBorderRadius: o.borderRadius, 11567 zIndex: 99 11568 }); 11569 11570 // set position
11571 const posCss = (o.position == 'right') ? { right: o.distance } : { left: o.distance }; 11572 rail.css(posCss); 11573 bar.css(posCss); 11574 11575 // wrap it 11576 me.wrap(wrapper); 11577 11578 // append to parent div 11579 me.parent().append(bar); 11580 me.parent().append(rail); 11581 11582 // make it draggable and no longer dependent on the jqueryUI 11583 if (o.railDraggable){ 11584 bar.bind("mousedown", function(e) { 11585 const $doc = $(document); 11586 isDragg = true; 11587 const t = parseFloat(bar.css('top')); 11588 const pageY = e.pageY; 11589 11590 $doc.bind("mousemove.slimscroll", function(e){ 11591 const currTop = t + e.pageY - pageY; 11592 bar.css('top', currTop); 11593 scrollContent(0, bar.position().top, false);// scroll content 11594 }); 11595 11596 $doc.bind("mouseup.slimscroll", function(e) { 11597 isDragg = false;hideBar(); 11598 $doc.unbind('.slimscroll'); 11599 }); 11600 return false; 11601 }).bind("selectstart.slimscroll", function(e){ 11602 e.stopPropagation(); 11603 e.preventDefault(); 11604 return false; 11605 }); 11606 } 11607 11608 // on rail over 11609 rail.hover(function(){ 11610 showBar(); 11611 }, function(){ 11612 hideBar(); 11613 }); 11614 11615 // on bar over 11616 bar.hover(function(){ 11617 isOverBar = true; 11618 }, function(){ 11619 isOverBar = false; 11620 }); 11621 11622 // show on parent mouseover 11623 me.hover(function(){ 11624 isOverPanel = true; 11625 showBar(); 11626 hideBar(); 11627 }, function(){ 11628 isOverPanel = false; 11629 hideBar(); 11630 }); 11631 11632 // support for mobile 11633 me.bind('touchstart', function(e,b){ 11634 if (e.originalEvent.touches.length) 11635 { 11636 // record where touch started 11637 touchDif = e.originalEvent.touches[0].pageY; 11638 } 11639 }); 11640 11641 me.bind('touchmove', function(e){ 11642 // prevent scrolling the page if necessary 11643 if(!releaseScroll) 11644 { 11645 e.originalEvent.preventDefault(); 11646 } 11647 if (e.originalEvent.touches.length) 11648 { 11649 // see how far user swiped 11650 const diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep; 11651 // scroll content 11652 scrollContent(diff, true); 11653 touchDif = e.originalEvent.touches[0].pageY; 11654 } 11655 }); 11656 11657 // set up initial height 11658 getBarHeight(); 11659 11660 // check start position 11661 if (o.start === 'bottom') 11662 { 11663 // scroll content to bottom 11664 bar.css({ top: me.outerHeight() - bar.outerHeight() }); 11665 scrollContent(0, true); 11666 } 11667 else if (o.start !== 'top') 11668 { 11669 // assume jQuery selector 11670 scrollContent($(o.start).position().top, null, true); 11671 11672 // make sure bar stays hidden 11673 if (!o.alwaysVisible) { bar.hide(); } 11674 } 11675 11676 // attach scroll events 11677 attachWheel(this); 11678 11679 function _onWheel(e) 11680 { 11681 // use mouse wheel only when mouse is over 11682 if (!isOverPanel) { return; } 11683 11684 e = e || window.event; 11685 11686 let delta = 0; 11687 if (e.wheelDelta) { delta = -e.wheelDelta/120; } 11688 if (e.detail) { delta = e.detail / 3; } 11689 11690 const target = e.target || e.srcTarget || e.srcElement; 11691 if ($(target).closest('.' + o.wrapperClass).is(me.parent())) { 11692 // scroll content 11693 scrollContent(delta, true); 11694 } 11695 11696 // stop window scroll 11697 if (e.preventDefault && !releaseScroll) { e.preventDefault(); } 11698 if (!releaseScroll) { e.returnValue = false; } 11699 } 11700 11701 function scrollContent(y, isWheel, isJump) 11702 { 11703 releaseScroll = false; 11704 let delta = y; 11705 const maxTop = me.outerHeight() - bar.outerHeight(); 11706 11707 if (isWheel) 11708 { 11709 // move bar with mouse wheel 11710 delta = parseInt(bar.css('top')) + y * parseInt(o.wheelStep) / 100 * bar.outerHeight(); 11711 11712 // move bar, make sure it doesn't go out 11713 delta = Math.min(Math.max(delta, 0), maxTop); 11714 11715 // if scrolling down, make sure a fractional change to the 11716 // scroll position isn't rounded away when the scrollbar's CSS is set 11717 // this flooring of delta would happened automatically when 11718 // bar.css is set below, but we floor here for clarity 11719 delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta); 11720 11721 // scroll the scrollbar 11722 bar.css({ top: delta + 'px' }); 11723 } 11724 11725 // calculate actual scroll amount 11726 percentScroll = parseInt(bar.css('top')) / (me.outerHeight() - bar.outerHeight()); 11727 delta = percentScroll * (me[0].scrollHeight - me.outerHeight()); 11728 11729 if (isJump) 11730 { 11731 delta = y; 11732 let offsetTop = delta / me[0].scrollHeight * me.outerHeight(); 11733 offsetTop = Math.min(Math.max(offsetTop, 0), maxTop); 11734 bar.css({ top: offsetTop + 'px' }); 11735 } 11736 11737 // scroll content 11738 me.scrollTop(delta); 11739 11740 // fire scrolling event 11741 me.trigger('slimscrolling', ~~delta); 11742 11743 // ensure bar is visible 11744 showBar(); 11745 11746 // trigger hide when scroll is stopped 11747 hideBar(); 11748 } 11749 11750 function attachWheel(target) 11751 { 11752 if (window.addEventListener) 11753 { 11754 target.addEventListener('DOMMouseScroll', _onWheel, false ); 11755 target.addEventListener('mousewheel', _onWheel, false ); 11756 } 11757 else 11758 { 11759 document.attachEvent("onmousewheel", _onWheel) 11760 } 11761 } 11762 11763 function getBarHeight() 11764 { 11765 // calculate scrollbar height and make sure it is not too small 11766 barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight); 11767 bar.css({ height: barHeight + 'px' }); 11768 11769 // hide scrollbar if content is not long enough 11770 var display = barHeight == me.outerHeight() ? 'none' : 'block'; 11771 bar.css({ display: display }); 11772 } 11773 11774 function showBar() 11775 { 11776 // recalculate bar height 11777 getBarHeight(); 11778 clearTimeout(queueHide); 11779 11780 // when bar reached top or bottom 11781 if (percentScroll == ~~percentScroll) 11782 { 11783 //release wheel 11784 releaseScroll = o.allowPageScroll; 11785 11786 // publish approporiate event 11787 if (lastScroll != percentScroll) 11788 { 11789 var msg = (~~percentScroll == 0) ? 'top' : 'bottom'; 11790 me.trigger('slimscroll', msg); 11791 } 11792 } 11793 else 11794 { 11795 releaseScroll = false;
11796 } 11797 lastScroll = percentScroll; 11798 11799 // show only when required 11800 if(barHeight >= me.outerHeight()) { 11801 //allow window scroll 11802 releaseScroll = true; 11803 return; 11804 } 11805 bar.stop(true,true).fadeIn('fast'); 11806 if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); } 11807 } 11808 11809 function hideBar() 11810 { 11811 // only hide when options allow it 11812 if (!o.alwaysVisible) 11813 { 11814 queueHide = setTimeout(function(){ 11815 if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg) 11816 { 11817 bar.fadeOut('slow'); 11818 rail.fadeOut('slow'); 11819 } 11820 }, 1000); 11821 } 11822 } 11823 11824 }); 11825 11826 // maintain chainability 11827 return this; 11828 } 11829 }); 11830 11831 $.fn.extend({ 11832 slimscroll: $.fn.slimScroll 11833 }); 11834 11835})(jQuery); 11836 11837 const inputs = document.querySelectorAll('.cmp-form-text__text'); 11838 11839 inputs.forEach(input => { 11840 input.addEventListener('blur', function() { 11841 11842 const regexPattern = input.getAttribute('data-pattern'); 11843 11844 if (regexPattern.trim() === '') { 11845 input.style.border = ''; 11846 const errorMessage = input.nextElementSibling; 11847 errorMessage.style.display = 'none'; 11848 return; 11849 } 11850 11851 const pattern = new RegExp(regexPattern); 11852 const value = input.value; 11853 11854 11855 const errorMessage = input.nextElementSibling; 11856 if (pattern.test(value)) { 11857 11858 input.style.border = ''; 11859 errorMessage.style.display = 'none'; 11860 } else { 11861 11862 input.style.border = '1.5px solid red'; 11863 errorMessage.style.display = 'inline'; 11864 } 11865 }); 11866 }); 11867/******************************************************************************* 11868 * Copyright 2017 Adobe 11869 * 11870 * Licensed under the Apache License, Version 2.0 (the "License"); 11871 * you may not use this file except in compliance with the License. 11872 * You may obtain a copy of the License at 11873 * 11874 * http://www.apache.org/licenses/LICENSE-2.0 11875 * 11876 * Unless required by applicable law or agreed to in writing, software 11877 * distributed under the License is distributed on an "AS IS" BASIS, 11878 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11879 * See the License for the specific language governing permissions and 11880 * limitations under the License. 11881 ******************************************************************************/ 11882if (window.Element && !Element.prototype.closest) { 11883 // eslint valid-jsdoc: "off" 11884 Element.prototype.closest = 11885 function(s) { 11886 "use strict"; 11887 var matches = (this.document || this.ownerDocument).querySelectorAll(s); 11888 var el = this; 11889 var i; 11890 do { 11891 i = matches.length; 11892 while (--i >= 0 && matches.item(i) !== el) { 11893 // continue 11894 } 11895 } while ((i < 0) && (el = el.parentElement)); 11896 return el; 11897 }; 11898} 11899 11900if (window.Element && !Element.prototype.matches) { 11901 Element.prototype.matches = 11902 Element.prototype.matchesSelector || 11903 Element.prototype.mozMatchesSelector || 11904 Element.prototype.msMatchesSelector || 11905 Element.prototype.oMatchesSelector || 11906 Element.prototype.webkitMatchesSelector || 11907 function(s) { 11908 "use strict"; 11909 var matches = (this.document || this.ownerDocument).querySelectorAll(s); 11910 var i = matches.length; 11911 while (--i >= 0 && matches.item(i) !== this) { 11912 // continue 11913 } 11914 return i > -1; 11915 }; 11916} 11917 11918if (!Object.assign) { 11919 Object.assign = function(target, varArgs) { // .length of function is 2 11920 "use strict"; 11921 if (target === null) { 11922 throw new TypeError("Cannot convert undefined or null to object"); 11923 } 11924 11925 var to = Object(target); 11926 11927 for (var index = 1; index < arguments.length; index++) { 11928 var nextSource = arguments[index]; 11929 11930 if (nextSource !== null) { 11931 for (var nextKey in nextSource) { 11932 if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { 11933 to[nextKey] = nextSource[nextKey]; 11934 } 11935 } 11936 } 11937 } 11938 return to; 11939 }; 11940} 11941 11942(function(arr) { 11943 "use strict"; 11944 arr.forEach(function(item) { 11945 if (item.hasOwnProperty("remove")) { 11946 return; 11947 } 11948 Object.defineProperty(item, "remove", { 11949 configurable: true, 11950 enumerable: true, 11951 writable: true, 11952 value: function remove() { 11953 this.parentNode.removeChild(this); 11954 } 11955 }); 11956 }); 11957})([Element.prototype, CharacterData.prototype, DocumentType.prototype]); 11958 11959/******************************************************************************* 11960 * Copyright 2016 Adobe 11961 * 11962 * Licensed under the Apache License, Version 2.0 (the "License");
11963 * you may not use this file except in compliance with the License. 11964 * You may obtain a copy of the License at 11965 * 11966 * http://www.apache.org/licenses/LICENSE-2.0 11967 * 11968 * Unless required by applicable law or agreed to in writing, software 11969 * distributed under the License is distributed on an "AS IS" BASIS, 11970 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11971 * See the License for the specific language governing permissions and 11972 * limitations under the License. 11973 ******************************************************************************/ 11974(function() { 11975 "use strict"; 11976 11977 var NS = "cmp"; 11978 var IS = "image"; 11979 11980 var EMPTY_PIXEL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"; 11981 var LAZY_THRESHOLD_DEFAULT = 0; 11982 var SRC_URI_TEMPLATE_WIDTH_VAR = "{.width}"; 11983 11984 var selectors = { 11985 self: "[data-" + NS + '-is="' + IS + '"]', 11986 image: '[data-cmp-hook-image="image"]', 11987 map: '[data-cmp-hook-image="map"]', 11988 area: '[data-cmp-hook-image="area"]' 11989 }; 11990 11991 var lazyLoader = { 11992 "cssClass": "cmp-image__image--is-loading", 11993 "style": { 11994 "height": 0, 11995 "padding-bottom": "" // will be replaced with % ratio 11996 } 11997 }; 11998 11999 var properties = { 12000 /** 12001 * An array of alternative image widths (in pixels). 12002 * Used to replace a {.width} variable in the src property with an optimal width if a URI template is provided. 12003 * 12004 * @memberof Image 12005 * @type {Number[]} 12006 * @default [] 12007 */ 12008 "widths": { 12009 "default": [], 12010 "transform": function(value) { 12011 var widths = []; 12012 value.split(",").forEach(function(item) { 12013 item = parseFloat(item); 12014 if (!isNaN(item)) { 12015 widths.push(item); 12016 } 12017 }); 12018 return widths; 12019 } 12020 }, 12021 /** 12022 * Indicates whether the image should be rendered lazily. 12023 * 12024 * @memberof Image 12025 * @type {Boolean} 12026 * @default false 12027 */ 12028 "lazy": { 12029 "default": false, 12030 "transform": function(value) { 12031 return !(value === null || typeof value === "undefined"); 12032 } 12033 }, 12034 /** 12035 * The lazy threshold. 12036 * This is the number of pixels, in advance of becoming visible, when an lazy-loading image should begin 12037 * to load. 12038 * 12039 * @memberof Image 12040 * @type {Number} 12041 * @default 0 12042 */ 12043 "lazythreshold": { 12044 "default": 0, 12045 "transform": function(value) { 12046 const val = parseInt(value); 12047 if (isNaN(val)) { 12048 return LAZY_THRESHOLD_DEFAULT; 12049 } 12050 return val; 12051 } 12052 }, 12053 /** 12054 * The image source. 12055 * 12056 * Can be a simple image source, or a URI template representation that 12057 * can be variable expanded - useful for building an image configuration with an alternative width. 12058 * e.g. '/path/image.coreimg{.width}.jpeg/1506620954214.jpeg' 12059 * 12060 * @memberof Image 12061 * @type {String} 12062 */ 12063 "src": { 12064 "transform": function(value) { 12065 return decodeURIComponent(value); 12066 } 12067 } 12068 }; 12069 12070 var devicePixelRatio = window.devicePixelRatio || 1; 12071 12072 function readData(element) { 12073 var data = element.dataset; 12074 var options = []; 12075 var capitalized = IS; 12076 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 12077 var reserved = ["is", "hook" + capitalized]; 12078 12079 for (var key in data) { 12080 if (data.hasOwnProperty(key)) { 12081 var value = data[key]; 12082 12083 if (key.indexOf(NS) === 0) { 12084 key = key.slice(NS.length); 12085 key = key.charAt(0).toLowerCase() + key.substring(1); 12086 12087 if (reserved.indexOf(key) === -1) { 12088 options[key] = value; 12089 } 12090 } 12091 } 12092 } 12093 12094 return options; 12095 } 12096 12097 function Image(config) { 12098 var that = this; 12099 12100 function init(config) { 12101 // prevents multiple initialization 12102 config.element.removeAttribute("data-" + NS + "-is"); 12103 12104 setupProperties(config.options); 12105 cacheElements(config.element); 12106 12107 if (!that._elements.noscript) { 12108 return; 12109 } 12110 12111 that._elements.container = that._elements.link ? that._elements.link : that._elements.self; 12112 12113 unwrapNoScript(); 12114 12115 if (that._properties.lazy) { 12116 addLazyLoader(); 12117 } 12118 12119 if (that._elements.map) { 12120 that._elements.image.addEventListener("load", onLoad); 12121 } 12122 12123 window.addEventListener("resize", onWindowResize); 12124 ["focus", "click", "load", "transitionend", "animationend", "scroll"].forEach(function(name) { 12125 document.addEventListener(name, that.update); 12126 }); 12127 12128 that._elements.image.addEventListener("cmp-image-redraw", that.update);
12129 that.update(); 12130 } 12131 12132 function loadImage() { 12133 var hasWidths = that._properties.widths && that._properties.widths.length > 0; 12134 var replacement = hasWidths ? "." + getOptimalWidth() : ""; 12135 var url = that._properties.src.replace(SRC_URI_TEMPLATE_WIDTH_VAR, replacement); 12136 12137 //console.log("replacement " + replacement); 12138 12139 if (that._elements.image.getAttribute("src") !== url) { 12140 that._elements.image.setAttribute("src", url); 12141 if (!hasWidths) { 12142 window.removeEventListener("scroll", that.update); 12143 } 12144 } 12145 12146 if (that._lazyLoaderShowing) { 12147 that._elements.image.addEventListener("load", removeLazyLoader); 12148 } 12149 } 12150 12151 function getOptimalWidth() { 12152 var container = that._elements.self; 12153 var containerWidth = container.clientWidth; 12154 12155 while (containerWidth === 0 && container.parentNode) { 12156 container = container.parentNode; 12157 containerWidth = container.clientWidth; 12158 12159 } 12160 var optimalWidth = containerWidth * devicePixelRatio; 12161 var len = that._properties.widths.length; 12162 var key = 0; 12163 12164 while ((key < len - 1) && (that._properties.widths[key] < optimalWidth)) { 12165 key++; 12166 } 12167 12168 return that._properties.widths[key].toString(); 12169 } 12170 12171 function addLazyLoader() { 12172 var width = that._elements.image.getAttribute("width"); 12173 var height = that._elements.image.getAttribute("height"); 12174 12175 if (width && height) { 12176 var ratio = (height / width) * 100; 12177 var styles = lazyLoader.style; 12178 12179 styles["padding-bottom"] = ratio + "%"; 12180 12181 for (var s in styles) { 12182 if (styles.hasOwnProperty(s)) { 12183 that._elements.image.style[s] = styles[s]; 12184 } 12185 } 12186 } 12187 that._elements.image.setAttribute("src", EMPTY_PIXEL); 12188 that._elements.image.classList.add(lazyLoader.cssClass); 12189 that._lazyLoaderShowing = true; 12190 } 12191 12192 function unwrapNoScript() { 12193 var markup = decodeNoscript(that._elements.noscript.textContent.trim()); 12194 var parser = new DOMParser(); 12195 12196 // temporary document avoids requesting the image before removing its src 12197 var temporaryDocument = parser.parseFromString(markup, "text/html"); 12198 var imageElement = temporaryDocument.querySelector(selectors.image); 12199 imageElement.removeAttribute("src"); 12200 that._elements.container.insertBefore(imageElement, that._elements.noscript); 12201 12202 var mapElement = temporaryDocument.querySelector(selectors.map); 12203 if (mapElement) { 12204 that._elements.container.insertBefore(mapElement, that._elements.noscript); 12205 } 12206 12207 that._elements.noscript.parentNode.removeChild(that._elements.noscript); 12208 if (that._elements.container.matches(selectors.image)) { 12209 that._elements.image = that._elements.container; 12210 } else { 12211 that._elements.image = that._elements.container.querySelector(selectors.image); 12212 } 12213 12214 that._elements.map = that._elements.container.querySelector(selectors.map); 12215 that._elements.areas = that._elements.container.querySelectorAll(selectors.area); 12216 } 12217 12218 function removeLazyLoader() { 12219 that._elements.image.classList.remove(lazyLoader.cssClass); 12220 for (var property in lazyLoader.style) { 12221 if (lazyLoader.style.hasOwnProperty(property)) { 12222 that._elements.image.style[property] = ""; 12223 } 12224 } 12225 that._elements.image.removeEventListener("load", removeLazyLoader); 12226 that._lazyLoaderShowing = false; 12227 } 12228 12229 function isLazyVisible() { 12230 if (that._elements.container.offsetParent === null) { 12231 return false;
12232 } 12233 12234 var wt = window.pageYOffset; 12235 var wb = wt + document.documentElement.clientHeight; 12236 var et = that._elements.container.getBoundingClientRect().top + wt; 12237 var eb = et + that._elements.container.clientHeight; 12238 12239 return eb >= wt - that._properties.lazythreshold && et <= wb + that._properties.lazythreshold; 12240 } 12241 12242 function resizeAreas() { 12243 if (that._elements.areas && that._elements.areas.length > 0) { 12244 for (var i = 0; i < that._elements.areas.length; i++) { 12245 var width = that._elements.image.width; 12246 var height = that._elements.image.height; 12247 12248 if (width && height) { 12249 var relcoords = that._elements.areas[i].dataset.cmpRelcoords; 12250 if (relcoords) { 12251 var relativeCoordinates = relcoords.split(","); 12252 var coordinates = new Array(relativeCoordinates.length); 12253 12254 for (var j = 0; j < coordinates.length; j++) { 12255 if (j % 2 === 0) { 12256 coordinates[j] = parseInt(relativeCoordinates[j] * width); 12257 } else { 12258 coordinates[j] = parseInt(relativeCoordinates[j] * height); 12259 } 12260 } 12261 12262 that._elements.areas[i].coords = coordinates; 12263 } 12264 } 12265 } 12266 } 12267 } 12268 12269 function cacheElements(wrapper) { 12270 that._elements = {}; 12271 that._elements.self = wrapper; 12272 var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 12273 12274 for (var i = 0; i < hooks.length; i++) { 12275 var hook = hooks[i]; 12276 var capitalized = IS; 12277 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 12278 var key = hook.dataset[NS + "Hook" + capitalized]; 12279 that._elements[key] = hook; 12280 } 12281 } 12282 12283 function setupProperties(options) { 12284 that._properties = {}; 12285 12286 for (var key in properties) { 12287 if (properties.hasOwnProperty(key)) { 12288 var property = properties[key]; 12289 if (options && options[key] != null) { 12290 if (property && typeof property.transform === "function") { 12291 that._properties[key] = property.transform(options[key]); 12292 } else { 12293 that._properties[key] = options[key]; 12294 } 12295 } else { 12296 that._properties[key] = properties[key]["default"]; 12297 } 12298 } 12299 } 12300 } 12301 12302 function onWindowResize() { 12303 that.update(); 12304 resizeAreas(); 12305 } 12306 12307 function onLoad() { 12308 resizeAreas(); 12309 } 12310 12311 that.update = function() { 12312 if (that._properties.lazy) { 12313 if (isLazyVisible()) { 12314 loadImage(); 12315 } 12316 } else { 12317 loadImage(); 12318 } 12319 }; 12320 12321 if (config && config.element) { 12322 init(config); 12323 } 12324 } 12325 12326 function onDocumentReady() { 12327 var elements = document.querySelectorAll(selectors.self); 12328 for (var i = 0; i < elements.length; i++) { 12329 new Image({ element: elements[i], options: readData(elements[i]) }); 12330 } 12331 12332 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 12333 var body = document.querySelector("body"); 12334 var observer = new MutationObserver(function(mutations) { 12335 mutations.forEach(function(mutation) { 12336 // needed for IE 12337 var nodesArray = [].slice.call(mutation.addedNodes); 12338 if (nodesArray.length > 0) { 12339 nodesArray.forEach(function(addedNode) { 12340 if (addedNode.querySelectorAll) { 12341 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 12342 elementsArray.forEach(function(element) { 12343 new Image({ element: element, options: readData(element) }); 12344 }); 12345 } 12346 }); 12347 } 12348 }); 12349 }); 12350 12351 observer.observe(body, { 12352 subtree: true, 12353 childList: true, 12354 characterData: true 12355 }); 12356 } 12357 12358 if (document.readyState !== "loading") { 12359 onDocumentReady(); 12360 } else { 12361 document.addEventListener("DOMContentLoaded", onDocumentReady); 12362 } 12363 12364 /* 12365 on drag & drop of the component into a parsys, noscript's content will be escaped multiple times by the editor which creates 12366 the DOM for editing; the HTML parser cannot be used here due to the multiple escaping 12367 */ 12368 function decodeNoscript(text) { 12369 text = text.replace(/&(amp;)*lt;/g, "<"); 12370 text = text.replace(/&(amp;)*gt;/g, ">"); 12371 return text; 12372 } 12373 12374})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.