diff --git a/.babelrc.js b/.babelrc.js deleted file mode 100644 index 51399697f4..0000000000 --- a/.babelrc.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - presets: [ - [ - '@babel/preset-env', - { - loose: true, - bugfixes: true, - modules: false - } - ] - ] -}; diff --git a/.browserslistrc b/.browserslistrc index cddd230052..281c2d86fe 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,12 +1,27 @@ # https://github.com/browserslist/browserslist#readme +# +# Read the docs before you change anything here. The support policy, the reason +# behind each floor, the features these floors do and do not give us, and how to +# measure coverage all live in one place: +# https://getbootstrap.com/docs/6.0/getting-started/browsers-devices/ +# +# Two rules for editing this file: +# 1. Never set a floor below `light-dark()`: Chrome 123, Firefox 120, +# Safari 17.5. Lightning CSS lowers `light-dark()` to a custom-property +# polyfill below those versions, and the polyfill breaks `data-bs-theme`. +# 2. Run `npx browserslist --coverage` after any change, then update the +# versions and the coverage figure on the docs page above. ->= 0.5% last 2 major versions not dead -Chrome >= 60 -Firefox >= 60 -Firefox ESR -iOS >= 12 -Safari >= 12 -not Explorer <= 11 -not kaios <= 2.5 # fix floating label issues in Firefox (see https://github.com/postcss/autoprefixer/issues/1533) + +Chrome >= 138 +Edge >= 138 +Firefox >= 147 +iOS >= 26 +Safari >= 26 + +not and_uc > 0 +not and_qq > 0 +not kaios > 0 +not op_mini all diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index fa12b81d13..2eee2e7d43 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -2,64 +2,57 @@ "files": [ { "path": "./dist/css/bootstrap-grid.css", - "maxSize": "6.5 kB" + "maxSize": "13.75 kB" }, { "path": "./dist/css/bootstrap-grid.min.css", - "maxSize": "6.0 kB" + "maxSize": "12.0 kB" }, { "path": "./dist/css/bootstrap-reboot.css", - "maxSize": "3.5 kB" + "maxSize": "6.0 kB" }, { "path": "./dist/css/bootstrap-reboot.min.css", - "maxSize": "3.25 kB" + "maxSize": "5.75 kB" }, { "path": "./dist/css/bootstrap-utilities.css", - "maxSize": "11.75 kB" + "maxSize": "21.25 kB" }, { "path": "./dist/css/bootstrap-utilities.min.css", - "maxSize": "10.75 kB" + "maxSize": "20.25 kB" }, { "path": "./dist/css/bootstrap.css", - "maxSize": "32.5 kB" + "maxSize": "55.5 kB" }, { "path": "./dist/css/bootstrap.min.css", - "maxSize": "30.25 kB" + "maxSize": "52 kB" }, { "path": "./dist/js/bootstrap.bundle.js", - "maxSize": "43.25 kB" + "maxSize": "79.75 kB" }, { "path": "./dist/js/bootstrap.bundle.min.js", - "maxSize": "23.5 kB" - }, - { - "path": "./dist/js/bootstrap.esm.js", - "maxSize": "28.25 kB" - }, - { - "path": "./dist/js/bootstrap.esm.min.js", - "maxSize": "18.25 kB" + "maxSize": "62.75 kB" }, { "path": "./dist/js/bootstrap.js", - "maxSize": "29.0 kB" + "maxSize": "60.25 kB" }, { "path": "./dist/js/bootstrap.min.js", - "maxSize": "16.25 kB" + "maxSize": "39.0 kB" } ], "ci": { "trackBranches": [ - "v5-dev" + "main", + "v4-dev" ] } } diff --git a/.cspell.json b/.cspell.json index 06b51aaab4..f06670ecad 100644 --- a/.cspell.json +++ b/.cspell.json @@ -1,82 +1,97 @@ { "version": "0.2", "words": [ + "activedescendant", "affordance", "allowfullscreen", - "alpadev", "Analyser", - "asciiquotes", + "autobuild", + "autofilled", "autohide", "autohiding", "Autoprefixer", "autoplay", "autoplays", "autoplaying", + "Beckwith", "blazingly", "Blockquotes", "Bootstrappers", "borderless", - "BOTTOMCENTER", - "BOTTOMEND", "Brotli", + "browsersl", "browserslist", "browserslistrc", + "bsversion", "btncheck", "btnradio", "bundlewatch", "Bytesize", + "calibreapp", "callout", "callouts", "camelCase", "cheatsheet", - "cleancss", + "checkgroup", "clearfix", "Codesniffer", "combinator", "contenteditable", "Contentful", + "cooldown", + "coverallsapp", "Cpath", "Croll", "Crossfade", + "crossfades", "crossfading", "cssgrid", + "csstricks", "Csvg", + "currentcolor", "Datalists", + "Datepicker", + "datepickers", "Deque", "describedby", - "dgst", + "desync", + "dialogbase", + "disableable", "discoverability", - "docsearch", "docsref", + "DOMCONTENT", "Dripicons", "dropend", "dropleft", "dropright", "dropstart", "dropup", + "dgst", "errorf", "esproj", + "extensionless", "favicon", "favicons", "fieldsets", - "filterpattern", "flexbox", "focusables", "focustrap", + "Fpath", + "frontmatter", "fullscreen", - "fullwidth", "fusv", "gesturechange", "gestureend", "gesturestart", "getbootstrap", - "getj", "Grayscale", + "haspopup", "Hoverable", "hreflang", "hstack", "icofont", "importmap", + "inputmode", "Ionicons", "itemtype", "ITUSEYJG", @@ -84,9 +99,9 @@ "Jumbotrons", "Jumpstart", "keyframes", - "keyshortcut", + "keyline", + "Keyshortcut", "keyshortcuts", - "KMZKZHQ", "komodoproject", "Komodo", "komodotools", @@ -95,26 +110,44 @@ "libman", "Libsass", "lightboxes", + "lightningcss", + "linkinator", + "llms", + "llmstxt", "longdesc", + "longhands", "Lowercased", "markdownify", + "maxlength", "mediaqueries", "minifiers", "misfunction", "mkdir", "monospace", "mouseleave", + "multiselectable", "navbars", "navs", + "navoverflow", "nbproject", + "negativify", + "networkidle", "Neue", "nextjs", "noindex", + "nojekyll", + "nonmodal", + "nvmrc", + "oklab", + "oklch", "Noto", + "drawer", "offcanvas", "offcanvases", "opencollective", + "ossf", "Packagist", + "Pagefind", "popperjs", "prebuild", "prefersreducedmotion", @@ -123,12 +156,14 @@ "recents", "rects", "relref", + "remint", "rgba", "roboto", "robotstxt", - "RTLCSS", + "rollup", "rubygem", "ruleset", + "sarif", "sassrc", "screenreaders", "scrollbars", @@ -136,6 +171,8 @@ "Segoe", "selectend", "semibold", + "shiki", + "shikijs", "slugified", "socio", "srcset", @@ -146,48 +183,49 @@ "subnav", "subresult", "subresults", - "tabbable", "Tabler", + "tabbable", "textareas", "tmproj", "toggleable", "topbar", - "TOPCENTER", - "TOPEND", "touchend", "twbs", "unitless", + "unnamespaced", "Unported", "unstylable", "unstyled", + "unthemed", "Uppercased", - "uppercases", "urlize", "urlquery", "vbtn", + "viewbox", "viewports", "Vite", "vstack", "walkthroughs", "WCAG", - "Werror", + "webp", + "worktrees", "xlink", "zindex" ], "language": "en-US", "ignoreRegExpList": [ - "\\u001[Bb]\\[[0-9;]*m" + "\\\\u001[Bb]\\[[0-9;]*m", + "%[0-9A-Fa-f]{2}" ], "ignorePaths": [ ".cspell.json", ".vscode/", "dist/", + "js/dist/", + "js/coverage/", "*.min.*", - "**/*rtl*", "**/tests/**", - "package-lock.json", - "site/data/core-team.yml", - "site/data/translations.yml" + "package-lock.json" ], "useGitignore": true } diff --git a/.cursor/skills/bootstrap-release/SKILL.md b/.cursor/skills/bootstrap-release/SKILL.md new file mode 100644 index 0000000000..18cfed048b --- /dev/null +++ b/.cursor/skills/bootstrap-release/SKILL.md @@ -0,0 +1,325 @@ +--- +name: bootstrap-release +description: Cuts a Bootstrap release from version preparation through npm, GitHub, NuGet, and documentation deployment. Use when a maintainer asks to release, publish, or ship Bootstrap, including prereleases such as v6.0.0-alpha.1. +disable-model-invocation: true +--- + +# Release Bootstrap + +Use this workflow for maintainer releases from this repository. +Set the release branch and version once before you start: + +```sh +export RELEASE_BRANCH=main +export RELEASE_VERSION=6.0.0-alpha.1 +export RELEASE_TAG="v${RELEASE_VERSION}" +``` + +## Safety rules + +- Keep the working tree clean before release work. +- Use `next` for alpha, beta, and release-candidate npm releases. +- Never point npm’s `latest` tag at a prerelease. +- Mark each GitHub prerelease as a prerelease. +- Use a signed git tag. +- Never edit generated SRI hashes. +- Pause before each external write. +- Get explicit approval before you push a tag, publish to npm, publish a GitHub release, or deploy documentation. +- Stop after any failed check. + +## Progress + +Track these steps: + +```text +- [ ] 1. Check release prerequisites +- [ ] 2. Prepare the version +- [ ] 3. Run tests +- [ ] 4. Build release files +- [ ] 5. Commit and merge the release PR +- [ ] 6. Verify and tag the merge commit +- [ ] 7. Publish to npm +- [ ] 8. Publish the GitHub release +- [ ] 9. Deploy documentation +- [ ] 10. Verify the release +``` + +## 1. Check release prerequisites + +1. Confirm the release branch and target version. +2. Confirm all target milestone work is complete. +3. Confirm the working tree is clean. +4. Update the release branch. +5. Use the Node.js version from `.nvmrc`. +6. Install exact dependencies. +7. Confirm npm access. +8. Confirm GitHub access. + +```sh +git switch "$RELEASE_BRANCH" +git pull --ff-only origin "$RELEASE_BRANCH" +git status --short +nvm use +npm ci +npm whoami +gh auth status +``` + +Confirm that the npm account can publish the `bootstrap` package. +Confirm that `.github/workflows/publish-nuget.yml` exists. +Confirm that `.github/workflows/docs-deploy.yml` exists before documentation deployment. + +## 2. Prepare the version + +Read and save the current version: + +```sh +export CURRENT_VERSION=$(node -p "require('./package.json').version") +printf '%s\n' "$CURRENT_VERSION" +``` + +Skip the version change when it already equals the release version. +Otherwise, preview the version change first: + +```sh +npm run release-version -- "$CURRENT_VERSION" "$RELEASE_VERSION" --dry-run --verbose +``` + +Then apply it: + +```sh +npm run release-version -- "$CURRENT_VERSION" "$RELEASE_VERSION" --verbose +``` + +The script updates: + +- `README.md` +- `config.yml` +- `js/src/base-component.ts` +- `package.js` +- `package.json` +- `package-lock.json` +- `scss/_banner.scss` +- `site/data/docs-versions.yml` + +It also updates RubyGem version strings from forms such as `6.0.0.alpha.1`. +Review every changed file. +Search for stale version strings outside generated output. + +```sh +git grep -Fn "$CURRENT_VERSION" -- \ + . \ + ':!dist' \ + ':!js/dist' \ + ':!_site' \ + ':!package-lock.json' +``` + +## 3. Run tests + +Run the full test suite before the final release build: + +```sh +npm test +npm run bundlewatch +``` + +The browser tests need Chromium. +Install it only when the test output reports that it is missing: + +```sh +npx playwright install --with-deps chromium +``` + +Fix all failures before continuing. + +## 4. Build release files + +Run the release build: + +```sh +npm run release +``` + +This command performs these tasks: + +1. It builds CSS, JavaScript, and TypeScript declarations. +2. It writes SRI hashes to `config.yml`. +3. It builds the documentation site. +4. It creates the distribution ZIP file. +5. It creates the examples ZIP file. + +Confirm these files exist: + +```text +bootstrap-${RELEASE_VERSION}-dist.zip +bootstrap-${RELEASE_VERSION}-examples.zip +``` + +Review the complete diff. +Confirm that `config.yml` contains updated `css_hash`, `js_hash`, and `js_bundle_hash` values. +Do not rebuild `dist/` after this check. +If another build changes `dist/`, run `npm run release-sri` again. + +## 5. Commit and merge the release PR + +Create a release branch from the release branch. +Commit all intended version and generated release changes. + +```sh +git switch -c "release-${RELEASE_TAG}" +git add -A +git commit -m "Release ${RELEASE_TAG}" +git push -u origin "release-${RELEASE_TAG}" +gh pr create --base "$RELEASE_BRANCH" +``` + +Review the staged file list before the commit. +Do not include unrelated changes. +Wait for all required checks. +Merge the PR before tagging. + +## 6. Verify and tag the merge commit + +Return to the release branch and update it: + +```sh +git switch "$RELEASE_BRANCH" +git pull --ff-only origin "$RELEASE_BRANCH" +npm ci +npm run release +git status --short +``` + +The tracked working tree must stay clean after the repeat build. +The two ZIP files must exist. + +After explicit approval, create and push a signed tag: + +```sh +git tag -s "$RELEASE_TAG" -m "$RELEASE_TAG" +git push origin "$RELEASE_TAG" +``` + +Use the version without `v` in package files. +Use the version with `v` for the git tag and GitHub release. + +## 7. Publish to npm + +Inspect the package contents: + +```sh +npm pack --dry-run +``` + +After explicit approval, publish the prerelease: + +```sh +npm publish --tag next +``` + +Complete npm’s authentication prompt. +Then verify the distribution tags: + +```sh +npm dist-tag ls bootstrap +``` + +`next` must point to `$RELEASE_VERSION`. +`latest` must remain on the newest stable release. + +Use the default `latest` tag only for a stable release. + +## 8. Publish the GitHub release + +Use GitHub’s generated release notes. +Attach both ZIP files. +Mark the release as a prerelease. + +After explicit approval, run: + +```sh +gh release create "$RELEASE_TAG" \ + --title "$RELEASE_TAG" \ + --generate-notes \ + --prerelease \ + "bootstrap-${RELEASE_VERSION}-dist.zip" \ + "bootstrap-${RELEASE_VERSION}-examples.zip" +``` + +Publishing the GitHub release starts `.github/workflows/publish-nuget.yml`. +Watch the workflow and confirm that both NuGet packages publish. + +## 9. Deploy documentation + +The manual documentation workflow builds `_site/`. +It copies the current site over `gh-pages` without deleting older version directories. + +After explicit approval, dispatch it from the released branch: + +```sh +gh workflow run docs-deploy.yml --ref "$RELEASE_BRANCH" +``` + +Find and watch the new run: + +```sh +gh run list --workflow docs-deploy.yml --limit 1 +gh run watch +``` + +Confirm that the repository Pages source remains the `gh-pages` branch: + +```sh +gh api repos/twbs/bootstrap/pages --jq '.build_type, .source' +``` + +## 10. Verify the release + +Verify all release surfaces: + +1. Confirm the npm version and distribution tags. +2. Confirm the GitHub release has both ZIP files. +3. Confirm the NuGet workflow passed. +4. Confirm the Bootstrap homepage shows the new version. +5. Confirm the new documentation version loads. +6. Confirm an older documentation version still loads. +7. Confirm the jsDelivr CSS and JavaScript files load. +8. Confirm their SRI hashes match `config.yml`. + +jsDelivr can take a few minutes to load a new npm version. + +Calculate a published file hash with: + +```sh +curl -sL \ + "https://cdn.jsdelivr.net/npm/bootstrap@${RELEASE_VERSION}/dist/css/bootstrap.min.css" \ + | openssl dgst -sha384 -binary \ + | openssl base64 -A +``` + +Repeat the check for: + +- `dist/js/bootstrap.min.js` +- `dist/js/bootstrap.bundle.min.js` + +Compare each result with the base64 part of the related `sha384-` value in `config.yml`. + +## Recovery + +Do not unpublish a bad npm release. +Publish a corrected version. + +To move the prerelease distribution tag: + +```sh +npm dist-tag add bootstrap@ next +``` + +To remove a bad GitHub release and tag: + +```sh +gh release delete "$RELEASE_TAG" --cleanup-tag +``` + +Get explicit approval before either recovery action. diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index e42161487a..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,9 +0,0 @@ -**/*.min.js -**/dist/ -**/vendor/ -/_site/ -/site/public/ -/js/coverage/ -/site/static/sw.js -/site/static/docs/**/assets/sw.js -/site/layouts/partials/ diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index da686166f5..0000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "root": true, - "extends": [ - "plugin:import/errors", - "plugin:import/warnings", - "plugin:unicorn/recommended", - "xo", - "xo/browser" - ], - "rules": { - "arrow-body-style": "off", - "capitalized-comments": "off", - "comma-dangle": [ - "error", - "never" - ], - "import/extensions": [ - "error", - "ignorePackages", - { - "js": "always" - } - ], - "import/first": "error", - "import/newline-after-import": "error", - "import/no-absolute-path": "error", - "import/no-amd": "error", - "import/no-cycle": [ - "error", - { - "ignoreExternal": true - } - ], - "import/no-duplicates": "error", - "import/no-extraneous-dependencies": "error", - "import/no-mutable-exports": "error", - "import/no-named-as-default": "error", - "import/no-named-as-default-member": "error", - "import/no-named-default": "error", - "import/no-self-import": "error", - "import/no-unassigned-import": [ - "error" - ], - "import/no-useless-path-segments": "error", - "import/order": "error", - "indent": [ - "error", - 2, - { - "MemberExpression": "off", - "SwitchCase": 1 - } - ], - "logical-assignment-operators": "off", - "max-params": [ - "warn", - 5 - ], - "multiline-ternary": [ - "error", - "always-multiline" - ], - "new-cap": [ - "error", - { - "properties": false - } - ], - "no-console": "error", - "no-negated-condition": "off", - "object-curly-spacing": [ - "error", - "always" - ], - "operator-linebreak": [ - "error", - "after" - ], - "prefer-object-has-own": "off", - "prefer-template": "error", - "semi": [ - "error", - "never" - ], - "strict": "error", - "unicorn/explicit-length-check": "off", - "unicorn/filename-case": "off", - "unicorn/no-anonymous-default-export": "off", - "unicorn/no-array-callback-reference": "off", - "unicorn/no-array-method-this-argument": "off", - "unicorn/no-null": "off", - "unicorn/no-typeof-undefined": "off", - "unicorn/no-unused-properties": "error", - "unicorn/numeric-separators-style": "off", - "unicorn/prefer-array-flat": "off", - "unicorn/prefer-at": "off", - "unicorn/prefer-dom-node-dataset": "off", - "unicorn/prefer-global-this": "off", - "unicorn/prefer-module": "off", - "unicorn/prefer-query-selector": "off", - "unicorn/prefer-spread": "off", - "unicorn/prefer-string-raw": "off", - "unicorn/prefer-string-replace-all": "off", - "unicorn/prefer-structured-clone": "off", - "unicorn/prevent-abbreviations": "off" - }, - "overrides": [ - { - "files": [ - "build/**" - ], - "env": { - "browser": false, - "node": true - }, - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "no-console": "off", - "unicorn/prefer-top-level-await": "off" - } - }, - { - "files": [ - "js/**" - ], - "parserOptions": { - "sourceType": "module" - } - }, - { - "files": [ - "js/tests/*.js", - "js/tests/integration/rollup*.js" - ], - "env": { - "node": true - }, - "parserOptions": { - "sourceType": "script" - } - }, - { - "files": [ - "js/tests/unit/**" - ], - "env": { - "jasmine": true - }, - "rules": { - "no-console": "off", - "unicorn/consistent-function-scoping": "off", - "unicorn/no-useless-undefined": "off", - "unicorn/prefer-add-event-listener": "off" - } - }, - { - "files": [ - "js/tests/visual/**" - ], - "plugins": [ - "html" - ], - "settings": { - "html/html-extensions": [ - ".html" - ] - }, - "rules": { - "no-console": "off", - "no-new": "off", - "unicorn/no-array-for-each": "off" - } - }, - { - "files": [ - "scss/tests/**" - ], - "env": { - "node": true - }, - "parserOptions": { - "sourceType": "script" - } - }, - { - "files": [ - "site/**" - ], - "env": { - "browser": true, - "node": false - }, - "parserOptions": { - "sourceType": "script", - "ecmaVersion": 2019 - }, - "rules": { - "no-new": "off", - "unicorn/no-array-for-each": "off" - } - }, - { - "files": [ - "site/src/assets/application.js", - "site/src/assets/partials/*.js", - "site/src/assets/search.js", - "site/src/assets/snippets.js", - "site/src/assets/stackblitz.js", - "site/src/plugins/*.js" - ], - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 2020 - } - }, - { - "files": [ - "**/*.md" - ], - "plugins": [ - "markdown" - ], - "processor": "markdown/markdown" - }, - { - "files": [ - "**/*.md/*.js", - "**/*.md/*.mjs" - ], - "extends": "plugin:markdown/recommended-legacy", - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "unicorn/prefer-node-protocol": "off" - } - } - ] -} diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2ce536b440..b6b0e8ce72 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -18,7 +18,7 @@ the preferred channel for [bug reports](#bug-reports), [features requests](#feat and [submitting pull requests](#pull-requests), but please respect the following restrictions: -- Please **do not** use the issue tracker for personal support requests. Stack Overflow ([`bootstrap-5`](https://stackoverflow.com/questions/tagged/bootstrap-5) tag), [our GitHub Discussions](https://github.com/twbs/bootstrap/discussions) or [IRC](/README.md#community) are better places to get help. +- Please **do not** use the issue tracker for personal support requests. Stack Overflow ([`bootstrap-6`](https://stackoverflow.com/questions/tagged/bootstrap-6) tag), Reddit ([`r/bootstrap` subreddit](https://www.reddit.com/r/bootstrap/)), [our GitHub Discussions](https://github.com/twbs/bootstrap/discussions), [the community Discord](https://discord.gg/bZUvakRU3M), or [IRC](/README.md#community) are better places to get help. - Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others. @@ -47,7 +47,7 @@ Our bug tracker utilizes several labels to help organize and identify issues and **Type** - `bug` - Something that does not work as documented. Bug reports get this label when they’re opened. -- `feature` - Issues asking for a new feature to be added, or an existing one to be extended or modified. New features require a minor version bump (e.g., `v3.0.0` to `v3.1.0`). +- `feature` - Issues asking for a new feature to be added, or an existing one to be extended or modified. New features require a minor version bump (e.g., `v6.0.0` to `v6.1.0`). - `regression` - A bug that did not happen in an earlier release. - `breaking-change` - A change that breaks existing markup, Sass, or JavaScript. These are listed first in the release notes. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index f152071133..ece97e31b7 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,4 @@ contact_links: - name: Ask the community - url: https://github.com/twbs/bootstrap/discussions/new + url: https://github.com/orgs/twbs/discussions/new/choose about: Ask and discuss questions with other Bootstrap community members. diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 26b3be42c5..0f0aa9275e 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -6,6 +6,6 @@ See the [contributing guidelines](CONTRIBUTING.md) for sharing bug reports. For general troubleshooting or help getting started: -- Ask and explore [our GitHub Discussions](https://github.com/twbs/bootstrap/discussions). +- Ask and explore [our GitHub Discussions](https://github.com/orgs/twbs/discussions). - Chat with fellow Bootstrappers in IRC. On the `irc.libera.chat` server, in the `#bootstrap` channel. - Ask and explore Stack Overflow with the [`bootstrap-5`](https://stackoverflow.com/questions/tagged/bootstrap-5) tag. diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml index 957877282f..4ba6aee4f7 100644 --- a/.github/codeql/codeql-config.yml +++ b/.github/codeql/codeql-config.yml @@ -1,3 +1,7 @@ name: "CodeQL config" paths-ignore: - dist + # Compile-time type assertions. `tsc` checks these files; nothing ever runs or + # bundles them. Each assertion is a typed declaration that is unused by design, + # so the quality suite reports every line as an unused variable. + - js/tests/types diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6c2a1f8f08..76a55b2289 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ updates: labels: - dependencies - github-actions - - v5 + - v6 schedule: interval: weekly day: tuesday @@ -21,7 +21,7 @@ updates: directory: "/" labels: - dependencies - - v5 + - v6 schedule: interval: weekly day: tuesday @@ -31,6 +31,66 @@ updates: default-days: 7 versioning-strategy: increase rebase-strategy: disabled + ignore: + - dependency-name: "prettier-plugin-astro" + update-types: + - "version-update:semver-major" + # TypeScript 7 (native compiler) is not supported yet by @astrojs/check + # and typescript-eslint. Remove this entry once both accept it. + - dependency-name: "typescript" + update-types: + - "version-update:semver-major" + # Rolldown is pinned exactly on purpose while it is still release-candidate + # software. Review each bump by hand. + - dependency-name: "rolldown" + update-types: + - "version-update:semver-major" + - "version-update:semver-minor" + - "version-update:semver-patch" + - dependency-name: "stylelint" + update-types: + - "version-update:semver-major" + - "version-update:semver-minor" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" + # The same updates for v5 on the v5-dev branch. Dependabot reads this file from the default branch + # only, so v5's entries live here too. The ignore list matches v5-dev's .ncurc.json. + - package-ecosystem: "github-actions" + target-branch: "v5-dev" + directory: "/" + labels: + - dependencies + - github-actions + - v5 + schedule: + interval: weekly + day: monday + time: "05:00" + timezone: Europe/Paris + cooldown: + default-days: 7 + groups: + v5-github-actions: + patterns: + - "*" + - package-ecosystem: npm + target-branch: "v5-dev" + directory: "/" + labels: + - dependencies + - v5 + schedule: + interval: weekly + day: monday + time: "05:00" + timezone: Europe/Paris + cooldown: + default-days: 7 + versioning-strategy: increase + rebase-strategy: disabled ignore: - dependency-name: "@astrojs/mdx" update-types: @@ -103,7 +163,7 @@ updates: - "version-update:semver-minor" - "version-update:semver-patch" groups: - production-dependencies: + v5-production-dependencies: dependency-type: "production" - development-dependencies: + v5-development-dependencies: dependency-type: "development" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 3700e96407..0000000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,60 +0,0 @@ -name-template: 'v$NEXT_MAJOR_VERSION' -tag-template: 'v$NEXT_MAJOR_VERSION' -prerelease: true -exclude-labels: - - 'skip-changelog' -categories: - - title: '❗ Breaking Changes' - labels: - - 'breaking-change' - - title: '🚀 Highlights' - labels: - - 'release-highlight' - - title: '🚀 Features' - labels: - - 'new-feature' - - 'feature' - - 'enhancement' - - title: '🐛 Bug fixes' - labels: - - 'fix' - - 'bugfix' - - 'bug' - - title: '⚡ Performance improvements' - labels: - - 'performance' - - title: '🎨 CSS' - labels: - - 'css' - - title: '☕️ JavaScript' - labels: - - 'js' - - title: '📖 Docs' - labels: - - 'docs' - - title: '🛠 Examples' - labels: - - 'examples' - - title: '🌎 Accessibility' - labels: - - 'accessibility' - - title: '🔧 Utility API' - labels: - - 'utility-api' - - 'utilities' - - title: '🏭 Tests' - labels: - - 'tests' - - title: '🧰 Misc' - labels: - - 'build' - - 'meta' - - 'chore' - - 'ci' - - title: '📦 Dependencies' - labels: - - 'dependencies' -change-template: '- #$NUMBER: $TITLE' -template: | - ## Changes - $CHANGES diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000000..eff7f1d0b7 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,62 @@ +# Configuration for GitHub's automatically generated release notes. +# Use the "Generate release notes" button in the release UI. +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes + +changelog: + exclude: + labels: + - 'skip-changelog' + categories: + - title: '❗ Breaking Changes' + labels: + - 'breaking-change' + - title: '🚀 Highlights' + labels: + - 'release-highlight' + - title: '🚀 Features' + labels: + - 'new-feature' + - 'feature' + - 'enhancement' + - title: '🐛 Bug fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '⚡ Performance improvements' + labels: + - 'performance' + - title: '🎨 CSS' + labels: + - 'css' + - title: '☕️ JavaScript' + labels: + - 'js' + - title: '📖 Docs' + labels: + - 'docs' + - title: '🛠 Examples' + labels: + - 'examples' + - title: '🌎 Accessibility' + labels: + - 'accessibility' + - title: '🔧 Utility API' + labels: + - 'utility-api' + - 'utilities' + - title: '🏭 Tests' + labels: + - 'tests' + - title: '🧰 Misc' + labels: + - 'build' + - 'meta' + - 'chore' + - 'ci' + - title: '📦 Dependencies' + labels: + - 'dependencies' + - title: '🗒 Other changes' + labels: + - '*' diff --git a/.github/workflows/browserstack.yml b/.github/workflows/browserstack.yml deleted file mode 100644 index 875e35d9cc..0000000000 --- a/.github/workflows/browserstack.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: BrowserStack - -on: - push: - branches: - - "**" - - "!dependabot/**" - workflow_dispatch: - -env: - FORCE_COLOR: 2 - -permissions: - contents: read - -jobs: - browserstack: - runs-on: ubuntu-latest - if: github.repository == 'twbs/bootstrap' - timeout-minutes: 30 - - steps: - - name: Clone repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version-file: ".nvmrc" - cache: npm - - - name: Install npm dependencies - run: npm ci - - - name: Run dist - run: npm run dist - - - name: Run BrowserStack tests - run: npm run js-test-cloud - env: - BROWSER_STACK_ACCESS_KEY: "${{ secrets.BROWSER_STACK_ACCESS_KEY }}" - BROWSER_STACK_USERNAME: "${{ secrets.BROWSER_STACK_USERNAME }}" - GITHUB_SHA: "${{ github.sha }}" diff --git a/.github/workflows/bundlewatch.yml b/.github/workflows/bundlewatch.yml index 68576ddb8e..e29104bad8 100644 --- a/.github/workflows/bundlewatch.yml +++ b/.github/workflows/bundlewatch.yml @@ -3,7 +3,7 @@ name: Bundlewatch on: push: branches: - - v5-dev + - main pull_request: workflow_dispatch: @@ -39,4 +39,4 @@ jobs: run: npm run bundlewatch env: BUNDLEWATCH_GITHUB_TOKEN: "${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}" - CI_BRANCH_BASE: v5-dev + CI_BRANCH_BASE: main diff --git a/.github/workflows/calibreapp-image-actions.yml b/.github/workflows/calibreapp-image-actions.yml index 09b984da39..b6e12a14d4 100644 --- a/.github/workflows/calibreapp-image-actions.yml +++ b/.github/workflows/calibreapp-image-actions.yml @@ -18,7 +18,8 @@ jobs: name: calibreapp/image-actions runs-on: ubuntu-latest permissions: - # allow calibreapp/image-actions to update PRs + # allow calibreapp/image-actions to update PRs and commit compressed images + contents: write pull-requests: write steps: - name: Clone repository diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9a09cd26d8..811eb654fc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -3,11 +3,13 @@ name: "CodeQL" on: push: branches: - - v5-dev + - main + - v4-dev - "!dependabot/**" pull_request: branches: - - v5-dev + - main + - v4-dev - "!dependabot/**" schedule: - cron: "0 2 * * 4" @@ -27,16 +29,16 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 + uses: github/codeql-action/init@1fc58d04a4d4374f921bdac573c3811c240f9c26 # v4.39.2 with: config-file: ./.github/codeql/codeql-config.yml languages: "javascript" queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 + uses: github/codeql-action/autobuild@1fc58d04a4d4374f921bdac573c3811c240f9c26 # v4.39.2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 + uses: github/codeql-action/analyze@1fc58d04a4d4374f921bdac573c3811c240f9c26 # v4.39.2 with: category: "/language:javascript" diff --git a/.github/workflows/cspell.yml b/.github/workflows/cspell.yml index b8e035de9f..89ea78d958 100644 --- a/.github/workflows/cspell.yml +++ b/.github/workflows/cspell.yml @@ -3,7 +3,7 @@ name: cspell on: push: branches: - - v5-dev + - main pull_request: workflow_dispatch: diff --git a/.github/workflows/css.yml b/.github/workflows/css.yml index d39fcfecc8..53b80a01fe 100644 --- a/.github/workflows/css.yml +++ b/.github/workflows/css.yml @@ -3,7 +3,7 @@ name: CSS on: push: branches: - - v5-dev + - main pull_request: workflow_dispatch: @@ -37,3 +37,12 @@ jobs: - name: Run CSS tests run: npm run css-test + + - name: Install grid test browsers + run: npx playwright install --with-deps chromium firefox webkit + + - name: Test grid layout in Chromium, Firefox, and WebKit + run: | + npm run css-test-grid + GRID_TEST_BROWSER=firefox npm run css-test-grid + GRID_TEST_BROWSER=webkit npm run css-test-grid diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 9d97674751..e2a7276188 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -1,7 +1,7 @@ name: Docs deploy # Manual only. Dispatch this workflow from the branch you want to publish. -# It builds the docs and pushes only this version to `gh-pages`. +# It builds the docs and pushes them to `gh-pages`. on: workflow_dispatch: @@ -49,22 +49,12 @@ jobs: ref: gh-pages path: .gh-pages - # Replace only the configured docs version, removing stale files while - # preserving the main site and every other `docs/` directory. - - name: Copy the built docs over gh-pages + # `rsync` runs without `--delete`, so the deploy adds the current version + # and overwrites the root files, but keeps every older `docs/` + # directory. Each build holds one version only. + - name: Copy the built site over gh-pages run: | - DOCS_VERSION=$(node --input-type=module -e ' - import fs from "node:fs"; - import { load } from "js-yaml"; - const { docs_version } = load(fs.readFileSync("config.yml", "utf8")); - if (!/^5\.\d+$/.test(docs_version)) { - throw new Error("Expected a v5 docs version in config.yml"); - } - console.log(docs_version); - ') - test -d "_site/docs/${DOCS_VERSION}" - mkdir -p .gh-pages/docs - rsync --archive --delete --exclude .git "_site/docs/${DOCS_VERSION}/" ".gh-pages/docs/${DOCS_VERSION}/" + rsync --archive --exclude .git _site/ .gh-pages/ touch .gh-pages/.nojekyll - name: Commit and push diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a7d3ad9b8e..6e03af1b0e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,7 +3,7 @@ name: Docs on: push: branches: - - v5-dev + - main pull_request: workflow_dispatch: @@ -29,8 +29,6 @@ jobs: node-version-file: ".nvmrc" cache: npm - - run: java -version - - name: Install npm dependencies run: npm ci @@ -38,4 +36,4 @@ jobs: run: npm run docs-build - name: Validate HTML - run: npm run docs-vnu + run: npm run docs-html-validate diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index dfcc772bc7..be71e21719 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -3,7 +3,7 @@ name: JS Tests on: push: branches: - - v5-dev + - main pull_request: workflow_dispatch: @@ -37,6 +37,9 @@ jobs: - name: Install npm dependencies run: npm ci + - name: Install Playwright Chromium + run: npx playwright install --with-deps chromium + - name: Run dist run: npm run js diff --git a/.github/workflows/linkinator.yml b/.github/workflows/linkinator.yml index 7bad4ababa..dc5cb90f01 100644 --- a/.github/workflows/linkinator.yml +++ b/.github/workflows/linkinator.yml @@ -40,8 +40,16 @@ jobs: paths: _site recurse: true verbosity: error + # github.com URLs are skipped because they will be broken until the next release is published. skip: >- ^http://localhost - ^https://github.com/floating-ui/popper-docs/blob/main/docs/v2/ ^https://www.reddit.com ^https://medium.com + ^https://getbootstrap.com/docs/6.0 + ^https://github.com/twbs/bootstrap/blob/v6.0.0-alpha.1 + ^https://github.com/twbs/bootstrap/tree/v5-dev + ^https://github.com/twbs/bootstrap/releases/download/v6.0.0-alpha.1/ + ^https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1 + ^https://github.com/twbs/bootstrap/archive/v6.0.0-alpha.1.zip + ^https://github.com/twbs/bootstrap/tree/main/skills + ^https://github.com/twbs/bootstrap/blob/main/scss/forms/_combobox.scss diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 89847ea765..631b2f5a14 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,7 @@ name: Lint on: push: branches: - - v5-dev + - main pull_request: workflow_dispatch: diff --git a/.github/workflows/node-sass.yml b/.github/workflows/node-sass.yml deleted file mode 100644 index 6b3add5913..0000000000 --- a/.github/workflows/node-sass.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: CSS (node-sass) - -on: - push: - branches: - - v5-dev - pull_request: - workflow_dispatch: - -env: - FORCE_COLOR: 2 - -permissions: - contents: read - -jobs: - css: - runs-on: ubuntu-latest - - steps: - - name: Clone repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version-file: ".nvmrc" - - - name: Build CSS with node-sass - run: | - npx --package node-sass@latest node-sass --version - npx --package node-sass@latest node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/ -o dist-sass/css/ - ls -Al dist-sass/css - - - name: Check built CSS files for Sass variables - shell: bash - run: | - SASS_VARS_FOUND=$(find "dist-sass/css/" -type f -name "*.css" -print0 | xargs -0 --no-run-if-empty grep -F "\$" || true) - if [[ -z "$SASS_VARS_FOUND" ]]; then - echo "All good, no Sass variables found!" - exit 0 - else - echo "Found $(echo "$SASS_VARS_FOUND" | wc -l | bc) Sass variables:" - echo "$SASS_VARS_FOUND" - exit 1 - fi diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 96acfe3c2a..2ea6e532d0 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -3,75 +3,32 @@ name: Publish NuGet Packages on: release: types: [published] - workflow_dispatch: - inputs: - tag: - description: Existing release tag to publish (for example, v5.3.9) - required: true - type: string permissions: contents: read -concurrency: - group: publish-nuget-${{ inputs.tag || github.event.release.tag_name }} - cancel-in-progress: false - jobs: package-nuget: runs-on: windows-latest - if: ${{ github.repository == 'twbs/bootstrap' && startsWith(inputs.tag || github.event.release.tag_name, 'v') }} - permissions: - contents: read - id-token: write + if: ${{ github.repository == 'twbs/bootstrap' && startsWith(github.event.release.tag_name, 'v') }} env: - RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }} + GITHUB_REF_NAME: ${{ github.ref_name }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - ref: refs/tags/${{ env.RELEASE_TAG }} persist-credentials: false - - name: Verify release version - id: package - shell: pwsh - run: | - $package = Get-Content package.json -Raw | ConvertFrom-Json - if ($package.name -ne 'bootstrap' -or $env:RELEASE_TAG -cne "v$($package.version)") { - throw "Release $env:RELEASE_TAG does not match $($package.name)@$($package.version)" - } - "version=$($package.version)" >> $env:GITHUB_OUTPUT - - name: Set up NuGet uses: nuget/setup-nuget@fd55a6f3b34392fa83fde1454582407d8c714123 # v4.0 with: + nuget-api-key: ${{ secrets.NuGetAPIKey }} nuget-version: '5.x' - name: Pack NuGet packages shell: pwsh - env: - PACKAGE_VERSION: ${{ steps.package.outputs.version }} run: | - $bsversion = $env:PACKAGE_VERSION + $bsversion = $env:GITHUB_REF_NAME.Substring(1) nuget pack "nuget\bootstrap.nuspec" -Verbosity detailed -NonInteractive -BasePath . -Version $bsversion - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } nuget pack "nuget\bootstrap.sass.nuspec" -Verbosity detailed -NonInteractive -BasePath . -Version $bsversion - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - - name: Log in to NuGet with trusted publishing - id: login - uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1 - with: - user: mdo - - - name: Publish NuGet packages - shell: pwsh - env: - PACKAGE_VERSION: ${{ steps.package.outputs.version }} - NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }} - run: | - $bsversion = $env:PACKAGE_VERSION - nuget push "bootstrap.$bsversion.nupkg" -Verbosity detailed -NonInteractive -Source "https://api.nuget.org/v3/index.json" -ApiKey $env:NUGET_API_KEY -SkipDuplicate - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - nuget push "bootstrap.sass.$bsversion.nupkg" -Verbosity detailed -NonInteractive -Source "https://api.nuget.org/v3/index.json" -ApiKey $env:NUGET_API_KEY -SkipDuplicate - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + nuget push "bootstrap.$bsversion.nupkg" -Verbosity detailed -NonInteractive -Source "https://api.nuget.org/v3/index.json" + nuget push "bootstrap.sass.$bsversion.nupkg" -Verbosity detailed -NonInteractive -Source "https://api.nuget.org/v3/index.json" diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml deleted file mode 100644 index 87785245ab..0000000000 --- a/.github/workflows/release-notes.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Release notes - -on: - push: - branches: - - main - workflow_dispatch: - -permissions: - contents: read - -jobs: - update_release_draft: - permissions: - # allow release-drafter/release-drafter to create GitHub releases and add labels to PRs - contents: write - pull-requests: write - runs-on: ubuntu-latest - if: github.repository == 'twbs/bootstrap' - steps: - - uses: release-drafter/release-drafter@978bb0b30c5ee8cdd332ced253758157150d43f0 # v7.10.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 572be7019a..69034206e9 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -73,6 +73,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 + uses: github/codeql-action/upload-sarif@1fc58d04a4d4374f921bdac573c3811c240f9c26 # v4.39.2 with: sarif_file: results.sarif diff --git a/.gitignore b/.gitignore index 235ad54948..ad178781bc 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,8 @@ # OS or Editor folders ._* .cache +.claude +.cursor .DS_Store .idea .project @@ -36,7 +38,7 @@ Thumbs.db # Folders to ignore /dist-sass/ /js/coverage/ -/node_modules/ +/node_modules # Site /site/dist diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000000..6b09841cb0 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,18 @@ +{ + "default": true, + "MD004": { "style": "dash" }, + "MD011": false, + "MD013": false, + "MD024": false, + "MD025": false, + "MD026": false, + "MD031": false, + "MD033": false, + "MD034": false, + "MD037": false, + "MD038": false, + "MD041": false, + "MD046": false, + "line-length": false, + "no-inline-html": false +} diff --git a/.ncurc.json b/.ncurc.json index 79574b3555..9a02213133 100644 --- a/.ncurc.json +++ b/.ncurc.json @@ -1,23 +1,8 @@ { "reject": [ - "@astrojs/mdx", - "@babel/cli", - "@babel/core", - "@babel/preset-env", - "@docsearch/js", - "astro", - "astro-auto-import", - "eslint", - "eslint-config-xo", - "eslint-plugin-unicorn", "hammer-simulator", - "jasmine", - "jquery", - "karma-browserstack-launcher", - "karma-rollup-preprocessor", "prettier-plugin-astro", - "sass", - "stylelint", - "vnu-jar" + "rolldown", + "stylelint" ] } diff --git a/.stylelintrc.json b/.stylelintrc.json deleted file mode 100644 index 589884aae7..0000000000 --- a/.stylelintrc.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "extends": [ - "stylelint-config-twbs-bootstrap" - ], - "reportInvalidScopeDisables": true, - "reportNeedlessDisables": true, - "overrides": [ - { - "files": "**/*.scss", - "rules": { - "declaration-property-value-disallowed-list": { - "border": "none", - "outline": "none" - }, - "function-disallowed-list": [ - "calc", - "lighten", - "darken" - ], - "property-disallowed-list": [ - "border-radius", - "border-top-left-radius", - "border-top-right-radius", - "border-bottom-right-radius", - "border-bottom-left-radius", - "transition" - ], - "scss/dollar-variable-default": [ - true, - { - "ignore": "local" - } - ], - "scss/selector-no-union-class-name": true - } - }, - { - "files": "scss/**/*.{test,spec}.scss", - "rules": { - "scss/dollar-variable-default": null, - "declaration-no-important": null - } - }, - { - "files": "site/**/*.scss", - "rules": { - "scss/dollar-variable-default": null - } - }, - { - "files": "site/**/examples/**/*.css", - "rules": { - "comment-empty-line-before": null, - "property-no-vendor-prefix": null, - "selector-no-qualifying-type": null, - "value-no-vendor-prefix": null - } - } - ] -} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000..d096362488 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,112 @@ +# AGENTS.md + +Guidance for AI coding agents working in this repository. Tool-agnostic; `CLAUDE.md` points here. + +Bootstrap v6.0.0-alpha.1 — CSS/JS framework. +Sass source in `scss/`, TypeScript source in `js/src/`, docs site in `site/` (Astro 5 + MDX). + +## Quick commands + +- `npm start` — dev server (watch + Astro on port 9001) +- `npm run dist` — full CSS + JS build +- `npm run css` — compile, prefix, minify CSS +- `npm run js` — compile + minify JS +- `npm run css-lint` / `npm run js-lint` — lint +- `npm run docs-build` — build docs site +- `npm test` — full test suite (lint + dist + tests + docs) + +## Writing style + +Use ASD-STE100 Simplified Technical English for all prose: replies to the user, docs, code comments, commit messages, and PR text. + +- Write short sentences. Use approximately 20 words or fewer. +- Give one instruction per sentence. +- Use the active voice. Name the actor. +- Use simple verbs. Do not use a complex verb when a simple one works. +- Use one term for one thing. Keep terms the same across the project. +- Keep paragraphs short. Cover one topic per paragraph. + +## Reply length + +Be extremely brief. Report the result, not the journey. + +- Target 75 words or fewer. Hard cap 150 words, and only for a genuinely multi-part answer. +- Answer in the first sentence. Then stop. +- Give one supporting fact per claim, at most. Cut the rest. +- Do not narrate your process, tool calls, or verification steps. Report a check only when it failed or changed the outcome. +- Do not restate the work you just did. The user reads the diff, the commit, and the PR. +- State a finding once. Never repeat it in a summary or closing line. +- No headings. No tables. Use a list of 5 items or fewer only when the answer is a real list. +- Cut praise, apologies, hedging, and filler such as "great question" or "worth noting". +- Do not explain what you did not do, or list caveats the user did not ask about. +- Do not offer next steps unless the user asks or the work is blocked. +- Expand only when the user asks for detail, or asks you to teach. + +## Teaching + +Act as a teacher for JavaScript, TypeScript, React, and all JavaScript-family topics. + +- When the work hits a new problem, concept, or language feature, stop and explain it. +- Keep each explanation short and plain. Define jargon on first use. +- Use a small code example when it makes the idea clear. +- Assume strong HTML/CSS knowledge. Do not assume deep JS internals knowledge. + +## SCSS conventions + +- Variable naming: `$component-state-property-size` (e.g., `$nav-link-disabled-color`) +- Module system: `@use` / `@forward` only — never `@import` +- Token system: component tokens are SCSS maps of CSS custom properties, merged via `defaults()`, output via `@include tokens($map)` on the component root selector +- Disallowed: raw `border-radius` / `transition` properties (use mixins), `lighten()` / `darken()`, `border: none` / `outline: none` +- Order: `@use` → `@forward` → `$variables` → `--custom-properties` → declarations → rules +- Variables use `!default` (except locals) +- CSS layers: `colors, config, root, reboot, layout, content, forms, components, custom, helpers, utilities` +- Logical properties: prefer `padding-inline-start` over `padding-left`, etc. +- Modern CSS: `color-mix()`, `light-dark()`, range media queries (`@media (width >= 1024px)`) +- Doc markers: `// scss-docs-start name` / `// scss-docs-end name` for docs extraction + +## JavaScript/TypeScript conventions + +- Source is TypeScript (`js/src/**/*.ts`, entry `js/src/index.ts`); ESM-only, no semicolons, 2-space indent +- Imports use `.js` extensions (standard TS ESM style); Rolldown resolves them to `.ts` via `resolve.extensionAlias`, Vitest via the `tsResolve` plugin in `js/tests/vitest.config.mts` +- Dist builds use Rolldown (`build/rolldown.config.mjs`, `build/build-plugins.mjs`) with built-in TS transforms; `build/browser-targets.mjs` derives the browser floors from `.browserslistrc` at build time, so there is nothing to keep in sync. Rollup and Babel are gone from the repo — Vitest transforms the specs itself +- Strict tsconfig with `verbatimModuleSyntax` + `erasableSyntaxOnly`; `tsc` only type-checks and emits `.d.ts` (`npm run js-typecheck`, `npm run js-emit-types`) +- Components extend `BaseComponent` (which extends `Config`); per-component config `type XxxConfig` typed off `Default`, refined on the class via `protected declare _config: XxxConfig` +- Instance fields use `declare` (no runtime emit); constructor `element` param stays optional to keep `typeof Component` assignable to `typeof BaseComponent` +- Every `_`-prefixed instance member is `protected` (never `private`, so subclasses keep access); public API methods and statics stay public. This keeps the internals out of the published `.d.ts` surface +- Constants: `NAME`, `DATA_KEY`, `EVENT_KEY`, `VERSION` +- DOM utilities via `dom/event-handler.ts`, `dom/selector-engine.ts`, `dom/manipulator.ts` +- Floating UI for positioning (dropdown, tooltip, popover) +- Tests: Vitest browser mode (real Chromium via Playwright), config in `js/tests/vitest.config.mts`, specs in `js/tests/unit/*.spec.js` (plain JS, bundled against the TS sources). `js/tests/vitest-setup.js` maps the Jasmine API the specs are written against onto Vitest — note `spyOn` stubs by default, unlike `vi.spyOn`. Async specs return a promise; Vitest 4 dropped `done`. Coverage is Istanbul over all of `js/src`, thresholds 90/88/90/90 +- Type-level API tests in `js/tests/types/` — `api.ts` checks the source (`npm run js-typecheck`), `consumer.ts` checks the shipped `js/dist/*.d.ts` through the package `exports` map (`npm run js-typecheck-dist`, after the build). Keep the two in sync + +## Docs conventions + +- Astro 5 + MDX in `site/src/content/docs/` +- Frontmatter schema: `title` (required), `description` (required), `toc`, `aliases`, `added`, `mdn`, `reference`, etc. +- Shortcodes: `Example`, `Callout`, `Code`, `Details` +- For multiline `` template literals that start on the same line as the shortcode, add two extra spaces to each following line of code. Top-level markup starts with two spaces in the source, and its children start with four. The rendered snippet removes the extra level. Follow `site/src/content/docs/forms/field.mdx` and check the rendered code before committing. +- Internal links: `[[docsref:/path/]]` +- JS component "Dependencies" tables are auto-generated — add a `### Dependencies` heading with `` (before `### Options`) on any doc for a `js/src/*.ts` component. The table is derived at build time by walking the component's import graph in `site/src/libs/js-dependencies.ts`; never hand-write the file list. When a new source file or third-party package enters the graph, add its human-readable label to `FILE_DESCRIPTIONS` / `PACKAGE_DESCRIPTIONS` in that lib (the build throws if a label is missing). + +## Formatting + +- 2 spaces, UTF-8, LF line endings, trim trailing whitespace, final newline +- Preserve smart punctuation (curly apostrophes U+2019, curly quotes) — never replace with ASCII equivalents +- Use `StrReplace` for targeted edits; avoid full-file rewrites on MDX files to protect typography + +## Workflow + +- Validate after changes: `npm run css-lint`, `npm run js-lint`, `npm run dist`, `npm run docs-build` +- Keep config files in sync: `config.yml`, `site/src/libs/config.ts` (Zod schema), `build/rolldown.config.mjs`, `build/generate-sri.mjs`, `package.json` +- For rebases/conflicts: favor base branch structure, layer feature changes on top + +## Commits & PRs + +- Commit messages: direct, succinct prose explaining why the change was made. +- PR descriptions: direct bulleted lists, minimal fluff — one bullet per notable change. +- Reference related issues/PRs explicitly with `Fixes #{issue}`, `Closes #{issue}`, or `Supersedes #{pr}`. +- No "Test plan" section and no extra headings — just the bullets and the references. + +## Do not edit + +Built output in `dist/`, `_site/`, `js/dist/` — these are generated. diff --git a/README.md b/README.md index 114d7c831b..76007fe97e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- Bootstrap logo + Bootstrap logo

@@ -9,7 +9,7 @@

Sleek, intuitive, and powerful front-end framework for faster and easier web development.
- Explore Bootstrap docs » + Explore Bootstrap docs »

Report bug @@ -19,11 +19,9 @@ Blog

+## Bootstrap 6 -## Bootstrap 5 - -Our default branch is for development of our Bootstrap 5 release. Head to the [`v4-dev` branch](https://github.com/twbs/bootstrap/tree/v4-dev) to view the readme, documentation, and source code for Bootstrap 4. - +Our default branch is for development of our Bootstrap 6 release. Head to the [`v5-dev` branch](https://github.com/twbs/bootstrap/tree/v5-dev) to view the readme, documentation, and source code for Bootstrap 5. ## Table of contents @@ -39,21 +37,19 @@ Our default branch is for development of our Bootstrap 5 release. Head to the [` - [Thanks](#thanks) - [Copyright and license](#copyright-and-license) - ## Quick start Several quick start options are available: -- [Download the latest release](https://github.com/twbs/bootstrap/archive/v5.3.9.zip) +- [Download the latest release](https://github.com/twbs/bootstrap/archive/v6.0.0-alpha.1.zip) - Clone the repo: `git clone https://github.com/twbs/bootstrap.git` -- Install with [npm](https://www.npmjs.com/): `npm install bootstrap@v5.3.9` -- Install with [yarn](https://yarnpkg.com/): `yarn add bootstrap@v5.3.9` -- Install with [Bun](https://bun.sh/): `bun add bootstrap@v5.3.9` -- Install with [Composer](https://getcomposer.org/): `composer require twbs/bootstrap:5.3.9` +- Install with [npm](https://www.npmjs.com/): `npm install bootstrap@6.0.0-alpha.1` +- Install with [yarn](https://yarnpkg.com/): `yarn add bootstrap@6.0.0-alpha.1` +- Install with [Bun](https://bun.sh/): `bun add bootstrap@6.0.0-alpha.1` +- Install with [Composer](https://getcomposer.org/): `composer require twbs/bootstrap:6.0.0-alpha.1` - Install with [NuGet](https://www.nuget.org/): CSS: `Install-Package bootstrap` Sass: `Install-Package bootstrap.sass` -Read the [Getting started page](https://getbootstrap.com/docs/5.3/getting-started/introduction/) for information on the framework contents, templates, examples, and more. - +Read the [Getting started page](https://getbootstrap.com/docs/6.0/getting-started/) for information on the framework contents, templates, examples, and more. ## Status @@ -68,11 +64,10 @@ Read the [Getting started page](https://getbootstrap.com/docs/5.3/getting-starte [![CSS Brotli size](https://img.badgesize.io/twbs/bootstrap/main/dist/css/bootstrap.min.css?compression=brotli&label=CSS%20Brotli%20size)](https://github.com/twbs/bootstrap/blob/main/dist/css/bootstrap.min.css) [![JS gzip size](https://img.badgesize.io/twbs/bootstrap/main/dist/js/bootstrap.min.js?compression=gzip&label=JS%20gzip%20size)](https://github.com/twbs/bootstrap/blob/main/dist/js/bootstrap.min.js) [![JS Brotli size](https://img.badgesize.io/twbs/bootstrap/main/dist/js/bootstrap.min.js?compression=brotli&label=JS%20Brotli%20size)](https://github.com/twbs/bootstrap/blob/main/dist/js/bootstrap.min.js) -![Open Source Security Foundation Scorecard](https://img.shields.io/ossf-scorecard/github.com/twbs/bootstrap) +[![Open Source Security Foundation Scorecard](https://img.shields.io/ossf-scorecard/github.com/twbs/bootstrap)](https://scorecard.dev/viewer/?uri=github.com/twbs/bootstrap) [![Backers on Open Collective](https://img.shields.io/opencollective/backers/bootstrap?logo=opencollective&logoColor=fff)](#backers) [![Sponsors on Open Collective](https://img.shields.io/opencollective/sponsors/bootstrap?logo=opencollective&logoColor=fff)](#sponsors) - ## What’s included Within the download you’ll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. @@ -87,43 +82,23 @@ Within the download you’ll find the following directories and files, logically │ ├── bootstrap-grid.css.map │ ├── bootstrap-grid.min.css │ ├── bootstrap-grid.min.css.map - │ ├── bootstrap-grid.rtl.css - │ ├── bootstrap-grid.rtl.css.map - │ ├── bootstrap-grid.rtl.min.css - │ ├── bootstrap-grid.rtl.min.css.map │ ├── bootstrap-reboot.css │ ├── bootstrap-reboot.css.map │ ├── bootstrap-reboot.min.css │ ├── bootstrap-reboot.min.css.map - │ ├── bootstrap-reboot.rtl.css - │ ├── bootstrap-reboot.rtl.css.map - │ ├── bootstrap-reboot.rtl.min.css - │ ├── bootstrap-reboot.rtl.min.css.map │ ├── bootstrap-utilities.css │ ├── bootstrap-utilities.css.map │ ├── bootstrap-utilities.min.css │ ├── bootstrap-utilities.min.css.map - │ ├── bootstrap-utilities.rtl.css - │ ├── bootstrap-utilities.rtl.css.map - │ ├── bootstrap-utilities.rtl.min.css - │ ├── bootstrap-utilities.rtl.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css - │ ├── bootstrap.min.css.map - │ ├── bootstrap.rtl.css - │ ├── bootstrap.rtl.css.map - │ ├── bootstrap.rtl.min.css - │ └── bootstrap.rtl.min.css.map + │ └── bootstrap.min.css.map └── js/ ├── bootstrap.bundle.js ├── bootstrap.bundle.js.map ├── bootstrap.bundle.min.js ├── bootstrap.bundle.min.js.map - ├── bootstrap.esm.js - ├── bootstrap.esm.js.map - ├── bootstrap.esm.min.js - ├── bootstrap.esm.min.js.map ├── bootstrap.js ├── bootstrap.js.map ├── bootstrap.min.js @@ -131,19 +106,17 @@ Within the download you’ll find the following directories and files, logically ``` -We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). [Source maps](https://web.dev/articles/source-maps) (`bootstrap.*.map`) are available for use with certain browsers’ developer tools. Bundled JS files (`bootstrap.bundle.js` and minified `bootstrap.bundle.min.js`) include [Popper](https://github.com/floating-ui/popper-docs/blob/main/docs/v2/index.md). - +We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). [Source maps](https://web.dev/articles/source-maps) (`bootstrap.*.map`) are available for use with certain browsers' developer tools. Bundled JS files (`bootstrap.bundle.js` and minified `bootstrap.bundle.min.js`) include [Floating UI](https://floating-ui.com/) and [Vanilla Calendar Pro](https://vanilla-calendar.pro/). All CSS files work for both LTR and RTL layouts thanks to logical properties—simply set `dir="rtl"` on your HTML element. ## Bugs and feature requests Have a bug or a feature request? Please first read the [issue guidelines](https://github.com/twbs/bootstrap/blob/main/.github/CONTRIBUTING.md#using-the-issue-tracker) and search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/twbs/bootstrap/issues/new/choose). - ## Documentation Bootstrap’s documentation, included in this repo in the root directory, is built with [Astro](https://astro.build/) and publicly hosted on GitHub Pages at . The docs may also be run locally. -Documentation search is powered by [Pagefind](https://pagefind.app/). Run `npm run docs-build` before starting the local dev server to generate the search index. +Documentation search is powered by [Pagefind](https://pagefind.app/). ### Running documentation locally @@ -160,7 +133,6 @@ You can find all our previous releases docs on . - ## Community Get updates on Bootstrap’s development and chat with the project maintainers and community members. - Follow [@getbootstrap on X](https://x.com/getbootstrap). - Read and subscribe to [The Official Bootstrap Blog](https://blog.getbootstrap.com/). -- Ask questions and explore [our GitHub Discussions](https://github.com/twbs/bootstrap/discussions). +- Ask questions and explore [our GitHub Discussions](https://github.com/orgs/twbs/discussions). - Discuss, ask questions, and more on [the community Discord](https://discord.gg/bZUvakRU3M) or [Bootstrap subreddit](https://www.reddit.com/r/bootstrap/). - Chat with fellow Bootstrappers in IRC. On the `irc.libera.chat` server, in the `#bootstrap` channel. - Implementation help may be found at Stack Overflow (tagged [`bootstrap-5`](https://stackoverflow.com/questions/tagged/bootstrap-5)). - Developers should use the keyword `bootstrap` on packages which modify or add to the functionality of Bootstrap when distributing through [npm](https://www.npmjs.com/browse/keyword/bootstrap) or similar delivery mechanisms for maximum discoverability. - ## Versioning For transparency into our release cycle and in striving to maintain backward compatibility, Bootstrap is maintained under [the Semantic Versioning guidelines](https://semver.org/). Sometimes we screw up, but we adhere to those rules whenever possible. See [the Releases section of our GitHub project](https://github.com/twbs/bootstrap/releases) for changelogs for each release version of Bootstrap. Release announcement posts on [the official Bootstrap blog](https://blog.getbootstrap.com/) contain summaries of the most noteworthy changes made in each release. - ## Creators -**Mark Otto** +### Mark Otto - - -**Jacob Thornton** +### Jacob Thornton - - - ## Thanks - - BrowserStack - - -Thanks to [BrowserStack](https://www.browserstack.com/) for providing the infrastructure that allows us to test in real browsers! - Netlify Thanks to [Netlify](https://www.netlify.com/) for providing us with Deploy Previews! - ## Sponsors Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/bootstrap#sponsor)] @@ -233,14 +194,12 @@ Support this project by becoming a sponsor. Your logo will show up here with a l [![OC sponsor 8](https://opencollective.com/bootstrap/sponsor/8/avatar.svg)](https://opencollective.com/bootstrap/sponsor/8/website) [![OC sponsor 9](https://opencollective.com/bootstrap/sponsor/9/avatar.svg)](https://opencollective.com/bootstrap/sponsor/9/website) - ## Backers Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/bootstrap#backer)] [![Backers](https://opencollective.com/bootstrap/backers.svg?width=890)](https://opencollective.com/bootstrap#backers) - ## Copyright and license Code and documentation copyright 2011-2026 the [Bootstrap Authors](https://github.com/twbs/bootstrap/graphs/contributors). Code released under the [MIT License](https://github.com/twbs/bootstrap/blob/main/LICENSE). Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/). diff --git a/build/browser-targets.mjs b/build/browser-targets.mjs new file mode 100644 index 0000000000..2c21bfc646 --- /dev/null +++ b/build/browser-targets.mjs @@ -0,0 +1,54 @@ +/*! + * Browser floors for the Rolldown transform, derived from `.browserslistrc`. + * Rolldown does not read browserslist, so we resolve the browser list here and + * map it to the esbuild-style target strings that oxc understands. + * Copyright 2026 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import browserslist from 'browserslist' + +// oxc only accepts these engines. Chromium- and Gecko-based mobile browsers map +// onto their desktop equivalent, because they share the engine we transform for. +// Samsung Internet and Opera Mobile have no oxc target and are left out; both +// track Chromium releases above our Chrome floor. +// A Map keeps the browserslist IDs as plain strings, so their snake_case names +// do not fight the camelcase rule. +const OXC_TARGETS = new Map([ + ['chrome', 'chrome'], + ['and_chr', 'chrome'], + ['android', 'chrome'], + ['edge', 'edge'], + ['firefox', 'firefox'], + ['and_ff', 'firefox'], + ['safari', 'safari'], + ['ios_saf', 'ios'], + ['opera', 'opera'] +]) + +const floors = new Map() + +for (const entry of browserslist()) { + // Browser names can hold a space, so split on the last one + const index = entry.lastIndexOf(' ') + const target = OXC_TARGETS.get(entry.slice(0, index)) + + if (!target) { + continue + } + + // Skip non-numeric versions such as `TP`, and take the low end of a range + // like `18.5-18.7` + const version = Number.parseFloat(entry.slice(index + 1)) + + if (Number.isNaN(version)) { + continue + } + + if (!floors.has(target) || version < floors.get(target)) { + floors.set(target, version) + } +} + +export default [...floors].map(([target, version]) => `${target}${version}`) diff --git a/build/build-plugins.mjs b/build/build-plugins.mjs index b5a88d7c06..d7388368c9 100644 --- a/build/build-plugins.mjs +++ b/build/build-plugins.mjs @@ -8,86 +8,54 @@ import path from 'node:path' import { fileURLToPath } from 'node:url' -import { babel } from '@rollup/plugin-babel' import { globby } from 'globby' -import { rollup } from 'rollup' +import { rolldown } from 'rolldown' import banner from './banner.mjs' +import browserTargets from './browser-targets.mjs' const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(fileURLToPath(import.meta.url)) const sourcePath = path.resolve(__dirname, '../js/src/').replace(/\\/g, '/') -const jsFiles = await globby(`${sourcePath}/**/*.js`) +const distPath = path.resolve(__dirname, '../js/dist/').replace(/\\/g, '/') +const tsFiles = await globby(`${sourcePath}/**/*.ts`) -// Array which holds the resolved plugins +// Array which holds the resolved plugins. The package entry (js/src/index.ts) +// is built by the same loop; its type declarations come from `js-emit-types`. const resolvedPlugins = [] -// Trims the "js" extension and uppercases => first letter, hyphens, backslashes & slashes -const filenameToEntity = filename => filename.replace('.js', '') - .replace(/(?:^|-|\/|\\)[a-z]/g, str => str.slice(-1).toUpperCase()) - -for (const file of jsFiles) { +for (const file of tsFiles) { resolvedPlugins.push({ src: file, - dist: file.replace('src', 'dist'), - fileName: path.basename(file), - className: filenameToEntity(path.basename(file)) - // safeClassName: filenameToEntity(path.relative(sourcePath, file)) + dist: file.replace(sourcePath, distPath).replace(/\.ts$/, '.js'), + fileName: path.basename(file).replace(/\.ts$/, '.js') }) } const build = async plugin => { - /** - * @type {import('rollup').GlobalsOption} - */ - const globals = {} - - const bundle = await rollup({ + const bundle = await rolldown({ input: plugin.src, - plugins: [ - babel({ - // Only transpile our source code - exclude: 'node_modules/**', - // Include the helpers in each file, at most one copy of each - babelHelpers: 'bundled' - }) - ], - external(source) { - // Pattern to identify local files - const pattern = /^(\.{1,2})\// - - // It's not a local file, e.g a Node.js package - if (!pattern.test(source)) { - globals[source] = source - return true - } - - const usedPlugin = resolvedPlugins.find(plugin => { - return plugin.src.includes(source.replace(pattern, '')) - }) - - if (!usedPlugin) { - throw new Error(`Source ${source} is not mapped!`) - } - - // We can change `Index` with `UtilIndex` etc if we use - // `safeClassName` instead of `className` everywhere - globals[path.normalize(usedPlugin.src)] = usedPlugin.className - return true + // Keep every import external, so each plugin file mirrors its source module + external: () => true, + resolve: { + // Map ESM-style `.js` specifiers to the `.ts` sources on disk + extensionAlias: { '.js': ['.ts', '.js'] } + }, + transform: { + target: browserTargets } }) await bundle.write({ banner: banner(plugin.fileName), - format: 'umd', - name: plugin.className, + format: 'esm', sourcemap: true, - globals, - generatedCode: 'es2015', file: plugin.dist }) - console.log(`Built ${plugin.className}`) + await bundle.close() + + console.log(`Built ${plugin.fileName}`) } (async () => { diff --git a/build/bundlewatch-fix.mjs b/build/bundlewatch-fix.mjs new file mode 100644 index 0000000000..2b20e55324 --- /dev/null +++ b/build/bundlewatch-fix.mjs @@ -0,0 +1,55 @@ +#!/usr/bin/env node + +import { execSync } from 'node:child_process' +import fs from 'node:fs' + +const configPath = '.bundlewatch.config.json' + +let stdout +try { + stdout = execSync('npx bundlewatch --config .bundlewatch.config.json', { + encoding: 'utf8', + stdio: ['pipe', 'pipe', 'pipe'] + }) +} catch (error) { + stdout = error.stdout || '' +} + +const failLines = stdout.split('\n').filter(l => l.startsWith('FAIL')) + +if (failLines.length === 0) { + console.log('All files are within their bundlewatch limits. Nothing to fix.') + process.exit(0) +} + +const config = JSON.parse(fs.readFileSync(configPath, 'utf8')) + +const parseSize = str => Number.parseFloat(str.replace('KB', '')) +const ceilToQuarter = n => Math.ceil(n / 0.25) * 0.25 +const formatSize = n => { + const frac = n % 1 + const decimals = (frac === 0 || frac === 0.5) ? 1 : 2 + return `${n.toFixed(decimals)} kB` +} + +for (const line of failLines) { + const match = line.match(/(FAIL)\s+(.+?):\s+([\d.]+KB)\s+([<>])\s+([\d.]+KB)/) + if (!match) { + continue + } + + const file = match[2] + const currentSize = parseSize(match[3]) + const oldMax = formatSize(parseSize(match[5])) + const newMax = ceilToQuarter(currentSize) + const newMaxStr = formatSize(newMax) + + const entry = config.files.find(f => f.path === `./${file}` || f.path === file) + if (entry) { + entry.maxSize = newMaxStr + console.log(`Updated ${file}: ${oldMax} -> ${newMaxStr}`) + } +} + +fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`) +console.log(`\nUpdated ${configPath}`) diff --git a/build/bundlewatch-table.mjs b/build/bundlewatch-table.mjs new file mode 100644 index 0000000000..e4759881ba --- /dev/null +++ b/build/bundlewatch-table.mjs @@ -0,0 +1,93 @@ +#!/usr/bin/env node + +import { execSync } from 'node:child_process' + +// Run bundlewatch and capture output +let stdout +let exitCode = 0 + +try { + stdout = execSync('npx bundlewatch --config .bundlewatch.config.json', { + encoding: 'utf8', + stdio: ['pipe', 'pipe', 'pipe'] + }) +} catch (error) { + stdout = error.stdout || '' + exitCode = error.status || 1 +} + +// Parse lines that contain PASS or FAIL +const lines = stdout.split('\n').filter(l => l.startsWith('PASS') || l.startsWith('FAIL')) + +if (lines.length === 0) { + console.log(stdout) + process.exit(exitCode) +} + +// Parse size string to number (KB) +const parseSize = str => Number.parseFloat(str.replace('KB', '')) + +// Calculate column widths and headroom +const rows = lines.map(line => { + const match = line.match(/(PASS|FAIL)\s+(.+?):\s+([\d.]+KB)\s+([<>])\s+([\d.]+KB)/) + if (match) { + const sizeNum = parseSize(match[3]) + const maxNum = parseSize(match[5]) + const headroomNum = maxNum - sizeNum + const headroom = `${headroomNum.toFixed(2)}KB` + return { + status: match[1], + file: match[2], + size: match[3], + max: match[5], + headroomNum, + headroom: match[1] === 'PASS' ? `+${headroom}` : `-${Math.abs(headroomNum).toFixed(2)}KB` + } + } + + return null +}).filter(Boolean) + +const maxFileLen = Math.max(...rows.map(r => r.file.length), 4) +const maxSizeLen = Math.max(...rows.map(r => r.size.length), 4) +const maxMaxLen = Math.max(...rows.map(r => r.max.length), 3) +const maxHeadroomLen = Math.max(...rows.map(r => r.headroom.length), 8) + +// Build table +const hr = `+-${'-'.repeat(maxFileLen)}-+-${'-'.repeat(maxSizeLen)}-+-${'-'.repeat(maxMaxLen)}-+-${'-'.repeat(maxHeadroomLen)}-+` + +console.log('') +console.log('bundlewatch results') +console.log(hr) +console.log(`| ${'File'.padEnd(maxFileLen)} | ${'Size'.padStart(maxSizeLen)} | ${'Max'.padStart(maxMaxLen)} | ${'Headroom'.padStart(maxHeadroomLen)} |`) +console.log(hr) + +const green = '\u001B[32m' +const red = '\u001B[31m' +const reset = '\u001B[0m' + +for (const row of rows) { + const sizeColor = row.status === 'PASS' ? green : red + const coloredSize = `${sizeColor}${row.size.padStart(maxSizeLen)}${reset}` + const headroomColor = row.headroomNum > 0.25 ? red : '' + const headroomReset = row.headroomNum > 0.25 ? reset : '' + const coloredHeadroom = `${headroomColor}${row.headroom.padStart(maxHeadroomLen)}${headroomReset}` + console.log(`| ${row.file.padEnd(maxFileLen)} | ${coloredSize} | ${row.max.padStart(maxMaxLen)} | ${coloredHeadroom} |`) +} + +console.log(hr) + +// Summary +const passed = rows.filter(r => r.status === 'PASS').length +const failed = rows.filter(r => r.status === 'FAIL').length + +console.log('') +if (failed > 0) { + console.log(`\u001B[31mbundlewatch FAIL\u001B[0m - ${passed} passed, ${failed} failed`) +} else { + console.log(`\u001B[32mbundlewatch PASS\u001B[0m - ${passed}/${rows.length} files within limits`) +} + +console.log('') + +process.exit(exitCode) diff --git a/build/change-version.mjs b/build/change-version.mjs index c1433d5780..0c33c43fdc 100644 --- a/build/change-version.mjs +++ b/build/change-version.mjs @@ -9,18 +9,29 @@ import { execFile } from 'node:child_process' import fs from 'node:fs/promises' import process from 'node:process' +import { promisify } from 'node:util' const VERBOSE = process.argv.includes('--verbose') const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-run') +const execFileAsync = promisify(execFile) // These are the files we only care about replacing the version const FILES = [ + '.cursor/skills/bootstrap-release/SKILL.md', + '.github/workflows/linkinator.yml', + 'AGENTS.md', 'README.md', 'config.yml', - 'js/src/base-component.js', + 'js/src/base-component.ts', 'package.js', - 'scss/mixins/_banner.scss', - 'site/data/docs-versions.yml' + 'scss/_banner.scss', + 'site/data/docs-versions.yml', + 'skills/bootstrap-npm/SKILL.md', + 'skills/bootstrap-parcel/SKILL.md', + 'skills/bootstrap-v5-v6-migration/SKILL.md', + 'skills/bootstrap-v6-install/SKILL.md', + 'skills/bootstrap-vite/SKILL.md', + 'skills/bootstrap-webpack/SKILL.md' ] // Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37 @@ -62,17 +73,12 @@ async function replaceRecursively(file, oldVersion, newVersion) { await fs.writeFile(file, newString, 'utf8') } -function bumpNpmVersion(newVersion) { +async function bumpNpmVersion(newVersion) { if (DRY_RUN) { return } - execFile('npm', ['version', newVersion, '--no-git-tag'], { shell: true }, error => { - if (error) { - console.error(error) - process.exit(1) - } - }) + await execFileAsync('npm', ['version', newVersion, '--no-git-tag-version']) } function showUsage(args) { @@ -98,9 +104,8 @@ async function main(args) { showUsage(args) } - bumpNpmVersion(newVersion) - try { + await bumpNpmVersion(newVersion) await Promise.all( FILES.map(file => replaceRecursively(file, oldVersion, newVersion)) ) diff --git a/build/check-unused-imports.mjs b/build/check-unused-imports.mjs new file mode 100644 index 0000000000..6ebfa15705 --- /dev/null +++ b/build/check-unused-imports.mjs @@ -0,0 +1,345 @@ +#!/usr/bin/env node + +/*! + * Script to detect unused SCSS @use statements. + * + * Copyright 2017-2026 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ + +import { readFileSync, readdirSync, existsSync } from 'node:fs' +import path from 'node:path' + +const DISABLE_FILE = 'check-unused-imports-disable' +const DISABLE_NEXT_LINE = 'check-unused-imports-disable-next-line' +const DISABLE_LINE = 'check-unused-imports-disable-line' + +function findScssFiles(dirs) { + const files = [] + for (const dir of dirs) { + const resolvedDir = path.resolve(dir) + if (!existsSync(resolvedDir)) { + throw new Error(`Directory does not exist: ${dir}`) + } + + walk(resolvedDir, files) + } + + return files.sort() +} + +function walk(dir, results) { + for (const entry of readdirSync(dir, { withFileTypes: true })) { + const full = path.join(dir, entry.name) + if (entry.isDirectory()) { + walk(full, results) + } else if (entry.name.endsWith('.scss')) { + results.push(full) + } + } +} + +function parseUseStatements(content) { + const lines = content.split('\n') + const uses = [] + + for (const line of lines) { + const trimmed = line.trim() + if (trimmed === '' || trimmed.startsWith('//')) { + if (trimmed.includes(DISABLE_FILE)) { + return [] + } + + continue + } + + break + } + + for (let i = 0; i < lines.length; i++) { + const trimmed = lines[i].trim() + if (!trimmed.startsWith('@use ')) { + continue + } + + // Suppression comments + if (trimmed.includes(DISABLE_LINE)) { + continue + } + + if (i > 0 && lines[i - 1].trim().includes(DISABLE_NEXT_LINE)) { + continue + } + + if (/\bwith\s*\(/.test(trimmed)) { + continue + } + + const match = trimmed.match(/^@use\s+["']([^"']+)["'](?:\s+as\s+(\*|[\w-]+))?/) + if (!match) { + continue + } + + const modulePath = match[1] + const asClause = match[2] + + let namespace + let isGlob = false + + if (asClause === '*') { + isGlob = true + namespace = '*' + } else if (asClause) { + namespace = asClause + } else { + namespace = modulePath.split('/').at(-1).replace(/^_/, '') + } + + uses.push({ + line: i + 1, + modulePath, + namespace, + isGlob, + isBuiltin: modulePath.startsWith('sass:') + }) + } + + return uses +} + +function resolveModule(modulePath, fromFile) { + if (modulePath.startsWith('sass:')) { + return null + } + + const fromDir = path.dirname(fromFile) + const target = path.resolve(fromDir, modulePath) + const dir = path.dirname(target) + const base = path.basename(target) + + const candidates = [ + path.join(dir, `_${base}.scss`), + `${target}.scss`, + path.join(target, '_index.scss'), + path.join(target, 'index.scss') + ] + + for (const c of candidates) { + if (existsSync(c)) { + return c + } + } + + return null +} + +const exportCache = new Map() + +function getModuleExports(filePath) { + if (!filePath || !existsSync(filePath)) { + return { variables: new Set(), mixins: new Set(), functions: new Set() } + } + + const real = path.resolve(filePath) + if (exportCache.has(real)) { + return exportCache.get(real) + } + + const exports = { variables: new Set(), mixins: new Set(), functions: new Set() } + exportCache.set(real, exports) + + const content = readFileSync(real, 'utf8') + const lines = content.split('\n') + + for (const line of lines) { + const v = line.match(/^\$([a-zA-Z][\w-]*)\s*:/) + if (v) { + exports.variables.add(v[1]) + } + + const m = line.match(/^@mixin\s+([a-zA-Z][\w-]*)/) + if (m) { + exports.mixins.add(m[1]) + } + + const f = line.match(/^@function\s+([a-zA-Z][\w-]*)/) + if (f) { + exports.functions.add(f[1]) + } + } + + for (const line of lines) { + const fwd = line.trim().match(/^@forward\s+["']([^"']+)["']/) + if (fwd) { + const resolved = resolveModule(fwd[1], real) + if (resolved) { + const fwdExports = getModuleExports(resolved) + for (const variable of fwdExports.variables) { + exports.variables.add(variable) + } + + for (const mixin of fwdExports.mixins) { + exports.mixins.add(mixin) + } + + for (const fn of fwdExports.functions) { + exports.functions.add(fn) + } + } + } + } + + return exports +} + +function escapeRegExp(s) { + return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') +} + +function isNamespaceUsed(namespace, body) { + return new RegExp(`(? 0 || + moduleExports.mixins.size > 0 || + moduleExports.functions.size > 0 + + if (!hasExports) { + return false + } + + return !isGlobImportUsed(moduleExports, body) +} + +function main() { + const args = process.argv.slice(2) + if (args.length === 0) { + console.error('Usage: node check-unused-imports.mjs [dir2] ...') + process.exit(2) + } + + let files + try { + files = findScssFiles(args) + } catch (error) { + console.error(error.message) + process.exit(2) + } + + let total = 0 + for (const file of files) { + const content = readFileSync(file, 'utf8') + const uses = parseUseStatements(content) + if (uses.length === 0) { + continue + } + + const body = getBody(content) + for (const use of uses) { + if (isUseUnused(use, body, file)) { + const rel = path.relative(process.cwd(), file) + console.log(`${rel}:${use.line}\tUnused @use "${use.modulePath}"`) + total++ + } + } + } + + if (total > 0) { + console.log(`\nFound ${total} unused @use statement${total === 1 ? '' : 's'}`) + process.exit(1) + } +} + +main() diff --git a/build/clean-astro.mjs b/build/clean-astro.mjs new file mode 100644 index 0000000000..dfe204ca36 --- /dev/null +++ b/build/clean-astro.mjs @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +/*! + * Clean Astro's generated directories. + * Copyright 2026 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ + +import fs from 'node:fs/promises' +import path from 'node:path' +import { fileURLToPath } from 'node:url' + +const __dirname = path.dirname(fileURLToPath(import.meta.url)) +const rootDir = path.join(__dirname, '..') +const generatedDirs = [ + path.join(rootDir, 'site/.astro'), + path.join(rootDir, 'site/node_modules/.astro') +] + +await Promise.all(generatedDirs.map(directory => fs.rm(directory, { force: true, recursive: true }))) diff --git a/build/copy-site.mjs b/build/copy-site.mjs new file mode 100644 index 0000000000..99cffca0d3 --- /dev/null +++ b/build/copy-site.mjs @@ -0,0 +1,19 @@ +#!/usr/bin/env node + +/*! + * Copy the built Astro site to the deployment directory. + * Copyright 2026 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ + +import fs from 'node:fs/promises' +import path from 'node:path' +import { fileURLToPath } from 'node:url' + +const __dirname = path.dirname(fileURLToPath(import.meta.url)) +const rootDir = path.join(__dirname, '..') +const sourceDir = path.join(rootDir, 'site/dist') +const destinationDir = path.join(rootDir, '_site') + +await fs.rm(destinationDir, { force: true, recursive: true }) +await fs.cp(sourceDir, destinationDir, { recursive: true }) diff --git a/build/css-minify.mjs b/build/css-minify.mjs new file mode 100644 index 0000000000..19082d61fc --- /dev/null +++ b/build/css-minify.mjs @@ -0,0 +1,74 @@ +#!/usr/bin/env node + +/** + * CSS minification script using lightningcss + * + * This replaces clean-css which doesn't support modern CSS features + * like light-dark(), color-mix(), @layer, etc. + */ + +import fs from 'node:fs' +import path from 'node:path' +import { transform, browserslistToTargets, Features } from 'lightningcss' + +const distDir = path.join(process.cwd(), 'dist/css') + +// Get all CSS files that need minification +const cssFiles = fs.readdirSync(distDir) + .filter(file => file.endsWith('.css') && !file.endsWith('.min.css')) + +// Target browsers (read from .browserslistrc when available) +let targets +try { + // eslint-disable-next-line import/no-extraneous-dependencies + const { default: browserslist } = await import('browserslist') + const browsers = browserslist() + console.log('Target browsers from .browserslistrc:', browsers) + targets = browserslistToTargets(browsers) +} catch { + console.error('Could not load browserslist') +} + +for (const file of cssFiles) { + const inputPath = path.join(distDir, file) + const outputPath = path.join(distDir, file.replace('.css', '.min.css')) + const mapPath = `${outputPath}.map` + + console.log(`Minifying ${file}...`) + + const inputCss = fs.readFileSync(inputPath, 'utf8') + const inputMap = fs.existsSync(`${inputPath}.map`) ? + JSON.parse(fs.readFileSync(`${inputPath}.map`, 'utf8')) : + undefined + + try { + const result = transform({ + filename: file, + code: Buffer.from(inputCss), + minify: true, + sourceMap: true, + inputSourceMap: inputMap ? JSON.stringify(inputMap) : undefined, + targets, + // Never lower `light-dark()`: its custom-property polyfill breaks our + // `data-bs-theme` dark mode. We bumped browser support to versions with + // native support to fix this, but this guards against a regression. + exclude: Features.LightDark + }) + + // Write minified CSS with source map reference + const minifiedCss = `${result.code.toString()}\n/*# sourceMappingURL=${path.basename(mapPath)} */` + fs.writeFileSync(outputPath, minifiedCss) + + // Write source map + if (result.map) { + fs.writeFileSync(mapPath, result.map.toString()) + } + + console.log(` ✓ ${file} → ${path.basename(outputPath)}`) + } catch (error) { + console.error(` ✗ Error minifying ${file}:`, error.message) + process.exit(1) + } +} + +console.log('\nCSS minification complete!') diff --git a/build/generate-sri.mjs b/build/generate-sri.mjs index 3d9ce7f5b1..921400f7a5 100644 --- a/build/generate-sri.mjs +++ b/build/generate-sri.mjs @@ -29,10 +29,6 @@ const files = [ file: 'dist/css/bootstrap.min.css', configPropertyName: 'css_hash' }, - { - file: 'dist/css/bootstrap.rtl.min.css', - configPropertyName: 'css_rtl_hash' - }, { file: 'dist/js/bootstrap.min.js', configPropertyName: 'js_hash' @@ -40,10 +36,6 @@ const files = [ { file: 'dist/js/bootstrap.bundle.min.js', configPropertyName: 'js_bundle_hash' - }, - { - file: 'node_modules/@popperjs/core/dist/umd/popper.min.js', - configPropertyName: 'popper_hash' } ] diff --git a/build/generate-utilities-json.mjs b/build/generate-utilities-json.mjs new file mode 100644 index 0000000000..3c5e93331a --- /dev/null +++ b/build/generate-utilities-json.mjs @@ -0,0 +1,87 @@ +#!/usr/bin/env node + +/** + * Generate utilities metadata JSON from Sass + * This script compiles a special Sass file that outputs utility information as CSS comments, + * then extracts and saves it as JSON for documentation use. + */ + +import { readFileSync, writeFileSync, unlinkSync } from 'node:fs' +import { execSync } from 'node:child_process' +import { fileURLToPath } from 'node:url' +import path from 'node:path' + +const __dirname = path.dirname(fileURLToPath(import.meta.url)) +const rootDir = path.join(__dirname, '..') + +// Compile the metadata generator SCSS file +console.log('Compiling utilities metadata...') + +try { + execSync( + 'sass --style expanded --no-source-map build/generate-utilities-metadata.scss:dist/css/utilities-metadata.tmp.css', + { cwd: rootDir, stdio: 'inherit' } + ) +} catch { + console.error('Failed to compile metadata SCSS') + process.exit(1) +} + +// Read the compiled CSS +const cssPath = path.join(rootDir, 'dist/css/utilities-metadata.tmp.css') +const cssContent = readFileSync(cssPath, 'utf8') + +// Extract JSON from the CSS comment +const startMarker = 'BOOTSTRAP-UTILITIES-METADATA-START' +const endMarker = 'BOOTSTRAP-UTILITIES-METADATA-END' + +const startIndex = cssContent.indexOf(startMarker) +const endIndex = cssContent.indexOf(endMarker) + +if (startIndex === -1 || endIndex === -1) { + console.error('Could not find metadata markers in compiled CSS') + process.exit(1) +} + +// Extract JSON content between markers +const jsonContent = cssContent + .slice(startIndex + startMarker.length, endIndex) + .trim() + +// Validate JSON +try { + const parsed = JSON.parse(jsonContent) + console.log(`✓ Extracted metadata for ${Object.keys(parsed.utilities).length} utilities`) + + // Write to JSON file + const outputPath = path.join(rootDir, 'dist/css/bootstrap-utilities.metadata.json') + writeFileSync(outputPath, JSON.stringify(parsed, null, 2)) + console.log(`✓ Wrote metadata to ${outputPath}`) + + // Clean up temporary CSS files + try { + unlinkSync(cssPath) + } catch { + // File may not exist + } + + // Also clean up any other temporary variants that may have been created + const tempFiles = [ + 'dist/css/utilities-metadata.tmp.min.css', + 'dist/css/utilities-metadata.tmp.min.css.map' + ] + + for (const file of tempFiles) { + try { + unlinkSync(path.join(rootDir, file)) + } catch { + // File may not exist, ignore + } + } + + console.log('✓ Cleaned up temporary files') +} catch (error) { + console.error('Failed to parse extracted JSON:', error.message) + console.error('Extracted content:', jsonContent.slice(0, 500)) + process.exit(1) +} diff --git a/build/generate-utilities-metadata.scss b/build/generate-utilities-metadata.scss new file mode 100644 index 0000000000..3789de00c4 --- /dev/null +++ b/build/generate-utilities-metadata.scss @@ -0,0 +1,123 @@ +// Generate utilities metadata JSON for documentation +// This file is compiled to extract utility information without generating CSS + +@use "sass:map"; +@use "sass:list"; +@use "sass:string"; +@use "sass:meta"; +@use "../scss/config" as *; +@use "../scss/colors" as *; +@use "../scss/functions" as *; +@use "../scss/theme" as *; +@use "../scss/utilities" as *; + +// Access the utilities map +$utilities-map: $utilities !default; + +// Start JSON output +$json: '{"utilities":{' !default; + +$utility-count: 0 !default; +$total-utilities: list.length(map.keys($utilities-map)) !default; + +@each $key, $utility in $utilities-map { + $utility-count: $utility-count + 1; + + // Skip if utility is null or false (disabled) + @if $utility { + // Extract class prefix + $class: $key; + @if map.has-key($utility, "class") { + $class: map.get($utility, "class"); + } + + // Extract property + $property: null; + @if map.has-key($utility, "property") { + $property: map.get($utility, "property"); + } + + // Extract values + $values: null; + @if map.has-key($utility, "values") { + $values: map.get($utility, "values"); + } + + // Generate class list + $classes: ""; + @if $values { + @if meta.type-of($values) == "map" { + $value-keys: map.keys($values); + $first: true; + @each $value-key in $value-keys { + @if not $first { + $classes: $classes + ", "; + } + $class-name: "#{$class}-#{$value-key}"; + @if $value-key == "null" or $value-key == null { + $class-name: $class; + } + $classes: $classes + '"' + $class-name + '"'; + $first: false; + } + } @else if meta.type-of($values) == "list" { + $first: true; + @each $value in $values { + @if not $first { + $classes: $classes + ", "; + } + $class-name: "#{$class}-#{$value}"; + $classes: $classes + '"' + $class-name + '"'; + $first: false; + } + } + } + + // Build JSON entry + $json: $json + '"' + $key + '":{"class":"' + $class + '"'; + + @if $property { + @if meta.type-of($property) == "string" { + $json: $json + ',"property":"' + $property + '"'; + } @else if meta.type-of($property) == "list" { + $property-str: ""; + $first: true; + @each $prop in $property { + @if not $first { + $property-str: $property-str + " "; + } + $property-str: $property-str + $prop; + $first: false; + } + $json: $json + ',"property":"' + $property-str + '"'; + } + // Skip map properties as they're complex and don't translate to JSON well + } + + @if $classes != "" { + $json: $json + ',"classes":[' + $classes + "]"; + } @else { + $json: $json + ',"classes":[]'; + } + + $json: $json + "}"; + + @if $utility-count < $total-utilities { + $json: $json + ","; + } + } +} + +// stylelint-disable-next-line scss/dollar-variable-default +$json: $json + "}}"; + +// Output as CSS comment so it appears in compiled file + +/*! BOOTSTRAP-UTILITIES-METADATA-START +#{$json} +BOOTSTRAP-UTILITIES-METADATA-END */ + +// Prevent any actual CSS output +.bootstrap-utilities-metadata-generator { + content: "This file should not generate CSS, only metadata comments"; +} diff --git a/build/html-validate.mjs b/build/html-validate.mjs new file mode 100644 index 0000000000..1ad686efee --- /dev/null +++ b/build/html-validate.mjs @@ -0,0 +1,104 @@ +#!/usr/bin/env node + +/*! + * Script to run html-validate for HTML validation. + * + * This replaces the Java-based vnu-jar validator with a faster, Node.js-only solution. + * Benefits: + * - No Java dependency required + * - Faster execution (no JVM startup time) + * - Easy to configure with rule-based system + * - Better integration with Node.js build tools + * + * Copyright 2017-2026 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ + +import { HtmlValidate } from 'html-validate' +import { globby } from 'globby' + +const htmlValidate = new HtmlValidate({ + rules: { + // Allow autocomplete on buttons (Bootstrap specific) + 'attribute-allowed-values': 'off', + // Allow aria-disabled on links (Bootstrap specific) + 'aria-label-misuse': 'off', + // Allow modern CSS syntax + 'valid-id': 'off', + // Allow void elements with trailing slashes (Astro) + 'void-style': 'off', + // Allow custom attributes + 'no-unknown-elements': 'off', + 'attribute-boolean-style': 'off', + 'no-inline-style': 'off', + // KEEP duplicate ID checking enabled (this is important for HTML validity) + 'no-dup-id': 'error' + }, + elements: [ + 'html5', + { + // Allow custom attributes for Astro/framework compatibility + '*': { + attributes: { + 'is:raw': { boolean: true }, + switch: { boolean: true }, + autocomplete: { enum: ['on', 'off', 'new-password', 'current-password'] } + } + } + } + ] +}) + +async function validateHTML() { + try { + console.log('Running html-validate validation...') + + // Find all HTML files + const files = await globby([ + '_site/**/*.html', + 'js/tests/**/*.html' + ], { + ignore: ['**/node_modules/**'] + }) + + console.log(`Validating ${files.length} HTML files...`) + + let hasErrors = false + + // Validate all files in parallel to avoid await-in-loop + const validationPromises = files.map(file => + htmlValidate.validateFile(file).then(report => ({ file, report })) + ) + + const validationResults = await Promise.all(validationPromises) + + // Process results and check for errors + for (const { file, report } of validationResults) { + if (!report.valid) { + hasErrors = true + console.error(`\nErrors in ${file}:`) + + // Extract error messages with reduced nesting + const errorMessages = report.results.flatMap(result => + result.messages.filter(message => message.severity === 2) + ) + + for (const message of errorMessages) { + console.error(` Line ${message.line}:${message.column} - ${message.message} (${message.ruleId})`) + } + } + } + + if (hasErrors) { + console.error('\nHTML validation failed!') + process.exit(1) + } else { + console.log('✓ All HTML files are valid!') + } + } catch (error) { + console.error('HTML validation error:', error) + process.exit(1) + } +} + +validateHTML() diff --git a/build/postcss.config.mjs b/build/postcss.config.mjs index 7717cfc3f1..7fe36ec06a 100644 --- a/build/postcss.config.mjs +++ b/build/postcss.config.mjs @@ -1,17 +1,37 @@ +import postcssPrefixCustomProperties from 'postcss-prefix-custom-properties' +import autoprefixer from 'autoprefixer' + const mapConfig = { inline: false, annotation: true, sourcesContent: true } +// Autoprefixer prefixes `transition` inside `::-webkit-slider-thumb` and +// `::-moz-range-thumb` rules because the selector itself is prefixed, not because +// any target needs it. Transitions have been unprefixed everywhere for years, and +// the unprefixed declaration is always emitted alongside, so drop the prefixed one. +const removeRedundantPrefixes = { + postcssPlugin: 'remove-redundant-prefixes', + OnceExit(root) { + root.walkDecls(decl => { + if (decl.prop === '-webkit-transition' || decl.prop === '-moz-transition') { + decl.remove() + } + }) + } +} + export default context => { return { map: context.file.dirname.includes('examples') ? false : mapConfig, - plugins: { - autoprefixer: { - cascade: false - }, - rtlcss: context.env === 'RTL' - } + plugins: [ + postcssPrefixCustomProperties({ + prefix: 'bs-', + ignore: [/^--bs-/, /^--bd-/] + }), + autoprefixer({ cascade: false }), + removeRedundantPrefixes + ] } } diff --git a/build/rolldown.config.mjs b/build/rolldown.config.mjs new file mode 100644 index 0000000000..d5a697af1c --- /dev/null +++ b/build/rolldown.config.mjs @@ -0,0 +1,40 @@ +import path from 'node:path' +import process from 'node:process' +import { fileURLToPath } from 'node:url' +import { defineConfig } from 'rolldown' +import banner from './banner.mjs' +import browserTargets from './browser-targets.mjs' + +const __dirname = path.dirname(fileURLToPath(import.meta.url)) + +const BUNDLE = process.env.BUNDLE === 'true' + +let destinationFile = 'bootstrap' +const external = ['@floating-ui/dom', 'vanilla-calendar-pro'] +const define = {} + +if (BUNDLE) { + destinationFile += '.bundle' + // Bundle all dependencies (Floating UI, Vanilla Calendar Pro, etc.) + external.length = 0 + define['process.env.NODE_ENV'] = '"production"' +} + +export default defineConfig({ + input: path.resolve(__dirname, '../js/src/index.ts'), + external, + resolve: { + // Our TS sources import siblings with the ESM-style `.js` extension; + // map those specifiers to the `.ts` files on disk + extensionAlias: { '.js': ['.ts', '.js'] } + }, + transform: { + target: browserTargets, + define + }, + output: { + banner: banner(), + file: path.resolve(__dirname, `../dist/js/${destinationFile}.js`), + format: 'esm' + } +}) diff --git a/build/rollup.config.mjs b/build/rollup.config.mjs deleted file mode 100644 index dd6c7d13e6..0000000000 --- a/build/rollup.config.mjs +++ /dev/null @@ -1,59 +0,0 @@ -import path from 'node:path' -import process from 'node:process' -import { fileURLToPath } from 'node:url' -import { babel } from '@rollup/plugin-babel' -import { nodeResolve } from '@rollup/plugin-node-resolve' -import replace from '@rollup/plugin-replace' -import banner from './banner.mjs' - -const __dirname = path.dirname(fileURLToPath(import.meta.url)) - -const BUNDLE = process.env.BUNDLE === 'true' -const ESM = process.env.ESM === 'true' - -let destinationFile = `bootstrap${ESM ? '.esm' : ''}` -const external = ['@popperjs/core'] -const plugins = [ - babel({ - // Only transpile our source code - exclude: 'node_modules/**', - // Include the helpers in the bundle, at most one copy of each - babelHelpers: 'bundled' - }) -] -const globals = { - '@popperjs/core': 'Popper' -} - -if (BUNDLE) { - destinationFile += '.bundle' - // Remove last entry in external array to bundle Popper - external.pop() - delete globals['@popperjs/core'] - plugins.push( - replace({ - 'process.env.NODE_ENV': '"production"', - preventAssignment: true - }), - nodeResolve() - ) -} - -const rollupConfig = { - input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`), - output: { - banner: banner(), - file: path.resolve(__dirname, `../dist/js/${destinationFile}.js`), - format: ESM ? 'esm' : 'umd', - globals, - generatedCode: 'es2015' - }, - external, - plugins -} - -if (!ESM) { - rollupConfig.output.name = 'bootstrap' -} - -export default rollupConfig diff --git a/build/screenshot-examples.mjs b/build/screenshot-examples.mjs new file mode 100644 index 0000000000..bfd6ccc7a1 --- /dev/null +++ b/build/screenshot-examples.mjs @@ -0,0 +1,202 @@ +/** + * Screenshot Bootstrap examples using Playwright. + * + * Starts the Astro dev server automatically, waits for it to be ready, + * takes light + dark screenshots at 1x and 2x, then shuts the server down. + * + * Usage: + * node build/screenshot-examples.mjs [--only album,pricing] + * + * Prerequisites: + * npm install -D playwright + * npx playwright install chromium + * + * The script reads examples.yml and saves to: + * site/static/docs/[version]/assets/img/examples/{slug}.png (480×300) + * site/static/docs/[version]/assets/img/examples/{slug}@2x.png (960×600) + * site/static/docs/[version]/assets/img/examples/{slug}-dark.png (480×300) + * site/static/docs/[version]/assets/img/examples/{slug}-dark@2x.png (960×600) + */ + +import { readFileSync, mkdirSync } from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import { spawn } from 'node:child_process' +import { parse as parseYaml } from 'yaml' +import { chromium } from 'playwright' +import sharp from 'sharp' + +const __dirname = path.dirname(fileURLToPath(import.meta.url)) +const ROOT = path.resolve(__dirname, '..') + +// ─── Config ────────────────────────────────────────────────────────────────── + +const args = process.argv.slice(2) +const getArg = flag => { + const idx = args.indexOf(flag) + return idx === -1 ? null : args[idx + 1] +} + +const ONLY = getArg('--only')?.split(',').map(s => s.trim().toLowerCase()) ?? null + +// Astro dev server port (matches astro-dev in package.json) +const PORT = 9001 +const BASE_URL = `http://localhost:${PORT}` +const SERVER_TIMEOUT_MS = 60_000 +const SERVER_POLL_INTERVAL_MS = 500 + +// Read docs version from config.yml +const configYml = readFileSync(path.resolve(ROOT, 'config.yml'), 'utf8') +const DOCS_VERSION = parseYaml(configYml).docs_version ?? '6.0' + +// Output directory — [version] is a literal Astro dynamic-route folder name +const OUT_DIR = path.resolve(ROOT, 'site/static/docs/[version]/assets/img/examples') +mkdirSync(OUT_DIR, { recursive: true }) + +// Full-width capture viewport; images are then resized down to thumbnail sizes +const CAPTURE_VIEWPORT = { width: 1440, height: 900 } +// 1x thumbnail: 480×300 | 2x thumbnail: 960×600 +const THUMB = { w: 480, h: 300 } + +// ─── Dev server ────────────────────────────────────────────────────────────── + +/** Spawn the Astro dev server and return the child process. */ +function startDevServer() { + console.log('Starting Astro dev server…') + const server = spawn('node', ['node_modules/.bin/astro', 'dev', '--root', 'site', '--port', String(PORT)], { + cwd: ROOT, + stdio: ['ignore', 'pipe', 'pipe'] + }) + server.stdout.on('data', d => process.stdout.write(`[astro] ${d}`)) + server.stderr.on('data', d => process.stderr.write(`[astro] ${d}`)) + return server +} + +/** Poll until the server responds or timeout is reached. */ +async function waitForServer() { + const deadline = Date.now() + SERVER_TIMEOUT_MS + + const poll = async () => { + if (Date.now() >= deadline) { + throw new Error(`Dev server did not start within ${SERVER_TIMEOUT_MS / 1000}s`) + } + + try { + const res = await fetch(`${BASE_URL}/`) + if (res.ok || res.status < 500) { + console.log('Dev server is ready.\n') + return + } + } catch { + // not up yet + } + + await new Promise(resolvePromise => { + setTimeout(resolvePromise, SERVER_POLL_INTERVAL_MS) + }) + + await poll() + } + + await poll() +} + +// ─── Helpers ───────────────────────────────────────────────────────────────── + +/** Replicate the getSlug() logic used in the Astro components */ +function getSlug(name) { + return name + .toLowerCase() + .replace(/[^a-z0-9]+/g, '-') + .replace(/(^-|-$)/g, '') +} + +/** Collect all non-external examples from examples.yml */ +function getExamples() { + const yml = readFileSync(path.resolve(ROOT, 'site/data/examples.yml'), 'utf8') + const categories = parseYaml(yml) + const result = [] + for (const { examples, external } of categories) { + if (external) { + continue + } + + for (const example of examples ?? []) { + result.push(example.name) + } + } + + return result +} + +// ─── Screenshot ────────────────────────────────────────────────────────────── + +/** + * Capture the page at full viewport, then resize to the target thumbnail size. + * colorScheme: 'light' | 'dark' + * scale: 1 (480×300) | 2 (960×600) + */ +async function screenshot(page, slug, colorScheme, scale) { + const darkSuffix = colorScheme === 'dark' ? '-dark' : '' + const scaleSuffix = scale === 2 ? '@2x' : '' + const outFile = path.resolve(OUT_DIR, `${slug}${darkSuffix}${scaleSuffix}.png`) + + await page.emulateMedia({ colorScheme }) + const rawBuffer = await page.screenshot({ type: 'png' }) + + await sharp(rawBuffer) + .resize(THUMB.w * scale, THUMB.h * scale, { fit: 'cover', position: 'top' }) + .toFile(outFile) + + console.log(` saved ${outFile.replace(`${ROOT}/`, '')}`) +} + +async function run() { + const examples = getExamples() + const filtered = ONLY ? examples.filter(n => ONLY.includes(n.toLowerCase())) : examples + + if (filtered.length === 0) { + throw new Error('No examples matched. Check --only values against examples.yml.') + } + + const server = startDevServer() + + // Ensure the server is killed even if we crash + const cleanup = () => server.kill() + process.on('exit', cleanup) + + try { + await waitForServer() + + console.log(`Taking screenshots of ${filtered.length} example(s)`) + console.log(`Output → ${OUT_DIR}\n`) + + const browser = await chromium.launch() + + await Promise.all(filtered.map(async name => { + const slug = getSlug(name) + const url = `${BASE_URL}/docs/${DOCS_VERSION}/examples/${slug}/` + console.log(`→ ${name} (${slug})`) + + // Single page load — reuse for light & dark, both scales (sharp handles resizing) + const page = await browser.newPage({ viewport: CAPTURE_VIEWPORT, deviceScaleFactor: 1 }) + await page.goto(url, { waitUntil: 'networkidle' }) + await page.addStyleTag({ content: '.bd-mode-toggle { display: none !important; }' }) + await screenshot(page, slug, 'light', 1) + await screenshot(page, slug, 'light', 2) + await screenshot(page, slug, 'dark', 1) + await screenshot(page, slug, 'dark', 2) + await page.close() + })) + + await browser.close() + console.log('\nDone.') + } finally { + server.kill() + } +} + +run().catch(error => { + console.error(error) + process.exitCode = 1 +}) diff --git a/build/test-grid-layout.mjs b/build/test-grid-layout.mjs new file mode 100644 index 0000000000..9d3a141773 --- /dev/null +++ b/build/test-grid-layout.mjs @@ -0,0 +1,287 @@ +/* eslint-disable no-await-in-loop -- Cases share one browser page and must run sequentially. */ +import assert from 'node:assert/strict' +import process from 'node:process' +import { fileURLToPath } from 'node:url' +import path from 'node:path' +import * as sass from 'sass' +import { chromium, firefox, webkit } from 'playwright' + +const root = + process.env.GRID_TEST_ROOT || + fileURLToPath(new URL('../', import.meta.url)) +const engine = process.env.GRID_TEST_BROWSER || 'chromium' +const browsers = { chromium, firefox, webkit } +assert.ok(browsers[engine], `Unknown browser: ${engine}`) +const browser = await browsers[engine].launch({ + headless: true, + timeout: 15000, + ...(process.env.GRID_TEST_EXECUTABLE ? + { executablePath: process.env.GRID_TEST_EXECUTABLE } : + {}), + ...(process.env.GRID_TEST_CHANNEL ? + { channel: process.env.GRID_TEST_CHANNEL } : + {}) +}) +const compile = columns => + sass.compileString( + `@use "bootstrap"${columns ? ` with ($grid-columns: ${columns})` : ''};`, + { + loadPaths: [path.join(root, 'scss')] + } + ).css +const css = compile() +const near = (actual, expected, name) => + assert.ok( + Math.abs(actual - expected) < 0.15, + `${name}: ${actual} != ${expected}` + ) +const column = (span, extra = '') => + `
` +let checks = 0 + +try { + const page = await browser.newPage() + await page.route('**/*', route => route.abort()) + async function render( + markup, + { width = 1200, dir = 'ltr', viewport = 1400, styles = css } = {} + ) { + await page.setViewportSize({ width: viewport, height: 900 }) + await page.setContent( + `
${markup}
` + ) + } + + async function boxes(selector = '.fixture > .row') { + return page.locator(selector).evaluateAll(rows => + rows.map(row => { + // eslint-disable-next-line unicorn/consistent-function-scoping -- This callback runs in the browser. + const rect = element => { + const r = element.getBoundingClientRect() + return { + x: r.x, + y: r.y, + width: r.width, + height: r.height, + right: r.right, + bottom: r.bottom + } + } + + return { row: rect(row), children: [...row.children].map(rect) } + }) + ) + } + + // Every ordered two- and three-column partition of twelve, including fractional widths. + const partitions = [] + for (let a = 1; a < 12; a++) { + partitions.push([a, 12 - a]) + for (let b = 1; b < 12 - a; b++) { + partitions.push([a, b, 12 - a - b]) + } + } + + const scenarios = [1200, 671.5, 320].flatMap(width => + ['ltr', 'rtl'].map(dir => ({ width, dir })) + ) + for (const { width, dir } of scenarios) { + await render( + partitions + .map( + spans => + `
${spans.map(s => column(s)).join('')}
` + ) + .join(''), + { width, dir } + ) + const layouts = await boxes() + for (const [index, { row, children }] of layouts.entries()) { + for (const [j, child] of children.entries()) { + near( + child.width, + (((width + 24) * partitions[index][j]) / 12) - 24, + 'numbered width' + ) + near(child.y, row.y, 'partition must not wrap') + const previous = children[j - 1] || row + near( + dir === 'ltr' ? + child.x - (j ? previous.right : row.x) : + (j ? previous.x : row.right) - child.right, + j ? 24 : 0, + 'horizontal gap and row edge' + ) + } + + checks++ + } + } + + for (const dir of ['ltr', 'rtl']) { + await render( + `${Array.from( + { length: 11 }, + (_, i) => `
${column(11 - i, `offset-${i + 1}`)}
` + ).join('') + }
${column(3)}${column(6, 'offset-3')}
`, + { dir } + ) + const offsetLayouts = await boxes() + for (const [i, { row, children }] of offsetLayouts.entries()) { + const last = children.at(-1) + near( + dir === 'ltr' ? last.right : row.right - last.x, + 1200, + 'offset reaches row end' + ) + if (i < 11) { + near( + dir === 'ltr' ? last.x - row.x : row.right - last.right, + (1224 * (i + 1)) / 12, + 'offset tracks' + ) + } + + checks++ + } + } + + await render(`
${column(8)}${column(6)}
`) + let [layout] = await boxes() + near(layout.children[1].y - layout.children[0].bottom, 16, 'wrapped row gap') + near(layout.children[1].x, layout.row.x, 'wrapped column starts at row edge') + checks++ + + await render( + `
Auto
${column(6)}
` + ); + [layout] = await boxes() + near(layout.children[2].width, 588, 'fixed column alongside auto columns') + near( + layout.children[0].width + + layout.children[1].width + + layout.children[2].width + + 48, + 1200, + 'auto fills remaining width' + ) + checks++ + + await render( + `
${Array.from({ length: 5 }, () => '
').join('')}
` + ); + [layout] = await boxes() + for (const child of layout.children) { + near(child.width, 384, 'row-cols width') + } + + near(layout.children[3].x, layout.row.x, 'row-cols wraps') + near( + layout.children[3].y - layout.children[0].bottom, + 16, + 'row-cols vertical gap' + ) + checks++ + + await render( + `
${column(3)}${column(9)}
${column(6)}
` + ) + const [nested] = await boxes('.row .row') + near(nested.row.width, 588, 'nested row has no negative margins') + near(nested.children[0].width, 129, 'nested span') + near(nested.children[1].right, nested.row.right, 'nested row fills parent') + near( + await page + .locator('.fixture > .standalone') + .evaluate(e => e.getBoundingClientRect().width), + 600, + 'standalone percentage width' + ) + near( + await page + .locator('.row .standalone') + .evaluate(e => e.getBoundingClientRect().width), + 294, + 'non-direct child keeps percentage width' + ) + checks++ + + // Responsive row-cols must retain the original specificity against numbered columns. + for (const viewport of [375, 900]) { + await render( + `
${column(6)}${column(6)}${column(6)}
${column(6, 'offset-6 md:offset-0')}
`, + { width: viewport, viewport } + ) + const [responsive, offset] = await boxes() + const count = viewport < 768 ? 2 : 3 + near( + responsive.children[0].width, + ((responsive.row.width + 24) / count) - 24, + 'responsive row-cols overrides' + ) + near( + offset.children[0].x, + viewport < 768 ? (offset.row.width + 24) / 2 : 0, + 'responsive offset reset' + ) + checks++ + } + + await render(`
${column(6)}${column(6)}
`); + [layout] = await boxes() + near(layout.children[0].width, 600, 'zero gutter width') + near(layout.children[1].x - layout.children[0].right, 0, 'zero gutter gap') + checks++ + + await render( + '
' + ); + [layout] = await boxes() + for (const child of layout.children) { + near(child.width, 400, 'zero gutter row-cols') + } + + checks++ + + await render(`
${column(3)}${column(7)}
`, { + styles: compile(10) + }); + [layout] = await boxes() + near(layout.children[0].width, 343.2, 'custom column count') + near(layout.children[1].right, 1200, 'custom grid fills row') + checks++ + + const gridOnly = sass.compile(path.join(root, 'scss/bootstrap-grid.scss')).css + for (const styles of [css, gridOnly]) { + for (const dir of ['ltr', 'rtl']) { + await render( + `
${column(6)}${column(6)}
`, + { dir, styles: `${styles} .cell { padding: 12px; border: 2px solid; }` } + ); + [layout] = await boxes() + near(layout.children[0].width, 588, 'padded column includes borders and padding') + near(layout.children[1].y, layout.children[0].y, 'padded columns do not wrap without reboot') + checks++ + } + } + + if (process.env.GRID_TEST_SCREENSHOT) { + await render( + `
${column(3)}${column(3)}${column(6)}
${column(9, 'offset-3')}
` + ) + await page + .locator('.fixture') + .screenshot({ path: process.env.GRID_TEST_SCREENSHOT }) + } + + console.log(`${checks} grid layouts passed in ${engine}.`) +} finally { + await browser.close() +} diff --git a/build/tsconfig.dts.json b/build/tsconfig.dts.json new file mode 100644 index 0000000000..4eab1ea5bb --- /dev/null +++ b/build/tsconfig.dts.json @@ -0,0 +1,12 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "noEmit": false, + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true, + "rootDir": "../js/src", + "outDir": "../js/dist" + }, + "include": ["../js/src/**/*.ts"] +} diff --git a/build/vnu-jar.mjs b/build/vnu-jar.mjs deleted file mode 100644 index 97e112d771..0000000000 --- a/build/vnu-jar.mjs +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env node - -/*! - * Script to run vnu-jar if Java is available. - * Copyright 2017-2026 The Bootstrap Authors - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - */ - -import { execFile, spawn } from 'node:child_process' -import vnu from 'vnu-jar' - -execFile('java', ['-version'], (error, stdout, stderr) => { - if (error) { - console.error('Skipping vnu-jar test; Java is probably missing.') - console.error(error) - return - } - - console.log('Running vnu-jar validation...') - - const is32bitJava = !/64-Bit/.test(stderr) - - // vnu-jar accepts multiple ignores joined with a `|`. - // Also note that the ignores are string regular expressions. - const ignores = [ - // "autocomplete" is included in `, + ArrowPrev: (e, t) => ``, + Dates: (e) => `
`, + Month: (e) => ``, + Months: (e) => `
`, + Week: (e) => `
`, + Year: (e) => ``, + Years: (e) => `
` +}; +var fe = (e, t) => t.replace(/[\n\t]/g, "").replace(/<#(?!\/?Multiple)(.*?)>/g, (t, n) => { + let a = (n.match(/\[(.*?)\]/) || [])[1], l = ((e, t) => { + var n, a, l, o; + return "Collapse" === t ? null == (n = u(e).weeks) ? void 0 : n.component : "WeekNumbers" === t ? null == (a = u(e).weeks) ? void 0 : a.numbersComponent : "DateRangeTooltip" === t ? null == (l = u(e).annotations) ? void 0 : l.component : "ControlTime" === t ? null == (o = u(e).time) ? void 0 : o.component : Object.prototype.hasOwnProperty.call(ge, t) ? ge[t] : void 0; + })(e, n.replace(/[/\s\n\t]|\[(.*?)\]/g, "")), o = l ? l(e, null == a ? null : a) : ""; + return e.sanitizerHTML(o); +}).replace(/[\n\t]/g, ""); +var xe = (e, t) => { + var n, a, l; + let o = u(e), r = { + default: j, + month: pe, + year: he, + multiple: null == (n = o.months) ? void 0 : n.layout, + week: null == (a = o.weeks) ? void 0 : a.layout + }; + var i; + Object.keys(r).forEach((t) => { + var n, a; + let l = t; + e.layouts[l].length || (e.layouts[l] = null == (n = null == (a = r[l]) ? void 0 : a.call(r, e)) ? "" : n); + }), e.context.mainElement.className = e.styles.calendar, e.context.mainElement.dataset.vc = "calendar", e.context.mainElement.dataset.vcType = e.context.currentType, e.context.mainElement.toggleAttribute("data-vc-swipe", e.enableSwipe), e.context.mainElement.role = e.inputMode ? "dialog" : "group", e.context.mainElement.tabIndex = -1, e.context.mainElement.ariaLabel = e.labels.application, null != (l = o.months) && l.render(e, t) || (null == (i = o.time) || i.destroy(e), e.context.mainElement.innerHTML = e.sanitizerHTML(fe(e, e.layouts[e.context.currentType]))), ((e) => { + let t = ["multiple", "multiple-ranged"].includes(String(e.selectionDatesMode)); + e.context.mainElement.querySelectorAll("[data-vc=\"content\"][role=\"grid\"]").forEach((e) => { + t ? e.setAttribute("aria-multiselectable", "true") : e.removeAttribute("aria-multiselectable"); + }); + })(e); +}; +var be = (e, t, n, a) => { + e.style.visibility = n ? "hidden" : "", t.style.visibility = a ? "hidden" : ""; +}; +var De = (n) => { + if ("month" === n.context.currentType) return; + let a = n.context.mainElement.querySelector("[data-vc-arrow=\"prev\"]"), l = n.context.mainElement.querySelector("[data-vc-arrow=\"next\"]"); + a && l && { + default: () => ((n, a, l) => { + let o = e(t(new Date(n.context.selectedYear, n.context.selectedMonth, 1))), r = new Date(o.getTime()), i = new Date(o.getTime()); + r.setMonth(r.getMonth() - n.monthsToSwitch), i.setMonth(i.getMonth() + n.monthsToSwitch); + let s = e(n.context.dateMin), c = e(n.context.dateMax); + n.selectionYearsMode || (s.setFullYear(o.getFullYear()), c.setFullYear(o.getFullYear())), be(a, l, !n.selectionMonthsMode || r.getFullYear() < s.getFullYear() || r.getFullYear() === s.getFullYear() && r.getMonth() < s.getMonth(), !n.selectionMonthsMode || i.getFullYear() > c.getFullYear() || i.getFullYear() === c.getFullYear() && i.getMonth() > c.getMonth() - (n.context.displayMonthsCount - 1)); + })(n, a, l), + year: () => ((t, n, a) => { + let l = e(t.context.dateMin), o = e(t.context.dateMax); + be(n, a, !!(l.getFullYear() && t.context.displayYear - 7 <= l.getFullYear()), !!(o.getFullYear() && t.context.displayYear + 7 >= o.getFullYear())); + })(n, a, l), + week: () => { + var e; + return null == (e = u(n).weeks) ? void 0 : e.arrows(n, a, l); + } + }["multiple" === n.context.currentType ? "default" : n.context.currentType](); +}; +var Me = (e, t) => { + let n = e.context.mainElement.querySelectorAll("[data-vc=\"month\"]"), a = e.context.mainElement.querySelectorAll("[data-vc=\"year\"]"), l = new Date(e.context.selectedYear, e.context.selectedMonth, 1); + [n, a].forEach((n) => null == n ? void 0 : n.forEach((n, a) => { + (!t || t.includes(a)) && ((e, t, n, a, l) => { + let o = new Date(a.setFullYear(e.context.selectedYear, e.context.selectedMonth + n)).getFullYear(), r = new Date(a.setMonth(e.context.selectedMonth + n)).getMonth(), i = e.context.locale.months.long[r], s = t.closest("[data-vc=\"column\"]"); + s && (s.ariaLabel = `${i} ${o}`); + let c = { + month: { + id: r, + label: i + }, + year: { + id: o, + label: o + } + }; + t.innerText = String(c[l].label), t.dataset[`vc${l.charAt(0).toUpperCase() + l.slice(1)}`] = String(c[l].id), t.ariaLabel = `${e.labels[l]} ${c[l].label}`; + let d = { + month: e.selectionMonthsMode, + year: e.selectionYearsMode + }, u = !1 === d[l] || "only-arrows" === d[l]; + u && (t.tabIndex = -1), t.disabled = u; + })(e, n, a, l, n.dataset.vc); + })); +}; +var we = (e, t, n, a, l) => { + let o = { + month: { + selected: "data-vc-months-month-selected", + aria: "aria-selected", + value: "vcMonthsMonth", + selectedProperty: "selectedMonth" + }, + year: { + selected: "data-vc-years-year-selected", + aria: "aria-selected", + value: "vcYearsYear", + selectedProperty: "selectedYear" + } + }; + var r, i; + l && (null == (r = e.context.mainElement.querySelectorAll({ + month: "[data-vc-months-month]", + year: "[data-vc-years-year]" + }[n])) || r.forEach((e) => { + var t; + e.removeAttribute(o[n].selected), null == (t = e.parentElement) || t.removeAttribute(o[n].aria); + }), g(e, o[n].selectedProperty, Number(t.dataset[o[n].value])), Me(e), "year" === n && De(e)), a && (t.setAttribute(o[n].selected, ""), null == (i = t.parentElement) || i.setAttribute(o[n].aria, "true")); +}; +var Ee = (e, t, n, a, l, o, r, i) => { + let s = "month" === t ? "months" : "years", c = document.createElement("div"); + c.className = e.styles[`${s}Cell`], c.setAttribute(`data-vc-${s}`, "cell"), c.role = "gridcell"; + let d = n.cloneNode(!1); + return d.className = e.styles["month" === t ? "monthsMonth" : "yearsYear"], d.innerText = r, d.ariaLabel = i, d.setAttribute(`data-vc-${s}-${t}`, String(o)), l && (d.ariaDisabled = "true"), l && (d.tabIndex = -1), d.disabled = l, c.appendChild(d), we(e, d, t, a === o, !1), c; +}; +var ke = (e, t) => { + var n, a; + return null == (n = null == (a = u(e).months) ? void 0 : a.column(e, t)) ? { + currentValue: null, + columnID: 0 + } : n; +}; +var Te = (t, n) => { + var a; + let l = null == n || null == (a = n.closest("[data-vc=\"header\"]")) ? void 0 : a.querySelector("[data-vc=\"year\"]"), o = l ? Number(l.dataset.vcYear) : t.context.selectedYear, r = null != n && n.dataset.vcMonth ? Number(n.dataset.vcMonth) : t.context.selectedMonth; + g(t, "currentType", "month"), xe(t, n), Me(t); + let i = t.context.mainElement.querySelector("[data-vc=\"months\"]"); + if (!t.selectionMonthsMode || !i) return; + let s = t.monthsToSwitch > 1 ? t.context.locale.months.long.map((e, n) => r - t.monthsToSwitch * n).concat(t.context.locale.months.long.map((e, n) => r + t.monthsToSwitch * n)).filter((e) => e >= 0 && e <= 12) : Array.from(Array(12).keys()), c = document.createElement("button"); + c.type = "button"; + let d, u = () => ({ + min: e(t.context.dateMin), + max: e(t.context.dateMax), + monthCount: t.context.displayMonthsCount - 1, + columnID: ke(t, "month").columnID + }), m = t.onCreateMonthEls ? void 0 : u(); + for (let e = 0; e < 12; e++) { + e % 4 == 0 && (d = document.createElement("div"), d.className = t.styles.monthsRow, d.dataset.vcMonths = "row", d.role = "row", i.appendChild(d)); + let { min: n, max: a, monthCount: l, columnID: p } = null == m ? u() : m, h = Ee(t, "month", c, r, o <= n.getFullYear() && e < n.getMonth() + p || o >= a.getFullYear() && e > a.getMonth() - l + p || o > a.getFullYear() || e !== r && !s.includes(e), e, t.context.locale.months.short[e], t.context.locale.months.long[e]); + d?.appendChild(h), t.onCreateMonthEls && t.onCreateMonthEls(t, h); + } + de(t); +}; +var Ae = (e) => { + var t; + let n = e.selectedWeekends ? [...e.selectedWeekends] : [], a = [...e.context.locale.weekdays.long].map((t, a) => ({ + id: a, + titleShort: e.context.locale.weekdays.short[a], + titleLong: t, + isWeekend: n.includes(a) + })), l = [...a.slice(e.firstWeekday), ...a.slice(0, e.firstWeekday)], o = null == (t = u(e).weeks) ? void 0 : t.weekday(e), r = document.createElement(o ? "div" : "b"); + e.context.mainElement.querySelectorAll("[data-vc=\"week\"]").forEach((t) => { + l.forEach((n) => { + let a = r.cloneNode(!1); + a.className = e.styles.weekDay, a.role = "columnheader", a.ariaLabel = n.titleLong, a.dataset.vcWeekDay = String(n.id), n.isWeekend && (a.dataset.vcWeekDayOff = ""), o ? o(a, n.titleShort, n.titleLong) : a.innerText = n.titleShort, t.appendChild(a); + }); + }); +}; +var Ce = (t, n) => { + let a = null != n && n.dataset.vcYear ? Number(n.dataset.vcYear) : t.context.selectedYear; + g(t, "currentType", "year"), xe(t, n), Me(t), De(t); + let l = t.context.mainElement.querySelector("[data-vc=\"years\"]"); + if (!t.selectionYearsMode || !l) return; + let o = "multiple" === t.type ? t.context.selectedYear === a ? 0 : 1 : 0, r = document.createElement("button"); + r.type = "button"; + let i, s = () => [e(t.context.dateMin).getFullYear(), e(t.context.dateMax).getFullYear()], c = t.onCreateYearEls ? void 0 : s(); + for (let e = t.context.displayYear - 7; e < t.context.displayYear + 8; e++) { + (e - (t.context.displayYear - 7)) % 5 == 0 && (i = document.createElement("div"), i.className = t.styles.yearsRow, i.dataset.vcYears = "row", i.role = "row", l.appendChild(i)); + let [n, d] = null == c ? s() : c, u = Ee(t, "year", r, a, e < n + o || e > d, e, String(e), String(e)); + i?.appendChild(u), t.onCreateYearEls && t.onCreateYearEls(t, u); + } + de(t); +}; +var Se = /* @__PURE__ */ new WeakMap(); +var $e = (e) => { + var t, n; + let a = "not all" !== window.matchMedia("(prefers-color-scheme)").media; + var l, o; + if (!a || "system" !== e.selectedTheme) return null == (l = (o = e.context).cleanupSystemTheme) || l.call(o), void (e.context.mainElement.dataset.vcTheme = a ? e.selectedTheme : "light"); + let r = e.themeAttrDetect.length ? document.querySelector(e.themeAttrDetect) : null, i = e.themeAttrDetect.replace(/^.*\[(.+)\]/g, (e, t) => t), s = Se.get(e); + if ((null == s ? void 0 : s.element) === r && s.attr === i) return void s.update(); + null == (t = (n = e.context).cleanupSystemTheme) || t.call(n); + let c, d = window.matchMedia("(prefers-color-scheme: dark)"), u = () => { + let t = null == r ? void 0 : r.getAttribute(i), n = !t || "system" === t; + e.context.mainElement.dataset.vcTheme = n ? d.matches ? "dark" : "light" : t, n && !c ? d.addEventListener ? (d.addEventListener("change", u), c = () => d.removeEventListener("change", u)) : (d.addListener(u), c = () => d.removeListener(u)) : !n && c && (c(), c = void 0); + }, m = r ? ((e, t, n) => { + let a = new MutationObserver((e) => { + for (let a = 0; a < e.length; a++) if (e[a].attributeName === t) { + n(); + break; + } + }); + return a.observe(e, { + attributes: !0, + attributeFilter: [t] + }), () => a.disconnect(); + })(r, i, u) : void 0; + Se.set(e, { + element: r, + attr: i, + update: u + }), g(e, "cleanupSystemTheme", () => { + m?.(), c?.(), Se.delete(e), g(e, "cleanupSystemTheme", void 0); + }), u(); +}; +function Ye(e) { + return Ye = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { + return typeof e; + } : function(e) { + return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; + }, Ye(e); +} +function Ne(e, t, n) { + return (t = function(e) { + var t = function(e) { + if ("object" != Ye(e) || !e) return e; + var t = e[Symbol.toPrimitive]; + if (void 0 !== t) { + var n = t.call(e, "string"); + if ("object" != Ye(n)) return n; + throw TypeError("@@toPrimitive must return a primitive value."); + } + return String(e); + }(e); + return "symbol" == Ye(t) ? t : t + ""; + }(t)) in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; +} +function Ie(e, t) { + var n = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var a = Object.getOwnPropertySymbols(e); + t && (a = a.filter(function(t) { + return Object.getOwnPropertyDescriptor(e, t).enumerable; + })), n.push.apply(n, a); + } + return n; +} +function Le(e) { + for (var t = 1; t < arguments.length; t++) { + var n = null == arguments[t] ? {} : arguments[t]; + t % 2 ? Ie(Object(n), !0).forEach(function(t) { + Ne(e, t, n[t]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ie(Object(n)).forEach(function(t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); + }); + } + return e; +} +var We = /* @__PURE__ */ new Map(); +var He = (e, t, n) => { + let a = new Intl.DateTimeFormat(e, { + [t]: n, + timeZone: "UTC" + }); + return Array.from({ length: "weekday" === t ? 7 : 12 }, (e, n) => { + return (l = a.format(new Date(Date.UTC(1978, "month" === t ? n : 0, "weekday" === t ? n + 1 : 1)))).charAt(0).toUpperCase() + l.slice(1).replace(/\./, ""); + var l; + }); +}; +var Oe = (e) => { + if (e.context.locale.weekdays.short[6] && e.context.locale.weekdays.long[6] && e.context.locale.months.short[11] && e.context.locale.months.long[11]) return; + if ("string" != typeof e.locale) { + var t, n, a, l; + if (!(null != (t = e.locale) && null != (t = t.weekdays) && t.short[6] && null != (n = e.locale) && null != (n = n.weekdays) && n.long[6] && null != (a = e.locale) && null != (a = a.months) && a.short[11] && null != (l = e.locale) && null != (l = l.months) && l.long[11])) throw Error(P); + g(e, "locale", Le({}, e.locale)); + return; + } + if ("string" == typeof e.locale && !e.locale.length) throw Error(P); + let o = We.get(e.locale); + o || (o = { + weekdays: { + short: He(e.locale, "weekday", "short"), + long: He(e.locale, "weekday", "long") + }, + months: { + short: He(e.locale, "month", "short"), + long: He(e.locale, "month", "long") + } + }, We.size >= 8 && We.delete(We.keys().next().value), We.set(e.locale, o)); + for (let r of ["weekdays", "months"]) for (let t of ["short", "long"]) e.context.locale[r][t].push(...o[r][t]); +}; +var qe = (e, t = !0) => { + var n; + U(e), $e(e), Oe(e), xe(e), Me(e), De(e), null == (n = u(e).time) || n.render(e), { + default: () => { + Ae(e), ue(e, void 0, !1); + }, + multiple: () => { + Ae(e), ue(e, void 0, !1); + }, + week: () => { + var t; + null == (t = u(e).weeks) || t.init(e), Ae(e), ue(e, void 0, !1); + }, + month: () => Te(e), + year: () => Ce(e) + }[e.context.currentType](), t && Q(e, !0); +}; +var Fe = (t, n = !1) => { + o(t), t.context.mainElement.querySelectorAll("[data-vc-date]").forEach((a) => { + let l = a.querySelector("[data-vc-date-btn]"), o = a.dataset.vcDate, r = e(o), i = r.getDay(); + n && le(t, o, i); + let s = n ? a.dataset.vcDateMonth : "current"; + "prev" === s && r.setMonth(r.getMonth() + 1, 1), "next" === s && r.setMonth(r.getMonth() - 1, 1), te(t, n ? r.getFullYear() : t.context.selectedYear, a, l, i, o, s); + }), de(t); +}; +var Pe = (e) => { + let t = [ + { + container: "[data-vc=\"dates\"]", + row: "[data-vc-dates=\"row\"]", + item: "[data-vc-date-btn]" + }, + { + container: "[data-vc=\"months\"]", + row: "[data-vc-months=\"row\"]", + item: "[data-vc-months-month]" + }, + { + container: "[data-vc=\"years\"]", + row: "[data-vc-years=\"row\"]", + item: "[data-vc-years-year]" + } + ], n = (e) => !e.disabled && "true" !== e.getAttribute("aria-disabled"), a = (e) => { + let a = e.target.closest("button"); + if (!a || ![ + "ArrowUp", + "ArrowDown", + "ArrowLeft", + "ArrowRight" + ].includes(e.key)) return; + let l, o = t.find((e) => a.matches(e.item)), r = o ? a.closest(o.container) : null; + if (o && r && !r.closest("[data-vc-ghost]") && n(a)) { + if ("ArrowUp" === e.key || "ArrowDown" === e.key) l = ((e, t, a, l) => { + var o; + let r = a.closest(t.row); + if (!r) return a; + let i = Array.from(e.querySelectorAll(t.row)), s = i.indexOf(r), c = Array.from(r.children).indexOf(a.parentElement), d = i[s + l], u = null == d || null == (o = d.children[c]) ? void 0 : o.querySelector(t.item); + return u && n(u) ? u : a; + })(r, o, a, "ArrowUp" === e.key ? -1 : 1); + else { + let t = Array.from(r.querySelectorAll(o.item)).filter(n), i = t.indexOf(a); + if (-1 === i) return; + l = "ArrowLeft" === e.key ? t[Math.max(0, i - 1)] : t[Math.min(t.length - 1, i + 1)]; + } + e.preventDefault(), l?.focus(); + } + }; + return e.context.mainElement.addEventListener("keydown", a), e.context.mainElement.addEventListener("focusin", ce), () => { + e.context.mainElement.removeEventListener("keydown", a), e.context.mainElement.removeEventListener("focusin", ce); + }; +}; +var _e = "[data-vc=\"dates\"]"; +var Re = (e, t) => "next" === e ? t : -t; +var je = (n) => { + let a = { + selector: _e, + shift: (a) => ((n, a) => { + let l = e(t(new Date(n.context.selectedYear, n.context.selectedMonth, 1))); + l.setMonth(l.getMonth() + Re(a, n.monthsToSwitch)), g(n, "selectedMonth", l.getMonth()), g(n, "selectedYear", l.getFullYear()); + })(n, a), + render: (e, t) => ue(n, t) + }; + return { + default: a, + multiple: a, + week: { + selector: _e, + shift: (e) => { + var t; + return null == (t = u(n).weeks) ? void 0 : t.shift(n, e); + }, + render: () => ue(n) + }, + year: { + selector: "[data-vc=\"years\"]", + shift: (e) => g(n, "displayYear", n.context.displayYear + Re(e, 15)), + render: (e) => Ce(n, e) + }, + month: null + }[n.context.currentType]; +}; +var ze = (e, t, n) => { + var a; + let l = je(e); + if (!l) return; + let { mainElement: o } = e.context, r = o.contains(w(o).activeElement), i = "multiple" === e.context.currentType ? J(e, !0) : void 0; + U(e), l.shift(t); + let s = i ? null == (a = u(e).months) ? void 0 : a.rotate(e, i) : void 0; + s || (i = void 0), Me(e, s), De(e); + let c = u(e).motion; + c && e.animation ? c.navigate(e, l.selector, t, () => l.render(n, i)) : l.render(n, i), ((e, t, n) => { + var a; + let { mainElement: l } = e.context; + if (!n || l.contains(w(l).activeElement)) return; + let o = l.querySelector(`[data-vc-arrow="${t}"]`); + if (o && "hidden" !== o.style.visibility) return o.focus(); + null == (a = Array.from(l.querySelectorAll("[tabindex=\"0\"]")).find((e) => !e.closest("[data-vc-ghost]"))) || a.focus(); + })(e, t, r); +}; +var Ke = (e, t, n) => { + let a = t.dataset.vcDate, l = t.closest("[data-vc-date][data-vc-date-selected]"), o = x(e); + (!l || o) && g(e, "selectedDates", l ? e.context.selectedDates.filter((e) => e !== a) : n ? [...e.context.selectedDates, a] : [a]); +}; +var Be = ["month", "year"]; +var Ue = "[data-vc=\"column\"]"; +var Xe = (e, t, n) => { + let a = u(e).motion; + a && e.animation ? a.changeView(e, t, n) : n(); +}; +var Ge = (e, t) => { + var n; + let { columnID: a } = ke(e, e.context.currentType); + g(e, "currentType", e.type), Xe(e, a, () => qe(e)), null == (n = e.context.mainElement.querySelector(`[data-vc="${t}"]`)) || n.focus(); +}; +var Ze = (e) => { + let t = (t) => { + var n, a; + ((e, t) => { + let n = t.target, a = n.closest("[data-vc-arrow]"); + a && (ze(e, a.dataset.vcArrow, n), e.onClickArrow && e.onClickArrow(e, t)); + })(e, t), null == (n = u(e).weeks) || n.click(e, t), ((e, t) => { + let n = t.target, a = n.closest("[data-vc-date-btn]"); + if (!e.selectionDatesMode || ![ + "single", + "multiple", + "multiple-ranged" + ].includes(e.selectionDatesMode) || !a) return; + let l = a.closest("[data-vc-date]"); + ({ + single: () => Ke(e, l, !1), + multiple: () => Ke(e, l, !0), + "multiple-ranged": () => M(e, l) + })[e.selectionDatesMode](), e.context.selectedDates && b(e.context.selectedDates), e.onClickDate && e.onClickDate(e, t), e.inputMode && e.context.inputElement && e.context.mainElement && e.onChangeToInput && e.onChangeToInput(e, t); + let o = n.closest("[data-vc-date-month=\"prev\"]"), r = n.closest("[data-vc-date-month=\"next\"]"); + ({ + prev: () => e.enableMonthChangeOnDayClick ? ze(e, "prev") : Fe(e), + next: () => e.enableMonthChangeOnDayClick ? ze(e, "next") : Fe(e), + current: () => Fe(e) + })[o ? "prev" : r ? "next" : "current"](); + })(e, t), ((e, t) => { + let n = { + month: e.selectionMonthsMode, + year: e.selectionYearsMode + }; + Be.forEach((a) => { + n[a] && t.target && ((e, t, n) => { + let a = t.target, l = a.closest(`[data-vc="${n}"]`), o = ((e, t) => { + let n = t.closest(Ue); + return n ? Array.from(e.context.mainElement.querySelectorAll(Ue)).indexOf(n) : 0; + })(e, a), r = { + year: () => Xe(e, o, () => Ce(e, a)), + month: () => Xe(e, o, () => Te(e, a)) + }; + if (l && e.onClickTitle && e.onClickTitle(e, t), l && e.context.currentType !== n) { + let t = a.closest(Ue); + return r[n](), ((e, t, n) => { + var a; + return null == (a = (null == n ? e.context.mainElement : n).querySelector(`[data-vc-${t}s-${t}][tabindex="0"]`)) ? void 0 : a.focus(); + })(e, n, t); + } + let i = a.closest(`[data-vc-${n}s-${n}]`); + if (i) return ((e, t, n, a) => { + ({ + year: () => { + var t; + if ("multiple" === e.type) return null == (t = u(e).months) ? void 0 : t.select(e, "year", a); + g(e, "selectedYear", Number(a.dataset.vcYearsYear)); + }, + month: () => { + var t; + if ("multiple" === e.type) return null == (t = u(e).months) ? void 0 : t.select(e, "month", a); + g(e, "selectedMonth", Number(a.dataset.vcMonthsMonth)); + } + })[n](), { + year: () => { + var n; + return null == (n = e.onClickYear) ? void 0 : n.call(e, e, t); + }, + month: () => { + var n; + return null == (n = e.onClickMonth) ? void 0 : n.call(e, e, t); + } + }[n](), e.context.currentType === e.type ? we(e, a, n, !0, !0) : Ge(e, n); + })(e, t, n, i); + let s = a.closest("[data-vc=\"grid\"]"), c = a.closest("[data-vc=\"column\"]"); + (e.context.currentType === n && l || "multiple" === e.type && e.context.currentType === n && s && !c) && Ge(e, n); + })(e, t, a); + }); + })(e, t), null == (a = u(e).weeks) || a.collapseClick(e, t); + }; + return e.context.mainElement.addEventListener("click", t), () => e.context.mainElement.removeEventListener("click", t); +}; +var Ve = /* @__PURE__ */ new WeakMap(); +var Je = (e, t) => { + let a = e[t].map((e) => e instanceof Date ? e.getTime() : e), l = Ve.get(e), o = null == l ? void 0 : l[t]; + if (o && a.length === o.values.length) { + let e = 0; + for (; e < a.length && a[e] === o.values[e];) e++; + if (e === a.length && o.timezone === new Intl.DateTimeFormat().resolvedOptions().timeZone) return o.dates.slice(); + } + let r = n(e[t]); + if (r.length > 1 && b(r), r.length > 128 && r.length <= 1e4 && a.length <= 1e4) { + let n = null == l ? {} : l; + n[t] = { + values: a, + dates: r.slice(), + timezone: new Intl.DateTimeFormat().resolvedOptions().timeZone + }, Ve.set(e, n); + } else l && delete l[t]; + return r; +}; +var Qe = (e, t) => "today" === e ? (() => { + let e = /* @__PURE__ */ new Date(); + /* @__PURE__ */ + return (/* @__PURE__ */ new Date(e.getTime() - 6e4 * e.getTimezoneOffset())).toISOString().substring(0, 10); +})() : e instanceof Date || "number" == typeof e || "string" == typeof e ? n([e])[0] : t; +var et = (e, t, n) => { + g(e, "selectedMonth", t), g(e, "selectedYear", n), g(e, "displayYear", n); +}; +var tt = (t) => { + var a, l; + if (t.enableCollapse && !["default", "week"].includes(t.type)) throw Error("The «enableCollapse» parameter is only supported by the «default» and «week» calendar types."); + g(t, "currentType", t.type), ((e) => { + if ("multiple" === e.type && (e.displayMonthsCount <= 1 || e.displayMonthsCount > 12) || "multiple" !== e.type && e.displayMonthsCount > 1) throw Error("For the «multiple» calendar type, the «displayMonthsCount» parameter can have a value from 2 to 12, and for all others it cannot be greater than 1."); + g(e, "displayMonthsCount", e.displayMonthsCount ? e.displayMonthsCount : "multiple" === e.type ? 2 : 1); + })(t), ((t) => { + var n, a, l; + let o = Qe(t.dateMin, t.dateMin), r = Qe(t.dateMax, t.dateMax), i = Qe(t.displayDateMin, o), s = Qe(t.displayDateMax, r); + if (g(t, "dateToday", Qe(t.dateToday, t.dateToday)), g(t, "displayDateMin", i ? e(o) >= e(i) ? o : i : o), g(t, "displayDateMax", s ? e(r) <= e(s) ? r : s : r), g(t, "displayDateMin", t.disableDatesPast && !t.disableAllDates && e(i) < e(t.context.dateToday) || t.disableAllDates ? t.context.dateToday : i), g(t, "displayDateMax", t.disableAllDates ? t.context.dateToday : s), g(t, "disableDates", t.disableDates[0] && !t.disableAllDates ? Je(t, "disableDates") : t.disableAllDates ? [t.context.displayDateMin] : []), g(t, "enableDates", t.enableDates[0] ? Je(t, "enableDates") : []), null != (n = t.context.enableDates) && n[0] && null != (a = t.context.disableDates) && a[0]) { + let e = new Set(t.context.enableDates); + g(t, "disableDates", t.context.disableDates.filter((t) => !e.has(t))); + } + null != (l = t.context.enableDates) && l[0] && t.disableAllDates && (g(t, "displayDateMin", t.context.enableDates[0]), g(t, "displayDateMax", t.context.enableDates[t.context.enableDates.length - 1])), g(t, "dateMin", t.displayDisabledDates ? o : t.context.displayDateMin), g(t, "dateMax", t.displayDisabledDates ? r : t.context.displayDateMax); + })(t), ((t) => { + var a; + if (t.enableJumpToSelectedDate && null != (a = t.selectedDates) && a[0] && void 0 === t.selectedMonth && void 0 === t.selectedYear) { + let a = e(n(t.selectedDates)[0]); + et(t, a.getMonth(), a.getFullYear()); + return; + } + if (((t) => { + let a = (e) => { + let n = new Date(e); + et(t, n.getMonth(), n.getFullYear()); + }; + return t.displayDateMin && "today" !== t.displayDateMin && (l = t.displayDateMin, o = /* @__PURE__ */ new Date(), new Date(l).getTime() > o.getTime()) ? (a(e(Qe(t.selectedDates.length && t.selectedDates[0] ? n(t.selectedDates)[0] : t.displayDateMin, t.displayDateMin))), !0) : !(!t.displayDateMax || "today" === t.displayDateMax || !((e, t) => new Date(e).getTime() < t.getTime())(t.displayDateMax, /* @__PURE__ */ new Date()) || (a(e(Qe(t.selectedDates.length && t.selectedDates[0] ? n(t.selectedDates)[0] : t.displayDateMax, t.displayDateMax))), 0)); + var l, o; + })(t)) return; + let l = void 0 !== t.selectedMonth && Number(t.selectedMonth) >= 0 && Number(t.selectedMonth) < 12, o = void 0 !== t.selectedYear && Number(t.selectedYear) >= 0 && Number(t.selectedYear) <= 9999; + et(t, l ? Number(t.selectedMonth) : e(t.context.dateToday).getMonth(), o ? Number(t.selectedYear) : e(t.context.dateToday).getFullYear()); + })(t), ((e) => { + var t; + g(e, "selectedDates", null != (t = e.selectedDates) && t[0] ? n(e.selectedDates) : []); + })(t), null == (a = u(t).weeks) || a.init(t), null == (l = u(t).time) || l.init(t); +}; +var nt = (e, { year: t, month: n, dates: a, time: l, locale: o }, r = !0, i) => { + var s, c, d, m; + U(e); + let p = u(e); + null == (s = p.motion) || s.reset(e), null == (c = p.time) || c.destroy(e), null == (d = p.annotations) || d.destroy(e), D(e); + let h = { + year: e.selectedYear, + month: e.selectedMonth, + dates: e.selectedDates, + time: e.selectedTime + }; + var v; + e.selectedYear = t ? h.year : e.context.selectedYear, e.selectedMonth = n ? h.month : e.context.selectedMonth, e.selectedTime = l ? h.time : e.context.selectedTime, e.selectedDates = "only-first" === a && null != (m = e.context.selectedDates) && m[0] ? [e.context.selectedDates[0]] : !0 === a ? h.dates : e.context.selectedDates, o && g(e, "locale", { + months: { + short: [], + long: [] + }, + weekdays: { + short: [], + long: [] + } + }), tt(e), r && (i && Oe(e), i && i.structure === Z(e) ? ($e(e), null == (v = p.time) || v.render(e), Fe(e, !0)) : qe(e, !1)), e.selectedYear = h.year, e.selectedMonth = h.month, e.selectedDates = h.dates, e.selectedTime = h.time, "multiple-ranged" === e.selectionDatesMode && M(e, null, !!a), r && Q(e, !0); +}; +var at = (e, t, n) => { + if (!e.context.isInit) throw Error(F); + m(e), nt(e, Le(Le({}, { + year: !0, + month: !0, + dates: !0, + time: !0, + locale: !0 + }), t), !(e.inputMode && !e.context.inputModeInit), n), e.onUpdate && e.onUpdate(e); +}; +var lt = [ + "extensions", + "context", + "init", + "update", + "destroy", + "show", + "hide", + "set", + "queryAndMemoize" +]; +var ot = (e, t, n = !0) => { + let a = Object.keys(t); + for (let l = 0; l < a.length; l++) { + let o = a[l]; + "__proto__" !== o && "constructor" !== o && "prototype" !== o && (n && lt.includes(String(o)) || ("object" != typeof e[o] || null === e[o] || "object" != typeof t[o] || null === t[o] || t[o] instanceof Date || Array.isArray(t[o]) ? void 0 !== t[o] && (e[o] = t[o]) : ot(e[o], t[o], !1))); + } +}; +var rt = { + application: "Calendar", + navigation: "Calendar Navigation", + arrowNext: { + month: "Next month", + year: "Next list of years", + week: "Next week" + }, + arrowPrev: { + month: "Previous month", + year: "Previous list of years", + week: "Previous week" + }, + month: "Select month, current selected month:", + months: "List of months", + year: "Select year, current selected year:", + years: "List of years", + week: "Days of the week", + weekNumber: "Numbers of weeks in a year", + collapse: "Collapse to a single week", + expand: "Expand to the whole month", + dates: "Dates in the current month", + selectingTime: "Selecting a time ", + inputHour: "Hours", + inputMinute: "Minutes", + rangeHour: "Slider for selecting hours", + rangeMinute: "Slider for selecting minutes", + btnKeeping: "Switch AM/PM, current position:" +}; +var it = { + calendar: "vc", + controls: "vc-controls", + grid: "vc-grid", + column: "vc-column", + header: "vc-header", + headerContent: "vc-header__content", + month: "vc-month", + year: "vc-year", + arrowPrev: "vc-arrow vc-arrow_prev", + arrowNext: "vc-arrow vc-arrow_next", + wrapper: "vc-wrapper", + content: "vc-content", + months: "vc-months", + monthsRow: "vc-months__row", + monthsCell: "vc-months__cell", + monthsMonth: "vc-months__month", + years: "vc-years", + yearsRow: "vc-years__row", + yearsCell: "vc-years__cell", + yearsYear: "vc-years__year", + week: "vc-week", + weekDay: "vc-week__day", + weekDayBtn: "vc-week__day-btn", + weekNumbers: "vc-week-numbers", + weekNumbersTitle: "vc-week-numbers__title", + weekNumbersContent: "vc-week-numbers__content", + weekNumber: "vc-week-number", + collapse: "vc-collapse", + dates: "vc-dates", + datesRow: "vc-dates__row", + date: "vc-date", + dateBtn: "vc-date__btn", + datePopup: "vc-date__popup", + dateRangeTooltip: "vc-date-range-tooltip", + time: "vc-time", + timeContent: "vc-time__content", + timeHour: "vc-time__hour", + timeMinute: "vc-time__minute", + timeKeeping: "vc-time__keeping", + timeRanges: "vc-time__ranges", + timeRange: "vc-time__range" +}; +var st = class { + constructor() { + Ne(this, "type", "default"), Ne(this, "inputMode", !1), Ne(this, "openOnFocus", !0), Ne(this, "positionToInput", "left"), Ne(this, "animation", !1), Ne(this, "firstWeekday", 1), Ne(this, "monthsToSwitch", 1), Ne(this, "themeAttrDetect", "html[data-theme]"), Ne(this, "locale", "en"), Ne(this, "dateToday", "today"), Ne(this, "dateMin", "1970-01-01"), Ne(this, "dateMax", "2470-12-31"), Ne(this, "displayDateMin", void 0), Ne(this, "displayDateMax", void 0), Ne(this, "displayDatesOutside", !0), Ne(this, "displayDisabledDates", !1), Ne(this, "displayMonthsCount", void 0), Ne(this, "disableDates", []), Ne(this, "disableAllDates", !1), Ne(this, "disableDatesPast", !1), Ne(this, "disableDatesGaps", !1), Ne(this, "disableWeekdays", []), Ne(this, "disableToday", !1), Ne(this, "enableDates", []), Ne(this, "enableEdgeDatesOnly", !0), Ne(this, "enableDateToggle", !0), Ne(this, "enableWeekNumbers", !1), Ne(this, "enableMonthChangeOnDayClick", !0), Ne(this, "enableJumpToSelectedDate", !1), Ne(this, "enableCollapse", !1), Ne(this, "enableSwipe", !1), Ne(this, "selectionDatesMode", "single"), Ne(this, "selectionMonthsMode", !0), Ne(this, "selectionYearsMode", !0), Ne(this, "selectionTimeMode", !1), Ne(this, "selectedDates", []), Ne(this, "selectedMonth", void 0), Ne(this, "selectedYear", void 0), Ne(this, "selectedHolidays", []), Ne(this, "selectedWeekends", [0, 6]), Ne(this, "selectedTime", void 0), Ne(this, "selectedTheme", "system"), Ne(this, "timeMinHour", 0), Ne(this, "timeMaxHour", 23), Ne(this, "timeMinMinute", 0), Ne(this, "timeMaxMinute", 59), Ne(this, "timeControls", "all"), Ne(this, "timeStepHour", 1), Ne(this, "timeStepMinute", 1), Ne(this, "sanitizerHTML", z), Ne(this, "onClickDate", void 0), Ne(this, "onClickWeekDay", void 0), Ne(this, "onClickWeekNumber", void 0), Ne(this, "onClickTitle", void 0), Ne(this, "onClickMonth", void 0), Ne(this, "onClickYear", void 0), Ne(this, "onClickArrow", void 0), Ne(this, "onChangeTime", void 0), Ne(this, "onChangeToInput", void 0), Ne(this, "onCreateDateRangeTooltip", void 0), Ne(this, "onCreateDateEls", void 0), Ne(this, "onCreateMonthEls", void 0), Ne(this, "onCreateYearEls", void 0), Ne(this, "onInit", void 0), Ne(this, "onUpdate", void 0), Ne(this, "onDestroy", void 0), Ne(this, "onShow", void 0), Ne(this, "onHide", void 0), Ne(this, "popups", {}), Ne(this, "labels", Le(Le({}, rt), {}, { + arrowNext: Le({}, rt.arrowNext), + arrowPrev: Le({}, rt.arrowPrev) + })), Ne(this, "layouts", { + default: "", + multiple: "", + month: "", + year: "", + week: "" + }), Ne(this, "styles", Le({}, it)); + } +}; +var pt = (e, t) => { + var n; + if ("multiple" !== e.type) return { + currentValue: null, + columnID: 0 + }; + let a = e.context.mainElement.querySelectorAll("[data-vc=\"column\"]"), l = Array.from(a).findIndex((e) => e.closest(`[data-vc-column="${t}"]`)); + return { + currentValue: l >= 0 ? Number(null == (n = a[l].querySelector(`[data-vc="${t}"]`)) ? void 0 : n.getAttribute(`data-vc-${t}`)) : null, + columnID: Math.max(l, 0) + }; +}; +var ht = (e, t, n) => { + let { currentValue: a, columnID: l } = pt(e, t); + return "month" === e.context.currentType && l >= 0 ? n - l : "year" === e.context.currentType && e.context.selectedYear !== a ? n - 1 : n; +}; +var vt = /* @__PURE__ */ Object.freeze({ + name: "months", + layout: (e) => `\n
\n <#ArrowPrev [month] />\n <#ArrowNext [month] />\n
\n
\n <#Multiple>\n
\n
\n
\n <#Month />\n <#Year />\n
\n
\n
\n <#WeekNumbers />\n
\n <#Week />\n <#Dates />\n
\n
\n
\n <#/Multiple>\n <#DateRangeTooltip />\n
\n <#ControlTime />\n`, + render: (e, t) => { + var n; + if ("multiple" === e.context.currentType) return null == (n = u(e).time) || n.destroy(e), e.context.mainElement.innerHTML = e.sanitizerHTML(((e, t) => t.replace(RegExp("<#Multiple>(.*?)<#\\/Multiple>", "gs"), (t, n) => { + let a = Array(e.context.displayMonthsCount).fill(n).join(""); + return e.sanitizerHTML(a); + }).replace(/[\n\t]/g, ""))(e, fe(e, e.layouts.multiple))), !0; + if ("multiple" !== e.type || !t) return !1; + let a = e.context.mainElement.querySelector("[data-vc=\"controls\"]"), l = e.context.mainElement.querySelector("[data-vc=\"grid\"]"), o = t.closest("[data-vc=\"column\"]"); + return a && a.remove(), l && (l.dataset.vcGrid = "hidden"), o && (o.dataset.vcColumn = e.context.currentType), o && (o.innerHTML = e.sanitizerHTML(fe(e, e.layouts[e.context.currentType]))), !0; + }, + column: pt, + select: (t, n, a) => "month" === n ? ((t, n) => { + let a = n.closest("[data-vc-column=\"month\"]").querySelector("[data-vc=\"year\"]"), l = ht(t, "month", Number(n.dataset.vcMonthsMonth)), o = Number(a.dataset.vcYear), r = e(t.context.dateMin), i = e(t.context.dateMax), s = l < r.getMonth() && o <= r.getFullYear(), c = l > i.getMonth() && o >= i.getFullYear(); + g(t, "selectedYear", o), g(t, "selectedMonth", s ? r.getMonth() : c ? i.getMonth() : l); + })(t, a) : ((t, n) => { + let a = ht(t, "year", Number(n.dataset.vcYearsYear)), l = e(t.context.dateMin), o = e(t.context.dateMax), r = t.context.displayMonthsCount - 1, { columnID: i } = pt(t, "year"), s = t.context.selectedMonth < l.getMonth() && a <= l.getFullYear(), c = t.context.selectedMonth > o.getMonth() - r + i && a >= o.getFullYear(), d = a < l.getFullYear(), u = a > o.getFullYear(), m = s || d ? l.getFullYear() : c || u ? o.getFullYear() : a, p = s || d ? l.getMonth() : c || u ? o.getMonth() - r + i : t.context.selectedMonth; + g(t, "selectedYear", m), g(t, "selectedMonth", p); + })(t, a), + rotate: (e, t) => { + var n; + let a = 12 * e.context.selectedYear + e.context.selectedMonth - t.month; + if (!a || Math.abs(a) >= t.count) return; + let l = Array.from(e.context.mainElement.querySelectorAll("[data-vc=\"column\"]")), o = null == (n = l[0]) ? void 0 : n.parentElement; + if (!o || l.length !== t.count || l.some((e) => e.parentElement !== o) || Array.from(o.childNodes).some((e) => { + var t; + return 1 === e.nodeType ? !l.includes(e) : 3 !== e.nodeType || !(null == (t = e.textContent) || !t.trim()); + })) return; + let r = []; + if (a > 0) { + let e = l[l.length - 1].nextSibling; + for (let n = 0; n < a; n++) { + let i = l[n].nextSibling; + 3 === (null == i ? void 0 : i.nodeType) && i !== e && o.insertBefore(i, e), o.insertBefore(l[n], e), r.push(t.count - a + n); + } + } else for (let i = t.count + a; i < t.count; i++) { + let e = l[i].previousSibling; + o.insertBefore(l[i], l[0]), 3 === (null == e ? void 0 : e.nodeType) && o.insertBefore(e, l[0]), r.push(i - t.count - a); + } + return r; + } +}); +var on = class e extends st { + constructor(t, n) { + var a; + super(), Ne(this, "extensions", void 0), Ne(this, "init", () => ((e) => { + var t; + if (e.context.isInit) throw Error("The calendar has already been initialized, calling init() again is not allowed. Create a new Calendar instance instead."); + if (m(e), g(e, "originalElement", e.context.mainElement.cloneNode(!0)), g(e, "isInit", !0), e.inputMode) { + let t = ((e) => { + g(e, "inputElement", e.context.mainElement); + let t = e.context.inputElement; + [ + "input", + "button", + "textarea" + ].includes(t.localName) && (t.setAttribute("aria-haspopup", "dialog"), ("button" === t.localName || "combobox" === t.getAttribute("role")) && t.setAttribute("aria-expanded", "false")); + let n = () => { + e.context.inputModeInit ? O(e) : ((e) => { + var t; + let n = document.createElement("div"); + n.className = e.styles.calendar, n.dataset.vc = "calendar", n.dataset.vcInput = "", n.dataset.vcCalendarHidden = "", Object.assign(n.style, { + left: "0", + top: "0" + }), S(n); + let a = w(e.context.mainElement), l = a === document ? document.body : a; + g(e, "inputModeInit", !0), g(e, "isShowInInputMode", !1), g(e, "mainElement", n), l.appendChild(e.context.mainElement), nt(e, { + year: !0, + month: !0, + dates: !0, + time: !0, + locale: !0 + }), O(e), e.onInit && e.onInit(e), e.context.isDestroyed || (Pe(e), null == (t = u(e).motion) || t.bind(e), Ze(e)); + })(e); + }; + e.context.inputElement.addEventListener("click", n); + let a = "function" == typeof e.openOnFocus || !0 === e.openOnFocus, l = () => { + ((e) => E.has(e))(e) ? ((e) => { + E.delete(e); + })(e) : ((e) => f(e, e.openOnFocus))(e) && n(); + }; + a && e.context.inputElement.addEventListener("focus", l); + let o = (t) => { + let n = "Tab" === t.key && !t.shiftKey, a = [ + "ArrowUp", + "ArrowDown", + "ArrowLeft", + "ArrowRight" + ].includes(t.key); + (n || a) && ((t) => { + var n; + if (!e.context.isShowInInputMode || w(e.context.mainElement).activeElement !== e.context.inputElement) return !1; + let a = (e) => e.tabIndex >= 0 && !e.hasAttribute("disabled") && "true" !== e.getAttribute("aria-disabled"), l = null == (n = document.createTreeWalker(e.context.mainElement, NodeFilter.SHOW_ELEMENT, { acceptNode: (e) => a(e) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP }).nextNode()) ? a(e.context.mainElement) ? e.context.mainElement : null : n; + !l || l.tabIndex < 0 || (t.preventDefault(), l.focus()); + })(t); + }; + return e.context.inputElement.addEventListener("keydown", o), () => { + t.removeEventListener("click", n), a && t.removeEventListener("focus", l), t.removeEventListener("keydown", o); + }; + })(e); + return g(e, "cleanupInput", t), t; + } + if (tt(e), qe(e), "multiple-ranged" === e.selectionDatesMode && 1 === e.context.selectedDates.length && (M(e, null), Fe(e)), e.onInit && e.onInit(e), !e.context.isDestroyed) return Pe(e), null == (t = u(e).motion) || t.bind(e), Ze(e); + })(this)), Ne(this, "update", (e) => at(this, e)), Ne(this, "destroy", () => { + let t = this.inputMode ? this.context.inputElement : this.context.mainElement; + if (((e) => { + var t, n, a, o, r, i, s, c; + if (!e.context.isInit) throw Error(F); + if (e.context.isDestroyed) throw Error("The calendar has already been destroyed, calling destroy() again is not allowed."); + B(e); + let d = u(e); + var m, p, h, v, y; + null == (t = d.motion) || t.destroy(e), null == (n = d.time) || n.destroy(e), null == (a = d.annotations) || a.destroy(e), D(e), ((e) => { + l.delete(e); + })(e), H(e), null == (o = (r = e.context).cleanupInput) || o.call(r), g(e, "cleanupInput", void 0), null == (i = e.context.cleanupHandlers) || i.forEach((e) => e()), g(e, "cleanupHandlers", []), g(e, "isShowInInputMode", !1), null == (s = (c = e.context).cleanupSystemTheme) || s.call(c), e.inputMode ? (e.context.mainElement !== e.context.inputElement && (null == (h = e.context.mainElement.parentElement) || h.removeChild(e.context.mainElement)), null == (m = e.context.inputElement) || null == (p = m.replaceWith) || p.call(m, e.context.originalElement), g(e, "inputElement", void 0)) : null == (v = (y = e.context.mainElement).replaceWith) || v.call(y, e.context.originalElement), g(e, "mainElement", e.context.originalElement), g(e, "isDestroyed", !0), e.onDestroy && e.onDestroy(e); + })(this), t) for (let [n, a] of e.memoizedElements) a === t && e.memoizedElements.delete(n); + }), Ne(this, "show", () => q(this)), Ne(this, "hide", () => $(this)), Ne(this, "set", (e, t) => ((e, t, n) => { + m(e, t); + let a = Object.keys(t); + t.extensions && a.splice(a.indexOf("extensions"), 1); + let l = 1 === a.length && "selectedDates" === a[0] ? J(e) : void 0; + ot(e, t), e.context.isInit && at(e, n, l); + })(this, e, t)), Ne(this, "context", void 0), this.context = Le(Le({}, this.context), {}, { locale: { + months: { + short: [], + long: [] + }, + weekdays: { + short: [], + long: [] + } + } }), g(this, "mainElement", "string" == typeof t ? null == (a = e.memoizedElements.get(t)) ? this.queryAndMemoize(t) : a : t); + let o = null == n ? void 0 : n.extensions; + this.extensions = null != o && o.length ? Object.freeze(Array.from(new Set(o))) : d, ((e) => { + if (!e.extensions.length) return; + let t = {}; + for (let n of e.extensions) { + let e = n, a = e.name; + if (!i.includes(a)) throw Error("Unknown calendar extension."); + if (t[a] && t[a] !== e) throw Error(`Conflicting calendar extension: ${a}.`); + Object.assign(t, { [a]: e }); + } + s.set(e, t); + })(this), n && ot(this, n); + } + queryAndMemoize(t) { + let n = document.querySelector(t); + if (!n) throw Error(((e) => `${e} is not found, check the first argument passed to new Calendar. If the element lives inside a Shadow DOM, a string selector can't reach it - resolve the element yourself (e.g. shadowRoot.querySelector(...)) and pass it directly instead.`)(t)); + return e.memoizedElements.set(t, n), n; + } +}; +Ne(on, "memoizedElements", /* @__PURE__ */ new Map()); +//#endregion +//#region js/src/datepicker.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap datepicker.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$15 = "datepicker"; +const EVENT_KEY$12 = `.bs.datepicker`; +const DATA_API_KEY$7 = ".data-api"; +const EVENT_CHANGE$2 = `change${EVENT_KEY$12}`; +const EVENT_SHOW$4 = `show${EVENT_KEY$12}`; +const EVENT_SHOWN$3 = `shown${EVENT_KEY$12}`; +const EVENT_HIDE$3 = `hide${EVENT_KEY$12}`; +const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$12}`; +const EVENT_FOCUSIN$3 = `focusin${EVENT_KEY$12}`; +const EVENT_POINTERDOWN$2 = `pointerdown${EVENT_KEY$12}`; +const EVENT_CLICK$4 = `click${EVENT_KEY$12}`; +const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$12}${DATA_API_KEY$7}`; +const EVENT_FOCUSIN_DATA_API = `focusin${EVENT_KEY$12}${DATA_API_KEY$7}`; +const SELECTOR_DATA_TOGGLE$6 = "[data-bs-toggle=\"datepicker\"]"; +const HIDE_DELAY = 100; +const Default$14 = { + datepickerTheme: null, + dateMin: null, + dateMax: null, + dateFormat: null, + displayElement: null, + displayMonthsCount: 1, + firstWeekday: 1, + inline: false, + locale: "default", + positionElement: null, + selectedDates: [], + selectionMode: "single", + placement: "left", + vcpOptions: {} +}; +const DefaultType$14 = { + datepickerTheme: "(null|string)", + dateMin: "(null|string|number|object)", + dateMax: "(null|string|number|object)", + dateFormat: "(null|object|function)", + displayElement: "(null|string|element|boolean)", + displayMonthsCount: "number", + firstWeekday: "number", + inline: "boolean", + locale: "string", + positionElement: "(null|string|element)", + selectedDates: "array", + selectionMode: "string", + placement: "string", + vcpOptions: "object" +}; +/** +* Class definition +*/ +var Datepicker = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._calendar = null; + this._isShown = false; + this._initCalendar(); + } + static get Default() { + return Default$14; + } + static get DefaultType() { + return DefaultType$14; + } + static get NAME() { + return NAME$15; + } + toggle() { + if (this._config.inline) return Promise.resolve(); + return this._isShown ? this.hide() : this.show(); + } + async show() { + if (this._config.inline) return; + if (!this._calendar || isDisabled(this._element) || this._isShown) return; + if (EventHandler.trigger(this._element, EVENT_SHOW$4).defaultPrevented) return; + this._calendar.show(); + this._isShown = true; + EventHandler.trigger(this._element, EVENT_SHOWN$3); + } + async hide() { + if (this._config.inline) return; + if (!this._calendar || !this._isShown) return; + if (EventHandler.trigger(this._element, EVENT_HIDE$3).defaultPrevented) return; + this._calendar.hide(); + this._isShown = false; + EventHandler.trigger(this._element, EVENT_HIDDEN$5); + } + dispose() { + if (this._themeObserver) { + this._themeObserver.disconnect(); + this._themeObserver = null; + } + if (this._onOutside) { + EventHandler.off(document, EVENT_FOCUSIN$3, this._onOutside); + EventHandler.off(document, EVENT_POINTERDOWN$2, this._onOutside); + } + if (this._onTriggerClick) EventHandler.off(this._positionElement, EVENT_CLICK$4, this._onTriggerClick); + if (this._calendar) this._calendar.destroy(); + this._calendar = null; + super.dispose(); + } + getSelectedDates() { + const dates = this._calendar?.context?.selectedDates; + return dates ? [...dates] : []; + } + setSelectedDates(dates) { + if (this._calendar) { + this._calendar.set({ selectedDates: dates }); + this._syncSelectedDates([...this._calendar.context.selectedDates]); + } + } + _initCalendar() { + this._isInput = this._element.tagName === "INPUT"; + this._isInline = this._config.inline; + if (this._isInline && !this._isInput) this._boundInput = this._element.querySelector("input[type=\"hidden\"], input[name]"); + this._positionElement = this._resolvePositionElement(); + this._displayElement = this._resolveDisplayElement(); + const calendarOptions = this._buildCalendarOptions(); + this._calendar = new on(this._positionElement, calendarOptions); + this._calendar.init(); + this._setupThemeObserver(); + this._setupDismiss(); + if (this._isInput && this._element.value) this._parseInputValue(); + this._updateDisplayWithSelectedDates(); + } + _updateDisplayWithSelectedDates() { + const calendarDates = [...this._calendar?.context.selectedDates || []]; + const selectedDates = calendarDates.length > 0 ? calendarDates : this._config.selectedDates; + if (selectedDates.length > 0) this._syncSelectedDates(selectedDates); + } + _syncSelectedDates(selectedDates) { + const formattedDate = this._formatDateForInput(selectedDates); + if (this._isInput) this._element.value = formattedDate; + if (this._boundInput) this._boundInput.value = selectedDates.join(","); + if (this._displayElement) this._displayElement.textContent = formattedDate; + } + _resolvePositionElement() { + let { positionElement } = this._config; + if (typeof positionElement === "string") positionElement = document.querySelector(positionElement); + if (!positionElement && this._isInput && !this._isInline) { + const parent = this._element.closest(".form-adorn"); + if (parent) positionElement = parent; + } + return positionElement || this._element; + } + _resolveDisplayElement() { + const { displayElement } = this._config; + if (typeof displayElement === "string") return document.querySelector(displayElement); + if (displayElement === true || displayElement === null && !this._isInput && !this._isInline) return this._element.querySelector("[data-bs-datepicker-display]") || this._element; + return displayElement; + } + _getThemeAncestor() { + if (this._themeAncestor === void 0) this._themeAncestor = this._element.closest("[data-bs-theme]"); + return this._themeAncestor; + } + _getEffectiveTheme() { + const { datepickerTheme } = this._config; + if (datepickerTheme) return datepickerTheme; + return this._getThemeAncestor()?.getAttribute("data-bs-theme") || null; + } + _syncThemeAttribute(element) { + if (!element) return; + const theme = this._getEffectiveTheme(); + if (theme) element.setAttribute("data-bs-theme", theme); + else element.removeAttribute("data-bs-theme"); + } + _setupThemeObserver() { + const ancestor = this._getThemeAncestor(); + if (!ancestor || this._config.datepickerTheme) return; + this._themeObserver = new MutationObserver(() => { + this._syncThemeAttribute(this._calendar?.context?.mainElement); + }); + this._themeObserver.observe(ancestor, { + attributes: true, + attributeFilter: ["data-bs-theme"] + }); + } + _setupDismiss() { + if (this._isInline) return; + if (!this._isInput) { + this._onTriggerClick = () => { + if (!this._isShown) this._calendar?.hide(); + }; + EventHandler.on(this._positionElement, EVENT_CLICK$4, this._onTriggerClick); + } + this._onOutside = ({ target }) => { + const mainElement = this._calendar?.context?.mainElement; + const isOutside = !(target instanceof Node) || !this._element.contains(target) && !mainElement?.contains(target); + if (this._isShown && isOutside) this.hide(); + }; + EventHandler.on(document, EVENT_FOCUSIN$3, this._onOutside); + EventHandler.on(document, EVENT_POINTERDOWN$2, this._onOutside); + } + _buildCalendarOptions() { + const theme = this._getEffectiveTheme(); + const vcpTheme = !theme || theme === "auto" ? "system" : theme; + const calendarOptions = { + ...this._config.vcpOptions, + extensions: [vt], + inputMode: !this._isInline, + positionToInput: this._config.placement, + firstWeekday: this._config.firstWeekday, + locale: this._config.locale, + selectionDatesMode: this._config.selectionMode, + selectedDates: this._config.selectedDates, + displayMonthsCount: this._config.displayMonthsCount, + type: this._config.displayMonthsCount > 1 ? "multiple" : "default", + selectedTheme: vcpTheme, + themeAttrDetect: "[data-bs-theme]", + onClickDate: (self, event) => this._handleDateClick(self, event), + onInit: (self) => { + this._syncThemeAttribute(self.context.mainElement); + }, + onShow: () => { + if (!this._calendar) return; + this._isShown = true; + this._syncThemeAttribute(this._calendar.context.mainElement); + }, + onHide: () => { + this._isShown = false; + } + }; + if (this._config.selectedDates.length > 0) { + const firstDate = this._parseDate(this._config.selectedDates[0]); + calendarOptions.selectedMonth = firstDate.getMonth(); + calendarOptions.selectedYear = firstDate.getFullYear(); + } + if (this._config.dateMin) calendarOptions.dateMin = this._config.dateMin; + if (this._config.dateMax) calendarOptions.dateMax = this._config.dateMax; + return calendarOptions; + } + _handleDateClick(self, event) { + const selectedDates = [...self.context.selectedDates]; + this._syncSelectedDates(selectedDates); + EventHandler.trigger(this._element, EVENT_CHANGE$2, { + dates: selectedDates, + event + }); + this._maybeHideAfterSelection(selectedDates); + } + _maybeHideAfterSelection(selectedDates) { + if (this._isInline) return; + if (this._config.selectionMode === "single" && selectedDates.length > 0 || this._config.selectionMode === "multiple-ranged" && selectedDates.length >= 2) setTimeout(() => this.hide(), HIDE_DELAY); + } + _parseDate(dateStr) { + const [year, month, day] = dateStr.split("-"); + return new Date(year, month - 1, day); + } + _formatDate(dateStr) { + const date = this._parseDate(dateStr); + const locale = this._config.locale === "default" ? void 0 : this._config.locale; + const { dateFormat } = this._config; + if (typeof dateFormat === "function") return dateFormat(date, locale); + if (dateFormat && typeof dateFormat === "object") return new Intl.DateTimeFormat(locale, dateFormat).format(date); + return date.toLocaleDateString(locale); + } + _formatDateForInput(dates) { + if (dates.length === 0) return ""; + if (dates.length === 1) return this._formatDate(dates[0]); + const separator = this._config.selectionMode === "multiple-ranged" ? " – " : ", "; + return dates.map((d) => this._formatDate(d)).join(separator); + } + _parseInputValue() { + const value = this._element.value.trim(); + if (!value) return; + const dateOnlyMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value); + const date = dateOnlyMatch ? new Date(Number(dateOnlyMatch[1]), Number(dateOnlyMatch[2]) - 1, Number(dateOnlyMatch[3])) : new Date(value); + if (!Number.isNaN(date.getTime())) { + const formatted = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`; + this._calendar.set({ selectedDates: [formatted] }); + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$6, function(event) { + if (this.tagName === "INPUT" || this.dataset.bsInline === "true") return; + event.preventDefault(); + Datepicker.getOrCreateInstance(this).toggle(); +}); +EventHandler.on(document, EVENT_FOCUSIN_DATA_API, SELECTOR_DATA_TOGGLE$6, function() { + if (this.tagName !== "INPUT") return; + Datepicker.getOrCreateInstance(this).show(); +}); +EventHandler.on(document, `DOMContentLoaded${EVENT_KEY$12}${DATA_API_KEY$7}`, () => { + const selector = `${SELECTOR_DATA_TOGGLE$6}[data-bs-inline="true"], ${SELECTOR_DATA_TOGGLE$6}[data-bs-selected-dates]`; + for (const element of document.querySelectorAll(selector)) Datepicker.getOrCreateInstance(element); +}); +//#endregion +//#region js/src/dialog-base.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap dialog-base.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const CLASS_NAME_OPEN = "dialog-open"; +/** +* Class definition +* +* Shared base class for Dialog and Drawer components that use +* the native element. Provides common behavior for: +* - Show/hide/toggle lifecycle with events +* - Opening/closing via showModal()/show()/close() +* - Escape key handling (modal and non-modal) +* - Backdrop click handling +* - Static backdrop transition ("bounce") +* - Body scroll prevention +* - Transition coordination +* - Child component cleanup (tooltips, popovers, toasts) +*/ +var DialogBase = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._isTransitioning = false; + this._openedAsModal = false; + this._addDialogListeners(); + } + static get NAME() { + return "dialogbase"; + } + toggle(relatedTarget) { + return this._element.open ? this.hide() : this.show(relatedTarget); + } + async show(relatedTarget) { + if (!this._canShow(relatedTarget)) return; + await this._show(relatedTarget); + } + async hide() { + if (!this._canHide()) return; + await this._hide(); + } + _canShow(relatedTarget) { + if (this._element.open || this._isTransitioning) return false; + return !EventHandler.trigger(this._element, this.constructor.eventName("show"), { relatedTarget }).defaultPrevented; + } + async _show(relatedTarget) { + this._isTransitioning = true; + this._onBeforeShow(); + const { modal, preventBodyScroll } = this._getShowOptions(); + this._showElement({ + modal, + preventBodyScroll + }); + await this._queueCallback(() => { + this._isTransitioning = false; + EventHandler.trigger(this._element, this.constructor.eventName("shown"), { relatedTarget }); + }, this._element, this._isAnimated()); + } + _canHide() { + if (!this._element.open || this._isTransitioning) return false; + return !EventHandler.trigger(this._element, this.constructor.eventName("hide")).defaultPrevented; + } + async _hide() { + this._isTransitioning = true; + this._hideElement(); + await this._queueCallback(() => { + if (this._element.open) this._closeAndCleanup(); + this._element.classList.remove("hiding"); + this._onAfterHide(); + this._isTransitioning = false; + EventHandler.trigger(this._element, this.constructor.eventName("hidden")); + }, this._element, this._isAnimated()); + } + dispose() { + if (this._element.open) this._closeAndCleanup(); + EventHandler.off(this._element, "cancel", this._cancelHandler); + super.dispose(); + } + _getShowOptions() { + return { + modal: true, + preventBodyScroll: true + }; + } + _onBeforeShow() {} + _onAfterHide() {} + _isAnimated() { + return !this._element.classList.contains(this._getInstantClassName()); + } + _getInstantClassName() { + return "dialog-instant"; + } + _getStaticClassName() { + return "dialog-static"; + } + _onCancel() {} + _showElement({ modal = true, preventBodyScroll = true } = {}) { + this._openedAsModal = modal; + if (modal) this._element.showModal(); + else this._element.show(); + if (preventBodyScroll) document.documentElement.classList.add(CLASS_NAME_OPEN); + } + _hideElement() { + this._hideChildComponents(); + this._element.classList.add("hiding"); + if (!this._shouldDeferClose()) this._closeAndCleanup(); + } + _closeAndCleanup() { + this._element.close(); + this._openedAsModal = false; + if (!document.querySelector("dialog[open]:modal")) document.documentElement.classList.remove(CLASS_NAME_OPEN); + } + _shouldDeferClose() { + return false; + } + _triggerBackdropTransition() { + if (EventHandler.trigger(this._element, this.constructor.eventName("hidePrevented")).defaultPrevented) return; + const staticClass = this._getStaticClassName(); + this._element.classList.add(staticClass); + this._queueCallback(() => { + this._element.classList.remove(staticClass); + }, this._element); + } + _hideChildComponents() { + for (const el of SelectorEngine.find("[data-bs-toggle=\"tooltip\"], [data-bs-toggle=\"popover\"]", this._element)) { + const instance = data_default.getAny(el); + if (instance && typeof instance.hide === "function") instance.hide(); + } + for (const el of SelectorEngine.find(".toast.show", this._element)) { + const instance = data_default.getAny(el); + if (instance && typeof instance.hide === "function") instance.hide(); + } + } + _addDialogListeners() { + const eventKey = this.constructor.EVENT_KEY; + this._cancelHandler = (event) => { + event.preventDefault(); + if (!this._config.keyboard) { + this._triggerBackdropTransition(); + return; + } + this._onCancel(); + this.hide(); + }; + EventHandler.on(this._element, "cancel", this._cancelHandler); + EventHandler.on(this._element, `keydown${eventKey}`, (event) => { + if (event.key !== "Escape" || this._openedAsModal) return; + event.preventDefault(); + if (!this._config.keyboard) return; + this._onCancel(); + this.hide(); + }); + EventHandler.on(this._element, `click${eventKey}`, (event) => { + if (event.target !== this._element || !this._openedAsModal) return; + if (this._config.backdrop === false) return; + if (this._config.backdrop === "static") { + this._triggerBackdropTransition(); + return; + } + this.hide(); + }); + } +}; +//#endregion +//#region js/src/dialog.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap dialog.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$14 = "dialog"; +const EVENT_KEY$11 = `.bs.dialog`; +const DATA_API_KEY$6 = ".data-api"; +const EVENT_SHOW$3 = `show${EVENT_KEY$11}`; +const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$11}`; +const EVENT_CANCEL = `cancel${EVENT_KEY$11}`; +const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$11}${DATA_API_KEY$6}`; +const CLASS_NAME_NONMODAL = "dialog-nonmodal"; +const CLASS_NAME_INSTANT$1 = "dialog-instant"; +const CLASS_NAME_SWAP_IN = "dialog-swap-in"; +const SELECTOR_DATA_TOGGLE$5 = "[data-bs-toggle=\"dialog\"]"; +const Default$13 = { + backdrop: true, + keyboard: true, + modal: true +}; +const DefaultType$13 = { + backdrop: "(boolean|string)", + keyboard: "boolean", + modal: "boolean" +}; +/** +* Class definition +*/ +var Dialog = class Dialog extends DialogBase { + constructor(element, config) { + super(element, config); + } + static get Default() { + return Default$13; + } + static get DefaultType() { + return DefaultType$13; + } + static get NAME() { + return NAME$14; + } + static { + EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$5, function(event) { + Dialog._handleDataApiClick(this, event); + }); + } + static _handleDataApiClick(trigger, event) { + const target = SelectorEngine.getElementFromSelector(trigger); + if (!target) return; + if (["A", "AREA"].includes(trigger.tagName)) event.preventDefault(); + const config = Manipulator.getDataAttributes(trigger); + const currentDialog = trigger.closest("dialog[open]"); + if (!(currentDialog && currentDialog !== target)) { + EventHandler.one(target, EVENT_SHOW$3, (showEvent) => { + if (!showEvent.defaultPrevented) Dialog._registerFocusRestoration(target, trigger); + }); + Dialog.getOrCreateInstance(target, config).toggle(trigger); + return; + } + if (currentDialog.classList.contains(CLASS_NAME_SWAP_IN)) return; + const newDialog = Dialog.getOrCreateInstance(target, config); + const currentInstance = Dialog.getOrCreateInstance(currentDialog); + if (!newDialog._canShow(trigger) || !currentInstance._canHide()) return; + Dialog._registerFocusRestoration(target, trigger); + target.classList.add(CLASS_NAME_SWAP_IN); + EventHandler.one(target, `shown${EVENT_KEY$11}`, () => { + target.classList.remove(CLASS_NAME_SWAP_IN); + }); + newDialog._show(trigger); + currentDialog.classList.add(CLASS_NAME_INSTANT$1); + EventHandler.one(currentDialog, EVENT_HIDDEN$4, () => { + currentDialog.classList.remove(CLASS_NAME_INSTANT$1); + }); + currentInstance._hide(); + } + static _registerFocusRestoration(target, trigger) { + EventHandler.one(target, EVENT_HIDDEN$4, () => { + if (isVisible(trigger)) trigger.focus({ preventScroll: true }); + }); + } + handleUpdate() {} + _getShowOptions() { + return { + modal: this._config.modal, + preventBodyScroll: this._config.modal + }; + } + _onBeforeShow() { + if (!this._config.modal) this._element.classList.add(CLASS_NAME_NONMODAL); + } + _onAfterHide() { + this._element.classList.remove(CLASS_NAME_NONMODAL); + } + _shouldDeferClose() { + return this._isAnimated(); + } + _onCancel() { + EventHandler.trigger(this._element, EVENT_CANCEL); + } +}; +/** +* Data API implementation +*/ +enableDismissTrigger(Dialog); +//#endregion +//#region js/src/util/sanitizer.ts +const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; +const DefaultAllowlist = { + "*": [ + "class", + "dir", + "id", + "lang", + "role", + ARIA_ATTRIBUTE_PATTERN + ], + a: [ + "target", + "href", + "title", + "rel" + ], + area: [], + b: [], + br: [], + col: [], + code: [], + dd: [], + div: [], + dl: [], + dt: [], + em: [], + hr: [], + h1: [], + h2: [], + h3: [], + h4: [], + h5: [], + h6: [], + i: [], + img: [ + "src", + "srcset", + "alt", + "title", + "width", + "height" + ], + li: [], + ol: [], + p: [], + pre: [], + s: [], + small: [], + span: [], + sub: [], + sup: [], + strong: [], + u: [], + ul: [] +}; +/** +* Allowlist for icon HTML options (Chips `dismissIcon`, NavOverflow `moreIcon`, +* and markup supplied via `[data-bs-overflow-icon]`). Covers the default SVG +* icons plus common inline-icon markup. Event-handler attributes and tags not +* listed here are stripped by `sanitizeHtml`. +*/ +const DefaultIconAllowlist = { + "*": [ + "class", + "role", + ARIA_ATTRIBUTE_PATTERN + ], + svg: [ + "xmlns", + "width", + "height", + "viewbox", + "fill", + "stroke", + "stroke-width", + "stroke-linecap", + "stroke-linejoin", + "focusable" + ], + path: [ + "d", + "fill", + "stroke", + "stroke-width", + "fill-rule", + "clip-rule" + ], + line: [ + "x1", + "y1", + "x2", + "y2", + "stroke", + "stroke-width", + "stroke-linecap" + ], + circle: [ + "cx", + "cy", + "r", + "fill", + "stroke", + "stroke-width" + ], + rect: [ + "x", + "y", + "width", + "height", + "rx", + "ry", + "fill", + "stroke", + "stroke-width" + ], + polyline: [ + "points", + "fill", + "stroke", + "stroke-width" + ], + polygon: [ + "points", + "fill", + "stroke", + "stroke-width" + ], + g: [ + "fill", + "stroke", + "stroke-width", + "transform" + ], + span: [], + i: [] +}; +const uriAttributes = /* @__PURE__ */ new Set([ + "background", + "cite", + "href", + "itemtype", + "longdesc", + "poster", + "src", + "xlink:href" +]); +/** +* A pattern that recognizes URLs that are safe wrt. XSS in URL navigation +* contexts. +* +* Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38 +*/ +const SAFE_URL_PATTERN = /^(?!(?:javascript|data|vbscript):)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i; +/** +* A pattern that matches safe data URLs. Only matches image, video and audio +* types — notably NOT `data:text/html`, which is an XSS vector. +* +* Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L49 +*/ +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; +const allowedAttribute = (attribute, allowedAttributeList) => { + const attributeName = attribute.nodeName.toLowerCase(); + if (allowedAttributeList.includes(attributeName)) { + if (uriAttributes.has(attributeName)) return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue)); + return true; + } + return allowedAttributeList.filter((attributeRegex) => attributeRegex instanceof RegExp).some((regex) => regex.test(attributeName)); +}; +function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) { + if (!unsafeHtml.length) return unsafeHtml; + if (sanitizeFunction && typeof sanitizeFunction === "function") return sanitizeFunction(unsafeHtml); + const createdDocument = new window.DOMParser().parseFromString(unsafeHtml, "text/html"); + const elements = [...createdDocument.body.querySelectorAll("*")]; + for (const element of elements) { + const elementName = element.nodeName.toLowerCase(); + if (!Object.keys(allowList).includes(elementName)) { + element.remove(); + continue; + } + const attributeList = [...element.attributes]; + const allowedAttributes = [...allowList["*"] || [], ...allowList[elementName] || []]; + for (const attribute of attributeList) if (!allowedAttribute(attribute, allowedAttributes)) element.removeAttribute(attribute.nodeName); + } + return createdDocument.body.innerHTML; +} +//#endregion +//#region js/src/nav-overflow.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap nav-overflow.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$13 = "navoverflow"; +const EVENT_KEY$10 = `.bs.navoverflow`; +const EVENT_UPDATE = `update${EVENT_KEY$10}`; +const EVENT_OVERFLOW = `overflow${EVENT_KEY$10}`; +const EVENT_RESIZE$2 = `resize${EVENT_KEY$10}`; +const CLASS_NAME_OVERFLOW = "nav-overflow"; +const CLASS_NAME_OVERFLOW_MENU = "nav-overflow-menu"; +const CLASS_NAME_HIDDEN = "d-none"; +const CLASS_NAME_KEEP = "nav-overflow-keep"; +const CLASS_NAME_INITIALIZED = "nav-overflow-initialized"; +const CLASS_NAME_SUBMENU = "submenu"; +const CLASS_NAME_SHOW$3 = "show"; +const SELECTOR_NAV = ".nav"; +const SELECTOR_NAV_ITEM = ".nav-item"; +const SELECTOR_NAV_LINK = ".nav-link"; +const SELECTOR_OVERFLOW_TOGGLE = ".nav-overflow-toggle"; +const SELECTOR_OVERFLOW_MENU = ".nav-overflow-menu"; +const SELECTOR_CUSTOM_ICON = "[data-bs-overflow-icon]"; +const SELECTOR_MENU$1 = ".menu"; +const SELECTOR_MENU_TOGGLE$2 = "[data-bs-toggle=\"menu\"]"; +const DEFAULT_TEXT = "More"; +const Default$12 = { + collapseBelow: 0, + iconPlacement: "start", + menuPlacement: "bottom-end", + menuStrategy: "absolute", + moreText: DEFAULT_TEXT, + moreIcon: "", + threshold: 0 +}; +const DefaultType$12 = { + collapseBelow: "(number|string)", + iconPlacement: "string", + menuPlacement: "string", + menuStrategy: "string", + moreText: "(string|boolean)", + moreIcon: "string", + threshold: "number" +}; +/** +* Class definition +*/ +var NavOverflow = class extends BaseComponent { + constructor(element, config) { + super(element, config); + const nav = SelectorEngine.findOne(SELECTOR_NAV, this._element); + if (!nav) throw new TypeError(`${this._element.outerHTML} has no child ${SELECTOR_NAV} to collapse`); + this._nav = nav; + this._items = []; + this._overflowItems = []; + this._overflowMenu = null; + this._overflowToggle = null; + this._resizeObserver = null; + this._resizeHandler = null; + this._collapseBelow = 0; + this._itemMenus = /* @__PURE__ */ new Map(); + this._relocatedMenus = /* @__PURE__ */ new Map(); + this._init(); + } + static get Default() { + return Default$12; + } + static get DefaultType() { + return DefaultType$12; + } + static get NAME() { + return NAME$13; + } + update() { + this._calculateOverflow(); + EventHandler.trigger(this._element, EVENT_UPDATE); + } + dispose() { + if (this._resizeObserver) this._resizeObserver.disconnect(); + if (this._resizeHandler) EventHandler.off(window, EVENT_RESIZE$2, this._resizeHandler); + this._restoreItems(); + if (this._overflowToggle && this._overflowToggle.parentElement) this._overflowToggle.parentElement.remove(); + super.dispose(); + } + _init() { + this._element.classList.add(CLASS_NAME_OVERFLOW); + this._items = SelectorEngine.find(SELECTOR_NAV_ITEM, this._nav).filter((item) => !item.querySelector(SELECTOR_OVERFLOW_TOGGLE)); + for (const [index, item] of this._items.entries()) { + item.dataset.bsNavOrder = index; + const link = SelectorEngine.findOne(SELECTOR_NAV_LINK, item); + if (link?.matches(SELECTOR_MENU_TOGGLE$2)) this._findItemMenu(item, link); + } + this._collapseBelow = this._resolveCollapseBelow(); + this._createOverflowMenu(); + this._setupResizeObserver(); + this._calculateOverflow(); + this._element.classList.add(CLASS_NAME_INITIALIZED); + } + _createOverflowMenu() { + this._overflowToggle = SelectorEngine.findOne(SELECTOR_OVERFLOW_TOGGLE, this._element); + if (this._overflowToggle) { + this._overflowMenu = SelectorEngine.findOne(SELECTOR_OVERFLOW_MENU, this._element); + return; + } + const { moreText } = this._config; + const label = typeof moreText === "string" ? moreText : ""; + const overflowItem = document.createElement("li"); + overflowItem.className = "nav-item nav-overflow-item"; + const button = document.createElement("button"); + button.type = "button"; + button.className = "nav-link nav-overflow-toggle"; + button.setAttribute("data-bs-toggle", "menu"); + button.setAttribute("data-bs-placement", this._config.menuPlacement); + button.setAttribute("data-bs-strategy", this._config.menuStrategy); + button.setAttribute("aria-expanded", "false"); + if (label === "") button.setAttribute("aria-label", DEFAULT_TEXT); + const iconSpan = document.createElement("span"); + iconSpan.className = "nav-overflow-icon"; + iconSpan.innerHTML = sanitizeHtml(this._resolveIcon(), DefaultIconAllowlist); + if (label === "") button.append(iconSpan); + else { + const textSpan = document.createElement("span"); + textSpan.className = "nav-overflow-text"; + textSpan.textContent = label; + if (this._config.iconPlacement === "end") button.append(textSpan, iconSpan); + else button.append(iconSpan, textSpan); + } + const menu = document.createElement("div"); + menu.className = `${CLASS_NAME_OVERFLOW_MENU} menu`; + overflowItem.append(button, menu); + this._nav.append(overflowItem); + this._overflowToggle = button; + this._overflowMenu = menu; + } + _resolveIcon() { + const customIconElement = SelectorEngine.findOne(SELECTOR_CUSTOM_ICON, this._element); + if (!customIconElement) return this._config.moreIcon; + const iconClone = customIconElement.cloneNode(true); + iconClone.removeAttribute("data-bs-overflow-icon"); + const iconHtml = iconClone.outerHTML; + customIconElement.remove(); + return iconHtml; + } + _resolveCollapseBelow() { + const value = this._config.collapseBelow; + if (typeof value === "number") return value; + if (typeof value === "string" && value !== "") { + const cssValue = getComputedStyle(document.documentElement).getPropertyValue(`--bs-breakpoint-${value}`); + return Number.parseFloat(cssValue) || 0; + } + return 0; + } + _setupResizeObserver() { + if (typeof ResizeObserver === "undefined") { + this._resizeHandler = () => this._calculateOverflow(); + EventHandler.on(window, EVENT_RESIZE$2, this._resizeHandler); + return; + } + this._resizeObserver = new ResizeObserver(() => { + this._calculateOverflow(); + }); + this._resizeObserver.observe(this._element); + } + _availableWidth() { + const { paddingInlineStart, paddingInlineEnd } = getComputedStyle(this._element); + const padding = (Number.parseFloat(paddingInlineStart) || 0) + (Number.parseFloat(paddingInlineEnd) || 0); + return this._element.clientWidth - padding; + } + _navGap() { + return Number.parseFloat(getComputedStyle(this._nav).columnGap) || 0; + } + _calculateOverflow() { + this._restoreItems(); + const availableWidth = this._availableWidth(); + const overflowItem = this._overflowToggle?.closest(SELECTOR_NAV_ITEM) ?? null; + const candidates = this._items.filter((item) => !item.classList.contains(CLASS_NAME_KEEP)); + if (this._collapseBelow > 0 && availableWidth < this._collapseBelow) { + this._applyOverflow(candidates, overflowItem); + return; + } + const gap = this._navGap(); + const keepWidth = this._items.filter((item) => item.classList.contains(CLASS_NAME_KEEP)).reduce((sum, item) => sum + item.offsetWidth + gap, 0); + const overflowWidth = overflowItem ? overflowItem.offsetWidth + gap : 0; + const limit = availableWidth - keepWidth - overflowWidth; + let usedWidth = 0; + let itemsToOverflow = []; + for (const item of candidates) { + usedWidth += item.offsetWidth + gap; + if (usedWidth > limit + 1) itemsToOverflow.push(item); + } + if (this._items.length - itemsToOverflow.length < this._config.threshold && this._items.length > this._config.threshold) itemsToOverflow = this._items.slice(this._config.threshold).filter((item) => !item.classList.contains(CLASS_NAME_KEEP)); + this._applyOverflow(itemsToOverflow, overflowItem); + } + _applyOverflow(items, overflowItem) { + this._moveToOverflow(items); + overflowItem?.classList.toggle(CLASS_NAME_HIDDEN, items.length === 0); + if (items.length > 0) EventHandler.trigger(this._element, EVENT_OVERFLOW, { + overflowCount: items.length, + visibleCount: this._items.length - items.length + }); + } + _moveToOverflow(items) { + if (!this._overflowMenu) return; + this._overflowMenu.replaceChildren(); + this._overflowItems = []; + for (const item of items) { + const link = SelectorEngine.findOne(SELECTOR_NAV_LINK, item); + if (!link) continue; + const menu = this._findItemMenu(item, link); + if (menu && link.matches(SELECTOR_MENU_TOGGLE$2)) this._overflowMenu.append(this._relocateAsSubmenu(item, link, menu)); + else this._overflowMenu.append(this._cloneAsMenuItem(link)); + item.classList.add(CLASS_NAME_HIDDEN); + item.dataset.bsNavOverflow = "true"; + this._overflowItems.push(item); + } + } + _relocateAsSubmenu(item, link, menu) { + this._resetMenu(link, menu); + item.classList.remove(CLASS_NAME_SHOW$3); + this._relocatedMenus.set(item, { + menu, + parent: menu.parentNode, + nextSibling: menu.nextSibling + }); + const submenu = document.createElement("div"); + submenu.className = CLASS_NAME_SUBMENU; + submenu.append(this._cloneAsMenuItem(link, true), menu); + return submenu; + } + _cloneAsMenuItem(link, submenu = false) { + const clonedLink = link.cloneNode(true); + clonedLink.className = "menu-item"; + clonedLink.removeAttribute("id"); + if (link.classList.contains("active")) clonedLink.classList.add("active"); + if (link.classList.contains("disabled") || link.hasAttribute("disabled")) clonedLink.classList.add("disabled"); + if (submenu) { + for (const name of clonedLink.getAttributeNames()) if (name.startsWith("data-bs-") && name !== "data-bs-theme") clonedLink.removeAttribute(name); + clonedLink.removeAttribute("href"); + clonedLink.setAttribute("aria-haspopup", "true"); + clonedLink.setAttribute("aria-expanded", "false"); + if (clonedLink.tagName === "A") { + clonedLink.setAttribute("role", "button"); + if (!clonedLink.hasAttribute("tabindex")) clonedLink.setAttribute("tabindex", "0"); + } + } + return clonedLink; + } + _findItemMenu(item, link) { + const sibling = SelectorEngine.next(link, SELECTOR_MENU$1)[0]; + if (sibling && !sibling.classList.contains(CLASS_NAME_OVERFLOW_MENU)) { + this._itemMenus.set(item, sibling); + return sibling; + } + const nested = SelectorEngine.findOne(SELECTOR_MENU$1, item); + if (nested && !nested.classList.contains(CLASS_NAME_OVERFLOW_MENU)) { + this._itemMenus.set(item, nested); + return nested; + } + const cached = this._itemMenus.get(item); + if (cached?.isConnected) return cached; + this._itemMenus.delete(item); + return null; + } + _resetMenu(toggle, menu) { + Menu.getInstance(toggle)?.dispose(); + toggle.classList.remove(CLASS_NAME_SHOW$3); + toggle.setAttribute("aria-expanded", "false"); + toggle.parentElement?.classList.remove(CLASS_NAME_SHOW$3); + menu.classList.remove(CLASS_NAME_SHOW$3); + } + _restoreRelocatedMenus() { + for (const { menu, parent, nextSibling } of this._relocatedMenus.values()) if (nextSibling) nextSibling.before(menu); + else parent.append(menu); + this._relocatedMenus.clear(); + } + _restoreItems() { + if (this._overflowToggle && this._overflowMenu) { + this._resetMenu(this._overflowToggle, this._overflowMenu); + this._overflowToggle.closest(SELECTOR_NAV_ITEM)?.classList.remove(CLASS_NAME_SHOW$3); + } + this._restoreRelocatedMenus(); + for (const item of this._items) { + item.classList.remove(CLASS_NAME_HIDDEN); + delete item.dataset.bsNavOverflow; + } + this._overflowToggle?.closest(SELECTOR_NAV_ITEM)?.classList.remove(CLASS_NAME_HIDDEN); + this._overflowMenu?.replaceChildren(); + this._overflowItems = []; + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, "DOMContentLoaded", () => { + for (const element of SelectorEngine.find("[data-bs-toggle=\"nav-overflow\"]")) NavOverflow.getOrCreateInstance(element); +}); +//#endregion +//#region js/src/util/swipe.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap util/swipe.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$12 = "swipe"; +const EVENT_KEY$9 = ".bs.swipe"; +const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`; +const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`; +const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`; +const EVENT_POINTERDOWN$1 = `pointerdown${EVENT_KEY$9}`; +const EVENT_POINTERUP$1 = `pointerup${EVENT_KEY$9}`; +const POINTER_TYPE_TOUCH = "touch"; +const POINTER_TYPE_PEN = "pen"; +const CLASS_NAME_POINTER_EVENT = "pointer-event"; +const SWIPE_THRESHOLD = 40; +const Default$11 = { + endCallback: null, + leftCallback: null, + rightCallback: null, + upCallback: null, + downCallback: null +}; +const DefaultType$11 = { + endCallback: "(function|null)", + leftCallback: "(function|null)", + rightCallback: "(function|null)", + upCallback: "(function|null)", + downCallback: "(function|null)" +}; +/** +* Class definition +*/ +var Swipe = class Swipe extends Config { + constructor(element, config) { + super(); + this._element = element; + if (!element || !Swipe.isSupported()) return; + this._config = this._getConfig(config); + this._deltaX = 0; + this._deltaY = 0; + this._supportPointerEvents = Boolean(window.PointerEvent); + this._initEvents(); + } + static get Default() { + return Default$11; + } + static get DefaultType() { + return DefaultType$11; + } + static get NAME() { + return NAME$12; + } + dispose() { + EventHandler.off(this._element, EVENT_KEY$9); + } + _start(event) { + if (!this._supportPointerEvents) { + this._deltaX = event.touches[0].clientX; + this._deltaY = event.touches[0].clientY; + return; + } + if (this._eventIsPointerPenTouch(event)) { + this._deltaX = event.clientX; + this._deltaY = event.clientY; + } + } + _end(event) { + if (this._eventIsPointerPenTouch(event)) { + this._deltaX = event.clientX - this._deltaX; + this._deltaY = event.clientY - this._deltaY; + } + this._handleSwipe(); + execute(this._config.endCallback); + } + _move(event) { + if (event.touches && event.touches.length > 1) { + this._deltaX = 0; + this._deltaY = 0; + return; + } + this._deltaX = event.touches[0].clientX - this._deltaX; + this._deltaY = event.touches[0].clientY - this._deltaY; + } + _handleSwipe() { + const absDeltaX = Math.abs(this._deltaX); + const absDeltaY = Math.abs(this._deltaY); + if (absDeltaY > absDeltaX && absDeltaY > SWIPE_THRESHOLD) { + const direction = this._deltaY > 0 ? "down" : "up"; + this._deltaX = 0; + this._deltaY = 0; + execute(direction === "down" ? this._config.downCallback : this._config.upCallback); + return; + } + if (absDeltaX > SWIPE_THRESHOLD) { + const direction = absDeltaX / this._deltaX; + this._deltaX = 0; + this._deltaY = 0; + if (!direction) return; + execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback); + return; + } + this._deltaX = 0; + this._deltaY = 0; + } + _initEvents() { + if (this._supportPointerEvents) { + EventHandler.on(this._element, EVENT_POINTERDOWN$1, (event) => this._start(event)); + EventHandler.on(this._element, EVENT_POINTERUP$1, (event) => this._end(event)); + this._element.classList.add(CLASS_NAME_POINTER_EVENT); + } else { + EventHandler.on(this._element, EVENT_TOUCHSTART, (event) => this._start(event)); + EventHandler.on(this._element, EVENT_TOUCHMOVE, (event) => this._move(event)); + EventHandler.on(this._element, EVENT_TOUCHEND, (event) => this._end(event)); + } + } + _eventIsPointerPenTouch(event) { + return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); + } + static isSupported() { + return "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0; + } +}; +//#endregion +//#region js/src/drawer.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap drawer.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$11 = "drawer"; +const EVENT_KEY$8 = `.bs.drawer`; +const DATA_API_KEY$5 = ".data-api"; +const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`; +const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$8}`; +const EVENT_RESIZE$1 = `resize${EVENT_KEY$8}`; +const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; +const SELECTOR_DATA_TOGGLE$4 = "[data-bs-toggle=\"drawer\"]"; +const SELECTOR_OPEN = "dialog.drawer[open], dialog[open][class*=\"\\:drawer\"]"; +const Default$10 = { + backdrop: true, + keyboard: true, + scroll: false +}; +const DefaultType$10 = { + backdrop: "(boolean|string)", + keyboard: "boolean", + scroll: "boolean" +}; +/** +* Class definition +*/ +var Drawer = class extends DialogBase { + constructor(element, config) { + super(element, config); + this._swipeHelper = null; + this._resizeObserver = null; + this._resizeFrame = null; + this._initResizeObserver(); + } + static get Default() { + return Default$10; + } + static get DefaultType() { + return DefaultType$10; + } + static get NAME() { + return NAME$11; + } + dispose() { + if (this._swipeHelper) this._swipeHelper.dispose(); + if (this._resizeObserver) this._resizeObserver.disconnect(); + if (this._resizeFrame !== null) cancelAnimationFrame(this._resizeFrame); + super.dispose(); + } + _getShowOptions() { + return { + modal: Boolean(this._config.backdrop) || !this._config.scroll, + preventBodyScroll: !this._config.scroll + }; + } + _onBeforeShow() { + this._initSwipe(); + } + _getInstantClassName() { + return "drawer-instant"; + } + _getStaticClassName() { + return "drawer-static"; + } + _initResizeObserver() { + const navbar = this._element.closest(".navbar"); + if (!navbar || typeof ResizeObserver === "undefined") return; + this._resizeObserver = new ResizeObserver(() => { + if (this._resizeFrame !== null) cancelAnimationFrame(this._resizeFrame); + this._resizeFrame = requestAnimationFrame(() => { + this._resizeFrame = null; + if (this._element.open && getComputedStyle(this._element).position !== "fixed") this.hide(); + }); + }); + this._resizeObserver.observe(navbar); + } + _initSwipe() { + if (this._swipeHelper || !Swipe.isSupported()) return; + const swipeConfig = {}; + const element = this._element; + if (element.classList.contains("drawer-bottom")) swipeConfig.downCallback = () => this.hide(); + else if (element.classList.contains("drawer-top")) swipeConfig.upCallback = () => this.hide(); + else if (element.classList.contains("drawer-end")) if (isRTL$1()) swipeConfig.leftCallback = () => this.hide(); + else swipeConfig.rightCallback = () => this.hide(); + else if (isRTL$1()) swipeConfig.rightCallback = () => this.hide(); + else swipeConfig.leftCallback = () => this.hide(); + this._swipeHelper = new Swipe(element, swipeConfig); + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$4, function(event) { + const target = SelectorEngine.getElementFromSelector(this); + if (["A", "AREA"].includes(this.tagName)) event.preventDefault(); + if (isDisabled(this)) return; + EventHandler.one(target, EVENT_HIDDEN$3, () => { + if (isVisible(this)) this.focus({ preventScroll: true }); + }); + const alreadyOpen = SelectorEngine.findOne("dialog.drawer[open]"); + if (alreadyOpen && alreadyOpen !== target) Drawer.getInstance(alreadyOpen).hide(); + Drawer.getOrCreateInstance(target).toggle(this); +}); +EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => { + for (const selector of SelectorEngine.find("dialog.drawer[open]")) Drawer.getOrCreateInstance(selector).show(); +}); +EventHandler.on(window, EVENT_RESIZE$1, () => { + for (const element of SelectorEngine.find(SELECTOR_OPEN)) if (getComputedStyle(element).position !== "fixed") Drawer.getOrCreateInstance(element).hide(); +}); +enableDismissTrigger(Drawer); +//#endregion +//#region js/src/strength.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap strength.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$10 = "strength"; +const EVENT_KEY$7 = `.bs.strength`; +const DATA_API_KEY$4 = ".data-api"; +const EVENT_STRENGTH_CHANGE = `strengthChange${EVENT_KEY$7}`; +const SELECTOR_DATA_STRENGTH = "[data-bs-strength]"; +const STRENGTH_LEVELS = [ + "weak", + "fair", + "good", + "strong" +]; +const Default$9 = { + input: null, + minLength: 8, + messages: { + weak: "Weak", + fair: "Fair", + good: "Good", + strong: "Strong" + }, + weights: { + minLength: 1, + extraLength: 1, + lowercase: 1, + uppercase: 1, + numbers: 1, + special: 1, + multipleSpecial: 1, + longPassword: 1 + }, + thresholds: [ + 2, + 4, + 6 + ], + scorer: null +}; +const DefaultType$9 = { + input: "(string|element|null)", + minLength: "number", + messages: "object", + weights: "object", + thresholds: "array", + scorer: "(function|null)" +}; +/** +* Class definition +*/ +var Strength = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._input = this._getInput(); + this._segments = SelectorEngine.find(".strength-segment", this._element); + this._textElement = SelectorEngine.findOne(".strength-text", this._element.parentElement); + this._currentStrength = null; + if (this._input) { + this._addEventListeners(); + this._evaluate(); + } + } + static get Default() { + return Default$9; + } + static get DefaultType() { + return DefaultType$9; + } + static get NAME() { + return NAME$10; + } + getStrength() { + return this._currentStrength; + } + evaluate() { + this._evaluate(); + } + dispose() { + EventHandler.off(this._input, EVENT_KEY$7); + super.dispose(); + } + _getInput() { + if (this._config.input) return typeof this._config.input === "string" ? SelectorEngine.findOne(this._config.input) : this._config.input; + const parent = this._element.parentElement; + return SelectorEngine.findOne("input[type=\"password\"]", parent); + } + _addEventListeners() { + EventHandler.on(this._input, `input${EVENT_KEY$7}`, () => this._evaluate()); + EventHandler.on(this._input, `change${EVENT_KEY$7}`, () => this._evaluate()); + } + _evaluate() { + const password = this._input.value; + const score = this._calculateScore(password); + const strength = this._scoreToStrength(score); + if (strength !== this._currentStrength) { + this._currentStrength = strength; + this._updateUI(strength); + EventHandler.trigger(this._element, EVENT_STRENGTH_CHANGE, { + strength, + score, + password: password.length > 0 ? "***" : "" + }); + } + } + _calculateScore(password) { + if (!password) return 0; + if (typeof this._config.scorer === "function") return this._config.scorer(password); + const { weights } = this._config; + let score = 0; + if (password.length >= this._config.minLength) score += weights.minLength; + if (password.length >= this._config.minLength + 4) score += weights.extraLength; + if (/[a-z]/.test(password)) score += weights.lowercase; + if (/[A-Z]/.test(password)) score += weights.uppercase; + if (/\d/.test(password)) score += weights.numbers; + if (/[!@#$%^&*(),.?":{}|<>]/.test(password)) score += weights.special; + if (/[!@#$%^&*(),.?":{}|<>].*[!@#$%^&*(),.?":{}|<>]/.test(password)) score += weights.multipleSpecial; + if (password.length >= 16) score += weights.longPassword; + return score; + } + _scoreToStrength(score) { + if (score === 0) return null; + const [weak, fair, good] = this._config.thresholds; + if (score <= weak) return "weak"; + if (score <= fair) return "fair"; + if (score <= good) return "good"; + return "strong"; + } + _updateUI(strength) { + if (strength) this._element.dataset.bsStrength = strength; + else delete this._element.dataset.bsStrength; + const strengthIndex = strength ? STRENGTH_LEVELS.indexOf(strength) : -1; + for (const [index, segment] of this._segments.entries()) if (index <= strengthIndex) segment.classList.add("active"); + else segment.classList.remove("active"); + if (this._textElement) if (strength && this._config.messages[strength]) { + this._textElement.textContent = this._config.messages[strength]; + this._textElement.dataset.bsStrength = strength; + this._textElement.style.setProperty("--strength-color", `var(--${{ + weak: "danger", + fair: "warning", + good: "info", + strong: "success" + }[strength]}-text)`); + } else { + this._textElement.textContent = ""; + delete this._textElement.dataset.bsStrength; + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, `DOMContentLoaded${EVENT_KEY$7}${DATA_API_KEY$4}`, () => { + for (const element of SelectorEngine.find(SELECTOR_DATA_STRENGTH)) Strength.getOrCreateInstance(element); +}); +//#endregion +//#region js/src/otp-input.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap otp-input.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$9 = "otpInput"; +const EVENT_KEY$6 = `.bs.otpInput`; +const DATA_API_KEY$3 = ".data-api"; +const EVENT_COMPLETE = `complete${EVENT_KEY$6}`; +const EVENT_INPUT$1 = `input${EVENT_KEY$6}`; +const EVENT_DOMCONTENT_LOADED = `DOMContentLoaded${EVENT_KEY$6}${DATA_API_KEY$3}`; +const SELECTOR_DATA_OTP = "[data-bs-otp]"; +const SELECTOR_INPUT$1 = "input"; +const CLASS_NAME_INPUT = "otp-input"; +const CLASS_NAME_RENDERED = "otp-rendered"; +const CLASS_NAME_SLOTS = "otp-slots"; +const CLASS_NAME_SLOT = "otp-slot"; +const CLASS_NAME_SLOT_FILLED = "otp-slot-filled"; +const CLASS_NAME_SLOT_ACTIVE = "otp-slot-active"; +const CLASS_NAME_SEPARATOR = "otp-separator"; +const MASK_CHARACTER = "•"; +const TYPES = { + numeric: { + inputmode: "numeric", + pattern: "[0-9]*", + filter: /[^0-9]/g + }, + alphanumeric: { + inputmode: "text", + pattern: "[A-Za-z0-9]*", + filter: /[^A-Za-z0-9]/g + }, + alpha: { + inputmode: "text", + pattern: "[A-Za-z]*", + filter: /[^A-Za-z]/g + } +}; +const Default$8 = { + groups: null, + length: null, + mask: false, + separator: "·", + type: "numeric" +}; +const DefaultType$8 = { + groups: "(array|null)", + length: "(number|null)", + mask: "boolean", + separator: "string", + type: "string" +}; +/** +* Class definition +*/ +var OtpInput = class extends BaseComponent { + constructor(element, config) { + super(element, config); + const input = SelectorEngine.findOne(SELECTOR_INPUT$1, this._element); + if (!input) return; + this._input = input; + this._type = TYPES[this._config.type] || TYPES.numeric; + this._length = this._resolveLength(); + this._slots = []; + this._pointerActive = false; + this._pointerIndex = 0; + this._setupInput(); + this._renderSlots(); + this._addEventListeners(); + this._render(); + } + static get Default() { + return Default$8; + } + static get DefaultType() { + return DefaultType$8; + } + static get NAME() { + return NAME$9; + } + getValue() { + return this._input.value; + } + setValue(value) { + this._input.value = this._sanitize(String(value)); + this._render(); + this._checkComplete(); + } + clear() { + this._input.value = ""; + this._render(); + this._input.focus(); + } + focus() { + this._input.focus(); + this._selectSlot(this._firstEmptyIndex()); + this._render(); + } + dispose() { + for (const [type, listener] of Object.entries(this._inputListeners ?? {})) EventHandler.off(this._input, type, listener); + EventHandler.off(document, "selectionchange", this._onSelectionChange); + this._slotsContainer?.remove(); + this._element.classList.remove(CLASS_NAME_RENDERED); + super.dispose(); + } + _resolveLength() { + if (this._config.length) return this._config.length; + const maxLength = Number.parseInt(this._input.getAttribute("maxlength"), 10); + return Number.isNaN(maxLength) || maxLength < 1 ? 6 : maxLength; + } + _setupInput() { + const input = this._input; + if (input.type === "number" || input.type === "password") input.type = "text"; + input.classList.add(CLASS_NAME_INPUT); + input.setAttribute("maxlength", String(this._length)); + input.setAttribute("inputmode", this._type.inputmode); + input.setAttribute("pattern", this._type.pattern); + if (!input.getAttribute("autocomplete")) input.setAttribute("autocomplete", "one-time-code"); + if (input.value) input.value = this._sanitize(input.value); + } + _renderSlots() { + const container = document.createElement("div"); + container.className = CLASS_NAME_SLOTS; + container.setAttribute("aria-hidden", "true"); + const { groups } = this._config; + let groupIndex = 0; + let inGroup = 0; + for (let i = 0; i < this._length; i++) { + const slot = document.createElement("div"); + slot.className = CLASS_NAME_SLOT; + container.append(slot); + this._slots.push(slot); + if (Array.isArray(groups) && groups.length > 0) { + inGroup++; + if (inGroup === groups[groupIndex] && i < this._length - 1) { + const separator = document.createElement("div"); + separator.className = CLASS_NAME_SEPARATOR; + separator.textContent = this._config.separator; + container.append(separator); + groupIndex = Math.min(groupIndex + 1, groups.length - 1); + inGroup = 0; + } + } + } + this._slotsContainer = container; + this._element.append(container); + this._element.classList.add(CLASS_NAME_RENDERED); + } + _addEventListeners() { + this._inputListeners = { + input: () => this._handleInput(), + beforeinput: (event) => this._handleBeforeInput(event), + paste: (event) => this._handlePaste(event), + pointerdown: (event) => this._handlePointerDown(event) + }; + this._inputListeners.focus = () => { + if (this._pointerActive) { + this._pointerActive = false; + this._selectSlot(this._pointerIndex); + this._render(); + return; + } + this._selectSlot(this._firstEmptyIndex()); + this._render(); + }; + const onSync = () => this._render(); + this._onSelectionChange = () => { + if (document.activeElement === this._input) this._render(); + }; + for (const type of [ + "blur", + "keyup", + "select" + ]) this._inputListeners[type] = onSync; + for (const [type, listener] of Object.entries(this._inputListeners)) EventHandler.on(this._input, type, listener); + EventHandler.on(document, "selectionchange", this._onSelectionChange); + } + _handleInput() { + const sanitized = this._sanitize(this._input.value); + if (sanitized !== this._input.value) this._input.value = sanitized; + if (document.activeElement === this._input) this._selectSlot(this._firstEmptyIndex()); + this._afterValueChange(); + } + _handlePaste(event) { + const pastedValue = event.clipboardData?.getData("text"); + if (!pastedValue || this._input.readOnly) return; + const sanitized = this._sanitize(pastedValue); + let start = this._input.selectionStart ?? this._input.value.length; + let end = this._input.selectionEnd ?? start; + if (sanitized.length === this._length) { + start = 0; + end = this._input.value.length; + } + const inserted = sanitized.slice(0, this._length - this._input.value.length + end - start); + event.preventDefault(); + if (!inserted) return; + this._input.setRangeText(inserted, start, end, "end"); + this._afterValueChange(); + } + _handleBeforeInput(event) { + const { inputType, data } = event; + if (inputType === "insertText" && data && data.length === 1) { + event.preventDefault(); + const char = this._sanitize(data); + if (!char) return; + const index = Math.min(this._input.selectionStart ?? 0, this._length - 1); + const chars = [...this._input.value]; + chars[index] = char; + this._input.value = chars.join("").slice(0, this._length); + this._selectSlot(index + 1); + this._afterValueChange(); + return; + } + if (inputType === "deleteContentBackward") { + event.preventDefault(); + const start = this._input.selectionStart ?? 0; + const end = this._input.selectionEnd ?? start; + const chars = [...this._input.value]; + if (end > start) { + chars.splice(start, end - start); + this._input.value = chars.join(""); + this._selectSlot(start); + } else if (start > 0) { + chars.splice(start - 1, 1); + this._input.value = chars.join(""); + this._selectSlot(start - 1); + } + this._afterValueChange(); + } + } + _handlePointerDown(event) { + const index = this._slotIndexFromPoint(event.clientX); + if (index === null) return; + const target = Math.min(index, this._firstEmptyIndex()); + if (document.activeElement === this._input) { + event.preventDefault(); + this._selectSlot(target); + this._render(); + return; + } + this._pointerActive = true; + this._pointerIndex = target; + } + _slotIndexFromPoint(x) { + for (const [index, slot] of this._slots.entries()) if (x <= slot.getBoundingClientRect().right || index === this._slots.length - 1) return index; + return null; + } + _afterValueChange() { + this._render(); + EventHandler.trigger(this._element, EVENT_INPUT$1, { value: this._input.value }); + this._checkComplete(); + } + _firstEmptyIndex() { + return Math.min(this._input.value.length, this._length - 1); + } + _selectSlot(index) { + const clamped = Math.max(0, Math.min(index, this._length - 1)); + const end = clamped < this._input.value.length ? clamped + 1 : clamped; + this._input.setSelectionRange(clamped, end); + } + _sanitize(value) { + return value.replace(this._type.filter, "").slice(0, this._length); + } + _render() { + const { value } = this._input; + const isFocused = document.activeElement === this._input; + const caret = Math.min(this._input.selectionStart ?? value.length, this._length - 1); + for (const [index, slot] of this._slots.entries()) { + const char = value[index] ?? ""; + slot.textContent = char && this._config.mask ? MASK_CHARACTER : char; + slot.classList.toggle(CLASS_NAME_SLOT_FILLED, Boolean(char)); + slot.classList.toggle(CLASS_NAME_SLOT_ACTIVE, isFocused && index === caret); + } + } + _checkComplete() { + const { value } = this._input; + if (value.length === this._length) EventHandler.trigger(this._element, EVENT_COMPLETE, { value }); + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_DOMCONTENT_LOADED, () => { + for (const element of SelectorEngine.find(SELECTOR_DATA_OTP)) OtpInput.getOrCreateInstance(element); +}); +//#endregion +//#region js/src/chips.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap chips.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$8 = "chips"; +const EVENT_KEY$5 = `.bs.chips`; +const DATA_API_KEY$2 = ".data-api"; +const EVENT_ADD = `add${EVENT_KEY$5}`; +const EVENT_REMOVE = `remove${EVENT_KEY$5}`; +const EVENT_CHANGE$1 = `change${EVENT_KEY$5}`; +const EVENT_SELECT = `select${EVENT_KEY$5}`; +const SELECTOR_DATA_CHIPS = "[data-bs-chips]"; +const SELECTOR_GHOST_INPUT = ".form-ghost"; +const SELECTOR_CHIP = ".chip"; +const SELECTOR_CHIP_DISMISS = ".chip-dismiss"; +const CLASS_NAME_CHIP = "chip"; +const CLASS_NAME_CHIP_DISMISS = "chip-dismiss"; +const CLASS_NAME_ACTIVE$2 = "active"; +const Default$7 = { + separator: ",", + allowDuplicates: false, + maxChips: null, + placeholder: "", + dismissible: true, + dismissIcon: "", + createOnBlur: true +}; +const DefaultType$7 = { + separator: "(string|null)", + allowDuplicates: "boolean", + maxChips: "(number|null)", + placeholder: "string", + dismissible: "boolean", + dismissIcon: "string", + createOnBlur: "boolean" +}; +/** +* Class definition +*/ +var Chips = class extends BaseComponent { + constructor(element, config) { + super(element, config); + const ghostInput = SelectorEngine.findOne(SELECTOR_GHOST_INPUT, this._element); + this._chips = []; + this._selectedChips = /* @__PURE__ */ new Set(); + this._anchorChip = null; + if (ghostInput) this._input = ghostInput; + else this._createInput(); + this._initializeExistingChips(); + this._addEventListeners(); + } + static get Default() { + return Default$7; + } + static get DefaultType() { + return DefaultType$7; + } + static get NAME() { + return NAME$8; + } + add(value) { + const trimmedValue = String(value).trim(); + if (!trimmedValue) return null; + if (!this._config.allowDuplicates && this._chips.includes(trimmedValue)) return null; + if (this._config.maxChips !== null && this._chips.length >= this._config.maxChips) return null; + if (EventHandler.trigger(this._element, EVENT_ADD, { + value: trimmedValue, + relatedTarget: this._input + }).defaultPrevented) return null; + const chip = this._createChip(trimmedValue); + this._element.insertBefore(chip, this._input); + this._chips.push(trimmedValue); + EventHandler.trigger(this._element, EVENT_CHANGE$1, { values: this.getValues() }); + return chip; + } + remove(chipOrValue) { + let chip; + let value; + if (typeof chipOrValue === "string") { + value = chipOrValue; + chip = this._findChipByValue(value); + } else { + chip = chipOrValue; + value = this._getChipValue(chip); + } + if (!chip || !value) return false; + if (EventHandler.trigger(this._element, EVENT_REMOVE, { + value, + chip, + relatedTarget: this._input + }).defaultPrevented) return false; + this._selectedChips.delete(chip); + if (this._anchorChip === chip) this._anchorChip = null; + chip.remove(); + this._chips = this._getChipElements().map((chipElement) => this._getChipValue(chipElement)).filter(Boolean); + EventHandler.trigger(this._element, EVENT_CHANGE$1, { values: this.getValues() }); + return true; + } + removeSelected() { + const chipsToRemove = [...this._selectedChips]; + for (const chip of chipsToRemove) this.remove(chip); + this._input?.focus(); + } + getValues() { + return [...this._chips]; + } + getSelectedValues() { + return [...this._selectedChips].map((chip) => this._getChipValue(chip)); + } + clear() { + const chips = SelectorEngine.find(SELECTOR_CHIP, this._element); + for (const chip of chips) chip.remove(); + this._chips = []; + this._selectedChips.clear(); + this._anchorChip = null; + EventHandler.trigger(this._element, EVENT_CHANGE$1, { values: [] }); + } + clearSelection() { + for (const chip of this._selectedChips) chip.classList.remove(CLASS_NAME_ACTIVE$2); + this._selectedChips.clear(); + this._anchorChip = null; + EventHandler.trigger(this._element, EVENT_SELECT, { selected: [] }); + } + selectChip(chip, options = {}) { + const { addToSelection = false, rangeSelect = false } = options; + const chipElements = this._getChipElements(); + if (!chipElements.includes(chip)) return; + if (rangeSelect && this._anchorChip) { + const anchorIndex = chipElements.indexOf(this._anchorChip); + const chipIndex = chipElements.indexOf(chip); + const start = Math.min(anchorIndex, chipIndex); + const end = Math.max(anchorIndex, chipIndex); + if (!addToSelection) { + const anchorChip = this._anchorChip; + this.clearSelection(); + this._anchorChip = anchorChip; + } + for (let i = start; i <= end; i++) { + this._selectedChips.add(chipElements[i]); + chipElements[i].classList.add(CLASS_NAME_ACTIVE$2); + } + } else if (addToSelection) if (this._selectedChips.has(chip)) { + this._selectedChips.delete(chip); + chip.classList.remove(CLASS_NAME_ACTIVE$2); + } else { + this._selectedChips.add(chip); + chip.classList.add(CLASS_NAME_ACTIVE$2); + this._anchorChip = chip; + } + else { + this.clearSelection(); + this._selectedChips.add(chip); + chip.classList.add(CLASS_NAME_ACTIVE$2); + this._anchorChip = chip; + } + EventHandler.trigger(this._element, EVENT_SELECT, { selected: this.getSelectedValues() }); + } + focus() { + this._input?.focus(); + } + dispose() { + EventHandler.off(this._input, EVENT_KEY$5); + super.dispose(); + } + _getChipElements() { + return SelectorEngine.find(SELECTOR_CHIP, this._element); + } + _createInput() { + const input = document.createElement("input"); + input.type = "text"; + input.className = "form-ghost"; + if (this._config.placeholder) input.placeholder = this._config.placeholder; + this._element.append(input); + this._input = input; + } + _initializeExistingChips() { + const existingChips = SelectorEngine.find(SELECTOR_CHIP, this._element); + for (const chip of existingChips) { + const value = this._getChipValue(chip); + if (value) { + this._chips.push(value); + this._setupChip(chip); + } + } + } + _setupChip(chip) { + chip.setAttribute("tabindex", "0"); + if (this._config.dismissible && !SelectorEngine.findOne(SELECTOR_CHIP_DISMISS, chip)) chip.append(this._createDismissButton()); + } + _createChip(value) { + const chip = document.createElement("span"); + chip.className = CLASS_NAME_CHIP; + chip.dataset.bsChipValue = value; + chip.append(document.createTextNode(value)); + this._setupChip(chip); + return chip; + } + _createDismissButton() { + const button = document.createElement("button"); + button.type = "button"; + button.className = CLASS_NAME_CHIP_DISMISS; + button.setAttribute("aria-label", "Remove"); + button.setAttribute("tabindex", "-1"); + button.innerHTML = sanitizeHtml(this._config.dismissIcon, DefaultIconAllowlist); + return button; + } + _findChipByValue(value) { + return this._getChipElements().find((chip) => this._getChipValue(chip) === value); + } + _getChipValue(chip) { + if (chip.dataset.bsChipValue) return chip.dataset.bsChipValue; + const clone = chip.cloneNode(true); + const dismiss = SelectorEngine.findOne(SELECTOR_CHIP_DISMISS, clone); + if (dismiss) dismiss.remove(); + return clone.textContent?.trim() || ""; + } + _addEventListeners() { + EventHandler.on(this._input, `keydown${EVENT_KEY$5}`, (event) => this._handleInputKeydown(event)); + EventHandler.on(this._input, `input${EVENT_KEY$5}`, (event) => this._handleInput(event)); + EventHandler.on(this._input, `paste${EVENT_KEY$5}`, (event) => this._handlePaste(event)); + EventHandler.on(this._input, `focus${EVENT_KEY$5}`, () => this.clearSelection()); + if (this._config.createOnBlur) EventHandler.on(this._input, `blur${EVENT_KEY$5}`, (event) => { + if (!event.relatedTarget?.closest(SELECTOR_CHIP)) this._createChipFromInput(); + }); + EventHandler.on(this._element, `click${EVENT_KEY$5}`, SELECTOR_CHIP, (event) => { + if (event.target.closest(SELECTOR_CHIP_DISMISS)) return; + const chip = event.target.closest(SELECTOR_CHIP); + if (chip) { + event.preventDefault(); + this.selectChip(chip, { + addToSelection: event.metaKey || event.ctrlKey, + rangeSelect: event.shiftKey + }); + chip.focus(); + } + }); + EventHandler.on(this._element, `click${EVENT_KEY$5}`, SELECTOR_CHIP_DISMISS, (event) => { + event.stopPropagation(); + const chip = event.target.closest(SELECTOR_CHIP); + if (chip) { + this.remove(chip); + this._input?.focus(); + } + }); + EventHandler.on(this._element, `keydown${EVENT_KEY$5}`, SELECTOR_CHIP, (event) => { + this._handleChipKeydown(event); + }); + EventHandler.on(this._element, `click${EVENT_KEY$5}`, (event) => { + if (event.target === this._element) { + this.clearSelection(); + this._input?.focus(); + } + }); + } + _handleInputKeydown(event) { + const { key } = event; + switch (key) { + case "Enter": + event.preventDefault(); + this._createChipFromInput(); + break; + case "Backspace": + case "Delete": + if (this._input.value === "") { + event.preventDefault(); + const chips = this._getChipElements(); + if (chips.length > 0) { + const lastChip = chips.at(-1); + this.selectChip(lastChip); + lastChip.focus(); + } + } + break; + case "ArrowLeft": + if (this._input.selectionStart === 0 && this._input.selectionEnd === 0) { + event.preventDefault(); + const chips = this._getChipElements(); + if (chips.length > 0) { + const lastChip = chips.at(-1); + if (event.shiftKey) this.selectChip(lastChip, { addToSelection: true }); + else this.selectChip(lastChip); + lastChip.focus(); + } + } + break; + case "Escape": + this._input.value = ""; + this.clearSelection(); + this._input.blur(); + break; + } + } + _handleChipKeydown(event) { + const { key } = event; + const chip = event.target.closest(SELECTOR_CHIP); + if (!chip) return; + const chips = this._getChipElements(); + const currentIndex = chips.indexOf(chip); + switch (key) { + case "Backspace": + case "Delete": + event.preventDefault(); + this._handleChipDelete(currentIndex, chips); + break; + case "ArrowLeft": + event.preventDefault(); + this._navigateChip(chips, currentIndex, -1, event.shiftKey); + break; + case "ArrowRight": + event.preventDefault(); + this._navigateChip(chips, currentIndex, 1, event.shiftKey); + break; + case "Home": + event.preventDefault(); + this._navigateToEdge(chips, 0, event.shiftKey); + break; + case "End": + event.preventDefault(); + this.clearSelection(); + this._input?.focus(); + break; + case "a": + this._handleSelectAll(event, chips); + break; + case "Escape": + event.preventDefault(); + this.clearSelection(); + this._input?.focus(); + break; + } + } + _handleChipDelete(currentIndex, chips) { + if (this._selectedChips.size === 0) return; + const nextIndex = Math.min(currentIndex, chips.length - this._selectedChips.size - 1); + this.removeSelected(); + const remainingChips = this._getChipElements(); + if (remainingChips.length > 0) { + const focusIndex = Math.max(0, Math.min(nextIndex, remainingChips.length - 1)); + remainingChips[focusIndex].focus(); + this.selectChip(remainingChips[focusIndex]); + } else this._input?.focus(); + } + _navigateChip(chips, currentIndex, direction, shiftKey) { + const targetIndex = currentIndex + direction; + if (direction < 0 && targetIndex >= 0) { + const targetChip = chips[targetIndex]; + this.selectChip(targetChip, shiftKey ? { + addToSelection: true, + rangeSelect: true + } : {}); + targetChip.focus(); + } else if (direction > 0 && targetIndex < chips.length) { + const targetChip = chips[targetIndex]; + this.selectChip(targetChip, shiftKey ? { + addToSelection: true, + rangeSelect: true + } : {}); + targetChip.focus(); + } else if (direction > 0) { + this.clearSelection(); + this._input?.focus(); + } + } + _navigateToEdge(chips, targetIndex, shiftKey) { + if (chips.length === 0) return; + const targetChip = chips[targetIndex]; + this.selectChip(targetChip, shiftKey ? { rangeSelect: true } : {}); + targetChip.focus(); + } + _handleSelectAll(event, chips) { + if (!(event.metaKey || event.ctrlKey)) return; + event.preventDefault(); + for (const c of chips) { + this._selectedChips.add(c); + c.classList.add(CLASS_NAME_ACTIVE$2); + } + EventHandler.trigger(this._element, EVENT_SELECT, { selected: this.getSelectedValues() }); + } + _handleInput(event) { + const { value } = event.target; + const { separator } = this._config; + if (separator && value.includes(separator)) { + const parts = value.split(separator); + for (const part of parts.slice(0, -1)) this.add(part.trim()); + this._input.value = parts.at(-1); + } + } + _handlePaste(event) { + const { separator } = this._config; + if (!separator) return; + const pastedData = (event.clipboardData || window.clipboardData).getData("text"); + if (pastedData.includes(separator)) { + event.preventDefault(); + const parts = pastedData.split(separator); + for (const part of parts) this.add(part.trim()); + } + } + _createChipFromInput() { + const value = this._input.value.trim(); + if (value) { + this.add(value); + this._input.value = ""; + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, `DOMContentLoaded${EVENT_KEY$5}${DATA_API_KEY$2}`, () => { + for (const element of SelectorEngine.find(SELECTOR_DATA_CHIPS)) Chips.getOrCreateInstance(element); +}); +//#endregion +//#region js/src/util/template-factory.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap util/template-factory.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$7 = "TemplateFactory"; +const Default$6 = { + allowList: DefaultAllowlist, + content: {}, + extraClass: "", + html: false, + sanitize: true, + sanitizeFn: null, + template: "
" +}; +const DefaultType$6 = { + allowList: "object", + content: "object", + extraClass: "(string|function)", + html: "boolean", + sanitize: "boolean", + sanitizeFn: "(null|function)", + template: "string" +}; +const DefaultContentType = { + entry: "(string|element|function|null)", + selector: "(string|element)" +}; +/** +* Class definition +*/ +var TemplateFactory = class extends Config { + constructor(config) { + super(); + this._config = this._getConfig(config); + } + static get Default() { + return Default$6; + } + static get DefaultType() { + return DefaultType$6; + } + static get NAME() { + return NAME$7; + } + getContent() { + return Object.values(this._config.content).map((config) => this._resolvePossibleFunction(config)).filter(Boolean); + } + hasContent() { + return this.getContent().length > 0; + } + changeContent(content) { + this._checkContent(content); + this._config.content = { + ...this._config.content, + ...content + }; + return this; + } + toHtml() { + const templateWrapper = document.createElement("div"); + templateWrapper.innerHTML = this._maybeSanitize(this._config.template); + for (const [selector, text] of Object.entries(this._config.content)) this._setContent(templateWrapper, text, selector); + const template = templateWrapper.children[0]; + const extraClass = this._resolvePossibleFunction(this._config.extraClass); + if (extraClass) template.classList.add(...extraClass.split(" ")); + return template; + } + _typeCheckConfig(config) { + super._typeCheckConfig(config); + this._checkContent(config.content); + } + _checkContent(arg) { + for (const [selector, content] of Object.entries(arg)) super._typeCheckConfig({ + selector, + entry: content + }, DefaultContentType); + } + _setContent(template, content, selector) { + const templateElement = SelectorEngine.findOne(selector, template); + if (!templateElement) return; + content = this._resolvePossibleFunction(content); + if (!content) { + templateElement.remove(); + return; + } + if (isElement$1(content)) { + this._putElementInTemplate(getElement(content), templateElement); + return; + } + if (this._config.html) { + templateElement.innerHTML = this._maybeSanitize(content); + return; + } + templateElement.textContent = content; + } + _maybeSanitize(arg) { + return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg; + } + _resolvePossibleFunction(arg) { + return execute(arg, [void 0, this]); + } + _putElementInTemplate(element, templateElement) { + if (this._config.html) { + templateElement.innerHTML = ""; + templateElement.append(element); + return; + } + templateElement.textContent = element.textContent; + } +}; +//#endregion +//#region js/src/tooltip.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap tooltip.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$6 = "tooltip"; +const DISALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set([ + "sanitize", + "allowList", + "sanitizeFn" +]); +const ESCAPE_KEY = "Escape"; +const CLASS_NAME_MODAL = "modal"; +const CLASS_NAME_SHOW$2 = "show"; +const SELECTOR_TOOLTIP_INNER = ".tooltip-inner"; +const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; +const SELECTOR_DATA_TOGGLE$3 = "[data-bs-toggle=\"tooltip\"]"; +const EVENT_MODAL_HIDE = "hide.bs.modal"; +const TRIGGER_HOVER = "hover"; +const TRIGGER_FOCUS = "focus"; +const TRIGGER_CLICK = "click"; +const TRIGGER_MANUAL = "manual"; +const EVENT_HIDE$2 = "hide"; +const EVENT_HIDDEN$2 = "hidden"; +const EVENT_SHOW$2 = "show"; +const EVENT_SHOWN$2 = "shown"; +const EVENT_INSERTED = "inserted"; +const EVENT_CLICK$3 = "click"; +const EVENT_FOCUSIN$2 = "focusin"; +const EVENT_FOCUSOUT$1 = "focusout"; +const EVENT_MOUSEENTER$1 = "mouseenter"; +const EVENT_MOUSELEAVE = "mouseleave"; +const EVENT_POINTERDOWN = "pointerdown"; +const EVENT_POINTERUP = "pointerup"; +const EVENT_KEYDOWN$1 = "keydown"; +const AttachmentMap = { + AUTO: "auto", + TOP: "top", + RIGHT: isRTL$1() ? "left" : "right", + BOTTOM: "bottom", + LEFT: isRTL$1() ? "right" : "left" +}; +const Default$5 = { + allowList: DefaultAllowlist, + animation: true, + boundary: "clippingParents", + container: false, + customClass: "", + delay: 0, + fallbackPlacements: [ + "top", + "right", + "bottom", + "left" + ], + html: false, + offset: [0, 6], + placement: "top", + floatingConfig: null, + sanitize: true, + sanitizeFn: null, + selector: false, + template: "
", + title: "", + trigger: "hover focus" +}; +const DefaultType$5 = { + allowList: "object", + animation: "boolean", + boundary: "(string|element)", + container: "(string|element|boolean)", + customClass: "(string|function)", + delay: "(number|object)", + fallbackPlacements: "array", + html: "boolean", + offset: "(array|string|function)", + placement: "(string|function)", + floatingConfig: "(null|object|function)", + sanitize: "boolean", + sanitizeFn: "(null|function)", + selector: "(string|boolean)", + template: "string", + title: "(string|element|function)", + trigger: "string" +}; +/** +* Class definition +*/ +var Tooltip = class extends BaseComponent { + constructor(element, config) { + if (typeof computePosition === "undefined") throw new TypeError("Bootstrap's tooltips require Floating UI (https://floating-ui.com)"); + super(element, config); + this._isEnabled = true; + this._timeout = 0; + this._resolveTimeout = null; + this._isHovered = null; + this._activeTrigger = {}; + this._floatingCleanup = null; + this._keydownHandler = null; + this._tipEventOut = null; + this._outsidePointerHandler = null; + this._tipPointerUpHandler = null; + this._tipPointerDown = false; + this._templateFactory = null; + this._newContent = null; + this._mediaQueryListeners = []; + this._responsivePlacements = null; + this.tip = null; + this._parseResponsivePlacements(); + this._setListeners(); + if (!this._config.selector) this._fixTitle(); + } + static get Default() { + return Default$5; + } + static get DefaultType() { + return DefaultType$5; + } + static get NAME() { + return NAME$6; + } + enable() { + this._isEnabled = true; + } + disable() { + this._isEnabled = false; + } + toggleEnabled() { + this._isEnabled = !this._isEnabled; + } + toggle() { + if (!this._isEnabled) return Promise.resolve(); + return this._isShown() ? this._leave() : this._enter(); + } + dispose() { + this._clearTimeout(); + this._removeEscapeListener(); + this._removeFocusOutsideListener(); + EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); + if (this._element.getAttribute("data-bs-original-title")) this._element.setAttribute("title", this._element.getAttribute("data-bs-original-title")); + this._disposeFloating(); + this._disposeMediaQueryListeners(); + super.dispose(); + } + async show() { + if (this._element.style.display === "none") throw new Error("Please use show on visible elements"); + if (!(this._isWithContent() && this._isEnabled)) return; + const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2)); + const isInTheDom = (findShadowRoot(this._element) || this._element.ownerDocument.documentElement).contains(this._element); + if (showEvent.defaultPrevented || !isInTheDom) { + this._isHovered = false; + return; + } + this._disposeFloating(); + const tip = this._getTipElement(); + this._element.setAttribute("aria-describedby", tip.getAttribute("id")); + let { container } = this._config; + const closestDialog = this._element.closest("dialog[open]"); + if (closestDialog && container === document.body) container = closestDialog; + if (!this._element.ownerDocument.documentElement.contains(this.tip)) { + container.append(tip); + EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED)); + this._setTipListeners(tip); + } + await this._createFloating(tip); + tip.classList.add(CLASS_NAME_SHOW$2); + this._setEscapeListener(); + this._setFocusOutsideListener(); + if ("ontouchstart" in document.documentElement) for (const element of document.body.children) EventHandler.on(element, "mouseover", noop); + const complete = () => { + EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2)); + if (this._isHovered === false) this._leave(); + this._isHovered = false; + }; + await this._queueCallback(complete, this.tip, this._isAnimated()); + } + async hide() { + if (!this._isShown()) return; + if (EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2)).defaultPrevented) return; + this._removeEscapeListener(); + this._removeFocusOutsideListener(); + this._getTipElement().classList.remove(CLASS_NAME_SHOW$2); + if ("ontouchstart" in document.documentElement) for (const element of document.body.children) EventHandler.off(element, "mouseover", noop); + this._activeTrigger[TRIGGER_CLICK] = false; + this._activeTrigger[TRIGGER_FOCUS] = false; + this._activeTrigger[TRIGGER_HOVER] = false; + this._isHovered = null; + const complete = () => { + if (this._isWithActiveTrigger()) return; + if (!this._isHovered) this._disposeFloating(); + this._element.removeAttribute("aria-describedby"); + EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2)); + }; + await this._queueCallback(complete, this.tip, this._isAnimated()); + } + update() { + if (this._floatingCleanup && this.tip) this._updateFloatingPosition(); + } + _isWithContent() { + return Boolean(this._getTitle()) || this._hasNewContent(); + } + _hasNewContent() { + return Boolean(this._newContent) && Object.values(this._newContent).some(Boolean); + } + _getTipElement() { + if (!this.tip) this.tip = this._createTipElement(this._newContent || this._getContentForTemplate()); + return this.tip; + } + _createTipElement(content) { + const tip = this._getTemplateFactory(content).toHtml(); + tip.classList.remove(CLASS_NAME_SHOW$2); + tip.classList.add(`bs-${this.constructor.NAME}-auto`); + const tipId = getUID(this.constructor.NAME).toString(); + tip.setAttribute("id", tipId); + if (!this._config.animation) tip.classList.add(this._getInstantClassName()); + this._setFocusTipListeners(tip); + return tip; + } + setContent(content) { + this._newContent = content; + if (this._isShown()) { + this._disposeFloating(); + this.show(); + } + } + _getTemplateFactory(content) { + if (this._templateFactory) this._templateFactory.changeContent(content); + else this._templateFactory = new TemplateFactory({ + ...this._config, + content, + extraClass: this._resolvePossibleFunction(this._config.customClass) + }); + return this._templateFactory; + } + _getContentForTemplate() { + return { [SELECTOR_TOOLTIP_INNER]: this._getTitle() }; + } + _getTitle() { + return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute("data-bs-original-title"); + } + _initializeOnDelegatedTarget(event) { + return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); + } + _getInstantClassName() { + return `${this.constructor.NAME}-instant`; + } + _isAnimated() { + return getTransitionDurationFromElement(this.tip) > 0; + } + _isShown() { + return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2); + } + _getPlacement(tip) { + if (this._responsivePlacements) { + const placement = getResponsivePlacement(this._responsivePlacements, "top"); + return AttachmentMap[placement.toUpperCase()] || placement; + } + const placement = execute(this._config.placement, [ + this, + tip, + this._element + ]); + return AttachmentMap[placement.toUpperCase()] || placement; + } + _parseResponsivePlacements() { + if (typeof this._config.placement !== "string") { + this._responsivePlacements = null; + return; + } + this._responsivePlacements = parseResponsivePlacement(this._config.placement, "top"); + if (this._responsivePlacements) this._setupMediaQueryListeners(); + } + _setupMediaQueryListeners() { + this._disposeMediaQueryListeners(); + this._mediaQueryListeners = createBreakpointListeners(() => { + if (this._isShown()) this._updateFloatingPosition(); + }); + } + _disposeMediaQueryListeners() { + disposeBreakpointListeners(this._mediaQueryListeners); + this._mediaQueryListeners = []; + } + async _createFloating(tip) { + const placement = this._getPlacement(tip); + const arrowElement = tip.querySelector(`.${this.constructor.NAME}-arrow`); + await this._updateFloatingPosition(tip, placement, arrowElement); + this._floatingCleanup = autoUpdate(this._element, tip, () => this._updateFloatingPosition(tip, null, arrowElement)); + } + async _updateFloatingPosition(tip = this.tip, placement = null, arrowElement = null) { + if (!tip) return; + if (!placement) placement = this._getPlacement(tip); + if (!arrowElement) arrowElement = tip.querySelector(`.${this.constructor.NAME}-arrow`); + const middleware = this._getFloatingMiddleware(arrowElement); + const floatingConfig = this._getFloatingConfig(placement, middleware); + const { x, y, placement: finalPlacement, middlewareData } = await computePosition(this._element, tip, floatingConfig); + Object.assign(tip.style, { + position: "absolute", + left: `${x}px`, + top: `${y}px` + }); + if (arrowElement) arrowElement.style.position = "absolute"; + Manipulator.setDataAttribute(tip, "placement", finalPlacement); + if (arrowElement && middlewareData.arrow) { + const { x: arrowX, y: arrowY } = middlewareData.arrow; + const isVertical = finalPlacement.startsWith("top") || finalPlacement.startsWith("bottom"); + Object.assign(arrowElement.style, { + left: isVertical && arrowX !== void 0 ? `${arrowX}px` : "", + top: !isVertical && arrowY !== void 0 ? `${arrowY}px` : "", + right: "", + bottom: "" + }); + } + } + _getOffset() { + const { offset } = this._config; + if (typeof offset === "string") return offset.split(",").map((value) => Number.parseInt(value, 10)); + if (typeof offset === "function") return ({ placement, rects }) => { + return toFloatingOffset(offset({ + placement, + reference: rects.reference, + floating: rects.floating + }, this._element)); + }; + return offset; + } + _resolvePossibleFunction(arg) { + return execute(arg, [this._element, this._element]); + } + _getFloatingMiddleware(arrowElement) { + const offsetValue = this._getOffset(); + const middleware = [ + offset(typeof offsetValue === "function" ? offsetValue : toFloatingOffset(offsetValue)), + flip({ fallbackPlacements: this._config.fallbackPlacements }), + shift({ boundary: this._config.boundary === "clippingParents" ? "clippingAncestors" : this._config.boundary }) + ]; + if (arrowElement) middleware.push(arrow({ element: arrowElement })); + return middleware; + } + _getFloatingConfig(placement, middleware) { + const defaultConfig = { + placement, + middleware + }; + return { + ...defaultConfig, + ...execute(this._config.floatingConfig, [void 0, defaultConfig]) + }; + } + _setListeners() { + const triggers = this._config.trigger.split(" "); + for (const trigger of triggers) if (trigger === "click") EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$3), this._config.selector, (event) => { + const context = this._initializeOnDelegatedTarget(event); + context._activeTrigger[TRIGGER_CLICK] = !(context._isShown() && context._activeTrigger[TRIGGER_CLICK]); + context.toggle(); + }); + else if (trigger !== TRIGGER_MANUAL) { + const [eventIn, eventOut] = this._getTriggerEvents(trigger); + EventHandler.on(this._element, eventIn, this._config.selector, (event) => { + const context = this._initializeOnDelegatedTarget(event); + context._activeTrigger[event.type === "focusin" ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; + context._enter(); + }); + EventHandler.on(this._element, eventOut, this._config.selector, (event) => { + const context = this._initializeOnDelegatedTarget(event); + if (event.type === "focusout") context._activeTrigger[TRIGGER_FOCUS] = context._isInside(event.relatedTarget) || context._tipPointerDown; + else context._activeTrigger[TRIGGER_HOVER] = context._isInside(event.relatedTarget); + context._leave(); + }); + } + this._hideModalHandler = () => { + if (this._element) this.hide(); + }; + EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); + } + _setTipListeners(tip) { + const trigger = this._getTrigger(); + if (trigger === TRIGGER_MANUAL || trigger.includes(TRIGGER_CLICK)) return; + this._tipEventOut = (event) => { + this._activeTrigger[event.type === "focusout" ? TRIGGER_FOCUS : TRIGGER_HOVER] = this._isInside(event.relatedTarget); + this._leave(); + }; + for (const name of trigger.split(" ")) if (name === TRIGGER_HOVER || name === TRIGGER_FOCUS) { + const [, eventOut] = this._getTriggerEvents(name); + EventHandler.on(tip, eventOut, this._tipEventOut); + } + } + _removeTipListeners(tip) { + if (!this._tipEventOut) return; + const trigger = this._getTrigger(); + for (const name of trigger.split(" ")) if (name === TRIGGER_HOVER || name === TRIGGER_FOCUS) { + const [, eventOut] = this._getTriggerEvents(name); + EventHandler.off(tip, eventOut, this._tipEventOut); + } + this._tipEventOut = null; + } + _isInside(target) { + return target instanceof Node && (this._element.contains(target) || Boolean(this.tip?.contains(target))); + } + _getTrigger() { + return this._config._trigger; + } + _getTriggerEvents(trigger) { + return { + [TRIGGER_HOVER]: [this.constructor.eventName(EVENT_MOUSEENTER$1), this.constructor.eventName(EVENT_MOUSELEAVE)], + [TRIGGER_FOCUS]: [this.constructor.eventName(EVENT_FOCUSIN$2), this.constructor.eventName(EVENT_FOCUSOUT$1)] + }[trigger]; + } + _hasFocusTrigger() { + return this._getTrigger().split(" ").includes(TRIGGER_FOCUS); + } + _setFocusTipListeners(tip) { + if (!this._hasFocusTrigger()) return; + EventHandler.on(tip, this.constructor.eventName(EVENT_POINTERDOWN), () => { + this._tipPointerDown = true; + this._activeTrigger[TRIGGER_FOCUS] = true; + }); + EventHandler.on(tip, this.constructor.eventName(EVENT_FOCUSIN$2), () => { + this._activeTrigger[TRIGGER_FOCUS] = true; + }); + EventHandler.on(tip, this.constructor.eventName(EVENT_FOCUSOUT$1), (event) => { + this._activeTrigger[TRIGGER_FOCUS] = this._isInside(event.relatedTarget) || this._tipPointerDown; + this._leave(); + }); + } + _setFocusOutsideListener() { + if (this._outsidePointerHandler || !this._hasFocusTrigger()) return; + this._tipPointerUpHandler = () => { + this._tipPointerDown = false; + }; + this._outsidePointerHandler = (event) => { + if (!this._isShown() || this._isInside(event.target)) return; + this._activeTrigger[TRIGGER_FOCUS] = false; + this.hide(); + }; + const doc = this._element.ownerDocument; + doc.addEventListener(EVENT_POINTERUP, this._tipPointerUpHandler, true); + doc.addEventListener(EVENT_POINTERDOWN, this._outsidePointerHandler, true); + } + _removeFocusOutsideListener() { + const doc = this._element?.ownerDocument; + if (this._tipPointerUpHandler && doc) doc.removeEventListener(EVENT_POINTERUP, this._tipPointerUpHandler, true); + if (this._outsidePointerHandler && doc) doc.removeEventListener(EVENT_POINTERDOWN, this._outsidePointerHandler, true); + this._tipPointerUpHandler = null; + this._outsidePointerHandler = null; + this._tipPointerDown = false; + } + _setEscapeListener() { + if (this._keydownHandler) return; + this._keydownHandler = (event) => { + if (event.key !== ESCAPE_KEY || !this._isShown() || !this.tip.isConnected) return; + event.preventDefault(); + event.stopPropagation(); + this.hide(); + }; + this._element.ownerDocument.addEventListener(EVENT_KEYDOWN$1, this._keydownHandler, true); + } + _removeEscapeListener() { + if (!this._keydownHandler) return; + this._element.ownerDocument.removeEventListener(EVENT_KEYDOWN$1, this._keydownHandler, true); + this._keydownHandler = null; + } + _fixTitle() { + const title = this._element.getAttribute("title"); + if (!title) return; + if (!this._element.getAttribute("aria-label") && !this._element.textContent.trim()) this._element.setAttribute("aria-label", title); + this._element.setAttribute("data-bs-original-title", title); + this._element.removeAttribute("title"); + } + _enter() { + if (this._isShown() || this._isHovered) { + this._isHovered = true; + return Promise.resolve(); + } + this._isHovered = true; + return this._setTimeout(() => this._isHovered ? this.show() : void 0, this._config.delay.show); + } + _leave() { + if (this._isWithActiveTrigger()) return Promise.resolve(); + this._isHovered = false; + return this._setTimeout(() => this._isHovered ? void 0 : this.hide(), this._config.delay.hide); + } + _setTimeout(handler, timeout) { + this._clearTimeout(); + return new Promise((resolve) => { + this._resolveTimeout = resolve; + this._timeout = setTimeout(() => { + this._resolveTimeout = null; + resolve(handler()); + }, timeout); + }); + } + _clearTimeout() { + clearTimeout(this._timeout); + if (this._resolveTimeout) { + this._resolveTimeout(); + this._resolveTimeout = null; + } + } + _isWithActiveTrigger() { + return Object.values(this._activeTrigger).includes(true); + } + _getConfig(config) { + const dataAttributes = Manipulator.getDataAttributes(this._element); + for (const dataAttribute of Object.keys(dataAttributes)) if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) delete dataAttributes[dataAttribute]; + config = { + ...dataAttributes, + ...typeof config === "object" && config ? config : {} + }; + config = this._mergeConfigObj(config); + config = this._configAfterMerge(config); + this._typeCheckConfig(config); + return config; + } + _configAfterMerge(config) { + config.container = config.container === false ? document.body : getElement(config.container); + config._trigger = config._trigger || config.trigger; + if (typeof config.delay === "number") config.delay = { + show: config.delay, + hide: config.delay + }; + if (typeof config.title === "number" || typeof config.title === "boolean") config.title = config.title.toString(); + if (typeof config.content === "number" || typeof config.content === "boolean") config.content = config.content.toString(); + return config; + } + _getDelegateConfig() { + const config = {}; + for (const [key, value] of Object.entries(this._config)) if (this.constructor.Default[key] !== value) config[key] = value; + config.selector = false; + config.trigger = "manual"; + return config; + } + _disposeFloating() { + if (this._floatingCleanup) { + this._floatingCleanup(); + this._floatingCleanup = null; + } + if (this.tip) { + this._removeTipListeners(this.tip); + EventHandler.off(this.tip, this.constructor.EVENT_KEY); + this.tip.remove(); + this.tip = null; + } + } +}; +/** +* Data API implementation - auto-initialize tooltips +*/ +const initTooltip = (event) => { + const target = event.target.closest(SELECTOR_DATA_TOGGLE$3); + if (!target) return; + Tooltip.getOrCreateInstance(target); +}; +EventHandler.on(document, EVENT_FOCUSIN$2, SELECTOR_DATA_TOGGLE$3, initTooltip); +EventHandler.on(document, EVENT_MOUSEENTER$1, SELECTOR_DATA_TOGGLE$3, initTooltip); +//#endregion +//#region js/src/popover.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap popover.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$5 = "popover"; +const SELECTOR_TITLE = ".popover-header"; +const SELECTOR_CONTENT = ".popover-body"; +const SELECTOR_DATA_TOGGLE$2 = "[data-bs-toggle=\"popover\"]"; +const EVENT_CLICK$2 = "click"; +const EVENT_FOCUSIN$1 = "focusin"; +const EVENT_MOUSEENTER = "mouseenter"; +const Default$4 = { + ...Tooltip.Default, + content: "", + offset: [0, 8], + placement: "right", + template: "

", + trigger: "click" +}; +const DefaultType$4 = { + ...Tooltip.DefaultType, + content: "(null|string|element|function)" +}; +/** +* Class definition +*/ +var Popover = class extends Tooltip { + constructor(element, config) { + super(element, config); + } + static get Default() { + return Default$4; + } + static get DefaultType() { + return DefaultType$4; + } + static get NAME() { + return NAME$5; + } + _isWithContent() { + return Boolean(this._getTitle() || this._getContent()) || this._hasNewContent(); + } + _getContentForTemplate() { + return { + [SELECTOR_TITLE]: this._getTitle(), + [SELECTOR_CONTENT]: this._getContent() + }; + } + _getContent() { + return this._resolvePossibleFunction(this._config.content); + } +}; +/** +* Data API implementation - auto-initialize popovers +*/ +const initPopover = (event) => { + const target = event.target.closest(SELECTOR_DATA_TOGGLE$2); + if (!target) return; + if (event.type === "click") event.preventDefault(); + Popover.getOrCreateInstance(target); +}; +EventHandler.on(document, EVENT_CLICK$2, SELECTOR_DATA_TOGGLE$2, initPopover); +EventHandler.on(document, EVENT_FOCUSIN$1, SELECTOR_DATA_TOGGLE$2, initPopover); +EventHandler.on(document, EVENT_MOUSEENTER, SELECTOR_DATA_TOGGLE$2, initPopover); +//#endregion +//#region js/src/range.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap range.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$4 = "range"; +const EVENT_KEY$4 = `.bs.range`; +const DATA_API_KEY$1 = ".data-api"; +const EVENT_CHANGED = `changed${EVENT_KEY$4}`; +const EVENT_DOM_CONTENT_LOADED = `DOMContentLoaded${EVENT_KEY$4}${DATA_API_KEY$1}`; +const EVENT_INPUT = "input"; +const EVENT_CHANGE = "change"; +const SELECTOR_RANGE = ".form-range"; +const SELECTOR_INPUT = ".form-range-input"; +const CLASS_NAME_BUBBLE = "form-range-bubble"; +const CLASS_NAME_TICKS = "form-range-ticks"; +const CLASS_NAME_TICK = "form-range-tick"; +const CLASS_NAME_TICK_LABEL = "form-range-tick-label"; +const PROPERTY_FILL = "--bs-range-fill"; +const Default$3 = { + bubble: false, + formatter: null +}; +const DefaultType$3 = { + bubble: "(boolean|null)", + formatter: "(function|null)" +}; +/** +* Class definition +*/ +var Range = class extends BaseComponent { + constructor(element, config) { + super(element, config); + if (!this._element) return; + this._input = SelectorEngine.findOne(SELECTOR_INPUT, this._element); + if (!this._input) return; + this._bubble = null; + this._bubbleText = null; + this._ticks = null; + this._updateHandler = () => this._update(); + if (this._config.bubble) this._createBubble(); + this._createTicks(); + this._addEventListeners(); + this._update(); + } + static get Default() { + return Default$3; + } + static get DefaultType() { + return DefaultType$3; + } + static get NAME() { + return NAME$4; + } + update() { + this._update(); + } + dispose() { + EventHandler.off(this._input, EVENT_INPUT, this._updateHandler); + EventHandler.off(this._input, EVENT_CHANGE, this._updateHandler); + this._bubble?.remove(); + this._ticks?.remove(); + super.dispose(); + } + _configAfterMerge(config) { + if (config.bubble === null) config.bubble = true; + return config; + } + _addEventListeners() { + EventHandler.on(this._input, EVENT_INPUT, this._updateHandler); + EventHandler.on(this._input, EVENT_CHANGE, this._updateHandler); + } + _min() { + return this._input.min === "" ? 0 : Number.parseFloat(this._input.min); + } + _max() { + return this._input.max === "" ? 100 : Number.parseFloat(this._input.max); + } + _value() { + return Number.parseFloat(this._input.value); + } + _ratio() { + const span = this._max() - this._min(); + return span > 0 ? (this._value() - this._min()) / span : 0; + } + _update() { + this._element.style.setProperty(PROPERTY_FILL, `${this._ratio()}`); + if (this._bubbleText) this._bubbleText.textContent = this._format(this._value()); + EventHandler.trigger(this._input, EVENT_CHANGED, { value: this._value() }); + } + _format(value) { + return typeof this._config.formatter === "function" ? this._config.formatter(value) : String(value); + } + _createBubble() { + this._bubble = document.createElement("output"); + this._bubble.className = `${CLASS_NAME_BUBBLE} tooltip bs-tooltip-top show`; + this._bubble.setAttribute("aria-hidden", "true"); + const arrow = document.createElement("div"); + arrow.className = "tooltip-arrow"; + this._bubbleText = document.createElement("div"); + this._bubbleText.className = "tooltip-inner"; + this._bubble.append(arrow, this._bubbleText); + this._input.insertAdjacentElement("afterend", this._bubble); + } + _createTicks() { + const listId = this._input.getAttribute("list"); + const datalist = listId ? document.getElementById(listId) : null; + if (!datalist) return; + const min = this._min(); + const span = this._max() - min || 1; + const points = []; + for (const option of SelectorEngine.find("option", datalist)) { + const value = Number.parseFloat(option.value); + if (!Number.isNaN(value)) { + const ratio = Math.min(Math.max((value - min) / span, 0), 1); + points.push({ + ratio, + label: option.label + }); + } + } + if (points.length === 0) return; + points.sort((a, b) => a.ratio - b.ratio); + this._ticks = document.createElement("div"); + this._ticks.className = CLASS_NAME_TICKS; + this._ticks.setAttribute("aria-hidden", "true"); + const stops = [ + 0, + ...points.map((point) => point.ratio), + 1 + ]; + this._ticks.style.gridTemplateColumns = stops.slice(1).map((stop, index) => `${stop - stops[index]}fr`).join(" "); + for (const [index, point] of points.entries()) { + const tick = document.createElement("span"); + tick.className = CLASS_NAME_TICK; + tick.style.gridColumnStart = `${index + 2}`; + if (point.label) { + const label = document.createElement("span"); + label.className = CLASS_NAME_TICK_LABEL; + label.textContent = point.label; + tick.append(label); + } + this._ticks.append(tick); + } + this._element.append(this._ticks); + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_DOM_CONTENT_LOADED, () => { + for (const element of SelectorEngine.find(SELECTOR_RANGE)) Range.getOrCreateInstance(element); +}); +//#endregion +//#region js/src/scrollspy.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap scrollspy.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$3 = "scrollspy"; +const EVENT_KEY$3 = `.bs.scrollspy`; +const DATA_API_KEY = ".data-api"; +const EVENT_ACTIVATE = `activate${EVENT_KEY$3}`; +const EVENT_CLICK$1 = `click${EVENT_KEY$3}`; +const EVENT_SCROLL = `scroll${EVENT_KEY$3}`; +const EVENT_SCROLLEND = `scrollend${EVENT_KEY$3}`; +const EVENT_RESIZE = `resize${EVENT_KEY$3}`; +const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$3}${DATA_API_KEY}`; +const CLASS_NAME_MENU_ITEM = "menu-item"; +const CLASS_NAME_ACTIVE$1 = "active"; +const SELECTOR_DATA_SPY = "[data-bs-spy=\"scroll\"]"; +const SELECTOR_TARGET_LINKS = "[href]"; +const SELECTOR_NAV_LIST_GROUP = ".nav, .list-group"; +const SELECTOR_NAV_LINKS = ".nav-link"; +const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, .nav-item > ${SELECTOR_NAV_LINKS}, .list-group-item`; +const SELECTOR_MENU_TOGGLE$1 = "[data-bs-toggle=\"menu\"]"; +const SCROLL_IDLE_TIMEOUT = 100; +const RESIZE_DEBOUNCE = 100; +const Default$2 = { + rootMargin: null, + smoothScroll: false, + target: null, + threshold: [0], + topMargin: "12%" +}; +const DefaultType$2 = { + rootMargin: "(string|null)", + smoothScroll: "boolean", + target: "element", + threshold: "array", + topMargin: "string" +}; +/** +* Class definition +*/ +var ScrollSpy = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._sections = []; + this._linkBySection = /* @__PURE__ */ new Map(); + this._sectionByLink = /* @__PURE__ */ new Map(); + this._intersecting = /* @__PURE__ */ new Set(); + this._activeTarget = null; + this._lastActive = null; + this._atBottom = false; + this._rootElement = getComputedStyle(this._element).overflowY === "visible" ? null : this._element; + this._observer = null; + this._sentinel = null; + this._sentinelObserver = null; + this._pendingNavigation = null; + this._settleTimeout = null; + this._settleHandler = null; + this._scrollIdleHandler = null; + this._resizeHandler = null; + this._resizeTimeout = null; + this.refresh(); + } + static get Default() { + return Default$2; + } + static get DefaultType() { + return DefaultType$2; + } + static get NAME() { + return NAME$3; + } + refresh() { + this._initializeTargetsAndObservables(); + this._maybeEnableSmoothScroll(); + this._observer?.disconnect(); + this._intersecting.clear(); + this._observer = this._getNewObserver(); + for (const section of this._sections) this._observer.observe(section); + this._setUpSentinel(); + this._maybeAddResizeListener(); + } + dispose() { + this._observer?.disconnect(); + this._teardownSentinel(); + this._disarmSettle(); + this._removeResizeListener(); + EventHandler.off(this._config.target, EVENT_CLICK$1); + super.dispose(); + } + _configAfterMerge(config) { + config.target = getElement(config.target) || document.body; + if (typeof config.threshold === "string") config.threshold = config.threshold.split(",").map((value) => Number.parseFloat(value)); + return config; + } + _getNewObserver() { + const options = { + root: this._rootElement, + threshold: this._config.threshold, + rootMargin: this._config.rootMargin ?? this._getDerivedRootMargin() + }; + return new IntersectionObserver((entries) => this._onIntersect(entries), options); + } + _onIntersect(entries) { + for (const entry of entries) if (entry.isIntersecting) this._intersecting.add(entry.target); + else this._intersecting.delete(entry.target); + this._computeActive(); + } + _computeActive() { + if (!this._element?.isConnected || this._sections.length === 0) return; + let active = null; + if (this._atBottom) active = this._sections.at(-1); + else { + for (const section of this._sections) if (this._intersecting.has(section)) active = section; + active ||= this._lastActive ?? this._sections.at(0); + } + if (!active) return; + this._lastActive = active; + const link = this._linkBySection.get(active); + if (link) this._process(link); + } + _parseTopMargin() { + const value = String(this._config.topMargin); + return { + value: Number.parseFloat(value) || 0, + unit: value.endsWith("%") ? "%" : "px" + }; + } + _getDerivedRootMargin() { + const { value, unit } = this._parseTopMargin(); + let percent = value; + if (unit === "px") { + const rootHeight = this._rootElement ? this._rootElement.clientHeight : document.documentElement.clientHeight || window.innerHeight; + percent = rootHeight ? value / rootHeight * 100 : 12; + } + return `0px 0px -${Math.min(Math.max(100 - percent, 0), 100)}% 0px`; + } + _usesPixelMargin() { + return !this._config.rootMargin && this._parseTopMargin().unit === "px"; + } + _setUpSentinel() { + this._teardownSentinel(); + if (this._sections.length === 0) return; + const sentinel = document.createElement("div"); + sentinel.setAttribute("aria-hidden", "true"); + sentinel.style.cssText = "position:relative;width:0;height:0;margin:0;padding:0;border:0;visibility:hidden;"; + this._element.append(sentinel); + this._sentinel = sentinel; + this._sentinelObserver = new IntersectionObserver((entries) => this._onSentinel(entries), { + root: this._rootElement, + threshold: [0] + }); + this._sentinelObserver.observe(sentinel); + } + _onSentinel(entries) { + const entry = entries.at(-1); + this._atBottom = Boolean(entry?.isIntersecting) && this._isOverflowing(); + this._computeActive(); + } + _isOverflowing() { + const scroller = this._rootElement || document.scrollingElement || document.documentElement; + return scroller.scrollHeight > scroller.clientHeight; + } + _teardownSentinel() { + this._sentinelObserver?.disconnect(); + this._sentinelObserver = null; + this._sentinel?.remove(); + this._sentinel = null; + this._atBottom = false; + } + _maybeAddResizeListener() { + this._removeResizeListener(); + if (!this._usesPixelMargin()) return; + this._resizeHandler = () => { + clearTimeout(this._resizeTimeout); + this._resizeTimeout = setTimeout(() => this._rebuildObserver(), RESIZE_DEBOUNCE); + }; + EventHandler.on(window, EVENT_RESIZE, this._resizeHandler); + } + _removeResizeListener() { + clearTimeout(this._resizeTimeout); + this._resizeTimeout = null; + if (this._resizeHandler) { + EventHandler.off(window, EVENT_RESIZE, this._resizeHandler); + this._resizeHandler = null; + } + } + _rebuildObserver() { + if (!this._observer) return; + this._observer.disconnect(); + this._intersecting.clear(); + this._observer = this._getNewObserver(); + for (const section of this._sections) this._observer.observe(section); + } + _maybeEnableSmoothScroll() { + if (!this._config.smoothScroll) return; + EventHandler.off(this._config.target, EVENT_CLICK$1); + EventHandler.on(this._config.target, EVENT_CLICK$1, SELECTOR_TARGET_LINKS, (event) => { + const link = event.target.closest(SELECTOR_TARGET_LINKS); + const section = link && this._sectionByLink.get(link); + if (!section || !this._element) return; + event.preventDefault(); + const root = this._rootElement || window; + const height = section.offsetTop - this._element.offsetTop; + const currentTop = this._rootElement ? this._rootElement.scrollTop : window.scrollY ?? window.pageYOffset; + if (matchMedia("(prefers-reduced-motion: reduce)").matches || Math.abs(currentTop - height) <= 2) { + if (root.scrollTo) root.scrollTo({ + top: height, + behavior: "auto" + }); + else root.scrollTop = height; + this._settleNavigation(link.hash, section); + return; + } + this._pendingNavigation = { + hash: link.hash, + section + }; + this._armSettle(); + if (root.scrollTo) root.scrollTo({ + top: height, + behavior: "smooth" + }); + else root.scrollTop = height; + }); + } + _armSettle() { + this._disarmSettle(); + const target = this._getSettleTarget(); + this._settleHandler = () => this._onSettle(); + this._scrollIdleHandler = () => { + clearTimeout(this._settleTimeout); + this._settleTimeout = setTimeout(() => this._onSettle(), SCROLL_IDLE_TIMEOUT); + }; + EventHandler.on(target, EVENT_SCROLLEND, this._settleHandler); + EventHandler.on(target, EVENT_SCROLL, this._scrollIdleHandler); + } + _disarmSettle() { + clearTimeout(this._settleTimeout); + this._settleTimeout = null; + const target = this._getSettleTarget(); + if (this._settleHandler) { + EventHandler.off(target, EVENT_SCROLLEND, this._settleHandler); + this._settleHandler = null; + } + if (this._scrollIdleHandler) { + EventHandler.off(target, EVENT_SCROLL, this._scrollIdleHandler); + this._scrollIdleHandler = null; + } + } + _getSettleTarget() { + return this._rootElement || document; + } + _onSettle() { + this._disarmSettle(); + if (!this._pendingNavigation) return; + const { hash, section } = this._pendingNavigation; + this._settleNavigation(hash, section); + } + _settleNavigation(hash, section) { + this._pendingNavigation = null; + if (window.history?.replaceState) window.history.replaceState(null, "", hash); + if (!section.hasAttribute("tabindex")) section.setAttribute("tabindex", "-1"); + section.focus({ preventScroll: true }); + } + _initializeTargetsAndObservables() { + this._sections = []; + this._linkBySection = /* @__PURE__ */ new Map(); + this._sectionByLink = /* @__PURE__ */ new Map(); + const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target); + const seen = /* @__PURE__ */ new Set(); + for (const anchor of targetLinks) { + if (!anchor.hash || isDisabled(anchor)) continue; + const id = decodeFragment(anchor.hash.slice(1)); + if (!id) continue; + const section = document.getElementById(id); + if (!section || !this._element.contains(section) || !isVisible(section)) continue; + this._sectionByLink.set(anchor, section); + this._linkBySection.set(section, anchor); + if (!seen.has(section)) { + seen.add(section); + this._sections.push(section); + } + } + this._sections.sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top); + } + _process(target) { + if (this._activeTarget === target) return; + this._clearActiveClass(this._config.target); + this._activeTarget = target; + target.classList.add(CLASS_NAME_ACTIVE$1); + this._activateParents(target); + EventHandler.trigger(this._element, EVENT_ACTIVATE, { relatedTarget: target }); + } + _activateParents(target) { + if (target.classList.contains(CLASS_NAME_MENU_ITEM)) { + const menuToggle = target.closest(".menu")?.previousElementSibling; + if (menuToggle?.matches(SELECTOR_MENU_TOGGLE$1)) menuToggle.classList.add(CLASS_NAME_ACTIVE$1); + return; + } + for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) item.classList.add(CLASS_NAME_ACTIVE$1); + } + _clearActiveClass(parent) { + parent.classList.remove(CLASS_NAME_ACTIVE$1); + const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent); + for (const node of activeNodes) node.classList.remove(CLASS_NAME_ACTIVE$1); + } +}; +function decodeFragment(hash) { + try { + return decodeURIComponent(hash); + } catch { + return hash; + } +} +/** +* Data API implementation +*/ +EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => { + for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) ScrollSpy.getOrCreateInstance(spy); +}); +//#endregion +//#region js/src/tab.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap tab.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$2 = "tab"; +const EVENT_KEY$2 = `.bs.tab`; +const EVENT_HIDE$1 = `hide${EVENT_KEY$2}`; +const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$2}`; +const EVENT_SHOW$1 = `show${EVENT_KEY$2}`; +const EVENT_SHOWN$1 = `shown${EVENT_KEY$2}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY$2}`; +const EVENT_KEYDOWN = `keydown${EVENT_KEY$2}`; +const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}`; +const ARROW_LEFT_KEY = "ArrowLeft"; +const ARROW_RIGHT_KEY = "ArrowRight"; +const ARROW_UP_KEY = "ArrowUp"; +const ARROW_DOWN_KEY = "ArrowDown"; +const HOME_KEY = "Home"; +const END_KEY = "End"; +const CLASS_NAME_ACTIVE = "active"; +const CLASS_NAME_SHOW$1 = "show"; +const SELECTOR_MENU_TOGGLE = "[data-bs-toggle=\"menu\"]"; +const SELECTOR_MENU = ".menu"; +const NOT_SELECTOR_MENU_TOGGLE = `:not(${SELECTOR_MENU_TOGGLE})`; +const SELECTOR_TAB_PANEL = ".list-group, .nav, [role=\"tablist\"]"; +const SELECTOR_OUTER = ".nav-item, .list-group-item"; +const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_MENU_TOGGLE}, .list-group-item${NOT_SELECTOR_MENU_TOGGLE}, [role="tab"]${NOT_SELECTOR_MENU_TOGGLE}`; +const SELECTOR_DATA_TOGGLE$1 = "[data-bs-toggle=\"tab\"]"; +const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE$1}`; +const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"]`; +const activationIds = /* @__PURE__ */ new WeakMap(); +/** +* Class definition +*/ +var Tab = class Tab extends BaseComponent { + constructor(element) { + super(element); + this._parent = this._element.closest(SELECTOR_TAB_PANEL); + if (!this._parent) throw new TypeError(`${this._element.outerHTML} has no valid parent ${SELECTOR_TAB_PANEL}`); + this._setInitialAttributes(this._parent, this._getChildren()); + EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event)); + } + static get NAME() { + return NAME$2; + } + async show() { + const innerElem = this._element; + if (this._elemIsActive(innerElem)) return; + const active = this._getActiveElem(); + const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, { relatedTarget: innerElem }) : null; + if (EventHandler.trigger(innerElem, EVENT_SHOW$1, { relatedTarget: active }).defaultPrevented || hideEvent && hideEvent.defaultPrevented) return; + const activationId = (activationIds.get(this._parent) || 0) + 1; + activationIds.set(this._parent, activationId); + this._deactivate(active, innerElem); + await this._activate(innerElem, active, activationId); + } + async _activate(element, relatedElem, activationId) { + if (!element) return; + element.classList.add(CLASS_NAME_ACTIVE); + if (element.getAttribute("role") !== "tab") { + element.classList.add(CLASS_NAME_SHOW$1); + return; + } + const pane = SelectorEngine.getElementFromSelector(element); + this._activate(pane); + const complete = () => { + if (activationId !== activationIds.get(this._parent) || !this._elemIsActive(element)) return; + element.removeAttribute("tabindex"); + setAriaAttribute(element, "aria-selected", true); + this._toggleMenu(element, true); + EventHandler.trigger(element, EVENT_SHOWN$1, { relatedTarget: relatedElem }); + }; + await this._queueCallback(complete, pane ?? element, getTransitionDurationFromElement(pane) > 0); + } + async _deactivate(element, relatedElem) { + if (!element) return; + element.classList.remove(CLASS_NAME_ACTIVE); + element.blur(); + if (element.getAttribute("role") !== "tab") { + element.classList.remove(CLASS_NAME_SHOW$1); + return; + } + this._deactivate(SelectorEngine.getElementFromSelector(element)); + const complete = () => { + setAriaAttribute(element, "aria-selected", false); + element.setAttribute("tabindex", "-1"); + this._toggleMenu(element, false); + EventHandler.trigger(element, EVENT_HIDDEN$1, { relatedTarget: relatedElem }); + }; + await this._queueCallback(complete, element, false); + } + _keydown(event) { + if (![ + ARROW_LEFT_KEY, + ARROW_RIGHT_KEY, + ARROW_UP_KEY, + ARROW_DOWN_KEY, + HOME_KEY, + END_KEY + ].includes(event.key)) return; + if (event.altKey || event.ctrlKey || event.metaKey) return; + event.stopPropagation(); + event.preventDefault(); + const children = this._getChildren().filter((element) => !isDisabled(element)); + let nextActiveElement; + if ([HOME_KEY, END_KEY].includes(event.key)) nextActiveElement = event.key === HOME_KEY ? children[0] : children.at(-1); + else { + const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); + nextActiveElement = getNextActiveElement(children, event.target, isNext, true); + } + if (nextActiveElement) { + nextActiveElement.focus({ preventScroll: true }); + Tab.getOrCreateInstance(nextActiveElement).show(); + } + } + _getChildren() { + return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent); + } + _getActiveElem() { + return this._getChildren().find((child) => this._elemIsActive(child)) || null; + } + _setInitialAttributes(parent, children) { + this._setAttributeIfNotExists(parent, "role", "tablist"); + for (const child of children) this._setInitialAttributesOnChild(child); + } + _setInitialAttributesOnChild(child) { + child = this._getInnerElement(child); + const isActive = this._elemIsActive(child); + const outerElem = this._getOuterElement(child); + setAriaAttribute(child, "aria-selected", isActive); + if (outerElem !== child) this._setAttributeIfNotExists(outerElem, "role", "presentation"); + if (!isActive) child.setAttribute("tabindex", "-1"); + this._setAttributeIfNotExists(child, "role", "tab"); + this._setInitialAttributesOnTargetPanel(child); + } + _setInitialAttributesOnTargetPanel(child) { + const target = SelectorEngine.getElementFromSelector(child); + if (!target) return; + this._setAttributeIfNotExists(target, "role", "tabpanel"); + if (child.id) this._setAttributeIfNotExists(target, "aria-labelledby", `${child.id}`); + } + _toggleMenu(element, open) { + const outerElem = this._getOuterElement(element); + const menuToggle = SelectorEngine.findOne(SELECTOR_MENU_TOGGLE, outerElem); + if (!menuToggle) return; + const menu = SelectorEngine.findOne(SELECTOR_MENU, outerElem); + menuToggle.classList.toggle(CLASS_NAME_ACTIVE, open); + if (menu) menu.classList.toggle(CLASS_NAME_SHOW$1, open); + setAriaAttribute(menuToggle, "aria-expanded", open); + } + _setAttributeIfNotExists(element, attribute, value) { + if (!element.hasAttribute(attribute)) element.setAttribute(attribute, value); + } + _elemIsActive(elem) { + return elem.classList.contains(CLASS_NAME_ACTIVE); + } + _getInnerElement(elem) { + return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem); + } + _getOuterElement(elem) { + return elem.closest(SELECTOR_OUTER) || elem; + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE$1, function(event) { + if (["A", "AREA"].includes(this.tagName)) event.preventDefault(); + if (isDisabled(this)) return; + Tab.getOrCreateInstance(this).show(); +}); +/** +* Initialize on focus +*/ +EventHandler.on(window, EVENT_LOAD_DATA_API, () => { + for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) Tab.getOrCreateInstance(element); +}); +//#endregion +//#region js/src/toast.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap toast.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$1 = "toast"; +const EVENT_KEY$1 = `.bs.toast`; +const EVENT_MOUSEOVER = `mouseover${EVENT_KEY$1}`; +const EVENT_MOUSEOUT = `mouseout${EVENT_KEY$1}`; +const EVENT_FOCUSIN = `focusin${EVENT_KEY$1}`; +const EVENT_FOCUSOUT = `focusout${EVENT_KEY$1}`; +const EVENT_HIDE = `hide${EVENT_KEY$1}`; +const EVENT_HIDDEN = `hidden${EVENT_KEY$1}`; +const EVENT_SHOW = `show${EVENT_KEY$1}`; +const EVENT_SHOWN = `shown${EVENT_KEY$1}`; +const CLASS_NAME_INSTANT = "toast-instant"; +const CLASS_NAME_SHOW = "show"; +const DefaultType$1 = { + autohide: "boolean", + delay: "number" +}; +const Default$1 = { + autohide: true, + delay: 5e3 +}; +/** +* Class definition +*/ +var Toast = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._timeout = null; + this._hasMouseInteraction = false; + this._hasKeyboardInteraction = false; + this._setListeners(); + } + static get Default() { + return Default$1; + } + static get DefaultType() { + return DefaultType$1; + } + static get NAME() { + return NAME$1; + } + async show() { + if (EventHandler.trigger(this._element, EVENT_SHOW).defaultPrevented) return; + this._clearTimeout(); + const complete = () => { + EventHandler.trigger(this._element, EVENT_SHOWN); + this._maybeScheduleHide(); + }; + this._element.classList.add(CLASS_NAME_SHOW); + await this._queueCallback(complete, this._element, this._isAnimated()); + } + async hide() { + if (!this.isShown()) return; + if (EventHandler.trigger(this._element, EVENT_HIDE).defaultPrevented) return; + const complete = () => { + EventHandler.trigger(this._element, EVENT_HIDDEN); + }; + this._element.classList.remove(CLASS_NAME_SHOW); + await this._queueCallback(complete, this._element, this._isAnimated()); + } + dispose() { + this._clearTimeout(); + if (this.isShown()) this._element.classList.remove(CLASS_NAME_SHOW); + super.dispose(); + } + isShown() { + return this._element.classList.contains(CLASS_NAME_SHOW); + } + _isAnimated() { + return !this._element.classList.contains(CLASS_NAME_INSTANT); + } + _maybeScheduleHide() { + if (!this._config.autohide) return; + if (this._hasMouseInteraction || this._hasKeyboardInteraction) return; + this._timeout = setTimeout(() => { + this.hide(); + }, this._config.delay); + } + _onInteraction(event, isInteracting) { + switch (event.type) { + case "mouseover": + case "mouseout": + this._hasMouseInteraction = isInteracting; + break; + case "focusin": + case "focusout": + this._hasKeyboardInteraction = isInteracting; + break; + default: break; + } + if (isInteracting) { + this._clearTimeout(); + return; + } + const nextElement = event.relatedTarget; + if (this._element === nextElement || this._element.contains(nextElement)) return; + this._maybeScheduleHide(); + } + _setListeners() { + EventHandler.on(this._element, EVENT_MOUSEOVER, (event) => this._onInteraction(event, true)); + EventHandler.on(this._element, EVENT_MOUSEOUT, (event) => this._onInteraction(event, false)); + EventHandler.on(this._element, EVENT_FOCUSIN, (event) => this._onInteraction(event, true)); + EventHandler.on(this._element, EVENT_FOCUSOUT, (event) => this._onInteraction(event, false)); + } + _clearTimeout() { + clearTimeout(this._timeout); + this._timeout = null; + } +}; +/** +* Data API implementation +*/ +enableDismissTrigger(Toast); +//#endregion +//#region js/src/toggler.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap toggler.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME = "toggler"; +const EVENT_KEY = `.bs.toggler`; +const EVENT_TOGGLE = `toggle${EVENT_KEY}`; +const EVENT_TOGGLED = `toggled${EVENT_KEY}`; +const EVENT_CLICK = "click"; +const SELECTOR_DATA_TOGGLE = "[data-bs-toggle=\"toggler\"]"; +const DefaultType = { + attribute: "string", + value: "(string|number|boolean|null)" +}; +const Default = { + attribute: "class", + value: null +}; +/** +* Class definition +*/ +var Toggler = class extends BaseComponent { + static get Default() { + return Default; + } + static get DefaultType() { + return DefaultType; + } + static get NAME() { + return NAME; + } + toggle() { + if (EventHandler.trigger(this._element, EVENT_TOGGLE).defaultPrevented) return; + this._execute(); + EventHandler.trigger(this._element, EVENT_TOGGLED); + } + _execute() { + const { attribute, value } = this._config; + if (attribute === "id") return; + if (value === null || value === void 0) return; + if (attribute === "class") { + this._element.classList.toggle(value); + return; + } + if (this._element.getAttribute(attribute) === String(value)) { + this._element.removeAttribute(attribute); + return; + } + this._element.setAttribute(attribute, value); + } +}; +/** +* Data API implementation +*/ +eventActionOnPlugin(Toggler, EVENT_CLICK, SELECTOR_DATA_TOGGLE, "toggle"); +//#endregion +export { Alert, Button, Carousel, Chips, Collapse, Combobox, Datepicker, Dialog, Drawer, Menu, NavOverflow, OtpInput, Popover, Range, ScrollSpy, Strength, Tab, Toast, Toggler, Tooltip }; + +//# sourceMappingURL=bootstrap.bundle.js.map \ No newline at end of file diff --git a/dist/js/bootstrap.bundle.js.map b/dist/js/bootstrap.bundle.js.map index 13f19f66aa..c7d4db7d9e 100644 --- a/dist/js/bootstrap.bundle.js.map +++ b/dist/js/bootstrap.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"bootstrap.bundle.js","sources":["../../js/src/dom/data.js","../../js/src/util/index.js","../../js/src/dom/event-handler.js","../../js/src/dom/manipulator.js","../../js/src/util/config.js","../../js/src/base-component.js","../../js/src/dom/selector-engine.js","../../js/src/util/component-functions.js","../../js/src/alert.js","../../js/src/button.js","../../js/src/util/swipe.js","../../js/src/carousel.js","../../js/src/collapse.js","../../node_modules/@popperjs/core/lib/enums.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../node_modules/@popperjs/core/lib/utils/math.js","../../node_modules/@popperjs/core/lib/utils/userAgent.js","../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../node_modules/@popperjs/core/lib/utils/within.js","../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../node_modules/@popperjs/core/lib/utils/debounce.js","../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../node_modules/@popperjs/core/lib/createPopper.js","../../node_modules/@popperjs/core/lib/popper.js","../../js/src/dropdown.js","../../js/src/util/backdrop.js","../../js/src/util/focustrap.js","../../js/src/util/scrollbar.js","../../js/src/modal.js","../../js/src/offcanvas.js","../../js/src/util/sanitizer.js","../../js/src/util/template-factory.js","../../js/src/tooltip.js","../../js/src/popover.js","../../js/src/scrollspy.js","../../js/src/tab.js","../../js/src/toast.js","../../js/index.umd.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * Constants\n */\n\nconst elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n","/**\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 escapes ID selectors to handle special characters in IDs\n * (e.g. forward slashes, periods) so that they work with `document.querySelector`.\n *\n * @param {string} selector the selector to escape\n * @returns {string} the escaped selector\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 falsely 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 by forcing a reflow.\n *\n * @param {HTMLElement} element the element whose animation should be restarted\n * @returns {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 {Element[]} list the list of elements to traverse\n * @param {Element} activeElement the currently active element\n * @param {boolean} shouldGetNext whether to return the next element (`true`) or the previous one (`false`)\n * @param {boolean} isCycleAllowed whether to cycle back to the opposite end of the list when reaching the boundary\n * @returns {Element} the appropriate previous/next element from the list\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","/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/event-handler.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { getjQuery } from '../util/index.js'\n\n/**\n * Constants\n */\n\nconst namespaceRegex = /[^.]*(?=\\..*)\\.|.*/\nconst stripNameRegex = /\\..*/\nconst stripUidRegex = /::\\d+$/\nconst eventRegistry = {} // Events storage\nlet uidEvent = 1\nconst customEvents = {\n mouseenter: 'mouseover',\n mouseleave: 'mouseout'\n}\n\nconst nativeEvents = new Set([\n 'click',\n 'dblclick',\n 'mouseup',\n 'mousedown',\n 'contextmenu',\n 'mousewheel',\n 'DOMMouseScroll',\n 'mouseover',\n 'mouseout',\n 'mousemove',\n 'selectstart',\n 'selectend',\n 'keydown',\n 'keypress',\n 'keyup',\n 'orientationchange',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'touchcancel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointerleave',\n 'pointercancel',\n 'gesturestart',\n 'gesturechange',\n 'gestureend',\n 'focus',\n 'blur',\n 'change',\n 'reset',\n 'select',\n 'submit',\n 'focusin',\n 'focusout',\n 'load',\n 'unload',\n 'beforeunload',\n 'resize',\n 'move',\n 'DOMContentLoaded',\n 'readystatechange',\n 'error',\n 'abort',\n 'scroll'\n])\n\n/**\n * Private methods\n */\n\nfunction makeEventUid(element, uid) {\n return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++\n}\n\nfunction getElementEvents(element) {\n const uid = makeEventUid(element)\n\n element.uidEvent = uid\n eventRegistry[uid] = eventRegistry[uid] || {}\n\n return eventRegistry[uid]\n}\n\nfunction bootstrapHandler(element, fn) {\n return function handler(event) {\n hydrateObj(event, { delegateTarget: element })\n\n if (handler.oneOff) {\n EventHandler.off(element, event.type, fn)\n }\n\n return fn.apply(element, [event])\n }\n}\n\nfunction bootstrapDelegationHandler(element, selector, fn) {\n return function handler(event) {\n const domElements = element.querySelectorAll(selector)\n\n for (let { target } = event; target && target !== this; target = target.parentNode) {\n for (const domElement of domElements) {\n if (domElement !== target) {\n continue\n }\n\n hydrateObj(event, { delegateTarget: target })\n\n if (handler.oneOff) {\n EventHandler.off(element, event.type, selector, fn)\n }\n\n return fn.apply(target, [event])\n }\n }\n }\n}\n\nfunction findHandler(events, callable, delegationSelector = null) {\n return Object.values(events)\n .find(event => event.callable === callable && event.delegationSelector === delegationSelector)\n}\n\nfunction normalizeParameters(originalTypeEvent, handler, delegationFunction) {\n const isDelegated = typeof handler === 'string'\n // TODO: tooltip passes `false` instead of selector, so we need to check\n const callable = isDelegated ? delegationFunction : (handler || delegationFunction)\n let typeEvent = getTypeEvent(originalTypeEvent)\n\n if (!nativeEvents.has(typeEvent)) {\n typeEvent = originalTypeEvent\n }\n\n return [isDelegated, callable, typeEvent]\n}\n\nfunction addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {\n if (typeof originalTypeEvent !== 'string' || !element) {\n return\n }\n\n let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction)\n\n // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position\n // this prevents the handler from being dispatched the same way as mouseover or mouseout does\n if (originalTypeEvent in customEvents) {\n const wrapFunction = fn => {\n return function (event) {\n if (!event.relatedTarget || (event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget))) {\n return fn.call(this, event)\n }\n }\n }\n\n callable = wrapFunction(callable)\n }\n\n const events = getElementEvents(element)\n const handlers = events[typeEvent] || (events[typeEvent] = {})\n const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null)\n\n if (previousFunction) {\n previousFunction.oneOff = previousFunction.oneOff && oneOff\n\n return\n }\n\n const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''))\n const fn = isDelegated ?\n bootstrapDelegationHandler(element, handler, callable) :\n bootstrapHandler(element, callable)\n\n fn.delegationSelector = isDelegated ? handler : null\n fn.callable = callable\n fn.oneOff = oneOff\n fn.uidEvent = uid\n handlers[uid] = fn\n\n element.addEventListener(typeEvent, fn, isDelegated)\n}\n\nfunction removeHandler(element, events, typeEvent, handler, delegationSelector) {\n const fn = findHandler(events[typeEvent], handler, delegationSelector)\n\n if (!fn) {\n return\n }\n\n element.removeEventListener(typeEvent, fn, Boolean(delegationSelector))\n delete events[typeEvent][fn.uidEvent]\n}\n\nfunction removeNamespacedHandlers(element, events, typeEvent, namespace) {\n const storeElementEvent = events[typeEvent] || {}\n\n for (const [handlerKey, event] of Object.entries(storeElementEvent)) {\n if (handlerKey.includes(namespace)) {\n removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)\n }\n }\n}\n\nfunction getTypeEvent(event) {\n // allow to get the native events from namespaced events ('click.bs.button' --> 'click')\n event = event.replace(stripNameRegex, '')\n return customEvents[event] || event\n}\n\nconst EventHandler = {\n on(element, event, handler, delegationFunction) {\n addHandler(element, event, handler, delegationFunction, false)\n },\n\n one(element, event, handler, delegationFunction) {\n addHandler(element, event, handler, delegationFunction, true)\n },\n\n off(element, originalTypeEvent, handler, delegationFunction) {\n if (typeof originalTypeEvent !== 'string' || !element) {\n return\n }\n\n const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction)\n const inNamespace = typeEvent !== originalTypeEvent\n const events = getElementEvents(element)\n const storeElementEvent = events[typeEvent] || {}\n const isNamespace = originalTypeEvent.startsWith('.')\n\n if (typeof callable !== 'undefined') {\n // Simplest case: handler is passed, remove that listener ONLY.\n if (!Object.keys(storeElementEvent).length) {\n return\n }\n\n removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null)\n return\n }\n\n if (isNamespace) {\n for (const elementEvent of Object.keys(events)) {\n removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1))\n }\n }\n\n for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {\n const handlerKey = keyHandlers.replace(stripUidRegex, '')\n\n if (!inNamespace || originalTypeEvent.includes(handlerKey)) {\n removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)\n }\n }\n },\n\n trigger(element, event, args) {\n if (typeof event !== 'string' || !element) {\n return null\n }\n\n const $ = getjQuery()\n const typeEvent = getTypeEvent(event)\n const inNamespace = event !== typeEvent\n\n let jQueryEvent = null\n let bubbles = true\n let nativeDispatch = true\n let defaultPrevented = false\n\n if (inNamespace && $) {\n jQueryEvent = $.Event(event, args)\n\n $(element).trigger(jQueryEvent)\n bubbles = !jQueryEvent.isPropagationStopped()\n nativeDispatch = !jQueryEvent.isImmediatePropagationStopped()\n defaultPrevented = jQueryEvent.isDefaultPrevented()\n }\n\n const evt = hydrateObj(new Event(event, { bubbles, cancelable: true }), args)\n\n if (defaultPrevented) {\n evt.preventDefault()\n }\n\n if (nativeDispatch) {\n element.dispatchEvent(evt)\n }\n\n if (evt.defaultPrevented && jQueryEvent) {\n jQueryEvent.preventDefault()\n }\n\n return evt\n }\n}\n\nfunction hydrateObj(obj, meta = {}) {\n for (const [key, value] of Object.entries(meta)) {\n try {\n obj[key] = value\n } catch {\n Object.defineProperty(obj, key, {\n configurable: true,\n get() {\n return value\n }\n })\n }\n }\n\n return obj\n}\n\nexport default EventHandler\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(value) {\n if (value === 'true') {\n return true\n }\n\n if (value === 'false') {\n return false\n }\n\n if (value === Number(value).toString()) {\n return Number(value)\n }\n\n if (value === '' || value === 'null') {\n return null\n }\n\n if (typeof value !== 'string') {\n return value\n }\n\n try {\n return JSON.parse(decodeURIComponent(value))\n } catch {\n return value\n }\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'))\n\n for (const key of bsKeys) {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1)\n attributes[pureKey] = normalizeData(element.dataset[key])\n }\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n }\n}\n\nexport default Manipulator\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap util/config.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Manipulator from '../dom/manipulator.js'\nimport { isElement, toType } from './index.js'\n\n/**\n * Class definition\n */\n\nclass Config {\n // Getters\n static get Default() {\n return {}\n }\n\n static get DefaultType() {\n return {}\n }\n\n static get NAME() {\n throw new Error('You have to implement the static method \"NAME\", for each component!')\n }\n\n _getConfig(config) {\n config = this._mergeConfigObj(config)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n _configAfterMerge(config) {\n return config\n }\n\n _mergeConfigObj(config, element) {\n const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {} // try to parse\n\n return {\n ...this.constructor.Default,\n ...(typeof jsonConfig === 'object' ? jsonConfig : {}),\n ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),\n ...(typeof config === 'object' ? config : {})\n }\n }\n\n _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {\n for (const [property, expectedTypes] of Object.entries(configTypes)) {\n const value = config[property]\n const valueType = isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new TypeError(\n `${this.constructor.NAME.toUpperCase()}: Option \"${property}\" provided type \"${valueType}\" but expected type \"${expectedTypes}\".`\n )\n }\n }\n }\n}\n\nexport default Config\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data.js'\nimport EventHandler from './dom/event-handler.js'\nimport Config from './util/config.js'\nimport { executeAfterTransition, getElement } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst VERSION = '5.3.9'\n\n/**\n * Class definition\n */\n\nclass BaseComponent extends Config {\n constructor(element, config) {\n super()\n\n element = getElement(element)\n if (!element) {\n return\n }\n\n this._element = element\n this._config = this._getConfig(config)\n\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n // Public\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n EventHandler.off(this._element, this.constructor.EVENT_KEY)\n\n for (const propertyName of Object.getOwnPropertyNames(this)) {\n this[propertyName] = null\n }\n }\n\n // Private\n _queueCallback(callback, element, isAnimated = true) {\n executeAfterTransition(callback, element, isAnimated)\n }\n\n _getConfig(config) {\n config = this._mergeConfigObj(config, this._element)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n // Static\n static getInstance(element) {\n return Data.get(getElement(element), this.DATA_KEY)\n }\n\n static getOrCreateInstance(element, config = {}) {\n return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)\n }\n\n static get VERSION() {\n return VERSION\n }\n\n static get DATA_KEY() {\n return `bs.${this.NAME}`\n }\n\n static get EVENT_KEY() {\n return `.${this.DATA_KEY}`\n }\n\n static eventName(name) {\n return `${name}${this.EVENT_KEY}`\n }\n}\n\nexport default BaseComponent\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { isDisabled, isVisible, parseSelector } from '../util/index.js'\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-bs-target')\n\n if (!selector || selector === '#') {\n let hrefAttribute = element.getAttribute('href')\n\n // The only valid content that could double as a selector are IDs or classes,\n // so everything starting with `#` or `.`. If a \"real\" URL is used as the selector,\n // `document.querySelector` will rightfully complain it is invalid.\n // See https://github.com/twbs/bootstrap/issues/32273\n if (!hrefAttribute || (!hrefAttribute.includes('#') && !hrefAttribute.startsWith('.'))) {\n return null\n }\n\n // Just in case some CMS puts out a full URL with the anchor appended\n if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {\n hrefAttribute = `#${hrefAttribute.split('#')[1]}`\n }\n\n selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null\n }\n\n return selector ? selector.split(',').map(sel => parseSelector(sel)).join(',') : null\n}\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children).filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n let ancestor = element.parentNode.closest(selector)\n\n while (ancestor) {\n parents.push(ancestor)\n ancestor = ancestor.parentNode.closest(selector)\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n // TODO: this is now unused; remove later along with prev()\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n },\n\n focusableChildren(element) {\n const focusables = [\n 'a',\n 'button',\n 'input',\n 'textarea',\n 'select',\n 'details',\n '[tabindex]',\n '[contenteditable=\"true\"]'\n ].map(selector => `${selector}:not([tabindex^=\"-\"])`).join(',')\n\n return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el))\n },\n\n getSelectorFromElement(element) {\n const selector = getSelector(element)\n\n if (selector) {\n return SelectorEngine.findOne(selector) ? selector : null\n }\n\n return null\n },\n\n getElementFromSelector(element) {\n const selector = getSelector(element)\n\n return selector ? SelectorEngine.findOne(selector) : null\n },\n\n getMultipleElementsFromSelector(element) {\n const selector = getSelector(element)\n\n return selector ? SelectorEngine.find(selector) : []\n }\n}\n\nexport default SelectorEngine\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap util/component-functions.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport SelectorEngine from '../dom/selector-engine.js'\nimport { isDisabled } from './index.js'\n\nconst enableDismissTrigger = (component, method = 'hide') => {\n const clickEvent = `click.dismiss${component.EVENT_KEY}`\n const name = component.NAME\n\n EventHandler.on(document, clickEvent, `[data-bs-dismiss=\"${name}\"]`, function (event) {\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`)\n const instance = component.getOrCreateInstance(target)\n\n // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method\n instance[method]()\n })\n}\n\nexport {\n enableDismissTrigger\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap alert.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport { enableDismissTrigger } from './util/component-functions.js'\nimport { defineJQueryPlugin } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'alert'\nconst DATA_KEY = 'bs.alert'\nconst EVENT_KEY = `.${DATA_KEY}`\n\nconst EVENT_CLOSE = `close${EVENT_KEY}`\nconst EVENT_CLOSED = `closed${EVENT_KEY}`\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\n\n/**\n * Class definition\n */\n\nclass Alert extends BaseComponent {\n // Getters\n static get NAME() {\n return NAME\n }\n\n // Public\n close() {\n const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE)\n\n if (closeEvent.defaultPrevented) {\n return\n }\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n const isAnimated = this._element.classList.contains(CLASS_NAME_FADE)\n this._queueCallback(() => this._destroyElement(), this._element, isAnimated)\n }\n\n // Private\n _destroyElement() {\n this._element.remove()\n EventHandler.trigger(this._element, EVENT_CLOSED)\n this.dispose()\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Alert.getOrCreateInstance(this)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nenableDismissTrigger(Alert, 'close')\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Alert)\n\nexport default Alert\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap button.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport { defineJQueryPlugin } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'button'\nconst DATA_KEY = 'bs.button'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst CLASS_NAME_ACTIVE = 'active'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"button\"]'\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\n/**\n * Class definition\n */\n\nclass Button extends BaseComponent {\n // Getters\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method\n this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE))\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Button.getOrCreateInstance(this)\n\n if (config === 'toggle') {\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {\n event.preventDefault()\n\n const button = event.target.closest(SELECTOR_DATA_TOGGLE)\n const data = Button.getOrCreateInstance(button)\n\n data.toggle()\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Button)\n\nexport default Button\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap util/swipe.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport Config from './config.js'\nimport { execute } from './index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'swipe'\nconst EVENT_KEY = '.bs.swipe'\nconst EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`\nconst EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`\nconst EVENT_TOUCHEND = `touchend${EVENT_KEY}`\nconst EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`\nconst EVENT_POINTERUP = `pointerup${EVENT_KEY}`\nconst POINTER_TYPE_TOUCH = 'touch'\nconst POINTER_TYPE_PEN = 'pen'\nconst CLASS_NAME_POINTER_EVENT = 'pointer-event'\nconst SWIPE_THRESHOLD = 40\n\nconst Default = {\n endCallback: null,\n leftCallback: null,\n rightCallback: null\n}\n\nconst DefaultType = {\n endCallback: '(function|null)',\n leftCallback: '(function|null)',\n rightCallback: '(function|null)'\n}\n\n/**\n * Class definition\n */\n\nclass Swipe extends Config {\n constructor(element, config) {\n super()\n this._element = element\n\n if (!element || !Swipe.isSupported()) {\n return\n }\n\n this._config = this._getConfig(config)\n this._startX = 0\n this._deltaX = 0\n this._supportPointerEvents = Boolean(window.PointerEvent)\n this._initEvents()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n dispose() {\n EventHandler.off(this._element, EVENT_KEY)\n }\n\n // Private\n _start(event) {\n this._deltaX = 0\n\n if (!this._supportPointerEvents) {\n this._startX = event.touches[0].clientX\n\n return\n }\n\n if (this._eventIsPointerPenTouch(event)) {\n this._startX = event.clientX\n }\n }\n\n _end(event) {\n if (this._eventIsPointerPenTouch(event)) {\n this._deltaX = event.clientX - this._startX\n }\n\n this._handleSwipe()\n execute(this._config.endCallback)\n }\n\n _move(event) {\n this._deltaX = event.touches && event.touches.length > 1 ?\n 0 :\n event.touches[0].clientX - this._startX\n }\n\n _handleSwipe() {\n const absDeltaX = Math.abs(this._deltaX)\n\n if (absDeltaX <= SWIPE_THRESHOLD) {\n return\n }\n\n const direction = absDeltaX / this._deltaX\n\n this._deltaX = 0\n\n if (!direction) {\n return\n }\n\n execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback)\n }\n\n _initEvents() {\n if (this._supportPointerEvents) {\n EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event))\n EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event))\n\n this._element.classList.add(CLASS_NAME_POINTER_EVENT)\n } else {\n EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event))\n EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event))\n EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event))\n }\n }\n\n _eventIsPointerPenTouch(event) {\n return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)\n }\n\n // Static\n static isSupported() {\n return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0\n }\n}\n\nexport default Swipe\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap carousel.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport Manipulator from './dom/manipulator.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin,\n getNextActiveElement,\n isRTL,\n isVisible,\n reflow,\n triggerTransitionEnd\n} from './util/index.js'\nimport Swipe from './util/swipe.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'carousel'\nconst DATA_KEY = 'bs.carousel'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ARROW_LEFT_KEY = 'ArrowLeft'\nconst ARROW_RIGHT_KEY = 'ArrowRight'\nconst TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch\n\nconst ORDER_NEXT = 'next'\nconst ORDER_PREV = 'prev'\nconst DIRECTION_LEFT = 'left'\nconst DIRECTION_RIGHT = 'right'\n\nconst EVENT_SLIDE = `slide${EVENT_KEY}`\nconst EVENT_SLID = `slid${EVENT_KEY}`\nconst EVENT_KEYDOWN = `keydown${EVENT_KEY}`\nconst EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`\nconst EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`\nconst EVENT_DRAG_START = `dragstart${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_CAROUSEL = 'carousel'\nconst CLASS_NAME_ACTIVE = 'active'\nconst CLASS_NAME_SLIDE = 'slide'\nconst CLASS_NAME_END = 'carousel-item-end'\nconst CLASS_NAME_START = 'carousel-item-start'\nconst CLASS_NAME_NEXT = 'carousel-item-next'\nconst CLASS_NAME_PREV = 'carousel-item-prev'\n\nconst SELECTOR_ACTIVE = '.active'\nconst SELECTOR_ITEM = '.carousel-item'\nconst SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM\nconst SELECTOR_ITEM_IMG = '.carousel-item img'\nconst SELECTOR_INDICATORS = '.carousel-indicators'\nconst SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'\nconst SELECTOR_DATA_RIDE = '[data-bs-ride=\"carousel\"]'\n\nconst KEY_TO_DIRECTION = {\n [ARROW_LEFT_KEY]: DIRECTION_RIGHT,\n [ARROW_RIGHT_KEY]: DIRECTION_LEFT\n}\n\nconst Default = {\n interval: 5000,\n keyboard: true,\n pause: 'hover',\n ride: false,\n touch: true,\n wrap: true\n}\n\nconst DefaultType = {\n interval: '(number|boolean)', // TODO:v6 remove boolean support\n keyboard: 'boolean',\n pause: '(string|boolean)',\n ride: '(boolean|string)',\n touch: 'boolean',\n wrap: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Carousel extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._interval = null\n this._activeElement = null\n this._isSliding = false\n this.touchTimeout = null\n this._swipeHelper = null\n\n this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)\n this._addEventListeners()\n\n if (this._config.ride === CLASS_NAME_CAROUSEL) {\n this.cycle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n next() {\n this._slide(ORDER_NEXT)\n }\n\n nextWhenVisible() {\n // FIXME TODO use `document.visibilityState`\n // Don't call next when the page isn't visible\n // or the carousel or its parent isn't visible\n if (!document.hidden && isVisible(this._element)) {\n this.next()\n }\n }\n\n prev() {\n this._slide(ORDER_PREV)\n }\n\n pause() {\n if (this._isSliding) {\n triggerTransitionEnd(this._element)\n }\n\n this._clearInterval()\n }\n\n cycle() {\n this._clearInterval()\n this._updateInterval()\n\n this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)\n }\n\n _maybeEnableCycle() {\n if (!this._config.ride) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.cycle())\n return\n }\n\n this.cycle()\n }\n\n to(index) {\n const items = this._getItems()\n if (index > items.length - 1 || index < 0) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.to(index))\n return\n }\n\n const activeIndex = this._getItemIndex(this._getActive())\n if (activeIndex === index) {\n return\n }\n\n const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV\n\n this._slide(order, items[index])\n }\n\n dispose() {\n if (this._swipeHelper) {\n this._swipeHelper.dispose()\n }\n\n super.dispose()\n }\n\n // Private\n _configAfterMerge(config) {\n config.defaultInterval = config.interval\n return config\n }\n\n _addEventListeners() {\n if (this._config.keyboard) {\n EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))\n }\n\n if (this._config.pause === 'hover') {\n EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause())\n EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle())\n }\n\n if (this._config.touch && Swipe.isSupported()) {\n this._addTouchEventListeners()\n }\n }\n\n _addTouchEventListeners() {\n for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {\n EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault())\n }\n\n const endCallBack = () => {\n if (this._config.pause !== 'hover') {\n return\n }\n\n // If it's a touch-enabled device, mouseenter/leave are fired as\n // part of the mouse compatibility events on first tap - the carousel\n // would stop cycling until user tapped out of it;\n // here, we listen for touchend, explicitly pause the carousel\n // (as if it's the second time we tap on it, mouseenter compat event\n // is NOT fired) and after a timeout (to allow for mouse compatibility\n // events to fire) we explicitly restart cycling\n\n this.pause()\n if (this.touchTimeout) {\n clearTimeout(this.touchTimeout)\n }\n\n this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval)\n }\n\n const swipeConfig = {\n leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),\n rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),\n endCallback: endCallBack\n }\n\n this._swipeHelper = new Swipe(this._element, swipeConfig)\n }\n\n _keydown(event) {\n if (/input|textarea/i.test(event.target.tagName)) {\n return\n }\n\n const direction = KEY_TO_DIRECTION[event.key]\n if (direction) {\n event.preventDefault()\n this._slide(this._directionToOrder(direction))\n }\n }\n\n _getItemIndex(element) {\n return this._getItems().indexOf(element)\n }\n\n _setActiveIndicatorElement(index) {\n if (!this._indicatorsElement) {\n return\n }\n\n const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement)\n\n if (activeIndicator) {\n activeIndicator.classList.remove(CLASS_NAME_ACTIVE)\n activeIndicator.removeAttribute('aria-current')\n }\n\n const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to=\"${index}\"]`, this._indicatorsElement)\n\n if (newActiveIndicator) {\n newActiveIndicator.classList.add(CLASS_NAME_ACTIVE)\n newActiveIndicator.setAttribute('aria-current', 'true')\n }\n }\n\n _updateInterval() {\n const element = this._activeElement || this._getActive()\n\n if (!element) {\n return\n }\n\n const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10)\n\n this._config.interval = elementInterval || this._config.defaultInterval\n }\n\n _slide(order, element = null) {\n if (this._isSliding) {\n return\n }\n\n const activeElement = this._getActive()\n const isNext = order === ORDER_NEXT\n const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap)\n\n if (nextElement === activeElement) {\n return\n }\n\n const nextElementIndex = this._getItemIndex(nextElement)\n\n const triggerEvent = eventName => {\n return EventHandler.trigger(this._element, eventName, {\n relatedTarget: nextElement,\n direction: this._orderToDirection(order),\n from: this._getItemIndex(activeElement),\n to: nextElementIndex\n })\n }\n\n const slideEvent = triggerEvent(EVENT_SLIDE)\n\n if (slideEvent.defaultPrevented) {\n return\n }\n\n if (!activeElement || !nextElement) {\n // Some weirdness is happening, so we bail\n // TODO: change tests that use empty divs to avoid this check\n return\n }\n\n const isCycling = Boolean(this._interval)\n this.pause()\n\n this._isSliding = true\n\n this._setActiveIndicatorElement(nextElementIndex)\n this._activeElement = nextElement\n\n const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END\n const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV\n\n nextElement.classList.add(orderClassName)\n\n reflow(nextElement)\n\n activeElement.classList.add(directionalClassName)\n nextElement.classList.add(directionalClassName)\n\n const completeCallBack = () => {\n nextElement.classList.remove(directionalClassName, orderClassName)\n nextElement.classList.add(CLASS_NAME_ACTIVE)\n\n activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName)\n\n this._isSliding = false\n\n triggerEvent(EVENT_SLID)\n }\n\n this._queueCallback(completeCallBack, activeElement, this._isAnimated())\n\n if (isCycling) {\n this.cycle()\n }\n }\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_SLIDE)\n }\n\n _getActive() {\n return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)\n }\n\n _getItems() {\n return SelectorEngine.find(SELECTOR_ITEM, this._element)\n }\n\n _clearInterval() {\n if (this._interval) {\n clearInterval(this._interval)\n this._interval = null\n }\n }\n\n _directionToOrder(direction) {\n if (isRTL()) {\n return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT\n }\n\n return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV\n }\n\n _orderToDirection(order) {\n if (isRTL()) {\n return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT\n }\n\n return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Carousel.getOrCreateInstance(this, config)\n\n if (typeof config === 'number') {\n data.to(config)\n return\n }\n\n if (typeof config === 'string') {\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {\n const target = SelectorEngine.getElementFromSelector(this)\n\n if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {\n return\n }\n\n event.preventDefault()\n\n const carousel = Carousel.getOrCreateInstance(target)\n const slideIndex = this.getAttribute('data-bs-slide-to')\n\n if (slideIndex) {\n carousel.to(slideIndex)\n carousel._maybeEnableCycle()\n return\n }\n\n if (Manipulator.getDataAttribute(this, 'slide') === 'next') {\n carousel.next()\n carousel._maybeEnableCycle()\n return\n }\n\n carousel.prev()\n carousel._maybeEnableCycle()\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE)\n\n for (const carousel of carousels) {\n Carousel.getOrCreateInstance(carousel)\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Carousel)\n\nexport default Carousel\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap collapse.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin,\n getElement,\n reflow\n} from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'collapse'\nconst DATA_KEY = 'bs.collapse'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_COLLAPSE = 'collapse'\nconst CLASS_NAME_COLLAPSING = 'collapsing'\nconst CLASS_NAME_COLLAPSED = 'collapsed'\nconst CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`\nconst CLASS_NAME_HORIZONTAL = 'collapse-horizontal'\n\nconst WIDTH = 'width'\nconst HEIGHT = 'height'\n\nconst SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"collapse\"]'\n\nconst Default = {\n parent: null,\n toggle: true\n}\n\nconst DefaultType = {\n parent: '(null|element)',\n toggle: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Collapse extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._isTransitioning = false\n this._triggerArray = []\n\n const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE)\n\n for (const elem of toggleList) {\n const selector = SelectorEngine.getSelectorFromElement(elem)\n const filterElement = SelectorEngine.find(selector)\n .filter(foundElement => foundElement === this._element)\n\n if (selector !== null && filterElement.length) {\n this._triggerArray.push(elem)\n }\n }\n\n this._initializeChildren()\n\n if (!this._config.parent) {\n this._addAriaAndCollapsedClass(this._triggerArray, this._isShown())\n }\n\n if (this._config.toggle) {\n this.toggle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n if (this._isShown()) {\n this.hide()\n } else {\n this.show()\n }\n }\n\n show() {\n if (this._isTransitioning || this._isShown()) {\n return\n }\n\n let activeChildren = []\n\n // find active children\n if (this._config.parent) {\n activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES)\n .filter(element => element !== this._element)\n .map(element => Collapse.getOrCreateInstance(element, { toggle: false }))\n }\n\n if (activeChildren.length && activeChildren[0]._isTransitioning) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_SHOW)\n if (startEvent.defaultPrevented) {\n return\n }\n\n for (const activeInstance of activeChildren) {\n activeInstance.hide()\n }\n\n const dimension = this._getDimension()\n\n this._element.classList.remove(CLASS_NAME_COLLAPSE)\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n\n this._element.style[dimension] = 0\n\n this._addAriaAndCollapsedClass(this._triggerArray, true)\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n this._element.style[dimension] = ''\n\n EventHandler.trigger(this._element, EVENT_SHOWN)\n }\n\n const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)\n const scrollSize = `scroll${capitalizedDimension}`\n\n this._queueCallback(complete, this._element, true)\n this._element.style[dimension] = `${this._element[scrollSize]}px`\n }\n\n hide() {\n if (this._isTransitioning || !this._isShown()) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n if (startEvent.defaultPrevented) {\n return\n }\n\n const dimension = this._getDimension()\n\n this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`\n\n reflow(this._element)\n\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n for (const trigger of this._triggerArray) {\n const element = SelectorEngine.getElementFromSelector(trigger)\n\n if (element && !this._isShown(element)) {\n this._addAriaAndCollapsedClass([trigger], false)\n }\n }\n\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE)\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._element.style[dimension] = ''\n\n this._queueCallback(complete, this._element, true)\n }\n\n // Private\n _isShown(element = this._element) {\n return element.classList.contains(CLASS_NAME_SHOW)\n }\n\n _configAfterMerge(config) {\n config.toggle = Boolean(config.toggle) // Coerce string values\n config.parent = getElement(config.parent)\n return config\n }\n\n _getDimension() {\n return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT\n }\n\n _initializeChildren() {\n if (!this._config.parent) {\n return\n }\n\n const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE)\n\n for (const element of children) {\n const selected = SelectorEngine.getElementFromSelector(element)\n\n if (selected) {\n this._addAriaAndCollapsedClass([element], this._isShown(selected))\n }\n }\n }\n\n _getFirstLevelChildren(selector) {\n const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent)\n // remove children if greater depth\n return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element))\n }\n\n _addAriaAndCollapsedClass(triggerArray, isOpen) {\n if (!triggerArray.length) {\n return\n }\n\n for (const element of triggerArray) {\n element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen)\n element.setAttribute('aria-expanded', isOpen)\n }\n }\n\n // Static\n static jQueryInterface(config) {\n const _config = {}\n if (typeof config === 'string' && /show|hide/.test(config)) {\n _config.toggle = false\n }\n\n return this.each(function () {\n const data = Collapse.getOrCreateInstance(this, _config)\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n // preventDefault only for
elements (which change the URL) not inside the collapsible element\n if (event.target.tagName === 'A' || (event.delegateTarget && event.delegateTarget.tagName === 'A')) {\n event.preventDefault()\n }\n\n for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {\n Collapse.getOrCreateInstance(element, { toggle: false }).toggle()\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Collapse)\n\nexport default Collapse\n","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref, win) {\n var x = _ref.x,\n y = _ref.y;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }, getWindow(popper)) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n });\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref) {\n var name = _ref.name,\n _ref$options = _ref.options,\n options = _ref$options === void 0 ? {} : _ref$options,\n effect = _ref.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","/**\n * --------------------------------------------------------------------------\n * Bootstrap dropdown.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport * as Popper from '@popperjs/core'\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport Manipulator from './dom/manipulator.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin,\n execute,\n getElement,\n getNextActiveElement,\n isDisabled,\n isElement,\n isRTL,\n isVisible,\n noop\n} from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'dropdown'\nconst DATA_KEY = 'bs.dropdown'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ESCAPE_KEY = 'Escape'\nconst TAB_KEY = 'Tab'\nconst ARROW_UP_KEY = 'ArrowUp'\nconst ARROW_DOWN_KEY = 'ArrowDown'\nconst RIGHT_MOUSE_BUTTON = 2 // MouseEvent.button value for the secondary button, usually the right button\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_DROPUP = 'dropup'\nconst CLASS_NAME_DROPEND = 'dropend'\nconst CLASS_NAME_DROPSTART = 'dropstart'\nconst CLASS_NAME_DROPUP_CENTER = 'dropup-center'\nconst CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"dropdown\"]:not(.disabled):not(:disabled)'\nconst SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE}.${CLASS_NAME_SHOW}`\nconst SELECTOR_MENU = '.dropdown-menu'\nconst SELECTOR_NAVBAR = '.navbar'\nconst SELECTOR_NAVBAR_NAV = '.navbar-nav'\nconst SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'\n\nconst PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'\nconst PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'\nconst PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'\nconst PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'\nconst PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'\nconst PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'\nconst PLACEMENT_TOPCENTER = 'top'\nconst PLACEMENT_BOTTOMCENTER = 'bottom'\n\nconst Default = {\n autoClose: true,\n boundary: 'clippingParents',\n display: 'dynamic',\n offset: [0, 2],\n popperConfig: null,\n reference: 'toggle'\n}\n\nconst DefaultType = {\n autoClose: '(boolean|string)',\n boundary: '(string|element)',\n display: 'string',\n offset: '(array|string|function)',\n popperConfig: '(null|object|function)',\n reference: '(string|element|object)'\n}\n\n/**\n * Class definition\n */\n\nclass Dropdown extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._popper = null\n this._parent = this._element.parentNode // dropdown wrapper\n // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/\n this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||\n SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||\n SelectorEngine.findOne(SELECTOR_MENU, this._parent)\n this._inNavbar = this._detectNavbar()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n return this._isShown() ? this.hide() : this.show()\n }\n\n show() {\n if (isDisabled(this._element) || this._isShown()) {\n return\n }\n\n const relatedTarget = {\n relatedTarget: this._element\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget)\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._createPopper()\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.on(element, 'mouseover', noop)\n }\n }\n\n this._element.focus()\n this._element.setAttribute('aria-expanded', true)\n\n this._menu.classList.add(CLASS_NAME_SHOW)\n this._element.classList.add(CLASS_NAME_SHOW)\n EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget)\n }\n\n hide() {\n if (isDisabled(this._element) || !this._isShown()) {\n return\n }\n\n const relatedTarget = {\n relatedTarget: this._element\n }\n\n this._completeHide(relatedTarget)\n }\n\n dispose() {\n if (this._popper) {\n this._popper.destroy()\n }\n\n super.dispose()\n }\n\n update() {\n this._inNavbar = this._detectNavbar()\n if (this._popper) {\n this._popper.update()\n }\n }\n\n // Private\n _completeHide(relatedTarget) {\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.off(element, 'mouseover', noop)\n }\n }\n\n if (this._popper) {\n this._popper.destroy()\n }\n\n this._menu.classList.remove(CLASS_NAME_SHOW)\n this._element.classList.remove(CLASS_NAME_SHOW)\n this._element.setAttribute('aria-expanded', 'false')\n Manipulator.removeDataAttribute(this._menu, 'popper')\n EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget)\n }\n\n _getConfig(config) {\n config = super._getConfig(config)\n\n if (typeof config.reference === 'object' && !isElement(config.reference) &&\n typeof config.reference.getBoundingClientRect !== 'function'\n ) {\n // Popper virtual elements require a getBoundingClientRect method\n throw new TypeError(`${NAME.toUpperCase()}: Option \"reference\" provided type \"object\" without a required \"getBoundingClientRect\" method.`)\n }\n\n return config\n }\n\n _createPopper() {\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s dropdowns require Popper (https://github.com/floating-ui/popper-docs/blob/main/docs/v2/index.md)')\n }\n\n let referenceElement = this._element\n\n if (this._config.reference === 'parent') {\n referenceElement = this._parent\n } else if (isElement(this._config.reference)) {\n referenceElement = getElement(this._config.reference)\n } else if (typeof this._config.reference === 'object') {\n referenceElement = this._config.reference\n }\n\n const popperConfig = this._getPopperConfig()\n this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)\n }\n\n _isShown() {\n return this._menu.classList.contains(CLASS_NAME_SHOW)\n }\n\n _getPlacement() {\n const parentDropdown = this._parent\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {\n return PLACEMENT_RIGHT\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {\n return PLACEMENT_LEFT\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {\n return PLACEMENT_TOPCENTER\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {\n return PLACEMENT_BOTTOMCENTER\n }\n\n // We need to trim the value because custom properties can also include spaces\n const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {\n return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP\n }\n\n return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM\n }\n\n _detectNavbar() {\n return this._element.closest(SELECTOR_NAVBAR) !== null\n }\n\n _getOffset() {\n const { offset } = this._config\n\n if (typeof offset === 'string') {\n return offset.split(',').map(value => Number.parseInt(value, 10))\n }\n\n if (typeof offset === 'function') {\n return popperData => offset(popperData, this._element)\n }\n\n return offset\n }\n\n _getPopperConfig() {\n const defaultBsPopperConfig = {\n placement: this._getPlacement(),\n modifiers: [{\n name: 'preventOverflow',\n options: {\n boundary: this._config.boundary\n }\n },\n {\n name: 'offset',\n options: {\n offset: this._getOffset()\n }\n }]\n }\n\n // Disable Popper if we have a static display or Dropdown is in Navbar\n if (this._inNavbar || this._config.display === 'static') {\n Manipulator.setDataAttribute(this._menu, 'popper', 'static') // TODO: v6 remove\n defaultBsPopperConfig.modifiers = [{\n name: 'applyStyles',\n enabled: false\n }]\n }\n\n return {\n ...defaultBsPopperConfig,\n ...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])\n }\n }\n\n _selectMenuItem({ key, target }) {\n const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element))\n\n if (!items.length) {\n return\n }\n\n // if target isn't included in items (e.g. when expanding the dropdown)\n // allow cycling to get the last item in case key equals ARROW_UP_KEY\n getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus()\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Dropdown.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n\n static clearMenus(event) {\n if (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY)) {\n return\n }\n\n const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN)\n\n for (const toggle of openToggles) {\n const context = Dropdown.getInstance(toggle)\n if (!context || context._config.autoClose === false) {\n continue\n }\n\n const composedPath = event.composedPath()\n const isMenuTarget = composedPath.includes(context._menu)\n if (\n composedPath.includes(context._element) ||\n (context._config.autoClose === 'inside' && !isMenuTarget) ||\n (context._config.autoClose === 'outside' && isMenuTarget)\n ) {\n continue\n }\n\n // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu\n if (context._menu.contains(event.target) && ((event.type === 'keyup' && event.key === TAB_KEY) || /input|select|option|textarea|form/i.test(event.target.tagName))) {\n continue\n }\n\n const relatedTarget = { relatedTarget: context._element }\n\n if (event.type === 'click') {\n relatedTarget.clickEvent = event\n }\n\n context._completeHide(relatedTarget)\n }\n }\n\n static dataApiKeydownHandler(event) {\n // If not an UP | DOWN | ESCAPE key => not a dropdown command\n // If input/textarea && if key is other than ESCAPE => not a dropdown command\n\n const isInput = /input|textarea/i.test(event.target.tagName)\n const isEscapeEvent = event.key === ESCAPE_KEY\n const isUpOrDownEvent = [ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)\n\n if (!isUpOrDownEvent && !isEscapeEvent) {\n return\n }\n\n if (isInput && !isEscapeEvent) {\n return\n }\n\n event.preventDefault()\n\n // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/\n const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ?\n this :\n (SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||\n SelectorEngine.next(this, SELECTOR_DATA_TOGGLE)[0] ||\n SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode))\n\n const instance = Dropdown.getOrCreateInstance(getToggleButton)\n\n if (isUpOrDownEvent) {\n event.stopPropagation()\n instance.show()\n instance._selectMenuItem(event)\n return\n }\n\n if (instance._isShown()) { // else is escape and we check if it is shown\n event.stopPropagation()\n instance.hide()\n getToggleButton.focus()\n }\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler)\nEventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler)\nEventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus)\nEventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus)\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n event.preventDefault()\n Dropdown.getOrCreateInstance(this).toggle()\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Dropdown)\n\nexport default Dropdown\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap util/backdrop.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport Config from './config.js'\nimport {\n execute, executeAfterTransition, getElement, reflow\n} from './index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'backdrop'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst EVENT_MOUSEDOWN = `mousedown.bs.${NAME}`\n\nconst Default = {\n className: 'modal-backdrop',\n clickCallback: null,\n isAnimated: false,\n isVisible: true, // if false, we use the backdrop helper without adding any element to the dom\n rootElement: 'body' // give the choice to place backdrop under different elements\n}\n\nconst DefaultType = {\n className: 'string',\n clickCallback: '(function|null)',\n isAnimated: 'boolean',\n isVisible: 'boolean',\n rootElement: '(element|string)'\n}\n\n/**\n * Class definition\n */\n\nclass Backdrop extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n this._isAppended = false\n this._element = null\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n show(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._append()\n\n const element = this._getElement()\n if (this._config.isAnimated) {\n reflow(element)\n }\n\n element.classList.add(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n execute(callback)\n })\n }\n\n hide(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._getElement().classList.remove(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n this.dispose()\n execute(callback)\n })\n }\n\n dispose() {\n if (!this._isAppended) {\n return\n }\n\n EventHandler.off(this._element, EVENT_MOUSEDOWN)\n\n this._element.remove()\n this._isAppended = false\n }\n\n // Private\n _getElement() {\n if (!this._element) {\n const backdrop = document.createElement('div')\n backdrop.className = this._config.className\n if (this._config.isAnimated) {\n backdrop.classList.add(CLASS_NAME_FADE)\n }\n\n this._element = backdrop\n }\n\n return this._element\n }\n\n _configAfterMerge(config) {\n // use getElement() with the default \"body\" to get a fresh Element on each instantiation\n config.rootElement = getElement(config.rootElement)\n return config\n }\n\n _append() {\n if (this._isAppended) {\n return\n }\n\n const element = this._getElement()\n this._config.rootElement.append(element)\n\n EventHandler.on(element, EVENT_MOUSEDOWN, () => {\n execute(this._config.clickCallback)\n })\n\n this._isAppended = true\n }\n\n _emulateAnimation(callback) {\n executeAfterTransition(callback, this._getElement(), this._config.isAnimated)\n }\n}\n\nexport default Backdrop\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap util/focustrap.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport SelectorEngine from '../dom/selector-engine.js'\nimport Config from './config.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'focustrap'\nconst DATA_KEY = 'bs.focustrap'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst EVENT_FOCUSIN = `focusin${EVENT_KEY}`\nconst EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`\n\nconst TAB_KEY = 'Tab'\nconst TAB_NAV_FORWARD = 'forward'\nconst TAB_NAV_BACKWARD = 'backward'\n\nconst Default = {\n autofocus: true,\n trapElement: null // The element to trap focus inside of\n}\n\nconst DefaultType = {\n autofocus: 'boolean',\n trapElement: 'element'\n}\n\n/**\n * Class definition\n */\n\nclass FocusTrap extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n this._isActive = false\n this._lastTabNavDirection = null\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n activate() {\n if (this._isActive) {\n return\n }\n\n if (this._config.autofocus) {\n this._config.trapElement.focus()\n }\n\n EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop\n EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event))\n EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event))\n\n this._isActive = true\n }\n\n deactivate() {\n if (!this._isActive) {\n return\n }\n\n this._isActive = false\n EventHandler.off(document, EVENT_KEY)\n }\n\n // Private\n _handleFocusin(event) {\n const { trapElement } = this._config\n\n if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {\n return\n }\n\n const elements = SelectorEngine.focusableChildren(trapElement)\n\n if (elements.length === 0) {\n trapElement.focus()\n } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {\n elements[elements.length - 1].focus()\n } else {\n elements[0].focus()\n }\n }\n\n _handleKeydown(event) {\n if (event.key !== TAB_KEY) {\n return\n }\n\n this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD\n }\n}\n\nexport default FocusTrap\n","/**\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","/**\n * --------------------------------------------------------------------------\n * Bootstrap modal.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport Backdrop from './util/backdrop.js'\nimport { enableDismissTrigger } from './util/component-functions.js'\nimport FocusTrap from './util/focustrap.js'\nimport {\n defineJQueryPlugin, isRTL, isVisible, reflow\n} from './util/index.js'\nimport ScrollBarHelper from './util/scrollbar.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'modal'\nconst DATA_KEY = 'bs.modal'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst ESCAPE_KEY = 'Escape'\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_RESIZE = `resize${EVENT_KEY}`\nconst EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`\nconst EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_OPEN = 'modal-open'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_STATIC = 'modal-static'\n\nconst OPEN_SELECTOR = '.modal.show'\nconst SELECTOR_DIALOG = '.modal-dialog'\nconst SELECTOR_MODAL_BODY = '.modal-body'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"modal\"]'\n\nconst Default = {\n backdrop: true,\n focus: true,\n keyboard: true\n}\n\nconst DefaultType = {\n backdrop: '(boolean|string)',\n focus: 'boolean',\n keyboard: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Modal extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element)\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._isShown = false\n this._isTransitioning = false\n this._scrollBar = new ScrollBarHelper()\n\n this._addEventListeners()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown || this._isTransitioning) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {\n relatedTarget\n })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n this._isTransitioning = true\n\n this._scrollBar.hide()\n\n document.body.classList.add(CLASS_NAME_OPEN)\n\n this._adjustDialog()\n\n this._backdrop.show(() => this._showElement(relatedTarget))\n }\n\n hide() {\n if (!this._isShown || this._isTransitioning) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._isShown = false\n this._isTransitioning = true\n this._focustrap.deactivate()\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n this._queueCallback(() => this._hideModal(), this._element, this._isAnimated())\n }\n\n dispose() {\n EventHandler.off(window, EVENT_KEY)\n EventHandler.off(this._dialog, EVENT_KEY)\n\n this._backdrop.dispose()\n this._focustrap.deactivate()\n\n super.dispose()\n }\n\n handleUpdate() {\n this._adjustDialog()\n }\n\n // Private\n _initializeBackDrop() {\n return new Backdrop({\n isVisible: Boolean(this._config.backdrop), // 'static' option will be translated to true, and booleans will keep their value,\n isAnimated: this._isAnimated()\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _showElement(relatedTarget) {\n // try to append dynamic modal\n if (!document.body.contains(this._element)) {\n document.body.append(this._element)\n }\n\n this._element.style.display = 'block'\n this._element.removeAttribute('aria-hidden')\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.scrollTop = 0\n\n const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog)\n if (modalBody) {\n modalBody.scrollTop = 0\n }\n\n reflow(this._element)\n\n this._element.classList.add(CLASS_NAME_SHOW)\n\n const transitionComplete = () => {\n if (this._config.focus) {\n this._focustrap.activate()\n }\n\n this._isTransitioning = false\n EventHandler.trigger(this._element, EVENT_SHOWN, {\n relatedTarget\n })\n }\n\n this._queueCallback(transitionComplete, this._dialog, this._isAnimated())\n }\n\n _addEventListeners() {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (event.key !== ESCAPE_KEY) {\n return\n }\n\n if (this._config.keyboard) {\n this.hide()\n return\n }\n\n this._triggerBackdropTransition()\n })\n\n EventHandler.on(window, EVENT_RESIZE, () => {\n if (this._isShown && !this._isTransitioning) {\n this._adjustDialog()\n }\n })\n\n EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {\n // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks\n EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {\n if (this._element !== event.target || this._element !== event2.target) {\n return\n }\n\n if (this._config.backdrop === 'static') {\n this._triggerBackdropTransition()\n return\n }\n\n if (this._config.backdrop) {\n this.hide()\n }\n })\n })\n }\n\n _hideModal() {\n this._element.style.display = 'none'\n this._element.setAttribute('aria-hidden', true)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n this._isTransitioning = false\n\n this._backdrop.hide(() => {\n document.body.classList.remove(CLASS_NAME_OPEN)\n this._resetAdjustments()\n this._scrollBar.reset()\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n })\n }\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_FADE)\n }\n\n _triggerBackdropTransition() {\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight\n const initialOverflowY = this._element.style.overflowY\n // return if the following background transition hasn't yet completed\n if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {\n return\n }\n\n if (!isModalOverflowing) {\n this._element.style.overflowY = 'hidden'\n }\n\n this._element.classList.add(CLASS_NAME_STATIC)\n this._queueCallback(() => {\n this._element.classList.remove(CLASS_NAME_STATIC)\n this._queueCallback(() => {\n this._element.style.overflowY = initialOverflowY\n }, this._dialog)\n }, this._dialog)\n\n this._element.focus()\n }\n\n /**\n * The following methods are used to handle overflowing modals\n */\n\n _adjustDialog() {\n const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight\n const scrollbarWidth = this._scrollBar.getWidth()\n const isBodyOverflowing = scrollbarWidth > 0\n\n if (isBodyOverflowing && !isModalOverflowing) {\n const property = isRTL() ? 'paddingLeft' : 'paddingRight'\n this._element.style[property] = `${scrollbarWidth}px`\n }\n\n if (!isBodyOverflowing && isModalOverflowing) {\n const property = isRTL() ? 'paddingRight' : 'paddingLeft'\n this._element.style[property] = `${scrollbarWidth}px`\n }\n }\n\n _resetAdjustments() {\n this._element.style.paddingLeft = ''\n this._element.style.paddingRight = ''\n }\n\n // Static\n static jQueryInterface(config, relatedTarget) {\n return this.each(function () {\n const data = Modal.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](relatedTarget)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = SelectorEngine.getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n EventHandler.one(target, EVENT_SHOW, showEvent => {\n if (showEvent.defaultPrevented) {\n // only register focus restorer if modal will actually get shown\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n if (isVisible(this)) {\n this.focus()\n }\n })\n })\n\n // avoid conflict when clicking modal toggler while another one is open\n const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (alreadyOpen) {\n Modal.getInstance(alreadyOpen).hide()\n }\n\n const data = Modal.getOrCreateInstance(target)\n\n data.toggle(this)\n})\n\nenableDismissTrigger(Modal)\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Modal)\n\nexport default Modal\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap offcanvas.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport Backdrop from './util/backdrop.js'\nimport { enableDismissTrigger } from './util/component-functions.js'\nimport FocusTrap from './util/focustrap.js'\nimport {\n defineJQueryPlugin,\n isDisabled,\n isVisible\n} from './util/index.js'\nimport ScrollBarHelper from './util/scrollbar.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'offcanvas'\nconst DATA_KEY = 'bs.offcanvas'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst ESCAPE_KEY = 'Escape'\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_SHOWING = 'showing'\nconst CLASS_NAME_HIDING = 'hiding'\nconst CLASS_NAME_BACKDROP = 'offcanvas-backdrop'\nconst OPEN_SELECTOR = '.offcanvas.show'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_RESIZE = `resize${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"offcanvas\"]'\n\nconst Default = {\n backdrop: true,\n keyboard: true,\n scroll: false\n}\n\nconst DefaultType = {\n backdrop: '(boolean|string)',\n keyboard: 'boolean',\n scroll: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Offcanvas extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._isShown = false\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._addEventListeners()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n this._backdrop.show()\n\n if (!this._config.scroll) {\n new ScrollBarHelper().hide()\n }\n\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.classList.add(CLASS_NAME_SHOWING)\n\n const completeCallBack = () => {\n if (!this._config.scroll || this._config.backdrop) {\n this._focustrap.activate()\n }\n\n this._element.classList.add(CLASS_NAME_SHOW)\n this._element.classList.remove(CLASS_NAME_SHOWING)\n EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget })\n }\n\n this._queueCallback(completeCallBack, this._element, true)\n }\n\n hide() {\n if (!this._isShown) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._focustrap.deactivate()\n this._element.blur()\n this._isShown = false\n this._element.classList.add(CLASS_NAME_HIDING)\n this._backdrop.hide()\n\n const completeCallback = () => {\n this._element.classList.remove(CLASS_NAME_SHOW, CLASS_NAME_HIDING)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n\n if (!this._config.scroll) {\n new ScrollBarHelper().reset()\n }\n\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._queueCallback(completeCallback, this._element, true)\n }\n\n dispose() {\n this._backdrop.dispose()\n this._focustrap.deactivate()\n super.dispose()\n }\n\n // Private\n _initializeBackDrop() {\n const clickCallback = () => {\n if (this._config.backdrop === 'static') {\n EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n return\n }\n\n this.hide()\n }\n\n // 'static' option will be translated to true, and booleans will keep their value\n const isVisible = Boolean(this._config.backdrop)\n\n return new Backdrop({\n className: CLASS_NAME_BACKDROP,\n isVisible,\n isAnimated: true,\n rootElement: this._element.parentNode,\n clickCallback: isVisible ? clickCallback : null\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _addEventListeners() {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (event.key !== ESCAPE_KEY) {\n return\n }\n\n if (this._config.keyboard) {\n this.hide()\n return\n }\n\n EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n })\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Offcanvas.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = SelectorEngine.getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n // focus on trigger when it is closed\n if (isVisible(this)) {\n this.focus()\n }\n })\n\n // avoid conflict when clicking a toggler of an offcanvas, while another is open\n const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (alreadyOpen && alreadyOpen !== target) {\n Offcanvas.getInstance(alreadyOpen).hide()\n }\n\n const data = Offcanvas.getOrCreateInstance(target)\n data.toggle(this)\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {\n Offcanvas.getOrCreateInstance(selector).show()\n }\n})\n\nEventHandler.on(window, EVENT_RESIZE, () => {\n for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {\n if (getComputedStyle(element).position !== 'fixed') {\n Offcanvas.getOrCreateInstance(element).hide()\n }\n }\n})\n\nenableDismissTrigger(Offcanvas)\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Offcanvas)\n\nexport default Offcanvas\n","/**\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","/**\n * --------------------------------------------------------------------------\n * Bootstrap util/template-factory.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport SelectorEngine from '../dom/selector-engine.js'\nimport Config from './config.js'\nimport { DefaultAllowlist, sanitizeHtml } from './sanitizer.js'\nimport { execute, getElement, isElement } from './index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'TemplateFactory'\n\nconst Default = {\n allowList: DefaultAllowlist,\n content: {}, // { selector : text , selector2 : text2 , }\n extraClass: '',\n html: false,\n sanitize: true,\n sanitizeFn: null,\n template: '
'\n}\n\nconst DefaultType = {\n allowList: 'object',\n content: 'object',\n extraClass: '(string|function)',\n html: 'boolean',\n sanitize: 'boolean',\n sanitizeFn: '(null|function)',\n template: 'string'\n}\n\nconst DefaultContentType = {\n entry: '(string|element|function|null)',\n selector: '(string|element)'\n}\n\n/**\n * Class definition\n */\n\nclass TemplateFactory extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n getContent() {\n return Object.values(this._config.content)\n .map(config => this._resolvePossibleFunction(config))\n .filter(Boolean)\n }\n\n hasContent() {\n return this.getContent().length > 0\n }\n\n changeContent(content) {\n this._checkContent(content)\n this._config.content = { ...this._config.content, ...content }\n return this\n }\n\n toHtml() {\n const templateWrapper = document.createElement('div')\n templateWrapper.innerHTML = this._maybeSanitize(this._config.template)\n\n for (const [selector, text] of Object.entries(this._config.content)) {\n this._setContent(templateWrapper, text, selector)\n }\n\n const template = templateWrapper.children[0]\n const extraClass = this._resolvePossibleFunction(this._config.extraClass)\n\n if (extraClass) {\n template.classList.add(...extraClass.split(' '))\n }\n\n return template\n }\n\n // Private\n _typeCheckConfig(config) {\n super._typeCheckConfig(config)\n this._checkContent(config.content)\n }\n\n _checkContent(arg) {\n for (const [selector, content] of Object.entries(arg)) {\n super._typeCheckConfig({ selector, entry: content }, DefaultContentType)\n }\n }\n\n _setContent(template, content, selector) {\n const templateElement = SelectorEngine.findOne(selector, template)\n\n if (!templateElement) {\n return\n }\n\n content = this._resolvePossibleFunction(content)\n\n if (!content) {\n templateElement.remove()\n return\n }\n\n if (isElement(content)) {\n this._putElementInTemplate(getElement(content), templateElement)\n return\n }\n\n if (this._config.html) {\n templateElement.innerHTML = this._maybeSanitize(content)\n return\n }\n\n templateElement.textContent = content\n }\n\n _maybeSanitize(arg) {\n return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg\n }\n\n _resolvePossibleFunction(arg) {\n return execute(arg, [undefined, this])\n }\n\n _putElementInTemplate(element, templateElement) {\n if (this._config.html) {\n templateElement.innerHTML = ''\n templateElement.append(element)\n return\n }\n\n templateElement.textContent = element.textContent\n }\n}\n\nexport default TemplateFactory\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap tooltip.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport * as Popper from '@popperjs/core'\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport Manipulator from './dom/manipulator.js'\nimport {\n defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop\n} from './util/index.js'\nimport { DefaultAllowlist } from './util/sanitizer.js'\nimport TemplateFactory from './util/template-factory.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'tooltip'\nconst DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])\n\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_MODAL = 'modal'\nconst CLASS_NAME_SHOW = 'show'\n\nconst SELECTOR_TOOLTIP_INNER = '.tooltip-inner'\nconst SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`\n\nconst EVENT_MODAL_HIDE = 'hide.bs.modal'\n\nconst TRIGGER_HOVER = 'hover'\nconst TRIGGER_FOCUS = 'focus'\nconst TRIGGER_CLICK = 'click'\nconst TRIGGER_MANUAL = 'manual'\n\nconst EVENT_HIDE = 'hide'\nconst EVENT_HIDDEN = 'hidden'\nconst EVENT_SHOW = 'show'\nconst EVENT_SHOWN = 'shown'\nconst EVENT_INSERTED = 'inserted'\nconst EVENT_CLICK = 'click'\nconst EVENT_FOCUSIN = 'focusin'\nconst EVENT_FOCUSOUT = 'focusout'\nconst EVENT_MOUSEENTER = 'mouseenter'\nconst EVENT_MOUSELEAVE = 'mouseleave'\n\nconst AttachmentMap = {\n AUTO: 'auto',\n TOP: 'top',\n RIGHT: isRTL() ? 'left' : 'right',\n BOTTOM: 'bottom',\n LEFT: isRTL() ? 'right' : 'left'\n}\n\nconst Default = {\n allowList: DefaultAllowlist,\n animation: true,\n boundary: 'clippingParents',\n container: false,\n customClass: '',\n delay: 0,\n fallbackPlacements: ['top', 'right', 'bottom', 'left'],\n html: false,\n offset: [0, 6],\n placement: 'top',\n popperConfig: null,\n sanitize: true,\n sanitizeFn: null,\n selector: false,\n template: '
' +\n '
' +\n '
' +\n '
',\n title: '',\n trigger: 'hover focus'\n}\n\nconst DefaultType = {\n allowList: 'object',\n animation: 'boolean',\n boundary: '(string|element)',\n container: '(string|element|boolean)',\n customClass: '(string|function)',\n delay: '(number|object)',\n fallbackPlacements: 'array',\n html: 'boolean',\n offset: '(array|string|function)',\n placement: '(string|function)',\n popperConfig: '(null|object|function)',\n sanitize: 'boolean',\n sanitizeFn: '(null|function)',\n selector: '(string|boolean)',\n template: 'string',\n title: '(string|element|function)',\n trigger: 'string'\n}\n\n/**\n * Class definition\n */\n\nclass Tooltip extends BaseComponent {\n constructor(element, config) {\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s tooltips require Popper (https://github.com/floating-ui/popper-docs/blob/main/docs/v2/index.md)')\n }\n\n super(element, config)\n\n // Private\n this._isEnabled = true\n this._timeout = 0\n this._isHovered = null\n this._activeTrigger = {}\n this._popper = null\n this._templateFactory = null\n this._newContent = null\n\n // Protected\n this.tip = null\n\n this._setListeners()\n\n if (!this._config.selector) {\n this._fixTitle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n enable() {\n this._isEnabled = true\n }\n\n disable() {\n this._isEnabled = false\n }\n\n toggleEnabled() {\n this._isEnabled = !this._isEnabled\n }\n\n toggle() {\n if (!this._isEnabled) {\n return\n }\n\n if (this._isShown()) {\n this._leave()\n return\n }\n\n this._enter()\n }\n\n dispose() {\n clearTimeout(this._timeout)\n\n EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)\n\n if (this._element.getAttribute('data-bs-original-title')) {\n this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'))\n }\n\n this._disposePopper()\n super.dispose()\n }\n\n show() {\n if (this._element.style.display === 'none') {\n throw new Error('Please use show on visible elements')\n }\n\n if (!(this._isWithContent() && this._isEnabled)) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW))\n const shadowRoot = findShadowRoot(this._element)\n const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element)\n\n if (showEvent.defaultPrevented || !isInTheDom) {\n return\n }\n\n // TODO: v6 remove this or make it optional\n this._disposePopper()\n\n const tip = this._getTipElement()\n\n this._element.setAttribute('aria-describedby', tip.getAttribute('id'))\n\n const { container } = this._config\n\n if (!this._element.ownerDocument.documentElement.contains(this.tip)) {\n container.append(tip)\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED))\n }\n\n this._popper = this._createPopper(tip)\n\n tip.classList.add(CLASS_NAME_SHOW)\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.on(element, 'mouseover', noop)\n }\n }\n\n const complete = () => {\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN))\n\n if (this._isHovered === false) {\n this._leave()\n }\n\n this._isHovered = false\n }\n\n this._queueCallback(complete, this.tip, this._isAnimated())\n }\n\n hide() {\n if (!this._isShown()) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE))\n if (hideEvent.defaultPrevented) {\n return\n }\n\n const tip = this._getTipElement()\n tip.classList.remove(CLASS_NAME_SHOW)\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.off(element, 'mouseover', noop)\n }\n }\n\n this._activeTrigger[TRIGGER_CLICK] = false\n this._activeTrigger[TRIGGER_FOCUS] = false\n this._activeTrigger[TRIGGER_HOVER] = false\n this._isHovered = null // it is a trick to support manual triggering\n\n const complete = () => {\n if (this._isWithActiveTrigger()) {\n return\n }\n\n if (!this._isHovered) {\n this._disposePopper()\n }\n\n this._element.removeAttribute('aria-describedby')\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN))\n }\n\n this._queueCallback(complete, this.tip, this._isAnimated())\n }\n\n update() {\n if (this._popper) {\n this._popper.update()\n }\n }\n\n // Protected\n _isWithContent() {\n return Boolean(this._getTitle())\n }\n\n _getTipElement() {\n if (!this.tip) {\n this.tip = this._createTipElement(this._newContent || this._getContentForTemplate())\n }\n\n return this.tip\n }\n\n _createTipElement(content) {\n const tip = this._getTemplateFactory(content).toHtml()\n\n // TODO: remove this check in v6\n if (!tip) {\n return null\n }\n\n tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)\n // TODO: v6 the following can be achieved with CSS only\n tip.classList.add(`bs-${this.constructor.NAME}-auto`)\n\n const tipId = getUID(this.constructor.NAME).toString()\n\n tip.setAttribute('id', tipId)\n\n if (this._isAnimated()) {\n tip.classList.add(CLASS_NAME_FADE)\n }\n\n return tip\n }\n\n setContent(content) {\n this._newContent = content\n if (this._isShown()) {\n this._disposePopper()\n this.show()\n }\n }\n\n _getTemplateFactory(content) {\n if (this._templateFactory) {\n this._templateFactory.changeContent(content)\n } else {\n this._templateFactory = new TemplateFactory({\n ...this._config,\n // the `content` var has to be after `this._config`\n // to override config.content in case of popover\n content,\n extraClass: this._resolvePossibleFunction(this._config.customClass)\n })\n }\n\n return this._templateFactory\n }\n\n _getContentForTemplate() {\n return {\n [SELECTOR_TOOLTIP_INNER]: this._getTitle()\n }\n }\n\n _getTitle() {\n return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title')\n }\n\n // Private\n _initializeOnDelegatedTarget(event) {\n return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig())\n }\n\n _isAnimated() {\n return this._config.animation || (this.tip && this.tip.classList.contains(CLASS_NAME_FADE))\n }\n\n _isShown() {\n return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW)\n }\n\n _createPopper(tip) {\n const placement = execute(this._config.placement, [this, tip, this._element])\n const attachment = AttachmentMap[placement.toUpperCase()]\n return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment))\n }\n\n _getOffset() {\n const { offset } = this._config\n\n if (typeof offset === 'string') {\n return offset.split(',').map(value => Number.parseInt(value, 10))\n }\n\n if (typeof offset === 'function') {\n return popperData => offset(popperData, this._element)\n }\n\n return offset\n }\n\n _resolvePossibleFunction(arg) {\n return execute(arg, [this._element, this._element])\n }\n\n _getPopperConfig(attachment) {\n const defaultBsPopperConfig = {\n placement: attachment,\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements: this._config.fallbackPlacements\n }\n },\n {\n name: 'offset',\n options: {\n offset: this._getOffset()\n }\n },\n {\n name: 'preventOverflow',\n options: {\n boundary: this._config.boundary\n }\n },\n {\n name: 'arrow',\n options: {\n element: `.${this.constructor.NAME}-arrow`\n }\n },\n {\n name: 'preSetPlacement',\n enabled: true,\n phase: 'beforeMain',\n fn: data => {\n // Pre-set Popper's placement attribute in order to read the arrow sizes properly.\n // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement\n this._getTipElement().setAttribute('data-popper-placement', data.state.placement)\n }\n }\n ]\n }\n\n return {\n ...defaultBsPopperConfig,\n ...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])\n }\n }\n\n _setListeners() {\n const triggers = this._config.trigger.split(' ')\n\n for (const trigger of triggers) {\n if (trigger === 'click') {\n EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context._activeTrigger[TRIGGER_CLICK] = !(context._isShown() && context._activeTrigger[TRIGGER_CLICK])\n context.toggle()\n })\n } else if (trigger !== TRIGGER_MANUAL) {\n const eventIn = trigger === TRIGGER_HOVER ?\n this.constructor.eventName(EVENT_MOUSEENTER) :\n this.constructor.eventName(EVENT_FOCUSIN)\n const eventOut = trigger === TRIGGER_HOVER ?\n this.constructor.eventName(EVENT_MOUSELEAVE) :\n this.constructor.eventName(EVENT_FOCUSOUT)\n\n EventHandler.on(this._element, eventIn, this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true\n context._enter()\n })\n EventHandler.on(this._element, eventOut, this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] =\n context._element.contains(event.relatedTarget)\n\n context._leave()\n })\n }\n }\n\n this._hideModalHandler = () => {\n if (this._element) {\n this.hide()\n }\n }\n\n EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)\n }\n\n _fixTitle() {\n const title = this._element.getAttribute('title')\n\n if (!title) {\n return\n }\n\n if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {\n this._element.setAttribute('aria-label', title)\n }\n\n this._element.setAttribute('data-bs-original-title', title) // DO NOT USE IT. Is only for backwards compatibility\n this._element.removeAttribute('title')\n }\n\n _enter() {\n if (this._isShown() || this._isHovered) {\n this._isHovered = true\n return\n }\n\n this._isHovered = true\n\n this._setTimeout(() => {\n if (this._isHovered) {\n this.show()\n }\n }, this._config.delay.show)\n }\n\n _leave() {\n if (this._isWithActiveTrigger()) {\n return\n }\n\n this._isHovered = false\n\n this._setTimeout(() => {\n if (!this._isHovered) {\n this.hide()\n }\n }, this._config.delay.hide)\n }\n\n _setTimeout(handler, timeout) {\n clearTimeout(this._timeout)\n this._timeout = setTimeout(handler, timeout)\n }\n\n _isWithActiveTrigger() {\n return Object.values(this._activeTrigger).includes(true)\n }\n\n _getConfig(config) {\n const dataAttributes = Manipulator.getDataAttributes(this._element)\n\n // Read text attributes without coercing their values.\n const title = this._element.getAttribute('data-bs-title')\n const content = this._element.getAttribute('data-bs-content')\n\n if (title !== null) {\n dataAttributes.title = title\n }\n\n if (content !== null) {\n dataAttributes.content = content\n }\n\n for (const dataAttribute of Object.keys(dataAttributes)) {\n if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {\n delete dataAttributes[dataAttribute]\n }\n }\n\n config = {\n ...dataAttributes,\n ...(typeof config === 'object' && config ? config : {})\n }\n config = this._mergeConfigObj(config)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n _configAfterMerge(config) {\n config.container = config.container === false ? document.body : getElement(config.container)\n\n if (typeof config.delay === 'number') {\n config.delay = {\n show: config.delay,\n hide: config.delay\n }\n }\n\n if (typeof config.title === 'number') {\n config.title = config.title.toString()\n }\n\n if (typeof config.content === 'number') {\n config.content = config.content.toString()\n }\n\n return config\n }\n\n _getDelegateConfig() {\n const config = {}\n\n for (const [key, value] of Object.entries(this._config)) {\n if (this.constructor.Default[key] !== value) {\n config[key] = value\n }\n }\n\n config.selector = false\n config.trigger = 'manual'\n\n // In the future can be replaced with:\n // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])\n // `Object.fromEntries(keysWithDifferentValues)`\n return config\n }\n\n _disposePopper() {\n if (this._popper) {\n this._popper.destroy()\n this._popper = null\n }\n\n if (this.tip) {\n this.tip.remove()\n this.tip = null\n }\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Tooltip.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Tooltip)\n\nexport default Tooltip\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap popover.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Tooltip from './tooltip.js'\nimport { defineJQueryPlugin } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'popover'\n\nconst SELECTOR_TITLE = '.popover-header'\nconst SELECTOR_CONTENT = '.popover-body'\n\nconst Default = {\n ...Tooltip.Default,\n content: '',\n offset: [0, 8],\n placement: 'right',\n template: '
' +\n '
' +\n '

' +\n '
' +\n '
',\n trigger: 'click'\n}\n\nconst DefaultType = {\n ...Tooltip.DefaultType,\n content: '(null|string|element|function)'\n}\n\n/**\n * Class definition\n */\n\nclass Popover extends Tooltip {\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Overrides\n _isWithContent() {\n return this._getTitle() || this._getContent()\n }\n\n // Private\n _getContentForTemplate() {\n return {\n [SELECTOR_TITLE]: this._getTitle(),\n [SELECTOR_CONTENT]: this._getContent()\n }\n }\n\n _getContent() {\n return this._resolvePossibleFunction(this._config.content)\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Popover.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Popover)\n\nexport default Popover\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap scrollspy.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin, getElement, isDisabled, isVisible\n} from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'scrollspy'\nconst DATA_KEY = 'bs.scrollspy'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_ACTIVATE = `activate${EVENT_KEY}`\nconst EVENT_CLICK = `click${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'\nconst CLASS_NAME_ACTIVE = 'active'\n\nconst SELECTOR_DATA_SPY = '[data-bs-spy=\"scroll\"]'\nconst SELECTOR_TARGET_LINKS = '[href]'\nconst SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'\nconst SELECTOR_NAV_LINKS = '.nav-link'\nconst SELECTOR_NAV_ITEMS = '.nav-item'\nconst SELECTOR_LIST_ITEMS = '.list-group-item'\nconst SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`\nconst SELECTOR_DROPDOWN = '.dropdown'\nconst SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'\n\nconst Default = {\n offset: null, // TODO: v6 @deprecated, keep it for backwards compatibility reasons\n rootMargin: '0px 0px -25%',\n smoothScroll: false,\n target: null,\n threshold: [0.1, 0.5, 1]\n}\n\nconst DefaultType = {\n offset: '(number|null)', // TODO v6 @deprecated, keep it for backwards compatibility reasons\n rootMargin: 'string',\n smoothScroll: 'boolean',\n target: 'element',\n threshold: 'array'\n}\n\n/**\n * Class definition\n */\n\nclass ScrollSpy extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n // this._element is the observablesContainer and config.target the menu links wrapper\n this._targetLinks = new Map()\n this._observableSections = new Map()\n this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element\n this._activeTarget = null\n this._observer = null\n this._previousScrollData = {\n visibleEntryTop: 0,\n parentScrollTop: 0\n }\n this.refresh() // initialize\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n refresh() {\n this._initializeTargetsAndObservables()\n this._maybeEnableSmoothScroll()\n\n if (this._observer) {\n this._observer.disconnect()\n } else {\n this._observer = this._getNewObserver()\n }\n\n for (const section of this._observableSections.values()) {\n this._observer.observe(section)\n }\n }\n\n dispose() {\n this._observer.disconnect()\n super.dispose()\n }\n\n // Private\n _configAfterMerge(config) {\n // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case\n config.target = getElement(config.target) || document.body\n\n // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only\n config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin\n\n if (typeof config.threshold === 'string') {\n config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value))\n }\n\n return config\n }\n\n _maybeEnableSmoothScroll() {\n if (!this._config.smoothScroll) {\n return\n }\n\n // unregister any previous listeners\n EventHandler.off(this._config.target, EVENT_CLICK)\n\n EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {\n const observableSection = this._observableSections.get(event.delegateTarget.hash)\n if (observableSection) {\n event.preventDefault()\n const root = this._rootElement || window\n const height = observableSection.offsetTop - this._element.offsetTop\n if (root.scrollTo) {\n root.scrollTo({ top: height, behavior: 'smooth' })\n return\n }\n\n // Chrome 60 doesn't support `scrollTo`\n root.scrollTop = height\n }\n })\n }\n\n _getNewObserver() {\n const options = {\n root: this._rootElement,\n threshold: this._config.threshold,\n rootMargin: this._config.rootMargin\n }\n\n return new IntersectionObserver(entries => this._observerCallback(entries), options)\n }\n\n // The logic of selection\n _observerCallback(entries) {\n const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`)\n const activate = entry => {\n this._previousScrollData.visibleEntryTop = entry.target.offsetTop\n this._process(targetElement(entry))\n }\n\n const parentScrollTop = (this._rootElement || document.documentElement).scrollTop\n const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop\n this._previousScrollData.parentScrollTop = parentScrollTop\n\n for (const entry of entries) {\n if (!entry.isIntersecting) {\n this._activeTarget = null\n this._clearActiveClass(targetElement(entry))\n\n continue\n }\n\n const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop\n // if we are scrolling down, pick the bigger offsetTop\n if (userScrollsDown && entryIsLowerThanPrevious) {\n activate(entry)\n // if parent isn't scrolled, let's keep the first visible item, breaking the iteration\n if (!parentScrollTop) {\n return\n }\n\n continue\n }\n\n // if we are scrolling up, pick the smallest offsetTop\n if (!userScrollsDown && !entryIsLowerThanPrevious) {\n activate(entry)\n }\n }\n }\n\n _initializeTargetsAndObservables() {\n this._targetLinks = new Map()\n this._observableSections = new Map()\n\n const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target)\n\n for (const anchor of targetLinks) {\n // ensure that the anchor has an id and is not disabled\n if (!anchor.hash || isDisabled(anchor)) {\n continue\n }\n\n const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element)\n\n // ensure that the observableSection exists & is visible\n if (isVisible(observableSection)) {\n this._targetLinks.set(decodeURI(anchor.hash), anchor)\n this._observableSections.set(anchor.hash, observableSection)\n }\n }\n }\n\n _process(target) {\n if (this._activeTarget === target) {\n return\n }\n\n this._clearActiveClass(this._config.target)\n this._activeTarget = target\n target.classList.add(CLASS_NAME_ACTIVE)\n this._activateParents(target)\n\n EventHandler.trigger(this._element, EVENT_ACTIVATE, { relatedTarget: target })\n }\n\n _activateParents(target) {\n // Activate dropdown parents\n if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {\n SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN))\n .classList.add(CLASS_NAME_ACTIVE)\n return\n }\n\n for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {\n // Set triggered links parents as active\n // With both