Rev 637 | Rev 846 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 637 | Rev 679 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /*! |
1 | /*! |
2 | * Bootstrap v5.1.1 (https://getbootstrap.com/) |
2 | * Bootstrap v5.1.3 (https://getbootstrap.com/) |
3 | * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
3 | * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
5 | */ |
5 | */ |
6 | import * as Popper from '@popperjs/core'; |
6 | import * as Popper from '@popperjs/core'; |
7 | 7 | ||
8 | /** |
8 | /** |
9 | * -------------------------------------------------------------------------- |
9 | * -------------------------------------------------------------------------- |
10 | * Bootstrap (v5.1.1): util/index.js |
10 | * Bootstrap (v5.1.3): util/index.js |
11 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
11 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
12 | * -------------------------------------------------------------------------- |
12 | * -------------------------------------------------------------------------- |
13 | */ |
13 | */ |
14 | const MAX_UID = 1000000; |
14 | const MAX_UID = 1000000; |
15 | const MILLISECONDS_MULTIPLIER = 1000; |
15 | const MILLISECONDS_MULTIPLIER = 1000; |
Line 316... | Line 316... | ||
316 | return list[Math.max(0, Math.min(index, listLength - 1))]; |
316 | return list[Math.max(0, Math.min(index, listLength - 1))]; |
317 | }; |
317 | }; |
318 | 318 | ||
319 | /** |
319 | /** |
320 | * -------------------------------------------------------------------------- |
320 | * -------------------------------------------------------------------------- |
321 | * Bootstrap (v5.1.1): dom/event-handler.js |
321 | * Bootstrap (v5.1.3): dom/event-handler.js |
322 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
322 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
323 | * -------------------------------------------------------------------------- |
323 | * -------------------------------------------------------------------------- |
324 | */ |
324 | */ |
325 | /** |
325 | /** |
326 | * ------------------------------------------------------------------------ |
326 | * ------------------------------------------------------------------------ |
Line 604... | Line 604... | ||
604 | 604 | ||
605 | }; |
605 | }; |
606 | 606 | ||
607 | /** |
607 | /** |
608 | * -------------------------------------------------------------------------- |
608 | * -------------------------------------------------------------------------- |
609 | * Bootstrap (v5.1.1): dom/data.js |
609 | * Bootstrap (v5.1.3): dom/data.js |
610 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
610 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
611 | * -------------------------------------------------------------------------- |
611 | * -------------------------------------------------------------------------- |
612 | */ |
612 | */ |
613 | 613 | ||
614 | /** |
614 | /** |
615 | * ------------------------------------------------------------------------ |
615 | * ------------------------------------------------------------------------ |
616 | * Constants |
616 | * Constants |
617 | * ------------------------------------------------------------------------ |
617 | * ------------------------------------------------------------------------ |
618 | */ |
618 | */ |
619 | const elementMap = new Map(); |
619 | const elementMap = new Map(); |
620 | var Data = { |
620 | const Data = { |
621 | set(element, key, instance) { |
621 | set(element, key, instance) { |
622 | if (!elementMap.has(element)) { |
622 | if (!elementMap.has(element)) { |
623 | elementMap.set(element, new Map()); |
623 | elementMap.set(element, new Map()); |
624 | } |
624 | } |
625 | 625 | ||
Line 658... | Line 658... | ||
658 | 658 | ||
659 | }; |
659 | }; |
660 | 660 | ||
661 | /** |
661 | /** |
662 | * -------------------------------------------------------------------------- |
662 | * -------------------------------------------------------------------------- |
663 | * Bootstrap (v5.1.1): base-component.js |
663 | * Bootstrap (v5.1.3): base-component.js |
664 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
664 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
665 | * -------------------------------------------------------------------------- |
665 | * -------------------------------------------------------------------------- |
666 | */ |
666 | */ |
667 | /** |
667 | /** |
668 | * ------------------------------------------------------------------------ |
668 | * ------------------------------------------------------------------------ |
669 | * Constants |
669 | * Constants |
670 | * ------------------------------------------------------------------------ |
670 | * ------------------------------------------------------------------------ |
671 | */ |
671 | */ |
672 | 672 | ||
673 | const VERSION = '5.1.1'; |
673 | const VERSION = '5.1.3'; |
674 | 674 | ||
675 | class BaseComponent { |
675 | class BaseComponent { |
676 | constructor(element) { |
676 | constructor(element) { |
677 | element = getElement(element); |
677 | element = getElement(element); |
678 | 678 | ||
Line 724... | Line 724... | ||
724 | 724 | ||
725 | } |
725 | } |
726 | 726 | ||
727 | /** |
727 | /** |
728 | * -------------------------------------------------------------------------- |
728 | * -------------------------------------------------------------------------- |
729 | * Bootstrap (v5.1.1): util/component-functions.js |
729 | * Bootstrap (v5.1.3): util/component-functions.js |
730 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
730 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
731 | * -------------------------------------------------------------------------- |
731 | * -------------------------------------------------------------------------- |
732 | */ |
732 | */ |
733 | 733 | ||
734 | const enableDismissTrigger = (component, method = 'hide') => { |
734 | const enableDismissTrigger = (component, method = 'hide') => { |
Line 750... | Line 750... | ||
750 | }); |
750 | }); |
751 | }; |
751 | }; |
752 | 752 | ||
753 | /** |
753 | /** |
754 | * -------------------------------------------------------------------------- |
754 | * -------------------------------------------------------------------------- |
755 | * Bootstrap (v5.1.1): alert.js |
755 | * Bootstrap (v5.1.3): alert.js |
756 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
756 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
757 | * -------------------------------------------------------------------------- |
757 | * -------------------------------------------------------------------------- |
758 | */ |
758 | */ |
759 | /** |
759 | /** |
760 | * ------------------------------------------------------------------------ |
760 | * ------------------------------------------------------------------------ |
Line 839... | Line 839... | ||
839 | 839 | ||
840 | defineJQueryPlugin(Alert); |
840 | defineJQueryPlugin(Alert); |
841 | 841 | ||
842 | /** |
842 | /** |
843 | * -------------------------------------------------------------------------- |
843 | * -------------------------------------------------------------------------- |
844 | * Bootstrap (v5.1.1): button.js |
844 | * Bootstrap (v5.1.3): button.js |
845 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
845 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
846 | * -------------------------------------------------------------------------- |
846 | * -------------------------------------------------------------------------- |
847 | */ |
847 | */ |
848 | /** |
848 | /** |
849 | * ------------------------------------------------------------------------ |
849 | * ------------------------------------------------------------------------ |
Line 910... | Line 910... | ||
910 | 910 | ||
911 | defineJQueryPlugin(Button); |
911 | defineJQueryPlugin(Button); |
912 | 912 | ||
913 | /** |
913 | /** |
914 | * -------------------------------------------------------------------------- |
914 | * -------------------------------------------------------------------------- |
915 | * Bootstrap (v5.1.1): dom/manipulator.js |
915 | * Bootstrap (v5.1.3): dom/manipulator.js |
916 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
916 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
917 | * -------------------------------------------------------------------------- |
917 | * -------------------------------------------------------------------------- |
918 | */ |
918 | */ |
919 | function normalizeData(val) { |
919 | function normalizeData(val) { |
920 | if (val === 'true') { |
920 | if (val === 'true') { |
Line 984... | Line 984... | ||
984 | 984 | ||
985 | }; |
985 | }; |
986 | 986 | ||
987 | /** |
987 | /** |
988 | * -------------------------------------------------------------------------- |
988 | * -------------------------------------------------------------------------- |
989 | * Bootstrap (v5.1.1): dom/selector-engine.js |
989 | * Bootstrap (v5.1.3): dom/selector-engine.js |
990 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
990 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
991 | * -------------------------------------------------------------------------- |
991 | * -------------------------------------------------------------------------- |
992 | */ |
992 | */ |
993 | const NODE_TEXT = 3; |
993 | const NODE_TEXT = 3; |
994 | const SelectorEngine = { |
994 | const SelectorEngine = { |
Line 1054... | Line 1054... | ||
1054 | 1054 | ||
1055 | }; |
1055 | }; |
1056 | 1056 | ||
1057 | /** |
1057 | /** |
1058 | * -------------------------------------------------------------------------- |
1058 | * -------------------------------------------------------------------------- |
1059 | * Bootstrap (v5.1.1): carousel.js |
1059 | * Bootstrap (v5.1.3): carousel.js |
1060 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
1060 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
1061 | * -------------------------------------------------------------------------- |
1061 | * -------------------------------------------------------------------------- |
1062 | */ |
1062 | */ |
1063 | /** |
1063 | /** |
1064 | * ------------------------------------------------------------------------ |
1064 | * ------------------------------------------------------------------------ |
Line 1322... | Line 1322... | ||
1322 | this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval); |
1322 | this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval); |
1323 | } |
1323 | } |
1324 | }; |
1324 | }; |
1325 | 1325 | ||
1326 | SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { |
1326 | SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { |
1327 | EventHandler.on(itemImg, EVENT_DRAG_START, e => e.preventDefault()); |
1327 | EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault()); |
1328 | }); |
1328 | }); |
1329 | 1329 | ||
1330 | if (this._pointerEvent) { |
1330 | if (this._pointerEvent) { |
1331 | EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event)); |
1331 | EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event)); |
1332 | EventHandler.on(this._element, EVENT_POINTERUP, event => end(event)); |
1332 | EventHandler.on(this._element, EVENT_POINTERUP, event => end(event)); |
Line 1603... | Line 1603... | ||
1603 | 1603 | ||
1604 | defineJQueryPlugin(Carousel); |
1604 | defineJQueryPlugin(Carousel); |
1605 | 1605 | ||
1606 | /** |
1606 | /** |
1607 | * -------------------------------------------------------------------------- |
1607 | * -------------------------------------------------------------------------- |
1608 | * Bootstrap (v5.1.1): collapse.js |
1608 | * Bootstrap (v5.1.3): collapse.js |
1609 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
1609 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
1610 | * -------------------------------------------------------------------------- |
1610 | * -------------------------------------------------------------------------- |
1611 | */ |
1611 | */ |
1612 | /** |
1612 | /** |
1613 | * ------------------------------------------------------------------------ |
1613 | * ------------------------------------------------------------------------ |
Line 1634... | Line 1634... | ||
1634 | const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`; |
1634 | const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`; |
1635 | const CLASS_NAME_SHOW$7 = 'show'; |
1635 | const CLASS_NAME_SHOW$7 = 'show'; |
1636 | const CLASS_NAME_COLLAPSE = 'collapse'; |
1636 | const CLASS_NAME_COLLAPSE = 'collapse'; |
1637 | const CLASS_NAME_COLLAPSING = 'collapsing'; |
1637 | const CLASS_NAME_COLLAPSING = 'collapsing'; |
1638 | const CLASS_NAME_COLLAPSED = 'collapsed'; |
1638 | const CLASS_NAME_COLLAPSED = 'collapsed'; |
- | 1639 | const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; |
|
1639 | const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; |
1640 | const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; |
1640 | const WIDTH = 'width'; |
1641 | const WIDTH = 'width'; |
1641 | const HEIGHT = 'height'; |
1642 | const HEIGHT = 'height'; |
1642 | const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; |
1643 | const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; |
1643 | const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; |
1644 | const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; |
Line 1703... | Line 1704... | ||
1703 | 1704 | ||
1704 | let actives = []; |
1705 | let actives = []; |
1705 | let activesData; |
1706 | let activesData; |
1706 | 1707 | ||
1707 | if (this._config.parent) { |
1708 | if (this._config.parent) { |
1708 | const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent); |
1709 | const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); |
1709 | actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth |
1710 | actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth |
1710 | } |
1711 | } |
1711 | 1712 | ||
1712 | const container = SelectorEngine.findOne(this._selector); |
1713 | const container = SelectorEngine.findOne(this._selector); |
1713 | 1714 | ||
Line 1841... | Line 1842... | ||
1841 | _initializeChildren() { |
1842 | _initializeChildren() { |
1842 | if (!this._config.parent) { |
1843 | if (!this._config.parent) { |
1843 | return; |
1844 | return; |
1844 | } |
1845 | } |
1845 | 1846 | ||
1846 | const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent); |
1847 | const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); |
1847 | SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => { |
1848 | SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => { |
1848 | const selected = getElementFromSelector(element); |
1849 | const selected = getElementFromSelector(element); |
1849 | 1850 | ||
1850 | if (selected) { |
1851 | if (selected) { |
1851 | this._addAriaAndCollapsedClass([element], this._isShown(selected)); |
1852 | this._addAriaAndCollapsedClass([element], this._isShown(selected)); |
Line 1921... | Line 1922... | ||
1921 | 1922 | ||
1922 | defineJQueryPlugin(Collapse); |
1923 | defineJQueryPlugin(Collapse); |
1923 | 1924 | ||
1924 | /** |
1925 | /** |
1925 | * -------------------------------------------------------------------------- |
1926 | * -------------------------------------------------------------------------- |
1926 | * Bootstrap (v5.1.1): dropdown.js |
1927 | * Bootstrap (v5.1.3): dropdown.js |
1927 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
1928 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
1928 | * -------------------------------------------------------------------------- |
1929 | * -------------------------------------------------------------------------- |
1929 | */ |
1930 | */ |
1930 | /** |
1931 | /** |
1931 | * ------------------------------------------------------------------------ |
1932 | * ------------------------------------------------------------------------ |
Line 2383... | Line 2384... | ||
2383 | 2384 | ||
2384 | defineJQueryPlugin(Dropdown); |
2385 | defineJQueryPlugin(Dropdown); |
2385 | 2386 | ||
2386 | /** |
2387 | /** |
2387 | * -------------------------------------------------------------------------- |
2388 | * -------------------------------------------------------------------------- |
2388 | * Bootstrap (v5.1.1): util/scrollBar.js |
2389 | * Bootstrap (v5.1.3): util/scrollBar.js |
2389 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
2390 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
2390 | * -------------------------------------------------------------------------- |
2391 | * -------------------------------------------------------------------------- |
2391 | */ |
2392 | */ |
2392 | const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; |
2393 | const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; |
2393 | const SELECTOR_STICKY_CONTENT = '.sticky-top'; |
2394 | const SELECTOR_STICKY_CONTENT = '.sticky-top'; |
Line 2487... | Line 2488... | ||
2487 | 2488 | ||
2488 | } |
2489 | } |
2489 | 2490 | ||
2490 | /** |
2491 | /** |
2491 | * -------------------------------------------------------------------------- |
2492 | * -------------------------------------------------------------------------- |
2492 | * Bootstrap (v5.1.1): util/backdrop.js |
2493 | * Bootstrap (v5.1.3): util/backdrop.js |
2493 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
2494 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
2494 | * -------------------------------------------------------------------------- |
2495 | * -------------------------------------------------------------------------- |
2495 | */ |
2496 | */ |
2496 | const Default$7 = { |
2497 | const Default$7 = { |
2497 | className: 'modal-backdrop', |
2498 | className: 'modal-backdrop', |
2498 | isVisible: true, |
2499 | isVisible: true, |
Line 2611... | Line 2612... | ||
2611 | 2612 | ||
2612 | } |
2613 | } |
2613 | 2614 | ||
2614 | /** |
2615 | /** |
2615 | * -------------------------------------------------------------------------- |
2616 | * -------------------------------------------------------------------------- |
2616 | * Bootstrap (v5.1.1): util/focustrap.js |
2617 | * Bootstrap (v5.1.3): util/focustrap.js |
2617 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
2618 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
2618 | * -------------------------------------------------------------------------- |
2619 | * -------------------------------------------------------------------------- |
2619 | */ |
2620 | */ |
2620 | const Default$6 = { |
2621 | const Default$6 = { |
2621 | trapElement: null, |
2622 | trapElement: null, |
2622 | // The element to trap focus inside of |
2623 | // The element to trap focus inside of |
Line 2714... | Line 2715... | ||
2714 | 2715 | ||
2715 | } |
2716 | } |
2716 | 2717 | ||
2717 | /** |
2718 | /** |
2718 | * -------------------------------------------------------------------------- |
2719 | * -------------------------------------------------------------------------- |
2719 | * Bootstrap (v5.1.1): modal.js |
2720 | * Bootstrap (v5.1.3): modal.js |
2720 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
2721 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
2721 | * -------------------------------------------------------------------------- |
2722 | * -------------------------------------------------------------------------- |
2722 | */ |
2723 | */ |
2723 | /** |
2724 | /** |
2724 | * ------------------------------------------------------------------------ |
2725 | * ------------------------------------------------------------------------ |
Line 3143... | Line 3144... | ||
3143 | 3144 | ||
3144 | defineJQueryPlugin(Modal); |
3145 | defineJQueryPlugin(Modal); |
3145 | 3146 | ||
3146 | /** |
3147 | /** |
3147 | * -------------------------------------------------------------------------- |
3148 | * -------------------------------------------------------------------------- |
3148 | * Bootstrap (v5.1.1): offcanvas.js |
3149 | * Bootstrap (v5.1.3): offcanvas.js |
3149 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
3150 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
3150 | * -------------------------------------------------------------------------- |
3151 | * -------------------------------------------------------------------------- |
3151 | */ |
3152 | */ |
3152 | /** |
3153 | /** |
3153 | * ------------------------------------------------------------------------ |
3154 | * ------------------------------------------------------------------------ |
3154 | * Constants |
3155 | * Constants |
Line 3399... | Line 3400... | ||
3399 | 3400 | ||
3400 | defineJQueryPlugin(Offcanvas); |
3401 | defineJQueryPlugin(Offcanvas); |
3401 | 3402 | ||
3402 | /** |
3403 | /** |
3403 | * -------------------------------------------------------------------------- |
3404 | * -------------------------------------------------------------------------- |
3404 | * Bootstrap (v5.1.1): util/sanitizer.js |
3405 | * Bootstrap (v5.1.3): util/sanitizer.js |
3405 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
3406 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
3406 | * -------------------------------------------------------------------------- |
3407 | * -------------------------------------------------------------------------- |
3407 | */ |
3408 | */ |
3408 | const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); |
3409 | const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); |
3409 | const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; |
3410 | const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; |
3410 | /** |
3411 | /** |
3411 | * A pattern that recognizes a commonly useful subset of URLs that are safe. |
3412 | * A pattern that recognizes a commonly useful subset of URLs that are safe. |
3412 | * |
3413 | * |
3413 | * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts |
3414 | * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts |
3414 | */ |
3415 | */ |
3415 | 3416 | ||
3416 | const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i; |
3417 | const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; |
3417 | /** |
3418 | /** |
3418 | * A pattern that matches safe data URLs. Only matches image, video and audio types. |
3419 | * A pattern that matches safe data URLs. Only matches image, video and audio types. |
3419 | * |
3420 | * |
3420 | * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts |
3421 | * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts |
3421 | */ |
3422 | */ |
3422 | 3423 | ||
3423 | const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; |
3424 | const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; |
3424 | 3425 | ||
3425 | const allowedAttribute = (attr, allowedAttributeList) => { |
3426 | const allowedAttribute = (attribute, allowedAttributeList) => { |
3426 | const attrName = attr.nodeName.toLowerCase(); |
3427 | const attributeName = attribute.nodeName.toLowerCase(); |
3427 | 3428 | ||
3428 | if (allowedAttributeList.includes(attrName)) { |
3429 | if (allowedAttributeList.includes(attributeName)) { |
3429 | if (uriAttrs.has(attrName)) { |
3430 | if (uriAttributes.has(attributeName)) { |
3430 | return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); |
3431 | return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue)); |
3431 | } |
3432 | } |
3432 | 3433 | ||
3433 | return true; |
3434 | return true; |
3434 | } |
3435 | } |
3435 | 3436 | ||
3436 | const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute. |
3437 | const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute. |
3437 | 3438 | ||
3438 | for (let i = 0, len = regExp.length; i < len; i++) { |
3439 | for (let i = 0, len = regExp.length; i < len; i++) { |
3439 | if (regExp[i].test(attrName)) { |
3440 | if (regExp[i].test(attributeName)) { |
3440 | return true; |
3441 | return true; |
3441 | } |
3442 | } |
3442 | } |
3443 | } |
3443 | 3444 | ||
3444 | return false; |
3445 | return false; |
Line 3486... | Line 3487... | ||
3486 | return sanitizeFn(unsafeHtml); |
3487 | return sanitizeFn(unsafeHtml); |
3487 | } |
3488 | } |
3488 | 3489 | ||
3489 | const domParser = new window.DOMParser(); |
3490 | const domParser = new window.DOMParser(); |
3490 | const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); |
3491 | const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); |
3491 | const allowlistKeys = Object.keys(allowList); |
- | |
3492 | const elements = [].concat(...createdDocument.body.querySelectorAll('*')); |
3492 | const elements = [].concat(...createdDocument.body.querySelectorAll('*')); |
3493 | 3493 | ||
3494 | for (let i = 0, len = elements.length; i < len; i++) { |
3494 | for (let i = 0, len = elements.length; i < len; i++) { |
3495 | const el = elements[i]; |
3495 | const element = elements[i]; |
3496 | const elName = el.nodeName.toLowerCase(); |
3496 | const elementName = element.nodeName.toLowerCase(); |
3497 | 3497 | ||
3498 | if (!allowlistKeys.includes(elName)) { |
3498 | if (!Object.keys(allowList).includes(elementName)) { |
3499 | el.remove(); |
3499 | element.remove(); |
3500 | continue; |
3500 | continue; |
3501 | } |
3501 | } |
3502 | 3502 | ||
3503 | const attributeList = [].concat(...el.attributes); |
3503 | const attributeList = [].concat(...element.attributes); |
3504 | const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []); |
3504 | const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); |
3505 | attributeList.forEach(attr => { |
3505 | attributeList.forEach(attribute => { |
3506 | if (!allowedAttribute(attr, allowedAttributes)) { |
3506 | if (!allowedAttribute(attribute, allowedAttributes)) { |
3507 | el.removeAttribute(attr.nodeName); |
3507 | element.removeAttribute(attribute.nodeName); |
3508 | } |
3508 | } |
3509 | }); |
3509 | }); |
3510 | } |
3510 | } |
3511 | 3511 | ||
3512 | return createdDocument.body.innerHTML; |
3512 | return createdDocument.body.innerHTML; |
3513 | } |
3513 | } |
3514 | 3514 | ||
3515 | /** |
3515 | /** |
3516 | * -------------------------------------------------------------------------- |
3516 | * -------------------------------------------------------------------------- |
3517 | * Bootstrap (v5.1.1): tooltip.js |
3517 | * Bootstrap (v5.1.3): tooltip.js |
3518 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
3518 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
3519 | * -------------------------------------------------------------------------- |
3519 | * -------------------------------------------------------------------------- |
3520 | */ |
3520 | */ |
3521 | /** |
3521 | /** |
3522 | * ------------------------------------------------------------------------ |
3522 | * ------------------------------------------------------------------------ |
Line 4222... | Line 4222... | ||
4222 | 4222 | ||
4223 | defineJQueryPlugin(Tooltip); |
4223 | defineJQueryPlugin(Tooltip); |
4224 | 4224 | ||
4225 | /** |
4225 | /** |
4226 | * -------------------------------------------------------------------------- |
4226 | * -------------------------------------------------------------------------- |
4227 | * Bootstrap (v5.1.1): popover.js |
4227 | * Bootstrap (v5.1.3): popover.js |
4228 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4228 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4229 | * -------------------------------------------------------------------------- |
4229 | * -------------------------------------------------------------------------- |
4230 | */ |
4230 | */ |
4231 | /** |
4231 | /** |
4232 | * ------------------------------------------------------------------------ |
4232 | * ------------------------------------------------------------------------ |
Line 4332... | Line 4332... | ||
4332 | 4332 | ||
4333 | defineJQueryPlugin(Popover); |
4333 | defineJQueryPlugin(Popover); |
4334 | 4334 | ||
4335 | /** |
4335 | /** |
4336 | * -------------------------------------------------------------------------- |
4336 | * -------------------------------------------------------------------------- |
4337 | * Bootstrap (v5.1.1): scrollspy.js |
4337 | * Bootstrap (v5.1.3): scrollspy.js |
4338 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4338 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4339 | * -------------------------------------------------------------------------- |
4339 | * -------------------------------------------------------------------------- |
4340 | */ |
4340 | */ |
4341 | /** |
4341 | /** |
4342 | * ------------------------------------------------------------------------ |
4342 | * ------------------------------------------------------------------------ |
Line 4567... | Line 4567... | ||
4567 | 4567 | ||
4568 | defineJQueryPlugin(ScrollSpy); |
4568 | defineJQueryPlugin(ScrollSpy); |
4569 | 4569 | ||
4570 | /** |
4570 | /** |
4571 | * -------------------------------------------------------------------------- |
4571 | * -------------------------------------------------------------------------- |
4572 | * Bootstrap (v5.1.1): tab.js |
4572 | * Bootstrap (v5.1.3): tab.js |
4573 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4573 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4574 | * -------------------------------------------------------------------------- |
4574 | * -------------------------------------------------------------------------- |
4575 | */ |
4575 | */ |
4576 | /** |
4576 | /** |
4577 | * ------------------------------------------------------------------------ |
4577 | * ------------------------------------------------------------------------ |
Line 4765... | Line 4765... | ||
4765 | 4765 | ||
4766 | defineJQueryPlugin(Tab); |
4766 | defineJQueryPlugin(Tab); |
4767 | 4767 | ||
4768 | /** |
4768 | /** |
4769 | * -------------------------------------------------------------------------- |
4769 | * -------------------------------------------------------------------------- |
4770 | * Bootstrap (v5.1.1): toast.js |
4770 | * Bootstrap (v5.1.3): toast.js |
4771 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4771 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4772 | * -------------------------------------------------------------------------- |
4772 | * -------------------------------------------------------------------------- |
4773 | */ |
4773 | */ |
4774 | /** |
4774 | /** |
4775 | * ------------------------------------------------------------------------ |
4775 | * ------------------------------------------------------------------------ |