diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d63065b8..3ce92a5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,31 +16,30 @@ jobs: gemfile: - test/gemfiles/rails_6_0.gemfile - test/gemfiles/rails_6_1.gemfile - - test/gemfiles/rails_7_0_sassc.gemfile - test/gemfiles/rails_7_0_dartsass.gemfile + - test/gemfiles/rails_7_1.gemfile + - test/gemfiles/rails_7_2.gemfile + - test/gemfiles/rails_8_0.gemfile + - test/gemfiles/rails_8_1.gemfile + # Propshaft + dartsass-rails + importmap-rails, the default stack of `rails new`. + - test/gemfiles/rails_8_1_propshaft.gemfile + exclude: + # Rails 7.2 requires Ruby 3.1+. + - { ruby_version: '2.7', gemfile: test/gemfiles/rails_7_2.gemfile } + - { ruby_version: '3.0', gemfile: test/gemfiles/rails_7_2.gemfile } + # Rails 8 requires Ruby 3.2+. + - { ruby_version: '2.7', gemfile: test/gemfiles/rails_8_0.gemfile } + - { ruby_version: '3.0', gemfile: test/gemfiles/rails_8_0.gemfile } + - { ruby_version: '3.1', gemfile: test/gemfiles/rails_8_0.gemfile } + - { ruby_version: '2.7', gemfile: test/gemfiles/rails_8_1.gemfile } + - { ruby_version: '3.0', gemfile: test/gemfiles/rails_8_1.gemfile } + - { ruby_version: '3.1', gemfile: test/gemfiles/rails_8_1.gemfile } + - { ruby_version: '2.7', gemfile: test/gemfiles/rails_8_1_propshaft.gemfile } + - { ruby_version: '3.0', gemfile: test/gemfiles/rails_8_1_propshaft.gemfile } + - { ruby_version: '3.1', gemfile: test/gemfiles/rails_8_1_propshaft.gemfile } include: - - ruby_version: '2.5' - gemfile: test/gemfiles/rails_4_2.gemfile - ruby_version: '2.6' - gemfile: test/gemfiles/rails_4_2.gemfile - - ruby_version: '2.5' - gemfile: test/gemfiles/rails_5_0.gemfile - - ruby_version: '2.6' - gemfile: test/gemfiles/rails_5_0.gemfile - - ruby_version: '2.7' - gemfile: test/gemfiles/rails_5_0.gemfile - - ruby_version: '2.5' - gemfile: test/gemfiles/rails_5_1.gemfile - - ruby_version: '2.6' - gemfile: test/gemfiles/rails_5_1.gemfile - - ruby_version: '2.7' - gemfile: test/gemfiles/rails_5_1.gemfile - - ruby_version: '2.5' - gemfile: test/gemfiles/rails_5_2.gemfile - - ruby_version: '2.6' - gemfile: test/gemfiles/rails_5_2.gemfile - - ruby_version: '2.7' - gemfile: test/gemfiles/rails_5_2.gemfile + gemfile: test/gemfiles/rails_6_0.gemfile runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 diff --git a/.github/workflows/update-bootstrap.yml b/.github/workflows/update-bootstrap.yml new file mode 100644 index 00000000..35544ced --- /dev/null +++ b/.github/workflows/update-bootstrap.yml @@ -0,0 +1,65 @@ +name: Update Bootstrap + +# Re-import the dist files from an upstream twbs/bootstrap release tag (or +# branch/commit). The gem tracks a fixed pre-release tag, so this no longer +# runs on a schedule: when a new Bootstrap 6 tag is published, dispatch it +# with that tag and bump the `default` below. If the tracked ref differs from +# what is checked in, the assets are re-imported, the version synced, the +# stylesheets verified to still compile, and the result committed. + +on: + workflow_dispatch: + inputs: + ref: + description: Upstream twbs/bootstrap tag (or branch/commit) to import + required: false + default: v6.0.0-alpha.1 + +permissions: + contents: write + +concurrency: + group: update-bootstrap + cancel-in-progress: false + +jobs: + update: + runs-on: ubuntu-latest + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/test/gemfiles/rails_7_0_dartsass.gemfile + UPSTREAM_REF: ${{ github.event.inputs.ref || 'v6.0.0-alpha.1' }} + steps: + - uses: actions/checkout@v6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.4' + bundler-cache: true + + - name: Import Bootstrap and sync version + id: update + run: | + bundle exec rake update"[$UPSTREAM_REF]" + bundle exec rake sync_version"[$UPSTREAM_REF]" + # Only consider the update's own outputs, never stray CI artifacts. + if [ -n "$(git status --porcelain -- assets lib/bootstrap/version.rb)" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + else + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "Already up to date with twbs/bootstrap@${UPSTREAM_REF}." + fi + + - name: Verify the stylesheets still compile + if: steps.update.outputs.changed == 'true' + run: bundle exec rake debug + + - name: Commit and push + if: steps.update.outputs.changed == 'true' + run: | + sha=$(grep -oE "[0-9a-f]{40}" lib/bootstrap/version.rb | head -1) + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + git add -A -- assets lib/bootstrap/version.rb + git commit -m "Update Bootstrap to twbs/bootstrap@${UPSTREAM_REF} (${sha})" + git push diff --git a/.gitignore b/.gitignore index ec182536..7ed22e85 100644 --- a/.gitignore +++ b/.gitignore @@ -7,13 +7,15 @@ Gemfile.lock .rvmrc .rbenv-version -# Ignore bundler config -/.bundle +# Ignore bundler config (in the repo root and under test/gemfiles/*) +.bundle/ /vendor/cache /vendor/bundle tmp/ test/screenshots/ test/dummy_rails/log/*.log test/dummy_rails/public/assets/ +test/dummy_propshaft/log/*.log +test/dummy_propshaft/public/assets/ .DS_Store node_modules diff --git a/CHANGELOG.md b/CHANGELOG.md index b0d48127..e3f9d6b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,33 @@ The changelog only includes changes specific to the RubyGem. The Bootstrap framework changes can be found in [the Releases section of twbs/bootstrap](https://github.com/twbs/bootstrap/releases). Release announcement posts on [the official Bootstrap blog](http://blog.getbootstrap.com) contain summaries of the most noteworthy changes made in each release of Bootstrap. +# 6.0.0.alpha.1 + +First pre-release tracking Bootstrap 6 (upstream [`v6.0.0-alpha.1`](https://github.com/twbs/bootstrap/releases/tag/v6.0.0-alpha.1)). **This is an alpha; expect breaking changes.** + +* **Sass module system.** Bootstrap 6 replaced `@import` with `@use`/`@forward`. + Import Bootstrap with `@use "bootstrap"` and customize variables via + `@use "bootstrap" with (...)`. See the [v5→v6 migration guide](https://github.com/twbs/bootstrap/blob/v6.0.0-alpha.1/skills/bootstrap-v5-v6-migration/SKILL.md). +* **Dart Sass is required to compile the stylesheets.** LibSass/SassC + (`sassc-rails`) cannot compile the module system, so `sassc-rails` is no + longer a supported Sass engine. Use `dartsass-sprockets` (a drop-in + replacement), `dartsass-rails`, or `cssbundling-rails`. The minimum Ruby + version is now 2.6 (compiling the stylesheets with a Ruby-side engine + requires a recent Dart Sass, i.e. Ruby 3.1+). +* The standalone `bootstrap-grid`, `bootstrap-reboot`, and `bootstrap-utilities` + Sass entry points were removed upstream; only `bootstrap` remains. +* **JavaScript is now ES-module only.** Bootstrap 6 removed the UMD bundle and + the `window.bootstrap` global, so the `bootstrap-sprockets` Sprockets manifest + and the `globalThis` shim are gone. Load Bootstrap via importmaps (see the + README). +* **Popper replaced by [Floating UI](https://floating-ui.com/).** The `popper_js` + runtime dependency was removed. The self-contained `bootstrap.bundle.{js,min.js}` + builds inline both `@floating-ui/dom` and `vanilla-calendar-pro`, so a single + importmap pin works with no extra dependencies (the recommended path). For + lighter-weight pinning of the non-bundled `bootstrap.{js,min.js}` or individual + component modules, a self-contained ESM build of `@floating-ui/dom` is also + vendored as `floating-ui.js`. + # 5.3.4 * Autoprefixer is now optional. diff --git a/Gemfile b/Gemfile index 9f4cb9a3..a7fb19d7 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,6 @@ source 'https://rubygems.org' gemspec group :development do - gem 'popper_js', '>= 1.12.3' gem 'dartsass-sprockets' end diff --git a/README.md b/README.md index 493a5c08..adbd32dc 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,18 @@ # Bootstrap Ruby Gem [![CI](https://github.com/twbs/bootstrap-rubygem/actions/workflows/ci.yml/badge.svg)](https://github.com/twbs/bootstrap-rubygem/actions/workflows/ci.yml) [![Gem](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap) -[Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*/*Importmaps*) and Hanami (formerly Lotus). +[Bootstrap 6][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*/*Importmaps*) and Hanami (formerly Lotus). For Sass versions of Bootstrap 3 and 2 see [bootstrap-sass](https://github.com/twbs/bootstrap-sass) instead. +> **Bootstrap 6 (pre-release):** This is an alpha tracking the upstream +> [`v6.0.0-alpha.1`](https://github.com/twbs/bootstrap/releases/tag/v6.0.0-alpha.1) release. +> Bootstrap 6 moved its Sass to the [module system](https://sass-lang.com/documentation/at-rules/use) +> (`@use`/`@forward`), so its stylesheets require a **Dart Sass** engine to +> compile — LibSass/SassC (`sassc-rails`) cannot compile them and is no longer +> supported by this gem. Its JavaScript is ES-module only and is loaded via +> importmaps. See the [CHANGELOG](CHANGELOG.md). +> For the previous stable release, use `gem 'bootstrap', '~> 5.3.8'`. + **Ruby on Rails Note**: Newer releases of Rails have added additional ways for assets to be processed. The `twbs/bootstrap-rubygem` is for use with Importmaps or Sprockets, but not Webpack. @@ -21,14 +30,16 @@ Please see the appropriate guide for your environment of choice: Add `bootstrap` to your Gemfile: ```ruby -gem 'bootstrap', '~> 5.3.8' +gem 'bootstrap', '~> 6.0.0.alpha1' ``` -This gem requires a Sass engine, so make sure you have **one** of these gems in your Gemfile: -- [`dartsass-sprockets`](https://github.com/tablecheck/dartsass-sprockets): Dart Sass engine, recommended but only works for Ruby 2.6+ and Rails 5+ +This gem requires a Sass engine, so make sure you have **one** of these gems in your Gemfile. +Bootstrap 6 stylesheets use the Sass module system, so a **Dart Sass** engine is +required to compile them — `sassc-rails` (LibSass) cannot compile Bootstrap 6 and +is no longer supported; migrate to one of: +- [`dartsass-sprockets`](https://github.com/tablecheck/dartsass-sprockets): Dart Sass engine, recommended (a drop-in replacement for `sassc-rails`). Compiling Bootstrap 6 requires version 3.1+ and therefore Ruby 3.1+; older versions install on Ruby 2.6+ but bundle a Dart Sass too old for Bootstrap 6. - [`dartsass-rails`](https://github.com/rails/dartsass-rails): Dart Sass engine, recommended for Rails projects that use Propshaft -- [`cssbundling-rails`](https://github.com/rails/cssbundling-rails): External Sass engine -- [`sassc-rails`](https://github.com/sass/sassc-rails): SassC engine, deprecated but compatible with Ruby 2.3+ and Rails 4 +- [`cssbundling-rails`](https://github.com/rails/cssbundling-rails): External Sass engine, runs Dart Sass in Node so it works on any supported Ruby Also ensure that `sprockets-rails` is at least v2.3.2. @@ -37,14 +48,24 @@ If you are using Rails, add the `autoprefixer-rails` gem to your app and ensure `bundle install` and restart your server to make the files available through the pipeline. -Import Bootstrap styles in `app/assets/stylesheets/application.scss`: +Import Bootstrap styles in `app/assets/stylesheets/application.scss` with `@use` +(Bootstrap 6 no longer supports `@import`): + +```scss +@use "bootstrap"; +``` + +To customize Bootstrap's variables, configure them through the `@use ... with` +rule instead of setting globals before an `@import`: ```scss -// Custom bootstrap variables must be set or imported *before* bootstrap. -@import "bootstrap"; +@use "bootstrap" with ( + $primary: #c0ffee, + $enable-rounded: false +); ``` -The available variables can be found [here](assets/stylesheets/bootstrap/_variables.scss). +The available variables can be found in [`bootstrap/_config.scss`](assets/stylesheets/bootstrap/_config.scss). Make sure the file has `.scss` extension (or `.sass` for Sass syntax). If you have just generated a new Rails app, it may come with a `.css` file instead. If this file exists, it will be served instead of Sass, so rename it: @@ -53,57 +74,68 @@ it may come with a `.css` file instead. If this file exists, it will be served i $ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss ``` -Then, remove all the `*= require` and `*= require_tree` statements from the Sass file. Instead, use `@import` to import Sass files. +Then, remove all the `*= require` and `*= require_tree` statements from the Sass file. Instead, use `@use` to import Sass files. Do not use `*= require` in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables. -Bootstrap JavaScript can optionally use jQuery. -If you're using Rails 5.1+, you can add the `jquery-rails` gem to your Gemfile: +### JavaScript -```ruby -gem 'jquery-rails' -``` +Bootstrap 6's JavaScript is **ES-module only** — there is no UMD bundle and no +`window.bootstrap` global, so the old Sprockets `//= require bootstrap-sprockets` +concatenation is gone. Load it through **importmaps** instead. -Bootstrap tooltips and popovers depend on [popper.js] for positioning. -The `bootstrap` gem already depends on the -[popper_js](https://github.com/glebm/popper_js-rubygem) gem. +Bootstrap 6 uses [Floating UI](https://floating-ui.com/) (`@floating-ui/dom`) +for positioning tooltips, popovers, and menus, replacing Popper. A self-contained +ESM build of `@floating-ui/dom` is **vendored in this gem** as `floating-ui.js`, +so you do not need an external dependency for it. #### Importmaps -You can pin either `bootstrap.js` or `bootstrap.min.js` in `config/importmap.rb` -as well as `popper.js`: +The simplest option is the self-contained **bundle** +(`bootstrap.bundle.min.js`), which inlines Floating UI and `vanilla-calendar-pro`, +so it needs no other pins. In `config/importmap.rb`: ```ruby -pin "bootstrap", to: "bootstrap.min.js", preload: true -pin "@popperjs/core", to: "popper.js", preload: true +pin "bootstrap", to: "bootstrap.bundle.min.js", preload: true ``` -Whichever files you pin will need to be added to `config.assets.precompile`: +Then import the components you need from your application's entrypoint: -```ruby -# config/initializers/assets.rb -Rails.application.config.assets.precompile += %w(bootstrap.min.js popper.js) +```js +// app/javascript/application.js +import { Tooltip } from "bootstrap" + +for (const el of document.querySelectorAll('[data-bs-toggle="tooltip"]')) { + new Tooltip(el) +} ``` -#### Sprockets +The data-attribute APIs (`data-bs-toggle`, etc.) work automatically once the +module is loaded. -Add Bootstrap dependencies and Bootstrap to your `application.js`: +
+Lighter-weight pinning (without the bundle) -```js -//= require jquery3 -//= require popper -//= require bootstrap-sprockets +If you want to avoid the bundled Floating UI / Datepicker code, pin the +non-bundled `bootstrap.min.js` together with the gem's **vendored** +`@floating-ui/dom` build: + +```ruby +pin "bootstrap", to: "bootstrap.min.js", preload: true +pin "@floating-ui/dom", to: "floating-ui.js", preload: true ``` -While `bootstrap-sprockets` provides individual Bootstrap components -for ease of debugging, you may alternatively require -the concatenated `bootstrap` for faster compilation: +Individual components are also available as separate modules +(e.g. `pin "bootstrap/tooltip", to: "bootstrap/tooltip.js"`) for finer-grained +pinning. The [Datepicker](https://getbootstrap.com/) component additionally +depends on [`vanilla-calendar-pro`](https://www.npmjs.com/package/vanilla-calendar-pro), +which is **not** vendored — if you use it (or the non-bundled `bootstrap.min.js`, +which imports it), pin it from a CDN: -```js -//= require jquery3 -//= require popper -//= require bootstrap +```ruby +pin "vanilla-calendar-pro", to: "https://ga.jspm.io/npm:vanilla-calendar-pro@3.1.0/index.js" ``` +
### b. Other Ruby frameworks @@ -123,13 +155,11 @@ By default all of Bootstrap is imported. You can also import components explicitly. To start with a full list of modules copy [`_bootstrap.scss`](assets/stylesheets/_bootstrap.scss) file into your assets as `_bootstrap-custom.scss`. Then comment out components you do not want from `_bootstrap-custom`. -In the application Sass file, replace `@import 'bootstrap'` with: +In the application Sass file, replace `@use 'bootstrap'` with: ```scss -@import 'bootstrap-custom'; +@use 'bootstrap-custom'; ``` [bootstrap-home]: https://getbootstrap.com -[bootstrap-variables.scss]: https://github.com/twbs/bootstrap-rubygem/blob/master/templates/project/_bootstrap-variables.scss [autoprefixer]: https://github.com/ai/autoprefixer -[popper.js]: https://popper.js.org diff --git a/Rakefile b/Rakefile index 52402cce..29acc5a2 100644 --- a/Rakefile +++ b/Rakefile @@ -7,7 +7,11 @@ $:.unshift(lib_path) unless $:.include?(lib_path) require 'rake/testtask' Rake::TestTask.new do |t| t.libs << 'test' - t.test_files = FileList['test/**/*_test.rb'] + # Only one dummy Rails app can boot per process: the Propshaft one when the + # bundle has Propshaft (test/gemfiles/*_propshaft.gemfile), else the Sprockets one. + t.test_files = FileList['test/**/*_test.rb'].exclude( + Gem.loaded_specs.key?('propshaft') ? 'test/rails_test.rb' : 'test/propshaft_test.rb' + ) t.verbose = false t.warning = false end @@ -58,7 +62,8 @@ task :debug do require './lib/bootstrap' require 'term/ansicolor' path = Bootstrap.stylesheets_path - %w(_bootstrap _bootstrap-reboot _bootstrap-grid).each do |file| + # Bootstrap 6 exposes a single `bootstrap` entry point. + %w(_bootstrap).each do |file| filename = "#{path}/#{file}.scss" css = if defined?(SassC::Engine) SassC::Engine.new(File.read(filename), filename: filename, syntax: :scss).render @@ -71,12 +76,28 @@ task :debug do end end -desc 'Update bootstrap from upstream' +desc 'Update bootstrap from upstream (tag, branch or commit; default main)' task :update, :branch do |t, args| require './tasks/updater' Updater.new(branch: args[:branch]).update_bootstrap end +desc 'Update only bootstrap stylesheets from upstream tag/branch (leaves JS untouched)' +task :update_scss, :branch do |t, args| + require './tasks/updater' + Updater.new(branch: args[:branch], skip_js: true).update_bootstrap +end + +desc 'Sync the gem VERSION to the upstream Bootstrap package.json version' +task :sync_version, :branch do |t, args| + require './tasks/updater' + # npm prerelease versions (e.g. 6.0.0-alpha.1) map to RubyGems (6.0.0.alpha.1). + gem_version = Updater.new(branch: args[:branch]).upstream_version.sub('-', '.') + path = 'lib/bootstrap/version.rb' + File.write(path, File.read(path).sub(/VERSION\s*=\s*'[^']*'/, "VERSION = '#{gem_version}'")) + $stderr.puts "VERSION set to #{gem_version}" +end + desc 'Start a dummy Rails app server' task :rails_server do require 'rack' diff --git a/assets/javascripts/bootstrap-global-this-define.js b/assets/javascripts/bootstrap-global-this-define.js deleted file mode 100644 index f3a3cc13..00000000 --- a/assets/javascripts/bootstrap-global-this-define.js +++ /dev/null @@ -1,6 +0,0 @@ -// Set a `globalThis` so that bootstrap components are defined on window.bootstrap instead of window. -window['bootstrap'] = { - "@popperjs/core": window.Popper, - _originalGlobalThis: window['globalThis'] -}; -window['globalThis'] = window['bootstrap']; diff --git a/assets/javascripts/bootstrap-global-this-undefine.js b/assets/javascripts/bootstrap-global-this-undefine.js deleted file mode 100644 index 6f96eb1d..00000000 --- a/assets/javascripts/bootstrap-global-this-undefine.js +++ /dev/null @@ -1,2 +0,0 @@ -window['globalThis'] = window['bootstrap']._originalGlobalThis; -window['bootstrap']._originalGlobalThis = null; diff --git a/assets/javascripts/bootstrap-sprockets.js b/assets/javascripts/bootstrap-sprockets.js deleted file mode 100644 index 8235e211..00000000 --- a/assets/javascripts/bootstrap-sprockets.js +++ /dev/null @@ -1,28 +0,0 @@ -//= require ./bootstrap-global-this-define -//= require ./bootstrap/dom/data -//= require ./bootstrap/util/index -//= require ./bootstrap/dom/event-handler -//= require ./bootstrap/dom/manipulator -//= require ./bootstrap/util/config -//= require ./bootstrap/base-component -//= require ./bootstrap/util/sanitizer -//= require ./bootstrap/dom/selector-engine -//= require ./bootstrap/util/template-factory -//= require ./bootstrap/tooltip -//= require ./bootstrap/popover -//= require ./bootstrap/util/component-functions -//= require ./bootstrap/alert -//= require ./bootstrap/toast -//= require ./bootstrap/button -//= require ./bootstrap/collapse -//= require ./bootstrap/util/scrollbar -//= require ./bootstrap/tab -//= require ./bootstrap/util/focustrap -//= require ./bootstrap/util/backdrop -//= require ./bootstrap/scrollspy -//= require ./bootstrap/modal -//= require ./bootstrap/offcanvas -//= require ./bootstrap/util/swipe -//= require ./bootstrap/carousel -//= require ./bootstrap/dropdown -//= require ./bootstrap-global-this-undefine diff --git a/assets/javascripts/bootstrap.bundle.js b/assets/javascripts/bootstrap.bundle.js new file mode 100644 index 00000000..b41a6a1b --- /dev/null +++ b/assets/javascripts/bootstrap.bundle.js @@ -0,0 +1,8763 @@ +/*! +* Bootstrap v6.0.0-alpha.1 (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) +*/ +//#region js/src/dom/data.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap dom/data.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const elementMap = /* @__PURE__ */ new Map(); +var data_default = { + set(element, key, instance) { + if (!elementMap.has(element)) elementMap.set(element, /* @__PURE__ */ new Map()); + const instanceMap = elementMap.get(element); + if (!instanceMap.has(key) && instanceMap.size !== 0) { + console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${[...instanceMap.keys()][0]}.`); + return; + } + instanceMap.set(key, instance); + }, + get(element, key) { + if (element && elementMap.has(element)) return elementMap.get(element).get(key) || null; + return null; + }, + getAny(element) { + if (element && elementMap.has(element)) return elementMap.get(element).values().next().value || null; + return null; + }, + remove(element, key) { + if (!elementMap.has(element)) return; + const instanceMap = elementMap.get(element); + instanceMap.delete(key); + if (instanceMap.size === 0) elementMap.delete(element); + } +}; +//#endregion +//#region js/src/dom/event-handler.ts +/** +* Constants +*/ +const namespaceRegex = /[^.]*(?=\..*)\.|.*/; +const stripNameRegex = /\..*/; +const stripUidRegex = /::\d+$/; +const eventRegistry = {}; +let uidEvent = 1; +const customEvents = { + mouseenter: "mouseover", + mouseleave: "mouseout" +}; +const nativeEvents = /* @__PURE__ */ new Set([ + "click", + "dblclick", + "mouseup", + "mousedown", + "contextmenu", + "mousewheel", + "DOMMouseScroll", + "mouseover", + "mouseout", + "mousemove", + "selectstart", + "selectend", + "keydown", + "keypress", + "keyup", + "input", + "paste", + "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", + "scrollend" +]); +/** +* 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 isMouseEventWithinTarget(event) { + const { delegateTarget, relatedTarget } = event; + return Boolean(relatedTarget && delegateTarget.contains(relatedTarget)); +} +function bootstrapHandler(element, fn, handlerTypeEvent) { + const isCustomMouseEvent = handlerTypeEvent in customEvents; + return function handler(event) { + const bootstrapEvent = hydrateObj(event, { delegateTarget: element }); + if (isCustomMouseEvent && isMouseEventWithinTarget(bootstrapEvent)) return; + if (handler.oneOff) EventHandler.off(element, handlerTypeEvent, fn); + return fn.apply(element, [bootstrapEvent]); + }; +} +function bootstrapDelegationHandler(element, selector, fn, handlerTypeEvent) { + const isCustomMouseEvent = handlerTypeEvent in customEvents; + 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; + const bootstrapEvent = hydrateObj(event, { delegateTarget: target }); + if (isCustomMouseEvent && isMouseEventWithinTarget(bootstrapEvent)) return; + if (handler.oneOff) EventHandler.off(element, handlerTypeEvent, selector, fn); + return fn.apply(target, [bootstrapEvent]); + } + }; +} +function findHandler(events, callable, handlerTypeEvent, delegationSelector = null) { + return Object.values(events).find((event) => event.callable === callable && event.handlerTypeEvent === handlerTypeEvent && event.delegationSelector === delegationSelector); +} +function normalizeParameters(originalTypeEvent, handler, delegationFunction) { + const isDelegated = typeof handler === "string"; + const callable = isDelegated ? delegationFunction : handler || delegationFunction; + const baseTypeEvent = originalTypeEvent.replace(stripNameRegex, ""); + let typeEvent = customEvents[baseTypeEvent] || baseTypeEvent; + if (!nativeEvents.has(typeEvent)) typeEvent = originalTypeEvent; + const handlerTypeEvent = baseTypeEvent in customEvents ? baseTypeEvent : typeEvent; + return { + isDelegated, + callable, + typeEvent, + handlerTypeEvent + }; +} +function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { + if (typeof originalTypeEvent !== "string" || !element) return; + const { isDelegated, callable, typeEvent, handlerTypeEvent } = normalizeParameters(originalTypeEvent, handler, delegationFunction); + const events = getElementEvents(element); + const handlers = events[typeEvent] || (events[typeEvent] = {}); + const previousFunction = findHandler(handlers, callable, handlerTypeEvent, 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, handlerTypeEvent) : bootstrapHandler(element, callable, handlerTypeEvent); + fn.delegationSelector = isDelegated ? handler : null; + fn.callable = callable; + fn.handlerTypeEvent = handlerTypeEvent; + fn.oneOff = oneOff; + fn.uidEvent = uid; + handlers[uid] = fn; + element.addEventListener(typeEvent, fn, isDelegated); +} +function removeHandler(element, events, typeEvent, handler) { + element.removeEventListener(typeEvent, handler, Boolean(handler.delegationSelector)); + delete events[typeEvent][handler.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); +} +function trigger(element, event, args) { + if (typeof event !== "string" || !element) return null; + const evt = hydrateObj(new Event(event, { + bubbles: true, + cancelable: true + }), args); + element.dispatchEvent(evt); + return evt; +} +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, handlerTypeEvent } = normalizeParameters(originalTypeEvent, handler, delegationFunction); + const inNamespace = typeEvent !== originalTypeEvent && handlerTypeEvent !== originalTypeEvent; + const events = getElementEvents(element); + const storeElementEvent = events[typeEvent] || {}; + const isNamespace = originalTypeEvent.startsWith("."); + if (typeof callable !== "undefined") { + if (!Object.keys(storeElementEvent).length) return; + const fn = findHandler(storeElementEvent, callable, handlerTypeEvent, isDelegated ? handler : null); + if (fn) removeHandler(element, events, typeEvent, fn); + 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 (event.handlerTypeEvent === handlerTypeEvent && (!inNamespace || originalTypeEvent.includes(handlerKey))) removeHandler(element, events, typeEvent, event); + } + }, + trigger +}; +function hydrateObj(obj, meta = {}) { + for (const [key, value] of Object.entries(meta)) try { + obj[key] = value; + } catch { + Object.defineProperty(obj, key, { + configurable: true, + get() { + return value; + } + }); + } + return obj; +} +//#endregion +//#region js/src/dom/manipulator.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap dom/manipulator.ts +* 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 { + 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)}`)); + } +}; +//#endregion +//#region js/src/util/index.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap util/index.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +const MAX_UID = 1e6; +const MILLISECONDS_MULTIPLIER = 1e3; +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 selector - The selector to escape +* @returns The escaped selector +*/ +const parseSelector = (selector) => { + if (selector && window.CSS && window.CSS.escape) selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`); + return selector; +}; +const toType = (object) => { + if (object === null || object === void 0) 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; + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + if (!Number.parseFloat(transitionDuration) && !Number.parseFloat(transitionDelay)) return 0; + 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; + return typeof object.nodeType !== "undefined"; +}; +const getElement = (object) => { + if (isElement$1(object)) return 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"; + 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; + const disableableElement = element; + if (typeof disableableElement.disabled !== "undefined") return disableableElement.disabled; + return element.hasAttribute("disabled") && element.getAttribute("disabled") !== "false"; +}; +const setAriaAttribute = (element, name, value) => { + element.setAttribute(name, String(value)); +}; +const findShadowRoot = (element) => { + if (!document.documentElement.attachShadow) return null; + if (typeof element.getRootNode === "function") { + const root = element.getRootNode(); + return root instanceof ShadowRoot ? root : null; + } + if (element instanceof ShadowRoot) return element; + if (!element.parentNode) return null; + return findShadowRoot(element.parentNode); +}; +const noop = () => {}; +const isRTL$1 = () => document.documentElement.dir === "rtl"; +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 emulatedDuration = getTransitionDurationFromElement(transitionElement) + 5; + 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 list - The list of elements to traverse +* @param activeElement - The currently active element +* @param shouldGetNext - Whether to return the next element (`true`) or the previous one (`false`) +* @param isCycleAllowed - Whether to cycle back to the opposite end of the list when reaching the boundary +* @returns The appropriate previous/next element from the list +*/ +const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { + const listLength = list.length; + let index = list.indexOf(activeElement); + 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))]; +}; +//#endregion +//#region js/src/util/config.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap util/config.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Class definition +*/ +var Config = class { + 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") : {}; + 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}".`); + } + } +}; +//#endregion +//#region js/src/base-component.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap base-component.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const VERSION = "6.0.0-alpha.1"; +/** +* Class definition +*/ +var BaseComponent = class extends Config { + constructor(element, config) { + super(); + element = getElement(element); + if (!element) return; + this._element = element; + this._config = this._getConfig(config); + const existingInstance = data_default.get(this._element, this.constructor.DATA_KEY); + if (existingInstance) existingInstance.dispose(); + data_default.set(this._element, this.constructor.DATA_KEY, this); + } + dispose() { + data_default.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; + } + _queueCallback(callback, element, isAnimated = true) { + return new Promise((resolve) => { + executeAfterTransition(() => { + if (this._element) callback(); + resolve(); + }, element, isAnimated); + }); + } + _getConfig(config) { + config = this._mergeConfigObj(config, this._element); + config = this._configAfterMerge(config); + this._typeCheckConfig(config); + return config; + } + static getInstance(element) { + return data_default.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}`; + } +}; +//#endregion +//#region js/src/dom/selector-engine.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap dom/selector-engine.ts +* 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"); + if (!hrefAttribute || !hrefAttribute.includes("#") && !hrefAttribute.startsWith(".")) return null; + 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 [...Element.prototype.querySelectorAll.call(element, selector)]; + }, + findOne(selector, element = document.documentElement) { + return Element.prototype.querySelector.call(element, selector); + }, + parents(element, selector) { + const parents = []; + let ancestor = element.parentNode.closest(selector); + while (ancestor) { + parents.push(ancestor); + ancestor = ancestor.parentNode.closest(selector); + } + return parents; + }, + closest(element, selector) { + return Element.prototype.closest.call(element, selector); + }, + prev(element, selector) { + let previous = element.previousElementSibling; + while (previous) { + if (previous.matches(selector)) return [previous]; + previous = previous.previousElementSibling; + } + return []; + }, + next(element, selector) { + let next = element.nextElementSibling; + while (next) { + if (next.matches(selector)) return [next]; + next = next.nextElementSibling; + } + return []; + }, + 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) : []; + } +}; +//#endregion +//#region js/src/util/component-functions.ts +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}, [class*=":${name}"]`); + component.getOrCreateInstance(target)[method](); + }); +}; +const eventActionOnPlugin = (Plugin, onEvent, stringSelector, method, callback = null) => { + eventAction(`${onEvent}.${Plugin.NAME}`, stringSelector, (data) => { + const instances = data.targets.filter(Boolean).map((element) => Plugin.getOrCreateInstance(element)); + if (typeof callback === "function") callback({ + ...data, + instances + }); + for (const instance of instances) instance[method](); + }); +}; +const eventAction = (onEvent, stringSelector, callback) => { + const selector = `${stringSelector}:not(.disabled):not(:disabled)`; + EventHandler.on(document, onEvent, selector, function(event) { + if (["A", "AREA"].includes(this.tagName)) event.preventDefault(); + const selector = SelectorEngine.getSelectorFromElement(this); + callback({ + targets: selector ? SelectorEngine.find(selector) : [this], + event + }); + }); +}; +//#endregion +//#region js/src/alert.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap alert.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$21 = "alert"; +const EVENT_KEY$18 = `.bs.alert`; +const EVENT_CLOSE = `close${EVENT_KEY$18}`; +const EVENT_CLOSED = `closed${EVENT_KEY$18}`; +const CLASS_NAME_HIDING = "hiding"; +const CLASS_NAME_SHOW$7 = "show"; +/** +* Class definition +*/ +var Alert = class extends BaseComponent { + static get NAME() { + return NAME$21; + } + async close() { + if (EventHandler.trigger(this._element, EVENT_CLOSE).defaultPrevented) return; + this._element.classList.remove(CLASS_NAME_SHOW$7); + this._element.classList.add(CLASS_NAME_HIDING); + const isAnimated = getTransitionDurationFromElement(this._element) > 0; + await this._queueCallback(() => this._destroyElement(), this._element, isAnimated); + } + _destroyElement() { + this._element.remove(); + EventHandler.trigger(this._element, EVENT_CLOSED); + this.dispose(); + } +}; +/** +* Data API implementation +*/ +enableDismissTrigger(Alert, "close"); +//#endregion +//#region js/src/button.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap button.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$20 = "button"; +const EVENT_KEY$17 = `.bs.button`; +const DATA_API_KEY$12 = ".data-api"; +const CLASS_NAME_ACTIVE$4 = "active"; +const SELECTOR_DATA_TOGGLE$10 = "[data-bs-toggle=\"button\"]"; +const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$17}${DATA_API_KEY$12}`; +const EVENT_DOM_CONTENT_LOADED$1 = `DOMContentLoaded${EVENT_KEY$17}${DATA_API_KEY$12}`; +/** +* Class definition +*/ +var Button = class extends BaseComponent { + static get NAME() { + return NAME$20; + } + toggle() { + setAriaAttribute(this._element, "aria-pressed", this._element.classList.toggle(CLASS_NAME_ACTIVE$4)); + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$8, SELECTOR_DATA_TOGGLE$10, (event) => { + event.preventDefault(); + const button = event.target.closest(SELECTOR_DATA_TOGGLE$10); + Button.getOrCreateInstance(button).toggle(); +}); +EventHandler.on(document, EVENT_DOM_CONTENT_LOADED$1, () => { + for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE$10)) if (!element.hasAttribute("aria-pressed")) setAriaAttribute(element, "aria-pressed", element.classList.contains(CLASS_NAME_ACTIVE$4)); +}); +//#endregion +//#region js/src/carousel.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap carousel.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$19 = "carousel"; +const EVENT_KEY$16 = `.bs.carousel`; +const DATA_API_KEY$11 = ".data-api"; +const ARROW_LEFT_KEY$2 = "ArrowLeft"; +const ARROW_RIGHT_KEY$2 = "ArrowRight"; +const DIRECTION_LEFT = "left"; +const DIRECTION_RIGHT = "right"; +const EVENT_SLIDE = `slide${EVENT_KEY$16}`; +const EVENT_SLID = `slid${EVENT_KEY$16}`; +const EVENT_KEYDOWN$2 = `keydown${EVENT_KEY$16}`; +const EVENT_MOUSEENTER$2 = `mouseenter${EVENT_KEY$16}`; +const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$16}`; +const EVENT_POINTERDOWN$3 = `pointerdown${EVENT_KEY$16}`; +const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$16}${DATA_API_KEY$11}`; +const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$16}${DATA_API_KEY$11}`; +const CLASS_NAME_CAROUSEL = "carousel"; +const CLASS_NAME_ACTIVE$3 = "active"; +const CLASS_NAME_FADE = "carousel-fade"; +const CLASS_NAME_CENTER = "carousel-center"; +const CLASS_NAME_AUTO = "carousel-auto"; +const CLASS_NAME_CLONE = "carousel-item-clone"; +const CLASS_NAME_PAUSED = "paused"; +const CLASS_NAME_PLAYING = "carousel-playing"; +const PROPERTY_INTERVAL = "--bs-carousel-interval"; +const SCROLL_DURATION = 300; +const ACTIVE_RATIO_TOLERANCE = .05; +const SELECTOR_ACTIVE = ".active"; +const SELECTOR_ITEM = `.carousel-item:not(.${CLASS_NAME_CLONE})`; +const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM; +const SELECTOR_INNER$1 = ".carousel-inner"; +const SELECTOR_INDICATORS = ".carousel-indicators"; +const SELECTOR_PLAY_PAUSE = ".carousel-control-play-pause"; +const SELECTOR_DATA_SLIDE = "[data-bs-slide], [data-bs-slide-to]"; +const SELECTOR_DATA_SLIDE_PREV = "[data-bs-slide=\"prev\"]"; +const SELECTOR_DATA_SLIDE_NEXT = "[data-bs-slide=\"next\"]"; +const SELECTOR_DATA_AUTOPLAY = "[data-bs-autoplay=\"true\"]"; +const KEY_TO_DIRECTION = { + [ARROW_LEFT_KEY$2]: DIRECTION_RIGHT, + [ARROW_RIGHT_KEY$2]: DIRECTION_LEFT +}; +const ENDS_STOP = "stop"; +const ENDS_WRAP = "wrap"; +const ENDS_LOOP = "loop"; +const Default$18 = { + autoplay: false, + ends: ENDS_LOOP, + interval: 5e3, + keyboard: true, + pause: "hover" +}; +const DefaultType$18 = { + autoplay: "boolean", + ends: "string", + interval: "number", + keyboard: "boolean", + pause: "(string|boolean)" +}; +const easeInOutCubic = (progress) => progress < .5 ? 4 * progress * progress * progress : 1 - (-2 * progress + 2) ** 3 / 2; +/** +* Class definition +*/ +var Carousel = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._viewport = SelectorEngine.findOne(SELECTOR_INNER$1, this._element) || this._element; + this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); + this._playPauseElement = SelectorEngine.findOne(SELECTOR_PLAY_PAUSE, this._element); + this._prevControls = SelectorEngine.find(SELECTOR_DATA_SLIDE_PREV, this._element); + this._nextControls = SelectorEngine.find(SELECTOR_DATA_SLIDE_NEXT, this._element); + this._interval = null; + this._observer = null; + this._scrollFrame = null; + this._looping = false; + this._visibility = /* @__PURE__ */ new Map(); + this._playing = this._config.autoplay; + this._activeIndex = this._initialActiveIndex(); + this._addEventListeners(); + this._observeItems(); + this._refreshActiveState(); + if (this._playing) this.cycle(); + this._updatePlayPauseControl(); + } + static get Default() { + return Default$18; + } + static get DefaultType() { + return DefaultType$18; + } + static get NAME() { + return NAME$19; + } + next() { + this.to(this._navIndex() + 1); + } + nextWhenVisible() { + if (document.visibilityState === "visible" && isVisible(this._element)) this.next(); + } + prev() { + this.to(this._navIndex() - 1); + } + pause() { + this._clearInterval(); + this._element.classList.remove(CLASS_NAME_PLAYING); + } + cycle() { + this._clearInterval(); + this._scheduleAutoplay(); + this._element.classList.add(CLASS_NAME_PLAYING); + } + to(index) { + if (this._looping) return; + const items = this._getItems(); + const rawIndex = Number.parseInt(index, 10); + if (this._config.ends === ENDS_LOOP && !this._prefersReducedMotion() && this._canLoop()) { + if (rawIndex > items.length - 1) { + this._loopTransition(true); + return; + } + if (rawIndex < 0) { + this._loopTransition(false); + return; + } + } + const targetIndex = this._normalizeIndex(rawIndex, items.length); + const currentIndex = this._navIndex(); + if (targetIndex === null || targetIndex === currentIndex) return; + if (EventHandler.trigger(this._element, EVENT_SLIDE, { + relatedTarget: items[targetIndex], + direction: this._direction(currentIndex, targetIndex), + from: currentIndex, + to: targetIndex + }).defaultPrevented) return; + if (this._isFade()) { + this._fadeTo(targetIndex); + return; + } + this._scrollToIndex(targetIndex); + } + dispose() { + this._clearInterval(); + if (this._observer) this._observer.disconnect(); + if (this._scrollFrame !== null) cancelAnimationFrame(this._scrollFrame); + for (const clone of SelectorEngine.find(`.${CLASS_NAME_CLONE}`, this._viewport)) clone.remove(); + this._viewport.style.scrollSnapType = ""; + EventHandler.off(this._viewport, EVENT_KEY$16); + super.dispose(); + } + _configAfterMerge(config) { + if (![ + ENDS_STOP, + ENDS_WRAP, + ENDS_LOOP + ].includes(config.ends)) config.ends = Default$18.ends; + return config; + } + _initialActiveIndex() { + const active = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + const index = active ? this._getItems().indexOf(active) : 0; + return Math.max(index, 0); + } + _addEventListeners() { + if (this._config.keyboard) EventHandler.on(this._element, EVENT_KEYDOWN$2, (event) => this._keydown(event)); + if (this._config.pause === "hover") { + EventHandler.on(this._element, EVENT_MOUSEENTER$2, () => this.pause()); + EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle()); + } + EventHandler.on(this._viewport, EVENT_POINTERDOWN$3, () => this._pauseFromInteraction()); + } + _keydown(event) { + if (/input|textarea/i.test(event.target.tagName)) return; + const direction = KEY_TO_DIRECTION[event.key]; + if (direction) { + event.preventDefault(); + this._pauseFromInteraction(); + if (direction === DIRECTION_RIGHT) this.prev(); + else this.next(); + } + } + _observeItems() { + if (this._isFade() || typeof IntersectionObserver === "undefined") return; + this._observer = new IntersectionObserver((entries) => this._handleIntersection(entries), { + root: this._viewport, + threshold: [ + 0, + .25, + .5, + .75, + 1 + ] + }); + for (const item of this._getItems()) this._observer.observe(item); + } + _handleIntersection(entries) { + if (this._looping) return; + for (const entry of entries) this._visibility.set(entry.target, entry.isIntersecting ? entry.intersectionRatio : 0); + const ratios = this._getItems().map((item) => this._visibility.get(item) ?? 0); + const maxRatio = Math.max(...ratios); + let bestIndex = this._activeIndex; + if (maxRatio > 0) bestIndex = ratios.findIndex((ratio) => ratio >= maxRatio - ACTIVE_RATIO_TOLERANCE); + this._setActive(bestIndex); + this._updateEndControls(); + } + _navIndex() { + if (this._isFade() || this._viewport.scrollWidth - this._viewport.clientWidth <= 0) return this._activeIndex; + let index = this._activeIndex; + let smallestDelta = Number.POSITIVE_INFINITY; + for (const [itemIndex, item] of this._getItems().entries()) { + const delta = Math.abs(this._scrollDelta(item)); + if (delta < smallestDelta) { + smallestDelta = delta; + index = itemIndex; + } + } + return index; + } + _scrollToIndex(index) { + const item = this._getItems()[index]; + if (!item) return; + const left = this._scrollDelta(item); + if (Math.abs(left) < 1) return; + const targetLeft = this._viewport.scrollLeft + left; + this._viewport.style.scrollSnapType = "none"; + this._animateScroll(targetLeft, () => { + this._viewport.style.scrollSnapType = ""; + if (!this._observer) this._setActive(index); + this._updateEndControls(); + }); + } + _animateScroll(targetLeft, onComplete) { + if (this._scrollFrame !== null) { + cancelAnimationFrame(this._scrollFrame); + this._scrollFrame = null; + } + const startLeft = this._viewport.scrollLeft; + const distance = targetLeft - startLeft; + if (this._prefersReducedMotion() || typeof requestAnimationFrame === "undefined") { + this._viewport.scrollTo({ + left: targetLeft, + behavior: "instant" + }); + onComplete(); + return; + } + let startTime = null; + const step = (now) => { + if (startTime === null) startTime = now; + const progress = Math.min((now - startTime) / SCROLL_DURATION, 1); + this._viewport.scrollTo({ + left: startLeft + distance * easeInOutCubic(progress), + behavior: "instant" + }); + if (progress < 1) { + this._scrollFrame = requestAnimationFrame(step); + return; + } + this._viewport.scrollTo({ + left: targetLeft, + behavior: "instant" + }); + this._scrollFrame = null; + onComplete(); + }; + this._scrollFrame = requestAnimationFrame(step); + } + _scrollDelta(element) { + const viewportRect = this._viewport.getBoundingClientRect(); + const rect = element.getBoundingClientRect(); + if (this._element.classList.contains(CLASS_NAME_CENTER)) return rect.left + rect.width / 2 - (viewportRect.left + viewportRect.width / 2); + const padStart = Number.parseFloat(getComputedStyle(this._viewport).scrollPaddingInlineStart) || 0; + return isRTL$1() ? rect.right - (viewportRect.right - padStart) : rect.left - (viewportRect.left + padStart); + } + _loopTransition(isNext) { + const items = this._getItems(); + const last = items.length - 1; + const fromIndex = this._activeIndex; + const toIndex = isNext ? 0 : last; + const direction = this._loopDirection(isNext); + if (EventHandler.trigger(this._element, EVENT_SLIDE, { + relatedTarget: items[toIndex], + direction, + from: fromIndex, + to: toIndex + }).defaultPrevented) return; + this._looping = true; + const clone = (isNext ? items[0] : items[last]).cloneNode(true); + clone.classList.add(CLASS_NAME_CLONE); + clone.classList.remove(CLASS_NAME_ACTIVE$3); + clone.removeAttribute("id"); + for (const node of SelectorEngine.find("[id]", clone)) node.removeAttribute("id"); + clone.setAttribute("aria-hidden", "true"); + clone.inert = true; + this._viewport.style.scrollSnapType = "none"; + if (isNext) this._viewport.append(clone); + else { + this._viewport.prepend(clone); + this._jumpScroll(this._scrollDelta(items[fromIndex])); + } + this._animateScroll(this._viewport.scrollLeft + this._scrollDelta(clone), () => { + clone.remove(); + this._jumpScroll(this._scrollDelta(items[toIndex])); + this._activeIndex = toIndex; + this._refreshActiveState(); + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: items[toIndex], + direction, + from: fromIndex, + to: toIndex + }); + this._viewport.style.scrollSnapType = ""; + this._looping = false; + }); + } + _loopDirection(isNext) { + if (isRTL$1()) return isNext ? DIRECTION_RIGHT : DIRECTION_LEFT; + return isNext ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + _jumpScroll(delta) { + this._viewport.style.scrollSnapType = "none"; + this._viewport.scrollBy({ + left: delta, + top: 0, + behavior: "instant" + }); + } + _fadeTo(index) { + this._setActive(index); + } + _setActive(index) { + const items = this._getItems(); + if (index === this._activeIndex || !items[index]) return; + const from = this._activeIndex; + this._activeIndex = index; + this._refreshActiveState(); + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: items[index], + direction: this._direction(from, index), + from, + to: index + }); + } + _refreshActiveState() { + const items = this._getItems(); + for (const [index, item] of items.entries()) item.classList.toggle(CLASS_NAME_ACTIVE$3, index === this._activeIndex); + this._setActiveIndicatorElement(this._activeIndex); + this._updateEndControls(); + } + _updateEndControls() { + if (this._config.ends !== ENDS_STOP) return; + const viewport = this._viewport; + const maxScroll = viewport.scrollWidth - viewport.clientWidth; + let atStart; + let atEnd; + if (maxScroll > 0) { + const progress = Math.abs(viewport.scrollLeft); + atStart = progress <= 1; + atEnd = progress >= maxScroll - 1; + } else { + const last = this._getItems().length - 1; + atStart = this._activeIndex <= 0; + atEnd = this._activeIndex >= last; + } + this._setControlsDisabled(this._prevControls, atStart); + this._setControlsDisabled(this._nextControls, atEnd); + } + _setControlsDisabled(controls, disabled) { + for (const control of controls) { + if (disabled && control === document.activeElement) ((controls === this._prevControls ? this._nextControls : this._prevControls)[0] ?? this._viewport).focus({ preventScroll: true }); + control.disabled = disabled; + } + } + _setActiveIndicatorElement(index) { + if (!this._indicatorsElement) return; + const active = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement); + if (active) { + active.classList.remove(CLASS_NAME_ACTIVE$3); + active.removeAttribute("aria-current"); + } + const newActive = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement); + if (newActive) { + newActive.classList.add(CLASS_NAME_ACTIVE$3); + newActive.setAttribute("aria-current", "true"); + } + } + _normalizeIndex(index, length) { + if (Number.isNaN(index) || length === 0) return null; + if (index < 0) return this._wrapsAround() ? length - 1 : null; + if (index > length - 1) return this._wrapsAround() ? 0 : null; + return index; + } + _wrapsAround() { + return this._config.ends === ENDS_WRAP || this._config.ends === ENDS_LOOP; + } + _canLoop() { + if (this._isFade() || this._getItems().length < 2) return false; + const styles = getComputedStyle(this._element); + const num = (name) => Number.parseFloat(styles.getPropertyValue(name)) || 0; + return (num("--bs-carousel-items") || 1) === 1 && num("--bs-carousel-items-peek") === 0 && !this._element.classList.contains(CLASS_NAME_CENTER) && !this._element.classList.contains(CLASS_NAME_AUTO); + } + _direction(from, to) { + const isNext = to > from; + if (isRTL$1()) return isNext ? DIRECTION_RIGHT : DIRECTION_LEFT; + return isNext ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + _scheduleAutoplay(index = this._activeIndex) { + const interval = this._itemInterval(index); + this._element.style.setProperty(PROPERTY_INTERVAL, `${interval}ms`); + this._interval = setTimeout(() => { + const upcoming = this._upcomingIndex(); + this.nextWhenVisible(); + if (upcoming === null) { + this.pause(); + return; + } + this._scheduleAutoplay(upcoming); + }, interval); + } + _upcomingIndex() { + return this._normalizeIndex(this._navIndex() + 1, this._getItems().length); + } + _itemInterval(index = this._activeIndex) { + const item = this._getItems()[index]; + const interval = item ? Number.parseInt(item.getAttribute("data-bs-interval"), 10) : NaN; + return Number.isNaN(interval) ? this._config.interval : interval; + } + _maybeEnableCycle() { + if (!this._playing) return; + this.cycle(); + } + _pauseFromInteraction() { + this._playing = false; + this.pause(); + this._updatePlayPauseControl(); + } + _togglePlayPause() { + if (this._playing) { + this._pauseFromInteraction(); + return; + } + this._playing = true; + this.cycle(); + this._updatePlayPauseControl(); + } + _updatePlayPauseControl() { + if (!this._playPauseElement) return; + this._playPauseElement.classList.toggle(CLASS_NAME_PAUSED, !this._playing); + const label = this._playPauseElement.getAttribute(this._playing ? "data-bs-pause-label" : "data-bs-play-label"); + if (label) this._playPauseElement.setAttribute("aria-label", label); + } + _isFade() { + return this._element.classList.contains(CLASS_NAME_FADE); + } + _prefersReducedMotion() { + return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches; + } + _getItems() { + return SelectorEngine.find(SELECTOR_ITEM, this._element); + } + _clearInterval() { + if (this._interval) { + clearTimeout(this._interval); + this._interval = null; + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$7, 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); + carousel._pauseFromInteraction(); + const slideIndex = this.getAttribute("data-bs-slide-to"); + if (slideIndex) { + carousel.to(slideIndex); + return; + } + if (Manipulator.getDataAttribute(this, "slide") === "next") { + carousel.next(); + return; + } + carousel.prev(); +}); +EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_PLAY_PAUSE, function(event) { + const target = SelectorEngine.getElementFromSelector(this); + if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) return; + event.preventDefault(); + Carousel.getOrCreateInstance(target)._togglePlayPause(); +}); +EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => { + const carousels = SelectorEngine.find(SELECTOR_DATA_AUTOPLAY); + for (const carousel of carousels) Carousel.getOrCreateInstance(carousel); +}); +//#endregion +//#region js/src/collapse.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap collapse.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$18 = "collapse"; +const EVENT_KEY$15 = `.bs.collapse`; +const DATA_API_KEY$10 = ".data-api"; +const EVENT_SHOW$7 = `show${EVENT_KEY$15}`; +const EVENT_SHOWN$6 = `shown${EVENT_KEY$15}`; +const EVENT_HIDE$6 = `hide${EVENT_KEY$15}`; +const EVENT_HIDDEN$8 = `hidden${EVENT_KEY$15}`; +const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$15}${DATA_API_KEY$10}`; +const CLASS_NAME_SHOW$6 = "show"; +const CLASS_NAME_COLLAPSE = "collapse"; +const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; +const SELECTOR_ACTIVES = ".collapse.show"; +const SELECTOR_DATA_TOGGLE$9 = "[data-bs-toggle=\"collapse\"]"; +const Default$17 = { parent: null }; +const DefaultType$17 = { parent: "(null|element)" }; +/** +* Class definition +*/ +var Collapse = class Collapse extends BaseComponent { + constructor(element, config) { + super(element, config); + this._isTransitioning = false; + this._triggerArray = []; + const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$9); + 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._setAriaExpanded(this._triggerArray, this._isShown()); + } + static get Default() { + return Default$17; + } + static get DefaultType() { + return DefaultType$17; + } + static get NAME() { + return NAME$18; + } + toggle() { + return this._isShown() ? this.hide() : this.show(); + } + async show() { + if (this._isTransitioning || this._isShown()) return; + let activeChildren = []; + if (this._config.parent) activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter((element) => element !== this._element && !this._sharesTrigger(element)).map((element) => Collapse.getOrCreateInstance(element)); + if (activeChildren.length && activeChildren[0]._isTransitioning) return; + if (EventHandler.trigger(this._element, EVENT_SHOW$7).defaultPrevented) return; + for (const activeInstance of activeChildren) activeInstance.hide(); + this._element.classList.add(CLASS_NAME_SHOW$6); + this._setAriaExpanded(this._triggerArray, true); + this._isTransitioning = true; + const complete = () => { + this._isTransitioning = false; + EventHandler.trigger(this._element, EVENT_SHOWN$6); + }; + await this._queueCallback(complete, this._element, this._isAnimated()); + } + async hide() { + if (this._isTransitioning || !this._isShown()) return; + if (EventHandler.trigger(this._element, EVENT_HIDE$6).defaultPrevented) return; + this._element.classList.remove(CLASS_NAME_SHOW$6); + for (const trigger of this._triggerArray) { + const element = SelectorEngine.getElementFromSelector(trigger); + if (element && !this._isShown(element)) this._setAriaExpanded([trigger], false); + } + this._isTransitioning = true; + const complete = () => { + this._isTransitioning = false; + EventHandler.trigger(this._element, EVENT_HIDDEN$8); + }; + await this._queueCallback(complete, this._element, this._isAnimated()); + } + _isShown(element = this._element) { + return element.classList.contains(CLASS_NAME_SHOW$6); + } + _isAnimated() { + return getTransitionDurationFromElement(this._element) > 0; + } + _sharesTrigger(element) { + return this._triggerArray.some((trigger) => SelectorEngine.getMultipleElementsFromSelector(trigger).includes(element)); + } + _configAfterMerge(config) { + config.parent = getElement(config.parent); + return config; + } + _initializeChildren() { + if (!this._config.parent) return; + const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$9); + for (const element of children) { + const selected = SelectorEngine.getElementFromSelector(element); + if (selected) this._setAriaExpanded([element], this._isShown(selected)); + } + } + _getFirstLevelChildren(selector) { + const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); + return SelectorEngine.find(selector, this._config.parent).filter((element) => !children.includes(element)); + } + _setAriaExpanded(triggerArray, isOpen) { + if (!triggerArray.length) return; + for (const element of triggerArray) setAriaAttribute(element, "aria-expanded", isOpen); + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$9, function(event) { + if (event.target.tagName === "A" || event.delegateTarget && event.delegateTarget.tagName === "A") event.preventDefault(); + for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) Collapse.getOrCreateInstance(element).toggle(); +}); +//#endregion +//#region node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +const min = Math.min; +const max = Math.max; +const round = Math.round; +const floor = Math.floor; +const createCoords = (v) => ({ + x: v, + y: v +}); +const oppositeSideMap = { + left: "right", + right: "left", + bottom: "top", + top: "bottom" +}; +function clamp(start, value, end) { + return max(start, min(value, end)); +} +function evaluate(value, param) { + return typeof value === "function" ? value(param) : value; +} +function getSide(placement) { + return placement.split("-")[0]; +} +function getAlignment(placement) { + return placement.split("-")[1]; +} +function getOppositeAxis(axis) { + return axis === "x" ? "y" : "x"; +} +function getAxisLength(axis) { + return axis === "y" ? "height" : "width"; +} +function getSideAxis(placement) { + const firstChar = placement[0]; + return firstChar === "t" || firstChar === "b" ? "y" : "x"; +} +function getAlignmentAxis(placement) { + return getOppositeAxis(getSideAxis(placement)); +} +function getAlignmentSides(placement, rects, rtl) { + if (rtl === void 0) rtl = false; + const alignment = getAlignment(placement); + const alignmentAxis = getAlignmentAxis(placement); + const length = getAxisLength(alignmentAxis); + let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; + if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide); + return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; +} +function getExpandedPlacements(placement) { + const oppositePlacement = getOppositePlacement(placement); + return [ + getOppositeAlignmentPlacement(placement), + oppositePlacement, + getOppositeAlignmentPlacement(oppositePlacement) + ]; +} +function getOppositeAlignmentPlacement(placement) { + return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); +} +const lrPlacement = ["left", "right"]; +const rlPlacement = ["right", "left"]; +const tbPlacement = ["top", "bottom"]; +const btPlacement = ["bottom", "top"]; +function getSideList(side, isStart, rtl) { + switch (side) { + case "top": + case "bottom": + if (rtl) return isStart ? rlPlacement : lrPlacement; + return isStart ? lrPlacement : rlPlacement; + case "left": + case "right": return isStart ? tbPlacement : btPlacement; + default: return []; + } +} +function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { + const alignment = getAlignment(placement); + let list = getSideList(getSide(placement), direction === "start", rtl); + if (alignment) { + list = list.map((side) => side + "-" + alignment); + if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement)); + } + return list; +} +function getOppositePlacement(placement) { + const side = getSide(placement); + return oppositeSideMap[side] + placement.slice(side.length); +} +function expandPaddingObject(padding) { + var _padding$top, _padding$right, _padding$bottom, _padding$left; + return { + top: (_padding$top = padding.top) != null ? _padding$top : 0, + right: (_padding$right = padding.right) != null ? _padding$right : 0, + bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0, + left: (_padding$left = padding.left) != null ? _padding$left : 0 + }; +} +function getPaddingObject(padding) { + return typeof padding !== "number" ? expandPaddingObject(padding) : { + top: padding, + right: padding, + bottom: padding, + left: padding + }; +} +function rectToClientRect(rect) { + const { x, y, width, height } = rect; + return { + width, + height, + top: y, + left: x, + right: x + width, + bottom: y + height, + x, + y + }; +} +//#endregion +//#region node_modules/@floating-ui/core/dist/floating-ui.core.mjs +function computeCoordsFromPlacement(_ref, placement, rtl) { + let { reference, floating } = _ref; + const sideAxis = getSideAxis(placement); + const alignmentAxis = getAlignmentAxis(placement); + const alignLength = getAxisLength(alignmentAxis); + const side = getSide(placement); + const isVertical = sideAxis === "y"; + const commonX = reference.x + reference.width / 2 - floating.width / 2; + const commonY = reference.y + reference.height / 2 - floating.height / 2; + const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; + let coords; + switch (side) { + case "top": + coords = { + x: commonX, + y: reference.y - floating.height + }; + break; + case "bottom": + coords = { + x: commonX, + y: reference.y + reference.height + }; + break; + case "right": + coords = { + x: reference.x + reference.width, + y: commonY + }; + break; + case "left": + coords = { + x: reference.x - floating.width, + y: commonY + }; + break; + default: coords = { + x: reference.x, + y: reference.y + }; + } + const alignment = getAlignment(placement); + if (alignment) coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1); + return coords; +} +/** +* Resolves with an object of overflow side offsets that determine how much the +* element is overflowing a given clipping boundary on each side. +* - positive = overflowing the boundary by that number of pixels +* - negative = how many pixels left before it will overflow +* - 0 = lies flush with the boundary +* @see https://floating-ui.com/docs/detectOverflow +*/ +async function detectOverflow(state, options) { + var _await$platform$isEle; + if (options === void 0) options = {}; + const { x, y, platform, rects, elements, strategy } = state; + const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state); + const paddingObject = getPaddingObject(padding); + const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext]; + const clippingClientRect = rectToClientRect(await platform.getClippingRect({ + element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)), + boundary, + rootBoundary, + strategy + })); + const rect = elementContext === "floating" ? { + x, + y, + width: rects.floating.width, + height: rects.floating.height + } : rects.reference; + const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)); + const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) && await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || { + x: 1, + y: 1 + }; + const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({ + elements, + rect, + offsetParent, + strategy + }) : rect); + return { + top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, + bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, + left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, + right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x + }; +} +const MAX_RESET_COUNT = 50; +/** +* Computes the `x` and `y` coordinates that will place the floating element +* next to a given reference element. +* +* This export does not have any `platform` interface logic. You will need to +* write one for the platform you are using Floating UI with. +*/ +const computePosition$1 = async (reference, floating, config) => { + const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config; + const platformWithDetectOverflow = platform.detectOverflow ? platform : { + ...platform, + detectOverflow + }; + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); + let rects = await platform.getElementRects({ + reference, + floating, + strategy + }); + let { x, y } = computeCoordsFromPlacement(rects, placement, rtl); + let statefulPlacement = placement; + let resetCount = 0; + const middlewareData = {}; + for (let i = 0; i < middleware.length; i++) { + const currentMiddleware = middleware[i]; + if (!currentMiddleware) continue; + const { name, fn } = currentMiddleware; + const { x: nextX, y: nextY, data, reset } = await fn({ + x, + y, + initialPlacement: placement, + placement: statefulPlacement, + strategy, + middlewareData, + rects, + platform: platformWithDetectOverflow, + elements: { + reference, + floating + } + }); + x = nextX != null ? nextX : x; + y = nextY != null ? nextY : y; + middlewareData[name] = { + ...middlewareData[name], + ...data + }; + if (reset && resetCount < MAX_RESET_COUNT) { + resetCount++; + if (typeof reset === "object") { + if (reset.placement) statefulPlacement = reset.placement; + if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({ + reference, + floating, + strategy + }) : reset.rects; + ({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); + } + i = -1; + } + } + return { + x, + y, + placement: statefulPlacement, + strategy, + middlewareData + }; +}; +/** +* Provides data to position an inner element of the floating element so that it +* appears centered to the reference element. +* @see https://floating-ui.com/docs/arrow +*/ +const arrow$1 = (options) => ({ + name: "arrow", + options, + async fn(state) { + const { x, y, placement, rects, platform, elements, middlewareData } = state; + const { element, padding = 0 } = evaluate(options, state) || {}; + if (element == null) return {}; + const paddingObject = getPaddingObject(padding); + const coords = { + x, + y + }; + const axis = getAlignmentAxis(placement); + const length = getAxisLength(axis); + const arrowDimensions = await platform.getDimensions(element); + const isYAxis = axis === "y"; + const minProp = isYAxis ? "top" : "left"; + const maxProp = isYAxis ? "bottom" : "right"; + const clientProp = isYAxis ? "clientHeight" : "clientWidth"; + const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; + const startDiff = coords[axis] - rects.reference[axis]; + const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); + let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; + if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length]; + const centerToReference = endDiff / 2 - startDiff / 2; + const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; + const minPadding = min(paddingObject[minProp], largestPossiblePadding); + const maxPadding = min(paddingObject[maxProp], largestPossiblePadding); + const max = clientSize - arrowDimensions[length] - maxPadding; + const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; + const offset = clamp(minPadding, center, max); + const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; + const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0; + return { + [axis]: coords[axis] + alignmentOffset, + data: { + [axis]: offset, + centerOffset: center - offset - alignmentOffset, + ...shouldAddOffset && { alignmentOffset } + }, + reset: shouldAddOffset + }; + } +}); +/** +* Optimizes the visibility of the floating element by flipping the `placement` +* in order to keep it in view when the preferred placement(s) will overflow the +* clipping boundary. Alternative to `autoPlacement`. +* @see https://floating-ui.com/docs/flip +*/ +const flip$1 = function(options) { + if (options === void 0) options = {}; + return { + name: "flip", + options, + async fn(state) { + var _middlewareData$arrow, _middlewareData$flip; + const { placement, middlewareData, rects, initialPlacement, platform, elements } = state; + const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state); + if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {}; + const side = getSide(placement); + const initialSideAxis = getSideAxis(initialPlacement); + const isBasePlacement = getSide(initialPlacement) === initialPlacement; + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); + const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); + const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; + if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); + const placements = [initialPlacement, ...fallbackPlacements]; + const overflow = await platform.detectOverflow(state, detectOverflowOptions); + const overflows = []; + let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; + if (checkMainAxis) overflows.push(overflow[side]); + if (checkCrossAxis) { + const sides = getAlignmentSides(placement, rects, rtl); + overflows.push(overflow[sides[0]], overflow[sides[1]]); + } + overflowsData = [...overflowsData, { + placement, + overflows + }]; + if (!overflows.every((side) => side <= 0)) { + var _middlewareData$flip2, _overflowsData$filter; + const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; + const nextPlacement = placements[nextIndex]; + if (nextPlacement) { + if (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false) || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) return { + data: { + index: nextIndex, + overflows: overflowsData + }, + reset: { placement: nextPlacement } + }; + } + let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; + if (!resetPlacement) switch (fallbackStrategy) { + case "bestFit": { + var _overflowsData$filter2; + const placement = (_overflowsData$filter2 = overflowsData.filter((d) => { + if (hasFallbackAxisSideDirection) { + const currentSideAxis = getSideAxis(d.placement); + return currentSideAxis === initialSideAxis || currentSideAxis === "y"; + } + return true; + }).map((d) => [d.placement, d.overflows.filter((overflow) => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; + if (placement) resetPlacement = placement; + break; + } + case "initialPlacement": + resetPlacement = initialPlacement; + break; + } + if (placement !== resetPlacement) return { reset: { placement: resetPlacement } }; + } + return {}; + } + }; +}; +const originSides = /*#__PURE__*/ new Set(["left", "top"]); +async function convertValueToCoords(state, options) { + const { placement, platform, elements } = state; + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); + const side = getSide(placement); + const alignment = getAlignment(placement); + const isVertical = getSideAxis(placement) === "y"; + const mainAxisMulti = originSides.has(side) ? -1 : 1; + const crossAxisMulti = rtl && isVertical ? -1 : 1; + const rawValue = evaluate(options, state); + let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? { + mainAxis: rawValue, + crossAxis: 0, + alignmentAxis: null + } : { + mainAxis: rawValue.mainAxis || 0, + crossAxis: rawValue.crossAxis || 0, + alignmentAxis: rawValue.alignmentAxis + }; + if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; + return isVertical ? { + x: crossAxis * crossAxisMulti, + y: mainAxis * mainAxisMulti + } : { + x: mainAxis * mainAxisMulti, + y: crossAxis * crossAxisMulti + }; +} +/** +* Modifies the placement by translating the floating element along the +* specified axes. +* A number (shorthand for `mainAxis` or distance), or an axes configuration +* object may be passed. +* @see https://floating-ui.com/docs/offset +*/ +const offset$1 = function(options) { + if (options === void 0) options = 0; + return { + name: "offset", + options, + async fn(state) { + var _middlewareData$offse, _middlewareData$arrow; + const { x, y, placement, middlewareData } = state; + const diffCoords = await convertValueToCoords(state, options); + if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {}; + return { + x: x + diffCoords.x, + y: y + diffCoords.y, + data: { + ...diffCoords, + placement + } + }; + } + }; +}; +/** +* Optimizes the visibility of the floating element by shifting it in order to +* keep it in view when it will overflow the clipping boundary. +* @see https://floating-ui.com/docs/shift +*/ +const shift$1 = function(options) { + if (options === void 0) options = {}; + return { + name: "shift", + options, + async fn(state) { + const { x, y, placement, platform } = state; + const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => { + let { x, y } = _ref; + return { + x, + y + }; + } }, ...detectOverflowOptions } = evaluate(options, state); + const coords = { + x, + y + }; + const overflow = await platform.detectOverflow(state, detectOverflowOptions); + const crossAxis = getSideAxis(placement); + const mainAxis = getOppositeAxis(crossAxis); + let mainAxisCoord = coords[mainAxis]; + let crossAxisCoord = coords[crossAxis]; + const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]); + if (checkMainAxis) mainAxisCoord = clampCoord(mainAxis, mainAxisCoord); + if (checkCrossAxis) crossAxisCoord = clampCoord(crossAxis, crossAxisCoord); + const limitedCoords = limiter.fn({ + ...state, + [mainAxis]: mainAxisCoord, + [crossAxis]: crossAxisCoord + }); + return { + ...limitedCoords, + data: { + x: limitedCoords.x - x, + y: limitedCoords.y - y, + enabled: { + [mainAxis]: checkMainAxis, + [crossAxis]: checkCrossAxis + } + } + }; + } + }; +}; +//#endregion +//#region node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +function hasWindow() { + return typeof window !== "undefined"; +} +function getNodeName(node) { + if (isNode(node)) return (node.nodeName || "").toLowerCase(); + return "#document"; +} +function getWindow(node) { + var _node$ownerDocument; + return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; +} +function getDocumentElement(node) { + var _ref; + return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; +} +function isNode(value) { + if (!hasWindow()) return false; + return value instanceof Node || value instanceof getWindow(value).Node; +} +function isElement(value) { + if (!hasWindow()) return false; + return value instanceof Element || value instanceof getWindow(value).Element; +} +function isHTMLElement(value) { + if (!hasWindow()) return false; + return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; +} +function isShadowRoot(value) { + if (!hasWindow() || typeof ShadowRoot === "undefined") return false; + return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; +} +function isOverflowElement(element) { + const { overflow, overflowX, overflowY, display } = getComputedStyle$1(element); + return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; +} +function isTableElement(element) { + return /^(table|td|th)$/.test(getNodeName(element)); +} +function isTopLayer(element) { + try { + if (element.matches(":popover-open")) return true; + } catch (_e) {} + try { + return element.matches(":modal"); + } catch (_e) { + return false; + } +} +const willChangeRe = /transform|translate|scale|rotate|perspective|filter/; +const containRe = /paint|layout|strict|content/; +const isNotNone = (value) => !!value && value !== "none"; +let isWebKitValue; +function isContainingBlock(elementOrCss) { + const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss; + return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || ""); +} +function getContainingBlock(element) { + let currentNode = getParentNode(element); + while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { + if (isContainingBlock(currentNode)) return currentNode; + else if (isTopLayer(currentNode)) return null; + currentNode = getParentNode(currentNode); + } + return null; +} +function isWebKit() { + if (isWebKitValue == null) isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); + return isWebKitValue; +} +function isLastTraversableNode(node) { + return /^(html|body|#document)$/.test(getNodeName(node)); +} +function getComputedStyle$1(element) { + return getWindow(element).getComputedStyle(element); +} +function getNodeScroll(element) { + if (isElement(element)) return { + scrollLeft: element.scrollLeft, + scrollTop: element.scrollTop + }; + return { + scrollLeft: element.scrollX, + scrollTop: element.scrollY + }; +} +function getParentNode(node) { + if (getNodeName(node) === "html") return node; + const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node); + return isShadowRoot(result) ? result.host : result; +} +function getNearestOverflowAncestor(node) { + const parentNode = getParentNode(node); + if (isLastTraversableNode(parentNode)) return (node.ownerDocument || node).body; + if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode; + return getNearestOverflowAncestor(parentNode); +} +function getOverflowAncestors(node, list, traverseIframes) { + var _node$ownerDocument2; + if (list === void 0) list = []; + if (traverseIframes === void 0) traverseIframes = true; + const scrollableAncestor = getNearestOverflowAncestor(node); + const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); + const win = getWindow(scrollableAncestor); + if (isBody) { + const frameElement = getFrameElement(win); + return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); + } else return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); +} +function getFrameElement(win) { + return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; +} +//#endregion +//#region node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +function getCssDimensions(element) { + const css = getComputedStyle$1(element); + let width = parseFloat(css.width) || 0; + let height = parseFloat(css.height) || 0; + const hasOffset = isHTMLElement(element); + const offsetWidth = hasOffset ? element.offsetWidth : width; + const offsetHeight = hasOffset ? element.offsetHeight : height; + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; + if (shouldFallback) { + width = offsetWidth; + height = offsetHeight; + } + return { + width, + height, + $: shouldFallback + }; +} +function unwrapElement(element) { + return !isElement(element) ? element.contextElement : element; +} +function getScale(element) { + const domElement = unwrapElement(element); + if (!isHTMLElement(domElement)) return createCoords(1); + const rect = domElement.getBoundingClientRect(); + const { width, height, $ } = getCssDimensions(domElement); + let x = ($ ? round(rect.width) : rect.width) / width; + let y = ($ ? round(rect.height) : rect.height) / height; + if (!x || !Number.isFinite(x)) x = 1; + if (!y || !Number.isFinite(y)) y = 1; + return { + x, + y + }; +} +const noOffsets = /*#__PURE__*/ createCoords(0); +function getVisualOffsets(element) { + const win = getWindow(element); + if (!isWebKit() || !win.visualViewport) return noOffsets; + return { + x: win.visualViewport.offsetLeft, + y: win.visualViewport.offsetTop + }; +} +function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { + if (isFixed === void 0) isFixed = false; + if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) return false; + return isFixed; +} +function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { + if (includeScale === void 0) includeScale = false; + if (isFixedStrategy === void 0) isFixedStrategy = false; + const clientRect = element.getBoundingClientRect(); + const domElement = unwrapElement(element); + let scale = createCoords(1); + if (includeScale) if (offsetParent) { + if (isElement(offsetParent)) scale = getScale(offsetParent); + } else scale = getScale(element); + const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); + let x = (clientRect.left + visualOffsets.x) / scale.x; + let y = (clientRect.top + visualOffsets.y) / scale.y; + let width = clientRect.width / scale.x; + let height = clientRect.height / scale.y; + if (domElement) { + const win = getWindow(domElement); + const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; + let currentWin = win; + let currentIFrame = getFrameElement(currentWin); + while (currentIFrame && offsetParent && offsetWin !== currentWin) { + const iframeScale = getScale(currentIFrame); + const iframeRect = currentIFrame.getBoundingClientRect(); + const css = getComputedStyle$1(currentIFrame); + const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; + const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; + x *= iframeScale.x; + y *= iframeScale.y; + width *= iframeScale.x; + height *= iframeScale.y; + x += left; + y += top; + currentWin = getWindow(currentIFrame); + currentIFrame = getFrameElement(currentWin); + } + } + return rectToClientRect({ + width, + height, + x, + y + }); +} +function getWindowScrollBarX(element, rect) { + const leftScroll = getNodeScroll(element).scrollLeft; + if (!rect) return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; + return rect.left + leftScroll; +} +function getHTMLOffset(documentElement, scroll) { + const htmlRect = documentElement.getBoundingClientRect(); + return { + x: htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect), + y: htmlRect.top + scroll.scrollTop + }; +} +function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { + let { elements, rect, offsetParent, strategy } = _ref; + const isFixed = strategy === "fixed"; + const documentElement = getDocumentElement(offsetParent); + const topLayer = elements ? isTopLayer(elements.floating) : false; + if (offsetParent === documentElement || topLayer && isFixed) return rect; + let scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + let scale = createCoords(1); + const offsets = createCoords(0); + const isOffsetParentAnElement = isHTMLElement(offsetParent); + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent); + if (isOffsetParentAnElement) { + const offsetRect = getBoundingClientRect(offsetParent); + scale = getScale(offsetParent); + offsets.x = offsetRect.x + offsetParent.clientLeft; + offsets.y = offsetRect.y + offsetParent.clientTop; + } + } + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); + return { + width: rect.width * scale.x, + height: rect.height * scale.y, + x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, + y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y + }; +} +function getClientRects(element) { + return Array.from(element.getClientRects()); +} +function getDocumentRect(element) { + const html = getDocumentElement(element); + const scroll = getNodeScroll(element); + const body = element.ownerDocument.body; + const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); + const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); + let x = -scroll.scrollLeft + getWindowScrollBarX(element); + const y = -scroll.scrollTop; + if (getComputedStyle$1(body).direction === "rtl") x += max(html.clientWidth, body.clientWidth) - width; + return { + width, + height, + x, + y + }; +} +const SCROLLBAR_MAX = 25; +function getViewportRect(element, strategy) { + const win = getWindow(element); + const html = getDocumentElement(element); + const visualViewport = win.visualViewport; + let width = html.clientWidth; + let height = html.clientHeight; + let x = 0; + let y = 0; + if (visualViewport) { + width = visualViewport.width; + height = visualViewport.height; + const visualViewportBased = isWebKit(); + if (!visualViewportBased || visualViewportBased && strategy === "fixed") { + x = visualViewport.offsetLeft; + y = visualViewport.offsetTop; + } + } + const windowScrollbarX = getWindowScrollBarX(html); + if (windowScrollbarX <= 0) { + const doc = html.ownerDocument; + const body = doc.body; + const bodyStyles = getComputedStyle(body); + const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; + const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); + if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) width -= clippingStableScrollbarWidth; + } else if (windowScrollbarX <= SCROLLBAR_MAX) width += windowScrollbarX; + return { + width, + height, + x, + y + }; +} +function getInnerBoundingClientRect(element, strategy) { + const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); + const top = clientRect.top + element.clientTop; + const left = clientRect.left + element.clientLeft; + const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); + return { + width: element.clientWidth * scale.x, + height: element.clientHeight * scale.y, + x: left * scale.x, + y: top * scale.y + }; +} +function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { + let rect; + if (clippingAncestor === "viewport") rect = getViewportRect(element, strategy); + else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element)); + else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy); + else { + const visualOffsets = getVisualOffsets(element); + rect = { + x: clippingAncestor.x - visualOffsets.x, + y: clippingAncestor.y - visualOffsets.y, + width: clippingAncestor.width, + height: clippingAncestor.height + }; + } + return rectToClientRect(rect); +} +function hasFixedPositionAncestor(element, stopNode) { + const parentNode = getParentNode(element); + if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) return false; + return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); +} +function getClippingElementAncestors(element, cache) { + const cachedResult = cache.get(element); + if (cachedResult) return cachedResult; + let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); + let currentContainingBlockComputedStyle = null; + const elementIsFixed = getComputedStyle$1(element).position === "fixed"; + let currentNode = elementIsFixed ? getParentNode(element) : element; + while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { + const computedStyle = getComputedStyle$1(currentNode); + const currentNodeIsContaining = isContainingBlock(currentNode); + if (!currentNodeIsContaining && computedStyle.position === "fixed") currentContainingBlockComputedStyle = null; + if (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) result = result.filter((ancestor) => ancestor !== currentNode); + else currentContainingBlockComputedStyle = computedStyle; + currentNode = getParentNode(currentNode); + } + cache.set(element, result); + return result; +} +function getClippingRect(_ref) { + let { element, boundary, rootBoundary, strategy } = _ref; + const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary]; + const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); + let top = firstRect.top; + let right = firstRect.right; + let bottom = firstRect.bottom; + let left = firstRect.left; + for (let i = 1; i < clippingAncestors.length; i++) { + const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); + top = max(rect.top, top); + right = min(rect.right, right); + bottom = min(rect.bottom, bottom); + left = max(rect.left, left); + } + return { + width: right - left, + height: bottom - top, + x: left, + y: top + }; +} +function getDimensions(element) { + const { width, height } = getCssDimensions(element); + return { + width, + height + }; +} +function getRectRelativeToOffsetParent(element, offsetParent, strategy) { + const isOffsetParentAnElement = isHTMLElement(offsetParent); + const documentElement = getDocumentElement(offsetParent); + const isFixed = strategy === "fixed"; + const rect = getBoundingClientRect(element, true, isFixed, offsetParent); + let scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + const offsets = createCoords(0); + function setLeftRTLScrollbarOffset() { + offsets.x = getWindowScrollBarX(documentElement); + } + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent); + if (isOffsetParentAnElement) { + const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); + offsets.x = offsetRect.x + offsetParent.clientLeft; + offsets.y = offsetRect.y + offsetParent.clientTop; + } else if (documentElement) setLeftRTLScrollbarOffset(); + } + if (isFixed && !isOffsetParentAnElement && documentElement) setLeftRTLScrollbarOffset(); + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); + return { + x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x, + y: rect.top + scroll.scrollTop - offsets.y - htmlOffset.y, + width: rect.width, + height: rect.height + }; +} +function isStaticPositioned(element) { + return getComputedStyle$1(element).position === "static"; +} +function getTrueOffsetParent(element, polyfill) { + if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") return null; + if (polyfill) return polyfill(element); + let rawOffsetParent = element.offsetParent; + if (getDocumentElement(element) === rawOffsetParent) rawOffsetParent = rawOffsetParent.ownerDocument.body; + return rawOffsetParent; +} +function getOffsetParent(element, polyfill) { + const win = getWindow(element); + if (isTopLayer(element)) return win; + if (!isHTMLElement(element)) { + let svgOffsetParent = getParentNode(element); + while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { + if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) return svgOffsetParent; + svgOffsetParent = getParentNode(svgOffsetParent); + } + return win; + } + let offsetParent = getTrueOffsetParent(element, polyfill); + while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) offsetParent = getTrueOffsetParent(offsetParent, polyfill); + if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) return win; + return offsetParent || getContainingBlock(element) || win; +} +const getElementRects = async function(data) { + const getOffsetParentFn = this.getOffsetParent || getOffsetParent; + const getDimensionsFn = this.getDimensions; + const floatingDimensions = await getDimensionsFn(data.floating); + return { + reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), + floating: { + x: 0, + y: 0, + width: floatingDimensions.width, + height: floatingDimensions.height + } + }; +}; +function isRTL(element) { + return getComputedStyle$1(element).direction === "rtl"; +} +const platform = { + convertOffsetParentRelativeRectToViewportRelativeRect, + getDocumentElement, + getClippingRect, + getOffsetParent, + getElementRects, + getClientRects, + getDimensions, + getScale, + isElement, + isRTL +}; +function rectsAreEqual(a, b) { + return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; +} +function observeMove(element, onMove) { + let io = null; + let timeoutId; + const root = getDocumentElement(element); + function cleanup() { + var _io; + clearTimeout(timeoutId); + (_io = io) == null || _io.disconnect(); + io = null; + } + function refresh(skip, threshold) { + if (skip === void 0) skip = false; + if (threshold === void 0) threshold = 1; + cleanup(); + const elementRectForRootMargin = element.getBoundingClientRect(); + const { left, top, width, height } = elementRectForRootMargin; + if (!skip) onMove(); + if (!width || !height) return; + const insetTop = floor(top); + const insetRight = floor(root.clientWidth - (left + width)); + const insetBottom = floor(root.clientHeight - (top + height)); + const insetLeft = floor(left); + const options = { + rootMargin: -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px", + threshold: max(0, min(1, threshold)) || 1 + }; + let isFirstUpdate = true; + function handleObserve(entries) { + const ratio = entries[0].intersectionRatio; + if (ratio !== threshold) { + if (!isFirstUpdate) return refresh(); + if (!ratio) timeoutId = setTimeout(() => { + refresh(false, 1e-7); + }, 1e3); + else refresh(false, ratio); + } + if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) refresh(); + isFirstUpdate = false; + } + try { + io = new IntersectionObserver(handleObserve, { + ...options, + root: root.ownerDocument + }); + } catch (_e) { + io = new IntersectionObserver(handleObserve, options); + } + io.observe(element); + } + refresh(true); + return cleanup; +} +/** +* Automatically updates the position of the floating element when necessary. +* Should only be called when the floating element is mounted on the DOM or +* visible on the screen. +* @returns cleanup function that should be invoked when the floating element is +* removed from the DOM or hidden from the screen. +* @see https://floating-ui.com/docs/autoUpdate +*/ +function autoUpdate(reference, floating, update, options) { + if (options === void 0) options = {}; + const { ancestorScroll = true, ancestorResize = true, elementResize = typeof ResizeObserver === "function", layoutShift = typeof IntersectionObserver === "function", animationFrame = false } = options; + const referenceEl = unwrapElement(reference); + const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; + ancestors.forEach((ancestor) => { + ancestorScroll && ancestor.addEventListener("scroll", update, { passive: true }); + ancestorResize && ancestor.addEventListener("resize", update); + }); + const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; + let reobserveFrame = -1; + let resizeObserver = null; + if (elementResize) { + resizeObserver = new ResizeObserver((_ref) => { + let [firstEntry] = _ref; + if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { + resizeObserver.unobserve(floating); + cancelAnimationFrame(reobserveFrame); + reobserveFrame = requestAnimationFrame(() => { + var _resizeObserver; + (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); + }); + } + update(); + }); + if (referenceEl && !animationFrame) resizeObserver.observe(referenceEl); + if (floating) resizeObserver.observe(floating); + } + let frameId; + let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; + if (animationFrame) frameLoop(); + function frameLoop() { + const nextRefRect = getBoundingClientRect(reference); + if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) update(); + prevRefRect = nextRefRect; + frameId = requestAnimationFrame(frameLoop); + } + update(); + return () => { + var _resizeObserver2; + ancestors.forEach((ancestor) => { + ancestorScroll && ancestor.removeEventListener("scroll", update); + ancestorResize && ancestor.removeEventListener("resize", update); + }); + cleanupIo?.(); + (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); + resizeObserver = null; + if (animationFrame) cancelAnimationFrame(frameId); + }; +} +/** +* Modifies the placement by translating the floating element along the +* specified axes. +* A number (shorthand for `mainAxis` or distance), or an axes configuration +* object may be passed. +* @see https://floating-ui.com/docs/offset +*/ +const offset = offset$1; +/** +* Optimizes the visibility of the floating element by shifting it in order to +* keep it in view when it will overflow the clipping boundary. +* @see https://floating-ui.com/docs/shift +*/ +const shift = shift$1; +/** +* Optimizes the visibility of the floating element by flipping the `placement` +* in order to keep it in view when the preferred placement(s) will overflow the +* clipping boundary. Alternative to `autoPlacement`. +* @see https://floating-ui.com/docs/flip +*/ +const flip = flip$1; +/** +* Provides data to position an inner element of the floating element so that it +* appears centered to the reference element. +* @see https://floating-ui.com/docs/arrow +*/ +const arrow = arrow$1; +/** +* Computes the `x` and `y` coordinates that will place the floating element +* next to a given reference element. +*/ +const computePosition = (reference, floating, options) => { + const cache = /* @__PURE__ */ new Map(); + const mergedOptions = { + platform, + ...options + }; + const platformWithCache = { + ...mergedOptions.platform, + _c: cache + }; + return computePosition$1(reference, floating, { + ...mergedOptions, + platform: platformWithCache + }); +}; +//#endregion +//#region js/src/util/floating-ui.ts +/** +* Breakpoints for responsive placement (matches SCSS $breakpoints) +*/ +const BREAKPOINTS = { + sm: 576, + md: 768, + lg: 1024, + xl: 1280, + "2xl": 1536 +}; +/** +* Parse a placement string that may contain responsive prefixes +* Example: "bottom-start md:top-end lg:right" returns { xs: 'bottom-start', md: 'top-end', lg: 'right' } +* +* @param placementString - The placement string to parse +* @param defaultPlacement - The default placement to use for xs/base +* @returns Object with breakpoint keys and placement values, or null if not responsive +*/ +const parseResponsivePlacement = (placementString, defaultPlacement = "bottom") => { + if (!placementString || !placementString.includes(":")) return null; + const parts = placementString.split(/\s+/); + const placements = { xs: defaultPlacement }; + for (const part of parts) if (part.includes(":")) { + const [breakpoint, placement] = part.split(":"); + if (BREAKPOINTS[breakpoint] !== void 0) placements[breakpoint] = placement; + } else placements.xs = part; + return placements; +}; +/** +* Get the active placement for the current viewport width +* +* @param responsivePlacements - Object with breakpoint keys and placement values +* @param defaultPlacement - Fallback placement +* @returns The active placement for current viewport +*/ +const getResponsivePlacement = (responsivePlacements, defaultPlacement = "bottom") => { + if (!responsivePlacements) return defaultPlacement; + const viewportWidth = window.innerWidth; + let activePlacement = responsivePlacements.xs || defaultPlacement; + for (const breakpoint of [ + "sm", + "md", + "lg", + "xl", + "2xl" + ]) if (viewportWidth >= BREAKPOINTS[breakpoint] && responsivePlacements[breakpoint]) activePlacement = responsivePlacements[breakpoint]; + return activePlacement; +}; +/** +* Create media query listeners for responsive placement changes +* +* @param callback - Callback to run when breakpoint changes +* @returns Array of { mql, handler } objects for cleanup +*/ +const createBreakpointListeners = (callback) => { + const listeners = []; + for (const breakpoint of Object.keys(BREAKPOINTS)) { + const minWidth = BREAKPOINTS[breakpoint]; + const mql = window.matchMedia(`(min-width: ${minWidth}px)`); + mql.addEventListener("change", callback); + listeners.push({ + mql, + handler: callback + }); + } + return listeners; +}; +/** +* Clean up media query listeners +* +* @param listeners - Array of { mql, handler } objects +*/ +const disposeBreakpointListeners = (listeners) => { + for (const { mql, handler } of listeners) mql.removeEventListener("change", handler); +}; +/** +* Normalize an offset value into Floating UI's offset shape. +* A `[skidding, distance]` array becomes `{ mainAxis: distance, crossAxis: skidding }`; +* numbers and axis objects pass through unchanged. +*/ +const toFloatingOffset = (value) => { + return Array.isArray(value) ? { + mainAxis: value[1] || 0, + crossAxis: value[0] || 0 + } : value; +}; +//#endregion +//#region js/src/menu.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap menu.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$17 = "menu"; +const EVENT_KEY$14 = `.bs.menu`; +const DATA_API_KEY$9 = ".data-api"; +const ESCAPE_KEY$2 = "Escape"; +const TAB_KEY$1 = "Tab"; +const ARROW_UP_KEY$2 = "ArrowUp"; +const ARROW_DOWN_KEY$2 = "ArrowDown"; +const ARROW_LEFT_KEY$1 = "ArrowLeft"; +const ARROW_RIGHT_KEY$1 = "ArrowRight"; +const HOME_KEY$2 = "Home"; +const END_KEY$2 = "End"; +const ENTER_KEY$1 = "Enter"; +const SPACE_KEY$1 = " "; +const RIGHT_MOUSE_BUTTON = 2; +const SUBMENU_CLOSE_DELAY = 100; +const EVENT_HIDE$5 = `hide${EVENT_KEY$14}`; +const EVENT_HIDDEN$7 = `hidden${EVENT_KEY$14}`; +const EVENT_SHOW$6 = `show${EVENT_KEY$14}`; +const EVENT_SHOWN$5 = `shown${EVENT_KEY$14}`; +const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$14}${DATA_API_KEY$9}`; +const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$14}${DATA_API_KEY$9}`; +const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$14}${DATA_API_KEY$9}`; +const CLASS_NAME_SHOW$5 = "show"; +const SELECTOR_DATA_TOGGLE$8 = "[data-bs-toggle=\"menu\"]:not(.disabled):not(:disabled)"; +const SELECTOR_MENU$3 = ".menu"; +const SELECTOR_SUBMENU = ".submenu"; +const SELECTOR_SUBMENU_TOGGLE = ".submenu > .menu-item"; +const SELECTOR_NAVBAR_NAV = ".navbar-nav"; +const SELECTOR_VISIBLE_ITEMS$1 = ".menu-item:not(.disabled):not(:disabled)"; +const DEFAULT_PLACEMENT = "bottom-start"; +const SUBMENU_PLACEMENT = "end-start"; +const resolveLogicalPlacement = (placement) => { + if (isRTL$1()) return placement.replace(/^start(?=-|$)/, "right").replace(/^end(?=-|$)/, "left"); + return placement.replace(/^start(?=-|$)/, "left").replace(/^end(?=-|$)/, "right"); +}; +const triangleSign = (p1, p2, p3) => (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y); +const Default$16 = { + autoClose: true, + boundary: "clippingParents", + container: false, + display: "dynamic", + offset: [0, 2], + floatingConfig: null, + menu: null, + placement: DEFAULT_PLACEMENT, + reference: "toggle", + strategy: "absolute", + submenuTrigger: "both", + submenuDelay: SUBMENU_CLOSE_DELAY +}; +const DefaultType$16 = { + autoClose: "(boolean|string)", + boundary: "(string|element)", + container: "(string|element|boolean)", + display: "string", + offset: "(array|string|function)", + floatingConfig: "(null|object|function)", + menu: "(null|element)", + placement: "string", + reference: "(string|element|object)", + strategy: "string", + submenuTrigger: "string", + submenuDelay: "number" +}; +/** +* Class definition +*/ +var Menu = class Menu extends BaseComponent { + static _openInstances = /* @__PURE__ */ new Set(); + constructor(element, config) { + if (typeof computePosition === "undefined") throw new TypeError("Bootstrap's menus require Floating UI (https://floating-ui.com)"); + super(element, config); + this._floatingCleanup = null; + this._mediaQueryListeners = []; + this._responsivePlacements = null; + this._parent = this._element.parentNode; + this._openSubmenus = /* @__PURE__ */ new Map(); + this._submenuCloseTimeouts = /* @__PURE__ */ new Map(); + this._hoverIntentData = null; + this._menu = this._config.menu || this._findMenu(); + if (!this._config.menu && this._menu) this._parent = this._findWrapper(this._menu); + this._isSubmenu = this._parent.classList?.contains("submenu"); + this._menuOriginalParent = this._menu?.parentNode; + this._parseResponsivePlacements(); + this._setupSubmenuListeners(); + this._initSubmenuTriggers(); + } + static get Default() { + return Default$16; + } + static get DefaultType() { + return DefaultType$16; + } + static get NAME() { + return NAME$17; + } + toggle() { + return this._isShown() ? this.hide() : this.show(); + } + async show() { + if (isDisabled(this._element) || this._isShown()) return; + const relatedTarget = { relatedTarget: this._element }; + if (EventHandler.trigger(this._element, EVENT_SHOW$6, relatedTarget).defaultPrevented) return; + this._moveMenuToContainer(); + this._createFloating(); + if ("ontouchstart" in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) for (const element of document.body.children) EventHandler.on(element, "mouseover", noop); + this._element.focus({ focusVisible: false }); + this._element.setAttribute("aria-expanded", "true"); + this._menu.classList.add(CLASS_NAME_SHOW$5); + this._element.classList.add(CLASS_NAME_SHOW$5); + if (this._parent) this._parent.classList.add(CLASS_NAME_SHOW$5); + Menu._openInstances.add(this); + await this._queueCallback(() => { + if (this._isShown()) EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget); + }, this._menu, this._isAnimated()); + } + async hide() { + if (isDisabled(this._element) || !this._isShown()) return; + const relatedTarget = { relatedTarget: this._element }; + await this._completeHide(relatedTarget); + } + dispose() { + this._disposeFloating(); + this._restoreMenuToOriginalParent(); + this._disposeMediaQueryListeners(); + this._closeAllSubmenus(); + this._clearAllSubmenuTimeouts(); + Menu._openInstances.delete(this); + super.dispose(); + } + update() { + if (this._floatingCleanup) this._updateFloatingPosition(); + } + _findMenu() { + const wrapper = SelectorEngine.closest(this._element, `:has(${SELECTOR_MENU$3})`); + return SelectorEngine.next(this._element, SELECTOR_MENU$3)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU$3)[0] || SelectorEngine.findOne(SELECTOR_MENU$3, wrapper || this._parent); + } + _findWrapper(menu) { + let wrapper = this._element.parentNode; + while (wrapper instanceof Element && !wrapper.contains(menu)) wrapper = wrapper.parentNode; + return wrapper instanceof Element ? wrapper : this._element.parentNode; + } + async _completeHide(relatedTarget) { + if (EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget).defaultPrevented) return; + this._closeAllSubmenus(); + if ("ontouchstart" in document.documentElement) for (const element of document.body.children) EventHandler.off(element, "mouseover", noop); + this._menu.classList.remove(CLASS_NAME_SHOW$5); + this._element.classList.remove(CLASS_NAME_SHOW$5); + if (this._parent) this._parent.classList.remove(CLASS_NAME_SHOW$5); + this._element.setAttribute("aria-expanded", "false"); + Menu._openInstances.delete(this); + await this._queueCallback(() => { + if (this._isShown()) return; + this._disposeFloating(); + this._restoreMenuToOriginalParent(); + Manipulator.removeDataAttribute(this._menu, "placement"); + Manipulator.removeDataAttribute(this._menu, "display"); + EventHandler.trigger(this._element, EVENT_HIDDEN$7, relatedTarget); + }, this._menu, this._isAnimated()); + } + _getConfig(config) { + config = super._getConfig(config); + if (typeof config.reference === "object" && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== "function") throw new TypeError(`${NAME$17.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); + return config; + } + _createFloating() { + if (this._config.display === "static") { + Manipulator.setDataAttribute(this._menu, "display", "static"); + return; + } + 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; + this._updateFloatingPosition(referenceElement); + this._floatingCleanup = autoUpdate(referenceElement, this._menu, () => this._updateFloatingPosition(referenceElement)); + } + async _updateFloatingPosition(referenceElement = null) { + if (!this._menu) return; + if (!referenceElement) 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; + else referenceElement = this._element; + const placement = this._getPlacement(); + const middleware = this._getFloatingMiddleware(); + const floatingConfig = this._getFloatingConfig(placement, middleware); + await this._applyFloatingPosition(referenceElement, this._menu, floatingConfig.placement, floatingConfig.middleware, floatingConfig.strategy); + } + _isShown() { + return this._menu.classList.contains(CLASS_NAME_SHOW$5); + } + _isAnimated() { + return getTransitionDurationFromElement(this._menu) > 0; + } + _getPlacement() { + const placement = this._responsivePlacements ? getResponsivePlacement(this._responsivePlacements, DEFAULT_PLACEMENT) : this._config.placement; + return resolveLogicalPlacement(placement); + } + _parseResponsivePlacements() { + this._responsivePlacements = parseResponsivePlacement(this._config.placement, DEFAULT_PLACEMENT); + if (this._responsivePlacements) this._setupMediaQueryListeners(); + } + _setupMediaQueryListeners() { + this._disposeMediaQueryListeners(); + this._mediaQueryListeners = createBreakpointListeners(() => { + if (this._isShown()) this._updateFloatingPosition(); + }); + } + _disposeMediaQueryListeners() { + disposeBreakpointListeners(this._mediaQueryListeners); + this._mediaQueryListeners = []; + } + _getOffset() { + const { offset: offsetConfig } = this._config; + if (typeof offsetConfig === "string") return offsetConfig.split(",").map((value) => Number.parseInt(value, 10)); + if (typeof offsetConfig === "function") return ({ placement, rects }) => { + return toFloatingOffset(offsetConfig({ + placement, + reference: rects.reference, + floating: rects.floating + }, this._element)); + }; + return offsetConfig; + } + _getFloatingMiddleware() { + const offsetValue = this._getOffset(); + return [ + offset(typeof offsetValue === "function" ? offsetValue : toFloatingOffset(offsetValue)), + flip({ + fallbackPlacements: this._getFallbackPlacements(), + fallbackStrategy: "initialPlacement" + }), + shift({ boundary: this._config.boundary === "clippingParents" ? "clippingAncestors" : this._config.boundary }) + ]; + } + _getFallbackPlacements() { + return { + bottom: [ + "top", + "bottom-start", + "bottom-end", + "top-start", + "top-end" + ], + "bottom-start": [ + "top-start", + "bottom-end", + "top-end" + ], + "bottom-end": [ + "top-end", + "bottom-start", + "top-start" + ], + top: [ + "bottom", + "top-start", + "top-end", + "bottom-start", + "bottom-end" + ], + "top-start": [ + "bottom-start", + "top-end", + "bottom-end" + ], + "top-end": [ + "bottom-end", + "top-start", + "bottom-start" + ], + right: [ + "left", + "right-start", + "right-end", + "left-start", + "left-end" + ], + "right-start": [ + "left-start", + "right-end", + "left-end", + "top-start", + "bottom-start" + ], + "right-end": [ + "left-end", + "right-start", + "left-start", + "top-end", + "bottom-end" + ], + left: [ + "right", + "left-start", + "left-end", + "right-start", + "right-end" + ], + "left-start": [ + "right-start", + "left-end", + "right-end", + "top-start", + "bottom-start" + ], + "left-end": [ + "right-end", + "left-start", + "right-start", + "top-end", + "bottom-end" + ] + }[this._getPlacement()] || [ + "top", + "bottom", + "right", + "left" + ]; + } + _getFloatingConfig(placement, middleware) { + const defaultConfig = { + placement, + middleware, + strategy: this._config.strategy + }; + return { + ...defaultConfig, + ...execute(this._config.floatingConfig, [void 0, defaultConfig]) + }; + } + _disposeFloating() { + if (this._floatingCleanup) { + this._floatingCleanup(); + this._floatingCleanup = null; + } + } + _getContainer() { + const { container } = this._config; + if (container === false) return null; + return container === true ? document.body : getElement(container); + } + _moveMenuToContainer() { + const container = this._getContainer(); + if (!container || !this._menu) return; + if (this._menu.parentNode !== container) container.append(this._menu); + } + _restoreMenuToOriginalParent() { + if (!this._menuOriginalParent || !this._menu) return; + if (this._menu.parentNode !== this._menuOriginalParent) this._menuOriginalParent.append(this._menu); + } + async _applyFloatingPosition(reference, floating, placement, middleware, strategy = "absolute") { + if (!floating.isConnected) return null; + const { x, y, placement: finalPlacement } = await computePosition(reference, floating, { + placement, + middleware, + strategy + }); + if (!floating.isConnected) return null; + Object.assign(floating.style, { + position: strategy, + left: `${x}px`, + top: `${y}px`, + margin: "0" + }); + Manipulator.setDataAttribute(floating, "placement", finalPlacement); + return finalPlacement; + } + _setupSubmenuListeners() { + if (this._config.submenuTrigger === "hover" || this._config.submenuTrigger === "both") { + EventHandler.on(this._menu, "mouseenter", SELECTOR_SUBMENU_TOGGLE, (event) => { + this._onSubmenuTriggerEnter(event); + }); + EventHandler.on(this._menu, "mouseleave", SELECTOR_SUBMENU, (event) => { + this._onSubmenuLeave(event); + }); + EventHandler.on(this._menu, "mousemove", (event) => { + this._trackMousePosition(event); + }); + } + if (this._config.submenuTrigger === "click" || this._config.submenuTrigger === "both") EventHandler.on(this._menu, "click", SELECTOR_SUBMENU_TOGGLE, (event) => { + this._onSubmenuTriggerClick(event); + }); + } + _onSubmenuTriggerEnter(event) { + const trigger = event.target.closest(SELECTOR_SUBMENU_TOGGLE); + if (!trigger) return; + const submenuWrapper = trigger.closest(SELECTOR_SUBMENU); + const submenu = SelectorEngine.findOne(SELECTOR_MENU$3, submenuWrapper); + if (!submenu) return; + this._cancelSubmenuCloseTimeout(submenu); + this._closeSiblingSubmenus(submenuWrapper); + this._openSubmenu(trigger, submenu, submenuWrapper); + } + _onSubmenuLeave(event) { + const submenuWrapper = event.target.closest(SELECTOR_SUBMENU); + const submenu = SelectorEngine.findOne(SELECTOR_MENU$3, submenuWrapper); + if (!submenu || !this._openSubmenus.has(submenu)) return; + if (this._isMovingTowardSubmenu(event, submenu)) return; + this._scheduleSubmenuClose(submenu, submenuWrapper); + } + _onSubmenuTriggerClick(event) { + const trigger = event.target.closest(SELECTOR_SUBMENU_TOGGLE); + if (!trigger) return; + event.preventDefault(); + event.stopPropagation(); + const submenuWrapper = trigger.closest(SELECTOR_SUBMENU); + const submenu = SelectorEngine.findOne(SELECTOR_MENU$3, submenuWrapper); + if (!submenu) return; + if (this._openSubmenus.has(submenu)) this._closeSubmenu(submenu, submenuWrapper); + else { + this._closeSiblingSubmenus(submenuWrapper); + this._openSubmenu(trigger, submenu, submenuWrapper); + } + } + _initSubmenuTriggers() { + if (!this._menu) return; + for (const trigger of SelectorEngine.find(SELECTOR_SUBMENU_TOGGLE, this._menu)) { + if (!SelectorEngine.findOne(SELECTOR_MENU$3, trigger.parentElement)) continue; + trigger.setAttribute("aria-haspopup", "true"); + if (!trigger.hasAttribute("aria-expanded")) trigger.setAttribute("aria-expanded", "false"); + } + } + _openSubmenu(trigger, submenu, submenuWrapper) { + if (this._openSubmenus.has(submenu)) return; + trigger.setAttribute("aria-expanded", "true"); + trigger.setAttribute("aria-haspopup", "true"); + submenu.style.opacity = "0"; + submenu.classList.add(CLASS_NAME_SHOW$5); + submenuWrapper.classList.add(CLASS_NAME_SHOW$5); + const cleanup = this._createSubmenuFloating(trigger, submenu, submenuWrapper); + this._openSubmenus.set(submenu, cleanup); + EventHandler.on(submenu, "mouseenter", () => { + this._cancelSubmenuCloseTimeout(submenu); + }); + } + _closeSubmenu(submenu, submenuWrapper) { + if (!this._openSubmenus.has(submenu)) return; + const nestedSubmenus = SelectorEngine.find(`${SELECTOR_SUBMENU} ${SELECTOR_MENU$3}.${CLASS_NAME_SHOW$5}`, submenu); + for (const nested of nestedSubmenus) { + const nestedWrapper = nested.closest(SELECTOR_SUBMENU); + this._closeSubmenu(nested, nestedWrapper); + } + const trigger = SelectorEngine.findOne(SELECTOR_SUBMENU_TOGGLE, submenuWrapper); + const cleanup = this._openSubmenus.get(submenu); + if (cleanup) cleanup(); + this._openSubmenus.delete(submenu); + EventHandler.off(submenu, "mouseenter"); + if (trigger) trigger.setAttribute("aria-expanded", "false"); + submenu.classList.remove(CLASS_NAME_SHOW$5); + submenuWrapper.classList.remove(CLASS_NAME_SHOW$5); + submenu.style.opacity = ""; + } + _closeAllSubmenus() { + for (const [submenu] of this._openSubmenus) { + const submenuWrapper = submenu.closest(SELECTOR_SUBMENU); + this._closeSubmenu(submenu, submenuWrapper); + } + } + _closeSiblingSubmenus(currentSubmenuWrapper) { + const parent = currentSubmenuWrapper.parentNode; + const siblingSubmenus = SelectorEngine.find(`${SELECTOR_SUBMENU} > ${SELECTOR_MENU$3}.${CLASS_NAME_SHOW$5}`, parent); + for (const siblingMenu of siblingSubmenus) { + const siblingWrapper = siblingMenu.closest(SELECTOR_SUBMENU); + if (siblingWrapper !== currentSubmenuWrapper) this._closeSubmenu(siblingMenu, siblingWrapper); + } + } + _createSubmenuFloating(trigger, submenu, submenuWrapper) { + const referenceElement = submenuWrapper; + const placement = resolveLogicalPlacement(SUBMENU_PLACEMENT); + const middleware = [ + offset({ + mainAxis: 0, + crossAxis: -4 + }), + flip({ fallbackPlacements: [ + resolveLogicalPlacement("start-start"), + resolveLogicalPlacement("end-end"), + resolveLogicalPlacement("start-end") + ] }), + shift({ padding: 8 }) + ]; + const updatePosition = () => this._applyFloatingPosition(referenceElement, submenu, placement, middleware).then((finalPlacement) => { + submenu.style.opacity = ""; + return finalPlacement; + }); + updatePosition(); + return autoUpdate(referenceElement, submenu, updatePosition); + } + _scheduleSubmenuClose(submenu, submenuWrapper) { + this._cancelSubmenuCloseTimeout(submenu); + const timeoutId = setTimeout(() => { + this._closeSubmenu(submenu, submenuWrapper); + this._submenuCloseTimeouts.delete(submenu); + }, this._config.submenuDelay); + this._submenuCloseTimeouts.set(submenu, timeoutId); + } + _cancelSubmenuCloseTimeout(submenu) { + const timeoutId = this._submenuCloseTimeouts.get(submenu); + if (timeoutId) { + clearTimeout(timeoutId); + this._submenuCloseTimeouts.delete(submenu); + } + } + _clearAllSubmenuTimeouts() { + for (const timeoutId of this._submenuCloseTimeouts.values()) clearTimeout(timeoutId); + this._submenuCloseTimeouts.clear(); + } + _trackMousePosition(event) { + this._hoverIntentData = { + x: event.clientX, + y: event.clientY, + timestamp: Date.now() + }; + } + _isMovingTowardSubmenu(event, submenu) { + if (!this._hoverIntentData) return false; + const submenuRect = submenu.getBoundingClientRect(); + const currentPos = { + x: event.clientX, + y: event.clientY + }; + const lastPos = { + x: this._hoverIntentData.x, + y: this._hoverIntentData.y + }; + const targetX = isRTL$1() ? submenuRect.right : submenuRect.left; + const topCorner = { + x: targetX, + y: submenuRect.top + }; + const bottomCorner = { + x: targetX, + y: submenuRect.bottom + }; + return this._pointInTriangle(currentPos, lastPos, topCorner, bottomCorner); + } + _pointInTriangle(point, v1, v2, v3) { + const d1 = triangleSign(point, v1, v2); + const d2 = triangleSign(point, v2, v3); + const d3 = triangleSign(point, v3, v1); + return !((d1 < 0 || d2 < 0 || d3 < 0) && (d1 > 0 || d2 > 0 || d3 > 0)); + } + _getItemsInMenu(menu) { + return SelectorEngine.find(`:scope > ${SELECTOR_VISIBLE_ITEMS$1}, :scope > ${SELECTOR_SUBMENU} > ${SELECTOR_VISIBLE_ITEMS$1}`, menu).filter((element) => isVisible(element)); + } + _selectMenuItem({ key, target }) { + const currentMenu = target.closest(SELECTOR_MENU$3) || this._menu; + const items = this._getItemsInMenu(currentMenu); + if (!items.length) return; + const nextItem = getNextActiveElement(items, target, key === ARROW_DOWN_KEY$2, !items.includes(target)); + nextItem.focus(); + this._closeUnrelatedSubmenus(currentMenu, nextItem); + } + _closeUnrelatedSubmenus(currentMenu, focusedElement) { + for (const [submenu] of this._openSubmenus) { + const submenuWrapper = submenu.closest(SELECTOR_SUBMENU); + if (!submenuWrapper || submenuWrapper.parentElement !== currentMenu || submenuWrapper.contains(focusedElement)) continue; + this._closeSubmenu(submenu, submenuWrapper); + } + } + _handleSubmenuKeydown(event) { + const { key, target } = event; + const isRtl = isRTL$1(); + const enterKey = isRtl ? ARROW_LEFT_KEY$1 : ARROW_RIGHT_KEY$1; + const exitKey = isRtl ? ARROW_RIGHT_KEY$1 : ARROW_LEFT_KEY$1; + const submenuWrapper = target.closest(SELECTOR_SUBMENU); + const isSubmenuToggle = target.matches(SELECTOR_SUBMENU_TOGGLE); + if ((key === ENTER_KEY$1 || key === SPACE_KEY$1 || key === enterKey) && submenuWrapper && isSubmenuToggle) { + event.preventDefault(); + event.stopPropagation(); + const submenu = SelectorEngine.findOne(SELECTOR_MENU$3, submenuWrapper); + if (submenu) { + this._closeSiblingSubmenus(submenuWrapper); + this._openSubmenu(target, submenu, submenuWrapper); + requestAnimationFrame(() => { + const firstItem = SelectorEngine.findOne(SELECTOR_VISIBLE_ITEMS$1, submenu); + if (firstItem) firstItem.focus(); + }); + } + return true; + } + if (key === exitKey) { + const currentMenu = target.closest(SELECTOR_MENU$3); + const parentSubmenuWrapper = currentMenu?.closest(SELECTOR_SUBMENU); + if (parentSubmenuWrapper) { + event.preventDefault(); + event.stopPropagation(); + const parentTrigger = SelectorEngine.findOne(SELECTOR_SUBMENU_TOGGLE, parentSubmenuWrapper); + this._closeSubmenu(currentMenu, parentSubmenuWrapper); + if (parentTrigger) parentTrigger.focus(); + return true; + } + } + if (key === HOME_KEY$2 || key === END_KEY$2) { + event.preventDefault(); + event.stopPropagation(); + const currentMenu = target.closest(SELECTOR_MENU$3); + const items = this._getItemsInMenu(currentMenu); + if (items.length) { + const targetItem = key === HOME_KEY$2 ? items[0] : items.at(-1); + targetItem.focus(); + this._closeUnrelatedSubmenus(currentMenu, targetItem); + } + return true; + } + return false; + } + static clearMenus(event) { + if (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY$1) return; + for (const instance of Menu._openInstances) { + if (instance._config.autoClose === false) continue; + const composedPath = event.composedPath(); + const isMenuTarget = composedPath.includes(instance._menu); + if (composedPath.includes(instance._element) || instance._config.autoClose === "inside" && !isMenuTarget || instance._config.autoClose === "outside" && isMenuTarget) continue; + const formAncestor = event.target.closest?.("form"); + const isInsideMenuForm = Boolean(formAncestor) && instance._menu.contains(formAncestor); + if (instance._menu.contains(event.target) && (event.type === "keyup" && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName) || isInsideMenuForm)) continue; + const relatedTarget = { relatedTarget: instance._element }; + if (event.type === "click") relatedTarget.clickEvent = event; + instance._completeHide(relatedTarget); + } + } + static _getToggleFromKeydownContext(element, event) { + if (element.matches(SELECTOR_DATA_TOGGLE$8)) return element; + for (const instance of Menu._openInstances) if (instance._element === event.target || instance._menu?.contains(event.target)) return instance._element; + return SelectorEngine.prev(element, SELECTOR_DATA_TOGGLE$8)[0] || SelectorEngine.next(element, SELECTOR_DATA_TOGGLE$8)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$8, event.delegateTarget.parentNode); + } + static dataApiKeydownHandler(event) { + const isInput = /input|textarea/i.test(event.target.tagName) || event.target.isContentEditable; + const isEscapeEvent = event.key === ESCAPE_KEY$2; + const isUpOrDownEvent = [ARROW_UP_KEY$2, ARROW_DOWN_KEY$2].includes(event.key); + const isLeftOrRightEvent = [ARROW_LEFT_KEY$1, ARROW_RIGHT_KEY$1].includes(event.key); + const isHomeOrEndEvent = [HOME_KEY$2, END_KEY$2].includes(event.key); + const isEnterOrSpaceEvent = [ENTER_KEY$1, SPACE_KEY$1].includes(event.key); + const isSubmenuTrigger = event.target.matches(SELECTOR_SUBMENU_TOGGLE); + if (!isUpOrDownEvent && !isEscapeEvent && !isLeftOrRightEvent && !isHomeOrEndEvent && !(isEnterOrSpaceEvent && isSubmenuTrigger)) return; + if (isInput && !isEscapeEvent) return; + const getToggleButton = Menu._getToggleFromKeydownContext(this, event); + if (!getToggleButton) return; + const instance = Menu.getOrCreateInstance(getToggleButton); + if ((isLeftOrRightEvent || isHomeOrEndEvent || isEnterOrSpaceEvent && isSubmenuTrigger) && instance._handleSubmenuKeydown(event)) return; + if (isUpOrDownEvent) { + event.preventDefault(); + event.stopPropagation(); + instance.show(); + instance._selectMenuItem(event); + return; + } + if (isEscapeEvent && instance._isShown()) { + event.preventDefault(); + event.stopPropagation(); + const currentMenu = event.target.closest(SELECTOR_MENU$3); + const parentSubmenuWrapper = currentMenu?.closest(SELECTOR_SUBMENU); + if (parentSubmenuWrapper && instance._openSubmenus.size > 0) { + const parentTrigger = SelectorEngine.findOne(SELECTOR_SUBMENU_TOGGLE, parentSubmenuWrapper); + instance._closeSubmenu(currentMenu, parentSubmenuWrapper); + if (parentTrigger) parentTrigger.focus(); + return; + } + instance.hide(); + getToggleButton.focus(); + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$8, Menu.dataApiKeydownHandler); +EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU$3, Menu.dataApiKeydownHandler); +EventHandler.on(document, EVENT_CLICK_DATA_API$5, Menu.clearMenus); +EventHandler.on(document, EVENT_KEYUP_DATA_API, Menu.clearMenus); +EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$8, function(event) { + event.preventDefault(); + Menu.getOrCreateInstance(this).toggle(); +}); +//#endregion +//#region js/src/combobox.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap combobox.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$16 = "combobox"; +const EVENT_KEY$13 = `.bs.combobox`; +const DATA_API_KEY$8 = ".data-api"; +const ESCAPE_KEY$1 = "Escape"; +const TAB_KEY = "Tab"; +const ARROW_UP_KEY$1 = "ArrowUp"; +const ARROW_DOWN_KEY$1 = "ArrowDown"; +const HOME_KEY$1 = "Home"; +const END_KEY$1 = "End"; +const ENTER_KEY = "Enter"; +const SPACE_KEY = " "; +const EVENT_CHANGE$3 = `change${EVENT_KEY$13}`; +const EVENT_SHOW$5 = `show${EVENT_KEY$13}`; +const EVENT_SHOWN$4 = `shown${EVENT_KEY$13}`; +const EVENT_HIDE$4 = `hide${EVENT_KEY$13}`; +const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$13}`; +const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$13}${DATA_API_KEY$8}`; +const CLASS_NAME_SHOW$4 = "show"; +const CLASS_NAME_SELECTED = "selected"; +const CLASS_NAME_PLACEHOLDER = "combobox-placeholder"; +const SELECTOR_DATA_TOGGLE$7 = "[data-bs-toggle=\"combobox\"]"; +const SELECTOR_MENU$2 = ".menu"; +const SELECTOR_MENU_ITEM = ".menu-item[data-bs-value]"; +const SELECTOR_VISIBLE_ITEMS = ".menu-item[data-bs-value]:not(.disabled):not(:disabled)"; +const SELECTOR_VALUE = ".combobox-value"; +const SELECTOR_SEARCH_INPUT = ".combobox-search-input"; +const SELECTOR_NO_RESULTS = ".combobox-no-results"; +const Default$15 = { + boundary: "clippingParents", + multiple: false, + name: null, + offset: [0, 2], + placeholder: "", + placement: "bottom-start", + search: false, + searchNormalize: false +}; +const DefaultType$15 = { + boundary: "(string|element)", + multiple: "boolean", + name: "(string|null)", + offset: "(array|string|function)", + placeholder: "string", + placement: "string", + search: "boolean", + searchNormalize: "boolean" +}; +/** +* Class definition +*/ +var Combobox = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._toggle = this._element; + this._menu = SelectorEngine.next(this._toggle, SELECTOR_MENU$2)[0]; + this._valueDisplay = SelectorEngine.findOne(SELECTOR_VALUE, this._toggle); + this._searchInput = SelectorEngine.findOne(SELECTOR_SEARCH_INPUT, this._menu); + this._noResults = SelectorEngine.findOne(SELECTOR_NO_RESULTS, this._menu); + this._hiddenInput = null; + this._menuInstance = null; + this._createHiddenInput(); + this._createMenuInstance(); + this._syncInitialSelection(); + this._addEventListeners(); + } + static get Default() { + return Default$15; + } + static get DefaultType() { + return DefaultType$15; + } + static get NAME() { + return NAME$16; + } + toggle() { + return this._isShown() ? this.hide() : this.show(); + } + async show() { + if (isDisabled(this._toggle) || this._isShown()) return; + if (EventHandler.trigger(this._toggle, EVENT_SHOW$5).defaultPrevented) return; + this._menuInstance.show(); + if (this._searchInput) { + this._searchInput.value = ""; + this._filterItems(""); + requestAnimationFrame(() => this._searchInput.focus()); + } + EventHandler.trigger(this._toggle, EVENT_SHOWN$4); + } + async hide() { + if (!this._isShown()) return; + if (EventHandler.trigger(this._toggle, EVENT_HIDE$4).defaultPrevented) return; + this._menuInstance.hide(); + EventHandler.trigger(this._toggle, EVENT_HIDDEN$6); + } + dispose() { + if (this._menuInstance) { + this._menuInstance.dispose(); + this._menuInstance = null; + } + if (this._hiddenInput) { + this._hiddenInput.remove(); + this._hiddenInput = null; + } + EventHandler.off(this._menu, EVENT_KEY$13); + EventHandler.off(this._toggle, EVENT_KEY$13); + EventHandler.off(this._searchInput, EVENT_KEY$13); + super.dispose(); + } + _isShown() { + return this._menu.classList.contains(CLASS_NAME_SHOW$4); + } + _createHiddenInput() { + const { name } = this._config; + if (!name) return; + this._hiddenInput = document.createElement("input"); + this._hiddenInput.type = "hidden"; + this._hiddenInput.name = name; + this._hiddenInput.value = ""; + this._toggle.parentNode.insertBefore(this._hiddenInput, this._toggle); + } + _createMenuInstance() { + this._menuInstance = new Menu(this._toggle, { + menu: this._menu, + autoClose: this._config.multiple ? "outside" : true, + boundary: this._config.boundary, + offset: this._config.offset, + placement: this._config.placement + }); + } + _syncInitialSelection() { + if (this._getSelectedItems().length > 0) { + this._updateToggleText(); + this._updateHiddenInput(); + } else this._showPlaceholder(); + } + _addEventListeners() { + EventHandler.on(this._menu, `click${EVENT_KEY$13}`, SELECTOR_MENU_ITEM, (event) => { + const item = event.target.closest(SELECTOR_MENU_ITEM); + if (!item || isDisabled(item)) return; + event.preventDefault(); + event.stopPropagation(); + this._selectItem(item); + }); + EventHandler.on(this._toggle, `keydown${EVENT_KEY$13}`, (event) => { + this._handleToggleKeydown(event); + }); + EventHandler.on(this._menu, `keydown${EVENT_KEY$13}`, (event) => { + this._handleMenuKeydown(event); + }); + if (this._searchInput) { + EventHandler.on(this._searchInput, `input${EVENT_KEY$13}`, () => { + this._filterItems(this._searchInput.value); + }); + EventHandler.on(this._searchInput, `keydown${EVENT_KEY$13}`, (event) => { + if (event.key === ARROW_DOWN_KEY$1) { + event.preventDefault(); + const items = this._getVisibleItems(); + if (items.length > 0) items[0].focus(); + } + if (event.key === ESCAPE_KEY$1) { + this.hide(); + this._toggle.focus(); + } + }); + } + } + _selectItem(item) { + if (this._config.multiple) { + item.classList.toggle(CLASS_NAME_SELECTED); + setAriaAttribute(item, "aria-selected", item.classList.contains(CLASS_NAME_SELECTED)); + } else { + const previouslySelected = SelectorEngine.find(`.${CLASS_NAME_SELECTED}`, this._menu); + for (const prev of previouslySelected) { + prev.classList.remove(CLASS_NAME_SELECTED); + prev.setAttribute("aria-selected", "false"); + } + item.classList.add(CLASS_NAME_SELECTED); + item.setAttribute("aria-selected", "true"); + } + this._updateToggleText(); + this._updateHiddenInput(); + const value = this._config.multiple ? this._getSelectedItems().map((el) => el.dataset.bsValue) : item.dataset.bsValue; + EventHandler.trigger(this._toggle, EVENT_CHANGE$3, { + value, + item + }); + if (!this._config.multiple) { + this.hide(); + this._toggle.focus(); + } + } + _updateToggleText() { + const selectedItems = this._getSelectedItems(); + if (selectedItems.length === 0) { + this._showPlaceholder(); + return; + } + this._valueDisplay.classList.remove(CLASS_NAME_PLACEHOLDER); + if (this._config.multiple && selectedItems.length > 1) this._valueDisplay.textContent = `${selectedItems.length} selected`; + else { + const item = selectedItems[0]; + const label = SelectorEngine.findOne(".menu-item-content > span:first-child", item); + this._valueDisplay.textContent = label ? label.textContent : item.textContent.trim(); + } + } + _showPlaceholder() { + const { placeholder } = this._config; + if (placeholder) { + this._valueDisplay.textContent = placeholder; + this._valueDisplay.classList.add(CLASS_NAME_PLACEHOLDER); + } + } + _updateHiddenInput() { + if (!this._hiddenInput) return; + const values = this._getSelectedItems().map((el) => el.dataset.bsValue); + this._hiddenInput.value = this._config.multiple ? values.join(",") : values[0] || ""; + } + _getSelectedItems() { + return SelectorEngine.find(`.${CLASS_NAME_SELECTED}`, this._menu); + } + _getVisibleItems() { + return SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((item) => isVisible(item)); + } + _filterItems(query) { + const normalizedQuery = this._normalizeText(query.toLowerCase().trim()); + const items = SelectorEngine.find(SELECTOR_MENU_ITEM, this._menu); + let visibleCount = 0; + for (const item of items) { + const text = this._normalizeText(item.textContent.toLowerCase().trim()); + const matches = !normalizedQuery || text.includes(normalizedQuery); + item.style.display = matches ? "" : "none"; + if (matches) visibleCount++; + } + if (this._noResults) this._noResults.classList.toggle("d-none", visibleCount > 0); + } + _normalizeText(text) { + if (this._config.searchNormalize) return text.normalize("NFD").replace(/[\u0300-\u036F]/g, ""); + return text; + } + _handleToggleKeydown(event) { + const { key } = event; + if (key === ARROW_DOWN_KEY$1 || key === ARROW_UP_KEY$1) { + event.preventDefault(); + if (!this._isShown()) this.show(); + const items = this._getVisibleItems(); + if (items.length > 0) (key === ARROW_DOWN_KEY$1 ? items[0] : items.at(-1)).focus(); + return; + } + if ((key === ENTER_KEY || key === SPACE_KEY) && !this._isShown()) { + event.preventDefault(); + this.show(); + } + } + _handleMenuKeydown(event) { + const { key, target } = event; + if (key === ESCAPE_KEY$1) { + event.preventDefault(); + event.stopPropagation(); + this.hide(); + this._toggle.focus(); + return; + } + if (key === TAB_KEY) { + this.hide(); + return; + } + const isInput = target.matches("input"); + if (key === ARROW_DOWN_KEY$1 || key === ARROW_UP_KEY$1) { + event.preventDefault(); + const items = this._getVisibleItems(); + if (items.length > 0) getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus(); + return; + } + if (key === HOME_KEY$1 || key === END_KEY$1) { + event.preventDefault(); + const items = this._getVisibleItems(); + if (items.length > 0) (key === HOME_KEY$1 ? items[0] : items.at(-1)).focus(); + return; + } + if ((key === ENTER_KEY || key === SPACE_KEY) && !isInput) { + event.preventDefault(); + const item = target.closest(SELECTOR_MENU_ITEM); + if (item && !isDisabled(item)) this._selectItem(item); + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$7, function(event) { + event.preventDefault(); + Combobox.getOrCreateInstance(this).toggle(); +}); +EventHandler.on(document, "DOMContentLoaded", () => { + for (const toggle of SelectorEngine.find(SELECTOR_DATA_TOGGLE$7)) Combobox.getOrCreateInstance(toggle); +}); +//#endregion +//#region node_modules/vanilla-calendar-pro/index.mjs +/*! name: vanilla-calendar-pro v3.4.0 | url: https://github.com/uvarov-frontend/vanilla-calendar-pro */ +var e = (e) => /* @__PURE__ */ new Date(`${e}T00:00:00`); +var t = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`; +var n = (n, a) => n.reduce((n, l) => { + if (l instanceof Date || "number" == typeof l) { + let e = l instanceof Date ? l : new Date(l); + n.push(t(e)); + } else l.match(/^(\d{4}-\d{2}-\d{2})$/g) ? n.push(l) : l.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g, (l, o, r) => { + var i; + let s = `${o}:${r}`, c = a ? a.start.getTime() : -Infinity, d = null == a || null == (i = a.cursors) ? void 0 : i.get(s), u = void 0 !== d && d <= c ? new Date(d) : e(o), m = e(r).setHours(23, 59, 59, 999); + if (a) { + if (m < c) return l; + m = Math.min(m, new Date(a.end).setHours(23, 59, 59, 999)); + } + let p = !1; + for (let e = u.getTime(); e <= m; e = u.setDate(u.getDate() + 1)) (!a || e >= c) && (null != a && a.cursors && !p && (a.cursors.set(s, e), p = !0), n.push(t(u))); + return l; + }); + return n; +}, []); +var a = (e, t) => { + if (t && t.values.length === e.length) { + let n = 0; + for (; n < e.length && t.values[n] === e[n];) n++; + if (n === e.length) return t; + } + return { + values: e.slice(), + set: new Set(e) + }; +}; +var l = /* @__PURE__ */ new WeakMap(); +var o = (e) => { + var t; + let o = null != (t = e.selectedHolidays) && t[0] ? e.selectedHolidays : [], r = JSON.stringify(o.map((e) => e instanceof Date ? e.getTime() : e)), i = l.get(e); + l.set(e, { + holidayKey: r, + holidays: (null == i ? void 0 : i.holidayKey) === r ? i.holidays : new Set(n(o)), + selected: a(e.context.selectedDates, null == i ? void 0 : i.selected), + disabled: a(e.context.disableDates, null == i ? void 0 : i.disabled), + enabled: a(e.context.enableDates, null == i ? void 0 : i.enabled), + min: Date.parse(`${e.context.displayDateMin}T00:00:00`), + max: Date.parse(`${e.context.displayDateMax}T00:00:00`), + first: Date.parse(`${e.context.selectedDates[0]}T00:00:00`), + last: Date.parse(`${e.context.selectedDates[e.context.selectedDates.length - 1]}T00:00:00`) + }); +}; +var r = (e) => l.get(e); +var i = [ + "motion", + "time", + "annotations", + "weeks", + "months" +]; +var s = /* @__PURE__ */ new WeakMap(); +var c = {}; +var d = /* @__PURE__ */ Object.freeze([]); +var u = (e) => { + var t; + return null == (t = s.get(e)) ? c : t; +}; +var m = (e, t = e) => { + if (t.extensions && t.extensions !== e.extensions && (new Set(t.extensions).size !== e.extensions.length || t.extensions.some((t) => !e.extensions.includes(t)))) throw Error("Calendar extensions are fixed at construction. Create a new Calendar to change them."); + let n = u(e), a = (e, t, a) => { + if (e && !n[t]) throw Error(`The "${a}" option requires ${t}. Import { ${t} } from 'vanilla-calendar-pro' and add it to extensions: [${t}].`); + }; + a(t.animation || t.enableSwipe, "motion", t.animation ? "animation" : "enableSwipe"), a(t.selectionTimeMode, "time", "selectionTimeMode"), a(t.popups && Object.keys(t.popups).length || t.onCreateDateRangeTooltip, "annotations", t.onCreateDateRangeTooltip ? "onCreateDateRangeTooltip" : "popups"), a("multiple" === t.type, "months", "type"), a("week" === t.type || t.enableCollapse || t.enableWeekNumbers || t.onClickWeekDay, "weeks", "week" === t.type ? "type" : t.enableCollapse ? "enableCollapse" : t.enableWeekNumbers ? "enableWeekNumbers" : "onClickWeekDay"); +}; +var p = (e, t, n) => { + var a; + return null == (a = u(e).annotations) ? void 0 : a.tooltip(e, t, n); +}; +var h = /* @__PURE__ */ new WeakMap(); +var v = (e) => { + let t = h.get(e); + return t || (t = { + lastDateEl: null, + isHovering: !1, + rangeMin: void 0, + rangeMax: void 0, + tooltipEl: null, + timeoutId: null, + frameId: null + }, h.set(e, t)), t; +}; +var y = (e) => { + e.context.mainElement.querySelectorAll("[data-vc-date-hover]").forEach((e) => e.removeAttribute("data-vc-date-hover")); +}; +var g = (e, t, n) => { + e.context[t] = n; +}; +var f = (e, t) => void 0 === t || ("function" == typeof t ? t(e) : t); +var x = (e) => f(e, e.enableDateToggle); +var b = (e) => { + if (e.length < 3 || e.includes(void 0)) return e.sort((e, t) => +new Date(e) - new Date(t)); + let t = e.map((e) => ({ + date: e, + time: +new Date(e) + })); + return t.sort((e, t) => e.time - t.time), t.forEach((t, n) => e[n] = t.date), e; +}; +var D = (e) => { + var t; + let n = h.get(e); + n && (null == (t = n.cleanup) || t.call(n), n.cleanup = void 0, null !== n.timeoutId && clearTimeout(n.timeoutId), null !== n.frameId && cancelAnimationFrame(n.frameId), n.lastDateEl = null, n.tooltipEl = null, n.timeoutId = null, n.frameId = null, h.delete(e)); +}; +var M = (a, l, o = !0) => { + let r = v(a); + if (r.lastDateEl = l, y(a), !r.cleanup) { + let n = a.context.mainElement, l = ((n) => (a) => { + if (!n.context.selectedDates[0] || 1 !== n.context.selectedDates.length && !n.onCreateDateRangeTooltip) return; + let l = v(n); + if (l.isHovering) return; + let o = a.target; + l.isHovering = !0, l.frameId = requestAnimationFrame(() => { + var a; + l.frameId = null, l.isHovering = !1, !n.context.isDestroyed && n.context.mainElement.contains(o) && (1 === n.context.selectedDates.length ? ((n, a) => { + var l; + let o = v(n); + if (n.context.mainElement.hasAttribute("data-vc-dragging") || !a || null == n || null == (l = n.context) || !l.selectedDates[0]) return; + if (!a.closest("[data-vc=\"dates\"]")) return o.lastDateEl = null, p(n, o.tooltipEl, null), void y(n); + let r = a.closest("[data-vc-date]"); + if (!r || o.lastDateEl === r) return; + o.lastDateEl = r, p(n, o.tooltipEl, r), y(n); + let i = r.dataset.vcDate, s = e(n.context.selectedDates[0]), c = e(i), [d, u] = s < c ? [s, c] : [c, s], [m, h] = s < c ? [n.context.selectedDates[0], i] : [i, n.context.selectedDates[0]], g = new Set(n.context.disableDates), f = new Date(d); + for (; f <= u && g.has(t(f));) f.setDate(f.getDate() + 1); + f <= u && n.context.mainElement.querySelectorAll("[data-vc-date]").forEach((t) => { + let n = t.dataset.vcDate; + if (n === m || n === h) t.dataset.vcDateHover = m === h ? "first-and-last" : n === m ? "first" : "last"; + else { + let a = e(n); + a >= d && a <= u && !g.has(n) && (t.dataset.vcDateHover = ""); + } + }); + })(n, o) : n.context.selectedDates[0] && n.onCreateDateRangeTooltip && (null == (a = u(n).annotations) || a.hover(n, o))); + }); + })(a), o = () => ((e) => { + let t = v(e); + null !== t.timeoutId && clearTimeout(t.timeoutId), t.timeoutId = setTimeout(() => { + t.timeoutId = null, !e.context.isDestroyed && (t.lastDateEl = null, p(e, t.tooltipEl, null), y(e)); + }, 50); + })(a), i = (e) => ((e, t) => { + if ("Escape" !== t.key || 1 !== e.context.selectedDates.length) return; + let n = v(e); + n.lastDateEl = null, g(e, "selectedDates", []), p(e, n.tooltipEl, null), y(e); + })(a, e); + n.addEventListener("mousemove", l), n.addEventListener("mouseleave", o), n.addEventListener("keydown", i), r.cleanup = () => { + n.removeEventListener("mousemove", l), n.removeEventListener("mouseleave", o), n.removeEventListener("keydown", i); + }; + } + a.disableDatesGaps && (r.rangeMin ??= a.context.displayDateMin, r.rangeMax ??= a.context.displayDateMax), r.tooltipEl = a.onCreateDateRangeTooltip ? a.context.mainElement.querySelector("[data-vc-date-range-tooltip]") : null; + let i = null == l ? void 0 : l.dataset.vcDate; + if (i) { + let e = 1 === a.context.selectedDates.length && a.context.selectedDates[0].includes(i); + g(a, "selectedDates", e && !x(a) ? [i, i] : e && x(a) ? [] : a.context.selectedDates.length > 1 ? [i] : [...a.context.selectedDates, i]), a.context.selectedDates.length > 1 && b(a.context.selectedDates); + } + ({ + set: () => { + a.disableDatesGaps && ((n) => { + var a, l; + if (null == n || null == (a = n.context) || null == (a = a.selectedDates) || !a[0] || null == (l = n.context.disableDates) || !l[0]) return; + let o = e(n.context.selectedDates[0]), [r, i] = n.context.disableDates.map((t) => e(t)).reduce(([e, t], n) => [o >= n ? n : e, o < n && null === t ? n : t], [null, null]); + r && g(n, "displayDateMin", t(new Date(r.setDate(r.getDate() + 1)))), i && g(n, "displayDateMax", t(new Date(i.setDate(i.getDate() - 1)))), n.disableDatesPast && !n.disableAllDates && e(n.context.displayDateMin) < e(n.context.dateToday) && g(n, "displayDateMin", n.context.dateToday); + })(a), p(a, r.tooltipEl, l); + }, + reset: () => { + if (!o) return; + let [e, t] = [a.context.selectedDates[0], a.context.selectedDates[a.context.selectedDates.length - 1]]; + g(a, "selectedDates", a.context.selectedDates[0] === a.context.selectedDates[a.context.selectedDates.length - 1] ? [a.context.selectedDates[0], a.context.selectedDates[0]] : a.enableEdgeDatesOnly ? [e, t] : (() => { + let l = new Set(a.context.disableDates); + return n([`${e}:${t}`]).filter((e) => !l.has(e)); + })()), a.disableDatesGaps && (g(a, "displayDateMin", r.rangeMin), g(a, "displayDateMax", r.rangeMax)), a.onCreateDateRangeTooltip && p(a, r.tooltipEl, a.context.selectedDates[0] ? l : null); + } + })[1 === a.context.selectedDates.length ? "set" : "reset"](); +}; +var w = (e) => e.getRootNode ? e.getRootNode() : document; +var E = /* @__PURE__ */ new WeakSet(); +var k = "data-vc-prev-tabindex"; +var T = (e) => e.tabIndex >= 0 && !e.hasAttribute("disabled") && "true" !== e.getAttribute("aria-disabled"); +var A = (e) => { + if (e.hasAttribute(k)) return; + let t = e.getAttribute("tabindex"); + e.setAttribute(k, null == t ? "" : t); +}; +var C = (e) => { + if (!e.hasAttribute(k)) return; + let t = e.getAttribute(k); + "" === t || null === t ? e.removeAttribute("tabindex") : e.setAttribute("tabindex", t), e.removeAttribute(k); +}; +var S = (e) => { + e.setAttribute("inert", ""), e.ariaHidden = "true", ((e) => { + T(e) && (A(e), e.tabIndex = -1); + let t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (e) => T(e) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP }); + for (; t.nextNode();) { + let e = t.currentNode; + A(e), e.tabIndex = -1; + } + })(e); +}; +var $ = (e) => { + var t; + if (H(e), !e.context.isShowInInputMode || !e.context.currentType) return; + let n = e.context.mainElement.contains(w(e.context.mainElement).activeElement); + e.context.mainElement.dataset.vcCalendarHidden = "", g(e, "isShowInInputMode", !1), e.inputMode && S(e.context.mainElement), null != (t = e.context.inputElement) && t.hasAttribute("aria-expanded") && e.context.inputElement.setAttribute("aria-expanded", "false"), e.context.cleanupHandlers[0] && (e.context.cleanupHandlers.forEach((e) => e()), g(e, "cleanupHandlers", [])), e.inputMode && e.context.inputElement && n && (("function" == typeof e.openOnFocus || !0 === e.openOnFocus) && ((e) => { + E.add(e); + })(e), e.context.inputElement.focus()), e.onHide && e.onHide(e); +}; +function Y(e) { + if (null == e || !e.getBoundingClientRect) return { + top: 0, + bottom: 0, + left: 0, + right: 0 + }; + let t = e.getBoundingClientRect(), n = document.documentElement; + return { + bottom: t.bottom, + right: t.right, + top: t.top + window.scrollY - n.clientTop, + left: t.left + window.scrollX - n.clientLeft + }; +} +function N() { + return { + vw: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0), + vh: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0) + }; +} +function I(e, t, n = 5) { + let a = { + top: !0, + bottom: !0, + left: !0, + right: !0 + }, l = []; + if (!t || !e) return { + canShow: a, + parentPositions: l + }; + let { bottom: o, top: r } = function(e) { + let { top: t, left: n } = { + left: window.scrollX || document.documentElement.scrollLeft || 0, + top: window.scrollY || document.documentElement.scrollTop || 0 + }, { top: a, left: l } = Y(e), { vh: o, vw: r } = N(), i = a - t, s = l - n; + return { + top: i, + bottom: o - (i + e.clientHeight), + left: s, + right: r - (s + e.clientWidth) + }; + }(e), { top: i, left: s } = Y(e), { height: c, width: d } = t.getBoundingClientRect(), { vh: u, vw: m } = N(), p = m / 2, h = u / 2; + return [ + { + condition: i < h, + position: "top" + }, + { + condition: i > h, + position: "bottom" + }, + { + condition: s < p, + position: "left" + }, + { + condition: s > p, + position: "right" + } + ].forEach(({ condition: e, position: t }) => { + e && l.push(t); + }), Object.assign(a, { + top: c <= r - n, + bottom: c <= o - n, + left: d <= s, + right: d <= m - s + }), { + canShow: a, + parentPositions: l + }; +} +var L = (e, t, n) => { + if (!e) return; + let a = "auto" === n ? function(e, t) { + let n = "left"; + if (!t || !e) return n; + let { canShow: a, parentPositions: l } = I(e, t), o = a.left && a.right; + return (o && a.bottom ? "center" : o && a.top ? ["top", "center"] : Array.isArray(l) ? ["bottom" === l[0] ? "top" : "bottom", ...l.slice(1)] : l) || n; + }(e, t) : n, l = { + top: -t.offsetHeight, + bottom: e.offsetHeight, + left: 0, + center: e.offsetWidth / 2 - t.offsetWidth / 2, + right: e.offsetWidth - t.offsetWidth + }, o = Array.isArray(a) ? a[0] : "bottom", r = Array.isArray(a) ? a[1] : a; + t.dataset.vcPosition = o; + let { top: i, left: s } = Y(e), c = i + l[o], d = s + l[r], { vw: u } = N(); + if (d + t.clientWidth > u) { + let e = window.innerWidth - document.body.clientWidth; + d = u - t.clientWidth - e; + } else d < 0 && (d = 0); + Object.assign(t.style, { + left: `${d}px`, + top: `${c}px` + }); +}; +var W = /* @__PURE__ */ new WeakMap(); +var H = (e) => { + clearTimeout(W.get(e)), W.delete(e); +}; +var O = (e) => { + H(e), W.set(e, setTimeout(() => { + W.delete(e), e.context.isDestroyed || q(e); + })); +}; +var q = (e) => { + var t, n; + if (H(e), e.context.isShowInInputMode || e.context.isDestroyed) return; + if (!e.context.currentType) return void e.context.mainElement.click(); + g(e, "cleanupHandlers", []), g(e, "isShowInInputMode", !0), e.inputMode && ((n = e.context.mainElement).removeAttribute("inert"), n.removeAttribute("aria-hidden"), ((e) => { + C(e), e.querySelectorAll(`[${k}]`).forEach(C); + })(n)), L(e.context.inputElement, e.context.mainElement, e.positionToInput), e.context.mainElement.removeAttribute("data-vc-calendar-hidden"), null != (t = e.context.inputElement) && t.hasAttribute("aria-expanded") && e.context.inputElement.setAttribute("aria-expanded", "true"); + let a = () => { + L(e.context.inputElement, e.context.mainElement, e.positionToInput); + }; + window.addEventListener("resize", a), e.context.cleanupHandlers.push(() => window.removeEventListener("resize", a)); + let l = (t) => { + "Escape" === t.key && $(e); + }; + document.addEventListener("keydown", l), e.context.cleanupHandlers.push(() => document.removeEventListener("keydown", l)); + let o = (t) => { + var n; + let a = null == (n = t.composedPath()[0]) ? t.target : n; + a === e.context.inputElement || e.context.mainElement.contains(a) || $(e); + }; + document.addEventListener("click", o, { capture: !0 }), e.context.cleanupHandlers.push(() => document.removeEventListener("click", o, { capture: !0 })), e.onShow && e.onShow(e); +}; +var F = "The calendar has not been initialized, please initialize it using the \"init()\" method first."; +var P = "You specified an incorrect language label or did not specify the required number of values ​​for «locale.weekdays» or «locale.months»."; +var _ = (e) => String(e).replace(/[&<>"']/g, (e) => ({ + "&": "&", + "<": "<", + ">": ">", + "\"": """, + "'": "'" +})[e]); +var R = (e, t) => `\n
\n${t ? ` <#ArrowPrev [${t}] />\n` : ""}
\n <#Month />\n <#Year />\n
\n${t ? ` <#ArrowNext [${t}] />\n` : ""}
\n`; +var j = (e, t = "month") => `${R(e, t)}
\n <#WeekNumbers />\n
\n <#Week />\n <#Dates />\n <#DateRangeTooltip />\n
\n
\n <#Collapse />\n <#ControlTime />\n`; +var z = (e) => e; +var K = /* @__PURE__ */ new WeakMap(); +var B = (e) => { + var t; + null == (t = K.get(e)) || t.observer.disconnect(), K.delete(e); +}; +var U = B; +var X = (e) => { + var t; + return !(e.animation || e.enableCollapse || e.onCreateDateEls || e.onCreateDateRangeTooltip || e.disableDatesGaps || e.popups && Object.keys(e.popups).length || e.sanitizerHTML !== z || "default" !== e.context.currentType && "multiple" !== e.context.currentType || e.layouts[e.context.currentType] !== ("multiple" === e.context.currentType ? null == (t = u(e).months) ? void 0 : t.layout(e) : j(e))); +}; +var G = (e) => JSON.stringify(Object.entries(e).filter(([e]) => "context" !== e && "selectedDates" !== e), (e, t) => "function" == typeof t || t); +var Z = ({ context: e }) => JSON.stringify([ + e.currentType, + e.locale, + e.dateToday, + e.dateMin, + e.dateMax, + e.displayDateMin, + e.displayDateMax, + e.selectedYear, + e.selectedMonth, + e.displayMonthsCount, + e.selectedHours, + e.selectedMinutes, + e.selectedKeeping, + e.selectedTime +]); +var V = (e) => JSON.stringify([ + Z(e), + e.context.displayYear, + e.context.displayWeekDate, + e.context.selectedDates, + e.context.disableDates, + e.context.enableDates +]); +var J = (e, t = !1) => { + let n = K.get(e); + if (!n || !t && !n.fullLayout || n.dirty || n.observer.takeRecords().length || !X(e)) return; + let a = w(e.context.mainElement).activeElement; + if (!a || a === e.context.mainElement || !e.context.mainElement.contains(a) || t && !a.closest("[data-vc=\"column\"], [data-vc=\"dates\"], [data-vc-week=\"numbers\"]")) try { + if (n.options === G(e) && n.context === V(e) && n.timezone === new Intl.DateTimeFormat().resolvedOptions().timeZone) return n; + } catch (l) {} +}; +var Q = (e, t = !1) => { + if (B(e), X(e) && !e.context.isDestroyed) try { + let n = G(e), a = V(e); + if (n.length + a.length > 262144) return; + let l = Array.from(e.context.mainElement.querySelectorAll("[data-vc=\"dates\"]")); + if (l.length !== e.context.displayMonthsCount) return; + let o = { + observer: new MutationObserver(() => o.dirty = !0), + dirty: !1, + fullLayout: t, + options: n, + context: a, + structure: Z(e), + timezone: new Intl.DateTimeFormat().resolvedOptions().timeZone, + month: 12 * e.context.selectedYear + e.context.selectedMonth, + count: l.length + }; + o.observer.observe(e.context.mainElement, { + subtree: !0, + childList: !0, + attributes: !0, + characterData: !0 + }), K.set(e, o); + } catch (n) { + B(e); + } +}; +var ee = (e, t, n, a = "") => { + t ? e.getAttribute(n) !== a && e.setAttribute(n, a) : e.getAttribute(n) === a && e.removeAttribute(n); +}; +var te = (t, n, a, l, o, i, s) => { + var c; + let d = (p = i, Date.parse(`${p}T00:00:00`)), u = r(t), m = u.min > d || u.max < d || u.disabled.set.has(i) || !t.selectionMonthsMode && "current" !== s || !t.selectionYearsMode && e(i).getFullYear() !== n; + var p; + ee(a, m, "data-vc-date-disabled"), l && ee(l, m, "aria-disabled", "true"), l && m && ee(l, !0, "tabindex", "-1"), l && l.disabled !== !!m && (l.disabled = !!m), ee(a, !t.disableToday && t.context.dateToday === i, "data-vc-date-today"), ee(a, !t.disableToday && t.context.dateToday === i, "aria-current", "date"), ee(a, null == (c = t.selectedWeekends) ? void 0 : c.includes(o), "data-vc-date-weekend"), ee(a, u.holidays.has(i), "data-vc-date-holiday"); + let h = u.selected.set.has(i), v = h ? "" : void 0; + h ? (ee(a, !0, "aria-selected", "true"), t.context.selectedDates.length > 1 && "multiple-ranged" === t.selectionDatesMode && (t.context.selectedDates[0] === i && t.context.selectedDates[t.context.selectedDates.length - 1] === i ? v = "first-and-last" : t.context.selectedDates[0] === i ? v = "first" : t.context.selectedDates[t.context.selectedDates.length - 1] === i && (v = "last"), t.context.selectedDates[0] !== i && t.context.selectedDates[t.context.selectedDates.length - 1] !== i && (v = "middle"))) : a.hasAttribute("data-vc-date-selected") && a.removeAttribute("aria-selected"), !u.disabled.set.has(i) && t.enableEdgeDatesOnly && t.context.selectedDates.length > 1 && "multiple-ranged" === t.selectionDatesMode && (d > u.first && d < u.last ? v = "middle" : "middle" === v && (v = void 0)), void 0 === v ? a.hasAttribute("data-vc-date-selected") && a.removeAttribute("data-vc-date-selected") : ee(a, !0, "data-vc-date-selected", v); +}; +var ne = /* @__PURE__ */ new Map(); +var ae = /* @__PURE__ */ new Map(); +var le = (e, t, n) => { + var a, l; + let o = null == (a = e.disableWeekdays) ? void 0 : a.includes(n), i = e.disableAllDates && !(null == (l = e.context.enableDates) || !l[0]), s = r(e); + if ((o || i) && !s.enabled.set.has(t) && !s.disabled.set.has(t)) { + let n = e.context.disableDates; + if (s.disabled.set.add(t), e.onCreateDateEls) n.push(t), b(n), s.disabled.values = n.slice(); + else { + let e = +new Date(t), a = 0, l = n.length; + for (; a < l;) { + let t = a + l >>> 1; + +new Date(n[t]) <= e ? a = t + 1 : l = t; + } + n.splice(a, 0, t), s.disabled.values.splice(a, 0, t); + } + } +}; +var oe = (t, n, a, l, r, i) => { + var s; + let c, d = e(r).getDay(), m = "string" == typeof t.locale && t.locale.length ? t.locale : "en", p = document.createElement("div"); + p.className = t.styles.date, p.dataset.vcDate = r, p.dataset.vcDateMonth = i, p.dataset.vcDateWeekDay = String(d), p.role = "gridcell", ("current" === i || t.displayDatesOutside) && (c = document.createElement("button"), c.className = t.styles.dateBtn, c.type = "button", c.dataset.vcDateBtn = "", c.ariaLabel = ((e, t) => { + let n = `${t}:${e}`, a = ae.get(n); + if (void 0 !== a) return a; + let l = ne.get(t); + l || (l = new Intl.DateTimeFormat(t, { + dateStyle: "long", + timeZone: "UTC" + }), ne.size >= 8 && ne.delete(ne.keys().next().value), ne.set(t, l)); + let o = l.format(/* @__PURE__ */ new Date(`${e}T00:00:00.000Z`)); + return ae.size >= 512 && ae.delete(ae.keys().next().value), ae.set(n, o), o; + })(r, m), c.innerText = String(l), p.appendChild(c)), t.enableWeekNumbers && (null == (s = u(t).weeks) || s.date(t, p, r)), le(t, r, d), te(t, n, p, c, d, r, i), a.addDate(p), t.onCreateDateEls && (t.onCreateDateEls(t, p), o(t)); +}; +var re = [ + { + container: "[data-vc=\"dates\"]", + item: "[data-vc-date-btn]", + active: ["[data-vc-date-selected] [data-vc-date-btn]", "[data-vc-date-today] [data-vc-date-btn]"] + }, + { + container: "[data-vc=\"months\"]", + item: "[data-vc-months-month]", + active: ["[data-vc-months-month-selected]"] + }, + { + container: "[data-vc=\"years\"]", + item: "[data-vc-years-year]", + active: ["[data-vc-years-year-selected]"] + } +]; +var ie = (e) => !e.hasAttribute("disabled") && "true" !== e.getAttribute("aria-disabled"); +var se = (e, t, n) => { + if (n && ie(n)) return e.querySelectorAll(`${t.item}:not([tabindex="-1"])`).forEach((e) => { + e !== n && (e.tabIndex = -1); + }), void ("0" !== n.getAttribute("tabindex") && (n.tabIndex = 0)); + let a = Array.from(e.querySelectorAll(t.item)); + if (!a[0]) return; + let l = ((e, t, n) => { + var a; + let l = t.active.map((t) => e.querySelector(t)).find((e) => !!e && ie(e)); + return null == (a = null == l ? n.find(ie) : l) ? n[0] : a; + })(e, t, a); + a.forEach((e) => { + let t = e === l ? 0 : -1; + e.getAttribute("tabindex") !== String(t) && (e.tabIndex = t); + }); +}; +var ce = (e) => { + let t = e.target, n = re.find((e) => { + var n; + return null == (n = t.matches) ? void 0 : n.call(t, e.item); + }), a = n ? t.closest(n.container) : null; + n && a && se(a, n, t); +}; +var de = (e) => { + re.forEach((t) => { + e.context.mainElement.querySelectorAll(t.container).forEach((e) => { + e.closest("[data-vc-ghost]") || se(e, t, null); + }); + }); +}; +var ue = (e, n, a = !0) => { + var l; + U(e); + let r = new Date(e.context.selectedYear, e.context.selectedMonth, 1), i = e.context.mainElement.querySelectorAll("[data-vc=\"dates\"]"), s = u(e).weeks, c = e.enableWeekNumbers ? e.context.mainElement.querySelectorAll("[data-vc-week=\"numbers\"]") : [], d = null == (l = u(e).annotations) ? void 0 : l.prepare(e, i.length); + i.forEach((a, l) => { + e.selectionDatesMode || (a.dataset.vcDatesDisabled = ""); + let i = n ? 12 * e.context.selectedYear + e.context.selectedMonth + l - n.month : -1; + if (n && i >= 0 && i < n.count) return; + if (a.textContent = "", o(e), "week" === e.context.currentType) return s?.dates(e, a), d?.(a), void (null == s || s.numbers(e, 0, 7, c[l], a)); + let u = new Date(r); + u.setMonth(u.getMonth() + l); + let m = u.getMonth(), p = u.getFullYear(), h = (new Date(p, m, 1).getDay() - e.firstWeekday + 7) % 7, v = new Date(p, m + 1, 0).getDate(), y = h + v, g = Math.ceil(y / 7), f = 7 * g - y, x = []; + for (let t = 0; t < g; t++) { + let t = document.createElement("div"); + t.className = e.styles.datesRow, t.setAttribute("data-vc-dates", "row"), t.setAttribute("role", "row"), x.push(t); + } + let b = 0, D = 0, M = { addDate: (e) => { + x[b].appendChild(e), D++, D >= 7 && (b++, D = 0); + } }; + ((e, t, n, a, l) => { + let o = new Date(n, a, 0).getDate() - (l - 1), r = 0 === a ? n - 1 : n, i = 0 === a ? 12 : a < 10 ? `0${a}` : a; + for (let s = l; s > 0; s--, o++) oe(e, n, t, o, `${r}-${i}-${o}`, "prev"); + })(e, M, p, m, h), ((e, n, a, l, o) => { + for (let r = 1; r <= a; r++) { + let a = new Date(l, o, r); + oe(e, l, n, r, t(a), "current"); + } + })(e, M, v, p, m), ((e, t, n, a, l) => { + let o = l + 1 === 12 ? a + 1 : a, r = l + 1 === 12 ? "01" : l + 2 < 10 ? `0${l + 2}` : l + 2; + for (let i = 1; i <= n; i++) { + let n = `${o}-${r}-${i < 10 ? `0${i}` : String(i)}`; + oe(e, a, t, i, n, "next"); + } + })(e, M, f, p, m); + for (let e of x) a.appendChild(e); + d?.(a), s?.numbers(e, h, v, c[l], a); + }), de(e), a && Q(e, null == n ? void 0 : n.fullLayout); +}; +var me = (e, t) => `${R(e, "Years" === t ? "year" : void 0)}
\n
\n <#${t} />\n
\n
\n`; +var pe = (e) => me(e, "Months"); +var he = (e) => me(e, "Years"); +var ye = (e, t, n) => e.labels["arrow" + ("prev" === t ? "Prev" : "Next")][n]; +var ge = { + ArrowNext: (e, t) => ``, + 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 }; + diff --git a/assets/javascripts/bootstrap.bundle.min.js b/assets/javascripts/bootstrap.bundle.min.js new file mode 100644 index 00000000..cbd6468b --- /dev/null +++ b/assets/javascripts/bootstrap.bundle.min.js @@ -0,0 +1,8 @@ +/*! +* Bootstrap v6.0.0-alpha.1 (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) +*/ +const elementMap=new Map;var data_default={set(e,t,n){elementMap.has(e)||elementMap.set(e,new Map);const i=elementMap.get(e);i.has(t)||0===i.size?i.set(t,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${[...i.keys()][0]}.`)},get:(e,t)=>e&&elementMap.has(e)&&elementMap.get(e).get(t)||null,getAny:e=>e&&elementMap.has(e)&&elementMap.get(e).values().next().value||null,remove(e,t){if(!elementMap.has(e))return;const n=elementMap.get(e);n.delete(t),0===n.size&&elementMap.delete(e)}};const namespaceRegex=/[^.]*(?=\..*)\.|.*/,stripNameRegex=/\..*/,stripUidRegex=/::\d+$/,eventRegistry={};let uidEvent=1;const customEvents={mouseenter:"mouseover",mouseleave:"mouseout"},nativeEvents=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","input","paste","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","scrollend"]);function makeEventUid(e,t){return t&&`${t}::${uidEvent++}`||e.uidEvent||uidEvent++}function getElementEvents(e){const t=makeEventUid(e);return e.uidEvent=t,eventRegistry[t]=eventRegistry[t]||{},eventRegistry[t]}function isMouseEventWithinTarget(e){const{delegateTarget:t,relatedTarget:n}=e;return Boolean(n&&t.contains(n))}function bootstrapHandler(e,t,n){const i=n in customEvents;return function s(o){const a=hydrateObj(o,{delegateTarget:e});if(!i||!isMouseEventWithinTarget(a))return s.oneOff&&EventHandler.off(e,n,t),t.apply(e,[a])}}function bootstrapDelegationHandler(e,t,n,i){const s=i in customEvents;return function o(a){const l=e.querySelectorAll(t);for(let{target:r}=a;r&&r!==this;r=r.parentNode)for(const c of l){if(c!==r)continue;const l=hydrateObj(a,{delegateTarget:r});if(s&&isMouseEventWithinTarget(l))return;return o.oneOff&&EventHandler.off(e,i,t,n),n.apply(r,[l])}}}function findHandler(e,t,n,i=null){return Object.values(e).find(e=>e.callable===t&&e.handlerTypeEvent===n&&e.delegationSelector===i)}function normalizeParameters(e,t,n){const i="string"==typeof t,s=i?n:t||n,o=e.replace(stripNameRegex,"");let a=customEvents[o]||o;return nativeEvents.has(a)||(a=e),{isDelegated:i,callable:s,typeEvent:a,handlerTypeEvent:o in customEvents?o:a}}function addHandler(e,t,n,i,s){if("string"!=typeof t||!e)return;const{isDelegated:o,callable:a,typeEvent:l,handlerTypeEvent:r}=normalizeParameters(t,n,i),c=getElementEvents(e),u=c[l]||(c[l]={}),d=findHandler(u,a,r,o?n:null);if(d)return void(d.oneOff=d.oneOff&&s);const h=makeEventUid(a,t.replace(namespaceRegex,"")),_=o?bootstrapDelegationHandler(e,n,a,r):bootstrapHandler(e,a,r);_.delegationSelector=o?n:null,_.callable=a,_.handlerTypeEvent=r,_.oneOff=s,_.uidEvent=h,u[h]=_,e.addEventListener(l,_,o)}function removeHandler(e,t,n,i){e.removeEventListener(n,i,Boolean(i.delegationSelector)),delete t[n][i.uidEvent]}function removeNamespacedHandlers(e,t,n,i){const s=t[n]||{};for(const[o,a]of Object.entries(s))o.includes(i)&&removeHandler(e,t,n,a)}function trigger(e,t,n){if("string"!=typeof t||!e)return null;const i=hydrateObj(new Event(t,{bubbles:!0,cancelable:!0}),n);return e.dispatchEvent(i),i}const EventHandler={on(e,t,n,i){addHandler(e,t,n,i,!1)},one(e,t,n,i){addHandler(e,t,n,i,!0)},off(e,t,n,i){if("string"!=typeof t||!e)return;const{isDelegated:s,callable:o,typeEvent:a,handlerTypeEvent:l}=normalizeParameters(t,n,i),r=a!==t&&l!==t,c=getElementEvents(e),u=c[a]||{},d=t.startsWith(".");if(void 0!==o){if(!Object.keys(u).length)return;const t=findHandler(u,o,l,s?n:null);return void(t&&removeHandler(e,c,a,t))}if(d)for(const n of Object.keys(c))removeNamespacedHandlers(e,c,n,t.slice(1));for(const[n,i]of Object.entries(u)){const s=n.replace(stripUidRegex,"");i.handlerTypeEvent!==l||r&&!t.includes(s)||removeHandler(e,c,a,i)}},trigger:trigger};function hydrateObj(e,t={}){for(const[n,i]of Object.entries(t))try{e[n]=i}catch{Object.defineProperty(e,n,{configurable:!0,get:()=>i})}return e}function normalizeData(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch{return e}}function normalizeDataKey(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}const Manipulator={setDataAttribute(e,t,n){e.setAttribute(`data-bs-${normalizeDataKey(t)}`,n)},removeDataAttribute(e,t){e.removeAttribute(`data-bs-${normalizeDataKey(t)}`)},getDataAttributes(e){if(!e)return{};const t={},n=Object.keys(e.dataset).filter(e=>e.startsWith("bs")&&!e.startsWith("bsConfig"));for(const i of n){let n=i.replace(/^bs/,"");n=n.charAt(0).toLowerCase()+n.slice(1),t[n]=normalizeData(e.dataset[i])}return t},getDataAttribute:(e,t)=>normalizeData(e.getAttribute(`data-bs-${normalizeDataKey(t)}`))},MAX_UID=1e6,MILLISECONDS_MULTIPLIER=1e3,TRANSITION_END="transitionend",parseSelector=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,(e,t)=>`#${CSS.escape(t)}`)),e),toType=e=>null==e?`${e}`:Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(),getUID=e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e},getTransitionDurationFromElement=e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:n}=window.getComputedStyle(e);return Number.parseFloat(t)||Number.parseFloat(n)?(t=t.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(n))):0},triggerTransitionEnd=e=>{e.dispatchEvent(new Event(TRANSITION_END))},isElement$1=e=>!(!e||"object"!=typeof e)&&void 0!==e.nodeType,getElement=e=>isElement$1(e)?e:"string"==typeof e&&e.length>0?document.querySelector(parseSelector(e)):null,isVisible=e=>{if(!isElement$1(e)||0===e.getClientRects().length)return!1;const t="visible"===getComputedStyle(e).getPropertyValue("visibility"),n=e.closest("details:not([open])");if(!n)return t;if(n!==e){const t=e.closest("summary");if(t&&t.parentNode!==n)return!1;if(null===t)return!1}return t},isDisabled=e=>{if(!e||e.nodeType!==Node.ELEMENT_NODE)return!0;if(e.classList.contains("disabled"))return!0;const t=e;return void 0!==t.disabled?t.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled")},setAriaAttribute=(e,t,n)=>{e.setAttribute(t,String(n))},findShadowRoot=e=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?findShadowRoot(e.parentNode):null},noop=()=>{},isRTL$1=()=>"rtl"===document.documentElement.dir,execute=(e,t=[],n=e)=>"function"==typeof e?e.call(...t):n,executeAfterTransition=(e,t,n=!0)=>{if(!n)return void execute(e);const i=getTransitionDurationFromElement(t)+5;let s=!1;const o=({target:n})=>{n===t&&(s=!0,t.removeEventListener(TRANSITION_END,o),execute(e))};t.addEventListener(TRANSITION_END,o),setTimeout(()=>{s||triggerTransitionEnd(t)},i)},getNextActiveElement=(e,t,n,i)=>{const s=e.length;let o=e.indexOf(t);return-1===o?!n&&i?e[s-1]:e[0]:(o+=n?1:-1,i&&(o=(o+s)%s),e[Math.max(0,Math.min(o,s-1))])};var Config=class{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(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const n=isElement$1(t)?Manipulator.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof n?n:{},...isElement$1(t)?Manipulator.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e,t=this.constructor.DefaultType){for(const[n,i]of Object.entries(t)){const t=e[n],s=isElement$1(t)?"element":toType(t);if(!new RegExp(i).test(s))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${s}" but expected type "${i}".`)}}};const VERSION="6.0.0-alpha.1";var BaseComponent=class extends Config{constructor(e,t){if(super(),!(e=getElement(e)))return;this._element=e,this._config=this._getConfig(t);const n=data_default.get(this._element,this.constructor.DATA_KEY);n&&n.dispose(),data_default.set(this._element,this.constructor.DATA_KEY,this)}dispose(){data_default.remove(this._element,this.constructor.DATA_KEY),EventHandler.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t,n=!0){return new Promise(i=>{executeAfterTransition(()=>{this._element&&e(),i()},t,n)})}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return data_default.get(getElement(e),this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return VERSION}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}};const getSelector=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let n=e.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n=`#${n.split("#")[1]}`),t=n&&"#"!==n?n.trim():null}return t?t.split(",").map(e=>parseSelector(e)).join(","):null},SelectorEngine={find:(e,t=document.documentElement)=>[...Element.prototype.querySelectorAll.call(t,e)],findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),parents(e,t){const n=[];let i=e.parentNode.closest(t);for(;i;)n.push(i),i=i.parentNode.closest(t);return n},closest:(e,t)=>Element.prototype.closest.call(e,t),prev(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return[n];n=n.previousElementSibling}return[]},next(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return[n];n=n.nextElementSibling}return[]},getSelectorFromElement(e){const t=getSelector(e);return t&&SelectorEngine.findOne(t)?t:null},getElementFromSelector(e){const t=getSelector(e);return t?SelectorEngine.findOne(t):null},getMultipleElementsFromSelector(e){const t=getSelector(e);return t?SelectorEngine.find(t):[]}},enableDismissTrigger=(e,t="hide")=>{const n=`click.dismiss${e.EVENT_KEY}`,i=e.NAME;EventHandler.on(document,n,`[data-bs-dismiss="${i}"]`,function(n){if(["A","AREA"].includes(this.tagName)&&n.preventDefault(),isDisabled(this))return;const s=SelectorEngine.getElementFromSelector(this)||this.closest(`.${i}, [class*=":${i}"]`);e.getOrCreateInstance(s)[t]()})},eventActionOnPlugin=(e,t,n,i,s=null)=>{eventAction(`${t}.${e.NAME}`,n,t=>{const n=t.targets.filter(Boolean).map(t=>e.getOrCreateInstance(t));"function"==typeof s&&s({...t,instances:n});for(const e of n)e[i]()})},eventAction=(e,t,n)=>{const i=`${t}:not(.disabled):not(:disabled)`;EventHandler.on(document,e,i,function(e){["A","AREA"].includes(this.tagName)&&e.preventDefault();const t=SelectorEngine.getSelectorFromElement(this);n({targets:t?SelectorEngine.find(t):[this],event:e})})},NAME$21="alert",EVENT_KEY$18=".bs.alert",EVENT_CLOSE="close.bs.alert",EVENT_CLOSED="closed.bs.alert",CLASS_NAME_HIDING="hiding",CLASS_NAME_SHOW$7="show";var Alert=class extends BaseComponent{static get NAME(){return"alert"}async close(){if(EventHandler.trigger(this._element,EVENT_CLOSE).defaultPrevented)return;this._element.classList.remove("show"),this._element.classList.add("hiding");const e=getTransitionDurationFromElement(this._element)>0;await this._queueCallback(()=>this._destroyElement(),this._element,e)}_destroyElement(){this._element.remove(),EventHandler.trigger(this._element,EVENT_CLOSED),this.dispose()}};enableDismissTrigger(Alert,"close");const NAME$20="button",EVENT_KEY$17=".bs.button",DATA_API_KEY$12=".data-api",CLASS_NAME_ACTIVE$4="active",SELECTOR_DATA_TOGGLE$10='[data-bs-toggle="button"]',EVENT_CLICK_DATA_API$8="click.bs.button.data-api",EVENT_DOM_CONTENT_LOADED$1="DOMContentLoaded.bs.button.data-api";var Button=class extends BaseComponent{static get NAME(){return NAME$20}toggle(){setAriaAttribute(this._element,"aria-pressed",this._element.classList.toggle("active"))}};EventHandler.on(document,EVENT_CLICK_DATA_API$8,SELECTOR_DATA_TOGGLE$10,e=>{e.preventDefault();const t=e.target.closest(SELECTOR_DATA_TOGGLE$10);Button.getOrCreateInstance(t).toggle()}),EventHandler.on(document,EVENT_DOM_CONTENT_LOADED$1,()=>{for(const e of SelectorEngine.find(SELECTOR_DATA_TOGGLE$10))e.hasAttribute("aria-pressed")||setAriaAttribute(e,"aria-pressed",e.classList.contains("active"))});const NAME$19="carousel",EVENT_KEY$16=".bs.carousel",DATA_API_KEY$11=".data-api",ARROW_LEFT_KEY$2="ArrowLeft",ARROW_RIGHT_KEY$2="ArrowRight",DIRECTION_LEFT="left",DIRECTION_RIGHT="right",EVENT_SLIDE=`slide${EVENT_KEY$16}`,EVENT_SLID=`slid${EVENT_KEY$16}`,EVENT_KEYDOWN$2=`keydown${EVENT_KEY$16}`,EVENT_MOUSEENTER$2=`mouseenter${EVENT_KEY$16}`,EVENT_MOUSELEAVE$1=`mouseleave${EVENT_KEY$16}`,EVENT_POINTERDOWN$3=`pointerdown${EVENT_KEY$16}`,EVENT_LOAD_DATA_API$3=`load${EVENT_KEY$16}.data-api`,EVENT_CLICK_DATA_API$7=`click${EVENT_KEY$16}.data-api`,CLASS_NAME_CAROUSEL="carousel",CLASS_NAME_ACTIVE$3="active",CLASS_NAME_FADE="carousel-fade",CLASS_NAME_CENTER="carousel-center",CLASS_NAME_AUTO="carousel-auto",CLASS_NAME_CLONE="carousel-item-clone",CLASS_NAME_PAUSED="paused",CLASS_NAME_PLAYING="carousel-playing",PROPERTY_INTERVAL="--bs-carousel-interval",SCROLL_DURATION=300,ACTIVE_RATIO_TOLERANCE=.05,SELECTOR_ACTIVE=".active",SELECTOR_ITEM=`.carousel-item:not(.${CLASS_NAME_CLONE})`,SELECTOR_ACTIVE_ITEM=".active"+SELECTOR_ITEM,SELECTOR_INNER$1=".carousel-inner",SELECTOR_INDICATORS=".carousel-indicators",SELECTOR_PLAY_PAUSE=".carousel-control-play-pause",SELECTOR_DATA_SLIDE="[data-bs-slide], [data-bs-slide-to]",SELECTOR_DATA_SLIDE_PREV='[data-bs-slide="prev"]',SELECTOR_DATA_SLIDE_NEXT='[data-bs-slide="next"]',SELECTOR_DATA_AUTOPLAY='[data-bs-autoplay="true"]',KEY_TO_DIRECTION={[ARROW_LEFT_KEY$2]:"right",[ARROW_RIGHT_KEY$2]:"left"},ENDS_STOP="stop",ENDS_WRAP="wrap",ENDS_LOOP="loop",Default$18={autoplay:!1,ends:ENDS_LOOP,interval:5e3,keyboard:!0,pause:"hover"},DefaultType$18={autoplay:"boolean",ends:"string",interval:"number",keyboard:"boolean",pause:"(string|boolean)"},easeInOutCubic=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;var Carousel=class extends BaseComponent{constructor(e,t){super(e,t),this._viewport=SelectorEngine.findOne(SELECTOR_INNER$1,this._element)||this._element,this._indicatorsElement=SelectorEngine.findOne(SELECTOR_INDICATORS,this._element),this._playPauseElement=SelectorEngine.findOne(SELECTOR_PLAY_PAUSE,this._element),this._prevControls=SelectorEngine.find('[data-bs-slide="prev"]',this._element),this._nextControls=SelectorEngine.find('[data-bs-slide="next"]',this._element),this._interval=null,this._observer=null,this._scrollFrame=null,this._looping=!1,this._visibility=new Map,this._playing=this._config.autoplay,this._activeIndex=this._initialActiveIndex(),this._addEventListeners(),this._observeItems(),this._refreshActiveState(),this._playing&&this.cycle(),this._updatePlayPauseControl()}static get Default(){return Default$18}static get DefaultType(){return DefaultType$18}static get NAME(){return NAME$19}next(){this.to(this._navIndex()+1)}nextWhenVisible(){"visible"===document.visibilityState&&isVisible(this._element)&&this.next()}prev(){this.to(this._navIndex()-1)}pause(){this._clearInterval(),this._element.classList.remove("carousel-playing")}cycle(){this._clearInterval(),this._scheduleAutoplay(),this._element.classList.add("carousel-playing")}to(e){if(this._looping)return;const t=this._getItems(),n=Number.parseInt(e,10);if(this._config.ends===ENDS_LOOP&&!this._prefersReducedMotion()&&this._canLoop()){if(n>t.length-1)return void this._loopTransition(!0);if(n<0)return void this._loopTransition(!1)}const i=this._normalizeIndex(n,t.length),s=this._navIndex();null!==i&&i!==s&&(EventHandler.trigger(this._element,EVENT_SLIDE,{relatedTarget:t[i],direction:this._direction(s,i),from:s,to:i}).defaultPrevented||(this._isFade()?this._fadeTo(i):this._scrollToIndex(i)))}dispose(){this._clearInterval(),this._observer&&this._observer.disconnect(),null!==this._scrollFrame&&cancelAnimationFrame(this._scrollFrame);for(const e of SelectorEngine.find(`.${CLASS_NAME_CLONE}`,this._viewport))e.remove();this._viewport.style.scrollSnapType="",EventHandler.off(this._viewport,EVENT_KEY$16),super.dispose()}_configAfterMerge(e){return[ENDS_STOP,ENDS_WRAP,ENDS_LOOP].includes(e.ends)||(e.ends=Default$18.ends),e}_initialActiveIndex(){const e=SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM,this._element),t=e?this._getItems().indexOf(e):0;return Math.max(t,0)}_addEventListeners(){this._config.keyboard&&EventHandler.on(this._element,EVENT_KEYDOWN$2,e=>this._keydown(e)),"hover"===this._config.pause&&(EventHandler.on(this._element,EVENT_MOUSEENTER$2,()=>this.pause()),EventHandler.on(this._element,EVENT_MOUSELEAVE$1,()=>this._maybeEnableCycle())),EventHandler.on(this._viewport,EVENT_POINTERDOWN$3,()=>this._pauseFromInteraction())}_keydown(e){if(/input|textarea/i.test(e.target.tagName))return;const t=KEY_TO_DIRECTION[e.key];t&&(e.preventDefault(),this._pauseFromInteraction(),"right"===t?this.prev():this.next())}_observeItems(){if(!this._isFade()&&"undefined"!=typeof IntersectionObserver){this._observer=new IntersectionObserver(e=>this._handleIntersection(e),{root:this._viewport,threshold:[0,.25,.5,.75,1]});for(const e of this._getItems())this._observer.observe(e)}}_handleIntersection(e){if(this._looping)return;for(const t of e)this._visibility.set(t.target,t.isIntersecting?t.intersectionRatio:0);const t=this._getItems().map(e=>this._visibility.get(e)??0),n=Math.max(...t);let i=this._activeIndex;n>0&&(i=t.findIndex(e=>e>=n-.05)),this._setActive(i),this._updateEndControls()}_navIndex(){if(this._isFade()||this._viewport.scrollWidth-this._viewport.clientWidth<=0)return this._activeIndex;let e=this._activeIndex,t=Number.POSITIVE_INFINITY;for(const[n,i]of this._getItems().entries()){const s=Math.abs(this._scrollDelta(i));s{this._viewport.style.scrollSnapType="",this._observer||this._setActive(e),this._updateEndControls()})}_animateScroll(e,t){null!==this._scrollFrame&&(cancelAnimationFrame(this._scrollFrame),this._scrollFrame=null);const n=this._viewport.scrollLeft,i=e-n;if(this._prefersReducedMotion()||"undefined"==typeof requestAnimationFrame)return this._viewport.scrollTo({left:e,behavior:"instant"}),void t();let s=null;const o=a=>{null===s&&(s=a);const l=Math.min((a-s)/300,1);this._viewport.scrollTo({left:n+i*easeInOutCubic(l),behavior:"instant"}),l<1?this._scrollFrame=requestAnimationFrame(o):(this._viewport.scrollTo({left:e,behavior:"instant"}),this._scrollFrame=null,t())};this._scrollFrame=requestAnimationFrame(o)}_scrollDelta(e){const t=this._viewport.getBoundingClientRect(),n=e.getBoundingClientRect();if(this._element.classList.contains("carousel-center"))return n.left+n.width/2-(t.left+t.width/2);const i=Number.parseFloat(getComputedStyle(this._viewport).scrollPaddingInlineStart)||0;return isRTL$1()?n.right-(t.right-i):n.left-(t.left+i)}_loopTransition(e){const t=this._getItems(),n=t.length-1,i=this._activeIndex,s=e?0:n,o=this._loopDirection(e);if(EventHandler.trigger(this._element,EVENT_SLIDE,{relatedTarget:t[s],direction:o,from:i,to:s}).defaultPrevented)return;this._looping=!0;const a=(e?t[0]:t[n]).cloneNode(!0);a.classList.add(CLASS_NAME_CLONE),a.classList.remove("active"),a.removeAttribute("id");for(const e of SelectorEngine.find("[id]",a))e.removeAttribute("id");a.setAttribute("aria-hidden","true"),a.inert=!0,this._viewport.style.scrollSnapType="none",e?this._viewport.append(a):(this._viewport.prepend(a),this._jumpScroll(this._scrollDelta(t[i]))),this._animateScroll(this._viewport.scrollLeft+this._scrollDelta(a),()=>{a.remove(),this._jumpScroll(this._scrollDelta(t[s])),this._activeIndex=s,this._refreshActiveState(),EventHandler.trigger(this._element,EVENT_SLID,{relatedTarget:t[s],direction:o,from:i,to:s}),this._viewport.style.scrollSnapType="",this._looping=!1})}_loopDirection(e){return isRTL$1()?e?"right":"left":e?"left":"right"}_jumpScroll(e){this._viewport.style.scrollSnapType="none",this._viewport.scrollBy({left:e,top:0,behavior:"instant"})}_fadeTo(e){this._setActive(e)}_setActive(e){const t=this._getItems();if(e===this._activeIndex||!t[e])return;const n=this._activeIndex;this._activeIndex=e,this._refreshActiveState(),EventHandler.trigger(this._element,EVENT_SLID,{relatedTarget:t[e],direction:this._direction(n,e),from:n,to:e})}_refreshActiveState(){const e=this._getItems();for(const[t,n]of e.entries())n.classList.toggle("active",t===this._activeIndex);this._setActiveIndicatorElement(this._activeIndex),this._updateEndControls()}_updateEndControls(){if(this._config.ends!==ENDS_STOP)return;const e=this._viewport,t=e.scrollWidth-e.clientWidth;let n,i;if(t>0){const s=Math.abs(e.scrollLeft);n=s<=1,i=s>=t-1}else{const e=this._getItems().length-1;n=this._activeIndex<=0,i=this._activeIndex>=e}this._setControlsDisabled(this._prevControls,n),this._setControlsDisabled(this._nextControls,i)}_setControlsDisabled(e,t){for(const n of e)t&&n===document.activeElement&&((e===this._prevControls?this._nextControls:this._prevControls)[0]??this._viewport).focus({preventScroll:!0}),n.disabled=t}_setActiveIndicatorElement(e){if(!this._indicatorsElement)return;const t=SelectorEngine.findOne(".active",this._indicatorsElement);t&&(t.classList.remove("active"),t.removeAttribute("aria-current"));const n=SelectorEngine.findOne(`[data-bs-slide-to="${e}"]`,this._indicatorsElement);n&&(n.classList.add("active"),n.setAttribute("aria-current","true"))}_normalizeIndex(e,t){return Number.isNaN(e)||0===t?null:e<0?this._wrapsAround()?t-1:null:e>t-1?this._wrapsAround()?0:null:e}_wrapsAround(){return this._config.ends===ENDS_WRAP||this._config.ends===ENDS_LOOP}_canLoop(){if(this._isFade()||this._getItems().length<2)return!1;const e=getComputedStyle(this._element),t=t=>Number.parseFloat(e.getPropertyValue(t))||0;return 1===(t("--bs-carousel-items")||1)&&0===t("--bs-carousel-items-peek")&&!this._element.classList.contains("carousel-center")&&!this._element.classList.contains("carousel-auto")}_direction(e,t){const n=t>e;return isRTL$1()?n?"right":"left":n?"left":"right"}_scheduleAutoplay(e=this._activeIndex){const t=this._itemInterval(e);this._element.style.setProperty(PROPERTY_INTERVAL,`${t}ms`),this._interval=setTimeout(()=>{const e=this._upcomingIndex();this.nextWhenVisible(),null!==e?this._scheduleAutoplay(e):this.pause()},t)}_upcomingIndex(){return this._normalizeIndex(this._navIndex()+1,this._getItems().length)}_itemInterval(e=this._activeIndex){const t=this._getItems()[e],n=t?Number.parseInt(t.getAttribute("data-bs-interval"),10):NaN;return Number.isNaN(n)?this._config.interval:n}_maybeEnableCycle(){this._playing&&this.cycle()}_pauseFromInteraction(){this._playing=!1,this.pause(),this._updatePlayPauseControl()}_togglePlayPause(){this._playing?this._pauseFromInteraction():(this._playing=!0,this.cycle(),this._updatePlayPauseControl())}_updatePlayPauseControl(){if(!this._playPauseElement)return;this._playPauseElement.classList.toggle("paused",!this._playing);const e=this._playPauseElement.getAttribute(this._playing?"data-bs-pause-label":"data-bs-play-label");e&&this._playPauseElement.setAttribute("aria-label",e)}_isFade(){return this._element.classList.contains("carousel-fade")}_prefersReducedMotion(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}_getItems(){return SelectorEngine.find(SELECTOR_ITEM,this._element)}_clearInterval(){this._interval&&(clearTimeout(this._interval),this._interval=null)}};EventHandler.on(document,EVENT_CLICK_DATA_API$7,SELECTOR_DATA_SLIDE,function(e){const t=SelectorEngine.getElementFromSelector(this);if(!t||!t.classList.contains("carousel"))return;e.preventDefault();const n=Carousel.getOrCreateInstance(t);n._pauseFromInteraction();const i=this.getAttribute("data-bs-slide-to");i?n.to(i):"next"!==Manipulator.getDataAttribute(this,"slide")?n.prev():n.next()}),EventHandler.on(document,EVENT_CLICK_DATA_API$7,SELECTOR_PLAY_PAUSE,function(e){const t=SelectorEngine.getElementFromSelector(this);t&&t.classList.contains("carousel")&&(e.preventDefault(),Carousel.getOrCreateInstance(t)._togglePlayPause())}),EventHandler.on(window,EVENT_LOAD_DATA_API$3,()=>{const e=SelectorEngine.find(SELECTOR_DATA_AUTOPLAY);for(const t of e)Carousel.getOrCreateInstance(t)});const NAME$18="collapse",EVENT_KEY$15=".bs.collapse",DATA_API_KEY$10=".data-api",EVENT_SHOW$7=`show${EVENT_KEY$15}`,EVENT_SHOWN$6=`shown${EVENT_KEY$15}`,EVENT_HIDE$6=`hide${EVENT_KEY$15}`,EVENT_HIDDEN$8=`hidden${EVENT_KEY$15}`,EVENT_CLICK_DATA_API$6=`click${EVENT_KEY$15}.data-api`,CLASS_NAME_SHOW$6="show",CLASS_NAME_COLLAPSE="collapse",CLASS_NAME_DEEPER_CHILDREN=":scope .collapse .collapse",SELECTOR_ACTIVES=".collapse.show",SELECTOR_DATA_TOGGLE$9='[data-bs-toggle="collapse"]',Default$17={parent:null},DefaultType$17={parent:"(null|element)"};var Collapse=class e extends BaseComponent{constructor(e,t){super(e,t),this._isTransitioning=!1,this._triggerArray=[];const n=SelectorEngine.find(SELECTOR_DATA_TOGGLE$9);for(const e of n){const t=SelectorEngine.getSelectorFromElement(e),n=SelectorEngine.find(t).filter(e=>e===this._element);null!==t&&n.length&&this._triggerArray.push(e)}this._initializeChildren(),this._config.parent||this._setAriaExpanded(this._triggerArray,this._isShown())}static get Default(){return Default$17}static get DefaultType(){return DefaultType$17}static get NAME(){return NAME$18}toggle(){return this._isShown()?this.hide():this.show()}async show(){if(this._isTransitioning||this._isShown())return;let t=[];if(!(this._config.parent&&(t=this._getFirstLevelChildren(".collapse.show").filter(e=>e!==this._element&&!this._sharesTrigger(e)).map(t=>e.getOrCreateInstance(t))),t.length&&t[0]._isTransitioning||EventHandler.trigger(this._element,EVENT_SHOW$7).defaultPrevented)){for(const e of t)e.hide();this._element.classList.add("show"),this._setAriaExpanded(this._triggerArray,!0),this._isTransitioning=!0,await this._queueCallback(()=>{this._isTransitioning=!1,EventHandler.trigger(this._element,EVENT_SHOWN$6)},this._element,this._isAnimated())}}async hide(){if(!this._isTransitioning&&this._isShown()&&!EventHandler.trigger(this._element,EVENT_HIDE$6).defaultPrevented){this._element.classList.remove("show");for(const e of this._triggerArray){const t=SelectorEngine.getElementFromSelector(e);t&&!this._isShown(t)&&this._setAriaExpanded([e],!1)}this._isTransitioning=!0,await this._queueCallback(()=>{this._isTransitioning=!1,EventHandler.trigger(this._element,EVENT_HIDDEN$8)},this._element,this._isAnimated())}}_isShown(e=this._element){return e.classList.contains("show")}_isAnimated(){return getTransitionDurationFromElement(this._element)>0}_sharesTrigger(e){return this._triggerArray.some(t=>SelectorEngine.getMultipleElementsFromSelector(t).includes(e))}_configAfterMerge(e){return e.parent=getElement(e.parent),e}_initializeChildren(){if(!this._config.parent)return;const e=this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$9);for(const t of e){const e=SelectorEngine.getElementFromSelector(t);e&&this._setAriaExpanded([t],this._isShown(e))}}_getFirstLevelChildren(e){const t=SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN,this._config.parent);return SelectorEngine.find(e,this._config.parent).filter(e=>!t.includes(e))}_setAriaExpanded(e,t){if(e.length)for(const n of e)setAriaAttribute(n,"aria-expanded",t)}};EventHandler.on(document,EVENT_CLICK_DATA_API$6,SELECTOR_DATA_TOGGLE$9,function(e){("A"===e.target.tagName||e.delegateTarget&&"A"===e.delegateTarget.tagName)&&e.preventDefault();for(const e of SelectorEngine.getMultipleElementsFromSelector(this))Collapse.getOrCreateInstance(e).toggle()});const min=Math.min,max=Math.max,round=Math.round,floor=Math.floor,createCoords=e=>({x:e,y:e}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"};function clamp(e,t,n){return max(e,min(t,n))}function evaluate(e,t){return"function"==typeof e?e(t):e}function getSide(e){return e.split("-")[0]}function getAlignment(e){return e.split("-")[1]}function getOppositeAxis(e){return"x"===e?"y":"x"}function getAxisLength(e){return"y"===e?"height":"width"}function getSideAxis(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function getAlignmentAxis(e){return getOppositeAxis(getSideAxis(e))}function getAlignmentSides(e,t,n){void 0===n&&(n=!1);const i=getAlignment(e),s=getAlignmentAxis(e),o=getAxisLength(s);let a="x"===s?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=getOppositePlacement(a)),[a,getOppositePlacement(a)]}function getExpandedPlacements(e){const t=getOppositePlacement(e);return[getOppositeAlignmentPlacement(e),t,getOppositeAlignmentPlacement(t)]}function getOppositeAlignmentPlacement(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const lrPlacement=["left","right"],rlPlacement=["right","left"],tbPlacement=["top","bottom"],btPlacement=["bottom","top"];function getSideList(e,t,n){switch(e){case"top":case"bottom":return n?t?rlPlacement:lrPlacement:t?lrPlacement:rlPlacement;case"left":case"right":return t?tbPlacement:btPlacement;default:return[]}}function getOppositeAxisPlacements(e,t,n,i){const s=getAlignment(e);let o=getSideList(getSide(e),"start"===n,i);return s&&(o=o.map(e=>e+"-"+s),t&&(o=o.concat(o.map(getOppositeAlignmentPlacement)))),o}function getOppositePlacement(e){const t=getSide(e);return oppositeSideMap[t]+e.slice(t.length)}function expandPaddingObject(e){var t,n,i,s;return{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(i=e.bottom)?i:0,left:null!=(s=e.left)?s:0}}function getPaddingObject(e){return"number"!=typeof e?expandPaddingObject(e):{top:e,right:e,bottom:e,left:e}}function rectToClientRect(e){const{x:t,y:n,width:i,height:s}=e;return{width:i,height:s,top:n,left:t,right:t+i,bottom:n+s,x:t,y:n}}function computeCoordsFromPlacement(e,t,n){let{reference:i,floating:s}=e;const o=getSideAxis(t),a=getAlignmentAxis(t),l=getAxisLength(a),r=getSide(t),c="y"===o,u=i.x+i.width/2-s.width/2,d=i.y+i.height/2-s.height/2,h=i[l]/2-s[l]/2;let _;switch(r){case"top":_={x:u,y:i.y-s.height};break;case"bottom":_={x:u,y:i.y+i.height};break;case"right":_={x:i.x+i.width,y:d};break;case"left":_={x:i.x-s.width,y:d};break;default:_={x:i.x,y:i.y}}const m=getAlignment(t);return m&&(_[a]+=h*("end"===m?1:-1)*(n&&c?-1:1)),_}async function detectOverflow(e,t){var n;void 0===t&&(t={});const{x:i,y:s,platform:o,rects:a,elements:l,strategy:r}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:_=0}=evaluate(t,e),m=getPaddingObject(_),g=l[h?"floating"===d?"reference":"floating":d],p=rectToClientRect(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(g)))||n?g:g.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:r})),E="floating"===d?{x:i,y:s,width:a.floating.width,height:a.floating.height}:a.reference,f=await(null==o.getOffsetParent?void 0:o.getOffsetParent(l.floating)),v=await(null==o.isElement?void 0:o.isElement(f))&&await(null==o.getScale?void 0:o.getScale(f))||{x:1,y:1},T=rectToClientRect(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:E,offsetParent:f,strategy:r}):E);return{top:(p.top-T.top+m.top)/v.y,bottom:(T.bottom-p.bottom+m.bottom)/v.y,left:(p.left-T.left+m.left)/v.x,right:(T.right-p.right+m.right)/v.x}}const MAX_RESET_COUNT=50,computePosition$1=async(e,t,n)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:detectOverflow},r=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=computeCoordsFromPlacement(c,i,r),h=i,_=0;const m={};for(let n=0;n({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:s,rects:o,platform:a,elements:l,middlewareData:r}=t,{element:c,padding:u=0}=evaluate(e,t)||{};if(null==c)return{};const d=getPaddingObject(u),h={x:n,y:i},_=getAlignmentAxis(s),m=getAxisLength(_),g=await a.getDimensions(c),p="y"===_,E=p?"top":"left",f=p?"bottom":"right",v=p?"clientHeight":"clientWidth",T=o.reference[m]+o.reference[_]-h[_]-o.floating[m],b=h[_]-o.reference[_],y=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let A=y?y[v]:0;A&&await(null==a.isElement?void 0:a.isElement(y))||(A=l.floating[v]||o.floating[m]);const S=T/2-b/2,N=A/2-g[m]/2-1,w=min(d[E],N),C=min(d[f],N),D=A-g[m]-C,x=A/2-g[m]/2+S,O=clamp(w,x,D),L=!r.arrow&&null!=getAlignment(s)&&x!==O&&o.reference[m]/2-(xe<=0)){var C,D;const e=((null==(C=o.flip)?void 0:C.index)||0)+1,t=A[e];if(t&&("alignment"!==d||f===getSideAxis(t)||w.every(e=>getSideAxis(e.placement)!==f||e.overflows[0]>0)))return{data:{index:e,overflows:w},reset:{placement:t}};let n=null==(D=w.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:D.placement;if(!n)switch(_){case"bestFit":{var x;const e=null==(x=w.filter(e=>{if(y){const t=getSideAxis(e.placement);return t===f||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:x[0];e&&(n=e);break}case"initialPlacement":n=l}if(s!==n)return{reset:{placement:n}}}return{}}}},originSides=new Set(["left","top"]);async function convertValueToCoords(e,t){const{placement:n,platform:i,elements:s}=e,o=await(null==i.isRTL?void 0:i.isRTL(s.floating)),a=getSide(n),l=getAlignment(n),r="y"===getSideAxis(n),c=originSides.has(a)?-1:1,u=o&&r?-1:1,d=evaluate(t,e);let{mainAxis:h,crossAxis:_,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&"number"==typeof m&&(_="end"===l?-1*m:m),r?{x:_*u,y:h*c}:{x:h*c,y:_*u}}const offset$1=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:s,y:o,placement:a,middlewareData:l}=t,r=await convertValueToCoords(t,e);return a===(null==(n=l.offset)?void 0:n.placement)&&null!=(i=l.arrow)&&i.alignmentOffset?{}:{x:s+r.x,y:o+r.y,data:{...r,placement:a}}}}},shift$1=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:s,platform:o}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:r={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=evaluate(e,t),u={x:n,y:i},d=await o.detectOverflow(t,c),h=getSideAxis(s),_=getOppositeAxis(h);let m=u[_],g=u[h];const p=(e,t)=>clamp(t+d["y"===e?"top":"left"],t,t-d["y"===e?"bottom":"right"]);a&&(m=p(_,m)),l&&(g=p(h,g));const E=r.fn({...t,[_]:m,[h]:g});return{...E,data:{x:E.x-n,y:E.y-i,enabled:{[_]:a,[h]:l}}}}}};function hasWindow(){return"undefined"!=typeof window}function getNodeName(e){return isNode(e)?(e.nodeName||"").toLowerCase():"#document"}function getWindow(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(e){var t;return null==(t=(isNode(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function isNode(e){return!!hasWindow()&&(e instanceof Node||e instanceof getWindow(e).Node)}function isElement(e){return!!hasWindow()&&(e instanceof Element||e instanceof getWindow(e).Element)}function isHTMLElement(e){return!!hasWindow()&&(e instanceof HTMLElement||e instanceof getWindow(e).HTMLElement)}function isShadowRoot(e){return!(!hasWindow()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof getWindow(e).ShadowRoot)}function isOverflowElement(e){const{overflow:t,overflowX:n,overflowY:i,display:s}=getComputedStyle$1(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&"inline"!==s&&"contents"!==s}function isTableElement(e){return/^(table|td|th)$/.test(getNodeName(e))}function isTopLayer(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const willChangeRe=/transform|translate|scale|rotate|perspective|filter/,containRe=/paint|layout|strict|content/,isNotNone=e=>!!e&&"none"!==e;let isWebKitValue;function isContainingBlock(e){const t=isElement(e)?getComputedStyle$1(e):e;return isNotNone(t.transform)||isNotNone(t.translate)||isNotNone(t.scale)||isNotNone(t.rotate)||isNotNone(t.perspective)||!isWebKit()&&(isNotNone(t.backdropFilter)||isNotNone(t.filter))||willChangeRe.test(t.willChange||"")||containRe.test(t.contain||"")}function getContainingBlock(e){let t=getParentNode(e);for(;isHTMLElement(t)&&!isLastTraversableNode(t);){if(isContainingBlock(t))return t;if(isTopLayer(t))return null;t=getParentNode(t)}return null}function isWebKit(){return null==isWebKitValue&&(isWebKitValue="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),isWebKitValue}function isLastTraversableNode(e){return/^(html|body|#document)$/.test(getNodeName(e))}function getComputedStyle$1(e){return getWindow(e).getComputedStyle(e)}function getNodeScroll(e){return isElement(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function getParentNode(e){if("html"===getNodeName(e))return e;const t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){const t=getParentNode(e);return isLastTraversableNode(t)?(e.ownerDocument||e).body:isHTMLElement(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,n){var i;void 0===t&&(t=[]),void 0===n&&(n=!0);const s=getNearestOverflowAncestor(e),o=s===(null==(i=e.ownerDocument)?void 0:i.body),a=getWindow(s);if(o){const e=getFrameElement(a);return t.concat(a,a.visualViewport||[],isOverflowElement(s)?s:[],e&&n?getOverflowAncestors(e):[])}return t.concat(s,getOverflowAncestors(s,[],n))}function getFrameElement(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function getCssDimensions(e){const t=getComputedStyle$1(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const s=isHTMLElement(e),o=s?e.offsetWidth:n,a=s?e.offsetHeight:i,l=round(n)!==o||round(i)!==a;return l&&(n=o,i=a),{width:n,height:i,$:l}}function unwrapElement(e){return isElement(e)?e:e.contextElement}function getScale(e){const t=unwrapElement(e);if(!isHTMLElement(t))return createCoords(1);const n=t.getBoundingClientRect(),{width:i,height:s,$:o}=getCssDimensions(t);let a=(o?round(n.width):n.width)/i,l=(o?round(n.height):n.height)/s;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const noOffsets=createCoords(0);function getVisualOffsets(e){const t=getWindow(e);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:noOffsets}function shouldAddVisualOffsets(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==getWindow(e))&&t}function getBoundingClientRect(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);const s=e.getBoundingClientRect(),o=unwrapElement(e);let a=createCoords(1);t&&(i?isElement(i)&&(a=getScale(i)):a=getScale(e));const l=shouldAddVisualOffsets(o,n,i)?getVisualOffsets(o):createCoords(0);let r=(s.left+l.x)/a.x,c=(s.top+l.y)/a.y,u=s.width/a.x,d=s.height/a.y;if(o){const e=getWindow(o),t=i&&isElement(i)?getWindow(i):i;let n=e,s=getFrameElement(n);for(;s&&i&&t!==n;){const e=getScale(s),t=s.getBoundingClientRect(),i=getComputedStyle$1(s),o=t.left+(s.clientLeft+parseFloat(i.paddingLeft))*e.x,a=t.top+(s.clientTop+parseFloat(i.paddingTop))*e.y;r*=e.x,c*=e.y,u*=e.x,d*=e.y,r+=o,c+=a,n=getWindow(s),s=getFrameElement(n)}}return rectToClientRect({width:u,height:d,x:r,y:c})}function getWindowScrollBarX(e,t){const n=getNodeScroll(e).scrollLeft;return t?t.left+n:getBoundingClientRect(getDocumentElement(e)).left+n}function getHTMLOffset(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-getWindowScrollBarX(e,n),y:n.top+t.scrollTop}}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{elements:t,rect:n,offsetParent:i,strategy:s}=e;const o="fixed"===s,a=getDocumentElement(i),l=!!t&&isTopLayer(t.floating);if(i===a||l&&o)return n;let r={scrollLeft:0,scrollTop:0},c=createCoords(1);const u=createCoords(0),d=isHTMLElement(i);if((d||!d&&!o)&&(("body"!==getNodeName(i)||isOverflowElement(a))&&(r=getNodeScroll(i)),d)){const e=getBoundingClientRect(i);c=getScale(i),u.x=e.x+i.clientLeft,u.y=e.y+i.clientTop}const h=!a||d||o?createCoords(0):getHTMLOffset(a,r);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-r.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-r.scrollTop*c.y+u.y+h.y}}function getClientRects(e){return Array.from(e.getClientRects())}function getDocumentRect(e){const t=getDocumentElement(e),n=getNodeScroll(e),i=e.ownerDocument.body,s=max(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=max(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let a=-n.scrollLeft+getWindowScrollBarX(e);const l=-n.scrollTop;return"rtl"===getComputedStyle$1(i).direction&&(a+=max(t.clientWidth,i.clientWidth)-s),{width:s,height:o,x:a,y:l}}const SCROLLBAR_MAX=25;function getViewportRect(e,t){const n=getWindow(e),i=getDocumentElement(e),s=n.visualViewport;let o=i.clientWidth,a=i.clientHeight,l=0,r=0;if(s){o=s.width,a=s.height;const e=isWebKit();(!e||e&&"fixed"===t)&&(l=s.offsetLeft,r=s.offsetTop)}const c=getWindowScrollBarX(i);if(c<=0){const e=i.ownerDocument,t=e.body,n=getComputedStyle(t),s="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(i.clientWidth-t.clientWidth-s);a<=25&&(o-=a)}else c<=25&&(o+=c);return{width:o,height:a,x:l,y:r}}function getInnerBoundingClientRect(e,t){const n=getBoundingClientRect(e,!0,"fixed"===t),i=n.top+e.clientTop,s=n.left+e.clientLeft,o=isHTMLElement(e)?getScale(e):createCoords(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:s*o.x,y:i*o.y}}function getClientRectFromClippingAncestor(e,t,n){let i;if("viewport"===t)i=getViewportRect(e,n);else if("document"===t)i=getDocumentRect(getDocumentElement(e));else if(isElement(t))i=getInnerBoundingClientRect(t,n);else{const n=getVisualOffsets(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return rectToClientRect(i)}function hasFixedPositionAncestor(e,t){const n=getParentNode(e);return!(n===t||!isElement(n)||isLastTraversableNode(n))&&("fixed"===getComputedStyle$1(n).position||hasFixedPositionAncestor(n,t))}function getClippingElementAncestors(e,t){const n=t.get(e);if(n)return n;let i=getOverflowAncestors(e,[],!1).filter(e=>isElement(e)&&"body"!==getNodeName(e)),s=null;const o="fixed"===getComputedStyle$1(e).position;let a=o?getParentNode(e):e;for(;isElement(a)&&!isLastTraversableNode(a);){const t=getComputedStyle$1(a),n=isContainingBlock(a);n||"fixed"!==t.position||(s=null),(o?!n&&!s:!n&&"static"===t.position&&s&&("absolute"===s.position||"fixed"===s.position)||isOverflowElement(a)&&!n&&hasFixedPositionAncestor(e,a))?i=i.filter(e=>e!==a):s=t,a=getParentNode(a)}return t.set(e,i),i}function getClippingRect(e){let{element:t,boundary:n,rootBoundary:i,strategy:s}=e;const o=[..."clippingAncestors"===n?isTopLayer(t)?[]:getClippingElementAncestors(t,this._c):[].concat(n),i],a=getClientRectFromClippingAncestor(t,o[0],s);let l=a.top,r=a.right,c=a.bottom,u=a.left;for(let e=1;e{a(!1,1e-7)},1e3)}1!==i||rectsAreEqual(c,e.getBoundingClientRect())||a(),g=!1}try{i=new IntersectionObserver(p,{...m,root:s.ownerDocument})}catch(e){i=new IntersectionObserver(p,m)}i.observe(e)}(!0),o}function autoUpdate(e,t,n,i){void 0===i&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:r=!1}=i,c=unwrapElement(e),u=s||o?[...c?getOverflowAncestors(c):[],...t?getOverflowAncestors(t):[]]:[];u.forEach(e=>{s&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const d=c&&l?observeMove(c,n):null;let h,_=-1,m=null;a&&(m=new ResizeObserver(e=>{let[i]=e;i&&i.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),n()}),c&&!r&&m.observe(c),t&&m.observe(t));let g=r?getBoundingClientRect(e):null;return r&&function t(){const i=getBoundingClientRect(e);g&&!rectsAreEqual(g,i)&&n(),g=i,h=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{s&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),d?.(),null==(e=m)||e.disconnect(),m=null,r&&cancelAnimationFrame(h)}}const offset=offset$1,shift=shift$1,flip=flip$1,arrow=arrow$1,computePosition=(e,t,n)=>{const i=new Map,s={platform:platform,...n},o={...s.platform,_c:i};return computePosition$1(e,t,{...s,platform:o})},BREAKPOINTS={sm:576,md:768,lg:1024,xl:1280,"2xl":1536},parseResponsivePlacement=(e,t="bottom")=>{if(!e||!e.includes(":"))return null;const n=e.split(/\s+/),i={xs:t};for(const e of n)if(e.includes(":")){const[t,n]=e.split(":");void 0!==BREAKPOINTS[t]&&(i[t]=n)}else i.xs=e;return i},getResponsivePlacement=(e,t="bottom")=>{if(!e)return t;const n=window.innerWidth;let i=e.xs||t;for(const t of["sm","md","lg","xl","2xl"])n>=BREAKPOINTS[t]&&e[t]&&(i=e[t]);return i},createBreakpointListeners=e=>{const t=[];for(const n of Object.keys(BREAKPOINTS)){const i=BREAKPOINTS[n],s=window.matchMedia(`(min-width: ${i}px)`);s.addEventListener("change",e),t.push({mql:s,handler:e})}return t},disposeBreakpointListeners=e=>{for(const{mql:t,handler:n}of e)t.removeEventListener("change",n)},toFloatingOffset=e=>Array.isArray(e)?{mainAxis:e[1]||0,crossAxis:e[0]||0}:e,NAME$17="menu",EVENT_KEY$14=".bs.menu",DATA_API_KEY$9=".data-api",ESCAPE_KEY$2="Escape",TAB_KEY$1="Tab",ARROW_UP_KEY$2="ArrowUp",ARROW_DOWN_KEY$2="ArrowDown",ARROW_LEFT_KEY$1="ArrowLeft",ARROW_RIGHT_KEY$1="ArrowRight",HOME_KEY$2="Home",END_KEY$2="End",ENTER_KEY$1="Enter",SPACE_KEY$1=" ",RIGHT_MOUSE_BUTTON=2,SUBMENU_CLOSE_DELAY=100,EVENT_HIDE$5="hide.bs.menu",EVENT_HIDDEN$7="hidden.bs.menu",EVENT_SHOW$6="show.bs.menu",EVENT_SHOWN$5="shown.bs.menu",EVENT_CLICK_DATA_API$5="click.bs.menu.data-api",EVENT_KEYDOWN_DATA_API="keydown.bs.menu.data-api",EVENT_KEYUP_DATA_API="keyup.bs.menu.data-api",CLASS_NAME_SHOW$5="show",SELECTOR_DATA_TOGGLE$8='[data-bs-toggle="menu"]:not(.disabled):not(:disabled)',SELECTOR_MENU$3=".menu",SELECTOR_SUBMENU=".submenu",SELECTOR_SUBMENU_TOGGLE=".submenu > .menu-item",SELECTOR_NAVBAR_NAV=".navbar-nav",SELECTOR_VISIBLE_ITEMS$1=".menu-item:not(.disabled):not(:disabled)",DEFAULT_PLACEMENT="bottom-start",SUBMENU_PLACEMENT="end-start",resolveLogicalPlacement=e=>isRTL$1()?e.replace(/^start(?=-|$)/,"right").replace(/^end(?=-|$)/,"left"):e.replace(/^start(?=-|$)/,"left").replace(/^end(?=-|$)/,"right"),triangleSign=(e,t,n)=>(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y),Default$16={autoClose:!0,boundary:"clippingParents",container:!1,display:"dynamic",offset:[0,2],floatingConfig:null,menu:null,placement:"bottom-start",reference:"toggle",strategy:"absolute",submenuTrigger:"both",submenuDelay:100},DefaultType$16={autoClose:"(boolean|string)",boundary:"(string|element)",container:"(string|element|boolean)",display:"string",offset:"(array|string|function)",floatingConfig:"(null|object|function)",menu:"(null|element)",placement:"string",reference:"(string|element|object)",strategy:"string",submenuTrigger:"string",submenuDelay:"number"};var Menu=class e extends BaseComponent{static _openInstances=new Set;constructor(e,t){super(e,t),this._floatingCleanup=null,this._mediaQueryListeners=[],this._responsivePlacements=null,this._parent=this._element.parentNode,this._openSubmenus=new Map,this._submenuCloseTimeouts=new Map,this._hoverIntentData=null,this._menu=this._config.menu||this._findMenu(),!this._config.menu&&this._menu&&(this._parent=this._findWrapper(this._menu)),this._isSubmenu=this._parent.classList?.contains("submenu"),this._menuOriginalParent=this._menu?.parentNode,this._parseResponsivePlacements(),this._setupSubmenuListeners(),this._initSubmenuTriggers()}static get Default(){return Default$16}static get DefaultType(){return DefaultType$16}static get NAME(){return"menu"}toggle(){return this._isShown()?this.hide():this.show()}async show(){if(isDisabled(this._element)||this._isShown())return;const t={relatedTarget:this._element};if(!EventHandler.trigger(this._element,EVENT_SHOW$6,t).defaultPrevented){if(this._moveMenuToContainer(),this._createFloating(),"ontouchstart"in document.documentElement&&!this._parent.closest(".navbar-nav"))for(const e of document.body.children)EventHandler.on(e,"mouseover",noop);this._element.focus({focusVisible:!1}),this._element.setAttribute("aria-expanded","true"),this._menu.classList.add("show"),this._element.classList.add("show"),this._parent&&this._parent.classList.add("show"),e._openInstances.add(this),await this._queueCallback(()=>{this._isShown()&&EventHandler.trigger(this._element,EVENT_SHOWN$5,t)},this._menu,this._isAnimated())}}async hide(){if(isDisabled(this._element)||!this._isShown())return;const e={relatedTarget:this._element};await this._completeHide(e)}dispose(){this._disposeFloating(),this._restoreMenuToOriginalParent(),this._disposeMediaQueryListeners(),this._closeAllSubmenus(),this._clearAllSubmenuTimeouts(),e._openInstances.delete(this),super.dispose()}update(){this._floatingCleanup&&this._updateFloatingPosition()}_findMenu(){const e=SelectorEngine.closest(this._element,":has(.menu)");return SelectorEngine.next(this._element,".menu")[0]||SelectorEngine.prev(this._element,".menu")[0]||SelectorEngine.findOne(".menu",e||this._parent)}_findWrapper(e){let t=this._element.parentNode;for(;t instanceof Element&&!t.contains(e);)t=t.parentNode;return t instanceof Element?t:this._element.parentNode}async _completeHide(t){if(!EventHandler.trigger(this._element,EVENT_HIDE$5,t).defaultPrevented){if(this._closeAllSubmenus(),"ontouchstart"in document.documentElement)for(const e of document.body.children)EventHandler.off(e,"mouseover",noop);this._menu.classList.remove("show"),this._element.classList.remove("show"),this._parent&&this._parent.classList.remove("show"),this._element.setAttribute("aria-expanded","false"),e._openInstances.delete(this),await this._queueCallback(()=>{this._isShown()||(this._disposeFloating(),this._restoreMenuToOriginalParent(),Manipulator.removeDataAttribute(this._menu,"placement"),Manipulator.removeDataAttribute(this._menu,"display"),EventHandler.trigger(this._element,EVENT_HIDDEN$7,t))},this._menu,this._isAnimated())}}_getConfig(e){if("object"==typeof(e=super._getConfig(e)).reference&&!isElement$1(e.reference)&&"function"!=typeof e.reference.getBoundingClientRect)throw new TypeError(`${"menu".toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return e}_createFloating(){if("static"===this._config.display)return void Manipulator.setDataAttribute(this._menu,"display","static");let e=this._element;"parent"===this._config.reference?e=this._parent:isElement$1(this._config.reference)?e=getElement(this._config.reference):"object"==typeof this._config.reference&&(e=this._config.reference),this._updateFloatingPosition(e),this._floatingCleanup=autoUpdate(e,this._menu,()=>this._updateFloatingPosition(e))}async _updateFloatingPosition(e=null){if(!this._menu)return;e||(e="parent"===this._config.reference?this._parent:isElement$1(this._config.reference)?getElement(this._config.reference):"object"==typeof this._config.reference?this._config.reference:this._element);const t=this._getPlacement(),n=this._getFloatingMiddleware(),i=this._getFloatingConfig(t,n);await this._applyFloatingPosition(e,this._menu,i.placement,i.middleware,i.strategy)}_isShown(){return this._menu.classList.contains("show")}_isAnimated(){return getTransitionDurationFromElement(this._menu)>0}_getPlacement(){const e=this._responsivePlacements?getResponsivePlacement(this._responsivePlacements,"bottom-start"):this._config.placement;return resolveLogicalPlacement(e)}_parseResponsivePlacements(){this._responsivePlacements=parseResponsivePlacement(this._config.placement,"bottom-start"),this._responsivePlacements&&this._setupMediaQueryListeners()}_setupMediaQueryListeners(){this._disposeMediaQueryListeners(),this._mediaQueryListeners=createBreakpointListeners(()=>{this._isShown()&&this._updateFloatingPosition()})}_disposeMediaQueryListeners(){disposeBreakpointListeners(this._mediaQueryListeners),this._mediaQueryListeners=[]}_getOffset(){const{offset:e}=this._config;return"string"==typeof e?e.split(",").map(e=>Number.parseInt(e,10)):"function"==typeof e?({placement:t,rects:n})=>toFloatingOffset(e({placement:t,reference:n.reference,floating:n.floating},this._element)):e}_getFloatingMiddleware(){const e=this._getOffset();return[offset("function"==typeof e?e:toFloatingOffset(e)),flip({fallbackPlacements:this._getFallbackPlacements(),fallbackStrategy:"initialPlacement"}),shift({boundary:"clippingParents"===this._config.boundary?"clippingAncestors":this._config.boundary})]}_getFallbackPlacements(){return{bottom:["top","bottom-start","bottom-end","top-start","top-end"],"bottom-start":["top-start","bottom-end","top-end"],"bottom-end":["top-end","bottom-start","top-start"],top:["bottom","top-start","top-end","bottom-start","bottom-end"],"top-start":["bottom-start","top-end","bottom-end"],"top-end":["bottom-end","top-start","bottom-start"],right:["left","right-start","right-end","left-start","left-end"],"right-start":["left-start","right-end","left-end","top-start","bottom-start"],"right-end":["left-end","right-start","left-start","top-end","bottom-end"],left:["right","left-start","left-end","right-start","right-end"],"left-start":["right-start","left-end","right-end","top-start","bottom-start"],"left-end":["right-end","left-start","right-start","top-end","bottom-end"]}[this._getPlacement()]||["top","bottom","right","left"]}_getFloatingConfig(e,t){const n={placement:e,middleware:t,strategy:this._config.strategy};return{...n,...execute(this._config.floatingConfig,[void 0,n])}}_disposeFloating(){this._floatingCleanup&&(this._floatingCleanup(),this._floatingCleanup=null)}_getContainer(){const{container:e}=this._config;return!1===e?null:!0===e?document.body:getElement(e)}_moveMenuToContainer(){const e=this._getContainer();e&&this._menu&&this._menu.parentNode!==e&&e.append(this._menu)}_restoreMenuToOriginalParent(){this._menuOriginalParent&&this._menu&&this._menu.parentNode!==this._menuOriginalParent&&this._menuOriginalParent.append(this._menu)}async _applyFloatingPosition(e,t,n,i,s="absolute"){if(!t.isConnected)return null;const{x:o,y:a,placement:l}=await computePosition(e,t,{placement:n,middleware:i,strategy:s});return t.isConnected?(Object.assign(t.style,{position:s,left:`${o}px`,top:`${a}px`,margin:"0"}),Manipulator.setDataAttribute(t,"placement",l),l):null}_setupSubmenuListeners(){"hover"!==this._config.submenuTrigger&&"both"!==this._config.submenuTrigger||(EventHandler.on(this._menu,"mouseenter",".submenu > .menu-item",e=>{this._onSubmenuTriggerEnter(e)}),EventHandler.on(this._menu,"mouseleave",".submenu",e=>{this._onSubmenuLeave(e)}),EventHandler.on(this._menu,"mousemove",e=>{this._trackMousePosition(e)})),"click"!==this._config.submenuTrigger&&"both"!==this._config.submenuTrigger||EventHandler.on(this._menu,"click",".submenu > .menu-item",e=>{this._onSubmenuTriggerClick(e)})}_onSubmenuTriggerEnter(e){const t=e.target.closest(".submenu > .menu-item");if(!t)return;const n=t.closest(".submenu"),i=SelectorEngine.findOne(".menu",n);i&&(this._cancelSubmenuCloseTimeout(i),this._closeSiblingSubmenus(n),this._openSubmenu(t,i,n))}_onSubmenuLeave(e){const t=e.target.closest(".submenu"),n=SelectorEngine.findOne(".menu",t);n&&this._openSubmenus.has(n)&&(this._isMovingTowardSubmenu(e,n)||this._scheduleSubmenuClose(n,t))}_onSubmenuTriggerClick(e){const t=e.target.closest(".submenu > .menu-item");if(!t)return;e.preventDefault(),e.stopPropagation();const n=t.closest(".submenu"),i=SelectorEngine.findOne(".menu",n);i&&(this._openSubmenus.has(i)?this._closeSubmenu(i,n):(this._closeSiblingSubmenus(n),this._openSubmenu(t,i,n)))}_initSubmenuTriggers(){if(this._menu)for(const e of SelectorEngine.find(".submenu > .menu-item",this._menu))SelectorEngine.findOne(".menu",e.parentElement)&&(e.setAttribute("aria-haspopup","true"),e.hasAttribute("aria-expanded")||e.setAttribute("aria-expanded","false"))}_openSubmenu(e,t,n){if(this._openSubmenus.has(t))return;e.setAttribute("aria-expanded","true"),e.setAttribute("aria-haspopup","true"),t.style.opacity="0",t.classList.add("show"),n.classList.add("show");const i=this._createSubmenuFloating(e,t,n);this._openSubmenus.set(t,i),EventHandler.on(t,"mouseenter",()=>{this._cancelSubmenuCloseTimeout(t)})}_closeSubmenu(e,t){if(!this._openSubmenus.has(e))return;const n=SelectorEngine.find(".submenu .menu.show",e);for(const e of n){const t=e.closest(".submenu");this._closeSubmenu(e,t)}const i=SelectorEngine.findOne(".submenu > .menu-item",t),s=this._openSubmenus.get(e);s&&s(),this._openSubmenus.delete(e),EventHandler.off(e,"mouseenter"),i&&i.setAttribute("aria-expanded","false"),e.classList.remove("show"),t.classList.remove("show"),e.style.opacity=""}_closeAllSubmenus(){for(const[e]of this._openSubmenus){const t=e.closest(".submenu");this._closeSubmenu(e,t)}}_closeSiblingSubmenus(e){const t=e.parentNode,n=SelectorEngine.find(".submenu > .menu.show",t);for(const t of n){const n=t.closest(".submenu");n!==e&&this._closeSubmenu(t,n)}}_createSubmenuFloating(e,t,n){const i=n,s=resolveLogicalPlacement("end-start"),o=[offset({mainAxis:0,crossAxis:-4}),flip({fallbackPlacements:[resolveLogicalPlacement("start-start"),resolveLogicalPlacement("end-end"),resolveLogicalPlacement("start-end")]}),shift({padding:8})],a=()=>this._applyFloatingPosition(i,t,s,o).then(e=>(t.style.opacity="",e));return a(),autoUpdate(i,t,a)}_scheduleSubmenuClose(e,t){this._cancelSubmenuCloseTimeout(e);const n=setTimeout(()=>{this._closeSubmenu(e,t),this._submenuCloseTimeouts.delete(e)},this._config.submenuDelay);this._submenuCloseTimeouts.set(e,n)}_cancelSubmenuCloseTimeout(e){const t=this._submenuCloseTimeouts.get(e);t&&(clearTimeout(t),this._submenuCloseTimeouts.delete(e))}_clearAllSubmenuTimeouts(){for(const e of this._submenuCloseTimeouts.values())clearTimeout(e);this._submenuCloseTimeouts.clear()}_trackMousePosition(e){this._hoverIntentData={x:e.clientX,y:e.clientY,timestamp:Date.now()}}_isMovingTowardSubmenu(e,t){if(!this._hoverIntentData)return!1;const n=t.getBoundingClientRect(),i={x:e.clientX,y:e.clientY},s={x:this._hoverIntentData.x,y:this._hoverIntentData.y},o=isRTL$1()?n.right:n.left,a={x:o,y:n.top},l={x:o,y:n.bottom};return this._pointInTriangle(i,s,a,l)}_pointInTriangle(e,t,n,i){const s=triangleSign(e,t,n),o=triangleSign(e,n,i),a=triangleSign(e,i,t);return!((s<0||o<0||a<0)&&(s>0||o>0||a>0))}_getItemsInMenu(e){return SelectorEngine.find(`:scope > ${SELECTOR_VISIBLE_ITEMS$1}, :scope > .submenu > ${SELECTOR_VISIBLE_ITEMS$1}`,e).filter(e=>isVisible(e))}_selectMenuItem({key:e,target:t}){const n=t.closest(".menu")||this._menu,i=this._getItemsInMenu(n);if(!i.length)return;const s=getNextActiveElement(i,t,e===ARROW_DOWN_KEY$2,!i.includes(t));s.focus(),this._closeUnrelatedSubmenus(n,s)}_closeUnrelatedSubmenus(e,t){for(const[n]of this._openSubmenus){const i=n.closest(".submenu");i&&i.parentElement===e&&!i.contains(t)&&this._closeSubmenu(n,i)}}_handleSubmenuKeydown(e){const{key:t,target:n}=e,i=isRTL$1(),s=i?ARROW_LEFT_KEY$1:ARROW_RIGHT_KEY$1,o=i?ARROW_RIGHT_KEY$1:ARROW_LEFT_KEY$1,a=n.closest(".submenu"),l=n.matches(".submenu > .menu-item");if((t===ENTER_KEY$1||t===SPACE_KEY$1||t===s)&&a&&l){e.preventDefault(),e.stopPropagation();const t=SelectorEngine.findOne(".menu",a);return t&&(this._closeSiblingSubmenus(a),this._openSubmenu(n,t,a),requestAnimationFrame(()=>{const e=SelectorEngine.findOne(SELECTOR_VISIBLE_ITEMS$1,t);e&&e.focus()})),!0}if(t===o){const t=n.closest(".menu"),i=t?.closest(".submenu");if(i){e.preventDefault(),e.stopPropagation();const n=SelectorEngine.findOne(".submenu > .menu-item",i);return this._closeSubmenu(t,i),n&&n.focus(),!0}}if(t===HOME_KEY$2||t===END_KEY$2){e.preventDefault(),e.stopPropagation();const i=n.closest(".menu"),s=this._getItemsInMenu(i);if(s.length){const e=t===HOME_KEY$2?s[0]:s.at(-1);e.focus(),this._closeUnrelatedSubmenus(i,e)}return!0}return!1}static clearMenus(t){if(2!==t.button&&("keyup"!==t.type||"Tab"===t.key))for(const n of e._openInstances){if(!1===n._config.autoClose)continue;const e=t.composedPath(),i=e.includes(n._menu);if(e.includes(n._element)||"inside"===n._config.autoClose&&!i||"outside"===n._config.autoClose&&i)continue;const s=t.target.closest?.("form"),o=Boolean(s)&&n._menu.contains(s);if(n._menu.contains(t.target)&&("keyup"===t.type&&"Tab"===t.key||/input|select|option|textarea|form/i.test(t.target.tagName)||o))continue;const a={relatedTarget:n._element};"click"===t.type&&(a.clickEvent=t),n._completeHide(a)}}static _getToggleFromKeydownContext(t,n){if(t.matches(SELECTOR_DATA_TOGGLE$8))return t;for(const t of e._openInstances)if(t._element===n.target||t._menu?.contains(n.target))return t._element;return SelectorEngine.prev(t,SELECTOR_DATA_TOGGLE$8)[0]||SelectorEngine.next(t,SELECTOR_DATA_TOGGLE$8)[0]||SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$8,n.delegateTarget.parentNode)}static dataApiKeydownHandler(t){const n=/input|textarea/i.test(t.target.tagName)||t.target.isContentEditable,i="Escape"===t.key,s=[ARROW_UP_KEY$2,ARROW_DOWN_KEY$2].includes(t.key),o=[ARROW_LEFT_KEY$1,ARROW_RIGHT_KEY$1].includes(t.key),a=[HOME_KEY$2,END_KEY$2].includes(t.key),l=[ENTER_KEY$1,SPACE_KEY$1].includes(t.key),r=t.target.matches(".submenu > .menu-item");if(!(s||i||o||a||l&&r))return;if(n&&!i)return;const c=e._getToggleFromKeydownContext(this,t);if(!c)return;const u=e.getOrCreateInstance(c);if(!(o||a||l&&r)||!u._handleSubmenuKeydown(t)){if(s)return t.preventDefault(),t.stopPropagation(),u.show(),void u._selectMenuItem(t);if(i&&u._isShown()){t.preventDefault(),t.stopPropagation();const e=t.target.closest(".menu"),n=e?.closest(".submenu");if(n&&u._openSubmenus.size>0){const t=SelectorEngine.findOne(".submenu > .menu-item",n);return u._closeSubmenu(e,n),void(t&&t.focus())}u.hide(),c.focus()}}}};EventHandler.on(document,EVENT_KEYDOWN_DATA_API,SELECTOR_DATA_TOGGLE$8,Menu.dataApiKeydownHandler),EventHandler.on(document,EVENT_KEYDOWN_DATA_API,".menu",Menu.dataApiKeydownHandler),EventHandler.on(document,EVENT_CLICK_DATA_API$5,Menu.clearMenus),EventHandler.on(document,EVENT_KEYUP_DATA_API,Menu.clearMenus),EventHandler.on(document,EVENT_CLICK_DATA_API$5,SELECTOR_DATA_TOGGLE$8,function(e){e.preventDefault(),Menu.getOrCreateInstance(this).toggle()});const NAME$16="combobox",EVENT_KEY$13=".bs.combobox",DATA_API_KEY$8=".data-api",ESCAPE_KEY$1="Escape",TAB_KEY="Tab",ARROW_UP_KEY$1="ArrowUp",ARROW_DOWN_KEY$1="ArrowDown",HOME_KEY$1="Home",END_KEY$1="End",ENTER_KEY="Enter",SPACE_KEY=" ",EVENT_CHANGE$3=`change${EVENT_KEY$13}`,EVENT_SHOW$5=`show${EVENT_KEY$13}`,EVENT_SHOWN$4=`shown${EVENT_KEY$13}`,EVENT_HIDE$4=`hide${EVENT_KEY$13}`,EVENT_HIDDEN$6=`hidden${EVENT_KEY$13}`,EVENT_CLICK_DATA_API$4=`click${EVENT_KEY$13}.data-api`,CLASS_NAME_SHOW$4="show",CLASS_NAME_SELECTED="selected",CLASS_NAME_PLACEHOLDER="combobox-placeholder",SELECTOR_DATA_TOGGLE$7='[data-bs-toggle="combobox"]',SELECTOR_MENU$2=".menu",SELECTOR_MENU_ITEM=".menu-item[data-bs-value]",SELECTOR_VISIBLE_ITEMS=".menu-item[data-bs-value]:not(.disabled):not(:disabled)",SELECTOR_VALUE=".combobox-value",SELECTOR_SEARCH_INPUT=".combobox-search-input",SELECTOR_NO_RESULTS=".combobox-no-results",Default$15={boundary:"clippingParents",multiple:!1,name:null,offset:[0,2],placeholder:"",placement:"bottom-start",search:!1,searchNormalize:!1},DefaultType$15={boundary:"(string|element)",multiple:"boolean",name:"(string|null)",offset:"(array|string|function)",placeholder:"string",placement:"string",search:"boolean",searchNormalize:"boolean"};var Combobox=class extends BaseComponent{constructor(e,t){super(e,t),this._toggle=this._element,this._menu=SelectorEngine.next(this._toggle,".menu")[0],this._valueDisplay=SelectorEngine.findOne(SELECTOR_VALUE,this._toggle),this._searchInput=SelectorEngine.findOne(SELECTOR_SEARCH_INPUT,this._menu),this._noResults=SelectorEngine.findOne(SELECTOR_NO_RESULTS,this._menu),this._hiddenInput=null,this._menuInstance=null,this._createHiddenInput(),this._createMenuInstance(),this._syncInitialSelection(),this._addEventListeners()}static get Default(){return Default$15}static get DefaultType(){return DefaultType$15}static get NAME(){return NAME$16}toggle(){return this._isShown()?this.hide():this.show()}async show(){isDisabled(this._toggle)||this._isShown()||EventHandler.trigger(this._toggle,EVENT_SHOW$5).defaultPrevented||(this._menuInstance.show(),this._searchInput&&(this._searchInput.value="",this._filterItems(""),requestAnimationFrame(()=>this._searchInput.focus())),EventHandler.trigger(this._toggle,EVENT_SHOWN$4))}async hide(){this._isShown()&&(EventHandler.trigger(this._toggle,EVENT_HIDE$4).defaultPrevented||(this._menuInstance.hide(),EventHandler.trigger(this._toggle,EVENT_HIDDEN$6)))}dispose(){this._menuInstance&&(this._menuInstance.dispose(),this._menuInstance=null),this._hiddenInput&&(this._hiddenInput.remove(),this._hiddenInput=null),EventHandler.off(this._menu,EVENT_KEY$13),EventHandler.off(this._toggle,EVENT_KEY$13),EventHandler.off(this._searchInput,EVENT_KEY$13),super.dispose()}_isShown(){return this._menu.classList.contains("show")}_createHiddenInput(){const{name:e}=this._config;e&&(this._hiddenInput=document.createElement("input"),this._hiddenInput.type="hidden",this._hiddenInput.name=e,this._hiddenInput.value="",this._toggle.parentNode.insertBefore(this._hiddenInput,this._toggle))}_createMenuInstance(){this._menuInstance=new Menu(this._toggle,{menu:this._menu,autoClose:!this._config.multiple||"outside",boundary:this._config.boundary,offset:this._config.offset,placement:this._config.placement})}_syncInitialSelection(){this._getSelectedItems().length>0?(this._updateToggleText(),this._updateHiddenInput()):this._showPlaceholder()}_addEventListeners(){EventHandler.on(this._menu,`click${EVENT_KEY$13}`,SELECTOR_MENU_ITEM,e=>{const t=e.target.closest(SELECTOR_MENU_ITEM);t&&!isDisabled(t)&&(e.preventDefault(),e.stopPropagation(),this._selectItem(t))}),EventHandler.on(this._toggle,`keydown${EVENT_KEY$13}`,e=>{this._handleToggleKeydown(e)}),EventHandler.on(this._menu,`keydown${EVENT_KEY$13}`,e=>{this._handleMenuKeydown(e)}),this._searchInput&&(EventHandler.on(this._searchInput,`input${EVENT_KEY$13}`,()=>{this._filterItems(this._searchInput.value)}),EventHandler.on(this._searchInput,`keydown${EVENT_KEY$13}`,e=>{if("ArrowDown"===e.key){e.preventDefault();const t=this._getVisibleItems();t.length>0&&t[0].focus()}"Escape"===e.key&&(this.hide(),this._toggle.focus())}))}_selectItem(e){if(this._config.multiple)e.classList.toggle("selected"),setAriaAttribute(e,"aria-selected",e.classList.contains("selected"));else{const t=SelectorEngine.find(".selected",this._menu);for(const e of t)e.classList.remove("selected"),e.setAttribute("aria-selected","false");e.classList.add("selected"),e.setAttribute("aria-selected","true")}this._updateToggleText(),this._updateHiddenInput();const t=this._config.multiple?this._getSelectedItems().map(e=>e.dataset.bsValue):e.dataset.bsValue;EventHandler.trigger(this._toggle,EVENT_CHANGE$3,{value:t,item:e}),this._config.multiple||(this.hide(),this._toggle.focus())}_updateToggleText(){const e=this._getSelectedItems();if(0!==e.length)if(this._valueDisplay.classList.remove("combobox-placeholder"),this._config.multiple&&e.length>1)this._valueDisplay.textContent=`${e.length} selected`;else{const t=e[0],n=SelectorEngine.findOne(".menu-item-content > span:first-child",t);this._valueDisplay.textContent=n?n.textContent:t.textContent.trim()}else this._showPlaceholder()}_showPlaceholder(){const{placeholder:e}=this._config;e&&(this._valueDisplay.textContent=e,this._valueDisplay.classList.add("combobox-placeholder"))}_updateHiddenInput(){if(!this._hiddenInput)return;const e=this._getSelectedItems().map(e=>e.dataset.bsValue);this._hiddenInput.value=this._config.multiple?e.join(","):e[0]||""}_getSelectedItems(){return SelectorEngine.find(".selected",this._menu)}_getVisibleItems(){return SelectorEngine.find(SELECTOR_VISIBLE_ITEMS,this._menu).filter(e=>isVisible(e))}_filterItems(e){const t=this._normalizeText(e.toLowerCase().trim()),n=SelectorEngine.find(SELECTOR_MENU_ITEM,this._menu);let i=0;for(const e of n){const n=this._normalizeText(e.textContent.toLowerCase().trim()),s=!t||n.includes(t);e.style.display=s?"":"none",s&&i++}this._noResults&&this._noResults.classList.toggle("d-none",i>0)}_normalizeText(e){return this._config.searchNormalize?e.normalize("NFD").replace(/[\u0300-\u036F]/g,""):e}_handleToggleKeydown(e){const{key:t}=e;if("ArrowDown"===t||"ArrowUp"===t){e.preventDefault(),this._isShown()||this.show();const n=this._getVisibleItems();return void(n.length>0&&("ArrowDown"===t?n[0]:n.at(-1)).focus())}"Enter"!==t&&" "!==t||this._isShown()||(e.preventDefault(),this.show())}_handleMenuKeydown(e){const{key:t,target:n}=e;if("Escape"===t)return e.preventDefault(),e.stopPropagation(),this.hide(),void this._toggle.focus();if("Tab"===t)return void this.hide();const i=n.matches("input");if("ArrowDown"===t||"ArrowUp"===t){e.preventDefault();const i=this._getVisibleItems();return void(i.length>0&&getNextActiveElement(i,n,"ArrowDown"===t,!i.includes(n)).focus())}if("Home"===t||"End"===t){e.preventDefault();const n=this._getVisibleItems();return void(n.length>0&&("Home"===t?n[0]:n.at(-1)).focus())}if(("Enter"===t||" "===t)&&!i){e.preventDefault();const t=n.closest(SELECTOR_MENU_ITEM);t&&!isDisabled(t)&&this._selectItem(t)}}};EventHandler.on(document,EVENT_CLICK_DATA_API$4,SELECTOR_DATA_TOGGLE$7,function(e){e.preventDefault(),Combobox.getOrCreateInstance(this).toggle()}),EventHandler.on(document,"DOMContentLoaded",()=>{for(const e of SelectorEngine.find(SELECTOR_DATA_TOGGLE$7))Combobox.getOrCreateInstance(e)}); +/*! name: vanilla-calendar-pro v3.4.0 | url: https://github.com/uvarov-frontend/vanilla-calendar-pro */ +var e=e=>new Date(`${e}T00:00:00`),t=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,n=(n,i)=>n.reduce((n,s)=>{if(s instanceof Date||"number"==typeof s){let e=s instanceof Date?s:new Date(s);n.push(t(e))}else s.match(/^(\d{4}-\d{2}-\d{2})$/g)?n.push(s):s.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,(s,o,a)=>{var l;let r=`${o}:${a}`,c=i?i.start.getTime():-1/0,u=null==i||null==(l=i.cursors)?void 0:l.get(r),d=void 0!==u&&u<=c?new Date(u):e(o),h=e(a).setHours(23,59,59,999);if(i){if(h=c)&&(null!=i&&i.cursors&&!_&&(i.cursors.set(r,e),_=!0),n.push(t(d)));return s});return n},[]),a=(e,t)=>{if(t&&t.values.length===e.length){let n=0;for(;n{var t;let i=null!=(t=e.selectedHolidays)&&t[0]?e.selectedHolidays:[],s=JSON.stringify(i.map(e=>e instanceof Date?e.getTime():e)),o=l.get(e);l.set(e,{holidayKey:s,holidays:(null==o?void 0:o.holidayKey)===s?o.holidays:new Set(n(i)),selected:a(e.context.selectedDates,null==o?void 0:o.selected),disabled:a(e.context.disableDates,null==o?void 0:o.disabled),enabled:a(e.context.enableDates,null==o?void 0:o.enabled),min:Date.parse(`${e.context.displayDateMin}T00:00:00`),max:Date.parse(`${e.context.displayDateMax}T00:00:00`),first:Date.parse(`${e.context.selectedDates[0]}T00:00:00`),last:Date.parse(`${e.context.selectedDates[e.context.selectedDates.length-1]}T00:00:00`)})},r=e=>l.get(e),i=["motion","time","annotations","weeks","months"],s=new WeakMap,c={},d=Object.freeze([]),u=e=>{var t;return null==(t=s.get(e))?c:t},m=(e,t=e)=>{if(t.extensions&&t.extensions!==e.extensions&&(new Set(t.extensions).size!==e.extensions.length||t.extensions.some(t=>!e.extensions.includes(t))))throw Error("Calendar extensions are fixed at construction. Create a new Calendar to change them.");let n=u(e),i=(e,t,i)=>{if(e&&!n[t])throw Error(`The "${i}" option requires ${t}. Import { ${t} } from 'vanilla-calendar-pro' and add it to extensions: [${t}].`)};i(t.animation||t.enableSwipe,"motion",t.animation?"animation":"enableSwipe"),i(t.selectionTimeMode,"time","selectionTimeMode"),i(t.popups&&Object.keys(t.popups).length||t.onCreateDateRangeTooltip,"annotations",t.onCreateDateRangeTooltip?"onCreateDateRangeTooltip":"popups"),i("multiple"===t.type,"months","type"),i("week"===t.type||t.enableCollapse||t.enableWeekNumbers||t.onClickWeekDay,"weeks","week"===t.type?"type":t.enableCollapse?"enableCollapse":t.enableWeekNumbers?"enableWeekNumbers":"onClickWeekDay")},p=(e,t,n)=>{var i;return null==(i=u(e).annotations)?void 0:i.tooltip(e,t,n)},h=new WeakMap,v=e=>{let t=h.get(e);return t||(t={lastDateEl:null,isHovering:!1,rangeMin:void 0,rangeMax:void 0,tooltipEl:null,timeoutId:null,frameId:null},h.set(e,t)),t},y=e=>{e.context.mainElement.querySelectorAll("[data-vc-date-hover]").forEach(e=>e.removeAttribute("data-vc-date-hover"))},g=(e,t,n)=>{e.context[t]=n},f=(e,t)=>void 0===t||("function"==typeof t?t(e):t),x=e=>f(e,e.enableDateToggle),b=e=>{if(e.length<3||e.includes(void 0))return e.sort((e,t)=>+new Date(e)-new Date(t));let t=e.map(e=>({date:e,time:+new Date(e)}));return t.sort((e,t)=>e.time-t.time),t.forEach((t,n)=>e[n]=t.date),e},D=e=>{var t;let n=h.get(e);n&&(null==(t=n.cleanup)||t.call(n),n.cleanup=void 0,null!==n.timeoutId&&clearTimeout(n.timeoutId),null!==n.frameId&&cancelAnimationFrame(n.frameId),n.lastDateEl=null,n.tooltipEl=null,n.timeoutId=null,n.frameId=null,h.delete(e))},M=(i,s,o=!0)=>{let a=v(i);if(a.lastDateEl=s,y(i),!a.cleanup){let n=i.context.mainElement,s=(n=>i=>{if(!n.context.selectedDates[0]||1!==n.context.selectedDates.length&&!n.onCreateDateRangeTooltip)return;let s=v(n);if(s.isHovering)return;let o=i.target;s.isHovering=!0,s.frameId=requestAnimationFrame(()=>{var i;s.frameId=null,s.isHovering=!1,!n.context.isDestroyed&&n.context.mainElement.contains(o)&&(1===n.context.selectedDates.length?((n,i)=>{var s;let o=v(n);if(n.context.mainElement.hasAttribute("data-vc-dragging")||!i||null==n||null==(s=n.context)||!s.selectedDates[0])return;if(!i.closest('[data-vc="dates"]'))return o.lastDateEl=null,p(n,o.tooltipEl,null),void y(n);let a=i.closest("[data-vc-date]");if(!a||o.lastDateEl===a)return;o.lastDateEl=a,p(n,o.tooltipEl,a),y(n);let l=a.dataset.vcDate,r=e(n.context.selectedDates[0]),c=e(l),[u,d]=r{let n=t.dataset.vcDate;if(n===h||n===_)t.dataset.vcDateHover=h===_?"first-and-last":n===h?"first":"last";else{let i=e(n);i>=u&&i<=d&&!m.has(n)&&(t.dataset.vcDateHover="")}})})(n,o):n.context.selectedDates[0]&&n.onCreateDateRangeTooltip&&(null==(i=u(n).annotations)||i.hover(n,o)))})})(i),o=()=>(e=>{let t=v(e);null!==t.timeoutId&&clearTimeout(t.timeoutId),t.timeoutId=setTimeout(()=>{t.timeoutId=null,!e.context.isDestroyed&&(t.lastDateEl=null,p(e,t.tooltipEl,null),y(e))},50)})(i),l=e=>((e,t)=>{if("Escape"!==t.key||1!==e.context.selectedDates.length)return;let n=v(e);n.lastDateEl=null,g(e,"selectedDates",[]),p(e,n.tooltipEl,null),y(e)})(i,e);n.addEventListener("mousemove",s),n.addEventListener("mouseleave",o),n.addEventListener("keydown",l),a.cleanup=()=>{n.removeEventListener("mousemove",s),n.removeEventListener("mouseleave",o),n.removeEventListener("keydown",l)}}i.disableDatesGaps&&(a.rangeMin??=i.context.displayDateMin,a.rangeMax??=i.context.displayDateMax),a.tooltipEl=i.onCreateDateRangeTooltip?i.context.mainElement.querySelector("[data-vc-date-range-tooltip]"):null;let l=null==s?void 0:s.dataset.vcDate;if(l){let e=1===i.context.selectedDates.length&&i.context.selectedDates[0].includes(l);g(i,"selectedDates",e&&!x(i)?[l,l]:e&&x(i)?[]:i.context.selectedDates.length>1?[l]:[...i.context.selectedDates,l]),i.context.selectedDates.length>1&&b(i.context.selectedDates)}({set:()=>{i.disableDatesGaps&&(n=>{var i,s;if(null==n||null==(i=n.context)||null==(i=i.selectedDates)||!i[0]||null==(s=n.context.disableDates)||!s[0])return;let o=e(n.context.selectedDates[0]),[a,l]=n.context.disableDates.map(t=>e(t)).reduce(([e,t],n)=>[o>=n?n:e,o{if(!o)return;let[e,t]=[i.context.selectedDates[0],i.context.selectedDates[i.context.selectedDates.length-1]];g(i,"selectedDates",i.context.selectedDates[0]===i.context.selectedDates[i.context.selectedDates.length-1]?[i.context.selectedDates[0],i.context.selectedDates[0]]:i.enableEdgeDatesOnly?[e,t]:(()=>{let s=new Set(i.context.disableDates);return n([`${e}:${t}`]).filter(e=>!s.has(e))})()),i.disableDatesGaps&&(g(i,"displayDateMin",a.rangeMin),g(i,"displayDateMax",a.rangeMax)),i.onCreateDateRangeTooltip&&p(i,a.tooltipEl,i.context.selectedDates[0]?s:null)}})[1===i.context.selectedDates.length?"set":"reset"]()},w=e=>e.getRootNode?e.getRootNode():document,E=new WeakSet,k="data-vc-prev-tabindex",T=e=>e.tabIndex>=0&&!e.hasAttribute("disabled")&&"true"!==e.getAttribute("aria-disabled"),A=e=>{if(e.hasAttribute(k))return;let t=e.getAttribute("tabindex");e.setAttribute(k,null==t?"":t)},C=e=>{if(!e.hasAttribute(k))return;let t=e.getAttribute(k);""===t||null===t?e.removeAttribute("tabindex"):e.setAttribute("tabindex",t),e.removeAttribute(k)},S=e=>{e.setAttribute("inert",""),e.ariaHidden="true",(e=>{T(e)&&(A(e),e.tabIndex=-1);let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>T(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;t.nextNode();){let e=t.currentNode;A(e),e.tabIndex=-1}})(e)},$=e=>{var t;if(H(e),!e.context.isShowInInputMode||!e.context.currentType)return;let n=e.context.mainElement.contains(w(e.context.mainElement).activeElement);e.context.mainElement.dataset.vcCalendarHidden="",g(e,"isShowInInputMode",!1),e.inputMode&&S(e.context.mainElement),null!=(t=e.context.inputElement)&&t.hasAttribute("aria-expanded")&&e.context.inputElement.setAttribute("aria-expanded","false"),e.context.cleanupHandlers[0]&&(e.context.cleanupHandlers.forEach(e=>e()),g(e,"cleanupHandlers",[])),e.inputMode&&e.context.inputElement&&n&&(("function"==typeof e.openOnFocus||!0===e.openOnFocus)&&(e=>{E.add(e)})(e),e.context.inputElement.focus()),e.onHide&&e.onHide(e)};function Y(e){if(null==e||!e.getBoundingClientRect)return{top:0,bottom:0,left:0,right:0};let t=e.getBoundingClientRect(),n=document.documentElement;return{bottom:t.bottom,right:t.right,top:t.top+window.scrollY-n.clientTop,left:t.left+window.scrollX-n.clientLeft}}function N(){return{vw:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),vh:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function I(e,t,n=5){let i={top:!0,bottom:!0,left:!0,right:!0},s=[];if(!t||!e)return{canShow:i,parentPositions:s};let{bottom:o,top:a}=function(e){let{top:t,left:n}={left:window.scrollX||document.documentElement.scrollLeft||0,top:window.scrollY||document.documentElement.scrollTop||0},{top:i,left:s}=Y(e),{vh:o,vw:a}=N(),l=i-t,r=s-n;return{top:l,bottom:o-(l+e.clientHeight),left:r,right:a-(r+e.clientWidth)}}(e),{top:l,left:r}=Y(e),{height:c,width:u}=t.getBoundingClientRect(),{vh:d,vw:h}=N(),_=h/2,m=d/2;return[{condition:lm,position:"bottom"},{condition:r<_,position:"left"},{condition:r>_,position:"right"}].forEach(({condition:e,position:t})=>{e&&s.push(t)}),Object.assign(i,{top:c<=a-n,bottom:c<=o-n,left:u<=r,right:u<=h-r}),{canShow:i,parentPositions:s}}var L=(e,t,n)=>{if(!e)return;let i="auto"===n?function(e,t){let n="left";if(!t||!e)return n;let{canShow:i,parentPositions:s}=I(e,t),o=i.left&&i.right;return(o&&i.bottom?"center":o&&i.top?["top","center"]:Array.isArray(s)?["bottom"===s[0]?"top":"bottom",...s.slice(1)]:s)||n}(e,t):n,s={top:-t.offsetHeight,bottom:e.offsetHeight,left:0,center:e.offsetWidth/2-t.offsetWidth/2,right:e.offsetWidth-t.offsetWidth},o=Array.isArray(i)?i[0]:"bottom",a=Array.isArray(i)?i[1]:i;t.dataset.vcPosition=o;let{top:l,left:r}=Y(e),c=l+s[o],u=r+s[a],{vw:d}=N();if(u+t.clientWidth>d){let e=window.innerWidth-document.body.clientWidth;u=d-t.clientWidth-e}else u<0&&(u=0);Object.assign(t.style,{left:`${u}px`,top:`${c}px`})},W=new WeakMap,H=e=>{clearTimeout(W.get(e)),W.delete(e)},O=e=>{H(e),W.set(e,setTimeout(()=>{W.delete(e),e.context.isDestroyed||q(e)}))},q=e=>{var t,n;if(H(e),e.context.isShowInInputMode||e.context.isDestroyed)return;if(!e.context.currentType)return void e.context.mainElement.click();g(e,"cleanupHandlers",[]),g(e,"isShowInInputMode",!0),e.inputMode&&((n=e.context.mainElement).removeAttribute("inert"),n.removeAttribute("aria-hidden"),(e=>{C(e),e.querySelectorAll(`[${k}]`).forEach(C)})(n)),L(e.context.inputElement,e.context.mainElement,e.positionToInput),e.context.mainElement.removeAttribute("data-vc-calendar-hidden"),null!=(t=e.context.inputElement)&&t.hasAttribute("aria-expanded")&&e.context.inputElement.setAttribute("aria-expanded","true");let i=()=>{L(e.context.inputElement,e.context.mainElement,e.positionToInput)};window.addEventListener("resize",i),e.context.cleanupHandlers.push(()=>window.removeEventListener("resize",i));let s=t=>{"Escape"===t.key&&$(e)};document.addEventListener("keydown",s),e.context.cleanupHandlers.push(()=>document.removeEventListener("keydown",s));let o=t=>{var n;let i=null==(n=t.composedPath()[0])?t.target:n;i===e.context.inputElement||e.context.mainElement.contains(i)||$(e)};document.addEventListener("click",o,{capture:!0}),e.context.cleanupHandlers.push(()=>document.removeEventListener("click",o,{capture:!0})),e.onShow&&e.onShow(e)},F='The calendar has not been initialized, please initialize it using the "init()" method first.',P="You specified an incorrect language label or did not specify the required number of values ​​for «locale.weekdays» or «locale.months».",_=e=>String(e).replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[e])),R=(e,t)=>`\n
\n${t?` <#ArrowPrev [${t}] />\n`:""}
\n <#Month />\n <#Year />\n
\n${t?` <#ArrowNext [${t}] />\n`:""}
\n`,j=(e,t="month")=>`${R(e,t)}
\n <#WeekNumbers />\n
\n <#Week />\n <#Dates />\n <#DateRangeTooltip />\n
\n
\n <#Collapse />\n <#ControlTime />\n`,z=e=>e,K=new WeakMap,B=e=>{var t;null==(t=K.get(e))||t.observer.disconnect(),K.delete(e)},U=B,X=e=>{var t;return!(e.animation||e.enableCollapse||e.onCreateDateEls||e.onCreateDateRangeTooltip||e.disableDatesGaps||e.popups&&Object.keys(e.popups).length||e.sanitizerHTML!==z||"default"!==e.context.currentType&&"multiple"!==e.context.currentType||e.layouts[e.context.currentType]!==("multiple"===e.context.currentType?null==(t=u(e).months)?void 0:t.layout(e):j(e)))},G=e=>JSON.stringify(Object.entries(e).filter(([e])=>"context"!==e&&"selectedDates"!==e),(e,t)=>"function"==typeof t||t),Z=({context:e})=>JSON.stringify([e.currentType,e.locale,e.dateToday,e.dateMin,e.dateMax,e.displayDateMin,e.displayDateMax,e.selectedYear,e.selectedMonth,e.displayMonthsCount,e.selectedHours,e.selectedMinutes,e.selectedKeeping,e.selectedTime]),V=e=>JSON.stringify([Z(e),e.context.displayYear,e.context.displayWeekDate,e.context.selectedDates,e.context.disableDates,e.context.enableDates]),J=(e,t=!1)=>{let n=K.get(e);if(!n||!t&&!n.fullLayout||n.dirty||n.observer.takeRecords().length||!X(e))return;let i=w(e.context.mainElement).activeElement;if(!i||i===e.context.mainElement||!e.context.mainElement.contains(i)||t&&!i.closest('[data-vc="column"], [data-vc="dates"], [data-vc-week="numbers"]'))try{if(n.options===G(e)&&n.context===V(e)&&n.timezone===(new Intl.DateTimeFormat).resolvedOptions().timeZone)return n}catch(e){}},Q=(e,t=!1)=>{if(B(e),X(e)&&!e.context.isDestroyed)try{let n=G(e),i=V(e);if(n.length+i.length>262144)return;let s=Array.from(e.context.mainElement.querySelectorAll('[data-vc="dates"]'));if(s.length!==e.context.displayMonthsCount)return;let o={observer:new MutationObserver(()=>o.dirty=!0),dirty:!1,fullLayout:t,options:n,context:i,structure:Z(e),timezone:(new Intl.DateTimeFormat).resolvedOptions().timeZone,month:12*e.context.selectedYear+e.context.selectedMonth,count:s.length};o.observer.observe(e.context.mainElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),K.set(e,o)}catch(t){B(e)}},ee=(e,t,n,i="")=>{t?e.getAttribute(n)!==i&&e.setAttribute(n,i):e.getAttribute(n)===i&&e.removeAttribute(n)},te=(t,n,i,s,o,a,l)=>{var c;let u=(_=a,Date.parse(`${_}T00:00:00`)),d=r(t),h=d.min>u||d.max1&&"multiple-ranged"===t.selectionDatesMode&&(t.context.selectedDates[0]===a&&t.context.selectedDates[t.context.selectedDates.length-1]===a?g="first-and-last":t.context.selectedDates[0]===a?g="first":t.context.selectedDates[t.context.selectedDates.length-1]===a&&(g="last"),t.context.selectedDates[0]!==a&&t.context.selectedDates[t.context.selectedDates.length-1]!==a&&(g="middle"))):i.hasAttribute("data-vc-date-selected")&&i.removeAttribute("aria-selected"),!d.disabled.set.has(a)&&t.enableEdgeDatesOnly&&t.context.selectedDates.length>1&&"multiple-ranged"===t.selectionDatesMode&&(u>d.first&&u{var i,s;let o=null==(i=e.disableWeekdays)?void 0:i.includes(n),a=e.disableAllDates&&!(null==(s=e.context.enableDates)||!s[0]),l=r(e);if((o||a)&&!l.enabled.set.has(t)&&!l.disabled.set.has(t)){let n=e.context.disableDates;if(l.disabled.set.add(t),e.onCreateDateEls)n.push(t),b(n),l.disabled.values=n.slice();else{let e=+new Date(t),i=0,s=n.length;for(;i>>1;+new Date(n[t])<=e?i=t+1:s=t}n.splice(i,0,t),l.disabled.values.splice(i,0,t)}}},oe=(t,n,i,s,a,l)=>{var r;let c,d=e(a).getDay(),h="string"==typeof t.locale&&t.locale.length?t.locale:"en",_=document.createElement("div");_.className=t.styles.date,_.dataset.vcDate=a,_.dataset.vcDateMonth=l,_.dataset.vcDateWeekDay=String(d),_.role="gridcell",("current"===l||t.displayDatesOutside)&&(c=document.createElement("button"),c.className=t.styles.dateBtn,c.type="button",c.dataset.vcDateBtn="",c.ariaLabel=((e,t)=>{let n=`${t}:${e}`,i=ae.get(n);if(void 0!==i)return i;let s=ne.get(t);s||(s=new Intl.DateTimeFormat(t,{dateStyle:"long",timeZone:"UTC"}),ne.size>=8&&ne.delete(ne.keys().next().value),ne.set(t,s));let o=s.format(new Date(`${e}T00:00:00.000Z`));return ae.size>=512&&ae.delete(ae.keys().next().value),ae.set(n,o),o})(a,h),c.innerText=String(s),_.appendChild(c)),t.enableWeekNumbers&&(null==(r=u(t).weeks)||r.date(t,_,a)),le(t,a,d),te(t,n,_,c,d,a,l),i.addDate(_),t.onCreateDateEls&&(t.onCreateDateEls(t,_),o(t))},re=[{container:'[data-vc="dates"]',item:"[data-vc-date-btn]",active:["[data-vc-date-selected] [data-vc-date-btn]","[data-vc-date-today] [data-vc-date-btn]"]},{container:'[data-vc="months"]',item:"[data-vc-months-month]",active:["[data-vc-months-month-selected]"]},{container:'[data-vc="years"]',item:"[data-vc-years-year]",active:["[data-vc-years-year-selected]"]}],ie=e=>!e.hasAttribute("disabled")&&"true"!==e.getAttribute("aria-disabled"),se=(e,t,n)=>{if(n&&ie(n))return e.querySelectorAll(`${t.item}:not([tabindex="-1"])`).forEach(e=>{e!==n&&(e.tabIndex=-1)}),void("0"!==n.getAttribute("tabindex")&&(n.tabIndex=0));let i=Array.from(e.querySelectorAll(t.item));if(!i[0])return;let s=((e,t,n)=>{var i;let s=t.active.map(t=>e.querySelector(t)).find(e=>!!e&&ie(e));return null==(i=null==s?n.find(ie):s)?n[0]:i})(e,t,i);i.forEach(e=>{let t=e===s?0:-1;e.getAttribute("tabindex")!==String(t)&&(e.tabIndex=t)})},ce=e=>{let t=e.target,n=re.find(e=>{var n;return null==(n=t.matches)?void 0:n.call(t,e.item)}),i=n?t.closest(n.container):null;n&&i&&se(i,n,t)},de=e=>{re.forEach(t=>{e.context.mainElement.querySelectorAll(t.container).forEach(e=>{e.closest("[data-vc-ghost]")||se(e,t,null)})})},ue=(e,n,i=!0)=>{var s;U(e);let a=new Date(e.context.selectedYear,e.context.selectedMonth,1),l=e.context.mainElement.querySelectorAll('[data-vc="dates"]'),r=u(e).weeks,c=e.enableWeekNumbers?e.context.mainElement.querySelectorAll('[data-vc-week="numbers"]'):[],d=null==(s=u(e).annotations)?void 0:s.prepare(e,l.length);l.forEach((i,s)=>{e.selectionDatesMode||(i.dataset.vcDatesDisabled="");let l=n?12*e.context.selectedYear+e.context.selectedMonth+s-n.month:-1;if(n&&l>=0&&l{v[T].appendChild(e),b++,b>=7&&(T++,b=0)}};((e,t,n,i,s)=>{let o=new Date(n,i,0).getDate()-(s-1),a=0===i?n-1:n,l=0===i?12:i<10?`0${i}`:i;for(let i=s;i>0;i--,o++)oe(e,n,t,o,`${a}-${l}-${o}`,"prev")})(e,y,_,h,m),((e,n,i,s,o)=>{for(let a=1;a<=i;a++){let i=new Date(s,o,a);oe(e,s,n,a,t(i),"current")}})(e,y,g,_,h),((e,t,n,i,s)=>{let o=s+1===12?i+1:i,a=s+1===12?"01":s+2<10?`0${s+2}`:s+2;for(let s=1;s<=n;s++){let n=`${o}-${a}-${s<10?`0${s}`:String(s)}`;oe(e,i,t,s,n,"next")}})(e,y,f,_,h);for(let e of v)i.appendChild(e);d?.(i),r?.numbers(e,m,g,c[s],i)}),de(e),i&&Q(e,null==n?void 0:n.fullLayout)},me=(e,t)=>`${R(e,"Years"===t?"year":void 0)}
\n
\n <#${t} />\n
\n
\n`,pe=e=>me(e,"Months"),he=e=>me(e,"Years"),ye=(e,t,n)=>e.labels["arrow"+("prev"===t?"Prev":"Next")][n],ge={ArrowNext:(e,t)=>``,ArrowPrev:(e,t)=>``,Dates:e=>`
`,Month:e=>``,Months:e=>`
`,Week:e=>`
`,Year:e=>``,Years:e=>`
`},fe=(e,t)=>t.replace(/[\n\t]/g,"").replace(/<#(?!\/?Multiple)(.*?)>/g,(t,n)=>{let i=(n.match(/\[(.*?)\]/)||[])[1],s=((e,t)=>{var n,i,s,o;return"Collapse"===t?null==(n=u(e).weeks)?void 0:n.component:"WeekNumbers"===t?null==(i=u(e).weeks)?void 0:i.numbersComponent:"DateRangeTooltip"===t?null==(s=u(e).annotations)?void 0:s.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=s?s(e,null==i?null:i):"";return e.sanitizerHTML(o)}).replace(/[\n\t]/g,""),xe=(e,t)=>{var n,i,s;let o=u(e),a={default:j,month:pe,year:he,multiple:null==(n=o.months)?void 0:n.layout,week:null==(i=o.weeks)?void 0:i.layout};var l;Object.keys(a).forEach(t=>{var n,i;let s=t;e.layouts[s].length||(e.layouts[s]=null==(n=null==(i=a[s])?void 0:i.call(a,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!=(s=o.months)&&s.render(e,t)||(null==(l=o.time)||l.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)},be=(e,t,n,i)=>{e.style.visibility=n?"hidden":"",t.style.visibility=i?"hidden":""},De=n=>{if("month"===n.context.currentType)return;let i=n.context.mainElement.querySelector('[data-vc-arrow="prev"]'),s=n.context.mainElement.querySelector('[data-vc-arrow="next"]');i&&s&&{default:()=>((n,i,s)=>{let o=e(t(new Date(n.context.selectedYear,n.context.selectedMonth,1))),a=new Date(o.getTime()),l=new Date(o.getTime());a.setMonth(a.getMonth()-n.monthsToSwitch),l.setMonth(l.getMonth()+n.monthsToSwitch);let r=e(n.context.dateMin),c=e(n.context.dateMax);n.selectionYearsMode||(r.setFullYear(o.getFullYear()),c.setFullYear(o.getFullYear())),be(i,s,!n.selectionMonthsMode||a.getFullYear()c.getFullYear()||l.getFullYear()===c.getFullYear()&&l.getMonth()>c.getMonth()-(n.context.displayMonthsCount-1))})(n,i,s),year:()=>((t,n,i)=>{let s=e(t.context.dateMin),o=e(t.context.dateMax);be(n,i,!!(s.getFullYear()&&t.context.displayYear-7<=s.getFullYear()),!!(o.getFullYear()&&t.context.displayYear+7>=o.getFullYear()))})(n,i,s),week:()=>{var e;return null==(e=u(n).weeks)?void 0:e.arrows(n,i,s)}}["multiple"===n.context.currentType?"default":n.context.currentType]()},Me=(e,t)=>{let n=e.context.mainElement.querySelectorAll('[data-vc="month"]'),i=e.context.mainElement.querySelectorAll('[data-vc="year"]'),s=new Date(e.context.selectedYear,e.context.selectedMonth,1);[n,i].forEach(n=>null==n?void 0:n.forEach((n,i)=>{(!t||t.includes(i))&&((e,t,n,i,s)=>{let o=new Date(i.setFullYear(e.context.selectedYear,e.context.selectedMonth+n)).getFullYear(),a=new Date(i.setMonth(e.context.selectedMonth+n)).getMonth(),l=e.context.locale.months.long[a],r=t.closest('[data-vc="column"]');r&&(r.ariaLabel=`${l} ${o}`);let c={month:{id:a,label:l},year:{id:o,label:o}};t.innerText=String(c[s].label),t.dataset[`vc${s.charAt(0).toUpperCase()+s.slice(1)}`]=String(c[s].id),t.ariaLabel=`${e.labels[s]} ${c[s].label}`;let u={month:e.selectionMonthsMode,year:e.selectionYearsMode},d=!1===u[s]||"only-arrows"===u[s];d&&(t.tabIndex=-1),t.disabled=d})(e,n,i,s,n.dataset.vc)}))},we=(e,t,n,i,s)=>{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 a,l;s&&(null==(a=e.context.mainElement.querySelectorAll({month:"[data-vc-months-month]",year:"[data-vc-years-year]"}[n]))||a.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)),i&&(t.setAttribute(o[n].selected,""),null==(l=t.parentElement)||l.setAttribute(o[n].aria,"true"))},Ee=(e,t,n,i,s,o,a,l)=>{let r="month"===t?"months":"years",c=document.createElement("div");c.className=e.styles[`${r}Cell`],c.setAttribute(`data-vc-${r}`,"cell"),c.role="gridcell";let u=n.cloneNode(!1);return u.className=e.styles["month"===t?"monthsMonth":"yearsYear"],u.innerText=a,u.ariaLabel=l,u.setAttribute(`data-vc-${r}-${t}`,String(o)),s&&(u.ariaDisabled="true"),s&&(u.tabIndex=-1),u.disabled=s,c.appendChild(u),we(e,u,t,i===o,!1),c},ke=(e,t)=>{var n,i;return null==(n=null==(i=u(e).months)?void 0:i.column(e,t))?{currentValue:null,columnID:0}:n},Te=(t,n)=>{var i;let s=null==n||null==(i=n.closest('[data-vc="header"]'))?void 0:i.querySelector('[data-vc="year"]'),o=s?Number(s.dataset.vcYear):t.context.selectedYear,a=null!=n&&n.dataset.vcMonth?Number(n.dataset.vcMonth):t.context.selectedMonth;g(t,"currentType","month"),xe(t,n),Me(t);let l=t.context.mainElement.querySelector('[data-vc="months"]');if(!t.selectionMonthsMode||!l)return;let r=t.monthsToSwitch>1?t.context.locale.months.long.map((e,n)=>a-t.monthsToSwitch*n).concat(t.context.locale.months.long.map((e,n)=>a+t.monthsToSwitch*n)).filter(e=>e>=0&&e<=12):Array.from(Array(12).keys()),c=document.createElement("button");c.type="button";let u,d=()=>({min:e(t.context.dateMin),max:e(t.context.dateMax),monthCount:t.context.displayMonthsCount-1,columnID:ke(t,"month").columnID}),h=t.onCreateMonthEls?void 0:d();for(let e=0;e<12;e++){e%4==0&&(u=document.createElement("div"),u.className=t.styles.monthsRow,u.dataset.vcMonths="row",u.role="row",l.appendChild(u));let{min:n,max:i,monthCount:s,columnID:_}=null==h?d():h,m=Ee(t,"month",c,a,o<=n.getFullYear()&&e=i.getFullYear()&&e>i.getMonth()-s+_||o>i.getFullYear()||e!==a&&!r.includes(e),e,t.context.locale.months.short[e],t.context.locale.months.long[e]);u?.appendChild(m),t.onCreateMonthEls&&t.onCreateMonthEls(t,m)}de(t)},Ae=e=>{var t;let n=e.selectedWeekends?[...e.selectedWeekends]:[],i=[...e.context.locale.weekdays.long].map((t,i)=>({id:i,titleShort:e.context.locale.weekdays.short[i],titleLong:t,isWeekend:n.includes(i)})),s=[...i.slice(e.firstWeekday),...i.slice(0,e.firstWeekday)],o=null==(t=u(e).weeks)?void 0:t.weekday(e),a=document.createElement(o?"div":"b");e.context.mainElement.querySelectorAll('[data-vc="week"]').forEach(t=>{s.forEach(n=>{let i=a.cloneNode(!1);i.className=e.styles.weekDay,i.role="columnheader",i.ariaLabel=n.titleLong,i.dataset.vcWeekDay=String(n.id),n.isWeekend&&(i.dataset.vcWeekDayOff=""),o?o(i,n.titleShort,n.titleLong):i.innerText=n.titleShort,t.appendChild(i)})})},Ce=(t,n)=>{let i=null!=n&&n.dataset.vcYear?Number(n.dataset.vcYear):t.context.selectedYear;g(t,"currentType","year"),xe(t,n),Me(t),De(t);let s=t.context.mainElement.querySelector('[data-vc="years"]');if(!t.selectionYearsMode||!s)return;let o="multiple"===t.type?t.context.selectedYear===i?0:1:0,a=document.createElement("button");a.type="button";let l,r=()=>[e(t.context.dateMin).getFullYear(),e(t.context.dateMax).getFullYear()],c=t.onCreateYearEls?void 0:r();for(let e=t.context.displayYear-7;eu,e,String(e),String(e));l?.appendChild(d),t.onCreateYearEls&&t.onCreateYearEls(t,d)}de(t)},Se=new WeakMap,$e=e=>{var t,n;let i="not all"!==window.matchMedia("(prefers-color-scheme)").media;var s,o;if(!i||"system"!==e.selectedTheme)return null==(s=(o=e.context).cleanupSystemTheme)||s.call(o),void(e.context.mainElement.dataset.vcTheme=i?e.selectedTheme:"light");let a=e.themeAttrDetect.length?document.querySelector(e.themeAttrDetect):null,l=e.themeAttrDetect.replace(/^.*\[(.+)\]/g,(e,t)=>t),r=Se.get(e);if((null==r?void 0:r.element)===a&&r.attr===l)return void r.update();null==(t=(n=e.context).cleanupSystemTheme)||t.call(n);let c,u=window.matchMedia("(prefers-color-scheme: dark)"),d=()=>{let t=null==a?void 0:a.getAttribute(l),n=!t||"system"===t;e.context.mainElement.dataset.vcTheme=n?u.matches?"dark":"light":t,n&&!c?u.addEventListener?(u.addEventListener("change",d),c=()=>u.removeEventListener("change",d)):(u.addListener(d),c=()=>u.removeListener(d)):!n&&c&&(c(),c=void 0)},h=a?((e,t,n)=>{let i=new MutationObserver(e=>{for(let i=0;ii.disconnect()})(a,l,d):void 0;Se.set(e,{element:a,attr:l,update:d}),g(e,"cleanupSystemTheme",()=>{h?.(),c?.(),Se.delete(e),g(e,"cleanupSystemTheme",void 0)}),d()};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 i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function Le(e){for(var t=1;t{let i=new Intl.DateTimeFormat(e,{[t]:n,timeZone:"UTC"});return Array.from({length:"weekday"===t?7:12},(e,n)=>{return(s=i.format(new Date(Date.UTC(1978,"month"===t?n:0,"weekday"===t?n+1:1)))).charAt(0).toUpperCase()+s.slice(1).replace(/\./,"");var s})},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,i,s;if(!(null!=(t=e.locale)&&null!=(t=t.weekdays)&&t.short[6]&&null!=(n=e.locale)&&null!=(n=n.weekdays)&&n.long[6]&&null!=(i=e.locale)&&null!=(i=i.months)&&i.short[11]&&null!=(s=e.locale)&&null!=(s=s.months)&&s.long[11]))throw Error(P);return void g(e,"locale",Le({},e.locale))}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 t of["weekdays","months"])for(let n of["short","long"])e.context.locale[t][n].push(...o[t][n])},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)},Fe=(t,n=!1)=>{o(t),t.context.mainElement.querySelectorAll("[data-vc-date]").forEach(i=>{let s=i.querySelector("[data-vc-date-btn]"),o=i.dataset.vcDate,a=e(o),l=a.getDay();n&&le(t,o,l);let r=n?i.dataset.vcDateMonth:"current";"prev"===r&&a.setMonth(a.getMonth()+1,1),"next"===r&&a.setMonth(a.getMonth()-1,1),te(t,n?a.getFullYear():t.context.selectedYear,i,s,l,o,r)}),de(t)},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"),i=e=>{let i=e.target.closest("button");if(!i||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key))return;let s,o=t.find(e=>i.matches(e.item)),a=o?i.closest(o.container):null;if(o&&a&&!a.closest("[data-vc-ghost]")&&n(i)){if("ArrowUp"===e.key||"ArrowDown"===e.key)s=((e,t,i,s)=>{var o;let a=i.closest(t.row);if(!a)return i;let l=Array.from(e.querySelectorAll(t.row)),r=l.indexOf(a),c=Array.from(a.children).indexOf(i.parentElement),u=l[r+s],d=null==u||null==(o=u.children[c])?void 0:o.querySelector(t.item);return d&&n(d)?d:i})(a,o,i,"ArrowUp"===e.key?-1:1);else{let t=Array.from(a.querySelectorAll(o.item)).filter(n),l=t.indexOf(i);if(-1===l)return;s="ArrowLeft"===e.key?t[Math.max(0,l-1)]:t[Math.min(t.length-1,l+1)]}e.preventDefault(),s?.focus()}};return e.context.mainElement.addEventListener("keydown",i),e.context.mainElement.addEventListener("focusin",ce),()=>{e.context.mainElement.removeEventListener("keydown",i),e.context.mainElement.removeEventListener("focusin",ce)}},_e='[data-vc="dates"]',Re=(e,t)=>"next"===e?t:-t,je=n=>{let i={selector:_e,shift:i=>((n,i)=>{let s=e(t(new Date(n.context.selectedYear,n.context.selectedMonth,1)));s.setMonth(s.getMonth()+Re(i,n.monthsToSwitch)),g(n,"selectedMonth",s.getMonth()),g(n,"selectedYear",s.getFullYear())})(n,i),render:(e,t)=>ue(n,t)};return{default:i,multiple:i,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]},ze=(e,t,n)=>{var i;let s=je(e);if(!s)return;let{mainElement:o}=e.context,a=o.contains(w(o).activeElement),l="multiple"===e.context.currentType?J(e,!0):void 0;U(e),s.shift(t);let r=l?null==(i=u(e).months)?void 0:i.rotate(e,l):void 0;r||(l=void 0),Me(e,r),De(e);let c=u(e).motion;c&&e.animation?c.navigate(e,s.selector,t,()=>s.render(n,l)):s.render(n,l),((e,t,n)=>{var i;let{mainElement:s}=e.context;if(!n||s.contains(w(s).activeElement))return;let o=s.querySelector(`[data-vc-arrow="${t}"]`);if(o&&"hidden"!==o.style.visibility)return o.focus();null==(i=Array.from(s.querySelectorAll('[tabindex="0"]')).find(e=>!e.closest("[data-vc-ghost]")))||i.focus()})(e,t,a)},Ke=(e,t,n)=>{let i=t.dataset.vcDate,s=t.closest("[data-vc-date][data-vc-date-selected]"),o=x(e);(!s||o)&&g(e,"selectedDates",s?e.context.selectedDates.filter(e=>e!==i):n?[...e.context.selectedDates,i]:[i])},Be=["month","year"],Ue='[data-vc="column"]',Xe=(e,t,n)=>{let i=u(e).motion;i&&e.animation?i.changeView(e,t,n):n()},Ge=(e,t)=>{var n;let{columnID:i}=ke(e,e.context.currentType);g(e,"currentType",e.type),Xe(e,i,()=>qe(e)),null==(n=e.context.mainElement.querySelector(`[data-vc="${t}"]`))||n.focus()},Ze=e=>{let t=t=>{var n,i;((e,t)=>{let n=t.target,i=n.closest("[data-vc-arrow]");i&&(ze(e,i.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,i=n.closest("[data-vc-date-btn]");if(!e.selectionDatesMode||!["single","multiple","multiple-ranged"].includes(e.selectionDatesMode)||!i)return;let s=i.closest("[data-vc-date]");({single:()=>Ke(e,s,!1),multiple:()=>Ke(e,s,!0),"multiple-ranged":()=>M(e,s)})[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"]'),a=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":a?"next":"current"]()})(e,t),((e,t)=>{let n={month:e.selectionMonthsMode,year:e.selectionYearsMode};Be.forEach(i=>{n[i]&&t.target&&((e,t,n)=>{let i=t.target,s=i.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,i),a={year:()=>Xe(e,o,()=>Ce(e,i)),month:()=>Xe(e,o,()=>Te(e,i))};if(s&&e.onClickTitle&&e.onClickTitle(e,t),s&&e.context.currentType!==n){let t=i.closest(Ue);return a[n](),((e,t,n)=>{var i;return null==(i=(null==n?e.context.mainElement:n).querySelector(`[data-vc-${t}s-${t}][tabindex="0"]`))?void 0:i.focus()})(e,n,t)}let l=i.closest(`[data-vc-${n}s-${n}]`);if(l)return((e,t,n,i)=>{({year:()=>{var t;if("multiple"===e.type)return null==(t=u(e).months)?void 0:t.select(e,"year",i);g(e,"selectedYear",Number(i.dataset.vcYearsYear))},month:()=>{var t;if("multiple"===e.type)return null==(t=u(e).months)?void 0:t.select(e,"month",i);g(e,"selectedMonth",Number(i.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,i,n,!0,!0):Ge(e,n)})(e,t,n,l);let r=i.closest('[data-vc="grid"]'),c=i.closest('[data-vc="column"]');(e.context.currentType===n&&s||"multiple"===e.type&&e.context.currentType===n&&r&&!c)&&Ge(e,n)})(e,t,i)})})(e,t),null==(i=u(e).weeks)||i.collapseClick(e,t)};return e.context.mainElement.addEventListener("click",t),()=>e.context.mainElement.removeEventListener("click",t)},Ve=new WeakMap,Je=(e,t)=>{let i=e[t].map(e=>e instanceof Date?e.getTime():e),s=Ve.get(e),o=null==s?void 0:s[t];if(o&&i.length===o.values.length){let e=0;for(;e1&&b(a),a.length>128&&a.length<=1e4&&i.length<=1e4){let n=null==s?{}:s;n[t]={values:i,dates:a.slice(),timezone:(new Intl.DateTimeFormat).resolvedOptions().timeZone},Ve.set(e,n)}else s&&delete s[t];return a},Qe=(e,t)=>"today"===e?(()=>{let e=new Date;return new Date(e.getTime()-6e4*e.getTimezoneOffset()).toISOString().substring(0,10)})():e instanceof Date||"number"==typeof e||"string"==typeof e?n([e])[0]:t,et=(e,t,n)=>{g(e,"selectedMonth",t),g(e,"selectedYear",n),g(e,"displayYear",n)},tt=t=>{var i,s;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,i,s;let o=Qe(t.dateMin,t.dateMin),a=Qe(t.dateMax,t.dateMax),l=Qe(t.displayDateMin,o),r=Qe(t.displayDateMax,a);if(g(t,"dateToday",Qe(t.dateToday,t.dateToday)),g(t,"displayDateMin",l?e(o)>=e(l)?o:l:o),g(t,"displayDateMax",r?e(a)<=e(r)?a:r:a),g(t,"displayDateMin",t.disableDatesPast&&!t.disableAllDates&&e(l)!e.has(t)))}null!=(s=t.context.enableDates)&&s[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?a:t.context.displayDateMax)})(t),(t=>{var i;if(t.enableJumpToSelectedDate&&null!=(i=t.selectedDates)&&i[0]&&void 0===t.selectedMonth&&void 0===t.selectedYear){let i=e(n(t.selectedDates)[0]);return void et(t,i.getMonth(),i.getFullYear())}if((t=>{let i=e=>{let n=new Date(e);et(t,n.getMonth(),n.getFullYear())};return t.displayDateMin&&"today"!==t.displayDateMin&&(s=t.displayDateMin,o=new Date,new Date(s).getTime()>o.getTime())?(i(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()=0&&Number(t.selectedMonth)<12,o=void 0!==t.selectedYear&&Number(t.selectedYear)>=0&&Number(t.selectedYear)<=9999;et(t,s?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==(i=u(t).weeks)||i.init(t),null==(s=u(t).time)||s.init(t)},nt=(e,{year:t,month:n,dates:i,time:s,locale:o},a=!0,l)=>{var r,c,d,h;U(e);let _=u(e);null==(r=_.motion)||r.reset(e),null==(c=_.time)||c.destroy(e),null==(d=_.annotations)||d.destroy(e),D(e);let m={year:e.selectedYear,month:e.selectedMonth,dates:e.selectedDates,time:e.selectedTime};var p;e.selectedYear=t?m.year:e.context.selectedYear,e.selectedMonth=n?m.month:e.context.selectedMonth,e.selectedTime=s?m.time:e.context.selectedTime,e.selectedDates="only-first"===i&&null!=(h=e.context.selectedDates)&&h[0]?[e.context.selectedDates[0]]:!0===i?m.dates:e.context.selectedDates,o&&g(e,"locale",{months:{short:[],long:[]},weekdays:{short:[],long:[]}}),tt(e),a&&(l&&Oe(e),l&&l.structure===Z(e)?($e(e),null==(p=_.time)||p.render(e),Fe(e,!0)):qe(e,!1)),e.selectedYear=m.year,e.selectedMonth=m.month,e.selectedDates=m.dates,e.selectedTime=m.time,"multiple-ranged"===e.selectionDatesMode&&M(e,null,!!i),a&&Q(e,!0)},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)},lt=["extensions","context","init","update","destroy","show","hide","set","queryAndMemoize"],ot=(e,t,n=!0)=>{let i=Object.keys(t);for(let s=0;s{var n;if("multiple"!==e.type)return{currentValue:null,columnID:0};let i=e.context.mainElement.querySelectorAll('[data-vc="column"]'),s=Array.from(i).findIndex(e=>e.closest(`[data-vc-column="${t}"]`));return{currentValue:s>=0?Number(null==(n=i[s].querySelector(`[data-vc="${t}"]`))?void 0:n.getAttribute(`data-vc-${t}`)):null,columnID:Math.max(s,0)}},ht=(e,t,n)=>{let{currentValue:i,columnID:s}=pt(e,t);return"month"===e.context.currentType&&s>=0?n-s:"year"===e.context.currentType&&e.context.selectedYear!==i?n-1:n},vt=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 i=Array(e.context.displayMonthsCount).fill(n).join("");return e.sanitizerHTML(i)}).replace(/[\n\t]/g,""))(e,fe(e,e.layouts.multiple))),!0;if("multiple"!==e.type||!t)return!1;let i=e.context.mainElement.querySelector('[data-vc="controls"]'),s=e.context.mainElement.querySelector('[data-vc="grid"]'),o=t.closest('[data-vc="column"]');return i&&i.remove(),s&&(s.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,i)=>"month"===n?((t,n)=>{let i=n.closest('[data-vc-column="month"]').querySelector('[data-vc="year"]'),s=ht(t,"month",Number(n.dataset.vcMonthsMonth)),o=Number(i.dataset.vcYear),a=e(t.context.dateMin),l=e(t.context.dateMax),r=sl.getMonth()&&o>=l.getFullYear();g(t,"selectedYear",o),g(t,"selectedMonth",r?a.getMonth():c?l.getMonth():s)})(t,i):((t,n)=>{let i=ht(t,"year",Number(n.dataset.vcYearsYear)),s=e(t.context.dateMin),o=e(t.context.dateMax),a=t.context.displayMonthsCount-1,{columnID:l}=pt(t,"year"),r=t.context.selectedMontho.getMonth()-a+l&&i>=o.getFullYear(),u=io.getFullYear(),h=r||u?s.getFullYear():c||d?o.getFullYear():i,_=r||u?s.getMonth():c||d?o.getMonth()-a+l:t.context.selectedMonth;g(t,"selectedYear",h),g(t,"selectedMonth",_)})(t,i),rotate:(e,t)=>{var n;let i=12*e.context.selectedYear+e.context.selectedMonth-t.month;if(!i||Math.abs(i)>=t.count)return;let s=Array.from(e.context.mainElement.querySelectorAll('[data-vc="column"]')),o=null==(n=s[0])?void 0:n.parentElement;if(!o||s.length!==t.count||s.some(e=>e.parentElement!==o)||Array.from(o.childNodes).some(e=>{var t;return 1===e.nodeType?!s.includes(e):3!==e.nodeType||!(null==(t=e.textContent)||!t.trim())}))return;let a=[];if(i>0){let e=s[s.length-1].nextSibling;for(let n=0;n(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 i=w(e.context.mainElement),s=i===document?document.body:i;g(e,"inputModeInit",!0),g(e,"isShowInInputMode",!1),g(e,"mainElement",n),s.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 i="function"==typeof e.openOnFocus||!0===e.openOnFocus,s=()=>{(e=>E.has(e))(e)?(e=>{E.delete(e)})(e):(e=>f(e,e.openOnFocus))(e)&&n()};i&&e.context.inputElement.addEventListener("focus",s);let o=t=>{let n="Tab"===t.key&&!t.shiftKey,i=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key);(n||i)&&(t=>{var n;if(!e.context.isShowInInputMode||w(e.context.mainElement).activeElement!==e.context.inputElement)return!1;let i=e=>e.tabIndex>=0&&!e.hasAttribute("disabled")&&"true"!==e.getAttribute("aria-disabled"),s=null==(n=document.createTreeWalker(e.context.mainElement,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>i(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}).nextNode())?i(e.context.mainElement)?e.context.mainElement:null:n;!s||s.tabIndex<0||(t.preventDefault(),s.focus())})(t)};return e.context.inputElement.addEventListener("keydown",o),()=>{t.removeEventListener("click",n),i&&t.removeEventListener("focus",s),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,i,s,o,a,r,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 h,_,m,p,E;null==(t=d.motion)||t.destroy(e),null==(n=d.time)||n.destroy(e),null==(i=d.annotations)||i.destroy(e),D(e),(e=>{l.delete(e)})(e),H(e),null==(s=(o=e.context).cleanupInput)||s.call(o),g(e,"cleanupInput",void 0),null==(a=e.context.cleanupHandlers)||a.forEach(e=>e()),g(e,"cleanupHandlers",[]),g(e,"isShowInInputMode",!1),null==(r=(c=e.context).cleanupSystemTheme)||r.call(c),e.inputMode?(e.context.mainElement!==e.context.inputElement&&(null==(m=e.context.mainElement.parentElement)||m.removeChild(e.context.mainElement)),null==(h=e.context.inputElement)||null==(_=h.replaceWith)||_.call(h,e.context.originalElement),g(e,"inputElement",void 0)):null==(p=(E=e.context.mainElement).replaceWith)||p.call(E,e.context.originalElement),g(e,"mainElement",e.context.originalElement),g(e,"isDestroyed",!0),e.onDestroy&&e.onDestroy(e)})(this),t)for(let[n,i]of e.memoizedElements)i===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 i=Object.keys(t);t.extensions&&i.splice(i.indexOf("extensions"),1);let s=1===i.length&&"selectedDates"===i[0]?J(e):void 0;ot(e,t),e.context.isInit&&at(e,n,s)})(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==(o=e.memoizedElements.get(t))?this.queryAndMemoize(t):o:t);let a=null==n?void 0:n.extensions;this.extensions=null!=a&&a.length?Object.freeze(Array.from(new Set(a))):d,(e=>{if(!e.extensions.length)return;let t={};for(let n of e.extensions){let e=n,s=e.name;if(!i.includes(s))throw Error("Unknown calendar extension.");if(t[s]&&t[s]!==e)throw Error(`Conflicting calendar extension: ${s}.`);Object.assign(t,{[s]: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",new Map);const NAME$15="datepicker",EVENT_KEY$12=".bs.datepicker",DATA_API_KEY$7=".data-api",EVENT_CHANGE$2=`change${EVENT_KEY$12}`,EVENT_SHOW$4=`show${EVENT_KEY$12}`,EVENT_SHOWN$3=`shown${EVENT_KEY$12}`,EVENT_HIDE$3=`hide${EVENT_KEY$12}`,EVENT_HIDDEN$5=`hidden${EVENT_KEY$12}`,EVENT_FOCUSIN$3=`focusin${EVENT_KEY$12}`,EVENT_POINTERDOWN$2=`pointerdown${EVENT_KEY$12}`,EVENT_CLICK$4=`click${EVENT_KEY$12}`,EVENT_CLICK_DATA_API$3=`click${EVENT_KEY$12}.data-api`,EVENT_FOCUSIN_DATA_API=`focusin${EVENT_KEY$12}.data-api`,SELECTOR_DATA_TOGGLE$6='[data-bs-toggle="datepicker"]',HIDE_DELAY=100,Default$14={datepickerTheme:null,dateMin:null,dateMax:null,dateFormat:null,displayElement:null,displayMonthsCount:1,firstWeekday:1,inline:!1,locale:"default",positionElement:null,selectedDates:[],selectionMode:"single",placement:"left",vcpOptions:{}},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"};var Datepicker=class extends BaseComponent{constructor(e,t){super(e,t),this._calendar=null,this._isShown=!1,this._initCalendar()}static get Default(){return Default$14}static get DefaultType(){return DefaultType$14}static get NAME(){return NAME$15}toggle(){return this._config.inline?Promise.resolve():this._isShown?this.hide():this.show()}async show(){this._config.inline||!this._calendar||isDisabled(this._element)||this._isShown||EventHandler.trigger(this._element,EVENT_SHOW$4).defaultPrevented||(this._calendar.show(),this._isShown=!0,EventHandler.trigger(this._element,EVENT_SHOWN$3))}async hide(){this._config.inline||this._calendar&&this._isShown&&(EventHandler.trigger(this._element,EVENT_HIDE$3).defaultPrevented||(this._calendar.hide(),this._isShown=!1,EventHandler.trigger(this._element,EVENT_HIDDEN$5)))}dispose(){this._themeObserver&&(this._themeObserver.disconnect(),this._themeObserver=null),this._onOutside&&(EventHandler.off(document,EVENT_FOCUSIN$3,this._onOutside),EventHandler.off(document,EVENT_POINTERDOWN$2,this._onOutside)),this._onTriggerClick&&EventHandler.off(this._positionElement,EVENT_CLICK$4,this._onTriggerClick),this._calendar&&this._calendar.destroy(),this._calendar=null,super.dispose()}getSelectedDates(){const e=this._calendar?.context?.selectedDates;return e?[...e]:[]}setSelectedDates(e){this._calendar&&(this._calendar.set({selectedDates:e}),this._syncSelectedDates([...this._calendar.context.selectedDates]))}_initCalendar(){this._isInput="INPUT"===this._element.tagName,this._isInline=this._config.inline,this._isInline&&!this._isInput&&(this._boundInput=this._element.querySelector('input[type="hidden"], input[name]')),this._positionElement=this._resolvePositionElement(),this._displayElement=this._resolveDisplayElement();const e=this._buildCalendarOptions();this._calendar=new on(this._positionElement,e),this._calendar.init(),this._setupThemeObserver(),this._setupDismiss(),this._isInput&&this._element.value&&this._parseInputValue(),this._updateDisplayWithSelectedDates()}_updateDisplayWithSelectedDates(){const e=[...this._calendar?.context.selectedDates||[]],t=e.length>0?e:this._config.selectedDates;t.length>0&&this._syncSelectedDates(t)}_syncSelectedDates(e){const t=this._formatDateForInput(e);this._isInput&&(this._element.value=t),this._boundInput&&(this._boundInput.value=e.join(",")),this._displayElement&&(this._displayElement.textContent=t)}_resolvePositionElement(){let{positionElement:e}=this._config;if("string"==typeof e&&(e=document.querySelector(e)),!e&&this._isInput&&!this._isInline){const t=this._element.closest(".form-adorn");t&&(e=t)}return e||this._element}_resolveDisplayElement(){const{displayElement:e}=this._config;return"string"==typeof e?document.querySelector(e):!0===e||null===e&&!this._isInput&&!this._isInline?this._element.querySelector("[data-bs-datepicker-display]")||this._element:e}_getThemeAncestor(){return void 0===this._themeAncestor&&(this._themeAncestor=this._element.closest("[data-bs-theme]")),this._themeAncestor}_getEffectiveTheme(){const{datepickerTheme:e}=this._config;return e||this._getThemeAncestor()?.getAttribute("data-bs-theme")||null}_syncThemeAttribute(e){if(!e)return;const t=this._getEffectiveTheme();t?e.setAttribute("data-bs-theme",t):e.removeAttribute("data-bs-theme")}_setupThemeObserver(){const e=this._getThemeAncestor();e&&!this._config.datepickerTheme&&(this._themeObserver=new MutationObserver(()=>{this._syncThemeAttribute(this._calendar?.context?.mainElement)}),this._themeObserver.observe(e,{attributes:!0,attributeFilter:["data-bs-theme"]}))}_setupDismiss(){this._isInline||(this._isInput||(this._onTriggerClick=()=>{this._isShown||this._calendar?.hide()},EventHandler.on(this._positionElement,EVENT_CLICK$4,this._onTriggerClick)),this._onOutside=({target:e})=>{const t=this._calendar?.context?.mainElement,n=!(e instanceof Node)||!this._element.contains(e)&&!t?.contains(e);this._isShown&&n&&this.hide()},EventHandler.on(document,EVENT_FOCUSIN$3,this._onOutside),EventHandler.on(document,EVENT_POINTERDOWN$2,this._onOutside))}_buildCalendarOptions(){const e=this._getEffectiveTheme(),t=e&&"auto"!==e?e:"system",n={...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:t,themeAttrDetect:"[data-bs-theme]",onClickDate:(e,t)=>this._handleDateClick(e,t),onInit:e=>{this._syncThemeAttribute(e.context.mainElement)},onShow:()=>{this._calendar&&(this._isShown=!0,this._syncThemeAttribute(this._calendar.context.mainElement))},onHide:()=>{this._isShown=!1}};if(this._config.selectedDates.length>0){const e=this._parseDate(this._config.selectedDates[0]);n.selectedMonth=e.getMonth(),n.selectedYear=e.getFullYear()}return this._config.dateMin&&(n.dateMin=this._config.dateMin),this._config.dateMax&&(n.dateMax=this._config.dateMax),n}_handleDateClick(e,t){const n=[...e.context.selectedDates];this._syncSelectedDates(n),EventHandler.trigger(this._element,EVENT_CHANGE$2,{dates:n,event:t}),this._maybeHideAfterSelection(n)}_maybeHideAfterSelection(e){this._isInline||("single"===this._config.selectionMode&&e.length>0||"multiple-ranged"===this._config.selectionMode&&e.length>=2)&&setTimeout(()=>this.hide(),100)}_parseDate(e){const[t,n,i]=e.split("-");return new Date(t,n-1,i)}_formatDate(e){const t=this._parseDate(e),n="default"===this._config.locale?void 0:this._config.locale,{dateFormat:i}=this._config;return"function"==typeof i?i(t,n):i&&"object"==typeof i?new Intl.DateTimeFormat(n,i).format(t):t.toLocaleDateString(n)}_formatDateForInput(e){if(0===e.length)return"";if(1===e.length)return this._formatDate(e[0]);const t="multiple-ranged"===this._config.selectionMode?" – ":", ";return e.map(e=>this._formatDate(e)).join(t)}_parseInputValue(){const e=this._element.value.trim();if(!e)return;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e),n=t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):new Date(e);if(!Number.isNaN(n.getTime())){const e=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`;this._calendar.set({selectedDates:[e]})}}};EventHandler.on(document,EVENT_CLICK_DATA_API$3,SELECTOR_DATA_TOGGLE$6,function(e){"INPUT"!==this.tagName&&"true"!==this.dataset.bsInline&&(e.preventDefault(),Datepicker.getOrCreateInstance(this).toggle())}),EventHandler.on(document,EVENT_FOCUSIN_DATA_API,SELECTOR_DATA_TOGGLE$6,function(){"INPUT"===this.tagName&&Datepicker.getOrCreateInstance(this).show()}),EventHandler.on(document,`DOMContentLoaded${EVENT_KEY$12}.data-api`,()=>{const e=`${SELECTOR_DATA_TOGGLE$6}[data-bs-inline="true"], ${SELECTOR_DATA_TOGGLE$6}[data-bs-selected-dates]`;for(const t of document.querySelectorAll(e))Datepicker.getOrCreateInstance(t)});const CLASS_NAME_OPEN="dialog-open";var DialogBase=class extends BaseComponent{constructor(e,t){super(e,t),this._isTransitioning=!1,this._openedAsModal=!1,this._addDialogListeners()}static get NAME(){return"dialogbase"}toggle(e){return this._element.open?this.hide():this.show(e)}async show(e){this._canShow(e)&&await this._show(e)}async hide(){this._canHide()&&await this._hide()}_canShow(e){return!this._element.open&&!this._isTransitioning&&!EventHandler.trigger(this._element,this.constructor.eventName("show"),{relatedTarget:e}).defaultPrevented}async _show(e){this._isTransitioning=!0,this._onBeforeShow();const{modal:t,preventBodyScroll:n}=this._getShowOptions();this._showElement({modal:t,preventBodyScroll:n}),await this._queueCallback(()=>{this._isTransitioning=!1,EventHandler.trigger(this._element,this.constructor.eventName("shown"),{relatedTarget:e})},this._element,this._isAnimated())}_canHide(){return!(!this._element.open||this._isTransitioning||EventHandler.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented)}async _hide(){this._isTransitioning=!0,this._hideElement(),await this._queueCallback(()=>{this._element.open&&this._closeAndCleanup(),this._element.classList.remove("hiding"),this._onAfterHide(),this._isTransitioning=!1,EventHandler.trigger(this._element,this.constructor.eventName("hidden"))},this._element,this._isAnimated())}dispose(){this._element.open&&this._closeAndCleanup(),EventHandler.off(this._element,"cancel",this._cancelHandler),super.dispose()}_getShowOptions(){return{modal:!0,preventBodyScroll:!0}}_onBeforeShow(){}_onAfterHide(){}_isAnimated(){return!this._element.classList.contains(this._getInstantClassName())}_getInstantClassName(){return"dialog-instant"}_getStaticClassName(){return"dialog-static"}_onCancel(){}_showElement({modal:e=!0,preventBodyScroll:t=!0}={}){this._openedAsModal=e,e?this._element.showModal():this._element.show(),t&&document.documentElement.classList.add("dialog-open")}_hideElement(){this._hideChildComponents(),this._element.classList.add("hiding"),this._shouldDeferClose()||this._closeAndCleanup()}_closeAndCleanup(){this._element.close(),this._openedAsModal=!1,document.querySelector("dialog[open]:modal")||document.documentElement.classList.remove("dialog-open")}_shouldDeferClose(){return!1}_triggerBackdropTransition(){if(EventHandler.trigger(this._element,this.constructor.eventName("hidePrevented")).defaultPrevented)return;const e=this._getStaticClassName();this._element.classList.add(e),this._queueCallback(()=>{this._element.classList.remove(e)},this._element)}_hideChildComponents(){for(const e of SelectorEngine.find('[data-bs-toggle="tooltip"], [data-bs-toggle="popover"]',this._element)){const t=data_default.getAny(e);t&&"function"==typeof t.hide&&t.hide()}for(const e of SelectorEngine.find(".toast.show",this._element)){const t=data_default.getAny(e);t&&"function"==typeof t.hide&&t.hide()}}_addDialogListeners(){const e=this.constructor.EVENT_KEY;this._cancelHandler=e=>{e.preventDefault(),this._config.keyboard?(this._onCancel(),this.hide()):this._triggerBackdropTransition()},EventHandler.on(this._element,"cancel",this._cancelHandler),EventHandler.on(this._element,`keydown${e}`,e=>{"Escape"!==e.key||this._openedAsModal||(e.preventDefault(),this._config.keyboard&&(this._onCancel(),this.hide()))}),EventHandler.on(this._element,`click${e}`,e=>{e.target===this._element&&this._openedAsModal&&!1!==this._config.backdrop&&("static"!==this._config.backdrop?this.hide():this._triggerBackdropTransition())})}};const NAME$14="dialog",EVENT_KEY$11=".bs.dialog",DATA_API_KEY$6=".data-api",EVENT_SHOW$3="show.bs.dialog",EVENT_HIDDEN$4="hidden.bs.dialog",EVENT_CANCEL="cancel.bs.dialog",EVENT_CLICK_DATA_API$2="click.bs.dialog.data-api",CLASS_NAME_NONMODAL="dialog-nonmodal",CLASS_NAME_INSTANT$1="dialog-instant",CLASS_NAME_SWAP_IN="dialog-swap-in",SELECTOR_DATA_TOGGLE$5='[data-bs-toggle="dialog"]',Default$13={backdrop:!0,keyboard:!0,modal:!0},DefaultType$13={backdrop:"(boolean|string)",keyboard:"boolean",modal:"boolean"};var Dialog=class e extends DialogBase{constructor(e,t){super(e,t)}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(t){e._handleDataApiClick(this,t)})}static _handleDataApiClick(t,n){const i=SelectorEngine.getElementFromSelector(t);if(!i)return;["A","AREA"].includes(t.tagName)&&n.preventDefault();const s=Manipulator.getDataAttributes(t),o=t.closest("dialog[open]");if(!o||o===i)return EventHandler.one(i,EVENT_SHOW$3,n=>{n.defaultPrevented||e._registerFocusRestoration(i,t)}),void e.getOrCreateInstance(i,s).toggle(t);if(o.classList.contains("dialog-swap-in"))return;const a=e.getOrCreateInstance(i,s),l=e.getOrCreateInstance(o);a._canShow(t)&&l._canHide()&&(e._registerFocusRestoration(i,t),i.classList.add("dialog-swap-in"),EventHandler.one(i,"shown.bs.dialog",()=>{i.classList.remove("dialog-swap-in")}),a._show(t),o.classList.add("dialog-instant"),EventHandler.one(o,EVENT_HIDDEN$4,()=>{o.classList.remove("dialog-instant")}),l._hide())}static _registerFocusRestoration(e,t){EventHandler.one(e,EVENT_HIDDEN$4,()=>{isVisible(t)&&t.focus({preventScroll:!0})})}handleUpdate(){}_getShowOptions(){return{modal:this._config.modal,preventBodyScroll:this._config.modal}}_onBeforeShow(){this._config.modal||this._element.classList.add("dialog-nonmodal")}_onAfterHide(){this._element.classList.remove("dialog-nonmodal")}_shouldDeferClose(){return this._isAnimated()}_onCancel(){EventHandler.trigger(this._element,EVENT_CANCEL)}};enableDismissTrigger(Dialog);const ARIA_ATTRIBUTE_PATTERN=/^aria-[\w-]*$/i,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:[]},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:[]},uriAttributes=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),SAFE_URL_PATTERN=/^(?!(?:javascript|data|vbscript):)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,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,allowedAttribute=(e,t)=>{const n=e.nodeName.toLowerCase();return t.includes(n)?!uriAttributes.has(n)||Boolean(SAFE_URL_PATTERN.test(e.nodeValue)||DATA_URL_PATTERN.test(e.nodeValue)):t.filter(e=>e instanceof RegExp).some(e=>e.test(n))};function sanitizeHtml(e,t,n){if(!e.length)return e;if(n&&"function"==typeof n)return n(e);const i=(new window.DOMParser).parseFromString(e,"text/html"),s=[...i.body.querySelectorAll("*")];for(const e of s){const n=e.nodeName.toLowerCase();if(!Object.keys(t).includes(n)){e.remove();continue}const i=[...e.attributes],s=[...t["*"]||[],...t[n]||[]];for(const t of i)allowedAttribute(t,s)||e.removeAttribute(t.nodeName)}return i.body.innerHTML}const NAME$13="navoverflow",EVENT_KEY$10=".bs.navoverflow",EVENT_UPDATE=`update${EVENT_KEY$10}`,EVENT_OVERFLOW=`overflow${EVENT_KEY$10}`,EVENT_RESIZE$2=`resize${EVENT_KEY$10}`,CLASS_NAME_OVERFLOW="nav-overflow",CLASS_NAME_OVERFLOW_MENU="nav-overflow-menu",CLASS_NAME_HIDDEN="d-none",CLASS_NAME_KEEP="nav-overflow-keep",CLASS_NAME_INITIALIZED="nav-overflow-initialized",CLASS_NAME_SUBMENU="submenu",CLASS_NAME_SHOW$3="show",SELECTOR_NAV=".nav",SELECTOR_NAV_ITEM=".nav-item",SELECTOR_NAV_LINK=".nav-link",SELECTOR_OVERFLOW_TOGGLE=".nav-overflow-toggle",SELECTOR_OVERFLOW_MENU=".nav-overflow-menu",SELECTOR_CUSTOM_ICON="[data-bs-overflow-icon]",SELECTOR_MENU$1=".menu",SELECTOR_MENU_TOGGLE$2='[data-bs-toggle="menu"]',DEFAULT_TEXT="More",Default$12={collapseBelow:0,iconPlacement:"start",menuPlacement:"bottom-end",menuStrategy:"absolute",moreText:"More",moreIcon:'',threshold:0},DefaultType$12={collapseBelow:"(number|string)",iconPlacement:"string",menuPlacement:"string",menuStrategy:"string",moreText:"(string|boolean)",moreIcon:"string",threshold:"number"};var NavOverflow=class extends BaseComponent{constructor(e,t){super(e,t);const n=SelectorEngine.findOne(".nav",this._element);if(!n)throw new TypeError(`${this._element.outerHTML} has no child .nav to collapse`);this._nav=n,this._items=[],this._overflowItems=[],this._overflowMenu=null,this._overflowToggle=null,this._resizeObserver=null,this._resizeHandler=null,this._collapseBelow=0,this._itemMenus=new Map,this._relocatedMenus=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(){this._resizeObserver&&this._resizeObserver.disconnect(),this._resizeHandler&&EventHandler.off(window,EVENT_RESIZE$2,this._resizeHandler),this._restoreItems(),this._overflowToggle&&this._overflowToggle.parentElement&&this._overflowToggle.parentElement.remove(),super.dispose()}_init(){this._element.classList.add("nav-overflow"),this._items=SelectorEngine.find(".nav-item",this._nav).filter(e=>!e.querySelector(".nav-overflow-toggle"));for(const[e,t]of this._items.entries()){t.dataset.bsNavOrder=e;const n=SelectorEngine.findOne(".nav-link",t);n?.matches(SELECTOR_MENU_TOGGLE$2)&&this._findItemMenu(t,n)}this._collapseBelow=this._resolveCollapseBelow(),this._createOverflowMenu(),this._setupResizeObserver(),this._calculateOverflow(),this._element.classList.add(CLASS_NAME_INITIALIZED)}_createOverflowMenu(){if(this._overflowToggle=SelectorEngine.findOne(".nav-overflow-toggle",this._element),this._overflowToggle)return void(this._overflowMenu=SelectorEngine.findOne(".nav-overflow-menu",this._element));const{moreText:e}=this._config,t="string"==typeof e?e:"",n=document.createElement("li");n.className="nav-item nav-overflow-item";const i=document.createElement("button");i.type="button",i.className="nav-link nav-overflow-toggle",i.setAttribute("data-bs-toggle","menu"),i.setAttribute("data-bs-placement",this._config.menuPlacement),i.setAttribute("data-bs-strategy",this._config.menuStrategy),i.setAttribute("aria-expanded","false"),""===t&&i.setAttribute("aria-label","More");const s=document.createElement("span");if(s.className="nav-overflow-icon",s.innerHTML=sanitizeHtml(this._resolveIcon(),DefaultIconAllowlist),""===t)i.append(s);else{const e=document.createElement("span");e.className="nav-overflow-text",e.textContent=t,"end"===this._config.iconPlacement?i.append(e,s):i.append(s,e)}const o=document.createElement("div");o.className="nav-overflow-menu menu",n.append(i,o),this._nav.append(n),this._overflowToggle=i,this._overflowMenu=o}_resolveIcon(){const e=SelectorEngine.findOne(SELECTOR_CUSTOM_ICON,this._element);if(!e)return this._config.moreIcon;const t=e.cloneNode(!0);t.removeAttribute("data-bs-overflow-icon");const n=t.outerHTML;return e.remove(),n}_resolveCollapseBelow(){const e=this._config.collapseBelow;if("number"==typeof e)return e;if("string"==typeof e&&""!==e){const t=getComputedStyle(document.documentElement).getPropertyValue(`--bs-breakpoint-${e}`);return Number.parseFloat(t)||0}return 0}_setupResizeObserver(){if("undefined"==typeof ResizeObserver)return this._resizeHandler=()=>this._calculateOverflow(),void EventHandler.on(window,EVENT_RESIZE$2,this._resizeHandler);this._resizeObserver=new ResizeObserver(()=>{this._calculateOverflow()}),this._resizeObserver.observe(this._element)}_availableWidth(){const{paddingInlineStart:e,paddingInlineEnd:t}=getComputedStyle(this._element),n=(Number.parseFloat(e)||0)+(Number.parseFloat(t)||0);return this._element.clientWidth-n}_navGap(){return Number.parseFloat(getComputedStyle(this._nav).columnGap)||0}_calculateOverflow(){this._restoreItems();const e=this._availableWidth(),t=this._overflowToggle?.closest(".nav-item")??null,n=this._items.filter(e=>!e.classList.contains(CLASS_NAME_KEEP));if(this._collapseBelow>0&&ee.classList.contains(CLASS_NAME_KEEP)).reduce((e,t)=>e+t.offsetWidth+i,0)-(t?t.offsetWidth+i:0);let o=0,a=[];for(const e of n)o+=e.offsetWidth+i,o>s+1&&a.push(e);this._items.length-a.lengththis._config.threshold&&(a=this._items.slice(this._config.threshold).filter(e=>!e.classList.contains(CLASS_NAME_KEEP))),this._applyOverflow(a,t)}_applyOverflow(e,t){this._moveToOverflow(e),t?.classList.toggle("d-none",0===e.length),e.length>0&&EventHandler.trigger(this._element,EVENT_OVERFLOW,{overflowCount:e.length,visibleCount:this._items.length-e.length})}_moveToOverflow(e){if(this._overflowMenu){this._overflowMenu.replaceChildren(),this._overflowItems=[];for(const t of e){const e=SelectorEngine.findOne(".nav-link",t);if(!e)continue;const n=this._findItemMenu(t,e);n&&e.matches(SELECTOR_MENU_TOGGLE$2)?this._overflowMenu.append(this._relocateAsSubmenu(t,e,n)):this._overflowMenu.append(this._cloneAsMenuItem(e)),t.classList.add("d-none"),t.dataset.bsNavOverflow="true",this._overflowItems.push(t)}}}_relocateAsSubmenu(e,t,n){this._resetMenu(t,n),e.classList.remove("show"),this._relocatedMenus.set(e,{menu:n,parent:n.parentNode,nextSibling:n.nextSibling});const i=document.createElement("div");return i.className="submenu",i.append(this._cloneAsMenuItem(t,!0),n),i}_cloneAsMenuItem(e,t=!1){const n=e.cloneNode(!0);if(n.className="menu-item",n.removeAttribute("id"),e.classList.contains("active")&&n.classList.add("active"),(e.classList.contains("disabled")||e.hasAttribute("disabled"))&&n.classList.add("disabled"),t){for(const e of n.getAttributeNames())e.startsWith("data-bs-")&&"data-bs-theme"!==e&&n.removeAttribute(e);n.removeAttribute("href"),n.setAttribute("aria-haspopup","true"),n.setAttribute("aria-expanded","false"),"A"===n.tagName&&(n.setAttribute("role","button"),n.hasAttribute("tabindex")||n.setAttribute("tabindex","0"))}return n}_findItemMenu(e,t){const n=SelectorEngine.next(t,".menu")[0];if(n&&!n.classList.contains("nav-overflow-menu"))return this._itemMenus.set(e,n),n;const i=SelectorEngine.findOne(".menu",e);if(i&&!i.classList.contains("nav-overflow-menu"))return this._itemMenus.set(e,i),i;const s=this._itemMenus.get(e);return s?.isConnected?s:(this._itemMenus.delete(e),null)}_resetMenu(e,t){Menu.getInstance(e)?.dispose(),e.classList.remove("show"),e.setAttribute("aria-expanded","false"),e.parentElement?.classList.remove("show"),t.classList.remove("show")}_restoreRelocatedMenus(){for(const{menu:e,parent:t,nextSibling:n}of this._relocatedMenus.values())n?n.before(e):t.append(e);this._relocatedMenus.clear()}_restoreItems(){this._overflowToggle&&this._overflowMenu&&(this._resetMenu(this._overflowToggle,this._overflowMenu),this._overflowToggle.closest(".nav-item")?.classList.remove("show")),this._restoreRelocatedMenus();for(const e of this._items)e.classList.remove("d-none"),delete e.dataset.bsNavOverflow;this._overflowToggle?.closest(".nav-item")?.classList.remove("d-none"),this._overflowMenu?.replaceChildren(),this._overflowItems=[]}};EventHandler.on(document,"DOMContentLoaded",()=>{for(const e of SelectorEngine.find('[data-bs-toggle="nav-overflow"]'))NavOverflow.getOrCreateInstance(e)});const NAME$12="swipe",EVENT_KEY$9=".bs.swipe",EVENT_TOUCHSTART="touchstart.bs.swipe",EVENT_TOUCHMOVE="touchmove.bs.swipe",EVENT_TOUCHEND="touchend.bs.swipe",EVENT_POINTERDOWN$1="pointerdown.bs.swipe",EVENT_POINTERUP$1="pointerup.bs.swipe",POINTER_TYPE_TOUCH="touch",POINTER_TYPE_PEN="pen",CLASS_NAME_POINTER_EVENT="pointer-event",SWIPE_THRESHOLD=40,Default$11={endCallback:null,leftCallback:null,rightCallback:null,upCallback:null,downCallback:null},DefaultType$11={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)",upCallback:"(function|null)",downCallback:"(function|null)"};var Swipe=class e extends Config{constructor(t,n){super(),this._element=t,t&&e.isSupported()&&(this._config=this._getConfig(n),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"swipe"}dispose(){EventHandler.off(this._element,".bs.swipe")}_start(e){if(!this._supportPointerEvents)return this._deltaX=e.touches[0].clientX,void(this._deltaY=e.touches[0].clientY);this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX,this._deltaY=e.clientY)}_end(e){this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX-this._deltaX,this._deltaY=e.clientY-this._deltaY),this._handleSwipe(),execute(this._config.endCallback)}_move(e){if(e.touches&&e.touches.length>1)return this._deltaX=0,void(this._deltaY=0);this._deltaX=e.touches[0].clientX-this._deltaX,this._deltaY=e.touches[0].clientY-this._deltaY}_handleSwipe(){const e=Math.abs(this._deltaX),t=Math.abs(this._deltaY);if(t>e&&t>40){const e=this._deltaY>0?"down":"up";return this._deltaX=0,this._deltaY=0,void execute("down"===e?this._config.downCallback:this._config.upCallback)}if(e>40){const t=e/this._deltaX;if(this._deltaX=0,this._deltaY=0,!t)return;return void execute(t>0?this._config.rightCallback:this._config.leftCallback)}this._deltaX=0,this._deltaY=0}_initEvents(){this._supportPointerEvents?(EventHandler.on(this._element,EVENT_POINTERDOWN$1,e=>this._start(e)),EventHandler.on(this._element,EVENT_POINTERUP$1,e=>this._end(e)),this._element.classList.add("pointer-event")):(EventHandler.on(this._element,EVENT_TOUCHSTART,e=>this._start(e)),EventHandler.on(this._element,EVENT_TOUCHMOVE,e=>this._move(e)),EventHandler.on(this._element,EVENT_TOUCHEND,e=>this._end(e)))}_eventIsPointerPenTouch(e){return this._supportPointerEvents&&("pen"===e.pointerType||"touch"===e.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}};const NAME$11="drawer",EVENT_KEY$8=".bs.drawer",DATA_API_KEY$5=".data-api",EVENT_LOAD_DATA_API$2=`load${EVENT_KEY$8}.data-api`,EVENT_HIDDEN$3=`hidden${EVENT_KEY$8}`,EVENT_RESIZE$1=`resize${EVENT_KEY$8}`,EVENT_CLICK_DATA_API$1=`click${EVENT_KEY$8}.data-api`,SELECTOR_DATA_TOGGLE$4='[data-bs-toggle="drawer"]',SELECTOR_OPEN='dialog.drawer[open], dialog[open][class*="\\:drawer"]',Default$10={backdrop:!0,keyboard:!0,scroll:!1},DefaultType$10={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};var Drawer=class extends DialogBase{constructor(e,t){super(e,t),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(){this._swipeHelper&&this._swipeHelper.dispose(),this._resizeObserver&&this._resizeObserver.disconnect(),null!==this._resizeFrame&&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 e=this._element.closest(".navbar");e&&"undefined"!=typeof ResizeObserver&&(this._resizeObserver=new ResizeObserver(()=>{null!==this._resizeFrame&&cancelAnimationFrame(this._resizeFrame),this._resizeFrame=requestAnimationFrame(()=>{this._resizeFrame=null,this._element.open&&"fixed"!==getComputedStyle(this._element).position&&this.hide()})}),this._resizeObserver.observe(e))}_initSwipe(){if(this._swipeHelper||!Swipe.isSupported())return;const e={},t=this._element;t.classList.contains("drawer-bottom")?e.downCallback=()=>this.hide():t.classList.contains("drawer-top")?e.upCallback=()=>this.hide():t.classList.contains("drawer-end")?isRTL$1()?e.leftCallback=()=>this.hide():e.rightCallback=()=>this.hide():isRTL$1()?e.rightCallback=()=>this.hide():e.leftCallback=()=>this.hide(),this._swipeHelper=new Swipe(t,e)}};EventHandler.on(document,EVENT_CLICK_DATA_API$1,SELECTOR_DATA_TOGGLE$4,function(e){const t=SelectorEngine.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&e.preventDefault(),isDisabled(this))return;EventHandler.one(t,EVENT_HIDDEN$3,()=>{isVisible(this)&&this.focus({preventScroll:!0})});const n=SelectorEngine.findOne("dialog.drawer[open]");n&&n!==t&&Drawer.getInstance(n).hide(),Drawer.getOrCreateInstance(t).toggle(this)}),EventHandler.on(window,EVENT_LOAD_DATA_API$2,()=>{for(const e of SelectorEngine.find("dialog.drawer[open]"))Drawer.getOrCreateInstance(e).show()}),EventHandler.on(window,EVENT_RESIZE$1,()=>{for(const e of SelectorEngine.find(SELECTOR_OPEN))"fixed"!==getComputedStyle(e).position&&Drawer.getOrCreateInstance(e).hide()}),enableDismissTrigger(Drawer);const NAME$10="strength",EVENT_KEY$7=".bs.strength",DATA_API_KEY$4=".data-api",EVENT_STRENGTH_CHANGE=`strengthChange${EVENT_KEY$7}`,SELECTOR_DATA_STRENGTH="[data-bs-strength]",STRENGTH_LEVELS=["weak","fair","good","strong"],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},DefaultType$9={input:"(string|element|null)",minLength:"number",messages:"object",weights:"object",thresholds:"array",scorer:"(function|null)"};var Strength=class extends BaseComponent{constructor(e,t){super(e,t),this._input=this._getInput(),this._segments=SelectorEngine.find(".strength-segment",this._element),this._textElement=SelectorEngine.findOne(".strength-text",this._element.parentElement),this._currentStrength=null,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"string"==typeof this._config.input?SelectorEngine.findOne(this._config.input):this._config.input;const e=this._element.parentElement;return SelectorEngine.findOne('input[type="password"]',e)}_addEventListeners(){EventHandler.on(this._input,`input${EVENT_KEY$7}`,()=>this._evaluate()),EventHandler.on(this._input,`change${EVENT_KEY$7}`,()=>this._evaluate())}_evaluate(){const e=this._input.value,t=this._calculateScore(e),n=this._scoreToStrength(t);n!==this._currentStrength&&(this._currentStrength=n,this._updateUI(n),EventHandler.trigger(this._element,EVENT_STRENGTH_CHANGE,{strength:n,score:t,password:e.length>0?"***":""}))}_calculateScore(e){if(!e)return 0;if("function"==typeof this._config.scorer)return this._config.scorer(e);const{weights:t}=this._config;let n=0;return e.length>=this._config.minLength&&(n+=t.minLength),e.length>=this._config.minLength+4&&(n+=t.extraLength),/[a-z]/.test(e)&&(n+=t.lowercase),/[A-Z]/.test(e)&&(n+=t.uppercase),/\d/.test(e)&&(n+=t.numbers),/[!@#$%^&*(),.?":{}|<>]/.test(e)&&(n+=t.special),/[!@#$%^&*(),.?":{}|<>].*[!@#$%^&*(),.?":{}|<>]/.test(e)&&(n+=t.multipleSpecial),e.length>=16&&(n+=t.longPassword),n}_scoreToStrength(e){if(0===e)return null;const[t,n,i]=this._config.thresholds;return e<=t?"weak":e<=n?"fair":e<=i?"good":"strong"}_updateUI(e){e?this._element.dataset.bsStrength=e:delete this._element.dataset.bsStrength;const t=e?STRENGTH_LEVELS.indexOf(e):-1;for(const[e,n]of this._segments.entries())e<=t?n.classList.add("active"):n.classList.remove("active");this._textElement&&(e&&this._config.messages[e]?(this._textElement.textContent=this._config.messages[e],this._textElement.dataset.bsStrength=e,this._textElement.style.setProperty("--strength-color",`var(--${{weak:"danger",fair:"warning",good:"info",strong:"success"}[e]}-text)`)):(this._textElement.textContent="",delete this._textElement.dataset.bsStrength))}};EventHandler.on(document,`DOMContentLoaded${EVENT_KEY$7}.data-api`,()=>{for(const e of SelectorEngine.find("[data-bs-strength]"))Strength.getOrCreateInstance(e)});const NAME$9="otpInput",EVENT_KEY$6=".bs.otpInput",DATA_API_KEY$3=".data-api",EVENT_COMPLETE=`complete${EVENT_KEY$6}`,EVENT_INPUT$1=`input${EVENT_KEY$6}`,EVENT_DOMCONTENT_LOADED=`DOMContentLoaded${EVENT_KEY$6}.data-api`,SELECTOR_DATA_OTP="[data-bs-otp]",SELECTOR_INPUT$1="input",CLASS_NAME_INPUT="otp-input",CLASS_NAME_RENDERED="otp-rendered",CLASS_NAME_SLOTS="otp-slots",CLASS_NAME_SLOT="otp-slot",CLASS_NAME_SLOT_FILLED="otp-slot-filled",CLASS_NAME_SLOT_ACTIVE="otp-slot-active",CLASS_NAME_SEPARATOR="otp-separator",MASK_CHARACTER="•",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}},Default$8={groups:null,length:null,mask:!1,separator:"·",type:"numeric"},DefaultType$8={groups:"(array|null)",length:"(number|null)",mask:"boolean",separator:"string",type:"string"};var OtpInput=class extends BaseComponent{constructor(e,t){super(e,t);const n=SelectorEngine.findOne("input",this._element);n&&(this._input=n,this._type=TYPES[this._config.type]||TYPES.numeric,this._length=this._resolveLength(),this._slots=[],this._pointerActive=!1,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(e){this._input.value=this._sanitize(String(e)),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[e,t]of Object.entries(this._inputListeners??{}))EventHandler.off(this._input,e,t);EventHandler.off(document,"selectionchange",this._onSelectionChange),this._slotsContainer?.remove(),this._element.classList.remove("otp-rendered"),super.dispose()}_resolveLength(){if(this._config.length)return this._config.length;const e=Number.parseInt(this._input.getAttribute("maxlength"),10);return Number.isNaN(e)||e<1?6:e}_setupInput(){const e=this._input;"number"!==e.type&&"password"!==e.type||(e.type="text"),e.classList.add("otp-input"),e.setAttribute("maxlength",String(this._length)),e.setAttribute("inputmode",this._type.inputmode),e.setAttribute("pattern",this._type.pattern),e.getAttribute("autocomplete")||e.setAttribute("autocomplete","one-time-code"),e.value&&(e.value=this._sanitize(e.value))}_renderSlots(){const e=document.createElement("div");e.className="otp-slots",e.setAttribute("aria-hidden","true");const{groups:t}=this._config;let n=0,i=0;for(let s=0;s0&&(i++,i===t[n]&&sthis._handleInput(),beforeinput:e=>this._handleBeforeInput(e),paste:e=>this._handlePaste(e),pointerdown:e=>this._handlePointerDown(e)},this._inputListeners.focus=()=>{if(this._pointerActive)return this._pointerActive=!1,this._selectSlot(this._pointerIndex),void this._render();this._selectSlot(this._firstEmptyIndex()),this._render()};const e=()=>this._render();this._onSelectionChange=()=>{document.activeElement===this._input&&this._render()};for(const t of["blur","keyup","select"])this._inputListeners[t]=e;for(const[e,t]of Object.entries(this._inputListeners))EventHandler.on(this._input,e,t);EventHandler.on(document,"selectionchange",this._onSelectionChange)}_handleInput(){const e=this._sanitize(this._input.value);e!==this._input.value&&(this._input.value=e),document.activeElement===this._input&&this._selectSlot(this._firstEmptyIndex()),this._afterValueChange()}_handlePaste(e){const t=e.clipboardData?.getData("text");if(!t||this._input.readOnly)return;const n=this._sanitize(t);let i=this._input.selectionStart??this._input.value.length,s=this._input.selectionEnd??i;n.length===this._length&&(i=0,s=this._input.value.length);const o=n.slice(0,this._length-this._input.value.length+s-i);e.preventDefault(),o&&(this._input.setRangeText(o,i,s,"end"),this._afterValueChange())}_handleBeforeInput(e){const{inputType:t,data:n}=e;if("insertText"===t&&n&&1===n.length){e.preventDefault();const t=this._sanitize(n);if(!t)return;const i=Math.min(this._input.selectionStart??0,this._length-1),s=[...this._input.value];return s[i]=t,this._input.value=s.join("").slice(0,this._length),this._selectSlot(i+1),void this._afterValueChange()}if("deleteContentBackward"===t){e.preventDefault();const t=this._input.selectionStart??0,n=this._input.selectionEnd??t,i=[...this._input.value];n>t?(i.splice(t,n-t),this._input.value=i.join(""),this._selectSlot(t)):t>0&&(i.splice(t-1,1),this._input.value=i.join(""),this._selectSlot(t-1)),this._afterValueChange()}}_handlePointerDown(e){const t=this._slotIndexFromPoint(e.clientX);if(null===t)return;const n=Math.min(t,this._firstEmptyIndex());if(document.activeElement===this._input)return e.preventDefault(),this._selectSlot(n),void this._render();this._pointerActive=!0,this._pointerIndex=n}_slotIndexFromPoint(e){for(const[t,n]of this._slots.entries())if(e<=n.getBoundingClientRect().right||t===this._slots.length-1)return t;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(e){const t=Math.max(0,Math.min(e,this._length-1)),n=t{for(const e of SelectorEngine.find("[data-bs-otp]"))OtpInput.getOrCreateInstance(e)});const NAME$8="chips",EVENT_KEY$5=".bs.chips",DATA_API_KEY$2=".data-api",EVENT_ADD="add.bs.chips",EVENT_REMOVE="remove.bs.chips",EVENT_CHANGE$1="change.bs.chips",EVENT_SELECT="select.bs.chips",SELECTOR_DATA_CHIPS="[data-bs-chips]",SELECTOR_GHOST_INPUT=".form-ghost",SELECTOR_CHIP=".chip",SELECTOR_CHIP_DISMISS=".chip-dismiss",CLASS_NAME_CHIP="chip",CLASS_NAME_CHIP_DISMISS="chip-dismiss",CLASS_NAME_ACTIVE$2="active",Default$7={separator:",",allowDuplicates:!1,maxChips:null,placeholder:"",dismissible:!0,dismissIcon:'',createOnBlur:!0},DefaultType$7={separator:"(string|null)",allowDuplicates:"boolean",maxChips:"(number|null)",placeholder:"string",dismissible:"boolean",dismissIcon:"string",createOnBlur:"boolean"};var Chips=class extends BaseComponent{constructor(e,t){super(e,t);const n=SelectorEngine.findOne(".form-ghost",this._element);this._chips=[],this._selectedChips=new Set,this._anchorChip=null,n?this._input=n: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(e){const t=String(e).trim();if(!t)return null;if(!this._config.allowDuplicates&&this._chips.includes(t))return null;if(null!==this._config.maxChips&&this._chips.length>=this._config.maxChips)return null;if(EventHandler.trigger(this._element,EVENT_ADD,{value:t,relatedTarget:this._input}).defaultPrevented)return null;const n=this._createChip(t);return this._element.insertBefore(n,this._input),this._chips.push(t),EventHandler.trigger(this._element,EVENT_CHANGE$1,{values:this.getValues()}),n}remove(e){let t,n;return"string"==typeof e?(n=e,t=this._findChipByValue(n)):(t=e,n=this._getChipValue(t)),!(!t||!n||EventHandler.trigger(this._element,EVENT_REMOVE,{value:n,chip:t,relatedTarget:this._input}).defaultPrevented||(this._selectedChips.delete(t),this._anchorChip===t&&(this._anchorChip=null),t.remove(),this._chips=this._getChipElements().map(e=>this._getChipValue(e)).filter(Boolean),EventHandler.trigger(this._element,EVENT_CHANGE$1,{values:this.getValues()}),0))}removeSelected(){const e=[...this._selectedChips];for(const t of e)this.remove(t);this._input?.focus()}getValues(){return[...this._chips]}getSelectedValues(){return[...this._selectedChips].map(e=>this._getChipValue(e))}clear(){const e=SelectorEngine.find(".chip",this._element);for(const t of e)t.remove();this._chips=[],this._selectedChips.clear(),this._anchorChip=null,EventHandler.trigger(this._element,EVENT_CHANGE$1,{values:[]})}clearSelection(){for(const e of this._selectedChips)e.classList.remove("active");this._selectedChips.clear(),this._anchorChip=null,EventHandler.trigger(this._element,EVENT_SELECT,{selected:[]})}selectChip(e,t={}){const{addToSelection:n=!1,rangeSelect:i=!1}=t,s=this._getChipElements();if(s.includes(e)){if(i&&this._anchorChip){const t=s.indexOf(this._anchorChip),i=s.indexOf(e),o=Math.min(t,i),a=Math.max(t,i);if(!n){const e=this._anchorChip;this.clearSelection(),this._anchorChip=e}for(let e=o;e<=a;e++)this._selectedChips.add(s[e]),s[e].classList.add("active")}else n?this._selectedChips.has(e)?(this._selectedChips.delete(e),e.classList.remove("active")):(this._selectedChips.add(e),e.classList.add("active"),this._anchorChip=e):(this.clearSelection(),this._selectedChips.add(e),e.classList.add("active"),this._anchorChip=e);EventHandler.trigger(this._element,EVENT_SELECT,{selected:this.getSelectedValues()})}}focus(){this._input?.focus()}dispose(){EventHandler.off(this._input,".bs.chips"),super.dispose()}_getChipElements(){return SelectorEngine.find(".chip",this._element)}_createInput(){const e=document.createElement("input");e.type="text",e.className="form-ghost",this._config.placeholder&&(e.placeholder=this._config.placeholder),this._element.append(e),this._input=e}_initializeExistingChips(){const e=SelectorEngine.find(".chip",this._element);for(const t of e){const e=this._getChipValue(t);e&&(this._chips.push(e),this._setupChip(t))}}_setupChip(e){e.setAttribute("tabindex","0"),this._config.dismissible&&!SelectorEngine.findOne(".chip-dismiss",e)&&e.append(this._createDismissButton())}_createChip(e){const t=document.createElement("span");return t.className="chip",t.dataset.bsChipValue=e,t.append(document.createTextNode(e)),this._setupChip(t),t}_createDismissButton(){const e=document.createElement("button");return e.type="button",e.className="chip-dismiss",e.setAttribute("aria-label","Remove"),e.setAttribute("tabindex","-1"),e.innerHTML=sanitizeHtml(this._config.dismissIcon,DefaultIconAllowlist),e}_findChipByValue(e){return this._getChipElements().find(t=>this._getChipValue(t)===e)}_getChipValue(e){if(e.dataset.bsChipValue)return e.dataset.bsChipValue;const t=e.cloneNode(!0),n=SelectorEngine.findOne(".chip-dismiss",t);return n&&n.remove(),t.textContent?.trim()||""}_addEventListeners(){EventHandler.on(this._input,"keydown.bs.chips",e=>this._handleInputKeydown(e)),EventHandler.on(this._input,"input.bs.chips",e=>this._handleInput(e)),EventHandler.on(this._input,"paste.bs.chips",e=>this._handlePaste(e)),EventHandler.on(this._input,"focus.bs.chips",()=>this.clearSelection()),this._config.createOnBlur&&EventHandler.on(this._input,"blur.bs.chips",e=>{e.relatedTarget?.closest(".chip")||this._createChipFromInput()}),EventHandler.on(this._element,"click.bs.chips",".chip",e=>{if(e.target.closest(".chip-dismiss"))return;const t=e.target.closest(".chip");t&&(e.preventDefault(),this.selectChip(t,{addToSelection:e.metaKey||e.ctrlKey,rangeSelect:e.shiftKey}),t.focus())}),EventHandler.on(this._element,"click.bs.chips",".chip-dismiss",e=>{e.stopPropagation();const t=e.target.closest(".chip");t&&(this.remove(t),this._input?.focus())}),EventHandler.on(this._element,"keydown.bs.chips",".chip",e=>{this._handleChipKeydown(e)}),EventHandler.on(this._element,"click.bs.chips",e=>{e.target===this._element&&(this.clearSelection(),this._input?.focus())})}_handleInputKeydown(e){const{key:t}=e;switch(t){case"Enter":e.preventDefault(),this._createChipFromInput();break;case"Backspace":case"Delete":if(""===this._input.value){e.preventDefault();const t=this._getChipElements();if(t.length>0){const e=t.at(-1);this.selectChip(e),e.focus()}}break;case"ArrowLeft":if(0===this._input.selectionStart&&0===this._input.selectionEnd){e.preventDefault();const t=this._getChipElements();if(t.length>0){const n=t.at(-1);e.shiftKey?this.selectChip(n,{addToSelection:!0}):this.selectChip(n),n.focus()}}break;case"Escape":this._input.value="",this.clearSelection(),this._input.blur()}}_handleChipKeydown(e){const{key:t}=e,n=e.target.closest(".chip");if(!n)return;const i=this._getChipElements(),s=i.indexOf(n);switch(t){case"Backspace":case"Delete":e.preventDefault(),this._handleChipDelete(s,i);break;case"ArrowLeft":e.preventDefault(),this._navigateChip(i,s,-1,e.shiftKey);break;case"ArrowRight":e.preventDefault(),this._navigateChip(i,s,1,e.shiftKey);break;case"Home":e.preventDefault(),this._navigateToEdge(i,0,e.shiftKey);break;case"End":case"Escape":e.preventDefault(),this.clearSelection(),this._input?.focus();break;case"a":this._handleSelectAll(e,i)}}_handleChipDelete(e,t){if(0===this._selectedChips.size)return;const n=Math.min(e,t.length-this._selectedChips.size-1);this.removeSelected();const i=this._getChipElements();if(i.length>0){const e=Math.max(0,Math.min(n,i.length-1));i[e].focus(),this.selectChip(i[e])}else this._input?.focus()}_navigateChip(e,t,n,i){const s=t+n;if(n<0&&s>=0){const t=e[s];this.selectChip(t,i?{addToSelection:!0,rangeSelect:!0}:{}),t.focus()}else if(n>0&&s0&&(this.clearSelection(),this._input?.focus())}_navigateToEdge(e,t,n){if(0===e.length)return;const i=e[t];this.selectChip(i,n?{rangeSelect:!0}:{}),i.focus()}_handleSelectAll(e,t){if(e.metaKey||e.ctrlKey){e.preventDefault();for(const e of t)this._selectedChips.add(e),e.classList.add("active");EventHandler.trigger(this._element,EVENT_SELECT,{selected:this.getSelectedValues()})}}_handleInput(e){const{value:t}=e.target,{separator:n}=this._config;if(n&&t.includes(n)){const e=t.split(n);for(const t of e.slice(0,-1))this.add(t.trim());this._input.value=e.at(-1)}}_handlePaste(e){const{separator:t}=this._config;if(!t)return;const n=(e.clipboardData||window.clipboardData).getData("text");if(n.includes(t)){e.preventDefault();const i=n.split(t);for(const e of i)this.add(e.trim())}}_createChipFromInput(){const e=this._input.value.trim();e&&(this.add(e),this._input.value="")}};EventHandler.on(document,"DOMContentLoaded.bs.chips.data-api",()=>{for(const e of SelectorEngine.find("[data-bs-chips]"))Chips.getOrCreateInstance(e)});const NAME$7="TemplateFactory",Default$6={allowList:DefaultAllowlist,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"
"},DefaultType$6={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},DefaultContentType={entry:"(string|element|function|null)",selector:"(string|element)"};var TemplateFactory=class extends Config{constructor(e){super(),this._config=this._getConfig(e)}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(e=>this._resolvePossibleFunction(e)).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(e){return this._checkContent(e),this._config.content={...this._config.content,...e},this}toHtml(){const e=document.createElement("div");e.innerHTML=this._maybeSanitize(this._config.template);for(const[t,n]of Object.entries(this._config.content))this._setContent(e,n,t);const t=e.children[0],n=this._resolvePossibleFunction(this._config.extraClass);return n&&t.classList.add(...n.split(" ")),t}_typeCheckConfig(e){super._typeCheckConfig(e),this._checkContent(e.content)}_checkContent(e){for(const[t,n]of Object.entries(e))super._typeCheckConfig({selector:t,entry:n},DefaultContentType)}_setContent(e,t,n){const i=SelectorEngine.findOne(n,e);i&&((t=this._resolvePossibleFunction(t))?isElement$1(t)?this._putElementInTemplate(getElement(t),i):this._config.html?i.innerHTML=this._maybeSanitize(t):i.textContent=t:i.remove())}_maybeSanitize(e){return this._config.sanitize?sanitizeHtml(e,this._config.allowList,this._config.sanitizeFn):e}_resolvePossibleFunction(e){return execute(e,[void 0,this])}_putElementInTemplate(e,t){if(this._config.html)return t.innerHTML="",void t.append(e);t.textContent=e.textContent}};const NAME$6="tooltip",DISALLOWED_ATTRIBUTES=new Set(["sanitize","allowList","sanitizeFn"]),ESCAPE_KEY="Escape",CLASS_NAME_MODAL="modal",CLASS_NAME_SHOW$2="show",SELECTOR_TOOLTIP_INNER=".tooltip-inner",SELECTOR_MODAL=".modal",SELECTOR_DATA_TOGGLE$3='[data-bs-toggle="tooltip"]',EVENT_MODAL_HIDE="hide.bs.modal",TRIGGER_HOVER="hover",TRIGGER_FOCUS="focus",TRIGGER_CLICK="click",TRIGGER_MANUAL="manual",EVENT_HIDE$2="hide",EVENT_HIDDEN$2="hidden",EVENT_SHOW$2="show",EVENT_SHOWN$2="shown",EVENT_INSERTED="inserted",EVENT_CLICK$3="click",EVENT_FOCUSIN$2="focusin",EVENT_FOCUSOUT$1="focusout",EVENT_MOUSEENTER$1="mouseenter",EVENT_MOUSELEAVE="mouseleave",EVENT_POINTERDOWN="pointerdown",EVENT_POINTERUP="pointerup",EVENT_KEYDOWN$1="keydown",AttachmentMap={AUTO:"auto",TOP:"top",RIGHT:isRTL$1()?"left":"right",BOTTOM:"bottom",LEFT:isRTL$1()?"right":"left"},Default$5={allowList:DefaultAllowlist,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,6],placement:"top",floatingConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'',title:"",trigger:"hover focus"},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"};var Tooltip=class extends BaseComponent{constructor(e,t){super(e,t),this._isEnabled=!0,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=!1,this._templateFactory=null,this._newContent=null,this._mediaQueryListeners=[],this._responsivePlacements=null,this.tip=null,this._parseResponsivePlacements(),this._setListeners(),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=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){return this._isEnabled?this._isShown()?this._leave():this._enter():Promise.resolve()}dispose(){this._clearTimeout(),this._removeEscapeListener(),this._removeFocusOutsideListener(),EventHandler.off(this._element.closest(".modal"),"hide.bs.modal",this._hideModalHandler),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("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const e=EventHandler.trigger(this._element,this.constructor.eventName("show")),t=(findShadowRoot(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(e.defaultPrevented||!t)return void(this._isHovered=!1);this._disposeFloating();const n=this._getTipElement();this._element.setAttribute("aria-describedby",n.getAttribute("id"));let{container:i}=this._config;const s=this._element.closest("dialog[open]");if(s&&i===document.body&&(i=s),this._element.ownerDocument.documentElement.contains(this.tip)||(i.append(n),EventHandler.trigger(this._element,this.constructor.eventName("inserted")),this._setTipListeners(n)),await this._createFloating(n),n.classList.add("show"),this._setEscapeListener(),this._setFocusOutsideListener(),"ontouchstart"in document.documentElement)for(const e of document.body.children)EventHandler.on(e,"mouseover",noop);await this._queueCallback(()=>{EventHandler.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1},this.tip,this._isAnimated())}async hide(){if(this._isShown()&&!EventHandler.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented){if(this._removeEscapeListener(),this._removeFocusOutsideListener(),this._getTipElement().classList.remove("show"),"ontouchstart"in document.documentElement)for(const e of document.body.children)EventHandler.off(e,"mouseover",noop);this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,this._isHovered=null,await this._queueCallback(()=>{this._isWithActiveTrigger()||(this._isHovered||this._disposeFloating(),this._element.removeAttribute("aria-describedby"),EventHandler.trigger(this._element,this.constructor.eventName("hidden")))},this.tip,this._isAnimated())}}update(){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(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(e){const t=this._getTemplateFactory(e).toHtml();t.classList.remove("show"),t.classList.add(`bs-${this.constructor.NAME}-auto`);const n=getUID(this.constructor.NAME).toString();return t.setAttribute("id",n),this._config.animation||t.classList.add(this._getInstantClassName()),this._setFocusTipListeners(t),t}setContent(e){this._newContent=e,this._isShown()&&(this._disposeFloating(),this.show())}_getTemplateFactory(e){return this._templateFactory?this._templateFactory.changeContent(e):this._templateFactory=new TemplateFactory({...this._config,content:e,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{[SELECTOR_TOOLTIP_INNER]:this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(e){return this.constructor.getOrCreateInstance(e.delegateTarget,this._getDelegateConfig())}_getInstantClassName(){return`${this.constructor.NAME}-instant`}_isAnimated(){return getTransitionDurationFromElement(this.tip)>0}_isShown(){return this.tip&&this.tip.classList.contains("show")}_getPlacement(e){if(this._responsivePlacements){const e=getResponsivePlacement(this._responsivePlacements,"top");return AttachmentMap[e.toUpperCase()]||e}const t=execute(this._config.placement,[this,e,this._element]);return AttachmentMap[t.toUpperCase()]||t}_parseResponsivePlacements(){"string"==typeof this._config.placement?(this._responsivePlacements=parseResponsivePlacement(this._config.placement,"top"),this._responsivePlacements&&this._setupMediaQueryListeners()):this._responsivePlacements=null}_setupMediaQueryListeners(){this._disposeMediaQueryListeners(),this._mediaQueryListeners=createBreakpointListeners(()=>{this._isShown()&&this._updateFloatingPosition()})}_disposeMediaQueryListeners(){disposeBreakpointListeners(this._mediaQueryListeners),this._mediaQueryListeners=[]}async _createFloating(e){const t=this._getPlacement(e),n=e.querySelector(`.${this.constructor.NAME}-arrow`);await this._updateFloatingPosition(e,t,n),this._floatingCleanup=autoUpdate(this._element,e,()=>this._updateFloatingPosition(e,null,n))}async _updateFloatingPosition(e=this.tip,t=null,n=null){if(!e)return;t||(t=this._getPlacement(e)),n||(n=e.querySelector(`.${this.constructor.NAME}-arrow`));const i=this._getFloatingMiddleware(n),s=this._getFloatingConfig(t,i),{x:o,y:a,placement:l,middlewareData:r}=await computePosition(this._element,e,s);if(Object.assign(e.style,{position:"absolute",left:`${o}px`,top:`${a}px`}),n&&(n.style.position="absolute"),Manipulator.setDataAttribute(e,"placement",l),n&&r.arrow){const{x:e,y:t}=r.arrow,i=l.startsWith("top")||l.startsWith("bottom");Object.assign(n.style,{left:i&&void 0!==e?`${e}px`:"",top:i||void 0===t?"":`${t}px`,right:"",bottom:""})}}_getOffset(){const{offset:e}=this._config;return"string"==typeof e?e.split(",").map(e=>Number.parseInt(e,10)):"function"==typeof e?({placement:t,rects:n})=>toFloatingOffset(e({placement:t,reference:n.reference,floating:n.floating},this._element)):e}_resolvePossibleFunction(e){return execute(e,[this._element,this._element])}_getFloatingMiddleware(e){const t=this._getOffset(),n=[offset("function"==typeof t?t:toFloatingOffset(t)),flip({fallbackPlacements:this._config.fallbackPlacements}),shift({boundary:"clippingParents"===this._config.boundary?"clippingAncestors":this._config.boundary})];return e&&n.push(arrow({element:e})),n}_getFloatingConfig(e,t){const n={placement:e,middleware:t};return{...n,...execute(this._config.floatingConfig,[void 0,n])}}_setListeners(){const e=this._config.trigger.split(" ");for(const t of e)if("click"===t)EventHandler.on(this._element,this.constructor.eventName("click"),this._config.selector,e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger.click=!(t._isShown()&&t._activeTrigger.click),t.toggle()});else if("manual"!==t){const[e,n]=this._getTriggerEvents(t);EventHandler.on(this._element,e,this._config.selector,e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger["focusin"===e.type?"focus":"hover"]=!0,t._enter()}),EventHandler.on(this._element,n,this._config.selector,e=>{const t=this._initializeOnDelegatedTarget(e);"focusout"===e.type?t._activeTrigger.focus=t._isInside(e.relatedTarget)||t._tipPointerDown:t._activeTrigger.hover=t._isInside(e.relatedTarget),t._leave()})}this._hideModalHandler=()=>{this._element&&this.hide()},EventHandler.on(this._element.closest(".modal"),"hide.bs.modal",this._hideModalHandler)}_setTipListeners(e){const t=this._getTrigger();if("manual"!==t&&!t.includes("click")){this._tipEventOut=e=>{this._activeTrigger["focusout"===e.type?"focus":"hover"]=this._isInside(e.relatedTarget),this._leave()};for(const n of t.split(" "))if("hover"===n||"focus"===n){const[,t]=this._getTriggerEvents(n);EventHandler.on(e,t,this._tipEventOut)}}}_removeTipListeners(e){if(!this._tipEventOut)return;const t=this._getTrigger();for(const n of t.split(" "))if("hover"===n||"focus"===n){const[,t]=this._getTriggerEvents(n);EventHandler.off(e,t,this._tipEventOut)}this._tipEventOut=null}_isInside(e){return e instanceof Node&&(this._element.contains(e)||Boolean(this.tip?.contains(e)))}_getTrigger(){return this._config._trigger}_getTriggerEvents(e){return{[TRIGGER_HOVER]:[this.constructor.eventName("mouseenter"),this.constructor.eventName("mouseleave")],[TRIGGER_FOCUS]:[this.constructor.eventName("focusin"),this.constructor.eventName("focusout")]}[e]}_hasFocusTrigger(){return this._getTrigger().split(" ").includes("focus")}_setFocusTipListeners(e){this._hasFocusTrigger()&&(EventHandler.on(e,this.constructor.eventName("pointerdown"),()=>{this._tipPointerDown=!0,this._activeTrigger.focus=!0}),EventHandler.on(e,this.constructor.eventName("focusin"),()=>{this._activeTrigger.focus=!0}),EventHandler.on(e,this.constructor.eventName("focusout"),e=>{this._activeTrigger.focus=this._isInside(e.relatedTarget)||this._tipPointerDown,this._leave()}))}_setFocusOutsideListener(){if(this._outsidePointerHandler||!this._hasFocusTrigger())return;this._tipPointerUpHandler=()=>{this._tipPointerDown=!1},this._outsidePointerHandler=e=>{this._isShown()&&!this._isInside(e.target)&&(this._activeTrigger.focus=!1,this.hide())};const e=this._element.ownerDocument;e.addEventListener("pointerup",this._tipPointerUpHandler,!0),e.addEventListener("pointerdown",this._outsidePointerHandler,!0)}_removeFocusOutsideListener(){const e=this._element?.ownerDocument;this._tipPointerUpHandler&&e&&e.removeEventListener("pointerup",this._tipPointerUpHandler,!0),this._outsidePointerHandler&&e&&e.removeEventListener("pointerdown",this._outsidePointerHandler,!0),this._tipPointerUpHandler=null,this._outsidePointerHandler=null,this._tipPointerDown=!1}_setEscapeListener(){this._keydownHandler||(this._keydownHandler=e=>{"Escape"===e.key&&this._isShown()&&this.tip.isConnected&&(e.preventDefault(),e.stopPropagation(),this.hide())},this._element.ownerDocument.addEventListener("keydown",this._keydownHandler,!0))}_removeEscapeListener(){this._keydownHandler&&(this._element.ownerDocument.removeEventListener("keydown",this._keydownHandler,!0),this._keydownHandler=null)}_fixTitle(){const e=this._element.getAttribute("title");e&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",e),this._element.setAttribute("data-bs-original-title",e),this._element.removeAttribute("title"))}_enter(){return this._isShown()||this._isHovered?(this._isHovered=!0,Promise.resolve()):(this._isHovered=!0,this._setTimeout(()=>this._isHovered?this.show():void 0,this._config.delay.show))}_leave(){return this._isWithActiveTrigger()?Promise.resolve():(this._isHovered=!1,this._setTimeout(()=>this._isHovered?void 0:this.hide(),this._config.delay.hide))}_setTimeout(e,t){return this._clearTimeout(),new Promise(n=>{this._resolveTimeout=n,this._timeout=setTimeout(()=>{this._resolveTimeout=null,n(e())},t)})}_clearTimeout(){clearTimeout(this._timeout),this._resolveTimeout&&(this._resolveTimeout(),this._resolveTimeout=null)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(e){const t=Manipulator.getDataAttributes(this._element);for(const e of Object.keys(t))DISALLOWED_ATTRIBUTES.has(e)&&delete t[e];return e={...t,..."object"==typeof e&&e?e:{}},e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e.container=!1===e.container?document.body:getElement(e.container),e._trigger=e._trigger||e.trigger,"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),"number"!=typeof e.title&&"boolean"!=typeof e.title||(e.title=e.title.toString()),"number"!=typeof e.content&&"boolean"!=typeof e.content||(e.content=e.content.toString()),e}_getDelegateConfig(){const e={};for(const[t,n]of Object.entries(this._config))this.constructor.Default[t]!==n&&(e[t]=n);return e.selector=!1,e.trigger="manual",e}_disposeFloating(){this._floatingCleanup&&(this._floatingCleanup(),this._floatingCleanup=null),this.tip&&(this._removeTipListeners(this.tip),EventHandler.off(this.tip,this.constructor.EVENT_KEY),this.tip.remove(),this.tip=null)}};const initTooltip=e=>{const t=e.target.closest(SELECTOR_DATA_TOGGLE$3);t&&Tooltip.getOrCreateInstance(t)};EventHandler.on(document,"focusin",SELECTOR_DATA_TOGGLE$3,initTooltip),EventHandler.on(document,"mouseenter",SELECTOR_DATA_TOGGLE$3,initTooltip);const NAME$5="popover",SELECTOR_TITLE=".popover-header",SELECTOR_CONTENT=".popover-body",SELECTOR_DATA_TOGGLE$2='[data-bs-toggle="popover"]',EVENT_CLICK$2="click",EVENT_FOCUSIN$1="focusin",EVENT_MOUSEENTER="mouseenter",Default$4={...Tooltip.Default,content:"",offset:[0,8],placement:"right",template:'',trigger:"click"},DefaultType$4={...Tooltip.DefaultType,content:"(null|string|element|function)"};var Popover=class extends Tooltip{constructor(e,t){super(e,t)}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)}};const initPopover=e=>{const t=e.target.closest(SELECTOR_DATA_TOGGLE$2);t&&("click"===e.type&&e.preventDefault(),Popover.getOrCreateInstance(t))};EventHandler.on(document,"click",SELECTOR_DATA_TOGGLE$2,initPopover),EventHandler.on(document,"focusin",SELECTOR_DATA_TOGGLE$2,initPopover),EventHandler.on(document,"mouseenter",SELECTOR_DATA_TOGGLE$2,initPopover);const NAME$4="range",EVENT_KEY$4=".bs.range",DATA_API_KEY$1=".data-api",EVENT_CHANGED="changed.bs.range",EVENT_DOM_CONTENT_LOADED="DOMContentLoaded.bs.range.data-api",EVENT_INPUT="input",EVENT_CHANGE="change",SELECTOR_RANGE=".form-range",SELECTOR_INPUT=".form-range-input",CLASS_NAME_BUBBLE="form-range-bubble",CLASS_NAME_TICKS="form-range-ticks",CLASS_NAME_TICK="form-range-tick",CLASS_NAME_TICK_LABEL="form-range-tick-label",PROPERTY_FILL="--bs-range-fill",Default$3={bubble:!1,formatter:null},DefaultType$3={bubble:"(boolean|null)",formatter:"(function|null)"};var Range=class extends BaseComponent{constructor(e,t){super(e,t),this._element&&(this._input=SelectorEngine.findOne(SELECTOR_INPUT,this._element),this._input&&(this._bubble=null,this._bubbleText=null,this._ticks=null,this._updateHandler=()=>this._update(),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,"input",this._updateHandler),EventHandler.off(this._input,"change",this._updateHandler),this._bubble?.remove(),this._ticks?.remove(),super.dispose()}_configAfterMerge(e){return null===e.bubble&&(e.bubble=!0),e}_addEventListeners(){EventHandler.on(this._input,"input",this._updateHandler),EventHandler.on(this._input,"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 e=this._max()-this._min();return e>0?(this._value()-this._min())/e:0}_update(){this._element.style.setProperty(PROPERTY_FILL,`${this._ratio()}`),this._bubbleText&&(this._bubbleText.textContent=this._format(this._value())),EventHandler.trigger(this._input,EVENT_CHANGED,{value:this._value()})}_format(e){return"function"==typeof this._config.formatter?this._config.formatter(e):String(e)}_createBubble(){this._bubble=document.createElement("output"),this._bubble.className=`${CLASS_NAME_BUBBLE} tooltip bs-tooltip-top show`,this._bubble.setAttribute("aria-hidden","true");const e=document.createElement("div");e.className="tooltip-arrow",this._bubbleText=document.createElement("div"),this._bubbleText.className="tooltip-inner",this._bubble.append(e,this._bubbleText),this._input.insertAdjacentElement("afterend",this._bubble)}_createTicks(){const e=this._input.getAttribute("list"),t=e?document.getElementById(e):null;if(!t)return;const n=this._min(),i=this._max()-n||1,s=[];for(const e of SelectorEngine.find("option",t)){const t=Number.parseFloat(e.value);if(!Number.isNaN(t)){const o=Math.min(Math.max((t-n)/i,0),1);s.push({ratio:o,label:e.label})}}if(0===s.length)return;s.sort((e,t)=>e.ratio-t.ratio),this._ticks=document.createElement("div"),this._ticks.className=CLASS_NAME_TICKS,this._ticks.setAttribute("aria-hidden","true");const o=[0,...s.map(e=>e.ratio),1];this._ticks.style.gridTemplateColumns=o.slice(1).map((e,t)=>e-o[t]+"fr").join(" ");for(const[e,t]of s.entries()){const n=document.createElement("span");if(n.className=CLASS_NAME_TICK,n.style.gridColumnStart=`${e+2}`,t.label){const e=document.createElement("span");e.className=CLASS_NAME_TICK_LABEL,e.textContent=t.label,n.append(e)}this._ticks.append(n)}this._element.append(this._ticks)}};EventHandler.on(document,EVENT_DOM_CONTENT_LOADED,()=>{for(const e of SelectorEngine.find(".form-range"))Range.getOrCreateInstance(e)});const NAME$3="scrollspy",EVENT_KEY$3=".bs.scrollspy",DATA_API_KEY=".data-api",EVENT_ACTIVATE=`activate${EVENT_KEY$3}`,EVENT_CLICK$1=`click${EVENT_KEY$3}`,EVENT_SCROLL=`scroll${EVENT_KEY$3}`,EVENT_SCROLLEND=`scrollend${EVENT_KEY$3}`,EVENT_RESIZE=`resize${EVENT_KEY$3}`,EVENT_LOAD_DATA_API$1=`load${EVENT_KEY$3}.data-api`,CLASS_NAME_MENU_ITEM="menu-item",CLASS_NAME_ACTIVE$1="active",SELECTOR_DATA_SPY='[data-bs-spy="scroll"]',SELECTOR_TARGET_LINKS="[href]",SELECTOR_NAV_LIST_GROUP=".nav, .list-group",SELECTOR_NAV_LINKS=".nav-link",SELECTOR_LINK_ITEMS=".nav-link, .nav-item > .nav-link, .list-group-item",SELECTOR_MENU_TOGGLE$1='[data-bs-toggle="menu"]',SCROLL_IDLE_TIMEOUT=100,RESIZE_DEBOUNCE=100,Default$2={rootMargin:null,smoothScroll:!1,target:null,threshold:[0],topMargin:"12%"},DefaultType$2={rootMargin:"(string|null)",smoothScroll:"boolean",target:"element",threshold:"array",topMargin:"string"};var ScrollSpy=class extends BaseComponent{constructor(e,t){super(e,t),this._sections=[],this._linkBySection=new Map,this._sectionByLink=new Map,this._intersecting=new Set,this._activeTarget=null,this._lastActive=null,this._atBottom=!1,this._rootElement="visible"===getComputedStyle(this._element).overflowY?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 e of this._sections)this._observer.observe(e);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(e){return e.target=getElement(e.target)||document.body,"string"==typeof e.threshold&&(e.threshold=e.threshold.split(",").map(e=>Number.parseFloat(e))),e}_getNewObserver(){const e={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin??this._getDerivedRootMargin()};return new IntersectionObserver(e=>this._onIntersect(e),e)}_onIntersect(e){for(const t of e)t.isIntersecting?this._intersecting.add(t.target):this._intersecting.delete(t.target);this._computeActive()}_computeActive(){if(!this._element?.isConnected||0===this._sections.length)return;let e=null;if(this._atBottom)e=this._sections.at(-1);else{for(const t of this._sections)this._intersecting.has(t)&&(e=t);e||=this._lastActive??this._sections.at(0)}if(!e)return;this._lastActive=e;const t=this._linkBySection.get(e);t&&this._process(t)}_parseTopMargin(){const e=String(this._config.topMargin);return{value:Number.parseFloat(e)||0,unit:e.endsWith("%")?"%":"px"}}_getDerivedRootMargin(){const{value:e,unit:t}=this._parseTopMargin();let n=e;if("px"===t){const t=this._rootElement?this._rootElement.clientHeight:document.documentElement.clientHeight||window.innerHeight;n=t?e/t*100:12}return`0px 0px -${Math.min(Math.max(100-n,0),100)}% 0px`}_usesPixelMargin(){return!this._config.rootMargin&&"px"===this._parseTopMargin().unit}_setUpSentinel(){if(this._teardownSentinel(),0===this._sections.length)return;const e=document.createElement("div");e.setAttribute("aria-hidden","true"),e.style.cssText="position:relative;width:0;height:0;margin:0;padding:0;border:0;visibility:hidden;",this._element.append(e),this._sentinel=e,this._sentinelObserver=new IntersectionObserver(e=>this._onSentinel(e),{root:this._rootElement,threshold:[0]}),this._sentinelObserver.observe(e)}_onSentinel(e){const t=e.at(-1);this._atBottom=Boolean(t?.isIntersecting)&&this._isOverflowing(),this._computeActive()}_isOverflowing(){const e=this._rootElement||document.scrollingElement||document.documentElement;return e.scrollHeight>e.clientHeight}_teardownSentinel(){this._sentinelObserver?.disconnect(),this._sentinelObserver=null,this._sentinel?.remove(),this._sentinel=null,this._atBottom=!1}_maybeAddResizeListener(){this._removeResizeListener(),this._usesPixelMargin()&&(this._resizeHandler=()=>{clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(()=>this._rebuildObserver(),100)},EventHandler.on(window,EVENT_RESIZE,this._resizeHandler))}_removeResizeListener(){clearTimeout(this._resizeTimeout),this._resizeTimeout=null,this._resizeHandler&&(EventHandler.off(window,EVENT_RESIZE,this._resizeHandler),this._resizeHandler=null)}_rebuildObserver(){if(this._observer){this._observer.disconnect(),this._intersecting.clear(),this._observer=this._getNewObserver();for(const e of this._sections)this._observer.observe(e)}}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(EventHandler.off(this._config.target,EVENT_CLICK$1),EventHandler.on(this._config.target,EVENT_CLICK$1,"[href]",e=>{const t=e.target.closest("[href]"),n=t&&this._sectionByLink.get(t);if(!n||!this._element)return;e.preventDefault();const i=this._rootElement||window,s=n.offsetTop-this._element.offsetTop,o=this._rootElement?this._rootElement.scrollTop:window.scrollY??window.pageYOffset;if(matchMedia("(prefers-reduced-motion: reduce)").matches||Math.abs(o-s)<=2)return i.scrollTo?i.scrollTo({top:s,behavior:"auto"}):i.scrollTop=s,void this._settleNavigation(t.hash,n);this._pendingNavigation={hash:t.hash,section:n},this._armSettle(),i.scrollTo?i.scrollTo({top:s,behavior:"smooth"}):i.scrollTop=s}))}_armSettle(){this._disarmSettle();const e=this._getSettleTarget();this._settleHandler=()=>this._onSettle(),this._scrollIdleHandler=()=>{clearTimeout(this._settleTimeout),this._settleTimeout=setTimeout(()=>this._onSettle(),100)},EventHandler.on(e,EVENT_SCROLLEND,this._settleHandler),EventHandler.on(e,EVENT_SCROLL,this._scrollIdleHandler)}_disarmSettle(){clearTimeout(this._settleTimeout),this._settleTimeout=null;const e=this._getSettleTarget();this._settleHandler&&(EventHandler.off(e,EVENT_SCROLLEND,this._settleHandler),this._settleHandler=null),this._scrollIdleHandler&&(EventHandler.off(e,EVENT_SCROLL,this._scrollIdleHandler),this._scrollIdleHandler=null)}_getSettleTarget(){return this._rootElement||document}_onSettle(){if(this._disarmSettle(),!this._pendingNavigation)return;const{hash:e,section:t}=this._pendingNavigation;this._settleNavigation(e,t)}_settleNavigation(e,t){this._pendingNavigation=null,window.history?.replaceState&&window.history.replaceState(null,"",e),t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0})}_initializeTargetsAndObservables(){this._sections=[],this._linkBySection=new Map,this._sectionByLink=new Map;const e=SelectorEngine.find("[href]",this._config.target),t=new Set;for(const n of e){if(!n.hash||isDisabled(n))continue;const e=decodeFragment(n.hash.slice(1));if(!e)continue;const i=document.getElementById(e);i&&this._element.contains(i)&&isVisible(i)&&(this._sectionByLink.set(n,i),this._linkBySection.set(i,n),t.has(i)||(t.add(i),this._sections.push(i)))}this._sections.sort((e,t)=>e.getBoundingClientRect().top-t.getBoundingClientRect().top)}_process(e){this._activeTarget!==e&&(this._clearActiveClass(this._config.target),this._activeTarget=e,e.classList.add("active"),this._activateParents(e),EventHandler.trigger(this._element,EVENT_ACTIVATE,{relatedTarget:e}))}_activateParents(e){if(e.classList.contains("menu-item")){const t=e.closest(".menu")?.previousElementSibling;return void(t?.matches(SELECTOR_MENU_TOGGLE$1)&&t.classList.add("active"))}for(const t of SelectorEngine.parents(e,".nav, .list-group"))for(const e of SelectorEngine.prev(t,SELECTOR_LINK_ITEMS))e.classList.add("active")}_clearActiveClass(e){e.classList.remove("active");const t=SelectorEngine.find("[href].active",e);for(const e of t)e.classList.remove("active")}};function decodeFragment(e){try{return decodeURIComponent(e)}catch{return e}}EventHandler.on(window,EVENT_LOAD_DATA_API$1,()=>{for(const e of SelectorEngine.find(SELECTOR_DATA_SPY))ScrollSpy.getOrCreateInstance(e)});const NAME$2="tab",EVENT_KEY$2=".bs.tab",EVENT_HIDE$1="hide.bs.tab",EVENT_HIDDEN$1="hidden.bs.tab",EVENT_SHOW$1="show.bs.tab",EVENT_SHOWN$1="shown.bs.tab",EVENT_CLICK_DATA_API="click.bs.tab",EVENT_KEYDOWN="keydown.bs.tab",EVENT_LOAD_DATA_API="load.bs.tab",ARROW_LEFT_KEY="ArrowLeft",ARROW_RIGHT_KEY="ArrowRight",ARROW_UP_KEY="ArrowUp",ARROW_DOWN_KEY="ArrowDown",HOME_KEY="Home",END_KEY="End",CLASS_NAME_ACTIVE="active",CLASS_NAME_SHOW$1="show",SELECTOR_MENU_TOGGLE='[data-bs-toggle="menu"]',SELECTOR_MENU=".menu",NOT_SELECTOR_MENU_TOGGLE=`:not(${SELECTOR_MENU_TOGGLE})`,SELECTOR_TAB_PANEL='.list-group, .nav, [role="tablist"]',SELECTOR_OUTER=".nav-item, .list-group-item",SELECTOR_INNER=`.nav-link${NOT_SELECTOR_MENU_TOGGLE}, .list-group-item${NOT_SELECTOR_MENU_TOGGLE}, [role="tab"]${NOT_SELECTOR_MENU_TOGGLE}`,SELECTOR_DATA_TOGGLE$1='[data-bs-toggle="tab"]',SELECTOR_INNER_ELEM=`${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE$1}`,SELECTOR_DATA_TOGGLE_ACTIVE='.active[data-bs-toggle="tab"]',activationIds=new WeakMap;var Tab=class e extends BaseComponent{constructor(e){if(super(e),this._parent=this._element.closest(SELECTOR_TAB_PANEL),!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,e=>this._keydown(e))}static get NAME(){return"tab"}async show(){const e=this._element;if(this._elemIsActive(e))return;const t=this._getActiveElem(),n=t?EventHandler.trigger(t,EVENT_HIDE$1,{relatedTarget:e}):null;if(EventHandler.trigger(e,EVENT_SHOW$1,{relatedTarget:t}).defaultPrevented||n&&n.defaultPrevented)return;const i=(activationIds.get(this._parent)||0)+1;activationIds.set(this._parent,i),this._deactivate(t,e),await this._activate(e,t,i)}async _activate(e,t,n){if(!e)return;if(e.classList.add("active"),"tab"!==e.getAttribute("role"))return void e.classList.add("show");const i=SelectorEngine.getElementFromSelector(e);this._activate(i),await this._queueCallback(()=>{n===activationIds.get(this._parent)&&this._elemIsActive(e)&&(e.removeAttribute("tabindex"),setAriaAttribute(e,"aria-selected",!0),this._toggleMenu(e,!0),EventHandler.trigger(e,EVENT_SHOWN$1,{relatedTarget:t}))},i??e,getTransitionDurationFromElement(i)>0)}async _deactivate(e,t){e&&(e.classList.remove("active"),e.blur(),"tab"===e.getAttribute("role")?(this._deactivate(SelectorEngine.getElementFromSelector(e)),await this._queueCallback(()=>{setAriaAttribute(e,"aria-selected",!1),e.setAttribute("tabindex","-1"),this._toggleMenu(e,!1),EventHandler.trigger(e,EVENT_HIDDEN$1,{relatedTarget:t})},e,!1)):e.classList.remove("show"))}_keydown(t){if(![ARROW_LEFT_KEY,ARROW_RIGHT_KEY,ARROW_UP_KEY,ARROW_DOWN_KEY,HOME_KEY,END_KEY].includes(t.key))return;if(t.altKey||t.ctrlKey||t.metaKey)return;t.stopPropagation(),t.preventDefault();const n=this._getChildren().filter(e=>!isDisabled(e));let i;if([HOME_KEY,END_KEY].includes(t.key))i=t.key===HOME_KEY?n[0]:n.at(-1);else{const e=[ARROW_RIGHT_KEY,ARROW_DOWN_KEY].includes(t.key);i=getNextActiveElement(n,t.target,e,!0)}i&&(i.focus({preventScroll:!0}),e.getOrCreateInstance(i).show())}_getChildren(){return SelectorEngine.find(SELECTOR_INNER_ELEM,this._parent)}_getActiveElem(){return this._getChildren().find(e=>this._elemIsActive(e))||null}_setInitialAttributes(e,t){this._setAttributeIfNotExists(e,"role","tablist");for(const e of t)this._setInitialAttributesOnChild(e)}_setInitialAttributesOnChild(e){e=this._getInnerElement(e);const t=this._elemIsActive(e),n=this._getOuterElement(e);setAriaAttribute(e,"aria-selected",t),n!==e&&this._setAttributeIfNotExists(n,"role","presentation"),t||e.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(e,"role","tab"),this._setInitialAttributesOnTargetPanel(e)}_setInitialAttributesOnTargetPanel(e){const t=SelectorEngine.getElementFromSelector(e);t&&(this._setAttributeIfNotExists(t,"role","tabpanel"),e.id&&this._setAttributeIfNotExists(t,"aria-labelledby",`${e.id}`))}_toggleMenu(e,t){const n=this._getOuterElement(e),i=SelectorEngine.findOne(SELECTOR_MENU_TOGGLE,n);if(!i)return;const s=SelectorEngine.findOne(".menu",n);i.classList.toggle("active",t),s&&s.classList.toggle("show",t),setAriaAttribute(i,"aria-expanded",t)}_setAttributeIfNotExists(e,t,n){e.hasAttribute(t)||e.setAttribute(t,n)}_elemIsActive(e){return e.classList.contains("active")}_getInnerElement(e){return e.matches(SELECTOR_INNER_ELEM)?e:SelectorEngine.findOne(SELECTOR_INNER_ELEM,e)}_getOuterElement(e){return e.closest(SELECTOR_OUTER)||e}};EventHandler.on(document,"click.bs.tab",SELECTOR_DATA_TOGGLE$1,function(e){["A","AREA"].includes(this.tagName)&&e.preventDefault(),isDisabled(this)||Tab.getOrCreateInstance(this).show()}),EventHandler.on(window,"load.bs.tab",()=>{for(const e of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE))Tab.getOrCreateInstance(e)});const NAME$1="toast",EVENT_KEY$1=".bs.toast",EVENT_MOUSEOVER="mouseover.bs.toast",EVENT_MOUSEOUT="mouseout.bs.toast",EVENT_FOCUSIN="focusin.bs.toast",EVENT_FOCUSOUT="focusout.bs.toast",EVENT_HIDE="hide.bs.toast",EVENT_HIDDEN="hidden.bs.toast",EVENT_SHOW="show.bs.toast",EVENT_SHOWN="shown.bs.toast",CLASS_NAME_INSTANT="toast-instant",CLASS_NAME_SHOW="show",DefaultType$1={autohide:"boolean",delay:"number"},Default$1={autohide:!0,delay:5e3};var Toast=class extends BaseComponent{constructor(e,t){super(e,t),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Default$1}static get DefaultType(){return DefaultType$1}static get NAME(){return NAME$1}async show(){EventHandler.trigger(this._element,EVENT_SHOW).defaultPrevented||(this._clearTimeout(),this._element.classList.add("show"),await this._queueCallback(()=>{EventHandler.trigger(this._element,EVENT_SHOWN),this._maybeScheduleHide()},this._element,this._isAnimated()))}async hide(){this.isShown()&&(EventHandler.trigger(this._element,EVENT_HIDE).defaultPrevented||(this._element.classList.remove("show"),await this._queueCallback(()=>{EventHandler.trigger(this._element,EVENT_HIDDEN)},this._element,this._isAnimated())))}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove("show"),super.dispose()}isShown(){return this._element.classList.contains("show")}_isAnimated(){return!this._element.classList.contains("toast-instant")}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout(()=>{this.hide()},this._config.delay)))}_onInteraction(e,t){switch(e.type){case"mouseover":case"mouseout":this._hasMouseInteraction=t;break;case"focusin":case"focusout":this._hasKeyboardInteraction=t}if(t)return void this._clearTimeout();const n=e.relatedTarget;this._element===n||this._element.contains(n)||this._maybeScheduleHide()}_setListeners(){EventHandler.on(this._element,EVENT_MOUSEOVER,e=>this._onInteraction(e,!0)),EventHandler.on(this._element,EVENT_MOUSEOUT,e=>this._onInteraction(e,!1)),EventHandler.on(this._element,EVENT_FOCUSIN,e=>this._onInteraction(e,!0)),EventHandler.on(this._element,EVENT_FOCUSOUT,e=>this._onInteraction(e,!1))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}};enableDismissTrigger(Toast);const NAME="toggler",EVENT_KEY=".bs.toggler",EVENT_TOGGLE=`toggle${EVENT_KEY}`,EVENT_TOGGLED=`toggled${EVENT_KEY}`,EVENT_CLICK="click",SELECTOR_DATA_TOGGLE='[data-bs-toggle="toggler"]',DefaultType={attribute:"string",value:"(string|number|boolean|null)"},Default={attribute:"class",value:null};var Toggler=class extends BaseComponent{static get Default(){return Default}static get DefaultType(){return DefaultType}static get NAME(){return NAME}toggle(){EventHandler.trigger(this._element,EVENT_TOGGLE).defaultPrevented||(this._execute(),EventHandler.trigger(this._element,EVENT_TOGGLED))}_execute(){const{attribute:e,value:t}=this._config;"id"!==e&&null!=t&&("class"!==e?this._element.getAttribute(e)!==String(t)?this._element.setAttribute(e,t):this._element.removeAttribute(e):this._element.classList.toggle(t))}};eventActionOnPlugin(Toggler,"click",SELECTOR_DATA_TOGGLE,"toggle");export{Alert,Button,Carousel,Chips,Collapse,Combobox,Datepicker,Dialog,Drawer,Menu,NavOverflow,OtpInput,Popover,Range,ScrollSpy,Strength,Tab,Toast,Toggler,Tooltip}; diff --git a/assets/javascripts/bootstrap.js b/assets/javascripts/bootstrap.js index 59302cc3..24461016 100644 --- a/assets/javascripts/bootstrap.js +++ b/assets/javascripts/bootstrap.js @@ -1,4493 +1,6207 @@ /*! - * Bootstrap v5.3.8 (https://getbootstrap.com/) - * Copyright 2011-2025 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(require('@popperjs/core')) : - typeof define === 'function' && define.amd ? define(['@popperjs/core'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper)); -})(this, (function (Popper) { 'use strict'; +* Bootstrap v6.0.0-alpha.1 (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) +*/ +import { arrow, autoUpdate, computePosition, flip, offset, shift } from "@floating-ui/dom"; +import { Calendar, months } from "vanilla-calendar-pro"; +//#region js/src/dom/data.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap dom/data.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const elementMap = /* @__PURE__ */ new Map(); +var data_default = { + set(element, key, instance) { + if (!elementMap.has(element)) elementMap.set(element, /* @__PURE__ */ new Map()); + const instanceMap = elementMap.get(element); + if (!instanceMap.has(key) && instanceMap.size !== 0) { + console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${[...instanceMap.keys()][0]}.`); + return; + } + instanceMap.set(key, instance); + }, + get(element, key) { + if (element && elementMap.has(element)) return elementMap.get(element).get(key) || null; + return null; + }, + getAny(element) { + if (element && elementMap.has(element)) return elementMap.get(element).values().next().value || null; + return null; + }, + remove(element, key) { + if (!elementMap.has(element)) return; + const instanceMap = elementMap.get(element); + instanceMap.delete(key); + if (instanceMap.size === 0) elementMap.delete(element); + } +}; +//#endregion +//#region js/src/dom/event-handler.ts +/** +* Constants +*/ +const namespaceRegex = /[^.]*(?=\..*)\.|.*/; +const stripNameRegex = /\..*/; +const stripUidRegex = /::\d+$/; +const eventRegistry = {}; +let uidEvent = 1; +const customEvents = { + mouseenter: "mouseover", + mouseleave: "mouseout" +}; +const nativeEvents = /* @__PURE__ */ new Set([ + "click", + "dblclick", + "mouseup", + "mousedown", + "contextmenu", + "mousewheel", + "DOMMouseScroll", + "mouseover", + "mouseout", + "mousemove", + "selectstart", + "selectend", + "keydown", + "keypress", + "keyup", + "input", + "paste", + "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", + "scrollend" +]); +/** +* 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 isMouseEventWithinTarget(event) { + const { delegateTarget, relatedTarget } = event; + return Boolean(relatedTarget && delegateTarget.contains(relatedTarget)); +} +function bootstrapHandler(element, fn, handlerTypeEvent) { + const isCustomMouseEvent = handlerTypeEvent in customEvents; + return function handler(event) { + const bootstrapEvent = hydrateObj(event, { delegateTarget: element }); + if (isCustomMouseEvent && isMouseEventWithinTarget(bootstrapEvent)) return; + if (handler.oneOff) EventHandler.off(element, handlerTypeEvent, fn); + return fn.apply(element, [bootstrapEvent]); + }; +} +function bootstrapDelegationHandler(element, selector, fn, handlerTypeEvent) { + const isCustomMouseEvent = handlerTypeEvent in customEvents; + 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; + const bootstrapEvent = hydrateObj(event, { delegateTarget: target }); + if (isCustomMouseEvent && isMouseEventWithinTarget(bootstrapEvent)) return; + if (handler.oneOff) EventHandler.off(element, handlerTypeEvent, selector, fn); + return fn.apply(target, [bootstrapEvent]); + } + }; +} +function findHandler(events, callable, handlerTypeEvent, delegationSelector = null) { + return Object.values(events).find((event) => event.callable === callable && event.handlerTypeEvent === handlerTypeEvent && event.delegationSelector === delegationSelector); +} +function normalizeParameters(originalTypeEvent, handler, delegationFunction) { + const isDelegated = typeof handler === "string"; + const callable = isDelegated ? delegationFunction : handler || delegationFunction; + const baseTypeEvent = originalTypeEvent.replace(stripNameRegex, ""); + let typeEvent = customEvents[baseTypeEvent] || baseTypeEvent; + if (!nativeEvents.has(typeEvent)) typeEvent = originalTypeEvent; + const handlerTypeEvent = baseTypeEvent in customEvents ? baseTypeEvent : typeEvent; + return { + isDelegated, + callable, + typeEvent, + handlerTypeEvent + }; +} +function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { + if (typeof originalTypeEvent !== "string" || !element) return; + const { isDelegated, callable, typeEvent, handlerTypeEvent } = normalizeParameters(originalTypeEvent, handler, delegationFunction); + const events = getElementEvents(element); + const handlers = events[typeEvent] || (events[typeEvent] = {}); + const previousFunction = findHandler(handlers, callable, handlerTypeEvent, 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, handlerTypeEvent) : bootstrapHandler(element, callable, handlerTypeEvent); + fn.delegationSelector = isDelegated ? handler : null; + fn.callable = callable; + fn.handlerTypeEvent = handlerTypeEvent; + fn.oneOff = oneOff; + fn.uidEvent = uid; + handlers[uid] = fn; + element.addEventListener(typeEvent, fn, isDelegated); +} +function removeHandler(element, events, typeEvent, handler) { + element.removeEventListener(typeEvent, handler, Boolean(handler.delegationSelector)); + delete events[typeEvent][handler.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); +} +function trigger(element, event, args) { + if (typeof event !== "string" || !element) return null; + const evt = hydrateObj(new Event(event, { + bubbles: true, + cancelable: true + }), args); + element.dispatchEvent(evt); + return evt; +} +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, handlerTypeEvent } = normalizeParameters(originalTypeEvent, handler, delegationFunction); + const inNamespace = typeEvent !== originalTypeEvent && handlerTypeEvent !== originalTypeEvent; + const events = getElementEvents(element); + const storeElementEvent = events[typeEvent] || {}; + const isNamespace = originalTypeEvent.startsWith("."); + if (typeof callable !== "undefined") { + if (!Object.keys(storeElementEvent).length) return; + const fn = findHandler(storeElementEvent, callable, handlerTypeEvent, isDelegated ? handler : null); + if (fn) removeHandler(element, events, typeEvent, fn); + 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 (event.handlerTypeEvent === handlerTypeEvent && (!inNamespace || originalTypeEvent.includes(handlerKey))) removeHandler(element, events, typeEvent, event); + } + }, + trigger +}; +function hydrateObj(obj, meta = {}) { + for (const [key, value] of Object.entries(meta)) try { + obj[key] = value; + } catch { + Object.defineProperty(obj, key, { + configurable: true, + get() { + return value; + } + }); + } + return obj; +} +//#endregion +//#region js/src/dom/manipulator.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap dom/manipulator.ts +* 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 { + 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)}`)); + } +}; +//#endregion +//#region js/src/util/index.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap util/index.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +const MAX_UID = 1e6; +const MILLISECONDS_MULTIPLIER = 1e3; +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 selector - The selector to escape +* @returns The escaped selector +*/ +const parseSelector = (selector) => { + if (selector && window.CSS && window.CSS.escape) selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`); + return selector; +}; +const toType = (object) => { + if (object === null || object === void 0) 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; + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + if (!Number.parseFloat(transitionDuration) && !Number.parseFloat(transitionDelay)) return 0; + 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 = (object) => { + if (!object || typeof object !== "object") return false; + return typeof object.nodeType !== "undefined"; +}; +const getElement = (object) => { + if (isElement(object)) return object; + if (typeof object === "string" && object.length > 0) return document.querySelector(parseSelector(object)); + return null; +}; +const isVisible = (element) => { + if (!isElement(element) || element.getClientRects().length === 0) return false; + const elementIsVisible = getComputedStyle(element).getPropertyValue("visibility") === "visible"; + 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; + const disableableElement = element; + if (typeof disableableElement.disabled !== "undefined") return disableableElement.disabled; + return element.hasAttribute("disabled") && element.getAttribute("disabled") !== "false"; +}; +const setAriaAttribute = (element, name, value) => { + element.setAttribute(name, String(value)); +}; +const findShadowRoot = (element) => { + if (!document.documentElement.attachShadow) return null; + if (typeof element.getRootNode === "function") { + const root = element.getRootNode(); + return root instanceof ShadowRoot ? root : null; + } + if (element instanceof ShadowRoot) return element; + if (!element.parentNode) return null; + return findShadowRoot(element.parentNode); +}; +const noop = () => {}; +const isRTL = () => document.documentElement.dir === "rtl"; +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 emulatedDuration = getTransitionDurationFromElement(transitionElement) + 5; + 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 list - The list of elements to traverse +* @param activeElement - The currently active element +* @param shouldGetNext - Whether to return the next element (`true`) or the previous one (`false`) +* @param isCycleAllowed - Whether to cycle back to the opposite end of the list when reaching the boundary +* @returns The appropriate previous/next element from the list +*/ +const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { + const listLength = list.length; + let index = list.indexOf(activeElement); + 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))]; +}; +//#endregion +//#region js/src/util/config.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap util/config.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Class definition +*/ +var Config = class { + 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(element) ? Manipulator.getDataAttribute(element, "config") : {}; + return { + ...this.constructor.Default, + ...typeof jsonConfig === "object" ? jsonConfig : {}, + ...isElement(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(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}".`); + } + } +}; +//#endregion +//#region js/src/base-component.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap base-component.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const VERSION = "6.0.0-alpha.1"; +/** +* Class definition +*/ +var BaseComponent = class extends Config { + constructor(element, config) { + super(); + element = getElement(element); + if (!element) return; + this._element = element; + this._config = this._getConfig(config); + const existingInstance = data_default.get(this._element, this.constructor.DATA_KEY); + if (existingInstance) existingInstance.dispose(); + data_default.set(this._element, this.constructor.DATA_KEY, this); + } + dispose() { + data_default.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; + } + _queueCallback(callback, element, isAnimated = true) { + return new Promise((resolve) => { + executeAfterTransition(() => { + if (this._element) callback(); + resolve(); + }, element, isAnimated); + }); + } + _getConfig(config) { + config = this._mergeConfigObj(config, this._element); + config = this._configAfterMerge(config); + this._typeCheckConfig(config); + return config; + } + static getInstance(element) { + return data_default.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}`; + } +}; +//#endregion +//#region js/src/dom/selector-engine.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap dom/selector-engine.ts +* 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"); + if (!hrefAttribute || !hrefAttribute.includes("#") && !hrefAttribute.startsWith(".")) return null; + 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 [...Element.prototype.querySelectorAll.call(element, selector)]; + }, + findOne(selector, element = document.documentElement) { + return Element.prototype.querySelector.call(element, selector); + }, + parents(element, selector) { + const parents = []; + let ancestor = element.parentNode.closest(selector); + while (ancestor) { + parents.push(ancestor); + ancestor = ancestor.parentNode.closest(selector); + } + return parents; + }, + closest(element, selector) { + return Element.prototype.closest.call(element, selector); + }, + prev(element, selector) { + let previous = element.previousElementSibling; + while (previous) { + if (previous.matches(selector)) return [previous]; + previous = previous.previousElementSibling; + } + return []; + }, + next(element, selector) { + let next = element.nextElementSibling; + while (next) { + if (next.matches(selector)) return [next]; + next = next.nextElementSibling; + } + return []; + }, + 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) : []; + } +}; +//#endregion +//#region js/src/util/component-functions.ts +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}, [class*=":${name}"]`); + component.getOrCreateInstance(target)[method](); + }); +}; +const eventActionOnPlugin = (Plugin, onEvent, stringSelector, method, callback = null) => { + eventAction(`${onEvent}.${Plugin.NAME}`, stringSelector, (data) => { + const instances = data.targets.filter(Boolean).map((element) => Plugin.getOrCreateInstance(element)); + if (typeof callback === "function") callback({ + ...data, + instances + }); + for (const instance of instances) instance[method](); + }); +}; +const eventAction = (onEvent, stringSelector, callback) => { + const selector = `${stringSelector}:not(.disabled):not(:disabled)`; + EventHandler.on(document, onEvent, selector, function(event) { + if (["A", "AREA"].includes(this.tagName)) event.preventDefault(); + const selector = SelectorEngine.getSelectorFromElement(this); + callback({ + targets: selector ? SelectorEngine.find(selector) : [this], + event + }); + }); +}; +//#endregion +//#region js/src/alert.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap alert.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$21 = "alert"; +const EVENT_KEY$18 = `.bs.alert`; +const EVENT_CLOSE = `close${EVENT_KEY$18}`; +const EVENT_CLOSED = `closed${EVENT_KEY$18}`; +const CLASS_NAME_HIDING = "hiding"; +const CLASS_NAME_SHOW$7 = "show"; +/** +* Class definition +*/ +var Alert = class extends BaseComponent { + static get NAME() { + return NAME$21; + } + async close() { + if (EventHandler.trigger(this._element, EVENT_CLOSE).defaultPrevented) return; + this._element.classList.remove(CLASS_NAME_SHOW$7); + this._element.classList.add(CLASS_NAME_HIDING); + const isAnimated = getTransitionDurationFromElement(this._element) > 0; + await this._queueCallback(() => this._destroyElement(), this._element, isAnimated); + } + _destroyElement() { + this._element.remove(); + EventHandler.trigger(this._element, EVENT_CLOSED); + this.dispose(); + } +}; +/** +* Data API implementation +*/ +enableDismissTrigger(Alert, "close"); +//#endregion +//#region js/src/button.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap button.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$20 = "button"; +const EVENT_KEY$17 = `.bs.button`; +const DATA_API_KEY$12 = ".data-api"; +const CLASS_NAME_ACTIVE$4 = "active"; +const SELECTOR_DATA_TOGGLE$10 = "[data-bs-toggle=\"button\"]"; +const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$17}${DATA_API_KEY$12}`; +const EVENT_DOM_CONTENT_LOADED$1 = `DOMContentLoaded${EVENT_KEY$17}${DATA_API_KEY$12}`; +/** +* Class definition +*/ +var Button = class extends BaseComponent { + static get NAME() { + return NAME$20; + } + toggle() { + setAriaAttribute(this._element, "aria-pressed", this._element.classList.toggle(CLASS_NAME_ACTIVE$4)); + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$8, SELECTOR_DATA_TOGGLE$10, (event) => { + event.preventDefault(); + const button = event.target.closest(SELECTOR_DATA_TOGGLE$10); + Button.getOrCreateInstance(button).toggle(); +}); +EventHandler.on(document, EVENT_DOM_CONTENT_LOADED$1, () => { + for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE$10)) if (!element.hasAttribute("aria-pressed")) setAriaAttribute(element, "aria-pressed", element.classList.contains(CLASS_NAME_ACTIVE$4)); +}); +//#endregion +//#region js/src/carousel.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap carousel.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$19 = "carousel"; +const EVENT_KEY$16 = `.bs.carousel`; +const DATA_API_KEY$11 = ".data-api"; +const ARROW_LEFT_KEY$2 = "ArrowLeft"; +const ARROW_RIGHT_KEY$2 = "ArrowRight"; +const DIRECTION_LEFT = "left"; +const DIRECTION_RIGHT = "right"; +const EVENT_SLIDE = `slide${EVENT_KEY$16}`; +const EVENT_SLID = `slid${EVENT_KEY$16}`; +const EVENT_KEYDOWN$2 = `keydown${EVENT_KEY$16}`; +const EVENT_MOUSEENTER$2 = `mouseenter${EVENT_KEY$16}`; +const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$16}`; +const EVENT_POINTERDOWN$3 = `pointerdown${EVENT_KEY$16}`; +const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$16}${DATA_API_KEY$11}`; +const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$16}${DATA_API_KEY$11}`; +const CLASS_NAME_CAROUSEL = "carousel"; +const CLASS_NAME_ACTIVE$3 = "active"; +const CLASS_NAME_FADE = "carousel-fade"; +const CLASS_NAME_CENTER = "carousel-center"; +const CLASS_NAME_AUTO = "carousel-auto"; +const CLASS_NAME_CLONE = "carousel-item-clone"; +const CLASS_NAME_PAUSED = "paused"; +const CLASS_NAME_PLAYING = "carousel-playing"; +const PROPERTY_INTERVAL = "--bs-carousel-interval"; +const SCROLL_DURATION = 300; +const ACTIVE_RATIO_TOLERANCE = .05; +const SELECTOR_ACTIVE = ".active"; +const SELECTOR_ITEM = `.carousel-item:not(.${CLASS_NAME_CLONE})`; +const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM; +const SELECTOR_INNER$1 = ".carousel-inner"; +const SELECTOR_INDICATORS = ".carousel-indicators"; +const SELECTOR_PLAY_PAUSE = ".carousel-control-play-pause"; +const SELECTOR_DATA_SLIDE = "[data-bs-slide], [data-bs-slide-to]"; +const SELECTOR_DATA_SLIDE_PREV = "[data-bs-slide=\"prev\"]"; +const SELECTOR_DATA_SLIDE_NEXT = "[data-bs-slide=\"next\"]"; +const SELECTOR_DATA_AUTOPLAY = "[data-bs-autoplay=\"true\"]"; +const KEY_TO_DIRECTION = { + [ARROW_LEFT_KEY$2]: DIRECTION_RIGHT, + [ARROW_RIGHT_KEY$2]: DIRECTION_LEFT +}; +const ENDS_STOP = "stop"; +const ENDS_WRAP = "wrap"; +const ENDS_LOOP = "loop"; +const Default$18 = { + autoplay: false, + ends: ENDS_LOOP, + interval: 5e3, + keyboard: true, + pause: "hover" +}; +const DefaultType$18 = { + autoplay: "boolean", + ends: "string", + interval: "number", + keyboard: "boolean", + pause: "(string|boolean)" +}; +const easeInOutCubic = (progress) => progress < .5 ? 4 * progress * progress * progress : 1 - (-2 * progress + 2) ** 3 / 2; +/** +* Class definition +*/ +var Carousel = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._viewport = SelectorEngine.findOne(SELECTOR_INNER$1, this._element) || this._element; + this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); + this._playPauseElement = SelectorEngine.findOne(SELECTOR_PLAY_PAUSE, this._element); + this._prevControls = SelectorEngine.find(SELECTOR_DATA_SLIDE_PREV, this._element); + this._nextControls = SelectorEngine.find(SELECTOR_DATA_SLIDE_NEXT, this._element); + this._interval = null; + this._observer = null; + this._scrollFrame = null; + this._looping = false; + this._visibility = /* @__PURE__ */ new Map(); + this._playing = this._config.autoplay; + this._activeIndex = this._initialActiveIndex(); + this._addEventListeners(); + this._observeItems(); + this._refreshActiveState(); + if (this._playing) this.cycle(); + this._updatePlayPauseControl(); + } + static get Default() { + return Default$18; + } + static get DefaultType() { + return DefaultType$18; + } + static get NAME() { + return NAME$19; + } + next() { + this.to(this._navIndex() + 1); + } + nextWhenVisible() { + if (document.visibilityState === "visible" && isVisible(this._element)) this.next(); + } + prev() { + this.to(this._navIndex() - 1); + } + pause() { + this._clearInterval(); + this._element.classList.remove(CLASS_NAME_PLAYING); + } + cycle() { + this._clearInterval(); + this._scheduleAutoplay(); + this._element.classList.add(CLASS_NAME_PLAYING); + } + to(index) { + if (this._looping) return; + const items = this._getItems(); + const rawIndex = Number.parseInt(index, 10); + if (this._config.ends === ENDS_LOOP && !this._prefersReducedMotion() && this._canLoop()) { + if (rawIndex > items.length - 1) { + this._loopTransition(true); + return; + } + if (rawIndex < 0) { + this._loopTransition(false); + return; + } + } + const targetIndex = this._normalizeIndex(rawIndex, items.length); + const currentIndex = this._navIndex(); + if (targetIndex === null || targetIndex === currentIndex) return; + if (EventHandler.trigger(this._element, EVENT_SLIDE, { + relatedTarget: items[targetIndex], + direction: this._direction(currentIndex, targetIndex), + from: currentIndex, + to: targetIndex + }).defaultPrevented) return; + if (this._isFade()) { + this._fadeTo(targetIndex); + return; + } + this._scrollToIndex(targetIndex); + } + dispose() { + this._clearInterval(); + if (this._observer) this._observer.disconnect(); + if (this._scrollFrame !== null) cancelAnimationFrame(this._scrollFrame); + for (const clone of SelectorEngine.find(`.${CLASS_NAME_CLONE}`, this._viewport)) clone.remove(); + this._viewport.style.scrollSnapType = ""; + EventHandler.off(this._viewport, EVENT_KEY$16); + super.dispose(); + } + _configAfterMerge(config) { + if (![ + ENDS_STOP, + ENDS_WRAP, + ENDS_LOOP + ].includes(config.ends)) config.ends = Default$18.ends; + return config; + } + _initialActiveIndex() { + const active = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + const index = active ? this._getItems().indexOf(active) : 0; + return Math.max(index, 0); + } + _addEventListeners() { + if (this._config.keyboard) EventHandler.on(this._element, EVENT_KEYDOWN$2, (event) => this._keydown(event)); + if (this._config.pause === "hover") { + EventHandler.on(this._element, EVENT_MOUSEENTER$2, () => this.pause()); + EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle()); + } + EventHandler.on(this._viewport, EVENT_POINTERDOWN$3, () => this._pauseFromInteraction()); + } + _keydown(event) { + if (/input|textarea/i.test(event.target.tagName)) return; + const direction = KEY_TO_DIRECTION[event.key]; + if (direction) { + event.preventDefault(); + this._pauseFromInteraction(); + if (direction === DIRECTION_RIGHT) this.prev(); + else this.next(); + } + } + _observeItems() { + if (this._isFade() || typeof IntersectionObserver === "undefined") return; + this._observer = new IntersectionObserver((entries) => this._handleIntersection(entries), { + root: this._viewport, + threshold: [ + 0, + .25, + .5, + .75, + 1 + ] + }); + for (const item of this._getItems()) this._observer.observe(item); + } + _handleIntersection(entries) { + if (this._looping) return; + for (const entry of entries) this._visibility.set(entry.target, entry.isIntersecting ? entry.intersectionRatio : 0); + const ratios = this._getItems().map((item) => this._visibility.get(item) ?? 0); + const maxRatio = Math.max(...ratios); + let bestIndex = this._activeIndex; + if (maxRatio > 0) bestIndex = ratios.findIndex((ratio) => ratio >= maxRatio - ACTIVE_RATIO_TOLERANCE); + this._setActive(bestIndex); + this._updateEndControls(); + } + _navIndex() { + if (this._isFade() || this._viewport.scrollWidth - this._viewport.clientWidth <= 0) return this._activeIndex; + let index = this._activeIndex; + let smallestDelta = Number.POSITIVE_INFINITY; + for (const [itemIndex, item] of this._getItems().entries()) { + const delta = Math.abs(this._scrollDelta(item)); + if (delta < smallestDelta) { + smallestDelta = delta; + index = itemIndex; + } + } + return index; + } + _scrollToIndex(index) { + const item = this._getItems()[index]; + if (!item) return; + const left = this._scrollDelta(item); + if (Math.abs(left) < 1) return; + const targetLeft = this._viewport.scrollLeft + left; + this._viewport.style.scrollSnapType = "none"; + this._animateScroll(targetLeft, () => { + this._viewport.style.scrollSnapType = ""; + if (!this._observer) this._setActive(index); + this._updateEndControls(); + }); + } + _animateScroll(targetLeft, onComplete) { + if (this._scrollFrame !== null) { + cancelAnimationFrame(this._scrollFrame); + this._scrollFrame = null; + } + const startLeft = this._viewport.scrollLeft; + const distance = targetLeft - startLeft; + if (this._prefersReducedMotion() || typeof requestAnimationFrame === "undefined") { + this._viewport.scrollTo({ + left: targetLeft, + behavior: "instant" + }); + onComplete(); + return; + } + let startTime = null; + const step = (now) => { + if (startTime === null) startTime = now; + const progress = Math.min((now - startTime) / SCROLL_DURATION, 1); + this._viewport.scrollTo({ + left: startLeft + distance * easeInOutCubic(progress), + behavior: "instant" + }); + if (progress < 1) { + this._scrollFrame = requestAnimationFrame(step); + return; + } + this._viewport.scrollTo({ + left: targetLeft, + behavior: "instant" + }); + this._scrollFrame = null; + onComplete(); + }; + this._scrollFrame = requestAnimationFrame(step); + } + _scrollDelta(element) { + const viewportRect = this._viewport.getBoundingClientRect(); + const rect = element.getBoundingClientRect(); + if (this._element.classList.contains(CLASS_NAME_CENTER)) return rect.left + rect.width / 2 - (viewportRect.left + viewportRect.width / 2); + const padStart = Number.parseFloat(getComputedStyle(this._viewport).scrollPaddingInlineStart) || 0; + return isRTL() ? rect.right - (viewportRect.right - padStart) : rect.left - (viewportRect.left + padStart); + } + _loopTransition(isNext) { + const items = this._getItems(); + const last = items.length - 1; + const fromIndex = this._activeIndex; + const toIndex = isNext ? 0 : last; + const direction = this._loopDirection(isNext); + if (EventHandler.trigger(this._element, EVENT_SLIDE, { + relatedTarget: items[toIndex], + direction, + from: fromIndex, + to: toIndex + }).defaultPrevented) return; + this._looping = true; + const clone = (isNext ? items[0] : items[last]).cloneNode(true); + clone.classList.add(CLASS_NAME_CLONE); + clone.classList.remove(CLASS_NAME_ACTIVE$3); + clone.removeAttribute("id"); + for (const node of SelectorEngine.find("[id]", clone)) node.removeAttribute("id"); + clone.setAttribute("aria-hidden", "true"); + clone.inert = true; + this._viewport.style.scrollSnapType = "none"; + if (isNext) this._viewport.append(clone); + else { + this._viewport.prepend(clone); + this._jumpScroll(this._scrollDelta(items[fromIndex])); + } + this._animateScroll(this._viewport.scrollLeft + this._scrollDelta(clone), () => { + clone.remove(); + this._jumpScroll(this._scrollDelta(items[toIndex])); + this._activeIndex = toIndex; + this._refreshActiveState(); + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: items[toIndex], + direction, + from: fromIndex, + to: toIndex + }); + this._viewport.style.scrollSnapType = ""; + this._looping = false; + }); + } + _loopDirection(isNext) { + if (isRTL()) return isNext ? DIRECTION_RIGHT : DIRECTION_LEFT; + return isNext ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + _jumpScroll(delta) { + this._viewport.style.scrollSnapType = "none"; + this._viewport.scrollBy({ + left: delta, + top: 0, + behavior: "instant" + }); + } + _fadeTo(index) { + this._setActive(index); + } + _setActive(index) { + const items = this._getItems(); + if (index === this._activeIndex || !items[index]) return; + const from = this._activeIndex; + this._activeIndex = index; + this._refreshActiveState(); + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: items[index], + direction: this._direction(from, index), + from, + to: index + }); + } + _refreshActiveState() { + const items = this._getItems(); + for (const [index, item] of items.entries()) item.classList.toggle(CLASS_NAME_ACTIVE$3, index === this._activeIndex); + this._setActiveIndicatorElement(this._activeIndex); + this._updateEndControls(); + } + _updateEndControls() { + if (this._config.ends !== ENDS_STOP) return; + const viewport = this._viewport; + const maxScroll = viewport.scrollWidth - viewport.clientWidth; + let atStart; + let atEnd; + if (maxScroll > 0) { + const progress = Math.abs(viewport.scrollLeft); + atStart = progress <= 1; + atEnd = progress >= maxScroll - 1; + } else { + const last = this._getItems().length - 1; + atStart = this._activeIndex <= 0; + atEnd = this._activeIndex >= last; + } + this._setControlsDisabled(this._prevControls, atStart); + this._setControlsDisabled(this._nextControls, atEnd); + } + _setControlsDisabled(controls, disabled) { + for (const control of controls) { + if (disabled && control === document.activeElement) ((controls === this._prevControls ? this._nextControls : this._prevControls)[0] ?? this._viewport).focus({ preventScroll: true }); + control.disabled = disabled; + } + } + _setActiveIndicatorElement(index) { + if (!this._indicatorsElement) return; + const active = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement); + if (active) { + active.classList.remove(CLASS_NAME_ACTIVE$3); + active.removeAttribute("aria-current"); + } + const newActive = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement); + if (newActive) { + newActive.classList.add(CLASS_NAME_ACTIVE$3); + newActive.setAttribute("aria-current", "true"); + } + } + _normalizeIndex(index, length) { + if (Number.isNaN(index) || length === 0) return null; + if (index < 0) return this._wrapsAround() ? length - 1 : null; + if (index > length - 1) return this._wrapsAround() ? 0 : null; + return index; + } + _wrapsAround() { + return this._config.ends === ENDS_WRAP || this._config.ends === ENDS_LOOP; + } + _canLoop() { + if (this._isFade() || this._getItems().length < 2) return false; + const styles = getComputedStyle(this._element); + const num = (name) => Number.parseFloat(styles.getPropertyValue(name)) || 0; + return (num("--bs-carousel-items") || 1) === 1 && num("--bs-carousel-items-peek") === 0 && !this._element.classList.contains(CLASS_NAME_CENTER) && !this._element.classList.contains(CLASS_NAME_AUTO); + } + _direction(from, to) { + const isNext = to > from; + if (isRTL()) return isNext ? DIRECTION_RIGHT : DIRECTION_LEFT; + return isNext ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + _scheduleAutoplay(index = this._activeIndex) { + const interval = this._itemInterval(index); + this._element.style.setProperty(PROPERTY_INTERVAL, `${interval}ms`); + this._interval = setTimeout(() => { + const upcoming = this._upcomingIndex(); + this.nextWhenVisible(); + if (upcoming === null) { + this.pause(); + return; + } + this._scheduleAutoplay(upcoming); + }, interval); + } + _upcomingIndex() { + return this._normalizeIndex(this._navIndex() + 1, this._getItems().length); + } + _itemInterval(index = this._activeIndex) { + const item = this._getItems()[index]; + const interval = item ? Number.parseInt(item.getAttribute("data-bs-interval"), 10) : NaN; + return Number.isNaN(interval) ? this._config.interval : interval; + } + _maybeEnableCycle() { + if (!this._playing) return; + this.cycle(); + } + _pauseFromInteraction() { + this._playing = false; + this.pause(); + this._updatePlayPauseControl(); + } + _togglePlayPause() { + if (this._playing) { + this._pauseFromInteraction(); + return; + } + this._playing = true; + this.cycle(); + this._updatePlayPauseControl(); + } + _updatePlayPauseControl() { + if (!this._playPauseElement) return; + this._playPauseElement.classList.toggle(CLASS_NAME_PAUSED, !this._playing); + const label = this._playPauseElement.getAttribute(this._playing ? "data-bs-pause-label" : "data-bs-play-label"); + if (label) this._playPauseElement.setAttribute("aria-label", label); + } + _isFade() { + return this._element.classList.contains(CLASS_NAME_FADE); + } + _prefersReducedMotion() { + return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches; + } + _getItems() { + return SelectorEngine.find(SELECTOR_ITEM, this._element); + } + _clearInterval() { + if (this._interval) { + clearTimeout(this._interval); + this._interval = null; + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$7, 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); + carousel._pauseFromInteraction(); + const slideIndex = this.getAttribute("data-bs-slide-to"); + if (slideIndex) { + carousel.to(slideIndex); + return; + } + if (Manipulator.getDataAttribute(this, "slide") === "next") { + carousel.next(); + return; + } + carousel.prev(); +}); +EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_PLAY_PAUSE, function(event) { + const target = SelectorEngine.getElementFromSelector(this); + if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) return; + event.preventDefault(); + Carousel.getOrCreateInstance(target)._togglePlayPause(); +}); +EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => { + const carousels = SelectorEngine.find(SELECTOR_DATA_AUTOPLAY); + for (const carousel of carousels) Carousel.getOrCreateInstance(carousel); +}); +//#endregion +//#region js/src/collapse.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap collapse.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$18 = "collapse"; +const EVENT_KEY$15 = `.bs.collapse`; +const DATA_API_KEY$10 = ".data-api"; +const EVENT_SHOW$7 = `show${EVENT_KEY$15}`; +const EVENT_SHOWN$6 = `shown${EVENT_KEY$15}`; +const EVENT_HIDE$6 = `hide${EVENT_KEY$15}`; +const EVENT_HIDDEN$8 = `hidden${EVENT_KEY$15}`; +const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$15}${DATA_API_KEY$10}`; +const CLASS_NAME_SHOW$6 = "show"; +const CLASS_NAME_COLLAPSE = "collapse"; +const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; +const SELECTOR_ACTIVES = ".collapse.show"; +const SELECTOR_DATA_TOGGLE$9 = "[data-bs-toggle=\"collapse\"]"; +const Default$17 = { parent: null }; +const DefaultType$17 = { parent: "(null|element)" }; +/** +* Class definition +*/ +var Collapse = class Collapse extends BaseComponent { + constructor(element, config) { + super(element, config); + this._isTransitioning = false; + this._triggerArray = []; + const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$9); + 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._setAriaExpanded(this._triggerArray, this._isShown()); + } + static get Default() { + return Default$17; + } + static get DefaultType() { + return DefaultType$17; + } + static get NAME() { + return NAME$18; + } + toggle() { + return this._isShown() ? this.hide() : this.show(); + } + async show() { + if (this._isTransitioning || this._isShown()) return; + let activeChildren = []; + if (this._config.parent) activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter((element) => element !== this._element && !this._sharesTrigger(element)).map((element) => Collapse.getOrCreateInstance(element)); + if (activeChildren.length && activeChildren[0]._isTransitioning) return; + if (EventHandler.trigger(this._element, EVENT_SHOW$7).defaultPrevented) return; + for (const activeInstance of activeChildren) activeInstance.hide(); + this._element.classList.add(CLASS_NAME_SHOW$6); + this._setAriaExpanded(this._triggerArray, true); + this._isTransitioning = true; + const complete = () => { + this._isTransitioning = false; + EventHandler.trigger(this._element, EVENT_SHOWN$6); + }; + await this._queueCallback(complete, this._element, this._isAnimated()); + } + async hide() { + if (this._isTransitioning || !this._isShown()) return; + if (EventHandler.trigger(this._element, EVENT_HIDE$6).defaultPrevented) return; + this._element.classList.remove(CLASS_NAME_SHOW$6); + for (const trigger of this._triggerArray) { + const element = SelectorEngine.getElementFromSelector(trigger); + if (element && !this._isShown(element)) this._setAriaExpanded([trigger], false); + } + this._isTransitioning = true; + const complete = () => { + this._isTransitioning = false; + EventHandler.trigger(this._element, EVENT_HIDDEN$8); + }; + await this._queueCallback(complete, this._element, this._isAnimated()); + } + _isShown(element = this._element) { + return element.classList.contains(CLASS_NAME_SHOW$6); + } + _isAnimated() { + return getTransitionDurationFromElement(this._element) > 0; + } + _sharesTrigger(element) { + return this._triggerArray.some((trigger) => SelectorEngine.getMultipleElementsFromSelector(trigger).includes(element)); + } + _configAfterMerge(config) { + config.parent = getElement(config.parent); + return config; + } + _initializeChildren() { + if (!this._config.parent) return; + const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$9); + for (const element of children) { + const selected = SelectorEngine.getElementFromSelector(element); + if (selected) this._setAriaExpanded([element], this._isShown(selected)); + } + } + _getFirstLevelChildren(selector) { + const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); + return SelectorEngine.find(selector, this._config.parent).filter((element) => !children.includes(element)); + } + _setAriaExpanded(triggerArray, isOpen) { + if (!triggerArray.length) return; + for (const element of triggerArray) setAriaAttribute(element, "aria-expanded", isOpen); + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$9, function(event) { + if (event.target.tagName === "A" || event.delegateTarget && event.delegateTarget.tagName === "A") event.preventDefault(); + for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) Collapse.getOrCreateInstance(element).toggle(); +}); +//#endregion +//#region js/src/util/floating-ui.ts +/** +* Breakpoints for responsive placement (matches SCSS $breakpoints) +*/ +const BREAKPOINTS = { + sm: 576, + md: 768, + lg: 1024, + xl: 1280, + "2xl": 1536 +}; +/** +* Parse a placement string that may contain responsive prefixes +* Example: "bottom-start md:top-end lg:right" returns { xs: 'bottom-start', md: 'top-end', lg: 'right' } +* +* @param placementString - The placement string to parse +* @param defaultPlacement - The default placement to use for xs/base +* @returns Object with breakpoint keys and placement values, or null if not responsive +*/ +const parseResponsivePlacement = (placementString, defaultPlacement = "bottom") => { + if (!placementString || !placementString.includes(":")) return null; + const parts = placementString.split(/\s+/); + const placements = { xs: defaultPlacement }; + for (const part of parts) if (part.includes(":")) { + const [breakpoint, placement] = part.split(":"); + if (BREAKPOINTS[breakpoint] !== void 0) placements[breakpoint] = placement; + } else placements.xs = part; + return placements; +}; +/** +* Get the active placement for the current viewport width +* +* @param responsivePlacements - Object with breakpoint keys and placement values +* @param defaultPlacement - Fallback placement +* @returns The active placement for current viewport +*/ +const getResponsivePlacement = (responsivePlacements, defaultPlacement = "bottom") => { + if (!responsivePlacements) return defaultPlacement; + const viewportWidth = window.innerWidth; + let activePlacement = responsivePlacements.xs || defaultPlacement; + for (const breakpoint of [ + "sm", + "md", + "lg", + "xl", + "2xl" + ]) if (viewportWidth >= BREAKPOINTS[breakpoint] && responsivePlacements[breakpoint]) activePlacement = responsivePlacements[breakpoint]; + return activePlacement; +}; +/** +* Create media query listeners for responsive placement changes +* +* @param callback - Callback to run when breakpoint changes +* @returns Array of { mql, handler } objects for cleanup +*/ +const createBreakpointListeners = (callback) => { + const listeners = []; + for (const breakpoint of Object.keys(BREAKPOINTS)) { + const minWidth = BREAKPOINTS[breakpoint]; + const mql = window.matchMedia(`(min-width: ${minWidth}px)`); + mql.addEventListener("change", callback); + listeners.push({ + mql, + handler: callback + }); + } + return listeners; +}; +/** +* Clean up media query listeners +* +* @param listeners - Array of { mql, handler } objects +*/ +const disposeBreakpointListeners = (listeners) => { + for (const { mql, handler } of listeners) mql.removeEventListener("change", handler); +}; +/** +* Normalize an offset value into Floating UI's offset shape. +* A `[skidding, distance]` array becomes `{ mainAxis: distance, crossAxis: skidding }`; +* numbers and axis objects pass through unchanged. +*/ +const toFloatingOffset = (value) => { + return Array.isArray(value) ? { + mainAxis: value[1] || 0, + crossAxis: value[0] || 0 + } : value; +}; +//#endregion +//#region js/src/menu.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap menu.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$17 = "menu"; +const EVENT_KEY$14 = `.bs.menu`; +const DATA_API_KEY$9 = ".data-api"; +const ESCAPE_KEY$2 = "Escape"; +const TAB_KEY$1 = "Tab"; +const ARROW_UP_KEY$2 = "ArrowUp"; +const ARROW_DOWN_KEY$2 = "ArrowDown"; +const ARROW_LEFT_KEY$1 = "ArrowLeft"; +const ARROW_RIGHT_KEY$1 = "ArrowRight"; +const HOME_KEY$2 = "Home"; +const END_KEY$2 = "End"; +const ENTER_KEY$1 = "Enter"; +const SPACE_KEY$1 = " "; +const RIGHT_MOUSE_BUTTON = 2; +const SUBMENU_CLOSE_DELAY = 100; +const EVENT_HIDE$5 = `hide${EVENT_KEY$14}`; +const EVENT_HIDDEN$7 = `hidden${EVENT_KEY$14}`; +const EVENT_SHOW$6 = `show${EVENT_KEY$14}`; +const EVENT_SHOWN$5 = `shown${EVENT_KEY$14}`; +const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$14}${DATA_API_KEY$9}`; +const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$14}${DATA_API_KEY$9}`; +const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$14}${DATA_API_KEY$9}`; +const CLASS_NAME_SHOW$5 = "show"; +const SELECTOR_DATA_TOGGLE$8 = "[data-bs-toggle=\"menu\"]:not(.disabled):not(:disabled)"; +const SELECTOR_MENU$3 = ".menu"; +const SELECTOR_SUBMENU = ".submenu"; +const SELECTOR_SUBMENU_TOGGLE = ".submenu > .menu-item"; +const SELECTOR_NAVBAR_NAV = ".navbar-nav"; +const SELECTOR_VISIBLE_ITEMS$1 = ".menu-item:not(.disabled):not(:disabled)"; +const DEFAULT_PLACEMENT = "bottom-start"; +const SUBMENU_PLACEMENT = "end-start"; +const resolveLogicalPlacement = (placement) => { + if (isRTL()) return placement.replace(/^start(?=-|$)/, "right").replace(/^end(?=-|$)/, "left"); + return placement.replace(/^start(?=-|$)/, "left").replace(/^end(?=-|$)/, "right"); +}; +const triangleSign = (p1, p2, p3) => (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y); +const Default$16 = { + autoClose: true, + boundary: "clippingParents", + container: false, + display: "dynamic", + offset: [0, 2], + floatingConfig: null, + menu: null, + placement: DEFAULT_PLACEMENT, + reference: "toggle", + strategy: "absolute", + submenuTrigger: "both", + submenuDelay: SUBMENU_CLOSE_DELAY +}; +const DefaultType$16 = { + autoClose: "(boolean|string)", + boundary: "(string|element)", + container: "(string|element|boolean)", + display: "string", + offset: "(array|string|function)", + floatingConfig: "(null|object|function)", + menu: "(null|element)", + placement: "string", + reference: "(string|element|object)", + strategy: "string", + submenuTrigger: "string", + submenuDelay: "number" +}; +/** +* Class definition +*/ +var Menu = class Menu extends BaseComponent { + static _openInstances = /* @__PURE__ */ new Set(); + constructor(element, config) { + if (typeof computePosition === "undefined") throw new TypeError("Bootstrap's menus require Floating UI (https://floating-ui.com)"); + super(element, config); + this._floatingCleanup = null; + this._mediaQueryListeners = []; + this._responsivePlacements = null; + this._parent = this._element.parentNode; + this._openSubmenus = /* @__PURE__ */ new Map(); + this._submenuCloseTimeouts = /* @__PURE__ */ new Map(); + this._hoverIntentData = null; + this._menu = this._config.menu || this._findMenu(); + if (!this._config.menu && this._menu) this._parent = this._findWrapper(this._menu); + this._isSubmenu = this._parent.classList?.contains("submenu"); + this._menuOriginalParent = this._menu?.parentNode; + this._parseResponsivePlacements(); + this._setupSubmenuListeners(); + this._initSubmenuTriggers(); + } + static get Default() { + return Default$16; + } + static get DefaultType() { + return DefaultType$16; + } + static get NAME() { + return NAME$17; + } + toggle() { + return this._isShown() ? this.hide() : this.show(); + } + async show() { + if (isDisabled(this._element) || this._isShown()) return; + const relatedTarget = { relatedTarget: this._element }; + if (EventHandler.trigger(this._element, EVENT_SHOW$6, relatedTarget).defaultPrevented) return; + this._moveMenuToContainer(); + this._createFloating(); + if ("ontouchstart" in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) for (const element of document.body.children) EventHandler.on(element, "mouseover", noop); + this._element.focus({ focusVisible: false }); + this._element.setAttribute("aria-expanded", "true"); + this._menu.classList.add(CLASS_NAME_SHOW$5); + this._element.classList.add(CLASS_NAME_SHOW$5); + if (this._parent) this._parent.classList.add(CLASS_NAME_SHOW$5); + Menu._openInstances.add(this); + await this._queueCallback(() => { + if (this._isShown()) EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget); + }, this._menu, this._isAnimated()); + } + async hide() { + if (isDisabled(this._element) || !this._isShown()) return; + const relatedTarget = { relatedTarget: this._element }; + await this._completeHide(relatedTarget); + } + dispose() { + this._disposeFloating(); + this._restoreMenuToOriginalParent(); + this._disposeMediaQueryListeners(); + this._closeAllSubmenus(); + this._clearAllSubmenuTimeouts(); + Menu._openInstances.delete(this); + super.dispose(); + } + update() { + if (this._floatingCleanup) this._updateFloatingPosition(); + } + _findMenu() { + const wrapper = SelectorEngine.closest(this._element, `:has(${SELECTOR_MENU$3})`); + return SelectorEngine.next(this._element, SELECTOR_MENU$3)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU$3)[0] || SelectorEngine.findOne(SELECTOR_MENU$3, wrapper || this._parent); + } + _findWrapper(menu) { + let wrapper = this._element.parentNode; + while (wrapper instanceof Element && !wrapper.contains(menu)) wrapper = wrapper.parentNode; + return wrapper instanceof Element ? wrapper : this._element.parentNode; + } + async _completeHide(relatedTarget) { + if (EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget).defaultPrevented) return; + this._closeAllSubmenus(); + if ("ontouchstart" in document.documentElement) for (const element of document.body.children) EventHandler.off(element, "mouseover", noop); + this._menu.classList.remove(CLASS_NAME_SHOW$5); + this._element.classList.remove(CLASS_NAME_SHOW$5); + if (this._parent) this._parent.classList.remove(CLASS_NAME_SHOW$5); + this._element.setAttribute("aria-expanded", "false"); + Menu._openInstances.delete(this); + await this._queueCallback(() => { + if (this._isShown()) return; + this._disposeFloating(); + this._restoreMenuToOriginalParent(); + Manipulator.removeDataAttribute(this._menu, "placement"); + Manipulator.removeDataAttribute(this._menu, "display"); + EventHandler.trigger(this._element, EVENT_HIDDEN$7, relatedTarget); + }, this._menu, this._isAnimated()); + } + _getConfig(config) { + config = super._getConfig(config); + if (typeof config.reference === "object" && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== "function") throw new TypeError(`${NAME$17.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); + return config; + } + _createFloating() { + if (this._config.display === "static") { + Manipulator.setDataAttribute(this._menu, "display", "static"); + return; + } + let referenceElement = this._element; + if (this._config.reference === "parent") referenceElement = this._parent; + else if (isElement(this._config.reference)) referenceElement = getElement(this._config.reference); + else if (typeof this._config.reference === "object") referenceElement = this._config.reference; + this._updateFloatingPosition(referenceElement); + this._floatingCleanup = autoUpdate(referenceElement, this._menu, () => this._updateFloatingPosition(referenceElement)); + } + async _updateFloatingPosition(referenceElement = null) { + if (!this._menu) return; + if (!referenceElement) if (this._config.reference === "parent") referenceElement = this._parent; + else if (isElement(this._config.reference)) referenceElement = getElement(this._config.reference); + else if (typeof this._config.reference === "object") referenceElement = this._config.reference; + else referenceElement = this._element; + const placement = this._getPlacement(); + const middleware = this._getFloatingMiddleware(); + const floatingConfig = this._getFloatingConfig(placement, middleware); + await this._applyFloatingPosition(referenceElement, this._menu, floatingConfig.placement, floatingConfig.middleware, floatingConfig.strategy); + } + _isShown() { + return this._menu.classList.contains(CLASS_NAME_SHOW$5); + } + _isAnimated() { + return getTransitionDurationFromElement(this._menu) > 0; + } + _getPlacement() { + const placement = this._responsivePlacements ? getResponsivePlacement(this._responsivePlacements, DEFAULT_PLACEMENT) : this._config.placement; + return resolveLogicalPlacement(placement); + } + _parseResponsivePlacements() { + this._responsivePlacements = parseResponsivePlacement(this._config.placement, DEFAULT_PLACEMENT); + if (this._responsivePlacements) this._setupMediaQueryListeners(); + } + _setupMediaQueryListeners() { + this._disposeMediaQueryListeners(); + this._mediaQueryListeners = createBreakpointListeners(() => { + if (this._isShown()) this._updateFloatingPosition(); + }); + } + _disposeMediaQueryListeners() { + disposeBreakpointListeners(this._mediaQueryListeners); + this._mediaQueryListeners = []; + } + _getOffset() { + const { offset: offsetConfig } = this._config; + if (typeof offsetConfig === "string") return offsetConfig.split(",").map((value) => Number.parseInt(value, 10)); + if (typeof offsetConfig === "function") return ({ placement, rects }) => { + return toFloatingOffset(offsetConfig({ + placement, + reference: rects.reference, + floating: rects.floating + }, this._element)); + }; + return offsetConfig; + } + _getFloatingMiddleware() { + const offsetValue = this._getOffset(); + return [ + offset(typeof offsetValue === "function" ? offsetValue : toFloatingOffset(offsetValue)), + flip({ + fallbackPlacements: this._getFallbackPlacements(), + fallbackStrategy: "initialPlacement" + }), + shift({ boundary: this._config.boundary === "clippingParents" ? "clippingAncestors" : this._config.boundary }) + ]; + } + _getFallbackPlacements() { + return { + bottom: [ + "top", + "bottom-start", + "bottom-end", + "top-start", + "top-end" + ], + "bottom-start": [ + "top-start", + "bottom-end", + "top-end" + ], + "bottom-end": [ + "top-end", + "bottom-start", + "top-start" + ], + top: [ + "bottom", + "top-start", + "top-end", + "bottom-start", + "bottom-end" + ], + "top-start": [ + "bottom-start", + "top-end", + "bottom-end" + ], + "top-end": [ + "bottom-end", + "top-start", + "bottom-start" + ], + right: [ + "left", + "right-start", + "right-end", + "left-start", + "left-end" + ], + "right-start": [ + "left-start", + "right-end", + "left-end", + "top-start", + "bottom-start" + ], + "right-end": [ + "left-end", + "right-start", + "left-start", + "top-end", + "bottom-end" + ], + left: [ + "right", + "left-start", + "left-end", + "right-start", + "right-end" + ], + "left-start": [ + "right-start", + "left-end", + "right-end", + "top-start", + "bottom-start" + ], + "left-end": [ + "right-end", + "left-start", + "right-start", + "top-end", + "bottom-end" + ] + }[this._getPlacement()] || [ + "top", + "bottom", + "right", + "left" + ]; + } + _getFloatingConfig(placement, middleware) { + const defaultConfig = { + placement, + middleware, + strategy: this._config.strategy + }; + return { + ...defaultConfig, + ...execute(this._config.floatingConfig, [void 0, defaultConfig]) + }; + } + _disposeFloating() { + if (this._floatingCleanup) { + this._floatingCleanup(); + this._floatingCleanup = null; + } + } + _getContainer() { + const { container } = this._config; + if (container === false) return null; + return container === true ? document.body : getElement(container); + } + _moveMenuToContainer() { + const container = this._getContainer(); + if (!container || !this._menu) return; + if (this._menu.parentNode !== container) container.append(this._menu); + } + _restoreMenuToOriginalParent() { + if (!this._menuOriginalParent || !this._menu) return; + if (this._menu.parentNode !== this._menuOriginalParent) this._menuOriginalParent.append(this._menu); + } + async _applyFloatingPosition(reference, floating, placement, middleware, strategy = "absolute") { + if (!floating.isConnected) return null; + const { x, y, placement: finalPlacement } = await computePosition(reference, floating, { + placement, + middleware, + strategy + }); + if (!floating.isConnected) return null; + Object.assign(floating.style, { + position: strategy, + left: `${x}px`, + top: `${y}px`, + margin: "0" + }); + Manipulator.setDataAttribute(floating, "placement", finalPlacement); + return finalPlacement; + } + _setupSubmenuListeners() { + if (this._config.submenuTrigger === "hover" || this._config.submenuTrigger === "both") { + EventHandler.on(this._menu, "mouseenter", SELECTOR_SUBMENU_TOGGLE, (event) => { + this._onSubmenuTriggerEnter(event); + }); + EventHandler.on(this._menu, "mouseleave", SELECTOR_SUBMENU, (event) => { + this._onSubmenuLeave(event); + }); + EventHandler.on(this._menu, "mousemove", (event) => { + this._trackMousePosition(event); + }); + } + if (this._config.submenuTrigger === "click" || this._config.submenuTrigger === "both") EventHandler.on(this._menu, "click", SELECTOR_SUBMENU_TOGGLE, (event) => { + this._onSubmenuTriggerClick(event); + }); + } + _onSubmenuTriggerEnter(event) { + const trigger = event.target.closest(SELECTOR_SUBMENU_TOGGLE); + if (!trigger) return; + const submenuWrapper = trigger.closest(SELECTOR_SUBMENU); + const submenu = SelectorEngine.findOne(SELECTOR_MENU$3, submenuWrapper); + if (!submenu) return; + this._cancelSubmenuCloseTimeout(submenu); + this._closeSiblingSubmenus(submenuWrapper); + this._openSubmenu(trigger, submenu, submenuWrapper); + } + _onSubmenuLeave(event) { + const submenuWrapper = event.target.closest(SELECTOR_SUBMENU); + const submenu = SelectorEngine.findOne(SELECTOR_MENU$3, submenuWrapper); + if (!submenu || !this._openSubmenus.has(submenu)) return; + if (this._isMovingTowardSubmenu(event, submenu)) return; + this._scheduleSubmenuClose(submenu, submenuWrapper); + } + _onSubmenuTriggerClick(event) { + const trigger = event.target.closest(SELECTOR_SUBMENU_TOGGLE); + if (!trigger) return; + event.preventDefault(); + event.stopPropagation(); + const submenuWrapper = trigger.closest(SELECTOR_SUBMENU); + const submenu = SelectorEngine.findOne(SELECTOR_MENU$3, submenuWrapper); + if (!submenu) return; + if (this._openSubmenus.has(submenu)) this._closeSubmenu(submenu, submenuWrapper); + else { + this._closeSiblingSubmenus(submenuWrapper); + this._openSubmenu(trigger, submenu, submenuWrapper); + } + } + _initSubmenuTriggers() { + if (!this._menu) return; + for (const trigger of SelectorEngine.find(SELECTOR_SUBMENU_TOGGLE, this._menu)) { + if (!SelectorEngine.findOne(SELECTOR_MENU$3, trigger.parentElement)) continue; + trigger.setAttribute("aria-haspopup", "true"); + if (!trigger.hasAttribute("aria-expanded")) trigger.setAttribute("aria-expanded", "false"); + } + } + _openSubmenu(trigger, submenu, submenuWrapper) { + if (this._openSubmenus.has(submenu)) return; + trigger.setAttribute("aria-expanded", "true"); + trigger.setAttribute("aria-haspopup", "true"); + submenu.style.opacity = "0"; + submenu.classList.add(CLASS_NAME_SHOW$5); + submenuWrapper.classList.add(CLASS_NAME_SHOW$5); + const cleanup = this._createSubmenuFloating(trigger, submenu, submenuWrapper); + this._openSubmenus.set(submenu, cleanup); + EventHandler.on(submenu, "mouseenter", () => { + this._cancelSubmenuCloseTimeout(submenu); + }); + } + _closeSubmenu(submenu, submenuWrapper) { + if (!this._openSubmenus.has(submenu)) return; + const nestedSubmenus = SelectorEngine.find(`${SELECTOR_SUBMENU} ${SELECTOR_MENU$3}.${CLASS_NAME_SHOW$5}`, submenu); + for (const nested of nestedSubmenus) { + const nestedWrapper = nested.closest(SELECTOR_SUBMENU); + this._closeSubmenu(nested, nestedWrapper); + } + const trigger = SelectorEngine.findOne(SELECTOR_SUBMENU_TOGGLE, submenuWrapper); + const cleanup = this._openSubmenus.get(submenu); + if (cleanup) cleanup(); + this._openSubmenus.delete(submenu); + EventHandler.off(submenu, "mouseenter"); + if (trigger) trigger.setAttribute("aria-expanded", "false"); + submenu.classList.remove(CLASS_NAME_SHOW$5); + submenuWrapper.classList.remove(CLASS_NAME_SHOW$5); + submenu.style.opacity = ""; + } + _closeAllSubmenus() { + for (const [submenu] of this._openSubmenus) { + const submenuWrapper = submenu.closest(SELECTOR_SUBMENU); + this._closeSubmenu(submenu, submenuWrapper); + } + } + _closeSiblingSubmenus(currentSubmenuWrapper) { + const parent = currentSubmenuWrapper.parentNode; + const siblingSubmenus = SelectorEngine.find(`${SELECTOR_SUBMENU} > ${SELECTOR_MENU$3}.${CLASS_NAME_SHOW$5}`, parent); + for (const siblingMenu of siblingSubmenus) { + const siblingWrapper = siblingMenu.closest(SELECTOR_SUBMENU); + if (siblingWrapper !== currentSubmenuWrapper) this._closeSubmenu(siblingMenu, siblingWrapper); + } + } + _createSubmenuFloating(trigger, submenu, submenuWrapper) { + const referenceElement = submenuWrapper; + const placement = resolveLogicalPlacement(SUBMENU_PLACEMENT); + const middleware = [ + offset({ + mainAxis: 0, + crossAxis: -4 + }), + flip({ fallbackPlacements: [ + resolveLogicalPlacement("start-start"), + resolveLogicalPlacement("end-end"), + resolveLogicalPlacement("start-end") + ] }), + shift({ padding: 8 }) + ]; + const updatePosition = () => this._applyFloatingPosition(referenceElement, submenu, placement, middleware).then((finalPlacement) => { + submenu.style.opacity = ""; + return finalPlacement; + }); + updatePosition(); + return autoUpdate(referenceElement, submenu, updatePosition); + } + _scheduleSubmenuClose(submenu, submenuWrapper) { + this._cancelSubmenuCloseTimeout(submenu); + const timeoutId = setTimeout(() => { + this._closeSubmenu(submenu, submenuWrapper); + this._submenuCloseTimeouts.delete(submenu); + }, this._config.submenuDelay); + this._submenuCloseTimeouts.set(submenu, timeoutId); + } + _cancelSubmenuCloseTimeout(submenu) { + const timeoutId = this._submenuCloseTimeouts.get(submenu); + if (timeoutId) { + clearTimeout(timeoutId); + this._submenuCloseTimeouts.delete(submenu); + } + } + _clearAllSubmenuTimeouts() { + for (const timeoutId of this._submenuCloseTimeouts.values()) clearTimeout(timeoutId); + this._submenuCloseTimeouts.clear(); + } + _trackMousePosition(event) { + this._hoverIntentData = { + x: event.clientX, + y: event.clientY, + timestamp: Date.now() + }; + } + _isMovingTowardSubmenu(event, submenu) { + if (!this._hoverIntentData) return false; + const submenuRect = submenu.getBoundingClientRect(); + const currentPos = { + x: event.clientX, + y: event.clientY + }; + const lastPos = { + x: this._hoverIntentData.x, + y: this._hoverIntentData.y + }; + const targetX = isRTL() ? submenuRect.right : submenuRect.left; + const topCorner = { + x: targetX, + y: submenuRect.top + }; + const bottomCorner = { + x: targetX, + y: submenuRect.bottom + }; + return this._pointInTriangle(currentPos, lastPos, topCorner, bottomCorner); + } + _pointInTriangle(point, v1, v2, v3) { + const d1 = triangleSign(point, v1, v2); + const d2 = triangleSign(point, v2, v3); + const d3 = triangleSign(point, v3, v1); + return !((d1 < 0 || d2 < 0 || d3 < 0) && (d1 > 0 || d2 > 0 || d3 > 0)); + } + _getItemsInMenu(menu) { + return SelectorEngine.find(`:scope > ${SELECTOR_VISIBLE_ITEMS$1}, :scope > ${SELECTOR_SUBMENU} > ${SELECTOR_VISIBLE_ITEMS$1}`, menu).filter((element) => isVisible(element)); + } + _selectMenuItem({ key, target }) { + const currentMenu = target.closest(SELECTOR_MENU$3) || this._menu; + const items = this._getItemsInMenu(currentMenu); + if (!items.length) return; + const nextItem = getNextActiveElement(items, target, key === ARROW_DOWN_KEY$2, !items.includes(target)); + nextItem.focus(); + this._closeUnrelatedSubmenus(currentMenu, nextItem); + } + _closeUnrelatedSubmenus(currentMenu, focusedElement) { + for (const [submenu] of this._openSubmenus) { + const submenuWrapper = submenu.closest(SELECTOR_SUBMENU); + if (!submenuWrapper || submenuWrapper.parentElement !== currentMenu || submenuWrapper.contains(focusedElement)) continue; + this._closeSubmenu(submenu, submenuWrapper); + } + } + _handleSubmenuKeydown(event) { + const { key, target } = event; + const isRtl = isRTL(); + const enterKey = isRtl ? ARROW_LEFT_KEY$1 : ARROW_RIGHT_KEY$1; + const exitKey = isRtl ? ARROW_RIGHT_KEY$1 : ARROW_LEFT_KEY$1; + const submenuWrapper = target.closest(SELECTOR_SUBMENU); + const isSubmenuToggle = target.matches(SELECTOR_SUBMENU_TOGGLE); + if ((key === ENTER_KEY$1 || key === SPACE_KEY$1 || key === enterKey) && submenuWrapper && isSubmenuToggle) { + event.preventDefault(); + event.stopPropagation(); + const submenu = SelectorEngine.findOne(SELECTOR_MENU$3, submenuWrapper); + if (submenu) { + this._closeSiblingSubmenus(submenuWrapper); + this._openSubmenu(target, submenu, submenuWrapper); + requestAnimationFrame(() => { + const firstItem = SelectorEngine.findOne(SELECTOR_VISIBLE_ITEMS$1, submenu); + if (firstItem) firstItem.focus(); + }); + } + return true; + } + if (key === exitKey) { + const currentMenu = target.closest(SELECTOR_MENU$3); + const parentSubmenuWrapper = currentMenu?.closest(SELECTOR_SUBMENU); + if (parentSubmenuWrapper) { + event.preventDefault(); + event.stopPropagation(); + const parentTrigger = SelectorEngine.findOne(SELECTOR_SUBMENU_TOGGLE, parentSubmenuWrapper); + this._closeSubmenu(currentMenu, parentSubmenuWrapper); + if (parentTrigger) parentTrigger.focus(); + return true; + } + } + if (key === HOME_KEY$2 || key === END_KEY$2) { + event.preventDefault(); + event.stopPropagation(); + const currentMenu = target.closest(SELECTOR_MENU$3); + const items = this._getItemsInMenu(currentMenu); + if (items.length) { + const targetItem = key === HOME_KEY$2 ? items[0] : items.at(-1); + targetItem.focus(); + this._closeUnrelatedSubmenus(currentMenu, targetItem); + } + return true; + } + return false; + } + static clearMenus(event) { + if (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY$1) return; + for (const instance of Menu._openInstances) { + if (instance._config.autoClose === false) continue; + const composedPath = event.composedPath(); + const isMenuTarget = composedPath.includes(instance._menu); + if (composedPath.includes(instance._element) || instance._config.autoClose === "inside" && !isMenuTarget || instance._config.autoClose === "outside" && isMenuTarget) continue; + const formAncestor = event.target.closest?.("form"); + const isInsideMenuForm = Boolean(formAncestor) && instance._menu.contains(formAncestor); + if (instance._menu.contains(event.target) && (event.type === "keyup" && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName) || isInsideMenuForm)) continue; + const relatedTarget = { relatedTarget: instance._element }; + if (event.type === "click") relatedTarget.clickEvent = event; + instance._completeHide(relatedTarget); + } + } + static _getToggleFromKeydownContext(element, event) { + if (element.matches(SELECTOR_DATA_TOGGLE$8)) return element; + for (const instance of Menu._openInstances) if (instance._element === event.target || instance._menu?.contains(event.target)) return instance._element; + return SelectorEngine.prev(element, SELECTOR_DATA_TOGGLE$8)[0] || SelectorEngine.next(element, SELECTOR_DATA_TOGGLE$8)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$8, event.delegateTarget.parentNode); + } + static dataApiKeydownHandler(event) { + const isInput = /input|textarea/i.test(event.target.tagName) || event.target.isContentEditable; + const isEscapeEvent = event.key === ESCAPE_KEY$2; + const isUpOrDownEvent = [ARROW_UP_KEY$2, ARROW_DOWN_KEY$2].includes(event.key); + const isLeftOrRightEvent = [ARROW_LEFT_KEY$1, ARROW_RIGHT_KEY$1].includes(event.key); + const isHomeOrEndEvent = [HOME_KEY$2, END_KEY$2].includes(event.key); + const isEnterOrSpaceEvent = [ENTER_KEY$1, SPACE_KEY$1].includes(event.key); + const isSubmenuTrigger = event.target.matches(SELECTOR_SUBMENU_TOGGLE); + if (!isUpOrDownEvent && !isEscapeEvent && !isLeftOrRightEvent && !isHomeOrEndEvent && !(isEnterOrSpaceEvent && isSubmenuTrigger)) return; + if (isInput && !isEscapeEvent) return; + const getToggleButton = Menu._getToggleFromKeydownContext(this, event); + if (!getToggleButton) return; + const instance = Menu.getOrCreateInstance(getToggleButton); + if ((isLeftOrRightEvent || isHomeOrEndEvent || isEnterOrSpaceEvent && isSubmenuTrigger) && instance._handleSubmenuKeydown(event)) return; + if (isUpOrDownEvent) { + event.preventDefault(); + event.stopPropagation(); + instance.show(); + instance._selectMenuItem(event); + return; + } + if (isEscapeEvent && instance._isShown()) { + event.preventDefault(); + event.stopPropagation(); + const currentMenu = event.target.closest(SELECTOR_MENU$3); + const parentSubmenuWrapper = currentMenu?.closest(SELECTOR_SUBMENU); + if (parentSubmenuWrapper && instance._openSubmenus.size > 0) { + const parentTrigger = SelectorEngine.findOne(SELECTOR_SUBMENU_TOGGLE, parentSubmenuWrapper); + instance._closeSubmenu(currentMenu, parentSubmenuWrapper); + if (parentTrigger) parentTrigger.focus(); + return; + } + instance.hide(); + getToggleButton.focus(); + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$8, Menu.dataApiKeydownHandler); +EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU$3, Menu.dataApiKeydownHandler); +EventHandler.on(document, EVENT_CLICK_DATA_API$5, Menu.clearMenus); +EventHandler.on(document, EVENT_KEYUP_DATA_API, Menu.clearMenus); +EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$8, function(event) { + event.preventDefault(); + Menu.getOrCreateInstance(this).toggle(); +}); +//#endregion +//#region js/src/combobox.ts +/** +* -------------------------------------------------------------------------- +* Bootstrap combobox.ts +* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) +* -------------------------------------------------------------------------- +*/ +/** +* Constants +*/ +const NAME$16 = "combobox"; +const EVENT_KEY$13 = `.bs.combobox`; +const DATA_API_KEY$8 = ".data-api"; +const ESCAPE_KEY$1 = "Escape"; +const TAB_KEY = "Tab"; +const ARROW_UP_KEY$1 = "ArrowUp"; +const ARROW_DOWN_KEY$1 = "ArrowDown"; +const HOME_KEY$1 = "Home"; +const END_KEY$1 = "End"; +const ENTER_KEY = "Enter"; +const SPACE_KEY = " "; +const EVENT_CHANGE$3 = `change${EVENT_KEY$13}`; +const EVENT_SHOW$5 = `show${EVENT_KEY$13}`; +const EVENT_SHOWN$4 = `shown${EVENT_KEY$13}`; +const EVENT_HIDE$4 = `hide${EVENT_KEY$13}`; +const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$13}`; +const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$13}${DATA_API_KEY$8}`; +const CLASS_NAME_SHOW$4 = "show"; +const CLASS_NAME_SELECTED = "selected"; +const CLASS_NAME_PLACEHOLDER = "combobox-placeholder"; +const SELECTOR_DATA_TOGGLE$7 = "[data-bs-toggle=\"combobox\"]"; +const SELECTOR_MENU$2 = ".menu"; +const SELECTOR_MENU_ITEM = ".menu-item[data-bs-value]"; +const SELECTOR_VISIBLE_ITEMS = ".menu-item[data-bs-value]:not(.disabled):not(:disabled)"; +const SELECTOR_VALUE = ".combobox-value"; +const SELECTOR_SEARCH_INPUT = ".combobox-search-input"; +const SELECTOR_NO_RESULTS = ".combobox-no-results"; +const Default$15 = { + boundary: "clippingParents", + multiple: false, + name: null, + offset: [0, 2], + placeholder: "", + placement: "bottom-start", + search: false, + searchNormalize: false +}; +const DefaultType$15 = { + boundary: "(string|element)", + multiple: "boolean", + name: "(string|null)", + offset: "(array|string|function)", + placeholder: "string", + placement: "string", + search: "boolean", + searchNormalize: "boolean" +}; +/** +* Class definition +*/ +var Combobox = class extends BaseComponent { + constructor(element, config) { + super(element, config); + this._toggle = this._element; + this._menu = SelectorEngine.next(this._toggle, SELECTOR_MENU$2)[0]; + this._valueDisplay = SelectorEngine.findOne(SELECTOR_VALUE, this._toggle); + this._searchInput = SelectorEngine.findOne(SELECTOR_SEARCH_INPUT, this._menu); + this._noResults = SelectorEngine.findOne(SELECTOR_NO_RESULTS, this._menu); + this._hiddenInput = null; + this._menuInstance = null; + this._createHiddenInput(); + this._createMenuInstance(); + this._syncInitialSelection(); + this._addEventListeners(); + } + static get Default() { + return Default$15; + } + static get DefaultType() { + return DefaultType$15; + } + static get NAME() { + return NAME$16; + } + toggle() { + return this._isShown() ? this.hide() : this.show(); + } + async show() { + if (isDisabled(this._toggle) || this._isShown()) return; + if (EventHandler.trigger(this._toggle, EVENT_SHOW$5).defaultPrevented) return; + this._menuInstance.show(); + if (this._searchInput) { + this._searchInput.value = ""; + this._filterItems(""); + requestAnimationFrame(() => this._searchInput.focus()); + } + EventHandler.trigger(this._toggle, EVENT_SHOWN$4); + } + async hide() { + if (!this._isShown()) return; + if (EventHandler.trigger(this._toggle, EVENT_HIDE$4).defaultPrevented) return; + this._menuInstance.hide(); + EventHandler.trigger(this._toggle, EVENT_HIDDEN$6); + } + dispose() { + if (this._menuInstance) { + this._menuInstance.dispose(); + this._menuInstance = null; + } + if (this._hiddenInput) { + this._hiddenInput.remove(); + this._hiddenInput = null; + } + EventHandler.off(this._menu, EVENT_KEY$13); + EventHandler.off(this._toggle, EVENT_KEY$13); + EventHandler.off(this._searchInput, EVENT_KEY$13); + super.dispose(); + } + _isShown() { + return this._menu.classList.contains(CLASS_NAME_SHOW$4); + } + _createHiddenInput() { + const { name } = this._config; + if (!name) return; + this._hiddenInput = document.createElement("input"); + this._hiddenInput.type = "hidden"; + this._hiddenInput.name = name; + this._hiddenInput.value = ""; + this._toggle.parentNode.insertBefore(this._hiddenInput, this._toggle); + } + _createMenuInstance() { + this._menuInstance = new Menu(this._toggle, { + menu: this._menu, + autoClose: this._config.multiple ? "outside" : true, + boundary: this._config.boundary, + offset: this._config.offset, + placement: this._config.placement + }); + } + _syncInitialSelection() { + if (this._getSelectedItems().length > 0) { + this._updateToggleText(); + this._updateHiddenInput(); + } else this._showPlaceholder(); + } + _addEventListeners() { + EventHandler.on(this._menu, `click${EVENT_KEY$13}`, SELECTOR_MENU_ITEM, (event) => { + const item = event.target.closest(SELECTOR_MENU_ITEM); + if (!item || isDisabled(item)) return; + event.preventDefault(); + event.stopPropagation(); + this._selectItem(item); + }); + EventHandler.on(this._toggle, `keydown${EVENT_KEY$13}`, (event) => { + this._handleToggleKeydown(event); + }); + EventHandler.on(this._menu, `keydown${EVENT_KEY$13}`, (event) => { + this._handleMenuKeydown(event); + }); + if (this._searchInput) { + EventHandler.on(this._searchInput, `input${EVENT_KEY$13}`, () => { + this._filterItems(this._searchInput.value); + }); + EventHandler.on(this._searchInput, `keydown${EVENT_KEY$13}`, (event) => { + if (event.key === ARROW_DOWN_KEY$1) { + event.preventDefault(); + const items = this._getVisibleItems(); + if (items.length > 0) items[0].focus(); + } + if (event.key === ESCAPE_KEY$1) { + this.hide(); + this._toggle.focus(); + } + }); + } + } + _selectItem(item) { + if (this._config.multiple) { + item.classList.toggle(CLASS_NAME_SELECTED); + setAriaAttribute(item, "aria-selected", item.classList.contains(CLASS_NAME_SELECTED)); + } else { + const previouslySelected = SelectorEngine.find(`.${CLASS_NAME_SELECTED}`, this._menu); + for (const prev of previouslySelected) { + prev.classList.remove(CLASS_NAME_SELECTED); + prev.setAttribute("aria-selected", "false"); + } + item.classList.add(CLASS_NAME_SELECTED); + item.setAttribute("aria-selected", "true"); + } + this._updateToggleText(); + this._updateHiddenInput(); + const value = this._config.multiple ? this._getSelectedItems().map((el) => el.dataset.bsValue) : item.dataset.bsValue; + EventHandler.trigger(this._toggle, EVENT_CHANGE$3, { + value, + item + }); + if (!this._config.multiple) { + this.hide(); + this._toggle.focus(); + } + } + _updateToggleText() { + const selectedItems = this._getSelectedItems(); + if (selectedItems.length === 0) { + this._showPlaceholder(); + return; + } + this._valueDisplay.classList.remove(CLASS_NAME_PLACEHOLDER); + if (this._config.multiple && selectedItems.length > 1) this._valueDisplay.textContent = `${selectedItems.length} selected`; + else { + const item = selectedItems[0]; + const label = SelectorEngine.findOne(".menu-item-content > span:first-child", item); + this._valueDisplay.textContent = label ? label.textContent : item.textContent.trim(); + } + } + _showPlaceholder() { + const { placeholder } = this._config; + if (placeholder) { + this._valueDisplay.textContent = placeholder; + this._valueDisplay.classList.add(CLASS_NAME_PLACEHOLDER); + } + } + _updateHiddenInput() { + if (!this._hiddenInput) return; + const values = this._getSelectedItems().map((el) => el.dataset.bsValue); + this._hiddenInput.value = this._config.multiple ? values.join(",") : values[0] || ""; + } + _getSelectedItems() { + return SelectorEngine.find(`.${CLASS_NAME_SELECTED}`, this._menu); + } + _getVisibleItems() { + return SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((item) => isVisible(item)); + } + _filterItems(query) { + const normalizedQuery = this._normalizeText(query.toLowerCase().trim()); + const items = SelectorEngine.find(SELECTOR_MENU_ITEM, this._menu); + let visibleCount = 0; + for (const item of items) { + const text = this._normalizeText(item.textContent.toLowerCase().trim()); + const matches = !normalizedQuery || text.includes(normalizedQuery); + item.style.display = matches ? "" : "none"; + if (matches) visibleCount++; + } + if (this._noResults) this._noResults.classList.toggle("d-none", visibleCount > 0); + } + _normalizeText(text) { + if (this._config.searchNormalize) return text.normalize("NFD").replace(/[\u0300-\u036F]/g, ""); + return text; + } + _handleToggleKeydown(event) { + const { key } = event; + if (key === ARROW_DOWN_KEY$1 || key === ARROW_UP_KEY$1) { + event.preventDefault(); + if (!this._isShown()) this.show(); + const items = this._getVisibleItems(); + if (items.length > 0) (key === ARROW_DOWN_KEY$1 ? items[0] : items.at(-1)).focus(); + return; + } + if ((key === ENTER_KEY || key === SPACE_KEY) && !this._isShown()) { + event.preventDefault(); + this.show(); + } + } + _handleMenuKeydown(event) { + const { key, target } = event; + if (key === ESCAPE_KEY$1) { + event.preventDefault(); + event.stopPropagation(); + this.hide(); + this._toggle.focus(); + return; + } + if (key === TAB_KEY) { + this.hide(); + return; + } + const isInput = target.matches("input"); + if (key === ARROW_DOWN_KEY$1 || key === ARROW_UP_KEY$1) { + event.preventDefault(); + const items = this._getVisibleItems(); + if (items.length > 0) getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus(); + return; + } + if (key === HOME_KEY$1 || key === END_KEY$1) { + event.preventDefault(); + const items = this._getVisibleItems(); + if (items.length > 0) (key === HOME_KEY$1 ? items[0] : items.at(-1)).focus(); + return; + } + if ((key === ENTER_KEY || key === SPACE_KEY) && !isInput) { + event.preventDefault(); + const item = target.closest(SELECTOR_MENU_ITEM); + if (item && !isDisabled(item)) this._selectItem(item); + } + } +}; +/** +* Data API implementation +*/ +EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$7, function(event) { + event.preventDefault(); + Combobox.getOrCreateInstance(this).toggle(); +}); +EventHandler.on(document, "DOMContentLoaded", () => { + for (const toggle of SelectorEngine.find(SELECTOR_DATA_TOGGLE$7)) Combobox.getOrCreateInstance(toggle); +}); +//#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 Calendar(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: [months], + 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()) swipeConfig.leftCallback = () => this.hide(); + else swipeConfig.rightCallback = () => this.hide(); + else if (isRTL()) 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(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() ? "left" : "right", + BOTTOM: "bottom", + LEFT: isRTL() ? "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 }; - function _interopNamespaceDefault(e) { - const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } }); - if (e) { - for (const k in e) { - if (k !== 'default') { - const d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: () => e[k] - }); - } - } - } - n.default = e; - return Object.freeze(n); - } - - const Popper__namespace = /*#__PURE__*/_interopNamespaceDefault(Popper); - - /** - * -------------------------------------------------------------------------- - * 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 escape IDs selectors to handle weird IDs - * @param {string} selector - * @returns {string} - */ - 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 = 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(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(element) || element.getClientRects().length === 0) { - return false; - } - const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; - // Handle `details` element as its content may falsie 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 - * - * @param {HTMLElement} element - * @return 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 {array} list The list of elements - * @param activeElement The active element - * @param shouldGetNext Choose to get next or previous element - * @param isCycleAllowed - * @return {Element|elem} The proper element - */ - 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(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse - - return { - ...this.constructor.Default, - ...(typeof jsonConfig === 'object' ? jsonConfig : {}), - ...(isElement(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(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.8'; - - /** - * 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._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) { - if (!this._supportPointerEvents) { - this._deltaX = event.touches[0].clientX; - return; - } - if (this._eventIsPointerPenTouch(event)) { - this._deltaX = event.clientX; - } - } - _end(event) { - if (this._eventIsPointerPenTouch(event)) { - this._deltaX = event.clientX - this._deltaX; - } - this._handleSwipe(); - execute(this._config.endCallback); - } - _move(event) { - this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX; - } - _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); - 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); - - /** - * -------------------------------------------------------------------------- - * 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(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__namespace === 'undefined') { - throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org/docs/v2/)'); - } - let referenceElement = this._element; - if (this._config.reference === 'parent') { - referenceElement = this._parent; - } else if (isElement(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 = Popper__namespace.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(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(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__namespace === 'undefined') { - throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org/docs/v2/)'); - } - 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 Popper__namespace.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); - 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.target.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