diff --git a/.babelrc.js b/.babelrc.js new file mode 100644 index 0000000000..51399697f4 --- /dev/null +++ b/.babelrc.js @@ -0,0 +1,12 @@ +module.exports = { + presets: [ + [ + '@babel/preset-env', + { + loose: true, + bugfixes: true, + modules: false + } + ] + ] +}; diff --git a/.browserslistrc b/.browserslistrc index 281c2d86fe..cddd230052 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,27 +1,12 @@ # 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 >= 138 -Edge >= 138 -Firefox >= 147 -iOS >= 26 -Safari >= 26 - -not and_uc > 0 -not and_qq > 0 -not kaios > 0 -not op_mini all +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) diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index 2eee2e7d43..fa12b81d13 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -2,57 +2,64 @@ "files": [ { "path": "./dist/css/bootstrap-grid.css", - "maxSize": "13.75 kB" + "maxSize": "6.5 kB" }, { "path": "./dist/css/bootstrap-grid.min.css", - "maxSize": "12.0 kB" - }, - { - "path": "./dist/css/bootstrap-reboot.css", "maxSize": "6.0 kB" }, + { + "path": "./dist/css/bootstrap-reboot.css", + "maxSize": "3.5 kB" + }, { "path": "./dist/css/bootstrap-reboot.min.css", - "maxSize": "5.75 kB" + "maxSize": "3.25 kB" }, { "path": "./dist/css/bootstrap-utilities.css", - "maxSize": "21.25 kB" + "maxSize": "11.75 kB" }, { "path": "./dist/css/bootstrap-utilities.min.css", - "maxSize": "20.25 kB" + "maxSize": "10.75 kB" }, { "path": "./dist/css/bootstrap.css", - "maxSize": "55.5 kB" + "maxSize": "32.5 kB" }, { "path": "./dist/css/bootstrap.min.css", - "maxSize": "52 kB" + "maxSize": "30.25 kB" }, { "path": "./dist/js/bootstrap.bundle.js", - "maxSize": "79.75 kB" + "maxSize": "43.25 kB" }, { "path": "./dist/js/bootstrap.bundle.min.js", - "maxSize": "62.75 kB" + "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" }, { "path": "./dist/js/bootstrap.js", - "maxSize": "60.25 kB" + "maxSize": "29.0 kB" }, { "path": "./dist/js/bootstrap.min.js", - "maxSize": "39.0 kB" + "maxSize": "16.25 kB" } ], "ci": { "trackBranches": [ - "main", - "v4-dev" + "v5-dev" ] } } diff --git a/.cspell.json b/.cspell.json index f06670ecad..06b51aaab4 100644 --- a/.cspell.json +++ b/.cspell.json @@ -1,97 +1,82 @@ { "version": "0.2", "words": [ - "activedescendant", "affordance", "allowfullscreen", + "alpadev", "Analyser", - "autobuild", - "autofilled", + "asciiquotes", "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", - "checkgroup", + "cleancss", "clearfix", "Codesniffer", "combinator", "contenteditable", "Contentful", - "cooldown", - "coverallsapp", "Cpath", "Croll", "Crossfade", - "crossfades", "crossfading", "cssgrid", - "csstricks", "Csvg", - "currentcolor", "Datalists", - "Datepicker", - "datepickers", "Deque", "describedby", - "desync", - "dialogbase", - "disableable", + "dgst", "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", @@ -99,9 +84,9 @@ "Jumbotrons", "Jumpstart", "keyframes", - "keyline", - "Keyshortcut", + "keyshortcut", "keyshortcuts", + "KMZKZHQ", "komodoproject", "Komodo", "komodotools", @@ -110,44 +95,26 @@ "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", @@ -156,14 +123,12 @@ "recents", "rects", "relref", - "remint", "rgba", "roboto", "robotstxt", - "rollup", + "RTLCSS", "rubygem", "ruleset", - "sarif", "sassrc", "screenreaders", "scrollbars", @@ -171,8 +136,6 @@ "Segoe", "selectend", "semibold", - "shiki", - "shikijs", "slugified", "socio", "srcset", @@ -183,49 +146,48 @@ "subnav", "subresult", "subresults", - "Tabler", "tabbable", + "Tabler", "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", - "webp", - "worktrees", + "Werror", "xlink", "zindex" ], "language": "en-US", "ignoreRegExpList": [ - "\\\\u001[Bb]\\[[0-9;]*m", - "%[0-9A-Fa-f]{2}" + "\\u001[Bb]\\[[0-9;]*m" ], "ignorePaths": [ ".cspell.json", ".vscode/", "dist/", - "js/dist/", - "js/coverage/", "*.min.*", + "**/*rtl*", "**/tests/**", - "package-lock.json" + "package-lock.json", + "site/data/core-team.yml", + "site/data/translations.yml" ], "useGitignore": true } diff --git a/.cursor/skills/bootstrap-release/SKILL.md b/.cursor/skills/bootstrap-release/SKILL.md deleted file mode 100644 index 18cfed048b..0000000000 --- a/.cursor/skills/bootstrap-release/SKILL.md +++ /dev/null @@ -1,325 +0,0 @@ ---- -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 new file mode 100644 index 0000000000..e42161487a --- /dev/null +++ b/.eslintignore @@ -0,0 +1,9 @@ +**/*.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 new file mode 100644 index 0000000000..da686166f5 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,241 @@ +{ + "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 b6b0e8ce72..2ce536b440 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-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** 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** 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., `v6.0.0` to `v6.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., `v3.0.0` to `v3.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 ece97e31b7..f152071133 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/orgs/twbs/discussions/new/choose + url: https://github.com/twbs/bootstrap/discussions/new about: Ask and discuss questions with other Bootstrap community members. diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 0f0aa9275e..26b3be42c5 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/orgs/twbs/discussions). +- Ask and explore [our GitHub Discussions](https://github.com/twbs/bootstrap/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 4ba6aee4f7..957877282f 100644 --- a/.github/codeql/codeql-config.yml +++ b/.github/codeql/codeql-config.yml @@ -1,7 +1,3 @@ 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 76a55b2289..6c2a1f8f08 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ updates: labels: - dependencies - github-actions - - v6 + - v5 schedule: interval: weekly day: tuesday @@ -21,7 +21,7 @@ updates: directory: "/" labels: - dependencies - - v6 + - v5 schedule: interval: weekly day: tuesday @@ -31,66 +31,6 @@ 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: @@ -163,7 +103,7 @@ updates: - "version-update:semver-minor" - "version-update:semver-patch" groups: - v5-production-dependencies: + production-dependencies: dependency-type: "production" - v5-development-dependencies: + development-dependencies: dependency-type: "development" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000000..3700e96407 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,60 @@ +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 deleted file mode 100644 index eff7f1d0b7..0000000000 --- a/.github/release.yml +++ /dev/null @@ -1,62 +0,0 @@ -# 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 new file mode 100644 index 0000000000..875e35d9cc --- /dev/null +++ b/.github/workflows/browserstack.yml @@ -0,0 +1,45 @@ +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 e29104bad8..68576ddb8e 100644 --- a/.github/workflows/bundlewatch.yml +++ b/.github/workflows/bundlewatch.yml @@ -3,7 +3,7 @@ name: Bundlewatch on: push: branches: - - main + - v5-dev pull_request: workflow_dispatch: @@ -39,4 +39,4 @@ jobs: run: npm run bundlewatch env: BUNDLEWATCH_GITHUB_TOKEN: "${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}" - CI_BRANCH_BASE: main + CI_BRANCH_BASE: v5-dev diff --git a/.github/workflows/calibreapp-image-actions.yml b/.github/workflows/calibreapp-image-actions.yml index b6e12a14d4..09b984da39 100644 --- a/.github/workflows/calibreapp-image-actions.yml +++ b/.github/workflows/calibreapp-image-actions.yml @@ -18,8 +18,7 @@ jobs: name: calibreapp/image-actions runs-on: ubuntu-latest permissions: - # allow calibreapp/image-actions to update PRs and commit compressed images - contents: write + # allow calibreapp/image-actions to update PRs pull-requests: write steps: - name: Clone repository diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 811eb654fc..9a09cd26d8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -3,13 +3,11 @@ name: "CodeQL" on: push: branches: - - main - - v4-dev + - v5-dev - "!dependabot/**" pull_request: branches: - - main - - v4-dev + - v5-dev - "!dependabot/**" schedule: - cron: "0 2 * * 4" @@ -29,16 +27,16 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@1fc58d04a4d4374f921bdac573c3811c240f9c26 # v4.39.2 + uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 with: config-file: ./.github/codeql/codeql-config.yml languages: "javascript" queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@1fc58d04a4d4374f921bdac573c3811c240f9c26 # v4.39.2 + uses: github/codeql-action/autobuild@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@1fc58d04a4d4374f921bdac573c3811c240f9c26 # v4.39.2 + uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 with: category: "/language:javascript" diff --git a/.github/workflows/cspell.yml b/.github/workflows/cspell.yml index 89ea78d958..b8e035de9f 100644 --- a/.github/workflows/cspell.yml +++ b/.github/workflows/cspell.yml @@ -3,7 +3,7 @@ name: cspell on: push: branches: - - main + - v5-dev pull_request: workflow_dispatch: diff --git a/.github/workflows/css.yml b/.github/workflows/css.yml index 53b80a01fe..d39fcfecc8 100644 --- a/.github/workflows/css.yml +++ b/.github/workflows/css.yml @@ -3,7 +3,7 @@ name: CSS on: push: branches: - - main + - v5-dev pull_request: workflow_dispatch: @@ -37,12 +37,3 @@ 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 e2a7276188..9d97674751 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 them to `gh-pages`. +# It builds the docs and pushes only this version to `gh-pages`. on: workflow_dispatch: @@ -49,12 +49,22 @@ jobs: ref: gh-pages path: .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 + # 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 run: | - rsync --archive --exclude .git _site/ .gh-pages/ + 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}/" touch .gh-pages/.nojekyll - name: Commit and push diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6e03af1b0e..a7d3ad9b8e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,7 +3,7 @@ name: Docs on: push: branches: - - main + - v5-dev pull_request: workflow_dispatch: @@ -29,6 +29,8 @@ jobs: node-version-file: ".nvmrc" cache: npm + - run: java -version + - name: Install npm dependencies run: npm ci @@ -36,4 +38,4 @@ jobs: run: npm run docs-build - name: Validate HTML - run: npm run docs-html-validate + run: npm run docs-vnu diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index be71e21719..dfcc772bc7 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -3,7 +3,7 @@ name: JS Tests on: push: branches: - - main + - v5-dev pull_request: workflow_dispatch: @@ -37,9 +37,6 @@ 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 dc5cb90f01..7bad4ababa 100644 --- a/.github/workflows/linkinator.yml +++ b/.github/workflows/linkinator.yml @@ -40,16 +40,8 @@ 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 631b2f5a14..89847ea765 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,7 @@ name: Lint on: push: branches: - - main + - v5-dev pull_request: workflow_dispatch: diff --git a/.github/workflows/node-sass.yml b/.github/workflows/node-sass.yml new file mode 100644 index 0000000000..6b3add5913 --- /dev/null +++ b/.github/workflows/node-sass.yml @@ -0,0 +1,48 @@ +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/release-notes.yml b/.github/workflows/release-notes.yml new file mode 100644 index 0000000000..87785245ab --- /dev/null +++ b/.github/workflows/release-notes.yml @@ -0,0 +1,23 @@ +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 69034206e9..572be7019a 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@1fc58d04a4d4374f921bdac573c3811c240f9c26 # v4.39.2 + uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 with: sarif_file: results.sarif diff --git a/.gitignore b/.gitignore index ad178781bc..235ad54948 100644 --- a/.gitignore +++ b/.gitignore @@ -16,8 +16,6 @@ # OS or Editor folders ._* .cache -.claude -.cursor .DS_Store .idea .project @@ -38,7 +36,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 deleted file mode 100644 index 6b09841cb0..0000000000 --- a/.markdownlint.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "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 9a02213133..79574b3555 100644 --- a/.ncurc.json +++ b/.ncurc.json @@ -1,8 +1,23 @@ { "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", - "rolldown", - "stylelint" + "sass", + "stylelint", + "vnu-jar" ] } diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000000..589884aae7 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,60 @@ +{ + "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 deleted file mode 100644 index d096362488..0000000000 --- a/AGENTS.md +++ /dev/null @@ -1,112 +0,0 @@ -# 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 76007fe97e..114d7c831b 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,9 +19,11 @@ Blog

-## Bootstrap 6 -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. +## 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. + ## Table of contents @@ -37,19 +39,21 @@ Our default branch is for development of our Bootstrap 6 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/v6.0.0-alpha.1.zip) +- [Download the latest release](https://github.com/twbs/bootstrap/archive/v5.3.9.zip) - Clone the repo: `git clone https://github.com/twbs/bootstrap.git` -- 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 [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 [NuGet](https://www.nuget.org/): CSS: `Install-Package bootstrap` Sass: `Install-Package bootstrap.sass` -Read the [Getting started page](https://getbootstrap.com/docs/6.0/getting-started/) for information on the framework contents, templates, examples, and more. +Read the [Getting started page](https://getbootstrap.com/docs/5.3/getting-started/introduction/) for information on the framework contents, templates, examples, and more. + ## Status @@ -64,10 +68,11 @@ Read the [Getting started page](https://getbootstrap.com/docs/6.0/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)](https://scorecard.dev/viewer/?uri=github.com/twbs/bootstrap) +![Open Source Security Foundation Scorecard](https://img.shields.io/ossf-scorecard/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. @@ -82,23 +87,43 @@ 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.min.css.map + │ ├── bootstrap.rtl.css + │ ├── bootstrap.rtl.css.map + │ ├── bootstrap.rtl.min.css + │ └── bootstrap.rtl.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 @@ -106,17 +131,19 @@ 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 [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. +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). + ## 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/). +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. ### Running documentation locally @@ -133,6 +160,7 @@ 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/orgs/twbs/discussions). +- Ask questions and explore [our GitHub Discussions](https://github.com/twbs/bootstrap/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)] @@ -194,12 +233,14 @@ 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 deleted file mode 100644 index 2c21bfc646..0000000000 --- a/build/browser-targets.mjs +++ /dev/null @@ -1,54 +0,0 @@ -/*! - * 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 d7388368c9..b5a88d7c06 100644 --- a/build/build-plugins.mjs +++ b/build/build-plugins.mjs @@ -8,54 +8,86 @@ import path from 'node:path' import { fileURLToPath } from 'node:url' +import { babel } from '@rollup/plugin-babel' import { globby } from 'globby' -import { rolldown } from 'rolldown' +import { rollup } from 'rollup' 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 distPath = path.resolve(__dirname, '../js/dist/').replace(/\\/g, '/') -const tsFiles = await globby(`${sourcePath}/**/*.ts`) +const jsFiles = await globby(`${sourcePath}/**/*.js`) -// 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`. +// Array which holds the resolved plugins const resolvedPlugins = [] -for (const file of tsFiles) { +// 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) { resolvedPlugins.push({ src: file, - dist: file.replace(sourcePath, distPath).replace(/\.ts$/, '.js'), - fileName: path.basename(file).replace(/\.ts$/, '.js') + dist: file.replace('src', 'dist'), + fileName: path.basename(file), + className: filenameToEntity(path.basename(file)) + // safeClassName: filenameToEntity(path.relative(sourcePath, file)) }) } const build = async plugin => { - const bundle = await rolldown({ + /** + * @type {import('rollup').GlobalsOption} + */ + const globals = {} + + const bundle = await rollup({ input: plugin.src, - // 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 + 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 } }) await bundle.write({ banner: banner(plugin.fileName), - format: 'esm', + format: 'umd', + name: plugin.className, sourcemap: true, + globals, + generatedCode: 'es2015', file: plugin.dist }) - await bundle.close() - - console.log(`Built ${plugin.fileName}`) + console.log(`Built ${plugin.className}`) } (async () => { diff --git a/build/bundlewatch-fix.mjs b/build/bundlewatch-fix.mjs deleted file mode 100644 index 2b20e55324..0000000000 --- a/build/bundlewatch-fix.mjs +++ /dev/null @@ -1,55 +0,0 @@ -#!/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 deleted file mode 100644 index e4759881ba..0000000000 --- a/build/bundlewatch-table.mjs +++ /dev/null @@ -1,93 +0,0 @@ -#!/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 0c33c43fdc..c1433d5780 100644 --- a/build/change-version.mjs +++ b/build/change-version.mjs @@ -9,29 +9,18 @@ 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.ts', + 'js/src/base-component.js', 'package.js', - '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' + 'scss/mixins/_banner.scss', + 'site/data/docs-versions.yml' ] // Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37 @@ -73,12 +62,17 @@ async function replaceRecursively(file, oldVersion, newVersion) { await fs.writeFile(file, newString, 'utf8') } -async function bumpNpmVersion(newVersion) { +function bumpNpmVersion(newVersion) { if (DRY_RUN) { return } - await execFileAsync('npm', ['version', newVersion, '--no-git-tag-version']) + execFile('npm', ['version', newVersion, '--no-git-tag'], { shell: true }, error => { + if (error) { + console.error(error) + process.exit(1) + } + }) } function showUsage(args) { @@ -104,8 +98,9 @@ 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 deleted file mode 100644 index 6ebfa15705..0000000000 --- a/build/check-unused-imports.mjs +++ /dev/null @@ -1,345 +0,0 @@ -#!/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 deleted file mode 100644 index dfe204ca36..0000000000 --- a/build/clean-astro.mjs +++ /dev/null @@ -1,20 +0,0 @@ -#!/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 deleted file mode 100644 index 99cffca0d3..0000000000 --- a/build/copy-site.mjs +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 deleted file mode 100644 index 19082d61fc..0000000000 --- a/build/css-minify.mjs +++ /dev/null @@ -1,74 +0,0 @@ -#!/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 921400f7a5..3d9ce7f5b1 100644 --- a/build/generate-sri.mjs +++ b/build/generate-sri.mjs @@ -29,6 +29,10 @@ 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' @@ -36,6 +40,10 @@ 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 deleted file mode 100644 index 3c5e93331a..0000000000 --- a/build/generate-utilities-json.mjs +++ /dev/null @@ -1,87 +0,0 @@ -#!/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 deleted file mode 100644 index 3789de00c4..0000000000 --- a/build/generate-utilities-metadata.scss +++ /dev/null @@ -1,123 +0,0 @@ -// 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 deleted file mode 100644 index 1ad686efee..0000000000 --- a/build/html-validate.mjs +++ /dev/null @@ -1,104 +0,0 @@ -#!/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 7fe36ec06a..7717cfc3f1 100644 --- a/build/postcss.config.mjs +++ b/build/postcss.config.mjs @@ -1,37 +1,17 @@ -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: [ - postcssPrefixCustomProperties({ - prefix: 'bs-', - ignore: [/^--bs-/, /^--bd-/] - }), - autoprefixer({ cascade: false }), - removeRedundantPrefixes - ] + plugins: { + autoprefixer: { + cascade: false + }, + rtlcss: context.env === 'RTL' + } } } diff --git a/build/rolldown.config.mjs b/build/rolldown.config.mjs deleted file mode 100644 index d5a697af1c..0000000000 --- a/build/rolldown.config.mjs +++ /dev/null @@ -1,40 +0,0 @@ -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 new file mode 100644 index 0000000000..dd6c7d13e6 --- /dev/null +++ b/build/rollup.config.mjs @@ -0,0 +1,59 @@ +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 deleted file mode 100644 index bfd6ccc7a1..0000000000 --- a/build/screenshot-examples.mjs +++ /dev/null @@ -1,202 +0,0 @@ -/** - * 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 deleted file mode 100644 index 9d3a141773..0000000000 --- a/build/test-grid-layout.mjs +++ /dev/null @@ -1,287 +0,0 @@ -/* 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 deleted file mode 100644 index 4eab1ea5bb..0000000000 --- a/build/tsconfig.dts.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "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 new file mode 100644 index 0000000000..97e112d771 --- /dev/null +++ b/build/vnu-jar.mjs @@ -0,0 +1,66 @@ +#!/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 }; + * Bootstrap v5.3.9 (https://getbootstrap.com/) + * Copyright 2011-2026 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory()); +})(this, (function () { 'use strict'; -//# sourceMappingURL=bootstrap.bundle.js.map \ No newline at end of file + /** + * -------------------------------------------------------------------------- + * Bootstrap dom/data.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + /** + * Constants + */ + + const elementMap = new Map(); + const Data = { + set(element, key, instance) { + if (!elementMap.has(element)) { + elementMap.set(element, new Map()); + } + const instanceMap = elementMap.get(element); + + // make it clear we only want one instance per element + // can be removed later when multiple key/instances are fine to be used + if (!instanceMap.has(key) && instanceMap.size !== 0) { + // eslint-disable-next-line no-console + console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); + return; + } + instanceMap.set(key, instance); + }, + get(element, key) { + if (elementMap.has(element)) { + return elementMap.get(element).get(key) || null; + } + return null; + }, + remove(element, key) { + if (!elementMap.has(element)) { + return; + } + const instanceMap = elementMap.get(element); + instanceMap.delete(key); + + // free up element references if there are no instances left for an element + if (instanceMap.size === 0) { + elementMap.delete(element); + } + } + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + const MAX_UID = 1000000; + const MILLISECONDS_MULTIPLIER = 1000; + const TRANSITION_END = 'transitionend'; + + /** + * Properly escapes ID selectors to handle special characters in IDs + * (e.g. forward slashes, periods) so that they work with `document.querySelector`. + * + * @param {string} selector the selector to escape + * @returns {string} the escaped selector + */ + const parseSelector = selector => { + if (selector && window.CSS && window.CSS.escape) { + // document.querySelector needs escaping to handle IDs (html5+) containing for instance / + selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`); + } + return selector; + }; + + // Shout-out Angus Croll (https://goo.gl/pxwQGp) + const toType = object => { + if (object === null || object === undefined) { + return `${object}`; + } + return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase(); + }; + + /** + * Public Util API + */ + + const getUID = prefix => { + do { + prefix += Math.floor(Math.random() * MAX_UID); + } while (document.getElementById(prefix)); + return prefix; + }; + const getTransitionDurationFromElement = element => { + if (!element) { + return 0; + } + + // Get transition-duration of the element + let { + transitionDuration, + transitionDelay + } = window.getComputedStyle(element); + const floatTransitionDuration = Number.parseFloat(transitionDuration); + const floatTransitionDelay = Number.parseFloat(transitionDelay); + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0; + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0]; + transitionDelay = transitionDelay.split(',')[0]; + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; + }; + const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)); + }; + const isElement$1 = object => { + if (!object || typeof object !== 'object') { + return false; + } + if (typeof object.jquery !== 'undefined') { + object = object[0]; + } + return typeof object.nodeType !== 'undefined'; + }; + const getElement = object => { + // it's a jQuery object or a node element + if (isElement$1(object)) { + return object.jquery ? object[0] : object; + } + if (typeof object === 'string' && object.length > 0) { + return document.querySelector(parseSelector(object)); + } + return null; + }; + const isVisible = element => { + if (!isElement$1(element) || element.getClientRects().length === 0) { + return false; + } + const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; + // Handle `details` element as its content may falsely appear visible when it is closed + const closedDetails = element.closest('details:not([open])'); + if (!closedDetails) { + return elementIsVisible; + } + if (closedDetails !== element) { + const summary = element.closest('summary'); + if (summary && summary.parentNode !== closedDetails) { + return false; + } + if (summary === null) { + return false; + } + } + return elementIsVisible; + }; + const isDisabled = element => { + if (!element || element.nodeType !== Node.ELEMENT_NODE) { + return true; + } + if (element.classList.contains('disabled')) { + return true; + } + if (typeof element.disabled !== 'undefined') { + return element.disabled; + } + return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; + }; + const findShadowRoot = element => { + if (!document.documentElement.attachShadow) { + return null; + } + + // Can find the shadow root otherwise it'll return the document + if (typeof element.getRootNode === 'function') { + const root = element.getRootNode(); + return root instanceof ShadowRoot ? root : null; + } + if (element instanceof ShadowRoot) { + return element; + } + + // when we don't find a shadow root + if (!element.parentNode) { + return null; + } + return findShadowRoot(element.parentNode); + }; + const noop = () => {}; + + /** + * Trick to restart an element's animation by forcing a reflow. + * + * @param {HTMLElement} element the element whose animation should be restarted + * @returns {void} + * + * @see https://www.harrytheo.com/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation + */ + const reflow = element => { + element.offsetHeight; // eslint-disable-line no-unused-expressions + }; + const getjQuery = () => { + if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return window.jQuery; + } + return null; + }; + const DOMContentLoadedCallbacks = []; + const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + // add listener on the first call when the document is in loading state + if (!DOMContentLoadedCallbacks.length) { + document.addEventListener('DOMContentLoaded', () => { + for (const callback of DOMContentLoadedCallbacks) { + callback(); + } + }); + } + DOMContentLoadedCallbacks.push(callback); + } else { + callback(); + } + }; + const isRTL = () => document.documentElement.dir === 'rtl'; + const defineJQueryPlugin = plugin => { + onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const name = plugin.NAME; + const JQUERY_NO_CONFLICT = $.fn[name]; + $.fn[name] = plugin.jQueryInterface; + $.fn[name].Constructor = plugin; + $.fn[name].noConflict = () => { + $.fn[name] = JQUERY_NO_CONFLICT; + return plugin.jQueryInterface; + }; + } + }); + }; + const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => { + return typeof possibleCallback === 'function' ? possibleCallback.call(...args) : defaultValue; + }; + const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { + if (!waitForTransition) { + execute(callback); + return; + } + const durationPadding = 5; + const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding; + let called = false; + const handler = ({ + target + }) => { + if (target !== transitionElement) { + return; + } + called = true; + transitionElement.removeEventListener(TRANSITION_END, handler); + execute(callback); + }; + transitionElement.addEventListener(TRANSITION_END, handler); + setTimeout(() => { + if (!called) { + triggerTransitionEnd(transitionElement); + } + }, emulatedDuration); + }; + + /** + * Return the previous/next element of a list. + * + * @param {Element[]} list the list of elements to traverse + * @param {Element} activeElement the currently active element + * @param {boolean} shouldGetNext whether to return the next element (`true`) or the previous one (`false`) + * @param {boolean} isCycleAllowed whether to cycle back to the opposite end of the list when reaching the boundary + * @returns {Element} the appropriate previous/next element from the list + */ + const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { + const listLength = list.length; + let index = list.indexOf(activeElement); + + // if the element does not exist in the list return an element + // depending on the direction and if cycle is allowed + if (index === -1) { + return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]; + } + index += shouldGetNext ? 1 : -1; + if (isCycleAllowed) { + index = (index + listLength) % listLength; + } + return list[Math.max(0, Math.min(index, listLength - 1))]; + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap dom/event-handler.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const namespaceRegex = /[^.]*(?=\..*)\.|.*/; + const stripNameRegex = /\..*/; + const stripUidRegex = /::\d+$/; + const eventRegistry = {}; // Events storage + let uidEvent = 1; + const customEvents = { + mouseenter: 'mouseover', + mouseleave: 'mouseout' + }; + const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); + + /** + * Private methods + */ + + function makeEventUid(element, uid) { + return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; + } + function getElementEvents(element) { + const uid = makeEventUid(element); + element.uidEvent = uid; + eventRegistry[uid] = eventRegistry[uid] || {}; + return eventRegistry[uid]; + } + function bootstrapHandler(element, fn) { + return function handler(event) { + hydrateObj(event, { + delegateTarget: element + }); + if (handler.oneOff) { + EventHandler.off(element, event.type, fn); + } + return fn.apply(element, [event]); + }; + } + function bootstrapDelegationHandler(element, selector, fn) { + return function handler(event) { + const domElements = element.querySelectorAll(selector); + for (let { + target + } = event; target && target !== this; target = target.parentNode) { + for (const domElement of domElements) { + if (domElement !== target) { + continue; + } + hydrateObj(event, { + delegateTarget: target + }); + if (handler.oneOff) { + EventHandler.off(element, event.type, selector, fn); + } + return fn.apply(target, [event]); + } + } + }; + } + function findHandler(events, callable, delegationSelector = null) { + return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector); + } + function normalizeParameters(originalTypeEvent, handler, delegationFunction) { + const isDelegated = typeof handler === 'string'; + // TODO: tooltip passes `false` instead of selector, so we need to check + const callable = isDelegated ? delegationFunction : handler || delegationFunction; + let typeEvent = getTypeEvent(originalTypeEvent); + if (!nativeEvents.has(typeEvent)) { + typeEvent = originalTypeEvent; + } + return [isDelegated, callable, typeEvent]; + } + function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { + if (typeof originalTypeEvent !== 'string' || !element) { + return; + } + let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); + + // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position + // this prevents the handler from being dispatched the same way as mouseover or mouseout does + if (originalTypeEvent in customEvents) { + const wrapFunction = fn => { + return function (event) { + if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) { + return fn.call(this, event); + } + }; + }; + callable = wrapFunction(callable); + } + const events = getElementEvents(element); + const handlers = events[typeEvent] || (events[typeEvent] = {}); + const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null); + if (previousFunction) { + previousFunction.oneOff = previousFunction.oneOff && oneOff; + return; + } + const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, '')); + const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable); + fn.delegationSelector = isDelegated ? handler : null; + fn.callable = callable; + fn.oneOff = oneOff; + fn.uidEvent = uid; + handlers[uid] = fn; + element.addEventListener(typeEvent, fn, isDelegated); + } + function removeHandler(element, events, typeEvent, handler, delegationSelector) { + const fn = findHandler(events[typeEvent], handler, delegationSelector); + if (!fn) { + return; + } + element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); + delete events[typeEvent][fn.uidEvent]; + } + function removeNamespacedHandlers(element, events, typeEvent, namespace) { + const storeElementEvent = events[typeEvent] || {}; + for (const [handlerKey, event] of Object.entries(storeElementEvent)) { + if (handlerKey.includes(namespace)) { + removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); + } + } + } + function getTypeEvent(event) { + // allow to get the native events from namespaced events ('click.bs.button' --> 'click') + event = event.replace(stripNameRegex, ''); + return customEvents[event] || event; + } + const EventHandler = { + on(element, event, handler, delegationFunction) { + addHandler(element, event, handler, delegationFunction, false); + }, + one(element, event, handler, delegationFunction) { + addHandler(element, event, handler, delegationFunction, true); + }, + off(element, originalTypeEvent, handler, delegationFunction) { + if (typeof originalTypeEvent !== 'string' || !element) { + return; + } + const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); + const inNamespace = typeEvent !== originalTypeEvent; + const events = getElementEvents(element); + const storeElementEvent = events[typeEvent] || {}; + const isNamespace = originalTypeEvent.startsWith('.'); + if (typeof callable !== 'undefined') { + // Simplest case: handler is passed, remove that listener ONLY. + if (!Object.keys(storeElementEvent).length) { + return; + } + removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null); + return; + } + if (isNamespace) { + for (const elementEvent of Object.keys(events)) { + removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); + } + } + for (const [keyHandlers, event] of Object.entries(storeElementEvent)) { + const handlerKey = keyHandlers.replace(stripUidRegex, ''); + if (!inNamespace || originalTypeEvent.includes(handlerKey)) { + removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); + } + } + }, + trigger(element, event, args) { + if (typeof event !== 'string' || !element) { + return null; + } + const $ = getjQuery(); + const typeEvent = getTypeEvent(event); + const inNamespace = event !== typeEvent; + let jQueryEvent = null; + let bubbles = true; + let nativeDispatch = true; + let defaultPrevented = false; + if (inNamespace && $) { + jQueryEvent = $.Event(event, args); + $(element).trigger(jQueryEvent); + bubbles = !jQueryEvent.isPropagationStopped(); + nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); + defaultPrevented = jQueryEvent.isDefaultPrevented(); + } + const evt = hydrateObj(new Event(event, { + bubbles, + cancelable: true + }), args); + if (defaultPrevented) { + evt.preventDefault(); + } + if (nativeDispatch) { + element.dispatchEvent(evt); + } + if (evt.defaultPrevented && jQueryEvent) { + jQueryEvent.preventDefault(); + } + return evt; + } + }; + function hydrateObj(obj, meta = {}) { + for (const [key, value] of Object.entries(meta)) { + try { + obj[key] = value; + } catch (_unused) { + Object.defineProperty(obj, key, { + configurable: true, + get() { + return value; + } + }); + } + } + return obj; + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap dom/manipulator.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + function normalizeData(value) { + if (value === 'true') { + return true; + } + if (value === 'false') { + return false; + } + if (value === Number(value).toString()) { + return Number(value); + } + if (value === '' || value === 'null') { + return null; + } + if (typeof value !== 'string') { + return value; + } + try { + return JSON.parse(decodeURIComponent(value)); + } catch (_unused) { + return value; + } + } + function normalizeDataKey(key) { + return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); + } + const Manipulator = { + setDataAttribute(element, key, value) { + element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); + }, + removeDataAttribute(element, key) { + element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); + }, + getDataAttributes(element) { + if (!element) { + return {}; + } + const attributes = {}; + const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig')); + for (const key of bsKeys) { + let pureKey = key.replace(/^bs/, ''); + pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1); + attributes[pureKey] = normalizeData(element.dataset[key]); + } + return attributes; + }, + getDataAttribute(element, key) { + return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); + } + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/config.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Class definition + */ + + class Config { + // Getters + static get Default() { + return {}; + } + static get DefaultType() { + return {}; + } + static get NAME() { + throw new Error('You have to implement the static method "NAME", for each component!'); + } + _getConfig(config) { + config = this._mergeConfigObj(config); + config = this._configAfterMerge(config); + this._typeCheckConfig(config); + return config; + } + _configAfterMerge(config) { + return config; + } + _mergeConfigObj(config, element) { + const jsonConfig = isElement$1(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse + + return { + ...this.constructor.Default, + ...(typeof jsonConfig === 'object' ? jsonConfig : {}), + ...(isElement$1(element) ? Manipulator.getDataAttributes(element) : {}), + ...(typeof config === 'object' ? config : {}) + }; + } + _typeCheckConfig(config, configTypes = this.constructor.DefaultType) { + for (const [property, expectedTypes] of Object.entries(configTypes)) { + const value = config[property]; + const valueType = isElement$1(value) ? 'element' : toType(value); + if (!new RegExp(expectedTypes).test(valueType)) { + throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); + } + } + } + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const VERSION = '5.3.9'; + + /** + * Class definition + */ + + class BaseComponent extends Config { + constructor(element, config) { + super(); + element = getElement(element); + if (!element) { + return; + } + this._element = element; + this._config = this._getConfig(config); + Data.set(this._element, this.constructor.DATA_KEY, this); + } + + // Public + dispose() { + Data.remove(this._element, this.constructor.DATA_KEY); + EventHandler.off(this._element, this.constructor.EVENT_KEY); + for (const propertyName of Object.getOwnPropertyNames(this)) { + this[propertyName] = null; + } + } + + // Private + _queueCallback(callback, element, isAnimated = true) { + executeAfterTransition(callback, element, isAnimated); + } + _getConfig(config) { + config = this._mergeConfigObj(config, this._element); + config = this._configAfterMerge(config); + this._typeCheckConfig(config); + return config; + } + + // Static + static getInstance(element) { + return Data.get(getElement(element), this.DATA_KEY); + } + static getOrCreateInstance(element, config = {}) { + return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null); + } + static get VERSION() { + return VERSION; + } + static get DATA_KEY() { + return `bs.${this.NAME}`; + } + static get EVENT_KEY() { + return `.${this.DATA_KEY}`; + } + static eventName(name) { + return `${name}${this.EVENT_KEY}`; + } + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap dom/selector-engine.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + if (!selector || selector === '#') { + let hrefAttribute = element.getAttribute('href'); + + // The only valid content that could double as a selector are IDs or classes, + // so everything starting with `#` or `.`. If a "real" URL is used as the selector, + // `document.querySelector` will rightfully complain it is invalid. + // See https://github.com/twbs/bootstrap/issues/32273 + if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) { + return null; + } + + // Just in case some CMS puts out a full URL with the anchor appended + if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) { + hrefAttribute = `#${hrefAttribute.split('#')[1]}`; + } + selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null; + } + return selector ? selector.split(',').map(sel => parseSelector(sel)).join(',') : null; + }; + const SelectorEngine = { + find(selector, element = document.documentElement) { + return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); + }, + findOne(selector, element = document.documentElement) { + return Element.prototype.querySelector.call(element, selector); + }, + children(element, selector) { + return [].concat(...element.children).filter(child => child.matches(selector)); + }, + parents(element, selector) { + const parents = []; + let ancestor = element.parentNode.closest(selector); + while (ancestor) { + parents.push(ancestor); + ancestor = ancestor.parentNode.closest(selector); + } + return parents; + }, + prev(element, selector) { + let previous = element.previousElementSibling; + while (previous) { + if (previous.matches(selector)) { + return [previous]; + } + previous = previous.previousElementSibling; + } + return []; + }, + // TODO: this is now unused; remove later along with prev() + next(element, selector) { + let next = element.nextElementSibling; + while (next) { + if (next.matches(selector)) { + return [next]; + } + next = next.nextElementSibling; + } + return []; + }, + focusableChildren(element) { + const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(','); + return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)); + }, + getSelectorFromElement(element) { + const selector = getSelector(element); + if (selector) { + return SelectorEngine.findOne(selector) ? selector : null; + } + return null; + }, + getElementFromSelector(element) { + const selector = getSelector(element); + return selector ? SelectorEngine.findOne(selector) : null; + }, + getMultipleElementsFromSelector(element) { + const selector = getSelector(element); + return selector ? SelectorEngine.find(selector) : []; + } + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/component-functions.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + const enableDismissTrigger = (component, method = 'hide') => { + const clickEvent = `click.dismiss${component.EVENT_KEY}`; + const name = component.NAME; + EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { + if (['A', 'AREA'].includes(this.tagName)) { + event.preventDefault(); + } + if (isDisabled(this)) { + return; + } + const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`); + const instance = component.getOrCreateInstance(target); + + // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method + instance[method](); + }); + }; + + /** + * -------------------------------------------------------------------------- + * Bootstrap alert.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$f = 'alert'; + const DATA_KEY$a = 'bs.alert'; + const EVENT_KEY$b = `.${DATA_KEY$a}`; + const EVENT_CLOSE = `close${EVENT_KEY$b}`; + const EVENT_CLOSED = `closed${EVENT_KEY$b}`; + const CLASS_NAME_FADE$5 = 'fade'; + const CLASS_NAME_SHOW$8 = 'show'; + + /** + * Class definition + */ + + class Alert extends BaseComponent { + // Getters + static get NAME() { + return NAME$f; + } + + // Public + close() { + const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); + if (closeEvent.defaultPrevented) { + return; + } + this._element.classList.remove(CLASS_NAME_SHOW$8); + const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5); + this._queueCallback(() => this._destroyElement(), this._element, isAnimated); + } + + // Private + _destroyElement() { + this._element.remove(); + EventHandler.trigger(this._element, EVENT_CLOSED); + this.dispose(); + } + + // Static + static jQueryInterface(config) { + return this.each(function () { + const data = Alert.getOrCreateInstance(this); + if (typeof config !== 'string') { + return; + } + if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { + throw new TypeError(`No method named "${config}"`); + } + data[config](this); + }); + } + } + + /** + * Data API implementation + */ + + enableDismissTrigger(Alert, 'close'); + + /** + * jQuery + */ + + defineJQueryPlugin(Alert); + + /** + * -------------------------------------------------------------------------- + * Bootstrap button.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$e = 'button'; + const DATA_KEY$9 = 'bs.button'; + const EVENT_KEY$a = `.${DATA_KEY$9}`; + const DATA_API_KEY$6 = '.data-api'; + const CLASS_NAME_ACTIVE$3 = 'active'; + const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; + const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`; + + /** + * Class definition + */ + + class Button extends BaseComponent { + // Getters + static get NAME() { + return NAME$e; + } + + // Public + toggle() { + // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method + this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); + } + + // Static + static jQueryInterface(config) { + return this.each(function () { + const data = Button.getOrCreateInstance(this); + if (config === 'toggle') { + data[config](); + } + }); + } + } + + /** + * Data API implementation + */ + + EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => { + event.preventDefault(); + const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); + const data = Button.getOrCreateInstance(button); + data.toggle(); + }); + + /** + * jQuery + */ + + defineJQueryPlugin(Button); + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/swipe.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$d = '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 = `pointerdown${EVENT_KEY$9}`; + const EVENT_POINTERUP = `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$c = { + endCallback: null, + leftCallback: null, + rightCallback: null + }; + const DefaultType$c = { + endCallback: '(function|null)', + leftCallback: '(function|null)', + rightCallback: '(function|null)' + }; + + /** + * Class definition + */ + + class Swipe extends Config { + constructor(element, config) { + super(); + this._element = element; + if (!element || !Swipe.isSupported()) { + return; + } + this._config = this._getConfig(config); + this._startX = 0; + this._deltaX = 0; + this._supportPointerEvents = Boolean(window.PointerEvent); + this._initEvents(); + } + + // Getters + static get Default() { + return Default$c; + } + static get DefaultType() { + return DefaultType$c; + } + static get NAME() { + return NAME$d; + } + + // Public + dispose() { + EventHandler.off(this._element, EVENT_KEY$9); + } + + // Private + _start(event) { + this._deltaX = 0; + if (!this._supportPointerEvents) { + this._startX = event.touches[0].clientX; + return; + } + if (this._eventIsPointerPenTouch(event)) { + this._startX = event.clientX; + } + } + _end(event) { + if (this._eventIsPointerPenTouch(event)) { + this._deltaX = event.clientX - this._startX; + } + this._handleSwipe(); + execute(this._config.endCallback); + } + _move(event) { + this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._startX; + } + _handleSwipe() { + const absDeltaX = Math.abs(this._deltaX); + if (absDeltaX <= SWIPE_THRESHOLD) { + return; + } + const direction = absDeltaX / this._deltaX; + this._deltaX = 0; + if (!direction) { + return; + } + execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback); + } + _initEvents() { + if (this._supportPointerEvents) { + EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event)); + EventHandler.on(this._element, EVENT_POINTERUP, 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 + static isSupported() { + return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; + } + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap carousel.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$c = 'carousel'; + const DATA_KEY$8 = 'bs.carousel'; + const EVENT_KEY$8 = `.${DATA_KEY$8}`; + const DATA_API_KEY$5 = '.data-api'; + const ARROW_LEFT_KEY$1 = 'ArrowLeft'; + const ARROW_RIGHT_KEY$1 = 'ArrowRight'; + const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch + + const ORDER_NEXT = 'next'; + const ORDER_PREV = 'prev'; + const DIRECTION_LEFT = 'left'; + const DIRECTION_RIGHT = 'right'; + const EVENT_SLIDE = `slide${EVENT_KEY$8}`; + const EVENT_SLID = `slid${EVENT_KEY$8}`; + const EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`; + const EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`; + const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`; + const EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`; + const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`; + const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; + const CLASS_NAME_CAROUSEL = 'carousel'; + const CLASS_NAME_ACTIVE$2 = 'active'; + const CLASS_NAME_SLIDE = 'slide'; + const CLASS_NAME_END = 'carousel-item-end'; + const CLASS_NAME_START = 'carousel-item-start'; + const CLASS_NAME_NEXT = 'carousel-item-next'; + const CLASS_NAME_PREV = 'carousel-item-prev'; + const SELECTOR_ACTIVE = '.active'; + const SELECTOR_ITEM = '.carousel-item'; + const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM; + const SELECTOR_ITEM_IMG = '.carousel-item img'; + const SELECTOR_INDICATORS = '.carousel-indicators'; + const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; + const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; + const KEY_TO_DIRECTION = { + [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT, + [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT + }; + const Default$b = { + interval: 5000, + keyboard: true, + pause: 'hover', + ride: false, + touch: true, + wrap: true + }; + const DefaultType$b = { + interval: '(number|boolean)', + // TODO:v6 remove boolean support + keyboard: 'boolean', + pause: '(string|boolean)', + ride: '(boolean|string)', + touch: 'boolean', + wrap: 'boolean' + }; + + /** + * Class definition + */ + + class Carousel extends BaseComponent { + constructor(element, config) { + super(element, config); + this._interval = null; + this._activeElement = null; + this._isSliding = false; + this.touchTimeout = null; + this._swipeHelper = null; + this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); + this._addEventListeners(); + if (this._config.ride === CLASS_NAME_CAROUSEL) { + this.cycle(); + } + } + + // Getters + static get Default() { + return Default$b; + } + static get DefaultType() { + return DefaultType$b; + } + static get NAME() { + return NAME$c; + } + + // Public + next() { + this._slide(ORDER_NEXT); + } + nextWhenVisible() { + // FIXME TODO use `document.visibilityState` + // Don't call next when the page isn't visible + // or the carousel or its parent isn't visible + if (!document.hidden && isVisible(this._element)) { + this.next(); + } + } + prev() { + this._slide(ORDER_PREV); + } + pause() { + if (this._isSliding) { + triggerTransitionEnd(this._element); + } + this._clearInterval(); + } + cycle() { + this._clearInterval(); + this._updateInterval(); + this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval); + } + _maybeEnableCycle() { + if (!this._config.ride) { + return; + } + if (this._isSliding) { + EventHandler.one(this._element, EVENT_SLID, () => this.cycle()); + return; + } + this.cycle(); + } + to(index) { + const items = this._getItems(); + if (index > items.length - 1 || index < 0) { + return; + } + if (this._isSliding) { + EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); + return; + } + const activeIndex = this._getItemIndex(this._getActive()); + if (activeIndex === index) { + return; + } + const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV; + this._slide(order, items[index]); + } + dispose() { + if (this._swipeHelper) { + this._swipeHelper.dispose(); + } + super.dispose(); + } + + // Private + _configAfterMerge(config) { + config.defaultInterval = config.interval; + return config; + } + _addEventListeners() { + if (this._config.keyboard) { + EventHandler.on(this._element, EVENT_KEYDOWN$1, event => this._keydown(event)); + } + if (this._config.pause === 'hover') { + EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause()); + EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle()); + } + if (this._config.touch && Swipe.isSupported()) { + this._addTouchEventListeners(); + } + } + _addTouchEventListeners() { + for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) { + EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault()); + } + const endCallBack = () => { + if (this._config.pause !== 'hover') { + return; + } + + // If it's a touch-enabled device, mouseenter/leave are fired as + // part of the mouse compatibility events on first tap - the carousel + // would stop cycling until user tapped out of it; + // here, we listen for touchend, explicitly pause the carousel + // (as if it's the second time we tap on it, mouseenter compat event + // is NOT fired) and after a timeout (to allow for mouse compatibility + // events to fire) we explicitly restart cycling + + this.pause(); + if (this.touchTimeout) { + clearTimeout(this.touchTimeout); + } + this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval); + }; + const swipeConfig = { + leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)), + rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)), + endCallback: endCallBack + }; + this._swipeHelper = new Swipe(this._element, swipeConfig); + } + _keydown(event) { + if (/input|textarea/i.test(event.target.tagName)) { + return; + } + const direction = KEY_TO_DIRECTION[event.key]; + if (direction) { + event.preventDefault(); + this._slide(this._directionToOrder(direction)); + } + } + _getItemIndex(element) { + return this._getItems().indexOf(element); + } + _setActiveIndicatorElement(index) { + if (!this._indicatorsElement) { + return; + } + const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement); + if (activeIndicator) { + activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2); + activeIndicator.removeAttribute('aria-current'); + } + const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement); + if (newActiveIndicator) { + newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2); + newActiveIndicator.setAttribute('aria-current', 'true'); + } + } + _updateInterval() { + const element = this._activeElement || this._getActive(); + if (!element) { + return; + } + const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); + this._config.interval = elementInterval || this._config.defaultInterval; + } + _slide(order, element = null) { + if (this._isSliding) { + return; + } + const activeElement = this._getActive(); + const isNext = order === ORDER_NEXT; + const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap); + if (nextElement === activeElement) { + return; + } + const nextElementIndex = this._getItemIndex(nextElement); + const triggerEvent = eventName => { + return EventHandler.trigger(this._element, eventName, { + relatedTarget: nextElement, + direction: this._orderToDirection(order), + from: this._getItemIndex(activeElement), + to: nextElementIndex + }); + }; + const slideEvent = triggerEvent(EVENT_SLIDE); + if (slideEvent.defaultPrevented) { + return; + } + if (!activeElement || !nextElement) { + // Some weirdness is happening, so we bail + // TODO: change tests that use empty divs to avoid this check + return; + } + const isCycling = Boolean(this._interval); + this.pause(); + this._isSliding = true; + this._setActiveIndicatorElement(nextElementIndex); + this._activeElement = nextElement; + const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END; + const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV; + nextElement.classList.add(orderClassName); + reflow(nextElement); + activeElement.classList.add(directionalClassName); + nextElement.classList.add(directionalClassName); + const completeCallBack = () => { + nextElement.classList.remove(directionalClassName, orderClassName); + nextElement.classList.add(CLASS_NAME_ACTIVE$2); + activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName); + this._isSliding = false; + triggerEvent(EVENT_SLID); + }; + this._queueCallback(completeCallBack, activeElement, this._isAnimated()); + if (isCycling) { + this.cycle(); + } + } + _isAnimated() { + return this._element.classList.contains(CLASS_NAME_SLIDE); + } + _getActive() { + return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + } + _getItems() { + return SelectorEngine.find(SELECTOR_ITEM, this._element); + } + _clearInterval() { + if (this._interval) { + clearInterval(this._interval); + this._interval = null; + } + } + _directionToOrder(direction) { + if (isRTL()) { + return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT; + } + return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV; + } + _orderToDirection(order) { + if (isRTL()) { + return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT; + } + + // Static + static jQueryInterface(config) { + return this.each(function () { + const data = Carousel.getOrCreateInstance(this, config); + if (typeof config === 'number') { + data.to(config); + return; + } + if (typeof config === 'string') { + if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { + throw new TypeError(`No method named "${config}"`); + } + data[config](); + } + }); + } + } + + /** + * Data API implementation + */ + + EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function (event) { + const target = SelectorEngine.getElementFromSelector(this); + if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { + return; + } + event.preventDefault(); + const carousel = Carousel.getOrCreateInstance(target); + const slideIndex = this.getAttribute('data-bs-slide-to'); + if (slideIndex) { + carousel.to(slideIndex); + carousel._maybeEnableCycle(); + return; + } + if (Manipulator.getDataAttribute(this, 'slide') === 'next') { + carousel.next(); + carousel._maybeEnableCycle(); + return; + } + carousel.prev(); + carousel._maybeEnableCycle(); + }); + EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => { + const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); + for (const carousel of carousels) { + Carousel.getOrCreateInstance(carousel); + } + }); + + /** + * jQuery + */ + + defineJQueryPlugin(Carousel); + + /** + * -------------------------------------------------------------------------- + * Bootstrap collapse.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$b = 'collapse'; + const DATA_KEY$7 = 'bs.collapse'; + const EVENT_KEY$7 = `.${DATA_KEY$7}`; + const DATA_API_KEY$4 = '.data-api'; + const EVENT_SHOW$6 = `show${EVENT_KEY$7}`; + const EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`; + const EVENT_HIDE$6 = `hide${EVENT_KEY$7}`; + const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`; + const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; + const CLASS_NAME_SHOW$7 = 'show'; + const CLASS_NAME_COLLAPSE = 'collapse'; + const CLASS_NAME_COLLAPSING = 'collapsing'; + const CLASS_NAME_COLLAPSED = 'collapsed'; + const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; + const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; + const WIDTH = 'width'; + const HEIGHT = 'height'; + const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; + const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; + const Default$a = { + parent: null, + toggle: true + }; + const DefaultType$a = { + parent: '(null|element)', + toggle: 'boolean' + }; + + /** + * Class definition + */ + + class Collapse extends BaseComponent { + constructor(element, config) { + super(element, config); + this._isTransitioning = false; + this._triggerArray = []; + const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); + for (const elem of toggleList) { + const selector = SelectorEngine.getSelectorFromElement(elem); + const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element); + if (selector !== null && filterElement.length) { + this._triggerArray.push(elem); + } + } + this._initializeChildren(); + if (!this._config.parent) { + this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); + } + if (this._config.toggle) { + this.toggle(); + } + } + + // Getters + static get Default() { + return Default$a; + } + static get DefaultType() { + return DefaultType$a; + } + static get NAME() { + return NAME$b; + } + + // Public + toggle() { + if (this._isShown()) { + this.hide(); + } else { + this.show(); + } + } + show() { + if (this._isTransitioning || this._isShown()) { + return; + } + let activeChildren = []; + + // find active children + if (this._config.parent) { + activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, { + toggle: false + })); + } + if (activeChildren.length && activeChildren[0]._isTransitioning) { + return; + } + const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6); + if (startEvent.defaultPrevented) { + return; + } + for (const activeInstance of activeChildren) { + activeInstance.hide(); + } + const dimension = this._getDimension(); + this._element.classList.remove(CLASS_NAME_COLLAPSE); + this._element.classList.add(CLASS_NAME_COLLAPSING); + this._element.style[dimension] = 0; + this._addAriaAndCollapsedClass(this._triggerArray, true); + this._isTransitioning = true; + const complete = () => { + this._isTransitioning = false; + this._element.classList.remove(CLASS_NAME_COLLAPSING); + this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); + this._element.style[dimension] = ''; + EventHandler.trigger(this._element, EVENT_SHOWN$6); + }; + const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); + const scrollSize = `scroll${capitalizedDimension}`; + this._queueCallback(complete, this._element, true); + this._element.style[dimension] = `${this._element[scrollSize]}px`; + } + hide() { + if (this._isTransitioning || !this._isShown()) { + return; + } + const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6); + if (startEvent.defaultPrevented) { + return; + } + const dimension = this._getDimension(); + this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; + reflow(this._element); + this._element.classList.add(CLASS_NAME_COLLAPSING); + this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); + for (const trigger of this._triggerArray) { + const element = SelectorEngine.getElementFromSelector(trigger); + if (element && !this._isShown(element)) { + this._addAriaAndCollapsedClass([trigger], false); + } + } + this._isTransitioning = true; + const complete = () => { + this._isTransitioning = false; + this._element.classList.remove(CLASS_NAME_COLLAPSING); + this._element.classList.add(CLASS_NAME_COLLAPSE); + EventHandler.trigger(this._element, EVENT_HIDDEN$6); + }; + this._element.style[dimension] = ''; + this._queueCallback(complete, this._element, true); + } + + // Private + _isShown(element = this._element) { + return element.classList.contains(CLASS_NAME_SHOW$7); + } + _configAfterMerge(config) { + config.toggle = Boolean(config.toggle); // Coerce string values + config.parent = getElement(config.parent); + return config; + } + _getDimension() { + return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; + } + _initializeChildren() { + if (!this._config.parent) { + return; + } + const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4); + for (const element of children) { + const selected = SelectorEngine.getElementFromSelector(element); + if (selected) { + this._addAriaAndCollapsedClass([element], this._isShown(selected)); + } + } + } + _getFirstLevelChildren(selector) { + const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); + // remove children if greater depth + return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element)); + } + _addAriaAndCollapsedClass(triggerArray, isOpen) { + if (!triggerArray.length) { + return; + } + for (const element of triggerArray) { + element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen); + element.setAttribute('aria-expanded', isOpen); + } + } + + // Static + static jQueryInterface(config) { + const _config = {}; + if (typeof config === 'string' && /show|hide/.test(config)) { + _config.toggle = false; + } + return this.each(function () { + const data = Collapse.getOrCreateInstance(this, _config); + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`); + } + data[config](); + } + }); + } + } + + /** + * Data API implementation + */ + + EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) { + // preventDefault only for
elements (which change the URL) not inside the collapsible element + if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { + event.preventDefault(); + } + for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) { + Collapse.getOrCreateInstance(element, { + toggle: false + }).toggle(); + } + }); + + /** + * jQuery + */ + + defineJQueryPlugin(Collapse); + + var top = 'top'; + var bottom = 'bottom'; + var right = 'right'; + var left = 'left'; + var auto = 'auto'; + var basePlacements = [top, bottom, right, left]; + var start = 'start'; + var end = 'end'; + var clippingParents = 'clippingParents'; + var viewport = 'viewport'; + var popper = 'popper'; + var reference = 'reference'; + var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) { + return acc.concat([placement + "-" + start, placement + "-" + end]); + }, []); + var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) { + return acc.concat([placement, placement + "-" + start, placement + "-" + end]); + }, []); // modifiers that need to read the DOM + + var beforeRead = 'beforeRead'; + var read = 'read'; + var afterRead = 'afterRead'; // pure-logic modifiers + + var beforeMain = 'beforeMain'; + var main = 'main'; + var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) + + var beforeWrite = 'beforeWrite'; + var write = 'write'; + var afterWrite = 'afterWrite'; + var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite]; + + function getNodeName(element) { + return element ? (element.nodeName || '').toLowerCase() : null; + } + + function getWindow(node) { + if (node == null) { + return window; + } + + if (node.toString() !== '[object Window]') { + var ownerDocument = node.ownerDocument; + return ownerDocument ? ownerDocument.defaultView || window : window; + } + + return node; + } + + function isElement(node) { + var OwnElement = getWindow(node).Element; + return node instanceof OwnElement || node instanceof Element; + } + + function isHTMLElement(node) { + var OwnElement = getWindow(node).HTMLElement; + return node instanceof OwnElement || node instanceof HTMLElement; + } + + function isShadowRoot(node) { + // IE 11 has no ShadowRoot + if (typeof ShadowRoot === 'undefined') { + return false; + } + + var OwnElement = getWindow(node).ShadowRoot; + return node instanceof OwnElement || node instanceof ShadowRoot; + } + + // and applies them to the HTMLElements such as popper and arrow + + function applyStyles(_ref) { + var state = _ref.state; + Object.keys(state.elements).forEach(function (name) { + var style = state.styles[name] || {}; + var attributes = state.attributes[name] || {}; + var element = state.elements[name]; // arrow is optional + virtual elements + + if (!isHTMLElement(element) || !getNodeName(element)) { + return; + } // Flow doesn't support to extend this property, but it's the most + // effective way to apply styles to an HTMLElement + // $FlowFixMe[cannot-write] + + + Object.assign(element.style, style); + Object.keys(attributes).forEach(function (name) { + var value = attributes[name]; + + if (value === false) { + element.removeAttribute(name); + } else { + element.setAttribute(name, value === true ? '' : value); + } + }); + }); + } + + function effect$2(_ref2) { + var state = _ref2.state; + var initialStyles = { + popper: { + position: state.options.strategy, + left: '0', + top: '0', + margin: '0' + }, + arrow: { + position: 'absolute' + }, + reference: {} + }; + Object.assign(state.elements.popper.style, initialStyles.popper); + state.styles = initialStyles; + + if (state.elements.arrow) { + Object.assign(state.elements.arrow.style, initialStyles.arrow); + } + + return function () { + Object.keys(state.elements).forEach(function (name) { + var element = state.elements[name]; + var attributes = state.attributes[name] || {}; + var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them + + var style = styleProperties.reduce(function (style, property) { + style[property] = ''; + return style; + }, {}); // arrow is optional + virtual elements + + if (!isHTMLElement(element) || !getNodeName(element)) { + return; + } + + Object.assign(element.style, style); + Object.keys(attributes).forEach(function (attribute) { + element.removeAttribute(attribute); + }); + }); + }; + } // eslint-disable-next-line import/no-unused-modules + + + const applyStyles$1 = { + name: 'applyStyles', + enabled: true, + phase: 'write', + fn: applyStyles, + effect: effect$2, + requires: ['computeStyles'] + }; + + function getBasePlacement(placement) { + return placement.split('-')[0]; + } + + var max = Math.max; + var min = Math.min; + var round = Math.round; + + function getUAString() { + var uaData = navigator.userAgentData; + + if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) { + return uaData.brands.map(function (item) { + return item.brand + "/" + item.version; + }).join(' '); + } + + return navigator.userAgent; + } + + function isLayoutViewport() { + return !/^((?!chrome|android).)*safari/i.test(getUAString()); + } + + function getBoundingClientRect(element, includeScale, isFixedStrategy) { + if (includeScale === void 0) { + includeScale = false; + } + + if (isFixedStrategy === void 0) { + isFixedStrategy = false; + } + + var clientRect = element.getBoundingClientRect(); + var scaleX = 1; + var scaleY = 1; + + if (includeScale && isHTMLElement(element)) { + scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1; + scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1; + } + + var _ref = isElement(element) ? getWindow(element) : window, + visualViewport = _ref.visualViewport; + + var addVisualOffsets = !isLayoutViewport() && isFixedStrategy; + var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX; + var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY; + var width = clientRect.width / scaleX; + var height = clientRect.height / scaleY; + return { + width: width, + height: height, + top: y, + right: x + width, + bottom: y + height, + left: x, + x: x, + y: y + }; + } + + // means it doesn't take into account transforms. + + function getLayoutRect(element) { + var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed. + // Fixes https://github.com/popperjs/popper-core/issues/1223 + + var width = element.offsetWidth; + var height = element.offsetHeight; + + if (Math.abs(clientRect.width - width) <= 1) { + width = clientRect.width; + } + + if (Math.abs(clientRect.height - height) <= 1) { + height = clientRect.height; + } + + return { + x: element.offsetLeft, + y: element.offsetTop, + width: width, + height: height + }; + } + + function contains(parent, child) { + var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method + + if (parent.contains(child)) { + return true; + } // then fallback to custom implementation with Shadow DOM support + else if (rootNode && isShadowRoot(rootNode)) { + var next = child; + + do { + if (next && parent.isSameNode(next)) { + return true; + } // $FlowFixMe[prop-missing]: need a better way to handle this... + + + next = next.parentNode || next.host; + } while (next); + } // Give up, the result is false + + + return false; + } + + function getComputedStyle$1(element) { + return getWindow(element).getComputedStyle(element); + } + + function isTableElement(element) { + return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0; + } + + function getDocumentElement(element) { + // $FlowFixMe[incompatible-return]: assume body is always available + return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing] + element.document) || window.document).documentElement; + } + + function getParentNode(element) { + if (getNodeName(element) === 'html') { + return element; + } + + return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle + // $FlowFixMe[incompatible-return] + // $FlowFixMe[prop-missing] + element.assignedSlot || // step into the shadow DOM of the parent of a slotted node + element.parentNode || ( // DOM Element detected + isShadowRoot(element) ? element.host : null) || // ShadowRoot detected + // $FlowFixMe[incompatible-call]: HTMLElement is a Node + getDocumentElement(element) // fallback + + ); + } + + function getTrueOffsetParent(element) { + if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837 + getComputedStyle$1(element).position === 'fixed') { + return null; + } + + return element.offsetParent; + } // `.offsetParent` reports `null` for fixed elements, while absolute elements + // return the containing block + + + function getContainingBlock(element) { + var isFirefox = /firefox/i.test(getUAString()); + var isIE = /Trident/i.test(getUAString()); + + if (isIE && isHTMLElement(element)) { + // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport + var elementCss = getComputedStyle$1(element); + + if (elementCss.position === 'fixed') { + return null; + } + } + + var currentNode = getParentNode(element); + + if (isShadowRoot(currentNode)) { + currentNode = currentNode.host; + } + + while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) { + var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that + // create a containing block. + // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block + + 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') { + return currentNode; + } else { + currentNode = currentNode.parentNode; + } + } + + return null; + } // Gets the closest ancestor positioned element. Handles some edge cases, + // such as table ancestors and cross browser bugs. + + + function getOffsetParent(element) { + var window = getWindow(element); + var offsetParent = getTrueOffsetParent(element); + + while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') { + offsetParent = getTrueOffsetParent(offsetParent); + } + + if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) { + return window; + } + + return offsetParent || getContainingBlock(element) || window; + } + + function getMainAxisFromPlacement(placement) { + return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; + } + + function within(min$1, value, max$1) { + return max(min$1, min(value, max$1)); + } + function withinMaxClamp(min, value, max) { + var v = within(min, value, max); + return v > max ? max : v; + } + + function getFreshSideObject() { + return { + top: 0, + right: 0, + bottom: 0, + left: 0 + }; + } + + function mergePaddingObject(paddingObject) { + return Object.assign({}, getFreshSideObject(), paddingObject); + } + + function expandToHashMap(value, keys) { + return keys.reduce(function (hashMap, key) { + hashMap[key] = value; + return hashMap; + }, {}); + } + + var toPaddingObject = function toPaddingObject(padding, state) { + padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, { + placement: state.placement + })) : padding; + return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); + }; + + function arrow(_ref) { + var _state$modifiersData$; + + var state = _ref.state, + name = _ref.name, + options = _ref.options; + var arrowElement = state.elements.arrow; + var popperOffsets = state.modifiersData.popperOffsets; + var basePlacement = getBasePlacement(state.placement); + var axis = getMainAxisFromPlacement(basePlacement); + var isVertical = [left, right].indexOf(basePlacement) >= 0; + var len = isVertical ? 'height' : 'width'; + + if (!arrowElement || !popperOffsets) { + return; + } + + var paddingObject = toPaddingObject(options.padding, state); + var arrowRect = getLayoutRect(arrowElement); + var minProp = axis === 'y' ? top : left; + var maxProp = axis === 'y' ? bottom : right; + var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; + var startDiff = popperOffsets[axis] - state.rects.reference[axis]; + var arrowOffsetParent = getOffsetParent(arrowElement); + var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; + var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is + // outside of the popper bounds + + var min = paddingObject[minProp]; + var max = clientSize - arrowRect[len] - paddingObject[maxProp]; + var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; + var offset = within(min, center, max); // Prevents breaking syntax highlighting... + + var axisProp = axis; + state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); + } + + function effect$1(_ref2) { + var state = _ref2.state, + options = _ref2.options; + var _options$element = options.element, + arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element; + + if (arrowElement == null) { + return; + } // CSS selector + + + if (typeof arrowElement === 'string') { + arrowElement = state.elements.popper.querySelector(arrowElement); + + if (!arrowElement) { + return; + } + } + + if (!contains(state.elements.popper, arrowElement)) { + return; + } + + state.elements.arrow = arrowElement; + } // eslint-disable-next-line import/no-unused-modules + + + const arrow$1 = { + name: 'arrow', + enabled: true, + phase: 'main', + fn: arrow, + effect: effect$1, + requires: ['popperOffsets'], + requiresIfExists: ['preventOverflow'] + }; + + function getVariation(placement) { + return placement.split('-')[1]; + } + + var unsetSides = { + top: 'auto', + right: 'auto', + bottom: 'auto', + left: 'auto' + }; // Round the offsets to the nearest suitable subpixel based on the DPR. + // Zooming can change the DPR, but it seems to report a value that will + // cleanly divide the values into the appropriate subpixels. + + function roundOffsetsByDPR(_ref, win) { + var x = _ref.x, + y = _ref.y; + var dpr = win.devicePixelRatio || 1; + return { + x: round(x * dpr) / dpr || 0, + y: round(y * dpr) / dpr || 0 + }; + } + + function mapToStyles(_ref2) { + var _Object$assign2; + + var popper = _ref2.popper, + popperRect = _ref2.popperRect, + placement = _ref2.placement, + variation = _ref2.variation, + offsets = _ref2.offsets, + position = _ref2.position, + gpuAcceleration = _ref2.gpuAcceleration, + adaptive = _ref2.adaptive, + roundOffsets = _ref2.roundOffsets, + isFixed = _ref2.isFixed; + var _offsets$x = offsets.x, + x = _offsets$x === void 0 ? 0 : _offsets$x, + _offsets$y = offsets.y, + y = _offsets$y === void 0 ? 0 : _offsets$y; + + var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({ + x: x, + y: y + }) : { + x: x, + y: y + }; + + x = _ref3.x; + y = _ref3.y; + var hasX = offsets.hasOwnProperty('x'); + var hasY = offsets.hasOwnProperty('y'); + var sideX = left; + var sideY = top; + var win = window; + + if (adaptive) { + var offsetParent = getOffsetParent(popper); + var heightProp = 'clientHeight'; + var widthProp = 'clientWidth'; + + if (offsetParent === getWindow(popper)) { + offsetParent = getDocumentElement(popper); + + if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') { + heightProp = 'scrollHeight'; + widthProp = 'scrollWidth'; + } + } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it + + + offsetParent = offsetParent; + + if (placement === top || (placement === left || placement === right) && variation === end) { + sideY = bottom; + var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing] + offsetParent[heightProp]; + y -= offsetY - popperRect.height; + y *= gpuAcceleration ? 1 : -1; + } + + if (placement === left || (placement === top || placement === bottom) && variation === end) { + sideX = right; + var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing] + offsetParent[widthProp]; + x -= offsetX - popperRect.width; + x *= gpuAcceleration ? 1 : -1; + } + } + + var commonStyles = Object.assign({ + position: position + }, adaptive && unsetSides); + + var _ref4 = roundOffsets === true ? roundOffsetsByDPR({ + x: x, + y: y + }, getWindow(popper)) : { + x: x, + y: y + }; + + x = _ref4.x; + y = _ref4.y; + + if (gpuAcceleration) { + var _Object$assign; + + 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)); + } + + return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); + } + + function computeStyles(_ref5) { + var state = _ref5.state, + options = _ref5.options; + var _options$gpuAccelerat = options.gpuAcceleration, + gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, + _options$adaptive = options.adaptive, + adaptive = _options$adaptive === void 0 ? true : _options$adaptive, + _options$roundOffsets = options.roundOffsets, + roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets; + var commonStyles = { + placement: getBasePlacement(state.placement), + variation: getVariation(state.placement), + popper: state.elements.popper, + popperRect: state.rects.popper, + gpuAcceleration: gpuAcceleration, + isFixed: state.options.strategy === 'fixed' + }; + + if (state.modifiersData.popperOffsets != null) { + state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, { + offsets: state.modifiersData.popperOffsets, + position: state.options.strategy, + adaptive: adaptive, + roundOffsets: roundOffsets + }))); + } + + if (state.modifiersData.arrow != null) { + state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, { + offsets: state.modifiersData.arrow, + position: 'absolute', + adaptive: false, + roundOffsets: roundOffsets + }))); + } + + state.attributes.popper = Object.assign({}, state.attributes.popper, { + 'data-popper-placement': state.placement + }); + } // eslint-disable-next-line import/no-unused-modules + + + const computeStyles$1 = { + name: 'computeStyles', + enabled: true, + phase: 'beforeWrite', + fn: computeStyles, + data: {} + }; + + var passive = { + passive: true + }; + + function effect(_ref) { + var state = _ref.state, + instance = _ref.instance, + options = _ref.options; + var _options$scroll = options.scroll, + scroll = _options$scroll === void 0 ? true : _options$scroll, + _options$resize = options.resize, + resize = _options$resize === void 0 ? true : _options$resize; + var window = getWindow(state.elements.popper); + var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); + + if (scroll) { + scrollParents.forEach(function (scrollParent) { + scrollParent.addEventListener('scroll', instance.update, passive); + }); + } + + if (resize) { + window.addEventListener('resize', instance.update, passive); + } + + return function () { + if (scroll) { + scrollParents.forEach(function (scrollParent) { + scrollParent.removeEventListener('scroll', instance.update, passive); + }); + } + + if (resize) { + window.removeEventListener('resize', instance.update, passive); + } + }; + } // eslint-disable-next-line import/no-unused-modules + + + const eventListeners = { + name: 'eventListeners', + enabled: true, + phase: 'write', + fn: function fn() {}, + effect: effect, + data: {} + }; + + var hash$1 = { + left: 'right', + right: 'left', + bottom: 'top', + top: 'bottom' + }; + function getOppositePlacement(placement) { + return placement.replace(/left|right|bottom|top/g, function (matched) { + return hash$1[matched]; + }); + } + + var hash = { + start: 'end', + end: 'start' + }; + function getOppositeVariationPlacement(placement) { + return placement.replace(/start|end/g, function (matched) { + return hash[matched]; + }); + } + + function getWindowScroll(node) { + var win = getWindow(node); + var scrollLeft = win.pageXOffset; + var scrollTop = win.pageYOffset; + return { + scrollLeft: scrollLeft, + scrollTop: scrollTop + }; + } + + function getWindowScrollBarX(element) { + // If has a CSS width greater than the viewport, then this will be + // incorrect for RTL. + // Popper 1 is broken in this case and never had a bug report so let's assume + // it's not an issue. I don't think anyone ever specifies width on + // anyway. + // Browsers where the left scrollbar doesn't cause an issue report `0` for + // this (e.g. Edge 2019, IE11, Safari) + return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft; + } + + function getViewportRect(element, strategy) { + var win = getWindow(element); + var html = getDocumentElement(element); + var visualViewport = win.visualViewport; + var width = html.clientWidth; + var height = html.clientHeight; + var x = 0; + var y = 0; + + if (visualViewport) { + width = visualViewport.width; + height = visualViewport.height; + var layoutViewport = isLayoutViewport(); + + if (layoutViewport || !layoutViewport && strategy === 'fixed') { + x = visualViewport.offsetLeft; + y = visualViewport.offsetTop; + } + } + + return { + width: width, + height: height, + x: x + getWindowScrollBarX(element), + y: y + }; + } + + // of the `` and `` rect bounds if horizontally scrollable + + function getDocumentRect(element) { + var _element$ownerDocumen; + + var html = getDocumentElement(element); + var winScroll = getWindowScroll(element); + var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; + var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); + var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); + var x = -winScroll.scrollLeft + getWindowScrollBarX(element); + var y = -winScroll.scrollTop; + + if (getComputedStyle$1(body || html).direction === 'rtl') { + x += max(html.clientWidth, body ? body.clientWidth : 0) - width; + } + + return { + width: width, + height: height, + x: x, + y: y + }; + } + + function isScrollParent(element) { + // Firefox wants us to check `-x` and `-y` variations as well + var _getComputedStyle = getComputedStyle$1(element), + overflow = _getComputedStyle.overflow, + overflowX = _getComputedStyle.overflowX, + overflowY = _getComputedStyle.overflowY; + + return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); + } + + function getScrollParent(node) { + if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) { + // $FlowFixMe[incompatible-return]: assume body is always available + return node.ownerDocument.body; + } + + if (isHTMLElement(node) && isScrollParent(node)) { + return node; + } + + return getScrollParent(getParentNode(node)); + } + + /* + given a DOM element, return the list of all scroll parents, up the list of ancesors + until we get to the top window object. This list is what we attach scroll listeners + to, because if any of these parent elements scroll, we'll need to re-calculate the + reference element's position. + */ + + function listScrollParents(element, list) { + var _element$ownerDocumen; + + if (list === void 0) { + list = []; + } + + var scrollParent = getScrollParent(element); + var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body); + var win = getWindow(scrollParent); + var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent; + var updatedList = list.concat(target); + return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here + updatedList.concat(listScrollParents(getParentNode(target))); + } + + function rectToClientRect(rect) { + return Object.assign({}, rect, { + left: rect.x, + top: rect.y, + right: rect.x + rect.width, + bottom: rect.y + rect.height + }); + } + + function getInnerBoundingClientRect(element, strategy) { + var rect = getBoundingClientRect(element, false, strategy === 'fixed'); + rect.top = rect.top + element.clientTop; + rect.left = rect.left + element.clientLeft; + rect.bottom = rect.top + element.clientHeight; + rect.right = rect.left + element.clientWidth; + rect.width = element.clientWidth; + rect.height = element.clientHeight; + rect.x = rect.left; + rect.y = rect.top; + return rect; + } + + function getClientRectFromMixedType(element, clippingParent, strategy) { + return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element))); + } // A "clipping parent" is an overflowable container with the characteristic of + // clipping (or hiding) overflowing elements with a position different from + // `initial` + + + function getClippingParents(element) { + var clippingParents = listScrollParents(getParentNode(element)); + var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0; + var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; + + if (!isElement(clipperElement)) { + return []; + } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414 + + + return clippingParents.filter(function (clippingParent) { + return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'; + }); + } // Gets the maximum area that the element is visible in due to any number of + // clipping parents + + + function getClippingRect(element, boundary, rootBoundary, strategy) { + var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary); + var clippingParents = [].concat(mainClippingParents, [rootBoundary]); + var firstClippingParent = clippingParents[0]; + var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { + var rect = getClientRectFromMixedType(element, clippingParent, strategy); + accRect.top = max(rect.top, accRect.top); + accRect.right = min(rect.right, accRect.right); + accRect.bottom = min(rect.bottom, accRect.bottom); + accRect.left = max(rect.left, accRect.left); + return accRect; + }, getClientRectFromMixedType(element, firstClippingParent, strategy)); + clippingRect.width = clippingRect.right - clippingRect.left; + clippingRect.height = clippingRect.bottom - clippingRect.top; + clippingRect.x = clippingRect.left; + clippingRect.y = clippingRect.top; + return clippingRect; + } + + function computeOffsets(_ref) { + var reference = _ref.reference, + element = _ref.element, + placement = _ref.placement; + var basePlacement = placement ? getBasePlacement(placement) : null; + var variation = placement ? getVariation(placement) : null; + var commonX = reference.x + reference.width / 2 - element.width / 2; + var commonY = reference.y + reference.height / 2 - element.height / 2; + var offsets; + + switch (basePlacement) { + case top: + offsets = { + x: commonX, + y: reference.y - element.height + }; + break; + + case bottom: + offsets = { + x: commonX, + y: reference.y + reference.height + }; + break; + + case right: + offsets = { + x: reference.x + reference.width, + y: commonY + }; + break; + + case left: + offsets = { + x: reference.x - element.width, + y: commonY + }; + break; + + default: + offsets = { + x: reference.x, + y: reference.y + }; + } + + var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; + + if (mainAxis != null) { + var len = mainAxis === 'y' ? 'height' : 'width'; + + switch (variation) { + case start: + offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2); + break; + + case end: + offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2); + break; + } + } + + return offsets; + } + + function detectOverflow(state, options) { + if (options === void 0) { + options = {}; + } + + var _options = options, + _options$placement = _options.placement, + placement = _options$placement === void 0 ? state.placement : _options$placement, + _options$strategy = _options.strategy, + strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, + _options$boundary = _options.boundary, + boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, + _options$rootBoundary = _options.rootBoundary, + rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, + _options$elementConte = _options.elementContext, + elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, + _options$altBoundary = _options.altBoundary, + altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, + _options$padding = _options.padding, + padding = _options$padding === void 0 ? 0 : _options$padding; + var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); + var altContext = elementContext === popper ? reference : popper; + var popperRect = state.rects.popper; + var element = state.elements[altBoundary ? altContext : elementContext]; + var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy); + var referenceClientRect = getBoundingClientRect(state.elements.reference); + var popperOffsets = computeOffsets({ + reference: referenceClientRect, + element: popperRect, + placement: placement + }); + var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets)); + var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect + // 0 or negative = within the clipping rect + + var overflowOffsets = { + top: clippingClientRect.top - elementClientRect.top + paddingObject.top, + bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, + left: clippingClientRect.left - elementClientRect.left + paddingObject.left, + right: elementClientRect.right - clippingClientRect.right + paddingObject.right + }; + var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element + + if (elementContext === popper && offsetData) { + var offset = offsetData[placement]; + Object.keys(overflowOffsets).forEach(function (key) { + var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; + var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x'; + overflowOffsets[key] += offset[axis] * multiply; + }); + } + + return overflowOffsets; + } + + function computeAutoPlacement(state, options) { + if (options === void 0) { + options = {}; + } + + var _options = options, + placement = _options.placement, + boundary = _options.boundary, + rootBoundary = _options.rootBoundary, + padding = _options.padding, + flipVariations = _options.flipVariations, + _options$allowedAutoP = _options.allowedAutoPlacements, + allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP; + var variation = getVariation(placement); + var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) { + return getVariation(placement) === variation; + }) : basePlacements; + var allowedPlacements = placements$1.filter(function (placement) { + return allowedAutoPlacements.indexOf(placement) >= 0; + }); + + if (allowedPlacements.length === 0) { + allowedPlacements = placements$1; + } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions... + + + var overflows = allowedPlacements.reduce(function (acc, placement) { + acc[placement] = detectOverflow(state, { + placement: placement, + boundary: boundary, + rootBoundary: rootBoundary, + padding: padding + })[getBasePlacement(placement)]; + return acc; + }, {}); + return Object.keys(overflows).sort(function (a, b) { + return overflows[a] - overflows[b]; + }); + } + + function getExpandedFallbackPlacements(placement) { + if (getBasePlacement(placement) === auto) { + return []; + } + + var oppositePlacement = getOppositePlacement(placement); + return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)]; + } + + function flip(_ref) { + var state = _ref.state, + options = _ref.options, + name = _ref.name; + + if (state.modifiersData[name]._skip) { + return; + } + + var _options$mainAxis = options.mainAxis, + checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, + _options$altAxis = options.altAxis, + checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, + specifiedFallbackPlacements = options.fallbackPlacements, + padding = options.padding, + boundary = options.boundary, + rootBoundary = options.rootBoundary, + altBoundary = options.altBoundary, + _options$flipVariatio = options.flipVariations, + flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, + allowedAutoPlacements = options.allowedAutoPlacements; + var preferredPlacement = state.options.placement; + var basePlacement = getBasePlacement(preferredPlacement); + var isBasePlacement = basePlacement === preferredPlacement; + var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); + var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { + return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, { + placement: placement, + boundary: boundary, + rootBoundary: rootBoundary, + padding: padding, + flipVariations: flipVariations, + allowedAutoPlacements: allowedAutoPlacements + }) : placement); + }, []); + var referenceRect = state.rects.reference; + var popperRect = state.rects.popper; + var checksMap = new Map(); + var makeFallbackChecks = true; + var firstFittingPlacement = placements[0]; + + for (var i = 0; i < placements.length; i++) { + var placement = placements[i]; + + var _basePlacement = getBasePlacement(placement); + + var isStartVariation = getVariation(placement) === start; + var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; + var len = isVertical ? 'width' : 'height'; + var overflow = detectOverflow(state, { + placement: placement, + boundary: boundary, + rootBoundary: rootBoundary, + altBoundary: altBoundary, + padding: padding + }); + var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top; + + if (referenceRect[len] > popperRect[len]) { + mainVariationSide = getOppositePlacement(mainVariationSide); + } + + var altVariationSide = getOppositePlacement(mainVariationSide); + var checks = []; + + if (checkMainAxis) { + checks.push(overflow[_basePlacement] <= 0); + } + + if (checkAltAxis) { + checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); + } + + if (checks.every(function (check) { + return check; + })) { + firstFittingPlacement = placement; + makeFallbackChecks = false; + break; + } + + checksMap.set(placement, checks); + } + + if (makeFallbackChecks) { + // `2` may be desired in some cases – research later + var numberOfChecks = flipVariations ? 3 : 1; + + var _loop = function _loop(_i) { + var fittingPlacement = placements.find(function (placement) { + var checks = checksMap.get(placement); + + if (checks) { + return checks.slice(0, _i).every(function (check) { + return check; + }); + } + }); + + if (fittingPlacement) { + firstFittingPlacement = fittingPlacement; + return "break"; + } + }; + + for (var _i = numberOfChecks; _i > 0; _i--) { + var _ret = _loop(_i); + + if (_ret === "break") break; + } + } + + if (state.placement !== firstFittingPlacement) { + state.modifiersData[name]._skip = true; + state.placement = firstFittingPlacement; + state.reset = true; + } + } // eslint-disable-next-line import/no-unused-modules + + + const flip$1 = { + name: 'flip', + enabled: true, + phase: 'main', + fn: flip, + requiresIfExists: ['offset'], + data: { + _skip: false + } + }; + + function getSideOffsets(overflow, rect, preventedOffsets) { + if (preventedOffsets === void 0) { + preventedOffsets = { + x: 0, + y: 0 + }; + } + + return { + top: overflow.top - rect.height - preventedOffsets.y, + right: overflow.right - rect.width + preventedOffsets.x, + bottom: overflow.bottom - rect.height + preventedOffsets.y, + left: overflow.left - rect.width - preventedOffsets.x + }; + } + + function isAnySideFullyClipped(overflow) { + return [top, right, bottom, left].some(function (side) { + return overflow[side] >= 0; + }); + } + + function hide(_ref) { + var state = _ref.state, + name = _ref.name; + var referenceRect = state.rects.reference; + var popperRect = state.rects.popper; + var preventedOffsets = state.modifiersData.preventOverflow; + var referenceOverflow = detectOverflow(state, { + elementContext: 'reference' + }); + var popperAltOverflow = detectOverflow(state, { + altBoundary: true + }); + var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); + var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); + var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); + var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); + state.modifiersData[name] = { + referenceClippingOffsets: referenceClippingOffsets, + popperEscapeOffsets: popperEscapeOffsets, + isReferenceHidden: isReferenceHidden, + hasPopperEscaped: hasPopperEscaped + }; + state.attributes.popper = Object.assign({}, state.attributes.popper, { + 'data-popper-reference-hidden': isReferenceHidden, + 'data-popper-escaped': hasPopperEscaped + }); + } // eslint-disable-next-line import/no-unused-modules + + + const hide$1 = { + name: 'hide', + enabled: true, + phase: 'main', + requiresIfExists: ['preventOverflow'], + fn: hide + }; + + function distanceAndSkiddingToXY(placement, rects, offset) { + var basePlacement = getBasePlacement(placement); + var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1; + + var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, { + placement: placement + })) : offset, + skidding = _ref[0], + distance = _ref[1]; + + skidding = skidding || 0; + distance = (distance || 0) * invertDistance; + return [left, right].indexOf(basePlacement) >= 0 ? { + x: distance, + y: skidding + } : { + x: skidding, + y: distance + }; + } + + function offset(_ref2) { + var state = _ref2.state, + options = _ref2.options, + name = _ref2.name; + var _options$offset = options.offset, + offset = _options$offset === void 0 ? [0, 0] : _options$offset; + var data = placements.reduce(function (acc, placement) { + acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset); + return acc; + }, {}); + var _data$state$placement = data[state.placement], + x = _data$state$placement.x, + y = _data$state$placement.y; + + if (state.modifiersData.popperOffsets != null) { + state.modifiersData.popperOffsets.x += x; + state.modifiersData.popperOffsets.y += y; + } + + state.modifiersData[name] = data; + } // eslint-disable-next-line import/no-unused-modules + + + const offset$1 = { + name: 'offset', + enabled: true, + phase: 'main', + requires: ['popperOffsets'], + fn: offset + }; + + function popperOffsets(_ref) { + var state = _ref.state, + name = _ref.name; + // Offsets are the actual position the popper needs to have to be + // properly positioned near its reference element + // This is the most basic placement, and will be adjusted by + // the modifiers in the next step + state.modifiersData[name] = computeOffsets({ + reference: state.rects.reference, + element: state.rects.popper, + placement: state.placement + }); + } // eslint-disable-next-line import/no-unused-modules + + + const popperOffsets$1 = { + name: 'popperOffsets', + enabled: true, + phase: 'read', + fn: popperOffsets, + data: {} + }; + + function getAltAxis(axis) { + return axis === 'x' ? 'y' : 'x'; + } + + function preventOverflow(_ref) { + var state = _ref.state, + options = _ref.options, + name = _ref.name; + var _options$mainAxis = options.mainAxis, + checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, + _options$altAxis = options.altAxis, + checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, + boundary = options.boundary, + rootBoundary = options.rootBoundary, + altBoundary = options.altBoundary, + padding = options.padding, + _options$tether = options.tether, + tether = _options$tether === void 0 ? true : _options$tether, + _options$tetherOffset = options.tetherOffset, + tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; + var overflow = detectOverflow(state, { + boundary: boundary, + rootBoundary: rootBoundary, + padding: padding, + altBoundary: altBoundary + }); + var basePlacement = getBasePlacement(state.placement); + var variation = getVariation(state.placement); + var isBasePlacement = !variation; + var mainAxis = getMainAxisFromPlacement(basePlacement); + var altAxis = getAltAxis(mainAxis); + var popperOffsets = state.modifiersData.popperOffsets; + var referenceRect = state.rects.reference; + var popperRect = state.rects.popper; + var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, { + placement: state.placement + })) : tetherOffset; + var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? { + mainAxis: tetherOffsetValue, + altAxis: tetherOffsetValue + } : Object.assign({ + mainAxis: 0, + altAxis: 0 + }, tetherOffsetValue); + var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null; + var data = { + x: 0, + y: 0 + }; + + if (!popperOffsets) { + return; + } + + if (checkMainAxis) { + var _offsetModifierState$; + + var mainSide = mainAxis === 'y' ? top : left; + var altSide = mainAxis === 'y' ? bottom : right; + var len = mainAxis === 'y' ? 'height' : 'width'; + var offset = popperOffsets[mainAxis]; + var min$1 = offset + overflow[mainSide]; + var max$1 = offset - overflow[altSide]; + var additive = tether ? -popperRect[len] / 2 : 0; + var minLen = variation === start ? referenceRect[len] : popperRect[len]; + var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go + // outside the reference bounds + + var arrowElement = state.elements.arrow; + var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { + width: 0, + height: 0 + }; + var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject(); + var arrowPaddingMin = arrowPaddingObject[mainSide]; + var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want + // to include its full size in the calculation. If the reference is small + // and near the edge of a boundary, the popper can overflow even if the + // reference is not overflowing as well (e.g. virtual elements with no + // width or height) + + var arrowLen = within(0, referenceRect[len], arrowRect[len]); + var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis; + var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis; + var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); + var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; + var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0; + var tetherMin = offset + minOffset - offsetModifierValue - clientOffset; + var tetherMax = offset + maxOffset - offsetModifierValue; + var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1); + popperOffsets[mainAxis] = preventedOffset; + data[mainAxis] = preventedOffset - offset; + } + + if (checkAltAxis) { + var _offsetModifierState$2; + + var _mainSide = mainAxis === 'x' ? top : left; + + var _altSide = mainAxis === 'x' ? bottom : right; + + var _offset = popperOffsets[altAxis]; + + var _len = altAxis === 'y' ? 'height' : 'width'; + + var _min = _offset + overflow[_mainSide]; + + var _max = _offset - overflow[_altSide]; + + var isOriginSide = [top, left].indexOf(basePlacement) !== -1; + + var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0; + + var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis; + + var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max; + + var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max); + + popperOffsets[altAxis] = _preventedOffset; + data[altAxis] = _preventedOffset - _offset; + } + + state.modifiersData[name] = data; + } // eslint-disable-next-line import/no-unused-modules + + + const preventOverflow$1 = { + name: 'preventOverflow', + enabled: true, + phase: 'main', + fn: preventOverflow, + requiresIfExists: ['offset'] + }; + + function getHTMLElementScroll(element) { + return { + scrollLeft: element.scrollLeft, + scrollTop: element.scrollTop + }; + } + + function getNodeScroll(node) { + if (node === getWindow(node) || !isHTMLElement(node)) { + return getWindowScroll(node); + } else { + return getHTMLElementScroll(node); + } + } + + function isElementScaled(element) { + var rect = element.getBoundingClientRect(); + var scaleX = round(rect.width) / element.offsetWidth || 1; + var scaleY = round(rect.height) / element.offsetHeight || 1; + return scaleX !== 1 || scaleY !== 1; + } // Returns the composite rect of an element relative to its offsetParent. + // Composite means it takes into account transforms as well as layout. + + + function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { + if (isFixed === void 0) { + isFixed = false; + } + + var isOffsetParentAnElement = isHTMLElement(offsetParent); + var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent); + var documentElement = getDocumentElement(offsetParent); + var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed); + var scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + var offsets = { + x: 0, + y: 0 + }; + + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 + isScrollParent(documentElement)) { + scroll = getNodeScroll(offsetParent); + } + + if (isHTMLElement(offsetParent)) { + offsets = getBoundingClientRect(offsetParent, true); + offsets.x += offsetParent.clientLeft; + offsets.y += offsetParent.clientTop; + } else if (documentElement) { + offsets.x = getWindowScrollBarX(documentElement); + } + } + + return { + x: rect.left + scroll.scrollLeft - offsets.x, + y: rect.top + scroll.scrollTop - offsets.y, + width: rect.width, + height: rect.height + }; + } + + function order(modifiers) { + var map = new Map(); + var visited = new Set(); + var result = []; + modifiers.forEach(function (modifier) { + map.set(modifier.name, modifier); + }); // On visiting object, check for its dependencies and visit them recursively + + function sort(modifier) { + visited.add(modifier.name); + var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); + requires.forEach(function (dep) { + if (!visited.has(dep)) { + var depModifier = map.get(dep); + + if (depModifier) { + sort(depModifier); + } + } + }); + result.push(modifier); + } + + modifiers.forEach(function (modifier) { + if (!visited.has(modifier.name)) { + // check for visited object + sort(modifier); + } + }); + return result; + } + + function orderModifiers(modifiers) { + // order based on dependencies + var orderedModifiers = order(modifiers); // order based on phase + + return modifierPhases.reduce(function (acc, phase) { + return acc.concat(orderedModifiers.filter(function (modifier) { + return modifier.phase === phase; + })); + }, []); + } + + function debounce(fn) { + var pending; + return function () { + if (!pending) { + pending = new Promise(function (resolve) { + Promise.resolve().then(function () { + pending = undefined; + resolve(fn()); + }); + }); + } + + return pending; + }; + } + + function mergeByName(modifiers) { + var merged = modifiers.reduce(function (merged, current) { + var existing = merged[current.name]; + merged[current.name] = existing ? Object.assign({}, existing, current, { + options: Object.assign({}, existing.options, current.options), + data: Object.assign({}, existing.data, current.data) + }) : current; + return merged; + }, {}); // IE11 does not support Object.values + + return Object.keys(merged).map(function (key) { + return merged[key]; + }); + } + + var DEFAULT_OPTIONS = { + placement: 'bottom', + modifiers: [], + strategy: 'absolute' + }; + + function areValidElements() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return !args.some(function (element) { + return !(element && typeof element.getBoundingClientRect === 'function'); + }); + } + + function popperGenerator(generatorOptions) { + if (generatorOptions === void 0) { + generatorOptions = {}; + } + + var _generatorOptions = generatorOptions, + _generatorOptions$def = _generatorOptions.defaultModifiers, + defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, + _generatorOptions$def2 = _generatorOptions.defaultOptions, + defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; + return function createPopper(reference, popper, options) { + if (options === void 0) { + options = defaultOptions; + } + + var state = { + placement: 'bottom', + orderedModifiers: [], + options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions), + modifiersData: {}, + elements: { + reference: reference, + popper: popper + }, + attributes: {}, + styles: {} + }; + var effectCleanupFns = []; + var isDestroyed = false; + var instance = { + state: state, + setOptions: function setOptions(setOptionsAction) { + var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction; + cleanupModifierEffects(); + state.options = Object.assign({}, defaultOptions, state.options, options); + state.scrollParents = { + reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [], + popper: listScrollParents(popper) + }; // Orders the modifiers based on their dependencies and `phase` + // properties + + var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers + + state.orderedModifiers = orderedModifiers.filter(function (m) { + return m.enabled; + }); + runModifierEffects(); + return instance.update(); + }, + // Sync update – it will always be executed, even if not necessary. This + // is useful for low frequency updates where sync behavior simplifies the + // logic. + // For high frequency updates (e.g. `resize` and `scroll` events), always + // prefer the async Popper#update method + forceUpdate: function forceUpdate() { + if (isDestroyed) { + return; + } + + var _state$elements = state.elements, + reference = _state$elements.reference, + popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements + // anymore + + if (!areValidElements(reference, popper)) { + return; + } // Store the reference and popper rects to be read by modifiers + + + state.rects = { + reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'), + popper: getLayoutRect(popper) + }; // Modifiers have the ability to reset the current update cycle. The + // most common use case for this is the `flip` modifier changing the + // placement, which then needs to re-run all the modifiers, because the + // logic was previously ran for the previous placement and is therefore + // stale/incorrect + + state.reset = false; + state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier + // is filled with the initial data specified by the modifier. This means + // it doesn't persist and is fresh on each update. + // To ensure persistent data, use `${name}#persistent` + + state.orderedModifiers.forEach(function (modifier) { + return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); + }); + + for (var index = 0; index < state.orderedModifiers.length; index++) { + if (state.reset === true) { + state.reset = false; + index = -1; + continue; + } + + var _state$orderedModifie = state.orderedModifiers[index], + fn = _state$orderedModifie.fn, + _state$orderedModifie2 = _state$orderedModifie.options, + _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, + name = _state$orderedModifie.name; + + if (typeof fn === 'function') { + state = fn({ + state: state, + options: _options, + name: name, + instance: instance + }) || state; + } + } + }, + // Async and optimistically optimized update – it will not be executed if + // not necessary (debounced to run at most once-per-tick) + update: debounce(function () { + return new Promise(function (resolve) { + instance.forceUpdate(); + resolve(state); + }); + }), + destroy: function destroy() { + cleanupModifierEffects(); + isDestroyed = true; + } + }; + + if (!areValidElements(reference, popper)) { + return instance; + } + + instance.setOptions(options).then(function (state) { + if (!isDestroyed && options.onFirstUpdate) { + options.onFirstUpdate(state); + } + }); // Modifiers have the ability to execute arbitrary code before the first + // update cycle runs. They will be executed in the same order as the update + // cycle. This is useful when a modifier adds some persistent data that + // other modifiers need to use, but the modifier is run after the dependent + // one. + + function runModifierEffects() { + state.orderedModifiers.forEach(function (_ref) { + var name = _ref.name, + _ref$options = _ref.options, + options = _ref$options === void 0 ? {} : _ref$options, + effect = _ref.effect; + + if (typeof effect === 'function') { + var cleanupFn = effect({ + state: state, + name: name, + instance: instance, + options: options + }); + + var noopFn = function noopFn() {}; + + effectCleanupFns.push(cleanupFn || noopFn); + } + }); + } + + function cleanupModifierEffects() { + effectCleanupFns.forEach(function (fn) { + return fn(); + }); + effectCleanupFns = []; + } + + return instance; + }; + } + + var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1]; + var createPopper = /*#__PURE__*/popperGenerator({ + defaultModifiers: defaultModifiers + }); // eslint-disable-next-line import/no-unused-modules + + const Popper = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ + __proto__: null, + afterMain, + afterRead, + afterWrite, + applyStyles: applyStyles$1, + arrow: arrow$1, + auto, + basePlacements, + beforeMain, + beforeRead, + beforeWrite, + bottom, + clippingParents, + computeStyles: computeStyles$1, + createPopper, + detectOverflow, + end, + eventListeners, + flip: flip$1, + hide: hide$1, + left, + main, + modifierPhases, + offset: offset$1, + placements, + popper, + popperGenerator, + popperOffsets: popperOffsets$1, + preventOverflow: preventOverflow$1, + read, + reference, + right, + start, + top, + variationPlacements, + viewport, + write + }, Symbol.toStringTag, { value: 'Module' })); + + /** + * -------------------------------------------------------------------------- + * Bootstrap dropdown.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$a = 'dropdown'; + const DATA_KEY$6 = 'bs.dropdown'; + const EVENT_KEY$6 = `.${DATA_KEY$6}`; + const DATA_API_KEY$3 = '.data-api'; + const ESCAPE_KEY$2 = 'Escape'; + const TAB_KEY$1 = 'Tab'; + const ARROW_UP_KEY$1 = 'ArrowUp'; + const ARROW_DOWN_KEY$1 = 'ArrowDown'; + const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button + + const EVENT_HIDE$5 = `hide${EVENT_KEY$6}`; + const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`; + const EVENT_SHOW$5 = `show${EVENT_KEY$6}`; + const EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`; + const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; + const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`; + const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`; + const CLASS_NAME_SHOW$6 = 'show'; + const CLASS_NAME_DROPUP = 'dropup'; + const CLASS_NAME_DROPEND = 'dropend'; + const CLASS_NAME_DROPSTART = 'dropstart'; + const CLASS_NAME_DROPUP_CENTER = 'dropup-center'; + const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'; + const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)'; + const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`; + const SELECTOR_MENU = '.dropdown-menu'; + const SELECTOR_NAVBAR = '.navbar'; + const SELECTOR_NAVBAR_NAV = '.navbar-nav'; + const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; + const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; + const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; + const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; + const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; + const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; + const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; + const PLACEMENT_TOPCENTER = 'top'; + const PLACEMENT_BOTTOMCENTER = 'bottom'; + const Default$9 = { + autoClose: true, + boundary: 'clippingParents', + display: 'dynamic', + offset: [0, 2], + popperConfig: null, + reference: 'toggle' + }; + const DefaultType$9 = { + autoClose: '(boolean|string)', + boundary: '(string|element)', + display: 'string', + offset: '(array|string|function)', + popperConfig: '(null|object|function)', + reference: '(string|element|object)' + }; + + /** + * Class definition + */ + + class Dropdown extends BaseComponent { + constructor(element, config) { + super(element, config); + this._popper = null; + this._parent = this._element.parentNode; // dropdown wrapper + // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ + this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent); + this._inNavbar = this._detectNavbar(); + } + + // Getters + static get Default() { + return Default$9; + } + static get DefaultType() { + return DefaultType$9; + } + static get NAME() { + return NAME$a; + } + + // Public + toggle() { + return this._isShown() ? this.hide() : this.show(); + } + show() { + if (isDisabled(this._element) || this._isShown()) { + return; + } + const relatedTarget = { + relatedTarget: this._element + }; + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget); + if (showEvent.defaultPrevented) { + return; + } + this._createPopper(); + + // If this is a touch-enabled device we add extra + // empty mouseover listeners to the body's immediate children; + // only needed because of broken event delegation on iOS + // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html + if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) { + for (const element of [].concat(...document.body.children)) { + EventHandler.on(element, 'mouseover', noop); + } + } + this._element.focus(); + this._element.setAttribute('aria-expanded', true); + this._menu.classList.add(CLASS_NAME_SHOW$6); + this._element.classList.add(CLASS_NAME_SHOW$6); + EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget); + } + hide() { + if (isDisabled(this._element) || !this._isShown()) { + return; + } + const relatedTarget = { + relatedTarget: this._element + }; + this._completeHide(relatedTarget); + } + dispose() { + if (this._popper) { + this._popper.destroy(); + } + super.dispose(); + } + update() { + this._inNavbar = this._detectNavbar(); + if (this._popper) { + this._popper.update(); + } + } + + // Private + _completeHide(relatedTarget) { + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget); + if (hideEvent.defaultPrevented) { + return; + } + + // If this is a touch-enabled device we remove the extra + // empty mouseover listeners we added for iOS support + if ('ontouchstart' in document.documentElement) { + for (const element of [].concat(...document.body.children)) { + EventHandler.off(element, 'mouseover', noop); + } + } + if (this._popper) { + this._popper.destroy(); + } + this._menu.classList.remove(CLASS_NAME_SHOW$6); + this._element.classList.remove(CLASS_NAME_SHOW$6); + this._element.setAttribute('aria-expanded', 'false'); + Manipulator.removeDataAttribute(this._menu, 'popper'); + EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget); + } + _getConfig(config) { + config = super._getConfig(config); + if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { + // Popper virtual elements require a getBoundingClientRect method + throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); + } + return config; + } + _createPopper() { + if (typeof Popper === 'undefined') { + throw new TypeError('Bootstrap\'s dropdowns require Popper (https://github.com/floating-ui/popper-docs/blob/main/docs/v2/index.md)'); + } + let referenceElement = this._element; + if (this._config.reference === 'parent') { + referenceElement = this._parent; + } else if (isElement$1(this._config.reference)) { + referenceElement = getElement(this._config.reference); + } else if (typeof this._config.reference === 'object') { + referenceElement = this._config.reference; + } + const popperConfig = this._getPopperConfig(); + this._popper = createPopper(referenceElement, this._menu, popperConfig); + } + _isShown() { + return this._menu.classList.contains(CLASS_NAME_SHOW$6); + } + _getPlacement() { + const parentDropdown = this._parent; + if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { + return PLACEMENT_RIGHT; + } + if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { + return PLACEMENT_LEFT; + } + if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) { + return PLACEMENT_TOPCENTER; + } + if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) { + return PLACEMENT_BOTTOMCENTER; + } + + // We need to trim the value because custom properties can also include spaces + const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; + if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { + return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; + } + return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; + } + _detectNavbar() { + return this._element.closest(SELECTOR_NAVBAR) !== null; + } + _getOffset() { + const { + offset + } = this._config; + if (typeof offset === 'string') { + return offset.split(',').map(value => Number.parseInt(value, 10)); + } + if (typeof offset === 'function') { + return popperData => offset(popperData, this._element); + } + return offset; + } + _getPopperConfig() { + const defaultBsPopperConfig = { + placement: this._getPlacement(), + modifiers: [{ + name: 'preventOverflow', + options: { + boundary: this._config.boundary + } + }, { + name: 'offset', + options: { + offset: this._getOffset() + } + }] + }; + + // Disable Popper if we have a static display or Dropdown is in Navbar + if (this._inNavbar || this._config.display === 'static') { + Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // TODO: v6 remove + defaultBsPopperConfig.modifiers = [{ + name: 'applyStyles', + enabled: false + }]; + } + return { + ...defaultBsPopperConfig, + ...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig]) + }; + } + _selectMenuItem({ + key, + target + }) { + const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element)); + if (!items.length) { + return; + } + + // if target isn't included in items (e.g. when expanding the dropdown) + // allow cycling to get the last item in case key equals ARROW_UP_KEY + getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus(); + } + + // Static + static jQueryInterface(config) { + return this.each(function () { + const data = Dropdown.getOrCreateInstance(this, config); + if (typeof config !== 'string') { + return; + } + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`); + } + data[config](); + }); + } + static clearMenus(event) { + if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) { + return; + } + const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN); + for (const toggle of openToggles) { + const context = Dropdown.getInstance(toggle); + if (!context || context._config.autoClose === false) { + continue; + } + const composedPath = event.composedPath(); + const isMenuTarget = composedPath.includes(context._menu); + if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { + continue; + } + + // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu + if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) { + continue; + } + const relatedTarget = { + relatedTarget: context._element + }; + if (event.type === 'click') { + relatedTarget.clickEvent = event; + } + context._completeHide(relatedTarget); + } + } + static dataApiKeydownHandler(event) { + // If not an UP | DOWN | ESCAPE key => not a dropdown command + // If input/textarea && if key is other than ESCAPE => not a dropdown command + + const isInput = /input|textarea/i.test(event.target.tagName); + const isEscapeEvent = event.key === ESCAPE_KEY$2; + const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key); + if (!isUpOrDownEvent && !isEscapeEvent) { + return; + } + if (isInput && !isEscapeEvent) { + return; + } + event.preventDefault(); + + // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ + const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode); + const instance = Dropdown.getOrCreateInstance(getToggleButton); + if (isUpOrDownEvent) { + event.stopPropagation(); + instance.show(); + instance._selectMenuItem(event); + return; + } + if (instance._isShown()) { + // else is escape and we check if it is shown + event.stopPropagation(); + instance.hide(); + getToggleButton.focus(); + } + } + } + + /** + * Data API implementation + */ + + EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); + EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); + EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); + EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); + EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { + event.preventDefault(); + Dropdown.getOrCreateInstance(this).toggle(); + }); + + /** + * jQuery + */ + + defineJQueryPlugin(Dropdown); + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/backdrop.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$9 = 'backdrop'; + const CLASS_NAME_FADE$4 = 'fade'; + const CLASS_NAME_SHOW$5 = 'show'; + const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`; + const Default$8 = { + className: 'modal-backdrop', + clickCallback: null, + isAnimated: false, + isVisible: true, + // if false, we use the backdrop helper without adding any element to the dom + rootElement: 'body' // give the choice to place backdrop under different elements + }; + const DefaultType$8 = { + className: 'string', + clickCallback: '(function|null)', + isAnimated: 'boolean', + isVisible: 'boolean', + rootElement: '(element|string)' + }; + + /** + * Class definition + */ + + class Backdrop extends Config { + constructor(config) { + super(); + this._config = this._getConfig(config); + this._isAppended = false; + this._element = null; + } + + // Getters + static get Default() { + return Default$8; + } + static get DefaultType() { + return DefaultType$8; + } + static get NAME() { + return NAME$9; + } + + // Public + show(callback) { + if (!this._config.isVisible) { + execute(callback); + return; + } + this._append(); + const element = this._getElement(); + if (this._config.isAnimated) { + reflow(element); + } + element.classList.add(CLASS_NAME_SHOW$5); + this._emulateAnimation(() => { + execute(callback); + }); + } + hide(callback) { + if (!this._config.isVisible) { + execute(callback); + return; + } + this._getElement().classList.remove(CLASS_NAME_SHOW$5); + this._emulateAnimation(() => { + this.dispose(); + execute(callback); + }); + } + dispose() { + if (!this._isAppended) { + return; + } + EventHandler.off(this._element, EVENT_MOUSEDOWN); + this._element.remove(); + this._isAppended = false; + } + + // Private + _getElement() { + if (!this._element) { + const backdrop = document.createElement('div'); + backdrop.className = this._config.className; + if (this._config.isAnimated) { + backdrop.classList.add(CLASS_NAME_FADE$4); + } + this._element = backdrop; + } + return this._element; + } + _configAfterMerge(config) { + // use getElement() with the default "body" to get a fresh Element on each instantiation + config.rootElement = getElement(config.rootElement); + return config; + } + _append() { + if (this._isAppended) { + return; + } + const element = this._getElement(); + this._config.rootElement.append(element); + EventHandler.on(element, EVENT_MOUSEDOWN, () => { + execute(this._config.clickCallback); + }); + this._isAppended = true; + } + _emulateAnimation(callback) { + executeAfterTransition(callback, this._getElement(), this._config.isAnimated); + } + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/focustrap.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$8 = 'focustrap'; + const DATA_KEY$5 = 'bs.focustrap'; + const EVENT_KEY$5 = `.${DATA_KEY$5}`; + const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`; + const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`; + const TAB_KEY = 'Tab'; + const TAB_NAV_FORWARD = 'forward'; + const TAB_NAV_BACKWARD = 'backward'; + const Default$7 = { + autofocus: true, + trapElement: null // The element to trap focus inside of + }; + const DefaultType$7 = { + autofocus: 'boolean', + trapElement: 'element' + }; + + /** + * Class definition + */ + + class FocusTrap extends Config { + constructor(config) { + super(); + this._config = this._getConfig(config); + this._isActive = false; + this._lastTabNavDirection = null; + } + + // Getters + static get Default() { + return Default$7; + } + static get DefaultType() { + return DefaultType$7; + } + static get NAME() { + return NAME$8; + } + + // Public + activate() { + if (this._isActive) { + return; + } + if (this._config.autofocus) { + this._config.trapElement.focus(); + } + EventHandler.off(document, EVENT_KEY$5); // guard against infinite focus loop + EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event)); + EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event)); + this._isActive = true; + } + deactivate() { + if (!this._isActive) { + return; + } + this._isActive = false; + EventHandler.off(document, EVENT_KEY$5); + } + + // Private + _handleFocusin(event) { + const { + trapElement + } = this._config; + if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) { + return; + } + const elements = SelectorEngine.focusableChildren(trapElement); + if (elements.length === 0) { + trapElement.focus(); + } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { + elements[elements.length - 1].focus(); + } else { + elements[0].focus(); + } + } + _handleKeydown(event) { + if (event.key !== TAB_KEY) { + return; + } + this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; + } + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/scrollBar.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; + const SELECTOR_STICKY_CONTENT = '.sticky-top'; + const PROPERTY_PADDING = 'padding-right'; + const PROPERTY_MARGIN = 'margin-right'; + + /** + * Class definition + */ + + class ScrollBarHelper { + constructor() { + this._element = document.body; + } + + // Public + getWidth() { + // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes + const documentWidth = document.documentElement.clientWidth; + return Math.abs(window.innerWidth - documentWidth); + } + hide() { + const width = this.getWidth(); + this._disableOverFlow(); + // give padding to element to balance the hidden scrollbar width + this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width); + // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth + this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width); + this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width); + } + reset() { + this._resetElementAttributes(this._element, 'overflow'); + this._resetElementAttributes(this._element, PROPERTY_PADDING); + this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING); + this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN); + } + isOverflowing() { + return this.getWidth() > 0; + } + + // Private + _disableOverFlow() { + this._saveInitialAttribute(this._element, 'overflow'); + this._element.style.overflow = 'hidden'; + } + _setElementAttributes(selector, styleProperty, callback) { + const scrollbarWidth = this.getWidth(); + const manipulationCallBack = element => { + if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { + return; + } + this._saveInitialAttribute(element, styleProperty); + const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty); + element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`); + }; + this._applyManipulationCallback(selector, manipulationCallBack); + } + _saveInitialAttribute(element, styleProperty) { + const actualValue = element.style.getPropertyValue(styleProperty); + if (actualValue) { + Manipulator.setDataAttribute(element, styleProperty, actualValue); + } + } + _resetElementAttributes(selector, styleProperty) { + const manipulationCallBack = element => { + const value = Manipulator.getDataAttribute(element, styleProperty); + // We only want to remove the property if the value is `null`; the value can also be zero + if (value === null) { + element.style.removeProperty(styleProperty); + return; + } + Manipulator.removeDataAttribute(element, styleProperty); + element.style.setProperty(styleProperty, value); + }; + this._applyManipulationCallback(selector, manipulationCallBack); + } + _applyManipulationCallback(selector, callBack) { + if (isElement$1(selector)) { + callBack(selector); + return; + } + for (const sel of SelectorEngine.find(selector, this._element)) { + callBack(sel); + } + } + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap modal.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$7 = 'modal'; + const DATA_KEY$4 = 'bs.modal'; + const EVENT_KEY$4 = `.${DATA_KEY$4}`; + const DATA_API_KEY$2 = '.data-api'; + const ESCAPE_KEY$1 = 'Escape'; + const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`; + const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`; + const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`; + const EVENT_SHOW$4 = `show${EVENT_KEY$4}`; + const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`; + const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`; + const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`; + const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`; + const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`; + const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`; + const CLASS_NAME_OPEN = 'modal-open'; + const CLASS_NAME_FADE$3 = 'fade'; + const CLASS_NAME_SHOW$4 = 'show'; + const CLASS_NAME_STATIC = 'modal-static'; + const OPEN_SELECTOR$1 = '.modal.show'; + const SELECTOR_DIALOG = '.modal-dialog'; + const SELECTOR_MODAL_BODY = '.modal-body'; + const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; + const Default$6 = { + backdrop: true, + focus: true, + keyboard: true + }; + const DefaultType$6 = { + backdrop: '(boolean|string)', + focus: 'boolean', + keyboard: 'boolean' + }; + + /** + * Class definition + */ + + class Modal extends BaseComponent { + constructor(element, config) { + super(element, config); + this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); + this._backdrop = this._initializeBackDrop(); + this._focustrap = this._initializeFocusTrap(); + this._isShown = false; + this._isTransitioning = false; + this._scrollBar = new ScrollBarHelper(); + this._addEventListeners(); + } + + // Getters + static get Default() { + return Default$6; + } + static get DefaultType() { + return DefaultType$6; + } + static get NAME() { + return NAME$7; + } + + // Public + toggle(relatedTarget) { + return this._isShown ? this.hide() : this.show(relatedTarget); + } + show(relatedTarget) { + if (this._isShown || this._isTransitioning) { + return; + } + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, { + relatedTarget + }); + if (showEvent.defaultPrevented) { + return; + } + this._isShown = true; + this._isTransitioning = true; + this._scrollBar.hide(); + document.body.classList.add(CLASS_NAME_OPEN); + this._adjustDialog(); + this._backdrop.show(() => this._showElement(relatedTarget)); + } + hide() { + if (!this._isShown || this._isTransitioning) { + return; + } + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4); + if (hideEvent.defaultPrevented) { + return; + } + this._isShown = false; + this._isTransitioning = true; + this._focustrap.deactivate(); + this._element.classList.remove(CLASS_NAME_SHOW$4); + this._queueCallback(() => this._hideModal(), this._element, this._isAnimated()); + } + dispose() { + EventHandler.off(window, EVENT_KEY$4); + EventHandler.off(this._dialog, EVENT_KEY$4); + this._backdrop.dispose(); + this._focustrap.deactivate(); + super.dispose(); + } + handleUpdate() { + this._adjustDialog(); + } + + // Private + _initializeBackDrop() { + return new Backdrop({ + isVisible: Boolean(this._config.backdrop), + // 'static' option will be translated to true, and booleans will keep their value, + isAnimated: this._isAnimated() + }); + } + _initializeFocusTrap() { + return new FocusTrap({ + trapElement: this._element + }); + } + _showElement(relatedTarget) { + // try to append dynamic modal + if (!document.body.contains(this._element)) { + document.body.append(this._element); + } + this._element.style.display = 'block'; + this._element.removeAttribute('aria-hidden'); + this._element.setAttribute('aria-modal', true); + this._element.setAttribute('role', 'dialog'); + this._element.scrollTop = 0; + const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); + if (modalBody) { + modalBody.scrollTop = 0; + } + reflow(this._element); + this._element.classList.add(CLASS_NAME_SHOW$4); + const transitionComplete = () => { + if (this._config.focus) { + this._focustrap.activate(); + } + this._isTransitioning = false; + EventHandler.trigger(this._element, EVENT_SHOWN$4, { + relatedTarget + }); + }; + this._queueCallback(transitionComplete, this._dialog, this._isAnimated()); + } + _addEventListeners() { + EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => { + if (event.key !== ESCAPE_KEY$1) { + return; + } + if (this._config.keyboard) { + this.hide(); + return; + } + this._triggerBackdropTransition(); + }); + EventHandler.on(window, EVENT_RESIZE$1, () => { + if (this._isShown && !this._isTransitioning) { + this._adjustDialog(); + } + }); + EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => { + // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks + EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => { + if (this._element !== event.target || this._element !== event2.target) { + return; + } + if (this._config.backdrop === 'static') { + this._triggerBackdropTransition(); + return; + } + if (this._config.backdrop) { + this.hide(); + } + }); + }); + } + _hideModal() { + this._element.style.display = 'none'; + this._element.setAttribute('aria-hidden', true); + this._element.removeAttribute('aria-modal'); + this._element.removeAttribute('role'); + this._isTransitioning = false; + this._backdrop.hide(() => { + document.body.classList.remove(CLASS_NAME_OPEN); + this._resetAdjustments(); + this._scrollBar.reset(); + EventHandler.trigger(this._element, EVENT_HIDDEN$4); + }); + } + _isAnimated() { + return this._element.classList.contains(CLASS_NAME_FADE$3); + } + _triggerBackdropTransition() { + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1); + if (hideEvent.defaultPrevented) { + return; + } + const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; + const initialOverflowY = this._element.style.overflowY; + // return if the following background transition hasn't yet completed + if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) { + return; + } + if (!isModalOverflowing) { + this._element.style.overflowY = 'hidden'; + } + this._element.classList.add(CLASS_NAME_STATIC); + this._queueCallback(() => { + this._element.classList.remove(CLASS_NAME_STATIC); + this._queueCallback(() => { + this._element.style.overflowY = initialOverflowY; + }, this._dialog); + }, this._dialog); + this._element.focus(); + } + + /** + * The following methods are used to handle overflowing modals + */ + + _adjustDialog() { + const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; + const scrollbarWidth = this._scrollBar.getWidth(); + const isBodyOverflowing = scrollbarWidth > 0; + if (isBodyOverflowing && !isModalOverflowing) { + const property = isRTL() ? 'paddingLeft' : 'paddingRight'; + this._element.style[property] = `${scrollbarWidth}px`; + } + if (!isBodyOverflowing && isModalOverflowing) { + const property = isRTL() ? 'paddingRight' : 'paddingLeft'; + this._element.style[property] = `${scrollbarWidth}px`; + } + } + _resetAdjustments() { + this._element.style.paddingLeft = ''; + this._element.style.paddingRight = ''; + } + + // Static + static jQueryInterface(config, relatedTarget) { + return this.each(function () { + const data = Modal.getOrCreateInstance(this, config); + if (typeof config !== 'string') { + return; + } + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`); + } + data[config](relatedTarget); + }); + } + } + + /** + * Data API implementation + */ + + EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { + const target = SelectorEngine.getElementFromSelector(this); + if (['A', 'AREA'].includes(this.tagName)) { + event.preventDefault(); + } + EventHandler.one(target, EVENT_SHOW$4, showEvent => { + if (showEvent.defaultPrevented) { + // only register focus restorer if modal will actually get shown + return; + } + EventHandler.one(target, EVENT_HIDDEN$4, () => { + if (isVisible(this)) { + this.focus(); + } + }); + }); + + // avoid conflict when clicking modal toggler while another one is open + const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1); + if (alreadyOpen) { + Modal.getInstance(alreadyOpen).hide(); + } + const data = Modal.getOrCreateInstance(target); + data.toggle(this); + }); + enableDismissTrigger(Modal); + + /** + * jQuery + */ + + defineJQueryPlugin(Modal); + + /** + * -------------------------------------------------------------------------- + * Bootstrap offcanvas.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$6 = 'offcanvas'; + const DATA_KEY$3 = 'bs.offcanvas'; + const EVENT_KEY$3 = `.${DATA_KEY$3}`; + const DATA_API_KEY$1 = '.data-api'; + const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`; + const ESCAPE_KEY = 'Escape'; + const CLASS_NAME_SHOW$3 = 'show'; + const CLASS_NAME_SHOWING$1 = 'showing'; + const CLASS_NAME_HIDING = 'hiding'; + const CLASS_NAME_BACKDROP = 'offcanvas-backdrop'; + const OPEN_SELECTOR = '.offcanvas.show'; + const EVENT_SHOW$3 = `show${EVENT_KEY$3}`; + const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`; + const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`; + const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`; + const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`; + const EVENT_RESIZE = `resize${EVENT_KEY$3}`; + const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`; + const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`; + const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; + const Default$5 = { + backdrop: true, + keyboard: true, + scroll: false + }; + const DefaultType$5 = { + backdrop: '(boolean|string)', + keyboard: 'boolean', + scroll: 'boolean' + }; + + /** + * Class definition + */ + + class Offcanvas extends BaseComponent { + constructor(element, config) { + super(element, config); + this._isShown = false; + this._backdrop = this._initializeBackDrop(); + this._focustrap = this._initializeFocusTrap(); + this._addEventListeners(); + } + + // Getters + static get Default() { + return Default$5; + } + static get DefaultType() { + return DefaultType$5; + } + static get NAME() { + return NAME$6; + } + + // Public + toggle(relatedTarget) { + return this._isShown ? this.hide() : this.show(relatedTarget); + } + show(relatedTarget) { + if (this._isShown) { + return; + } + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { + relatedTarget + }); + if (showEvent.defaultPrevented) { + return; + } + this._isShown = true; + this._backdrop.show(); + if (!this._config.scroll) { + new ScrollBarHelper().hide(); + } + this._element.setAttribute('aria-modal', true); + this._element.setAttribute('role', 'dialog'); + this._element.classList.add(CLASS_NAME_SHOWING$1); + const completeCallBack = () => { + if (!this._config.scroll || this._config.backdrop) { + this._focustrap.activate(); + } + this._element.classList.add(CLASS_NAME_SHOW$3); + this._element.classList.remove(CLASS_NAME_SHOWING$1); + EventHandler.trigger(this._element, EVENT_SHOWN$3, { + relatedTarget + }); + }; + this._queueCallback(completeCallBack, this._element, true); + } + hide() { + if (!this._isShown) { + return; + } + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); + if (hideEvent.defaultPrevented) { + return; + } + this._focustrap.deactivate(); + this._element.blur(); + this._isShown = false; + this._element.classList.add(CLASS_NAME_HIDING); + this._backdrop.hide(); + const completeCallback = () => { + this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING); + this._element.removeAttribute('aria-modal'); + this._element.removeAttribute('role'); + if (!this._config.scroll) { + new ScrollBarHelper().reset(); + } + EventHandler.trigger(this._element, EVENT_HIDDEN$3); + }; + this._queueCallback(completeCallback, this._element, true); + } + dispose() { + this._backdrop.dispose(); + this._focustrap.deactivate(); + super.dispose(); + } + + // Private + _initializeBackDrop() { + const clickCallback = () => { + if (this._config.backdrop === 'static') { + EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); + return; + } + this.hide(); + }; + + // 'static' option will be translated to true, and booleans will keep their value + const isVisible = Boolean(this._config.backdrop); + return new Backdrop({ + className: CLASS_NAME_BACKDROP, + isVisible, + isAnimated: true, + rootElement: this._element.parentNode, + clickCallback: isVisible ? clickCallback : null + }); + } + _initializeFocusTrap() { + return new FocusTrap({ + trapElement: this._element + }); + } + _addEventListeners() { + EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { + if (event.key !== ESCAPE_KEY) { + return; + } + if (this._config.keyboard) { + this.hide(); + return; + } + EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); + }); + } + + // Static + static jQueryInterface(config) { + return this.each(function () { + const data = Offcanvas.getOrCreateInstance(this, config); + if (typeof config !== 'string') { + return; + } + if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { + throw new TypeError(`No method named "${config}"`); + } + data[config](this); + }); + } + } + + /** + * Data API implementation + */ + + EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, 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, () => { + // focus on trigger when it is closed + if (isVisible(this)) { + this.focus(); + } + }); + + // avoid conflict when clicking a toggler of an offcanvas, while another is open + const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); + if (alreadyOpen && alreadyOpen !== target) { + Offcanvas.getInstance(alreadyOpen).hide(); + } + const data = Offcanvas.getOrCreateInstance(target); + data.toggle(this); + }); + EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => { + for (const selector of SelectorEngine.find(OPEN_SELECTOR)) { + Offcanvas.getOrCreateInstance(selector).show(); + } + }); + EventHandler.on(window, EVENT_RESIZE, () => { + for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) { + if (getComputedStyle(element).position !== 'fixed') { + Offcanvas.getOrCreateInstance(element).hide(); + } + } + }); + enableDismissTrigger(Offcanvas); + + /** + * jQuery + */ + + defineJQueryPlugin(Offcanvas); + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/sanitizer.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + // js-docs-start allow-list + const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; + const DefaultAllowlist = { + // Global attributes allowed on any supplied element below. + '*': ['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: [] + }; + // js-docs-end allow-list + + const uriAttributes = 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:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/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)); + } + return true; + } + + // Check if a regular expression validates the attribute. + 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 domParser = new window.DOMParser(); + const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); + const elements = [].concat(...createdDocument.body.querySelectorAll('*')); + for (const element of elements) { + const elementName = element.nodeName.toLowerCase(); + if (!Object.keys(allowList).includes(elementName)) { + element.remove(); + continue; + } + const attributeList = [].concat(...element.attributes); + const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); + for (const attribute of attributeList) { + if (!allowedAttribute(attribute, allowedAttributes)) { + element.removeAttribute(attribute.nodeName); + } + } + } + return createdDocument.body.innerHTML; + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap util/template-factory.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$5 = 'TemplateFactory'; + const Default$4 = { + allowList: DefaultAllowlist, + content: {}, + // { selector : text , selector2 : text2 , } + extraClass: '', + html: false, + sanitize: true, + sanitizeFn: null, + template: '
' + }; + const DefaultType$4 = { + 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 + */ + + class TemplateFactory extends Config { + constructor(config) { + super(); + this._config = this._getConfig(config); + } + + // Getters + static get Default() { + return Default$4; + } + static get DefaultType() { + return DefaultType$4; + } + static get NAME() { + return NAME$5; + } + + // Public + 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; + } + + // Private + _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, [undefined, this]); + } + _putElementInTemplate(element, templateElement) { + if (this._config.html) { + templateElement.innerHTML = ''; + templateElement.append(element); + return; + } + templateElement.textContent = element.textContent; + } + } + + /** + * -------------------------------------------------------------------------- + * Bootstrap tooltip.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$4 = 'tooltip'; + const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); + const CLASS_NAME_FADE$2 = 'fade'; + const CLASS_NAME_MODAL = 'modal'; + const CLASS_NAME_SHOW$2 = 'show'; + const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; + const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; + 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$1 = 'click'; + const EVENT_FOCUSIN$1 = 'focusin'; + const EVENT_FOCUSOUT$1 = 'focusout'; + const EVENT_MOUSEENTER = 'mouseenter'; + const EVENT_MOUSELEAVE = 'mouseleave'; + const AttachmentMap = { + AUTO: 'auto', + TOP: 'top', + RIGHT: isRTL() ? 'left' : 'right', + BOTTOM: 'bottom', + LEFT: isRTL() ? 'right' : 'left' + }; + const Default$3 = { + allowList: DefaultAllowlist, + animation: true, + boundary: 'clippingParents', + container: false, + customClass: '', + delay: 0, + fallbackPlacements: ['top', 'right', 'bottom', 'left'], + html: false, + offset: [0, 6], + placement: 'top', + popperConfig: null, + sanitize: true, + sanitizeFn: null, + selector: false, + template: '', + title: '', + trigger: 'hover focus' + }; + const DefaultType$3 = { + 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)', + popperConfig: '(null|object|function)', + sanitize: 'boolean', + sanitizeFn: '(null|function)', + selector: '(string|boolean)', + template: 'string', + title: '(string|element|function)', + trigger: 'string' + }; + + /** + * Class definition + */ + + class Tooltip extends BaseComponent { + constructor(element, config) { + if (typeof Popper === 'undefined') { + throw new TypeError('Bootstrap\'s tooltips require Popper (https://github.com/floating-ui/popper-docs/blob/main/docs/v2/index.md)'); + } + super(element, config); + + // Private + this._isEnabled = true; + this._timeout = 0; + this._isHovered = null; + this._activeTrigger = {}; + this._popper = null; + this._templateFactory = null; + this._newContent = null; + + // Protected + this.tip = null; + this._setListeners(); + if (!this._config.selector) { + this._fixTitle(); + } + } + + // Getters + static get Default() { + return Default$3; + } + static get DefaultType() { + return DefaultType$3; + } + static get NAME() { + return NAME$4; + } + + // Public + enable() { + this._isEnabled = true; + } + disable() { + this._isEnabled = false; + } + toggleEnabled() { + this._isEnabled = !this._isEnabled; + } + toggle() { + if (!this._isEnabled) { + return; + } + if (this._isShown()) { + this._leave(); + return; + } + this._enter(); + } + dispose() { + clearTimeout(this._timeout); + 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._disposePopper(); + super.dispose(); + } + 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 shadowRoot = findShadowRoot(this._element); + const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element); + if (showEvent.defaultPrevented || !isInTheDom) { + return; + } + + // TODO: v6 remove this or make it optional + this._disposePopper(); + const tip = this._getTipElement(); + this._element.setAttribute('aria-describedby', tip.getAttribute('id')); + const { + container + } = this._config; + if (!this._element.ownerDocument.documentElement.contains(this.tip)) { + container.append(tip); + EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED)); + } + this._popper = this._createPopper(tip); + tip.classList.add(CLASS_NAME_SHOW$2); + + // If this is a touch-enabled device we add extra + // empty mouseover listeners to the body's immediate children; + // only needed because of broken event delegation on iOS + // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html + if ('ontouchstart' in document.documentElement) { + for (const element of [].concat(...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; + }; + this._queueCallback(complete, this.tip, this._isAnimated()); + } + hide() { + if (!this._isShown()) { + return; + } + const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2)); + if (hideEvent.defaultPrevented) { + return; + } + const tip = this._getTipElement(); + tip.classList.remove(CLASS_NAME_SHOW$2); + + // If this is a touch-enabled device we remove the extra + // empty mouseover listeners we added for iOS support + if ('ontouchstart' in document.documentElement) { + for (const element of [].concat(...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; // it is a trick to support manual triggering + + const complete = () => { + if (this._isWithActiveTrigger()) { + return; + } + if (!this._isHovered) { + this._disposePopper(); + } + this._element.removeAttribute('aria-describedby'); + EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2)); + }; + this._queueCallback(complete, this.tip, this._isAnimated()); + } + update() { + if (this._popper) { + this._popper.update(); + } + } + + // Protected + _isWithContent() { + return Boolean(this._getTitle()); + } + _getTipElement() { + if (!this.tip) { + this.tip = this._createTipElement(this._newContent || this._getContentForTemplate()); + } + return this.tip; + } + _createTipElement(content) { + const tip = this._getTemplateFactory(content).toHtml(); + + // TODO: remove this check in v6 + if (!tip) { + return null; + } + tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); + // TODO: v6 the following can be achieved with CSS only + tip.classList.add(`bs-${this.constructor.NAME}-auto`); + const tipId = getUID(this.constructor.NAME).toString(); + tip.setAttribute('id', tipId); + if (this._isAnimated()) { + tip.classList.add(CLASS_NAME_FADE$2); + } + return tip; + } + setContent(content) { + this._newContent = content; + if (this._isShown()) { + this._disposePopper(); + this.show(); + } + } + _getTemplateFactory(content) { + if (this._templateFactory) { + this._templateFactory.changeContent(content); + } else { + this._templateFactory = new TemplateFactory({ + ...this._config, + // the `content` var has to be after `this._config` + // to override config.content in case of popover + 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'); + } + + // Private + _initializeOnDelegatedTarget(event) { + return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); + } + _isAnimated() { + return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2); + } + _isShown() { + return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2); + } + _createPopper(tip) { + const placement = execute(this._config.placement, [this, tip, this._element]); + const attachment = AttachmentMap[placement.toUpperCase()]; + return createPopper(this._element, tip, this._getPopperConfig(attachment)); + } + _getOffset() { + const { + offset + } = this._config; + if (typeof offset === 'string') { + return offset.split(',').map(value => Number.parseInt(value, 10)); + } + if (typeof offset === 'function') { + return popperData => offset(popperData, this._element); + } + return offset; + } + _resolvePossibleFunction(arg) { + return execute(arg, [this._element, this._element]); + } + _getPopperConfig(attachment) { + const defaultBsPopperConfig = { + placement: attachment, + modifiers: [{ + name: 'flip', + options: { + fallbackPlacements: this._config.fallbackPlacements + } + }, { + name: 'offset', + options: { + offset: this._getOffset() + } + }, { + name: 'preventOverflow', + options: { + boundary: this._config.boundary + } + }, { + name: 'arrow', + options: { + element: `.${this.constructor.NAME}-arrow` + } + }, { + name: 'preSetPlacement', + enabled: true, + phase: 'beforeMain', + fn: data => { + // Pre-set Popper's placement attribute in order to read the arrow sizes properly. + // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement + this._getTipElement().setAttribute('data-popper-placement', data.state.placement); + } + }] + }; + return { + ...defaultBsPopperConfig, + ...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig]) + }; + } + _setListeners() { + const triggers = this._config.trigger.split(' '); + for (const trigger of triggers) { + if (trigger === 'click') { + EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), 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 = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1); + const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1); + 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); + context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); + context._leave(); + }); + } + } + this._hideModalHandler = () => { + if (this._element) { + this.hide(); + } + }; + EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); + } + _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); // DO NOT USE IT. Is only for backwards compatibility + this._element.removeAttribute('title'); + } + _enter() { + if (this._isShown() || this._isHovered) { + this._isHovered = true; + return; + } + this._isHovered = true; + this._setTimeout(() => { + if (this._isHovered) { + this.show(); + } + }, this._config.delay.show); + } + _leave() { + if (this._isWithActiveTrigger()) { + return; + } + this._isHovered = false; + this._setTimeout(() => { + if (!this._isHovered) { + this.hide(); + } + }, this._config.delay.hide); + } + _setTimeout(handler, timeout) { + clearTimeout(this._timeout); + this._timeout = setTimeout(handler, timeout); + } + _isWithActiveTrigger() { + return Object.values(this._activeTrigger).includes(true); + } + _getConfig(config) { + const dataAttributes = Manipulator.getDataAttributes(this._element); + + // Read text attributes without coercing their values. + const title = this._element.getAttribute('data-bs-title'); + const content = this._element.getAttribute('data-bs-content'); + if (title !== null) { + dataAttributes.title = title; + } + if (content !== null) { + dataAttributes.content = content; + } + 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); + if (typeof config.delay === 'number') { + config.delay = { + show: config.delay, + hide: config.delay + }; + } + if (typeof config.title === 'number') { + config.title = config.title.toString(); + } + if (typeof config.content === 'number') { + 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'; + + // In the future can be replaced with: + // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]]) + // `Object.fromEntries(keysWithDifferentValues)` + return config; + } + _disposePopper() { + if (this._popper) { + this._popper.destroy(); + this._popper = null; + } + if (this.tip) { + this.tip.remove(); + this.tip = null; + } + } + + // Static + static jQueryInterface(config) { + return this.each(function () { + const data = Tooltip.getOrCreateInstance(this, config); + if (typeof config !== 'string') { + return; + } + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`); + } + data[config](); + }); + } + } + + /** + * jQuery + */ + + defineJQueryPlugin(Tooltip); + + /** + * -------------------------------------------------------------------------- + * Bootstrap popover.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$3 = 'popover'; + const SELECTOR_TITLE = '.popover-header'; + const SELECTOR_CONTENT = '.popover-body'; + const Default$2 = { + ...Tooltip.Default, + content: '', + offset: [0, 8], + placement: 'right', + template: '', + trigger: 'click' + }; + const DefaultType$2 = { + ...Tooltip.DefaultType, + content: '(null|string|element|function)' + }; + + /** + * Class definition + */ + + class Popover extends Tooltip { + // Getters + static get Default() { + return Default$2; + } + static get DefaultType() { + return DefaultType$2; + } + static get NAME() { + return NAME$3; + } + + // Overrides + _isWithContent() { + return this._getTitle() || this._getContent(); + } + + // Private + _getContentForTemplate() { + return { + [SELECTOR_TITLE]: this._getTitle(), + [SELECTOR_CONTENT]: this._getContent() + }; + } + _getContent() { + return this._resolvePossibleFunction(this._config.content); + } + + // Static + static jQueryInterface(config) { + return this.each(function () { + const data = Popover.getOrCreateInstance(this, config); + if (typeof config !== 'string') { + return; + } + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`); + } + data[config](); + }); + } + } + + /** + * jQuery + */ + + defineJQueryPlugin(Popover); + + /** + * -------------------------------------------------------------------------- + * Bootstrap scrollspy.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + + /** + * Constants + */ + + const NAME$2 = 'scrollspy'; + const DATA_KEY$2 = 'bs.scrollspy'; + const EVENT_KEY$2 = `.${DATA_KEY$2}`; + const DATA_API_KEY = '.data-api'; + const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; + const EVENT_CLICK = `click${EVENT_KEY$2}`; + const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`; + const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-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_NAV_ITEMS = '.nav-item'; + const SELECTOR_LIST_ITEMS = '.list-group-item'; + const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`; + const SELECTOR_DROPDOWN = '.dropdown'; + const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; + const Default$1 = { + offset: null, + // TODO: v6 @deprecated, keep it for backwards compatibility reasons + rootMargin: '0px 0px -25%', + smoothScroll: false, + target: null, + threshold: [0.1, 0.5, 1] + }; + const DefaultType$1 = { + offset: '(number|null)', + // TODO v6 @deprecated, keep it for backwards compatibility reasons + rootMargin: 'string', + smoothScroll: 'boolean', + target: 'element', + threshold: 'array' + }; + + /** + * Class definition + */ + + class ScrollSpy extends BaseComponent { + constructor(element, config) { + super(element, config); + + // this._element is the observablesContainer and config.target the menu links wrapper + this._targetLinks = new Map(); + this._observableSections = new Map(); + this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element; + this._activeTarget = null; + this._observer = null; + this._previousScrollData = { + visibleEntryTop: 0, + parentScrollTop: 0 + }; + this.refresh(); // initialize + } + + // Getters + static get Default() { + return Default$1; + } + static get DefaultType() { + return DefaultType$1; + } + static get NAME() { + return NAME$2; + } + + // Public + refresh() { + this._initializeTargetsAndObservables(); + this._maybeEnableSmoothScroll(); + if (this._observer) { + this._observer.disconnect(); + } else { + this._observer = this._getNewObserver(); + } + for (const section of this._observableSections.values()) { + this._observer.observe(section); + } + } + dispose() { + this._observer.disconnect(); + super.dispose(); + } + + // Private + _configAfterMerge(config) { + // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case + config.target = getElement(config.target) || document.body; + + // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only + config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin; + if (typeof config.threshold === 'string') { + config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value)); + } + return config; + } + _maybeEnableSmoothScroll() { + if (!this._config.smoothScroll) { + return; + } + + // unregister any previous listeners + EventHandler.off(this._config.target, EVENT_CLICK); + EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => { + const observableSection = this._observableSections.get(event.delegateTarget.hash); + if (observableSection) { + event.preventDefault(); + const root = this._rootElement || window; + const height = observableSection.offsetTop - this._element.offsetTop; + if (root.scrollTo) { + root.scrollTo({ + top: height, + behavior: 'smooth' + }); + return; + } + + // Chrome 60 doesn't support `scrollTo` + root.scrollTop = height; + } + }); + } + _getNewObserver() { + const options = { + root: this._rootElement, + threshold: this._config.threshold, + rootMargin: this._config.rootMargin + }; + return new IntersectionObserver(entries => this._observerCallback(entries), options); + } + + // The logic of selection + _observerCallback(entries) { + const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`); + const activate = entry => { + this._previousScrollData.visibleEntryTop = entry.target.offsetTop; + this._process(targetElement(entry)); + }; + const parentScrollTop = (this._rootElement || document.documentElement).scrollTop; + const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop; + this._previousScrollData.parentScrollTop = parentScrollTop; + for (const entry of entries) { + if (!entry.isIntersecting) { + this._activeTarget = null; + this._clearActiveClass(targetElement(entry)); + continue; + } + const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop; + // if we are scrolling down, pick the bigger offsetTop + if (userScrollsDown && entryIsLowerThanPrevious) { + activate(entry); + // if parent isn't scrolled, let's keep the first visible item, breaking the iteration + if (!parentScrollTop) { + return; + } + continue; + } + + // if we are scrolling up, pick the smallest offsetTop + if (!userScrollsDown && !entryIsLowerThanPrevious) { + activate(entry); + } + } + } + _initializeTargetsAndObservables() { + this._targetLinks = new Map(); + this._observableSections = new Map(); + const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target); + for (const anchor of targetLinks) { + // ensure that the anchor has an id and is not disabled + if (!anchor.hash || isDisabled(anchor)) { + continue; + } + const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element); + + // ensure that the observableSection exists & is visible + if (isVisible(observableSection)) { + this._targetLinks.set(decodeURI(anchor.hash), anchor); + this._observableSections.set(anchor.hash, observableSection); + } + } + } + _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) { + // Activate dropdown parents + if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { + SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1); + return; + } + for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) { + // Set triggered links parents as active + // With both