publishing_platform_publishing_components 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +2 -0
- data/Rakefile +41 -0
- data/app/assets/builds/gemkeep +0 -0
- data/app/assets/config/publishing_platform_publishing_components_manifest.js +2 -0
- data/app/assets/images/publishing_platform_publishing_components/gemkeep +0 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/_all_components.scss +3 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/components/_attachment.scss +117 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/components/_summary-list.scss +169 -0
- data/app/controllers/publishing_platform_publishing_components/application_controller.rb +4 -0
- data/app/helpers/publishing_platform_publishing_components/application_helper.rb +4 -0
- data/app/models/publishing_platform_publishing_components/component_doc.rb +90 -0
- data/app/models/publishing_platform_publishing_components/component_docs.rb +57 -0
- data/app/models/publishing_platform_publishing_components/component_example.rb +104 -0
- data/app/models/publishing_platform_publishing_components/shared_accessibility_criteria.rb +37 -0
- data/app/views/publishing_platform_publishing_components/component_doc/_component_output.html.erb +15 -0
- data/app/views/publishing_platform_publishing_components/components/_attachment.html.erb +91 -0
- data/app/views/publishing_platform_publishing_components/components/_error_summary.html.erb +38 -0
- data/app/views/publishing_platform_publishing_components/components/_summary_list.html.erb +135 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_document.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_external.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_generic.html.erb +4 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_html.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_pdf.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb +5 -0
- data/app/views/publishing_platform_publishing_components/components/docs/attachment.yml +104 -0
- data/app/views/publishing_platform_publishing_components/components/docs/error_summary.yml +51 -0
- data/app/views/publishing_platform_publishing_components/components/docs/summary_list.yml +137 -0
- data/config/initializers/assets.rb +24 -0
- data/config/routes.rb +2 -0
- data/lib/publishing_platform_publishing_components/config.rb +25 -0
- data/lib/publishing_platform_publishing_components/engine.rb +5 -0
- data/lib/publishing_platform_publishing_components/presenters/attachment_helper.rb +176 -0
- data/lib/publishing_platform_publishing_components/presenters/component_wrapper_helper.rb +290 -0
- data/lib/publishing_platform_publishing_components/presenters/shared_helper.rb +24 -0
- data/lib/publishing_platform_publishing_components/version.rb +3 -0
- data/lib/publishing_platform_publishing_components.rb +10 -0
- data/lib/tasks/publishing_platform_publishing_components_tasks.rake +4 -0
- data/node_modules/bootstrap/LICENSE +21 -0
- data/node_modules/bootstrap/README.md +246 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css +4085 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css +4084 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css +601 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css +598 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css +5406 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css +5397 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.css +12048 -0
- data/node_modules/bootstrap/dist/css/bootstrap.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css +12021 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js +6312 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js +4447 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js +4494 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js.map +1 -0
- data/node_modules/bootstrap/js/dist/alert.js +90 -0
- data/node_modules/bootstrap/js/dist/alert.js.map +1 -0
- data/node_modules/bootstrap/js/dist/base-component.js +86 -0
- data/node_modules/bootstrap/js/dist/base-component.js.map +1 -0
- data/node_modules/bootstrap/js/dist/button.js +79 -0
- data/node_modules/bootstrap/js/dist/button.js.map +1 -0
- data/node_modules/bootstrap/js/dist/carousel.js +388 -0
- data/node_modules/bootstrap/js/dist/carousel.js.map +1 -0
- data/node_modules/bootstrap/js/dist/collapse.js +249 -0
- data/node_modules/bootstrap/js/dist/collapse.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/data.js +63 -0
- data/node_modules/bootstrap/js/dist/dom/data.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/event-handler.js +237 -0
- data/node_modules/bootstrap/js/dist/dom/event-handler.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/manipulator.js +72 -0
- data/node_modules/bootstrap/js/dist/dom/manipulator.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js +104 -0
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dropdown.js +402 -0
- data/node_modules/bootstrap/js/dist/dropdown.js.map +1 -0
- data/node_modules/bootstrap/js/dist/modal.js +320 -0
- data/node_modules/bootstrap/js/dist/modal.js.map +1 -0
- data/node_modules/bootstrap/js/dist/offcanvas.js +246 -0
- data/node_modules/bootstrap/js/dist/offcanvas.js.map +1 -0
- data/node_modules/bootstrap/js/dist/popover.js +96 -0
- data/node_modules/bootstrap/js/dist/popover.js.map +1 -0
- data/node_modules/bootstrap/js/dist/scrollspy.js +275 -0
- data/node_modules/bootstrap/js/dist/scrollspy.js.map +1 -0
- data/node_modules/bootstrap/js/dist/tab.js +285 -0
- data/node_modules/bootstrap/js/dist/tab.js.map +1 -0
- data/node_modules/bootstrap/js/dist/toast.js +198 -0
- data/node_modules/bootstrap/js/dist/toast.js.map +1 -0
- data/node_modules/bootstrap/js/dist/tooltip.js +546 -0
- data/node_modules/bootstrap/js/dist/tooltip.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/backdrop.js +139 -0
- data/node_modules/bootstrap/js/dist/util/backdrop.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/component-functions.js +42 -0
- data/node_modules/bootstrap/js/dist/util/component-functions.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/config.js +68 -0
- data/node_modules/bootstrap/js/dist/util/config.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/focustrap.js +113 -0
- data/node_modules/bootstrap/js/dist/util/focustrap.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/index.js +281 -0
- data/node_modules/bootstrap/js/dist/util/index.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/sanitizer.js +113 -0
- data/node_modules/bootstrap/js/dist/util/sanitizer.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/scrollbar.js +113 -0
- data/node_modules/bootstrap/js/dist/util/scrollbar.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/swipe.js +135 -0
- data/node_modules/bootstrap/js/dist/util/swipe.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/template-factory.js +151 -0
- data/node_modules/bootstrap/js/dist/util/template-factory.js.map +1 -0
- data/node_modules/bootstrap/js/index.esm.js +19 -0
- data/node_modules/bootstrap/js/index.umd.js +34 -0
- data/node_modules/bootstrap/js/src/alert.js +87 -0
- data/node_modules/bootstrap/js/src/base-component.js +86 -0
- data/node_modules/bootstrap/js/src/button.js +72 -0
- data/node_modules/bootstrap/js/src/carousel.js +474 -0
- data/node_modules/bootstrap/js/src/collapse.js +297 -0
- data/node_modules/bootstrap/js/src/dom/data.js +55 -0
- data/node_modules/bootstrap/js/src/dom/event-handler.js +317 -0
- data/node_modules/bootstrap/js/src/dom/manipulator.js +71 -0
- data/node_modules/bootstrap/js/src/dom/selector-engine.js +126 -0
- data/node_modules/bootstrap/js/src/dropdown.js +455 -0
- data/node_modules/bootstrap/js/src/modal.js +378 -0
- data/node_modules/bootstrap/js/src/offcanvas.js +282 -0
- data/node_modules/bootstrap/js/src/popover.js +97 -0
- data/node_modules/bootstrap/js/src/scrollspy.js +296 -0
- data/node_modules/bootstrap/js/src/tab.js +315 -0
- data/node_modules/bootstrap/js/src/toast.js +224 -0
- data/node_modules/bootstrap/js/src/tooltip.js +633 -0
- data/node_modules/bootstrap/js/src/util/backdrop.js +151 -0
- data/node_modules/bootstrap/js/src/util/component-functions.js +35 -0
- data/node_modules/bootstrap/js/src/util/config.js +65 -0
- data/node_modules/bootstrap/js/src/util/focustrap.js +115 -0
- data/node_modules/bootstrap/js/src/util/index.js +306 -0
- data/node_modules/bootstrap/js/src/util/sanitizer.js +116 -0
- data/node_modules/bootstrap/js/src/util/scrollbar.js +114 -0
- data/node_modules/bootstrap/js/src/util/swipe.js +146 -0
- data/node_modules/bootstrap/js/src/util/template-factory.js +160 -0
- data/node_modules/bootstrap/package.json +210 -0
- data/node_modules/bootstrap/scss/_accordion.scss +153 -0
- data/node_modules/bootstrap/scss/_alert.scss +68 -0
- data/node_modules/bootstrap/scss/_badge.scss +38 -0
- data/node_modules/bootstrap/scss/_breadcrumb.scss +40 -0
- data/node_modules/bootstrap/scss/_button-group.scss +147 -0
- data/node_modules/bootstrap/scss/_buttons.scss +216 -0
- data/node_modules/bootstrap/scss/_card.scss +238 -0
- data/node_modules/bootstrap/scss/_carousel.scss +226 -0
- data/node_modules/bootstrap/scss/_close.scss +66 -0
- data/node_modules/bootstrap/scss/_containers.scss +41 -0
- data/node_modules/bootstrap/scss/_dropdown.scss +250 -0
- data/node_modules/bootstrap/scss/_forms.scss +9 -0
- data/node_modules/bootstrap/scss/_functions.scss +302 -0
- data/node_modules/bootstrap/scss/_grid.scss +39 -0
- data/node_modules/bootstrap/scss/_helpers.scss +12 -0
- data/node_modules/bootstrap/scss/_images.scss +42 -0
- data/node_modules/bootstrap/scss/_list-group.scss +199 -0
- data/node_modules/bootstrap/scss/_maps.scss +174 -0
- data/node_modules/bootstrap/scss/_mixins.scss +42 -0
- data/node_modules/bootstrap/scss/_modal.scss +240 -0
- data/node_modules/bootstrap/scss/_nav.scss +197 -0
- data/node_modules/bootstrap/scss/_navbar.scss +289 -0
- data/node_modules/bootstrap/scss/_offcanvas.scss +147 -0
- data/node_modules/bootstrap/scss/_pagination.scss +109 -0
- data/node_modules/bootstrap/scss/_placeholders.scss +51 -0
- data/node_modules/bootstrap/scss/_popover.scss +196 -0
- data/node_modules/bootstrap/scss/_progress.scss +68 -0
- data/node_modules/bootstrap/scss/_reboot.scss +617 -0
- data/node_modules/bootstrap/scss/_root.scss +187 -0
- data/node_modules/bootstrap/scss/_spinners.scss +86 -0
- data/node_modules/bootstrap/scss/_tables.scss +171 -0
- data/node_modules/bootstrap/scss/_toasts.scss +73 -0
- data/node_modules/bootstrap/scss/_tooltip.scss +119 -0
- data/node_modules/bootstrap/scss/_transitions.scss +27 -0
- data/node_modules/bootstrap/scss/_type.scss +106 -0
- data/node_modules/bootstrap/scss/_utilities.scss +806 -0
- data/node_modules/bootstrap/scss/_variables-dark.scss +102 -0
- data/node_modules/bootstrap/scss/_variables.scss +1753 -0
- data/node_modules/bootstrap/scss/bootstrap-grid.scss +62 -0
- data/node_modules/bootstrap/scss/bootstrap-reboot.scss +10 -0
- data/node_modules/bootstrap/scss/bootstrap-utilities.scss +19 -0
- data/node_modules/bootstrap/scss/bootstrap.scss +52 -0
- data/node_modules/bootstrap/scss/forms/_floating-labels.scss +97 -0
- data/node_modules/bootstrap/scss/forms/_form-check.scss +189 -0
- data/node_modules/bootstrap/scss/forms/_form-control.scss +214 -0
- data/node_modules/bootstrap/scss/forms/_form-range.scss +91 -0
- data/node_modules/bootstrap/scss/forms/_form-select.scss +80 -0
- data/node_modules/bootstrap/scss/forms/_form-text.scss +11 -0
- data/node_modules/bootstrap/scss/forms/_input-group.scss +132 -0
- data/node_modules/bootstrap/scss/forms/_labels.scss +36 -0
- data/node_modules/bootstrap/scss/forms/_validation.scss +12 -0
- data/node_modules/bootstrap/scss/helpers/_clearfix.scss +3 -0
- data/node_modules/bootstrap/scss/helpers/_color-bg.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_colored-links.scss +30 -0
- data/node_modules/bootstrap/scss/helpers/_focus-ring.scss +5 -0
- data/node_modules/bootstrap/scss/helpers/_icon-link.scss +25 -0
- data/node_modules/bootstrap/scss/helpers/_position.scss +36 -0
- data/node_modules/bootstrap/scss/helpers/_ratio.scss +26 -0
- data/node_modules/bootstrap/scss/helpers/_stacks.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_stretched-link.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_text-truncation.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
- data/node_modules/bootstrap/scss/helpers/_vr.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_alert.scss +18 -0
- data/node_modules/bootstrap/scss/mixins/_backdrop.scss +14 -0
- data/node_modules/bootstrap/scss/mixins/_banner.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_border-radius.scss +78 -0
- data/node_modules/bootstrap/scss/mixins/_box-shadow.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_breakpoints.scss +127 -0
- data/node_modules/bootstrap/scss/mixins/_buttons.scss +70 -0
- data/node_modules/bootstrap/scss/mixins/_caret.scss +69 -0
- data/node_modules/bootstrap/scss/mixins/_clearfix.scss +9 -0
- data/node_modules/bootstrap/scss/mixins/_color-mode.scss +21 -0
- data/node_modules/bootstrap/scss/mixins/_color-scheme.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_container.scss +11 -0
- data/node_modules/bootstrap/scss/mixins/_deprecate.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_forms.scss +163 -0
- data/node_modules/bootstrap/scss/mixins/_gradients.scss +47 -0
- data/node_modules/bootstrap/scss/mixins/_grid.scss +151 -0
- data/node_modules/bootstrap/scss/mixins/_image.scss +16 -0
- data/node_modules/bootstrap/scss/mixins/_list-group.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_lists.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_pagination.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_reset-text.scss +17 -0
- data/node_modules/bootstrap/scss/mixins/_resize.scss +6 -0
- data/node_modules/bootstrap/scss/mixins/_table-variants.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_text-truncate.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_transition.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_utilities.scss +97 -0
- data/node_modules/bootstrap/scss/mixins/_visually-hidden.scss +38 -0
- data/node_modules/bootstrap/scss/utilities/_api.scss +47 -0
- data/node_modules/bootstrap/scss/vendor/_rfs.scss +348 -0
- metadata +448 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap index.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Index = {}));
|
|
10
|
+
})(this, (function (exports) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap util/index.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const MAX_UID = 1000000;
|
|
20
|
+
const MILLISECONDS_MULTIPLIER = 1000;
|
|
21
|
+
const TRANSITION_END = 'transitionend';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Properly escape IDs selectors to handle weird IDs
|
|
25
|
+
* @param {string} selector
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
const parseSelector = selector => {
|
|
29
|
+
if (selector && window.CSS && window.CSS.escape) {
|
|
30
|
+
// document.querySelector needs escaping to handle IDs (html5+) containing for instance /
|
|
31
|
+
selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
|
|
32
|
+
}
|
|
33
|
+
return selector;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Shout-out Angus Croll (https://goo.gl/pxwQGp)
|
|
37
|
+
const toType = object => {
|
|
38
|
+
if (object === null || object === undefined) {
|
|
39
|
+
return `${object}`;
|
|
40
|
+
}
|
|
41
|
+
return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Public Util API
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
const getUID = prefix => {
|
|
49
|
+
do {
|
|
50
|
+
prefix += Math.floor(Math.random() * MAX_UID);
|
|
51
|
+
} while (document.getElementById(prefix));
|
|
52
|
+
return prefix;
|
|
53
|
+
};
|
|
54
|
+
const getTransitionDurationFromElement = element => {
|
|
55
|
+
if (!element) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Get transition-duration of the element
|
|
60
|
+
let {
|
|
61
|
+
transitionDuration,
|
|
62
|
+
transitionDelay
|
|
63
|
+
} = window.getComputedStyle(element);
|
|
64
|
+
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
|
65
|
+
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
|
66
|
+
|
|
67
|
+
// Return 0 if element or transition duration is not found
|
|
68
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// If multiple durations are defined, take the first
|
|
73
|
+
transitionDuration = transitionDuration.split(',')[0];
|
|
74
|
+
transitionDelay = transitionDelay.split(',')[0];
|
|
75
|
+
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
|
76
|
+
};
|
|
77
|
+
const triggerTransitionEnd = element => {
|
|
78
|
+
element.dispatchEvent(new Event(TRANSITION_END));
|
|
79
|
+
};
|
|
80
|
+
const isElement = object => {
|
|
81
|
+
if (!object || typeof object !== 'object') {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (typeof object.jquery !== 'undefined') {
|
|
85
|
+
object = object[0];
|
|
86
|
+
}
|
|
87
|
+
return typeof object.nodeType !== 'undefined';
|
|
88
|
+
};
|
|
89
|
+
const getElement = object => {
|
|
90
|
+
// it's a jQuery object or a node element
|
|
91
|
+
if (isElement(object)) {
|
|
92
|
+
return object.jquery ? object[0] : object;
|
|
93
|
+
}
|
|
94
|
+
if (typeof object === 'string' && object.length > 0) {
|
|
95
|
+
return document.querySelector(parseSelector(object));
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
};
|
|
99
|
+
const isVisible = element => {
|
|
100
|
+
if (!isElement(element) || element.getClientRects().length === 0) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible';
|
|
104
|
+
// Handle `details` element as its content may falsie appear visible when it is closed
|
|
105
|
+
const closedDetails = element.closest('details:not([open])');
|
|
106
|
+
if (!closedDetails) {
|
|
107
|
+
return elementIsVisible;
|
|
108
|
+
}
|
|
109
|
+
if (closedDetails !== element) {
|
|
110
|
+
const summary = element.closest('summary');
|
|
111
|
+
if (summary && summary.parentNode !== closedDetails) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (summary === null) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return elementIsVisible;
|
|
119
|
+
};
|
|
120
|
+
const isDisabled = element => {
|
|
121
|
+
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
if (element.classList.contains('disabled')) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
if (typeof element.disabled !== 'undefined') {
|
|
128
|
+
return element.disabled;
|
|
129
|
+
}
|
|
130
|
+
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
|
131
|
+
};
|
|
132
|
+
const findShadowRoot = element => {
|
|
133
|
+
if (!document.documentElement.attachShadow) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Can find the shadow root otherwise it'll return the document
|
|
138
|
+
if (typeof element.getRootNode === 'function') {
|
|
139
|
+
const root = element.getRootNode();
|
|
140
|
+
return root instanceof ShadowRoot ? root : null;
|
|
141
|
+
}
|
|
142
|
+
if (element instanceof ShadowRoot) {
|
|
143
|
+
return element;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// when we don't find a shadow root
|
|
147
|
+
if (!element.parentNode) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return findShadowRoot(element.parentNode);
|
|
151
|
+
};
|
|
152
|
+
const noop = () => {};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Trick to restart an element's animation
|
|
156
|
+
*
|
|
157
|
+
* @param {HTMLElement} element
|
|
158
|
+
* @return void
|
|
159
|
+
*
|
|
160
|
+
* @see https://www.harrytheo.com/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
|
161
|
+
*/
|
|
162
|
+
const reflow = element => {
|
|
163
|
+
element.offsetHeight; // eslint-disable-line no-unused-expressions
|
|
164
|
+
};
|
|
165
|
+
const getjQuery = () => {
|
|
166
|
+
if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
|
167
|
+
return window.jQuery;
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
};
|
|
171
|
+
const DOMContentLoadedCallbacks = [];
|
|
172
|
+
const onDOMContentLoaded = callback => {
|
|
173
|
+
if (document.readyState === 'loading') {
|
|
174
|
+
// add listener on the first call when the document is in loading state
|
|
175
|
+
if (!DOMContentLoadedCallbacks.length) {
|
|
176
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
177
|
+
for (const callback of DOMContentLoadedCallbacks) {
|
|
178
|
+
callback();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
DOMContentLoadedCallbacks.push(callback);
|
|
183
|
+
} else {
|
|
184
|
+
callback();
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const isRTL = () => document.documentElement.dir === 'rtl';
|
|
188
|
+
const defineJQueryPlugin = plugin => {
|
|
189
|
+
onDOMContentLoaded(() => {
|
|
190
|
+
const $ = getjQuery();
|
|
191
|
+
/* istanbul ignore if */
|
|
192
|
+
if ($) {
|
|
193
|
+
const name = plugin.NAME;
|
|
194
|
+
const JQUERY_NO_CONFLICT = $.fn[name];
|
|
195
|
+
$.fn[name] = plugin.jQueryInterface;
|
|
196
|
+
$.fn[name].Constructor = plugin;
|
|
197
|
+
$.fn[name].noConflict = () => {
|
|
198
|
+
$.fn[name] = JQUERY_NO_CONFLICT;
|
|
199
|
+
return plugin.jQueryInterface;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
|
|
205
|
+
return typeof possibleCallback === 'function' ? possibleCallback.call(...args) : defaultValue;
|
|
206
|
+
};
|
|
207
|
+
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
|
|
208
|
+
if (!waitForTransition) {
|
|
209
|
+
execute(callback);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const durationPadding = 5;
|
|
213
|
+
const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
|
214
|
+
let called = false;
|
|
215
|
+
const handler = ({
|
|
216
|
+
target
|
|
217
|
+
}) => {
|
|
218
|
+
if (target !== transitionElement) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
called = true;
|
|
222
|
+
transitionElement.removeEventListener(TRANSITION_END, handler);
|
|
223
|
+
execute(callback);
|
|
224
|
+
};
|
|
225
|
+
transitionElement.addEventListener(TRANSITION_END, handler);
|
|
226
|
+
setTimeout(() => {
|
|
227
|
+
if (!called) {
|
|
228
|
+
triggerTransitionEnd(transitionElement);
|
|
229
|
+
}
|
|
230
|
+
}, emulatedDuration);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Return the previous/next element of a list.
|
|
235
|
+
*
|
|
236
|
+
* @param {array} list The list of elements
|
|
237
|
+
* @param activeElement The active element
|
|
238
|
+
* @param shouldGetNext Choose to get next or previous element
|
|
239
|
+
* @param isCycleAllowed
|
|
240
|
+
* @return {Element|elem} The proper element
|
|
241
|
+
*/
|
|
242
|
+
const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
|
|
243
|
+
const listLength = list.length;
|
|
244
|
+
let index = list.indexOf(activeElement);
|
|
245
|
+
|
|
246
|
+
// if the element does not exist in the list return an element
|
|
247
|
+
// depending on the direction and if cycle is allowed
|
|
248
|
+
if (index === -1) {
|
|
249
|
+
return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
|
|
250
|
+
}
|
|
251
|
+
index += shouldGetNext ? 1 : -1;
|
|
252
|
+
if (isCycleAllowed) {
|
|
253
|
+
index = (index + listLength) % listLength;
|
|
254
|
+
}
|
|
255
|
+
return list[Math.max(0, Math.min(index, listLength - 1))];
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
exports.defineJQueryPlugin = defineJQueryPlugin;
|
|
259
|
+
exports.execute = execute;
|
|
260
|
+
exports.executeAfterTransition = executeAfterTransition;
|
|
261
|
+
exports.findShadowRoot = findShadowRoot;
|
|
262
|
+
exports.getElement = getElement;
|
|
263
|
+
exports.getNextActiveElement = getNextActiveElement;
|
|
264
|
+
exports.getTransitionDurationFromElement = getTransitionDurationFromElement;
|
|
265
|
+
exports.getUID = getUID;
|
|
266
|
+
exports.getjQuery = getjQuery;
|
|
267
|
+
exports.isDisabled = isDisabled;
|
|
268
|
+
exports.isElement = isElement;
|
|
269
|
+
exports.isRTL = isRTL;
|
|
270
|
+
exports.isVisible = isVisible;
|
|
271
|
+
exports.noop = noop;
|
|
272
|
+
exports.onDOMContentLoaded = onDOMContentLoaded;
|
|
273
|
+
exports.parseSelector = parseSelector;
|
|
274
|
+
exports.reflow = reflow;
|
|
275
|
+
exports.toType = toType;
|
|
276
|
+
exports.triggerTransitionEnd = triggerTransitionEnd;
|
|
277
|
+
|
|
278
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
279
|
+
|
|
280
|
+
}));
|
|
281
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/util/index.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1_000_000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n/**\n * Properly escape IDs selectors to handle weird IDs\n * @param {string} selector\n * @returns {string}\n */\nconst parseSelector = selector => {\n if (selector && window.CSS && window.CSS.escape) {\n // document.querySelector needs escaping to handle IDs (html5+) containing for instance /\n selector = selector.replace(/#([^\\s\"#']+)/g, (match, id) => `#${CSS.escape(id)}`)\n }\n\n return selector\n}\n\n// Shout-out Angus Croll (https://goo.gl/pxwQGp)\nconst toType = object => {\n if (object === null || object === undefined) {\n return `${object}`\n }\n\n return Object.prototype.toString.call(object).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\n/**\n * Public Util API\n */\n\nconst getUID = prefix => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element)\n\n const floatTransitionDuration = Number.parseFloat(transitionDuration)\n const floatTransitionDelay = Number.parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n element.dispatchEvent(new Event(TRANSITION_END))\n}\n\nconst isElement = object => {\n if (!object || typeof object !== 'object') {\n return false\n }\n\n if (typeof object.jquery !== 'undefined') {\n object = object[0]\n }\n\n return typeof object.nodeType !== 'undefined'\n}\n\nconst getElement = object => {\n // it's a jQuery object or a node element\n if (isElement(object)) {\n return object.jquery ? object[0] : object\n }\n\n if (typeof object === 'string' && object.length > 0) {\n return document.querySelector(parseSelector(object))\n }\n\n return null\n}\n\nconst isVisible = element => {\n if (!isElement(element) || element.getClientRects().length === 0) {\n return false\n }\n\n const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'\n // Handle `details` element as its content may falsie appear visible when it is closed\n const closedDetails = element.closest('details:not([open])')\n\n if (!closedDetails) {\n return elementIsVisible\n }\n\n if (closedDetails !== element) {\n const summary = element.closest('summary')\n if (summary && summary.parentNode !== closedDetails) {\n return false\n }\n\n if (summary === null) {\n return false\n }\n }\n\n return elementIsVisible\n}\n\nconst isDisabled = element => {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n return true\n }\n\n if (element.classList.contains('disabled')) {\n return true\n }\n\n if (typeof element.disabled !== 'undefined') {\n return element.disabled\n }\n\n return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => {}\n\n/**\n * Trick to restart an element's animation\n *\n * @param {HTMLElement} element\n * @return void\n *\n * @see https://www.harrytheo.com/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation\n */\nconst reflow = element => {\n element.offsetHeight // eslint-disable-line no-unused-expressions\n}\n\nconst getjQuery = () => {\n if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {\n return window.jQuery\n }\n\n return null\n}\n\nconst DOMContentLoadedCallbacks = []\n\nconst onDOMContentLoaded = callback => {\n if (document.readyState === 'loading') {\n // add listener on the first call when the document is in loading state\n if (!DOMContentLoadedCallbacks.length) {\n document.addEventListener('DOMContentLoaded', () => {\n for (const callback of DOMContentLoadedCallbacks) {\n callback()\n }\n })\n }\n\n DOMContentLoadedCallbacks.push(callback)\n } else {\n callback()\n }\n}\n\nconst isRTL = () => document.documentElement.dir === 'rtl'\n\nconst defineJQueryPlugin = plugin => {\n onDOMContentLoaded(() => {\n const $ = getjQuery()\n /* istanbul ignore if */\n if ($) {\n const name = plugin.NAME\n const JQUERY_NO_CONFLICT = $.fn[name]\n $.fn[name] = plugin.jQueryInterface\n $.fn[name].Constructor = plugin\n $.fn[name].noConflict = () => {\n $.fn[name] = JQUERY_NO_CONFLICT\n return plugin.jQueryInterface\n }\n }\n })\n}\n\nconst execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {\n return typeof possibleCallback === 'function' ? possibleCallback.call(...args) : defaultValue\n}\n\nconst executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {\n if (!waitForTransition) {\n execute(callback)\n return\n }\n\n const durationPadding = 5\n const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding\n\n let called = false\n\n const handler = ({ target }) => {\n if (target !== transitionElement) {\n return\n }\n\n called = true\n transitionElement.removeEventListener(TRANSITION_END, handler)\n execute(callback)\n }\n\n transitionElement.addEventListener(TRANSITION_END, handler)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(transitionElement)\n }\n }, emulatedDuration)\n}\n\n/**\n * Return the previous/next element of a list.\n *\n * @param {array} list The list of elements\n * @param activeElement The active element\n * @param shouldGetNext Choose to get next or previous element\n * @param isCycleAllowed\n * @return {Element|elem} The proper element\n */\nconst getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {\n const listLength = list.length\n let index = list.indexOf(activeElement)\n\n // if the element does not exist in the list return an element\n // depending on the direction and if cycle is allowed\n if (index === -1) {\n return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]\n }\n\n index += shouldGetNext ? 1 : -1\n\n if (isCycleAllowed) {\n index = (index + listLength) % listLength\n }\n\n return list[Math.max(0, Math.min(index, listLength - 1))]\n}\n\nexport {\n defineJQueryPlugin,\n execute,\n executeAfterTransition,\n findShadowRoot,\n getElement,\n getjQuery,\n getNextActiveElement,\n getTransitionDurationFromElement,\n getUID,\n isDisabled,\n isElement,\n isRTL,\n isVisible,\n noop,\n onDOMContentLoaded,\n parseSelector,\n reflow,\n triggerTransitionEnd,\n toType\n}\n"],"names":["MAX_UID","MILLISECONDS_MULTIPLIER","TRANSITION_END","parseSelector","selector","window","CSS","escape","replace","match","id","toType","object","undefined","Object","prototype","toString","call","toLowerCase","getUID","prefix","Math","floor","random","document","getElementById","getTransitionDurationFromElement","element","transitionDuration","transitionDelay","getComputedStyle","floatTransitionDuration","Number","parseFloat","floatTransitionDelay","split","triggerTransitionEnd","dispatchEvent","Event","isElement","jquery","nodeType","getElement","length","querySelector","isVisible","getClientRects","elementIsVisible","getPropertyValue","closedDetails","closest","summary","parentNode","isDisabled","Node","ELEMENT_NODE","classList","contains","disabled","hasAttribute","getAttribute","findShadowRoot","documentElement","attachShadow","getRootNode","root","ShadowRoot","noop","reflow","offsetHeight","getjQuery","jQuery","body","DOMContentLoadedCallbacks","onDOMContentLoaded","callback","readyState","addEventListener","push","isRTL","dir","defineJQueryPlugin","plugin","$","name","NAME","JQUERY_NO_CONFLICT","fn","jQueryInterface","Constructor","noConflict","execute","possibleCallback","args","defaultValue","executeAfterTransition","transitionElement","waitForTransition","durationPadding","emulatedDuration","called","handler","target","removeEventListener","setTimeout","getNextActiveElement","list","activeElement","shouldGetNext","isCycleAllowed","listLength","index","indexOf","max","min"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA,MAAMA,OAAO,GAAG,OAAS;EACzB,MAAMC,uBAAuB,GAAG,IAAI;EACpC,MAAMC,cAAc,GAAG,eAAe;;EAEtC;EACA;EACA;EACA;EACA;AACA,QAAMC,aAAa,GAAGC,QAAQ,IAAI;IAChC,IAAIA,QAAQ,IAAIC,MAAM,CAACC,GAAG,IAAID,MAAM,CAACC,GAAG,CAACC,MAAM,EAAE;EAC/C;MACAH,QAAQ,GAAGA,QAAQ,CAACI,OAAO,CAAC,eAAe,EAAE,CAACC,KAAK,EAAEC,EAAE,KAAK,CAAA,CAAA,EAAIJ,GAAG,CAACC,MAAM,CAACG,EAAE,CAAC,EAAE,CAAC;EACnF,EAAA;EAEA,EAAA,OAAON,QAAQ;EACjB;;EAEA;AACA,QAAMO,MAAM,GAAGC,MAAM,IAAI;EACvB,EAAA,IAAIA,MAAM,KAAK,IAAI,IAAIA,MAAM,KAAKC,SAAS,EAAE;MAC3C,OAAO,CAAA,EAAGD,MAAM,CAAA,CAAE;EACp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|
+
* Bootstrap sanitizer.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sanitizer = {}));
|
|
10
|
+
})(this, (function (exports) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap util/sanitizer.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// js-docs-start allow-list
|
|
20
|
+
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
|
21
|
+
const DefaultAllowlist = {
|
|
22
|
+
// Global attributes allowed on any supplied element below.
|
|
23
|
+
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
|
24
|
+
a: ['target', 'href', 'title', 'rel'],
|
|
25
|
+
area: [],
|
|
26
|
+
b: [],
|
|
27
|
+
br: [],
|
|
28
|
+
col: [],
|
|
29
|
+
code: [],
|
|
30
|
+
dd: [],
|
|
31
|
+
div: [],
|
|
32
|
+
dl: [],
|
|
33
|
+
dt: [],
|
|
34
|
+
em: [],
|
|
35
|
+
hr: [],
|
|
36
|
+
h1: [],
|
|
37
|
+
h2: [],
|
|
38
|
+
h3: [],
|
|
39
|
+
h4: [],
|
|
40
|
+
h5: [],
|
|
41
|
+
h6: [],
|
|
42
|
+
i: [],
|
|
43
|
+
img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
|
|
44
|
+
li: [],
|
|
45
|
+
ol: [],
|
|
46
|
+
p: [],
|
|
47
|
+
pre: [],
|
|
48
|
+
s: [],
|
|
49
|
+
small: [],
|
|
50
|
+
span: [],
|
|
51
|
+
sub: [],
|
|
52
|
+
sup: [],
|
|
53
|
+
strong: [],
|
|
54
|
+
u: [],
|
|
55
|
+
ul: []
|
|
56
|
+
};
|
|
57
|
+
// js-docs-end allow-list
|
|
58
|
+
|
|
59
|
+
const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A pattern that recognizes URLs that are safe wrt. XSS in URL navigation
|
|
63
|
+
* contexts.
|
|
64
|
+
*
|
|
65
|
+
* Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
|
|
66
|
+
*/
|
|
67
|
+
const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
|
|
68
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
|
69
|
+
const attributeName = attribute.nodeName.toLowerCase();
|
|
70
|
+
if (allowedAttributeList.includes(attributeName)) {
|
|
71
|
+
if (uriAttributes.has(attributeName)) {
|
|
72
|
+
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue));
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Check if a regular expression validates the attribute.
|
|
78
|
+
return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
|
|
79
|
+
};
|
|
80
|
+
function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
|
|
81
|
+
if (!unsafeHtml.length) {
|
|
82
|
+
return unsafeHtml;
|
|
83
|
+
}
|
|
84
|
+
if (sanitizeFunction && typeof sanitizeFunction === 'function') {
|
|
85
|
+
return sanitizeFunction(unsafeHtml);
|
|
86
|
+
}
|
|
87
|
+
const domParser = new window.DOMParser();
|
|
88
|
+
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
|
89
|
+
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
|
90
|
+
for (const element of elements) {
|
|
91
|
+
const elementName = element.nodeName.toLowerCase();
|
|
92
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
|
93
|
+
element.remove();
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const attributeList = [].concat(...element.attributes);
|
|
97
|
+
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
|
|
98
|
+
for (const attribute of attributeList) {
|
|
99
|
+
if (!allowedAttribute(attribute, allowedAttributes)) {
|
|
100
|
+
element.removeAttribute(attribute.nodeName);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return createdDocument.body.innerHTML;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
exports.DefaultAllowlist = DefaultAllowlist;
|
|
108
|
+
exports.sanitizeHtml = sanitizeHtml;
|
|
109
|
+
|
|
110
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
111
|
+
|
|
112
|
+
}));
|
|
113
|
+
//# sourceMappingURL=sanitizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitizer.js","sources":["../../src/util/sanitizer.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap util/sanitizer.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n// js-docs-start allow-list\nconst ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i\n\nexport const DefaultAllowlist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n dd: [],\n div: [],\n dl: [],\n dt: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n}\n// js-docs-end allow-list\n\nconst uriAttributes = new Set([\n 'background',\n 'cite',\n 'href',\n 'itemtype',\n 'longdesc',\n 'poster',\n 'src',\n 'xlink:href'\n])\n\n/**\n * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation\n * contexts.\n *\n * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38\n */\nconst SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i\n\nconst allowedAttribute = (attribute, allowedAttributeList) => {\n const attributeName = attribute.nodeName.toLowerCase()\n\n if (allowedAttributeList.includes(attributeName)) {\n if (uriAttributes.has(attributeName)) {\n return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue))\n }\n\n return true\n }\n\n // Check if a regular expression validates the attribute.\n return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)\n .some(regex => regex.test(attributeName))\n}\n\nexport function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {\n if (!unsafeHtml.length) {\n return unsafeHtml\n }\n\n if (sanitizeFunction && typeof sanitizeFunction === 'function') {\n return sanitizeFunction(unsafeHtml)\n }\n\n const domParser = new window.DOMParser()\n const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')\n const elements = [].concat(...createdDocument.body.querySelectorAll('*'))\n\n for (const element of elements) {\n const elementName = element.nodeName.toLowerCase()\n\n if (!Object.keys(allowList).includes(elementName)) {\n element.remove()\n continue\n }\n\n const attributeList = [].concat(...element.attributes)\n const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])\n\n for (const attribute of attributeList) {\n if (!allowedAttribute(attribute, allowedAttributes)) {\n element.removeAttribute(attribute.nodeName)\n }\n }\n }\n\n return createdDocument.body.innerHTML\n}\n"],"names":["ARIA_ATTRIBUTE_PATTERN","DefaultAllowlist","a","area","b","br","col","code","dd","div","dl","dt","em","hr","h1","h2","h3","h4","h5","h6","i","img","li","ol","p","pre","s","small","span","sub","sup","strong","u","ul","uriAttributes","Set","SAFE_URL_PATTERN","allowedAttribute","attribute","allowedAttributeList","attributeName","nodeName","toLowerCase","includes","has","Boolean","test","nodeValue","filter","attributeRegex","RegExp","some","regex","sanitizeHtml","unsafeHtml","allowList","sanitizeFunction","length","domParser","window","DOMParser","createdDocument","parseFromString","elements","concat","body","querySelectorAll","element","elementName","Object","keys","remove","attributeList","attributes","allowedAttributes","removeAttribute","innerHTML"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA,MAAMA,sBAAsB,GAAG,gBAAgB;AAExC,QAAMC,gBAAgB,GAAG;EAC9B;EACA,EAAA,GAAG,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAED,sBAAsB,CAAC;IACnEE,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;EACrCC,EAAAA,IAAI,EAAE,EAAE;EACRC,EAAAA,CAAC,EAAE,EAAE;EACLC,EAAAA,EAAE,EAAE,EAAE;EACNC,EAAAA,GAAG,EAAE,EAAE;EACPC,EAAAA,IAAI,EAAE,EAAE;EACRC,EAAAA,EAAE,EAAE,EAAE;EACNC,EAAAA,GAAG,EAAE,EAAE;EACPC,EAAAA,EAAE,EAAE,EAAE;EACNC,EAAAA,EAAE,EAAE,EAAE;EACNC,EAAAA,EAAE,EAAE,EAAE;EACNC,EAAAA,EAAE,EAAE,EAAE;EACNC,EAAAA,EAAE,E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,CAAC,IAAI,EAAE,CAAC;EAEvF,IAAA,KAAK,MAAM9B,SAAS,IAAIkC,aAAa,EAAE;EACrC,MAAA,IAAI,CAACnC,gBAAgB,CAACC,SAAS,EAAEoC,iBAAiB,CAAC,EAAE;EACnDP,QAAAA,OAAO,CAACQ,eAAe,CAACrC,SAAS,CAACG,QAAQ,CAAC;EAC7C,MAAA;EACF,IAAA;EACF,EAAA;EAEA,EAAA,OAAOoB,eAAe,CAACI,IAAI,CAACW,SAAS;EACvC;;;;;;;;;;;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap scrollbar.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/manipulator.js'), require('../dom/selector-engine.js'), require('./index.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/manipulator', '../dom/selector-engine', './index'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Scrollbar = factory(global.Manipulator, global.SelectorEngine, global.Index));
|
|
10
|
+
})(this, (function (Manipulator, SelectorEngine, index_js) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap util/scrollBar.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Constants
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
|
25
|
+
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
|
26
|
+
const PROPERTY_PADDING = 'padding-right';
|
|
27
|
+
const PROPERTY_MARGIN = 'margin-right';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Class definition
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
class ScrollBarHelper {
|
|
34
|
+
constructor() {
|
|
35
|
+
this._element = document.body;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Public
|
|
39
|
+
getWidth() {
|
|
40
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
|
41
|
+
const documentWidth = document.documentElement.clientWidth;
|
|
42
|
+
return Math.abs(window.innerWidth - documentWidth);
|
|
43
|
+
}
|
|
44
|
+
hide() {
|
|
45
|
+
const width = this.getWidth();
|
|
46
|
+
this._disableOverFlow();
|
|
47
|
+
// give padding to element to balance the hidden scrollbar width
|
|
48
|
+
this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
|
|
49
|
+
// trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
|
|
50
|
+
this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
|
|
51
|
+
this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
|
|
52
|
+
}
|
|
53
|
+
reset() {
|
|
54
|
+
this._resetElementAttributes(this._element, 'overflow');
|
|
55
|
+
this._resetElementAttributes(this._element, PROPERTY_PADDING);
|
|
56
|
+
this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
|
|
57
|
+
this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
|
|
58
|
+
}
|
|
59
|
+
isOverflowing() {
|
|
60
|
+
return this.getWidth() > 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Private
|
|
64
|
+
_disableOverFlow() {
|
|
65
|
+
this._saveInitialAttribute(this._element, 'overflow');
|
|
66
|
+
this._element.style.overflow = 'hidden';
|
|
67
|
+
}
|
|
68
|
+
_setElementAttributes(selector, styleProperty, callback) {
|
|
69
|
+
const scrollbarWidth = this.getWidth();
|
|
70
|
+
const manipulationCallBack = element => {
|
|
71
|
+
if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this._saveInitialAttribute(element, styleProperty);
|
|
75
|
+
const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
|
|
76
|
+
element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
|
|
77
|
+
};
|
|
78
|
+
this._applyManipulationCallback(selector, manipulationCallBack);
|
|
79
|
+
}
|
|
80
|
+
_saveInitialAttribute(element, styleProperty) {
|
|
81
|
+
const actualValue = element.style.getPropertyValue(styleProperty);
|
|
82
|
+
if (actualValue) {
|
|
83
|
+
Manipulator.setDataAttribute(element, styleProperty, actualValue);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_resetElementAttributes(selector, styleProperty) {
|
|
87
|
+
const manipulationCallBack = element => {
|
|
88
|
+
const value = Manipulator.getDataAttribute(element, styleProperty);
|
|
89
|
+
// We only want to remove the property if the value is `null`; the value can also be zero
|
|
90
|
+
if (value === null) {
|
|
91
|
+
element.style.removeProperty(styleProperty);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
Manipulator.removeDataAttribute(element, styleProperty);
|
|
95
|
+
element.style.setProperty(styleProperty, value);
|
|
96
|
+
};
|
|
97
|
+
this._applyManipulationCallback(selector, manipulationCallBack);
|
|
98
|
+
}
|
|
99
|
+
_applyManipulationCallback(selector, callBack) {
|
|
100
|
+
if (index_js.isElement(selector)) {
|
|
101
|
+
callBack(selector);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
for (const sel of SelectorEngine.find(selector, this._element)) {
|
|
105
|
+
callBack(sel);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return ScrollBarHelper;
|
|
111
|
+
|
|
112
|
+
}));
|
|
113
|
+
//# sourceMappingURL=scrollbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrollbar.js","sources":["../../src/util/scrollbar.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap util/scrollBar.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Manipulator from '../dom/manipulator.js'\nimport SelectorEngine from '../dom/selector-engine.js'\nimport { isElement } from './index.js'\n\n/**\n * Constants\n */\n\nconst SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'\nconst SELECTOR_STICKY_CONTENT = '.sticky-top'\nconst PROPERTY_PADDING = 'padding-right'\nconst PROPERTY_MARGIN = 'margin-right'\n\n/**\n * Class definition\n */\n\nclass ScrollBarHelper {\n constructor() {\n this._element = document.body\n }\n\n // Public\n getWidth() {\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n const documentWidth = document.documentElement.clientWidth\n return Math.abs(window.innerWidth - documentWidth)\n }\n\n hide() {\n const width = this.getWidth()\n this._disableOverFlow()\n // give padding to element to balance the hidden scrollbar width\n this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width)\n // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth\n this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width)\n this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width)\n }\n\n reset() {\n this._resetElementAttributes(this._element, 'overflow')\n this._resetElementAttributes(this._element, PROPERTY_PADDING)\n this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING)\n this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN)\n }\n\n isOverflowing() {\n return this.getWidth() > 0\n }\n\n // Private\n _disableOverFlow() {\n this._saveInitialAttribute(this._element, 'overflow')\n this._element.style.overflow = 'hidden'\n }\n\n _setElementAttributes(selector, styleProperty, callback) {\n const scrollbarWidth = this.getWidth()\n const manipulationCallBack = element => {\n if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {\n return\n }\n\n this._saveInitialAttribute(element, styleProperty)\n const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty)\n element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`)\n }\n\n this._applyManipulationCallback(selector, manipulationCallBack)\n }\n\n _saveInitialAttribute(element, styleProperty) {\n const actualValue = element.style.getPropertyValue(styleProperty)\n if (actualValue) {\n Manipulator.setDataAttribute(element, styleProperty, actualValue)\n }\n }\n\n _resetElementAttributes(selector, styleProperty) {\n const manipulationCallBack = element => {\n const value = Manipulator.getDataAttribute(element, styleProperty)\n // We only want to remove the property if the value is `null`; the value can also be zero\n if (value === null) {\n element.style.removeProperty(styleProperty)\n return\n }\n\n Manipulator.removeDataAttribute(element, styleProperty)\n element.style.setProperty(styleProperty, value)\n }\n\n this._applyManipulationCallback(selector, manipulationCallBack)\n }\n\n _applyManipulationCallback(selector, callBack) {\n if (isElement(selector)) {\n callBack(selector)\n return\n }\n\n for (const sel of SelectorEngine.find(selector, this._element)) {\n callBack(sel)\n }\n }\n}\n\nexport default ScrollBarHelper\n"],"names":["SELECTOR_FIXED_CONTENT","SELECTOR_STICKY_CONTENT","PROPERTY_PADDING","PROPERTY_MARGIN","ScrollBarHelper","constructor","_element","document","body","getWidth","documentWidth","documentElement","clientWidth","Math","abs","window","innerWidth","hide","width","_disableOverFlow","_setElementAttributes","calculatedValue","reset","_resetElementAttributes","isOverflowing","_saveInitialAttribute","style","overflow","selector","styleProperty","callback","scrollbarWidth","manipulationCallBack","element","getComputedStyle","getPropertyValue","setProperty","Number","parseFloat","_applyManipulationCallback","actualValue","Manipulator","setDataAttribute","value","getDataAttribute","removeProperty","removeDataAttribute","callBack","isElement","sel","SelectorEngine","find"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;;EAMA;EACA;EACA;;EAEA,MAAMA,sBAAsB,GAAG,mDAAmD;EAClF,MAAMC,uBAAuB,GAAG,aAAa;EAC7C,MAAMC,gBAAgB,GAAG,eAAe;EACxC,MAAMC,eAAe,GAAG,cAAc;;EAEtC;EACA;EACA;;EAEA,MAAMC,eAAe,CAAC;EACpBC,EAAAA,WAAWA,GAAG;EACZ,IAAA,IAAI,CAACC,QAAQ,GAAGC,QAAQ,CAACC,IAAI;EAC/B,EAAA;;EAEA;EACAC,EAAAA,QAAQA,GAAG;EACT;EACA,IAAA,MAAMC,aAAa,GAAGH,QAAQ,CAACI,eAAe,CAACC,WAAW;MAC1D,OAAOC,IAAI,CAACC,GAAG,CAACC,MAAM,CAACC,UAAU,GAAGN,aAAa,CAAC;EACpD,EAAA;EAEAO,EAAAA,IAAIA,GAAG;EACL,IAAA,MAAMC,KAAK,GAAG,IAAI,CAACT,QAAQ,EAAE;MAC7B,IAAI,CAACU,gBAAgB,EAAE;EACvB;EACA,IAAA,IAAI,CAACC,qBAAqB,CAAC,IAAI,CAACd,QAAQ,EAAEJ,gBAAgB,EAAEmB,eAAe,IAAIA,eAAe,GAAGH,KAAK,CAAC;EACvG;EACA,IAAA,IAAI,CAACE,qBAAqB,CAACpB,sBAAsB,EAAEE,gBAAgB,EAAEmB,eAAe,IAAIA,eAAe,GAAGH,KAAK,CAAC;EAChH,IAAA,IAAI,CAACE,qBAAqB,CAACnB,uBAAuB,EAAEE,eAAe,EAAEkB,eAAe,IAAIA,eAAe,GAAGH,KAAK,CAAC;EAClH,EAAA;EAEAI,EAAAA,KAAKA,GAAG;MACN,IAAI,CAACC,uBAAuB,CA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