diff --git a/netbox_napalm_plugin/project-static/package.json b/netbox_napalm_plugin/project-static/package.json
index c5073b3..0da7762 100644
--- a/netbox_napalm_plugin/project-static/package.json
+++ b/netbox_napalm_plugin/project-static/package.json
@@ -9,13 +9,14 @@
"build": "node build.mjs"
},
"dependencies": {
- "bootstrap": "~5.3.3",
- "dayjs": "^1.11.5"
+ "bootstrap": "5.3.3",
+ "dayjs": "^1.11.11"
},
"devDependencies": {
+ "@types/bootstrap": "5.2.10",
"esbuild": "^0.13.15"
},
"resolutions": {
- "@types/bootstrap/**/@popperjs/core": "^2.11.6"
+ "@types/bootstrap/**/@popperjs/core": "^2.11.8"
}
}
diff --git a/netbox_napalm_plugin/project-static/yarn.lock b/netbox_napalm_plugin/project-static/yarn.lock
index 3c19f84..f78a6c3 100644
--- a/netbox_napalm_plugin/project-static/yarn.lock
+++ b/netbox_napalm_plugin/project-static/yarn.lock
@@ -2,155 +2,132 @@
# yarn lockfile v1
-"@esbuild/android-arm64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.8.tgz#b3d5b65a3b2e073a6c7ee36b1f3c30c8f000315b"
- integrity sha512-oa/N5j6v1svZQs7EIRPqR8f+Bf8g6HBDjD/xHC02radE/NjKHK7oQmtmLxPs1iVwYyvE+Kolo6lbpfEQ9xnhxQ==
-
-"@esbuild/android-arm@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.8.tgz#c41e496af541e175369d48164d0cf01a5f656cf6"
- integrity sha512-0/rb91GYKhrtbeglJXOhAv9RuYimgI8h623TplY2X+vA4EXnk3Zj1fXZreJ0J3OJJu1bwmb0W7g+2cT/d8/l/w==
-
-"@esbuild/android-x64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.8.tgz#080fa67c29be77f5a3ca5ee4cc78d5bf927e3a3b"
- integrity sha512-bTliMLqD7pTOoPg4zZkXqCDuzIUguEWLpeqkNfC41ODBHwoUgZ2w5JBeYimv4oP6TDVocoYmEhZrCLQTrH89bg==
-
-"@esbuild/darwin-arm64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.8.tgz#053622bf9a82f43d5c075b7818e02618f7b4a397"
- integrity sha512-ghAbV3ia2zybEefXRRm7+lx8J/rnupZT0gp9CaGy/3iolEXkJ6LYRq4IpQVI9zR97ID80KJVoUlo3LSeA/sMAg==
-
-"@esbuild/darwin-x64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.8.tgz#8a1aadb358d537d8efad817bb1a5bff91b84734b"
- integrity sha512-n5WOpyvZ9TIdv2V1K3/iIkkJeKmUpKaCTdun9buhGRWfH//osmUjlv4Z5mmWdPWind/VGcVxTHtLfLCOohsOXw==
-
-"@esbuild/freebsd-arm64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.8.tgz#e6738d0081ba0721a5c6c674e84c6e7fcea61989"
- integrity sha512-a/SATTaOhPIPFWvHZDoZYgxaZRVHn0/LX1fHLGfZ6C13JqFUZ3K6SMD6/HCtwOQ8HnsNaEeokdiDSFLuizqv5A==
-
-"@esbuild/freebsd-x64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.8.tgz#1855e562f2b730f4483f6e94086e9e2597feb4c3"
- integrity sha512-xpFJb08dfXr5+rZc4E+ooZmayBW6R3q59daCpKZ/cDU96/kvDM+vkYzNeTJCGd8rtO6fHWMq5Rcv/1cY6p6/0Q==
-
-"@esbuild/linux-arm64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.8.tgz#481da38952721a3fdb77c17a36ceaacc4270b5c5"
- integrity sha512-v3iwDQuDljLTxpsqQDl3fl/yihjPAyOguxuloON9kFHYwopeJEf1BkDXODzYyXEI19gisEsQlG1bM65YqKSIww==
-
-"@esbuild/linux-arm@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.8.tgz#18127072b270bb6321c6d11be20bfd30e0d6ad17"
- integrity sha512-6Ij8gfuGszcEwZpi5jQIJCVIACLS8Tz2chnEBfYjlmMzVsfqBP1iGmHQPp7JSnZg5xxK9tjCc+pJ2WtAmPRFVA==
-
-"@esbuild/linux-ia32@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.8.tgz#ee400af7b3bc69e8ca2e593ca35156ffb9abd54f"
- integrity sha512-8svILYKhE5XetuFk/B6raFYIyIqydQi+GngEXJgdPdI7OMKUbSd7uzR02wSY4kb53xBrClLkhH4Xs8P61Q2BaA==
-
-"@esbuild/linux-loong64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.8.tgz#8c509d8a454693d39824b83b3f66c400872fce82"
- integrity sha512-B6FyMeRJeV0NpyEOYlm5qtQfxbdlgmiGdD+QsipzKfFky0K5HW5Td6dyK3L3ypu1eY4kOmo7wW0o94SBqlqBSA==
-
-"@esbuild/linux-mips64el@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.8.tgz#f2b0d36e63fb26bc3f95b203b6a80638292101ca"
- integrity sha512-CCb67RKahNobjm/eeEqeD/oJfJlrWyw29fgiyB6vcgyq97YAf3gCOuP6qMShYSPXgnlZe/i4a8WFHBw6N8bYAA==
-
-"@esbuild/linux-ppc64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.8.tgz#1e628be003e036e90423716028cc884fe5ba25bd"
- integrity sha512-bytLJOi55y55+mGSdgwZ5qBm0K9WOCh0rx+vavVPx+gqLLhxtSFU0XbeYy/dsAAD6xECGEv4IQeFILaSS2auXw==
-
-"@esbuild/linux-riscv64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.8.tgz#419a815cb4c3fb9f1b78ef5295f5b48b8bf6427a"
- integrity sha512-2YpRyQJmKVBEHSBLa8kBAtbhucaclb6ex4wchfY0Tj3Kg39kpjeJ9vhRU7x4mUpq8ISLXRXH1L0dBYjAeqzZAw==
-
-"@esbuild/linux-s390x@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.8.tgz#291c49ae5c3d11d226352755c0835911fe1a9e5c"
- integrity sha512-QgbNY/V3IFXvNf11SS6exkpVcX0LJcob+0RWCgV9OiDAmVElnxciHIisoSix9uzYzScPmS6dJFbZULdSAEkQVw==
-
-"@esbuild/linux-x64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.8.tgz#03199d91c76faf80bd54104f5cbf0a489bc39f6a"
- integrity sha512-mM/9S0SbAFDBc4OPoyP6SEOo5324LpUxdpeIUUSrSTOfhHU9hEfqRngmKgqILqwx/0DVJBzeNW7HmLEWp9vcOA==
-
-"@esbuild/netbsd-x64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.8.tgz#b436d767e1b21852f9ed212e2bb57f77203b0ae2"
- integrity sha512-eKUYcWaWTaYr9zbj8GertdVtlt1DTS1gNBWov+iQfWuWyuu59YN6gSEJvFzC5ESJ4kMcKR0uqWThKUn5o8We6Q==
-
-"@esbuild/openbsd-x64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.8.tgz#d1481d8539e21d4729cd04a0450a26c2c8789e89"
- integrity sha512-Vc9J4dXOboDyMXKD0eCeW0SIeEzr8K9oTHJU+Ci1mZc5njPfhKAqkRt3B/fUNU7dP+mRyralPu8QUkiaQn7iIg==
-
-"@esbuild/sunos-x64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.8.tgz#2cfb8126e079b2c00fd1bf095541e9f5c47877e4"
- integrity sha512-0xvOTNuPXI7ft1LYUgiaXtpCEjp90RuBBYovdd2lqAFxje4sEucurg30M1WIm03+3jxByd3mfo+VUmPtRSVuOw==
-
-"@esbuild/win32-arm64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.8.tgz#7c6ecfd097ca23b82119753bf7072bbaefe51e3a"
- integrity sha512-G0JQwUI5WdEFEnYNKzklxtBheCPkuDdu1YrtRrjuQv30WsYbkkoixKxLLv8qhJmNI+ATEWquZe/N0d0rpr55Mg==
-
-"@esbuild/win32-ia32@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.8.tgz#cffec63c3cb0ef8563a04df4e09fa71056171d00"
- integrity sha512-Fqy63515xl20OHGFykjJsMnoIWS+38fqfg88ClvPXyDbLtgXal2DTlhb1TfTX34qWi3u4I7Cq563QcHpqgLx8w==
-
-"@esbuild/win32-x64@0.17.8":
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.8.tgz#200a0965cf654ac28b971358ecdca9cc5b44c335"
- integrity sha512-1iuezdyDNngPnz8rLRDO2C/ZZ/emJLb72OsZeqQ6gL6Avko/XCXZw+NuxBSNhBAP13Hie418V7VMt9et1FMvpg==
-
-"@popperjs/core@^2.11.6":
- version "2.11.6"
- resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.6.tgz#cee20bd55e68a1720bdab363ecf0c821ded4cd45"
- integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==
-
-bootstrap@~5.0.2:
- version "5.0.2"
- resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.0.2.tgz#aff23d5e0e03c31255ad437530ee6556e78e728e"
- integrity sha512-1Ge963tyEQWJJ+8qtXFU6wgmAVj9gweEjibUdbmcCEYsn38tVwRk8107rk2vzt6cfQcRr3SlZ8aQBqaD8aqf+Q==
-
-dayjs@^1.11.5:
- version "1.11.7"
- resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2"
- integrity sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==
-
-esbuild@^0.17.8:
- version "0.17.8"
- resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.8.tgz#f7f799abc7cdce3f0f2e3e0c01f120d4d55193b4"
- integrity sha512-g24ybC3fWhZddZK6R3uD2iF/RIPnRpwJAqLov6ouX3hMbY4+tKolP0VMF3zuIYCaXun+yHwS5IPQ91N2BT191g==
+"@popperjs/core@^2.11.8", "@popperjs/core@^2.9.2":
+ version "2.11.8"
+ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f"
+ integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==
+
+"@types/bootstrap@5.2.10":
+ version "5.2.10"
+ resolved "https://registry.yarnpkg.com/@types/bootstrap/-/bootstrap-5.2.10.tgz#58506463bccc6602bc051487ad8d3a6458f94c6c"
+ integrity sha512-F2X+cd6551tep0MvVZ6nM8v7XgGN/twpdNDjqS1TUM7YFNEtQYWk+dKAnH+T1gr6QgCoGMPl487xw/9hXooa2g==
+ dependencies:
+ "@popperjs/core" "^2.9.2"
+
+bootstrap@5.3.3:
+ version "5.3.3"
+ resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.3.3.tgz#de35e1a765c897ac940021900fcbb831602bac38"
+ integrity sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==
+
+dayjs@^1.11.11:
+ version "1.11.11"
+ resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.11.tgz#dfe0e9d54c5f8b68ccf8ca5f72ac603e7e5ed59e"
+ integrity sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==
+
+esbuild-android-arm64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.13.15.tgz#3fc3ff0bab76fe35dd237476b5d2b32bb20a3d44"
+ integrity sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==
+
+esbuild-darwin-64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.13.15.tgz#8e9169c16baf444eacec60d09b24d11b255a8e72"
+ integrity sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==
+
+esbuild-darwin-arm64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.15.tgz#1b07f893b632114f805e188ddfca41b2b778229a"
+ integrity sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==
+
+esbuild-freebsd-64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.15.tgz#0b8b7eca1690c8ec94c75680c38c07269c1f4a85"
+ integrity sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==
+
+esbuild-freebsd-arm64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.15.tgz#2e1a6c696bfdcd20a99578b76350b41db1934e52"
+ integrity sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==
+
+esbuild-linux-32@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.13.15.tgz#6fd39f36fc66dd45b6b5f515728c7bbebc342a69"
+ integrity sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==
+
+esbuild-linux-64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.13.15.tgz#9cb8e4bcd7574e67946e4ee5f1f1e12386bb6dd3"
+ integrity sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==
+
+esbuild-linux-arm64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.15.tgz#3891aa3704ec579a1b92d2a586122e5b6a2bfba1"
+ integrity sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==
+
+esbuild-linux-arm@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.13.15.tgz#8a00e99e6a0c6c9a6b7f334841364d8a2b4aecfe"
+ integrity sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==
+
+esbuild-linux-mips64le@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.15.tgz#36b07cc47c3d21e48db3bb1f4d9ef8f46aead4f7"
+ integrity sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==
+
+esbuild-linux-ppc64le@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.15.tgz#f7e6bba40b9a11eb9dcae5b01550ea04670edad2"
+ integrity sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==
+
+esbuild-netbsd-64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.15.tgz#a2fedc549c2b629d580a732d840712b08d440038"
+ integrity sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==
+
+esbuild-openbsd-64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.15.tgz#b22c0e5806d3a1fbf0325872037f885306b05cd7"
+ integrity sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==
+
+esbuild-sunos-64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.13.15.tgz#d0b6454a88375ee8d3964daeff55c85c91c7cef4"
+ integrity sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==
+
+esbuild-windows-32@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.13.15.tgz#c96d0b9bbb52f3303322582ef8e4847c5ad375a7"
+ integrity sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==
+
+esbuild-windows-64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.13.15.tgz#1f79cb9b1e1bb02fb25cd414cb90d4ea2892c294"
+ integrity sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==
+
+esbuild-windows-arm64@0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz#482173070810df22a752c686509c370c3be3b3c3"
+ integrity sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==
+
+esbuild@^0.13.15:
+ version "0.13.15"
+ resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.13.15.tgz#db56a88166ee373f87dbb2d8798ff449e0450cdf"
+ integrity sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==
optionalDependencies:
- "@esbuild/android-arm" "0.17.8"
- "@esbuild/android-arm64" "0.17.8"
- "@esbuild/android-x64" "0.17.8"
- "@esbuild/darwin-arm64" "0.17.8"
- "@esbuild/darwin-x64" "0.17.8"
- "@esbuild/freebsd-arm64" "0.17.8"
- "@esbuild/freebsd-x64" "0.17.8"
- "@esbuild/linux-arm" "0.17.8"
- "@esbuild/linux-arm64" "0.17.8"
- "@esbuild/linux-ia32" "0.17.8"
- "@esbuild/linux-loong64" "0.17.8"
- "@esbuild/linux-mips64el" "0.17.8"
- "@esbuild/linux-ppc64" "0.17.8"
- "@esbuild/linux-riscv64" "0.17.8"
- "@esbuild/linux-s390x" "0.17.8"
- "@esbuild/linux-x64" "0.17.8"
- "@esbuild/netbsd-x64" "0.17.8"
- "@esbuild/openbsd-x64" "0.17.8"
- "@esbuild/sunos-x64" "0.17.8"
- "@esbuild/win32-arm64" "0.17.8"
- "@esbuild/win32-ia32" "0.17.8"
- "@esbuild/win32-x64" "0.17.8"
+ esbuild-android-arm64 "0.13.15"
+ esbuild-darwin-64 "0.13.15"
+ esbuild-darwin-arm64 "0.13.15"
+ esbuild-freebsd-64 "0.13.15"
+ esbuild-freebsd-arm64 "0.13.15"
+ esbuild-linux-32 "0.13.15"
+ esbuild-linux-64 "0.13.15"
+ esbuild-linux-arm "0.13.15"
+ esbuild-linux-arm64 "0.13.15"
+ esbuild-linux-mips64le "0.13.15"
+ esbuild-linux-ppc64le "0.13.15"
+ esbuild-netbsd-64 "0.13.15"
+ esbuild-openbsd-64 "0.13.15"
+ esbuild-sunos-64 "0.13.15"
+ esbuild-windows-32 "0.13.15"
+ esbuild-windows-64 "0.13.15"
+ esbuild-windows-arm64 "0.13.15"
diff --git a/netbox_napalm_plugin/static/netbox_napalm_plugin/js/config.js b/netbox_napalm_plugin/static/netbox_napalm_plugin/js/config.js
index fa33a24..7373484 100644
--- a/netbox_napalm_plugin/static/netbox_napalm_plugin/js/config.js
+++ b/netbox_napalm_plugin/static/netbox_napalm_plugin/js/config.js
@@ -1,6 +1,8 @@
(() => {
var __defProp = Object.defineProperty;
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
+ __markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
@@ -193,7 +195,7 @@
// node_modules/@popperjs/core/lib/utils/userAgent.js
function getUAString() {
var uaData = navigator.userAgentData;
- if (uaData != null && uaData.brands) {
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
return uaData.brands.map(function(item) {
return item.brand + "/" + item.version;
}).join(" ");
@@ -287,10 +289,7 @@
// node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
function getDocumentElement(element) {
- return ((isElement(element) ? element.ownerDocument : (
- // $FlowFixMe[prop-missing]
- element.document
- )) || window.document).documentElement;
+ return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
}
// node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
@@ -298,22 +297,12 @@
if (getNodeName(element) === "html") {
return element;
}
- return (
- // this is a quicker (but less type safe) way to save quite some bytes from the bundle
- // $FlowFixMe[incompatible-return]
- // $FlowFixMe[prop-missing]
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
- element.parentNode || // DOM Element detected
- (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
- getDocumentElement(element)
- );
+ return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
}
// node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
function getTrueOffsetParent(element) {
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
- getComputedStyle2(element).position === "fixed") {
+ if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
return null;
}
return element.offsetParent;
@@ -437,15 +426,7 @@
return;
}
}
- if (true) {
- if (!isHTMLElement(arrowElement)) {
- console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', "To use an SVG arrow, wrap it in an HTMLElement that will be used as", "the arrow."].join(" "));
- }
- }
if (!contains(state.elements.popper, arrowElement)) {
- if (true) {
- console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', "element."].join(" "));
- }
return;
}
state.elements.arrow = arrowElement;
@@ -472,9 +453,8 @@
bottom: "auto",
left: "auto"
};
- function roundOffsetsByDPR(_ref) {
+ function roundOffsetsByDPR(_ref, win) {
var x = _ref.x, y = _ref.y;
- var win = window;
var dpr = win.devicePixelRatio || 1;
return {
x: round(x * dpr) / dpr || 0,
@@ -513,19 +493,13 @@
offsetParent = offsetParent;
if (placement === top || (placement === left || placement === right) && variation === end) {
sideY = bottom;
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
- // $FlowFixMe[prop-missing]
- offsetParent[heightProp]
- );
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
y -= offsetY - popperRect.height;
y *= gpuAcceleration ? 1 : -1;
}
if (placement === left || (placement === top || placement === bottom) && variation === end) {
sideX = right;
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
- // $FlowFixMe[prop-missing]
- offsetParent[widthProp]
- );
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
x -= offsetX - popperRect.width;
x *= gpuAcceleration ? 1 : -1;
}
@@ -536,7 +510,7 @@
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
x,
y
- }) : {
+ }, getWindow(popper2)) : {
x,
y
};
@@ -551,14 +525,6 @@
function computeStyles(_ref5) {
var state = _ref5.state, options = _ref5.options;
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
- if (true) {
- var transitionProperty = getComputedStyle2(state.elements.popper).transitionProperty || "";
- if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
- return transitionProperty.indexOf(property) >= 0;
- })) {
- console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
- }
- }
var commonStyles = {
placement: getBasePlacement(state.placement),
variation: getVariation(state.placement),
@@ -748,10 +714,7 @@
var win = getWindow(scrollParent);
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
- return isBody ? updatedList : (
- // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
- updatedList.concat(listScrollParents(getParentNode(target)))
- );
+ return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
}
// node_modules/@popperjs/core/lib/utils/rectToClientRect.js
@@ -918,9 +881,6 @@
});
if (allowedPlacements.length === 0) {
allowedPlacements = placements2;
- if (true) {
- console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" "));
- }
}
var overflows = allowedPlacements.reduce(function(acc, placement2) {
acc[placement2] = detectOverflow(state, {
@@ -966,7 +926,7 @@
}, []);
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
- var checksMap = /* @__PURE__ */ new Map();
+ var checksMap = new Map();
var makeFallbackChecks = true;
var firstFittingPlacement = placements2[0];
for (var i = 0; i < placements2.length; i++) {
@@ -1292,8 +1252,7 @@
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
- if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
- isScrollParent(documentElement)) {
+ if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
@@ -1314,8 +1273,8 @@
// node_modules/@popperjs/core/lib/utils/orderModifiers.js
function order(modifiers) {
- var map = /* @__PURE__ */ new Map();
- var visited = /* @__PURE__ */ new Set();
+ var map = new Map();
+ var visited = new Set();
var result = [];
modifiers.forEach(function(modifier) {
map.set(modifier.name, modifier);
@@ -1365,92 +1324,6 @@
};
}
- // node_modules/@popperjs/core/lib/utils/format.js
- function format(str) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- return [].concat(args).reduce(function(p, c) {
- return p.replace(/%s/, c);
- }, str);
- }
-
- // node_modules/@popperjs/core/lib/utils/validateModifiers.js
- var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
- var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
- var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
- function validateModifiers(modifiers) {
- modifiers.forEach(function(modifier) {
- [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self) {
- return self.indexOf(value) === index;
- }).forEach(function(key) {
- switch (key) {
- case "name":
- if (typeof modifier.name !== "string") {
- console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
- }
- break;
- case "enabled":
- if (typeof modifier.enabled !== "boolean") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
- }
- break;
- case "phase":
- if (modifierPhases.indexOf(modifier.phase) < 0) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
- }
- break;
- case "fn":
- if (typeof modifier.fn !== "function") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
- }
- break;
- case "effect":
- if (modifier.effect != null && typeof modifier.effect !== "function") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
- }
- break;
- case "requires":
- if (modifier.requires != null && !Array.isArray(modifier.requires)) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
- }
- break;
- case "requiresIfExists":
- if (!Array.isArray(modifier.requiresIfExists)) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
- }
- break;
- case "options":
- case "data":
- break;
- default:
- console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
- return '"' + s + '"';
- }).join(", ") + '; but "' + key + '" was provided.');
- }
- modifier.requires && modifier.requires.forEach(function(requirement) {
- if (modifiers.find(function(mod) {
- return mod.name === requirement;
- }) == null) {
- console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
- }
- });
- });
- });
- }
-
- // node_modules/@popperjs/core/lib/utils/uniqueBy.js
- function uniqueBy(arr, fn2) {
- var identifiers = /* @__PURE__ */ new Set();
- return arr.filter(function(item) {
- var identifier = fn2(item);
- if (!identifiers.has(identifier)) {
- identifiers.add(identifier);
- return true;
- }
- });
- }
-
// node_modules/@popperjs/core/lib/utils/mergeByName.js
function mergeByName(modifiers) {
var merged = modifiers.reduce(function(merged2, current) {
@@ -1467,8 +1340,6 @@
}
// node_modules/@popperjs/core/lib/createPopper.js
- var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
- var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
var DEFAULT_OPTIONS = {
placement: "bottom",
modifiers: [],
@@ -1519,45 +1390,15 @@
state.orderedModifiers = orderedModifiers.filter(function(m) {
return m.enabled;
});
- if (true) {
- var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
- var name = _ref.name;
- return name;
- });
- validateModifiers(modifiers);
- if (getBasePlacement(state.options.placement) === auto) {
- var flipModifier = state.orderedModifiers.find(function(_ref2) {
- var name = _ref2.name;
- return name === "flip";
- });
- if (!flipModifier) {
- console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
- }
- }
- var _getComputedStyle = getComputedStyle2(popper2), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
- if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
- return parseFloat(margin);
- })) {
- console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
- }
- }
runModifierEffects();
return instance.update();
},
- // Sync update – it will always be executed, even if not necessary. This
- // is useful for low frequency updates where sync behavior simplifies the
- // logic.
- // For high frequency updates (e.g. `resize` and `scroll` events), always
- // prefer the async Popper#update method
forceUpdate: function forceUpdate() {
if (isDestroyed) {
return;
}
var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
if (!areValidElements(reference3, popper3)) {
- if (true) {
- console.error(INVALID_ELEMENT_ERROR);
- }
return;
}
state.rects = {
@@ -1569,15 +1410,7 @@
state.orderedModifiers.forEach(function(modifier) {
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
});
- var __debug_loops__ = 0;
for (var index = 0; index < state.orderedModifiers.length; index++) {
- if (true) {
- __debug_loops__ += 1;
- if (__debug_loops__ > 100) {
- console.error(INFINITE_LOOP_ERROR);
- break;
- }
- }
if (state.reset === true) {
state.reset = false;
index = -1;
@@ -1594,8 +1427,6 @@
}
}
},
- // Async and optimistically optimized update – it will not be executed if
- // not necessary (debounced to run at most once-per-tick)
update: debounce(function() {
return new Promise(function(resolve) {
instance.forceUpdate();
@@ -1608,9 +1439,6 @@
}
};
if (!areValidElements(reference2, popper2)) {
- if (true) {
- console.error(INVALID_ELEMENT_ERROR);
- }
return instance;
}
instance.setOptions(options).then(function(state2) {
@@ -1619,8 +1447,8 @@
}
});
function runModifierEffects() {
- state.orderedModifiers.forEach(function(_ref3) {
- var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect4 = _ref3.effect;
+ state.orderedModifiers.forEach(function(_ref) {
+ var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect4 = _ref.effect;
if (typeof effect4 === "function") {
var cleanupFn = effect4({
state,
@@ -1658,57 +1486,50 @@
});
// node_modules/bootstrap/dist/js/bootstrap.esm.js
- var NODE_TEXT = 3;
- var 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;
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
- if (ancestor.matches(selector)) {
- parents.push(ancestor);
- }
- ancestor = ancestor.parentNode;
+ var elementMap = new Map();
+ var Data = {
+ set(element, key, instance) {
+ if (!elementMap.has(element)) {
+ elementMap.set(element, new Map());
}
- return parents;
+ 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: ${Array.from(instanceMap.keys())[0]}.`);
+ return;
+ }
+ instanceMap.set(key, instance);
},
- prev(element, selector) {
- let previous = element.previousElementSibling;
- while (previous) {
- if (previous.matches(selector)) {
- return [previous];
- }
- previous = previous.previousElementSibling;
+ get(element, key) {
+ if (elementMap.has(element)) {
+ return elementMap.get(element).get(key) || null;
}
- return [];
+ return null;
},
- next(element, selector) {
- let next = element.nextElementSibling;
- while (next) {
- if (next.matches(selector)) {
- return [next];
- }
- next = next.nextElementSibling;
+ remove(element, key) {
+ if (!elementMap.has(element)) {
+ return;
+ }
+ const instanceMap = elementMap.get(element);
+ instanceMap.delete(key);
+ if (instanceMap.size === 0) {
+ elementMap.delete(element);
}
- return [];
}
};
var MAX_UID = 1e6;
var MILLISECONDS_MULTIPLIER = 1e3;
var TRANSITION_END = "transitionend";
- var toType = (obj) => {
- if (obj === null || obj === void 0) {
- return `${obj}`;
+ var parseSelector = (selector) => {
+ if (selector && window.CSS && window.CSS.escape) {
+ selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
+ }
+ return selector;
+ };
+ var toType = (object) => {
+ if (object === null || object === void 0) {
+ return `${object}`;
}
- return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
+ return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
};
var getUID = (prefix) => {
do {
@@ -1716,31 +1537,6 @@
} while (document.getElementById(prefix));
return prefix;
};
- var getSelector = (element) => {
- let selector = element.getAttribute("data-bs-target");
- if (!selector || selector === "#") {
- let hrefAttr = element.getAttribute("href");
- if (!hrefAttr || !hrefAttr.includes("#") && !hrefAttr.startsWith(".")) {
- return null;
- }
- if (hrefAttr.includes("#") && !hrefAttr.startsWith("#")) {
- hrefAttr = `#${hrefAttr.split("#")[1]}`;
- }
- selector = hrefAttr && hrefAttr !== "#" ? hrefAttr.trim() : null;
- }
- return selector;
- };
- var getSelectorFromElement = (element) => {
- const selector = getSelector(element);
- if (selector) {
- return document.querySelector(selector) ? selector : null;
- }
- return null;
- };
- var getElementFromSelector = (element) => {
- const selector = getSelector(element);
- return selector ? document.querySelector(selector) : null;
- };
var getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
@@ -1761,39 +1557,43 @@
var triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
- var isElement2 = (obj) => {
- if (!obj || typeof obj !== "object") {
+ var isElement2 = (object) => {
+ if (!object || typeof object !== "object") {
return false;
}
- if (typeof obj.jquery !== "undefined") {
- obj = obj[0];
+ if (typeof object.jquery !== "undefined") {
+ object = object[0];
}
- return typeof obj.nodeType !== "undefined";
+ return typeof object.nodeType !== "undefined";
};
- var getElement = (obj) => {
- if (isElement2(obj)) {
- return obj.jquery ? obj[0] : obj;
+ var getElement = (object) => {
+ if (isElement2(object)) {
+ return object.jquery ? object[0] : object;
}
- if (typeof obj === "string" && obj.length > 0) {
- return SelectorEngine.findOne(obj);
+ if (typeof object === "string" && object.length > 0) {
+ return document.querySelector(parseSelector(object));
}
return null;
};
- var typeCheckConfig = (componentName, config, configTypes) => {
- Object.keys(configTypes).forEach((property) => {
- const expectedTypes = configTypes[property];
- const value = config[property];
- const valueType = value && isElement2(value) ? "element" : toType(value);
- if (!new RegExp(expectedTypes).test(valueType)) {
- throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
- }
- });
- };
var isVisible = (element) => {
if (!isElement2(element) || element.getClientRects().length === 0) {
return false;
}
- return getComputedStyle(element).getPropertyValue("visibility") === "visible";
+ 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;
};
var isDisabled = (element) => {
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
@@ -1825,13 +1625,12 @@
};
var noop = () => {
};
- var reflow = (element) => element.offsetHeight;
+ var reflow = (element) => {
+ element.offsetHeight;
+ };
var getjQuery = () => {
- const {
- jQuery
- } = window;
- if (jQuery && !document.body.hasAttribute("data-bs-no-jquery")) {
- return jQuery;
+ if (window.jQuery && !document.body.hasAttribute("data-bs-no-jquery")) {
+ return window.jQuery;
}
return null;
};
@@ -1840,7 +1639,9 @@
if (document.readyState === "loading") {
if (!DOMContentLoadedCallbacks.length) {
document.addEventListener("DOMContentLoaded", () => {
- DOMContentLoadedCallbacks.forEach((callback2) => callback2());
+ for (const callback2 of DOMContentLoadedCallbacks) {
+ callback2();
+ }
});
}
DOMContentLoadedCallbacks.push(callback);
@@ -1864,10 +1665,8 @@
}
});
};
- var execute = (callback) => {
- if (typeof callback === "function") {
- callback();
- }
+ var execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
+ return typeof possibleCallback === "function" ? possibleCallback(...args) : defaultValue;
};
var executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
if (!waitForTransition) {
@@ -1895,11 +1694,11 @@
}, emulatedDuration);
};
var getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
+ const listLength = list.length;
let index = list.indexOf(activeElement);
if (index === -1) {
- return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
}
- const listLength = list.length;
index += shouldGetNext ? 1 : -1;
if (isCycleAllowed) {
index = (index + listLength) % listLength;
@@ -1915,20 +1714,21 @@
mouseenter: "mouseover",
mouseleave: "mouseout"
};
- var customEventsRegex = /^(mouseenter|mouseleave)/i;
- var nativeEvents = /* @__PURE__ */ 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"]);
- function getUidEvent(element, uid) {
+ var 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"]);
+ function makeEventUid(element, uid) {
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
}
- function getEvent(element) {
- const uid = getUidEvent(element);
+ function getElementEvents(element) {
+ const uid = makeEventUid(element);
element.uidEvent = uid;
eventRegistry[uid] = eventRegistry[uid] || {};
return eventRegistry[uid];
}
function bootstrapHandler(element, fn2) {
return function handler(event) {
- event.delegateTarget = element;
+ hydrateObj(event, {
+ delegateTarget: element
+ });
if (handler.oneOff) {
EventHandler.off(element, event.type, fn2);
}
@@ -1941,77 +1741,63 @@
for (let {
target
} = event; target && target !== this; target = target.parentNode) {
- for (let i = domElements.length; i--; ) {
- if (domElements[i] === target) {
- event.delegateTarget = target;
- if (handler.oneOff) {
- EventHandler.off(element, event.type, selector, fn2);
- }
- return fn2.apply(target, [event]);
+ for (const domElement of domElements) {
+ if (domElement !== target) {
+ continue;
+ }
+ hydrateObj(event, {
+ delegateTarget: target
+ });
+ if (handler.oneOff) {
+ EventHandler.off(element, event.type, selector, fn2);
}
+ return fn2.apply(target, [event]);
}
}
- return null;
};
}
- function findHandler(events, handler, delegationSelector = null) {
- const uidEventList = Object.keys(events);
- for (let i = 0, len = uidEventList.length; i < len; i++) {
- const event = events[uidEventList[i]];
- if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
- return event;
- }
- }
- return null;
+ function findHandler(events, callable, delegationSelector = null) {
+ return Object.values(events).find((event) => event.callable === callable && event.delegationSelector === delegationSelector);
}
- function normalizeParams(originalTypeEvent, handler, delegationFn) {
- const delegation = typeof handler === "string";
- const originalHandler = delegation ? delegationFn : handler;
+ function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
+ const isDelegated = typeof handler === "string";
+ const callable = isDelegated ? delegationFunction : handler || delegationFunction;
let typeEvent = getTypeEvent(originalTypeEvent);
- const isNative = nativeEvents.has(typeEvent);
- if (!isNative) {
+ if (!nativeEvents.has(typeEvent)) {
typeEvent = originalTypeEvent;
}
- return [delegation, originalHandler, typeEvent];
+ return [isDelegated, callable, typeEvent];
}
- function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
+ function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
- if (!handler) {
- handler = delegationFn;
- delegationFn = null;
- }
- if (customEventsRegex.test(originalTypeEvent)) {
- const wrapFn = (fn3) => {
+ let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
+ if (originalTypeEvent in customEvents) {
+ const wrapFunction = (fn3) => {
return function(event) {
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
return fn3.call(this, event);
}
};
};
- if (delegationFn) {
- delegationFn = wrapFn(delegationFn);
- } else {
- handler = wrapFn(handler);
- }
+ callable = wrapFunction(callable);
}
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
- const events = getEvent(element);
+ const events = getElementEvents(element);
const handlers = events[typeEvent] || (events[typeEvent] = {});
- const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
- if (previousFn) {
- previousFn.oneOff = previousFn.oneOff && oneOff;
+ const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
+ if (previousFunction) {
+ previousFunction.oneOff = previousFunction.oneOff && oneOff;
return;
}
- const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ""));
- const fn2 = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
- fn2.delegationSelector = delegation ? handler : null;
- fn2.originalHandler = originalHandler;
+ const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ""));
+ const fn2 = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
+ fn2.delegationSelector = isDelegated ? handler : null;
+ fn2.callable = callable;
fn2.oneOff = oneOff;
fn2.uidEvent = uid;
handlers[uid] = fn2;
- element.addEventListener(typeEvent, fn2, delegation);
+ element.addEventListener(typeEvent, fn2, isDelegated);
}
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
const fn2 = findHandler(events[typeEvent], handler, delegationSelector);
@@ -2023,52 +1809,50 @@
}
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
const storeElementEvent = events[typeEvent] || {};
- Object.keys(storeElementEvent).forEach((handlerKey) => {
+ for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
if (handlerKey.includes(namespace)) {
- const event = storeElementEvent[handlerKey];
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
- });
+ }
}
function getTypeEvent(event) {
event = event.replace(stripNameRegex, "");
return customEvents[event] || event;
}
var EventHandler = {
- on(element, event, handler, delegationFn) {
- addHandler(element, event, handler, delegationFn, false);
+ on(element, event, handler, delegationFunction) {
+ addHandler(element, event, handler, delegationFunction, false);
},
- one(element, event, handler, delegationFn) {
- addHandler(element, event, handler, delegationFn, true);
+ one(element, event, handler, delegationFunction) {
+ addHandler(element, event, handler, delegationFunction, true);
},
- off(element, originalTypeEvent, handler, delegationFn) {
+ off(element, originalTypeEvent, handler, delegationFunction) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
+ const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
const inNamespace = typeEvent !== originalTypeEvent;
- const events = getEvent(element);
+ const events = getElementEvents(element);
+ const storeElementEvent = events[typeEvent] || {};
const isNamespace = originalTypeEvent.startsWith(".");
- if (typeof originalHandler !== "undefined") {
- if (!events || !events[typeEvent]) {
+ if (typeof callable !== "undefined") {
+ if (!Object.keys(storeElementEvent).length) {
return;
}
- removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
+ removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
return;
}
if (isNamespace) {
- Object.keys(events).forEach((elementEvent) => {
+ for (const elementEvent of Object.keys(events)) {
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
- });
+ }
}
- const storeElementEvent = events[typeEvent] || {};
- Object.keys(storeElementEvent).forEach((keyHandlers) => {
+ for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
const handlerKey = keyHandlers.replace(stripUidRegex, "");
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
- const event = storeElementEvent[keyHandlers];
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
- });
+ }
},
trigger(element, event, args) {
if (typeof event !== "string" || !element) {
@@ -2077,12 +1861,10 @@
const $ = getjQuery();
const typeEvent = getTypeEvent(event);
const inNamespace = event !== typeEvent;
- const isNative = nativeEvents.has(typeEvent);
- let jQueryEvent;
+ let jQueryEvent = null;
let bubbles = true;
let nativeDispatch = true;
let defaultPrevented = false;
- let evt = null;
if (inNamespace && $) {
jQueryEvent = $.Event(event, args);
$(element).trigger(jQueryEvent);
@@ -2090,89 +1872,154 @@
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
defaultPrevented = jQueryEvent.isDefaultPrevented();
}
- if (isNative) {
- evt = document.createEvent("HTMLEvents");
- evt.initEvent(typeEvent, bubbles, true);
- } else {
- evt = new CustomEvent(event, {
- bubbles,
- cancelable: true
- });
- }
- if (typeof args !== "undefined") {
- Object.keys(args).forEach((key) => {
- Object.defineProperty(evt, key, {
- get() {
- return args[key];
- }
- });
- });
- }
+ const evt = hydrateObj(new Event(event, {
+ bubbles,
+ cancelable: true
+ }), args);
if (defaultPrevented) {
evt.preventDefault();
}
if (nativeDispatch) {
element.dispatchEvent(evt);
}
- if (evt.defaultPrevented && typeof jQueryEvent !== "undefined") {
+ if (evt.defaultPrevented && jQueryEvent) {
jQueryEvent.preventDefault();
}
return evt;
}
};
- var elementMap = /* @__PURE__ */ new Map();
- var Data = {
- 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: ${Array.from(instanceMap.keys())[0]}.`);
- return;
- }
- instanceMap.set(key, instance);
- },
- get(element, key) {
- if (elementMap.has(element)) {
- return elementMap.get(element).get(key) || null;
+ 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;
+ }
+ 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()}`);
+ }
+ var Manipulator = {
+ setDataAttribute(element, key, value) {
+ element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
},
- remove(element, key) {
- if (!elementMap.has(element)) {
- return;
+ removeDataAttribute(element, key) {
+ element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
+ },
+ getDataAttributes(element) {
+ if (!element) {
+ return {};
}
- const instanceMap = elementMap.get(element);
- instanceMap.delete(key);
- if (instanceMap.size === 0) {
- elementMap.delete(element);
+ 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, pureKey.length);
+ attributes[pureKey] = normalizeData(element.dataset[key]);
}
+ return attributes;
+ },
+ getDataAttribute(element, key) {
+ return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
}
};
- var VERSION = "5.0.2";
- var BaseComponent = class {
- constructor(element) {
+ 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 = isElement2(element) ? Manipulator.getDataAttribute(element, "config") : {};
+ return {
+ ...this.constructor.Default,
+ ...typeof jsonConfig === "object" ? jsonConfig : {},
+ ...isElement2(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 = isElement2(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}".`);
+ }
+ }
+ }
+ };
+ var VERSION = "5.3.3";
+ var BaseComponent = class 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);
}
dispose() {
Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, this.constructor.EVENT_KEY);
- Object.getOwnPropertyNames(this).forEach((propertyName) => {
+ for (const propertyName of Object.getOwnPropertyNames(this)) {
this[propertyName] = null;
- });
+ }
}
_queueCallback(callback, element, isAnimated = true) {
executeAfterTransition(callback, element, isAnimated);
}
- /** Static */
+ _getConfig(config) {
+ config = this._mergeConfigObj(config, this._element);
+ config = this._configAfterMerge(config);
+ this._typeCheckConfig(config);
+ return config;
+ }
static getInstance(element) {
- return Data.get(element, this.DATA_KEY);
+ return Data.get(getElement(element), this.DATA_KEY);
}
static getOrCreateInstance(element, config = {}) {
return this.getInstance(element) || new this(element, typeof config === "object" ? config : null);
@@ -2180,94 +2027,158 @@
static get VERSION() {
return VERSION;
}
- static get NAME() {
- throw new Error('You have to implement the static method "NAME", for each component!');
- }
static get DATA_KEY() {
return `bs.${this.NAME}`;
}
static get EVENT_KEY() {
return `.${this.DATA_KEY}`;
}
- };
- var NAME$c = "alert";
- var DATA_KEY$b = "bs.alert";
- var EVENT_KEY$b = `.${DATA_KEY$b}`;
- var DATA_API_KEY$8 = ".data-api";
- var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
- var EVENT_CLOSE = `close${EVENT_KEY$b}`;
- var EVENT_CLOSED = `closed${EVENT_KEY$b}`;
- var EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
- var CLASS_NAME_ALERT = "alert";
- var CLASS_NAME_FADE$6 = "fade";
- var CLASS_NAME_SHOW$9 = "show";
- var Alert = class extends BaseComponent {
- // Getters
- static get NAME() {
- return NAME$c;
+ static eventName(name) {
+ return `${name}${this.EVENT_KEY}`;
}
- // Public
- close(element) {
- const rootElement = element ? this._getRootElement(element) : this._element;
- const customEvent = this._triggerCloseEvent(rootElement);
- if (customEvent === null || customEvent.defaultPrevented) {
- return;
+ };
+ var 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;
}
- this._removeElement(rootElement);
- }
- // Private
- _getRootElement(element) {
- return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
- }
- _triggerCloseEvent(element) {
- return EventHandler.trigger(element, EVENT_CLOSE);
- }
- _removeElement(element) {
- element.classList.remove(CLASS_NAME_SHOW$9);
- const isAnimated = element.classList.contains(CLASS_NAME_FADE$6);
- this._queueCallback(() => this._destroyElement(element), element, isAnimated);
- }
- _destroyElement(element) {
- element.remove();
- EventHandler.trigger(element, EVENT_CLOSED);
- }
- // Static
- static jQueryInterface(config) {
- return this.each(function() {
- const data = Alert.getOrCreateInstance(this);
- if (config === "close") {
- data[config](this);
- }
- });
+ if (hrefAttribute.includes("#") && !hrefAttribute.startsWith("#")) {
+ hrefAttribute = `#${hrefAttribute.split("#")[1]}`;
+ }
+ selector = hrefAttribute && hrefAttribute !== "#" ? hrefAttribute.trim() : null;
}
- static handleDismiss(alertInstance) {
- return function(event) {
- if (event) {
- event.preventDefault();
+ return selector ? selector.split(",").map((sel) => parseSelector(sel)).join(",") : null;
+ };
+ var 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];
}
- alertInstance.close(this);
- };
+ previous = previous.previousElementSibling;
+ }
+ return [];
+ },
+ 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) : [];
+ }
+ };
+ var 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);
+ instance[method]();
+ });
+ };
+ var NAME$f = "alert";
+ var DATA_KEY$a = "bs.alert";
+ var EVENT_KEY$b = `.${DATA_KEY$a}`;
+ var EVENT_CLOSE = `close${EVENT_KEY$b}`;
+ var EVENT_CLOSED = `closed${EVENT_KEY$b}`;
+ var CLASS_NAME_FADE$5 = "fade";
+ var CLASS_NAME_SHOW$8 = "show";
+ var Alert = class extends BaseComponent {
+ static get NAME() {
+ return NAME$f;
+ }
+ 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);
+ }
+ _destroyElement() {
+ this._element.remove();
+ EventHandler.trigger(this._element, EVENT_CLOSED);
+ this.dispose();
+ }
+ static jQueryInterface(config) {
+ return this.each(function() {
+ const data = Alert.getOrCreateInstance(this);
+ if (typeof config !== "string") {
+ return;
+ }
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config](this);
+ });
}
};
- EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
+ enableDismissTrigger(Alert, "close");
defineJQueryPlugin(Alert);
- var NAME$b = "button";
- var DATA_KEY$a = "bs.button";
- var EVENT_KEY$a = `.${DATA_KEY$a}`;
- var DATA_API_KEY$7 = ".data-api";
+ var NAME$e = "button";
+ var DATA_KEY$9 = "bs.button";
+ var EVENT_KEY$a = `.${DATA_KEY$9}`;
+ var DATA_API_KEY$6 = ".data-api";
var CLASS_NAME_ACTIVE$3 = "active";
var SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
- var EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`;
+ var EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
var Button = class extends BaseComponent {
- // Getters
static get NAME() {
- return NAME$b;
+ return NAME$e;
}
- // Public
toggle() {
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);
@@ -2284,105 +2195,119 @@
data.toggle();
});
defineJQueryPlugin(Button);
- function normalizeData(val) {
- if (val === "true") {
- return true;
+ var NAME$d = "swipe";
+ var EVENT_KEY$9 = ".bs.swipe";
+ var EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
+ var EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
+ var EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
+ var EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
+ var EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
+ var POINTER_TYPE_TOUCH = "touch";
+ var POINTER_TYPE_PEN = "pen";
+ var CLASS_NAME_POINTER_EVENT = "pointer-event";
+ var SWIPE_THRESHOLD = 40;
+ var Default$c = {
+ endCallback: null,
+ leftCallback: null,
+ rightCallback: null
+ };
+ var DefaultType$c = {
+ endCallback: "(function|null)",
+ leftCallback: "(function|null)",
+ rightCallback: "(function|null)"
+ };
+ var Swipe = class 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();
}
- if (val === "false") {
- return false;
+ static get Default() {
+ return Default$c;
}
- if (val === Number(val).toString()) {
- return Number(val);
+ static get DefaultType() {
+ return DefaultType$c;
}
- if (val === "" || val === "null") {
- return null;
+ static get NAME() {
+ return NAME$d;
}
- return val;
- }
- function normalizeDataKey(key) {
- return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`);
- }
- var 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 {};
+ dispose() {
+ EventHandler.off(this._element, EVENT_KEY$9);
+ }
+ _start(event) {
+ if (!this._supportPointerEvents) {
+ this._deltaX = event.touches[0].clientX;
+ return;
}
- const attributes = {};
- Object.keys(element.dataset).filter((key) => key.startsWith("bs")).forEach((key) => {
- let pureKey = key.replace(/^bs/, "");
- pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
- attributes[pureKey] = normalizeData(element.dataset[key]);
- });
- return attributes;
- },
- getDataAttribute(element, key) {
- return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
- },
- offset(element) {
- const rect = element.getBoundingClientRect();
- return {
- top: rect.top + document.body.scrollTop,
- left: rect.left + document.body.scrollLeft
- };
- },
- position(element) {
- return {
- top: element.offsetTop,
- left: element.offsetLeft
- };
+ 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 isSupported() {
+ return "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0;
}
};
- var NAME$a = "carousel";
- var DATA_KEY$9 = "bs.carousel";
- var EVENT_KEY$9 = `.${DATA_KEY$9}`;
- var DATA_API_KEY$6 = ".data-api";
- var ARROW_LEFT_KEY = "ArrowLeft";
- var ARROW_RIGHT_KEY = "ArrowRight";
+ var NAME$c = "carousel";
+ var DATA_KEY$8 = "bs.carousel";
+ var EVENT_KEY$8 = `.${DATA_KEY$8}`;
+ var DATA_API_KEY$5 = ".data-api";
+ var ARROW_LEFT_KEY$1 = "ArrowLeft";
+ var ARROW_RIGHT_KEY$1 = "ArrowRight";
var TOUCHEVENT_COMPAT_WAIT = 500;
- var SWIPE_THRESHOLD = 40;
- var Default$9 = {
- interval: 5e3,
- keyboard: true,
- slide: false,
- pause: "hover",
- wrap: true,
- touch: true
- };
- var DefaultType$9 = {
- interval: "(number|boolean)",
- keyboard: "boolean",
- slide: "(boolean|string)",
- pause: "(string|boolean)",
- wrap: "boolean",
- touch: "boolean"
- };
var ORDER_NEXT = "next";
var ORDER_PREV = "prev";
var DIRECTION_LEFT = "left";
var DIRECTION_RIGHT = "right";
- var KEY_TO_DIRECTION = {
- [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
- [ARROW_RIGHT_KEY]: DIRECTION_LEFT
- };
- var EVENT_SLIDE = `slide${EVENT_KEY$9}`;
- var EVENT_SLID = `slid${EVENT_KEY$9}`;
- var EVENT_KEYDOWN = `keydown${EVENT_KEY$9}`;
- var EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$9}`;
- var EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$9}`;
- var EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
- var EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
- var EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
- var EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
- var EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
- var EVENT_DRAG_START = `dragstart${EVENT_KEY$9}`;
- var EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$9}${DATA_API_KEY$6}`;
- var EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`;
+ var EVENT_SLIDE = `slide${EVENT_KEY$8}`;
+ var EVENT_SLID = `slid${EVENT_KEY$8}`;
+ var EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`;
+ var EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`;
+ var EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`;
+ var EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`;
+ var EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`;
+ var EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
var CLASS_NAME_CAROUSEL = "carousel";
var CLASS_NAME_ACTIVE$2 = "active";
var CLASS_NAME_SLIDE = "slide";
@@ -2390,43 +2315,56 @@
var CLASS_NAME_START = "carousel-item-start";
var CLASS_NAME_NEXT = "carousel-item-next";
var CLASS_NAME_PREV = "carousel-item-prev";
- var CLASS_NAME_POINTER_EVENT = "pointer-event";
- var SELECTOR_ACTIVE$1 = ".active";
- var SELECTOR_ACTIVE_ITEM = ".active.carousel-item";
+ var SELECTOR_ACTIVE = ".active";
var SELECTOR_ITEM = ".carousel-item";
+ var SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
var SELECTOR_ITEM_IMG = ".carousel-item img";
- var SELECTOR_NEXT_PREV = ".carousel-item-next, .carousel-item-prev";
var SELECTOR_INDICATORS = ".carousel-indicators";
- var SELECTOR_INDICATOR = "[data-bs-target]";
var SELECTOR_DATA_SLIDE = "[data-bs-slide], [data-bs-slide-to]";
var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
- var POINTER_TYPE_TOUCH = "touch";
- var POINTER_TYPE_PEN = "pen";
+ var KEY_TO_DIRECTION = {
+ [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT,
+ [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT
+ };
+ var Default$b = {
+ interval: 5e3,
+ keyboard: true,
+ pause: "hover",
+ ride: false,
+ touch: true,
+ wrap: true
+ };
+ var DefaultType$b = {
+ interval: "(number|boolean)",
+ keyboard: "boolean",
+ pause: "(string|boolean)",
+ ride: "(boolean|string)",
+ touch: "boolean",
+ wrap: "boolean"
+ };
var Carousel = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._items = null;
+ super(element, config);
this._interval = null;
this._activeElement = null;
- this._isPaused = false;
this._isSliding = false;
this.touchTimeout = null;
- this.touchStartX = 0;
- this.touchDeltaX = 0;
- this._config = this._getConfig(config);
+ this._swipeHelper = null;
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
- this._touchSupported = "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0;
- this._pointerEvent = Boolean(window.PointerEvent);
this._addEventListeners();
+ if (this._config.ride === CLASS_NAME_CAROUSEL) {
+ this.cycle();
+ }
}
- // Getters
static get Default() {
- return Default$9;
+ return Default$b;
+ }
+ static get DefaultType() {
+ return DefaultType$b;
}
static get NAME() {
- return NAME$a;
+ return NAME$c;
}
- // Public
next() {
this._slide(ORDER_NEXT);
}
@@ -2438,118 +2376,85 @@
prev() {
this._slide(ORDER_PREV);
}
- pause(event) {
- if (!event) {
- this._isPaused = true;
- }
- if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
+ pause() {
+ if (this._isSliding) {
triggerTransitionEnd(this._element);
- this.cycle(true);
}
- clearInterval(this._interval);
- this._interval = null;
+ this._clearInterval();
}
- cycle(event) {
- if (!event) {
- this._isPaused = false;
- }
- if (this._interval) {
- clearInterval(this._interval);
- this._interval = null;
+ cycle() {
+ this._clearInterval();
+ this._updateInterval();
+ this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
+ }
+ _maybeEnableCycle() {
+ if (!this._config.ride) {
+ return;
}
- if (this._config && this._config.interval && !this._isPaused) {
- this._updateInterval();
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
+ if (this._isSliding) {
+ EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
+ return;
}
+ this.cycle();
}
to(index) {
- this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
- const activeIndex = this._getItemIndex(this._activeElement);
- if (index > this._items.length - 1 || index < 0) {
+ 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) {
- this.pause();
- this.cycle();
return;
}
const order2 = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
- this._slide(order2, this._items[index]);
+ this._slide(order2, items[index]);
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$9,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$a, config, DefaultType$9);
- return config;
- }
- _handleSwipe() {
- const absDeltax = Math.abs(this.touchDeltaX);
- if (absDeltax <= SWIPE_THRESHOLD) {
- return;
- }
- const direction = absDeltax / this.touchDeltaX;
- this.touchDeltaX = 0;
- if (!direction) {
- return;
+ dispose() {
+ if (this._swipeHelper) {
+ this._swipeHelper.dispose();
}
- this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
+ super.dispose();
+ }
+ _configAfterMerge(config) {
+ config.defaultInterval = config.interval;
+ return config;
}
_addEventListeners() {
if (this._config.keyboard) {
- EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event));
+ EventHandler.on(this._element, EVENT_KEYDOWN$1, (event) => this._keydown(event));
}
if (this._config.pause === "hover") {
- EventHandler.on(this._element, EVENT_MOUSEENTER, (event) => this.pause(event));
- EventHandler.on(this._element, EVENT_MOUSELEAVE, (event) => this.cycle(event));
+ EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause());
+ EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle());
}
- if (this._config.touch && this._touchSupported) {
+ if (this._config.touch && Swipe.isSupported()) {
this._addTouchEventListeners();
}
}
_addTouchEventListeners() {
- const start2 = (event) => {
- if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
- this.touchStartX = event.clientX;
- } else if (!this._pointerEvent) {
- this.touchStartX = event.touches[0].clientX;
- }
- };
- const move = (event) => {
- this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
- };
- const end2 = (event) => {
- if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
- this.touchDeltaX = event.clientX - this.touchStartX;
+ 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;
}
- this._handleSwipe();
- if (this._config.pause === "hover") {
- this.pause();
- if (this.touchTimeout) {
- clearTimeout(this.touchTimeout);
- }
- this.touchTimeout = setTimeout((event2) => this.cycle(event2), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
+ this.pause();
+ if (this.touchTimeout) {
+ clearTimeout(this.touchTimeout);
}
+ this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
};
- SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach((itemImg) => {
- EventHandler.on(itemImg, EVENT_DRAG_START, (e) => e.preventDefault());
- });
- if (this._pointerEvent) {
- EventHandler.on(this._element, EVENT_POINTERDOWN, (event) => start2(event));
- EventHandler.on(this._element, EVENT_POINTERUP, (event) => end2(event));
- this._element.classList.add(CLASS_NAME_POINTER_EVENT);
- } else {
- EventHandler.on(this._element, EVENT_TOUCHSTART, (event) => start2(event));
- EventHandler.on(this._element, EVENT_TOUCHMOVE, (event) => move(event));
- EventHandler.on(this._element, EVENT_TOUCHEND, (event) => end2(event));
- }
+ 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)) {
@@ -2558,313 +2463,249 @@
const direction = KEY_TO_DIRECTION[event.key];
if (direction) {
event.preventDefault();
- this._slide(direction);
+ this._slide(this._directionToOrder(direction));
}
}
_getItemIndex(element) {
- this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
- return this._items.indexOf(element);
+ return this._getItems().indexOf(element);
}
- _getItemByOrder(order2, activeElement) {
- const isNext = order2 === ORDER_NEXT;
- return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
- }
- _triggerSlideEvent(relatedTarget, eventDirectionName) {
- const targetIndex = this._getItemIndex(relatedTarget);
- const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
- return EventHandler.trigger(this._element, EVENT_SLIDE, {
- relatedTarget,
- direction: eventDirectionName,
- from: fromIndex,
- to: targetIndex
- });
- }
- _setActiveIndicatorElement(element) {
- if (this._indicatorsElement) {
- const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
- activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
- activeIndicator.removeAttribute("aria-current");
- const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
- for (let i = 0; i < indicators.length; i++) {
- if (Number.parseInt(indicators[i].getAttribute("data-bs-slide-to"), 10) === this._getItemIndex(element)) {
- indicators[i].classList.add(CLASS_NAME_ACTIVE$2);
- indicators[i].setAttribute("aria-current", "true");
- break;
- }
- }
+ _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 || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
+ const element = this._activeElement || this._getActive();
if (!element) {
return;
}
const elementInterval = Number.parseInt(element.getAttribute("data-bs-interval"), 10);
- if (elementInterval) {
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
- this._config.interval = elementInterval;
- } else {
- this._config.interval = this._config.defaultInterval || this._config.interval;
- }
+ this._config.interval = elementInterval || this._config.defaultInterval;
}
- _slide(directionOrOrder, element) {
- const order2 = this._directionToOrder(directionOrOrder);
- const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
- const activeElementIndex = this._getItemIndex(activeElement);
- const nextElement = element || this._getItemByOrder(order2, activeElement);
- const nextElementIndex = this._getItemIndex(nextElement);
- const isCycling = Boolean(this._interval);
- const isNext = order2 === ORDER_NEXT;
- const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
- const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
- const eventDirectionName = this._orderToDirection(order2);
- if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) {
- this._isSliding = false;
+ _slide(order2, element = null) {
+ if (this._isSliding) {
return;
}
- if (this._isSliding) {
+ const activeElement = this._getActive();
+ const isNext = order2 === ORDER_NEXT;
+ const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
+ if (nextElement === activeElement) {
return;
}
- const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
+ const nextElementIndex = this._getItemIndex(nextElement);
+ const triggerEvent = (eventName) => {
+ return EventHandler.trigger(this._element, eventName, {
+ relatedTarget: nextElement,
+ direction: this._orderToDirection(order2),
+ from: this._getItemIndex(activeElement),
+ to: nextElementIndex
+ });
+ };
+ const slideEvent = triggerEvent(EVENT_SLIDE);
if (slideEvent.defaultPrevented) {
return;
}
if (!activeElement || !nextElement) {
return;
}
+ const isCycling = Boolean(this._interval);
+ this.pause();
this._isSliding = true;
- if (isCycling) {
- this.pause();
- }
- this._setActiveIndicatorElement(nextElement);
+ this._setActiveIndicatorElement(nextElementIndex);
this._activeElement = nextElement;
- const triggerSlidEvent = () => {
- EventHandler.trigger(this._element, EVENT_SLID, {
- relatedTarget: nextElement,
- direction: eventDirectionName,
- from: activeElementIndex,
- to: nextElementIndex
- });
- };
- if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
- 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;
- setTimeout(triggerSlidEvent, 0);
- };
- this._queueCallback(completeCallBack, activeElement, true);
- } else {
- activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
+ 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;
- triggerSlidEvent();
- }
+ triggerEvent(EVENT_SLID);
+ };
+ this._queueCallback(completeCallBack, activeElement, this._isAnimated());
if (isCycling) {
this.cycle();
}
}
- _directionToOrder(direction) {
- if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
- return direction;
+ _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(order2) {
- if (![ORDER_NEXT, ORDER_PREV].includes(order2)) {
- return order2;
- }
if (isRTL()) {
return order2 === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return order2 === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
}
- // Static
- static carouselInterface(element, config) {
- const data = Carousel.getOrCreateInstance(element, config);
- let {
- _config
- } = data;
- if (typeof config === "object") {
- _config = {
- ..._config,
- ...config
- };
- }
- const action = typeof config === "string" ? config : _config.slide;
- if (typeof config === "number") {
- data.to(config);
- } else if (typeof action === "string") {
- if (typeof data[action] === "undefined") {
- throw new TypeError(`No method named "${action}"`);
- }
- data[action]();
- } else if (_config.interval && _config.ride) {
- data.pause();
- data.cycle();
- }
- }
static jQueryInterface(config) {
return this.each(function() {
- Carousel.carouselInterface(this, config);
+ const data = Carousel.getOrCreateInstance(this, config);
+ if (typeof config === "number") {
+ data.to(config);
+ return;
+ }
+ if (typeof config === "string") {
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
+ }
});
}
- static dataApiClickHandler(event) {
- const target = getElementFromSelector(this);
- if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
- return;
- }
- const config = {
- ...Manipulator.getDataAttributes(target),
- ...Manipulator.getDataAttributes(this)
- };
- const slideIndex = this.getAttribute("data-bs-slide-to");
- if (slideIndex) {
- config.interval = false;
- }
- Carousel.carouselInterface(target, config);
- if (slideIndex) {
- Carousel.getInstance(target).to(slideIndex);
- }
- event.preventDefault();
- }
};
- EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
- EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
+ 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 (let i = 0, len = carousels.length; i < len; i++) {
- Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
+ for (const carousel of carousels) {
+ Carousel.getOrCreateInstance(carousel);
}
});
defineJQueryPlugin(Carousel);
- var NAME$9 = "collapse";
- var DATA_KEY$8 = "bs.collapse";
- var EVENT_KEY$8 = `.${DATA_KEY$8}`;
- var DATA_API_KEY$5 = ".data-api";
- var Default$8 = {
- toggle: true,
- parent: ""
- };
- var DefaultType$8 = {
- toggle: "boolean",
- parent: "(string|element)"
- };
- var EVENT_SHOW$5 = `show${EVENT_KEY$8}`;
- var EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`;
- var EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
- var EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
- var EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
- var CLASS_NAME_SHOW$8 = "show";
+ var NAME$b = "collapse";
+ var DATA_KEY$7 = "bs.collapse";
+ var EVENT_KEY$7 = `.${DATA_KEY$7}`;
+ var DATA_API_KEY$4 = ".data-api";
+ var EVENT_SHOW$6 = `show${EVENT_KEY$7}`;
+ var EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`;
+ var EVENT_HIDE$6 = `hide${EVENT_KEY$7}`;
+ var EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`;
+ var EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
+ var CLASS_NAME_SHOW$7 = "show";
var CLASS_NAME_COLLAPSE = "collapse";
var CLASS_NAME_COLLAPSING = "collapsing";
var CLASS_NAME_COLLAPSED = "collapsed";
+ var CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
+ var CLASS_NAME_HORIZONTAL = "collapse-horizontal";
var WIDTH = "width";
var HEIGHT = "height";
- var SELECTOR_ACTIVES = ".show, .collapsing";
+ var SELECTOR_ACTIVES = ".collapse.show, .collapse.collapsing";
var SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
+ var Default$a = {
+ parent: null,
+ toggle: true
+ };
+ var DefaultType$a = {
+ parent: "(null|element)",
+ toggle: "boolean"
+ };
var Collapse = class extends BaseComponent {
constructor(element, config) {
- super(element);
+ super(element, config);
this._isTransitioning = false;
- this._config = this._getConfig(config);
- this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$4}[href="#${this._element.id}"],${SELECTOR_DATA_TOGGLE$4}[data-bs-target="#${this._element.id}"]`);
+ this._triggerArray = [];
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
- for (let i = 0, len = toggleList.length; i < len; i++) {
- const elem = toggleList[i];
- const selector = getSelectorFromElement(elem);
- const filterElement = SelectorEngine.find(selector).filter((foundElem) => foundElem === this._element);
+ 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._selector = selector;
this._triggerArray.push(elem);
}
}
- this._parent = this._config.parent ? this._getParent() : null;
+ this._initializeChildren();
if (!this._config.parent) {
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
+ this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
}
if (this._config.toggle) {
this.toggle();
}
}
- // Getters
static get Default() {
- return Default$8;
+ return Default$a;
+ }
+ static get DefaultType() {
+ return DefaultType$a;
}
static get NAME() {
- return NAME$9;
+ return NAME$b;
}
- // Public
toggle() {
- if (this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isShown()) {
this.hide();
} else {
this.show();
}
}
show() {
- if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isTransitioning || this._isShown()) {
return;
}
- let actives;
- let activesData;
- if (this._parent) {
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter((elem) => {
- if (typeof this._config.parent === "string") {
- return elem.getAttribute("data-bs-parent") === this._config.parent;
- }
- return elem.classList.contains(CLASS_NAME_COLLAPSE);
- });
- if (actives.length === 0) {
- actives = null;
- }
+ let activeChildren = [];
+ if (this._config.parent) {
+ activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter((element) => element !== this._element).map((element) => Collapse.getOrCreateInstance(element, {
+ toggle: false
+ }));
}
- const container = SelectorEngine.findOne(this._selector);
- if (actives) {
- const tempActiveData = actives.find((elem) => container !== elem);
- activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
- if (activesData && activesData._isTransitioning) {
- return;
- }
+ if (activeChildren.length && activeChildren[0]._isTransitioning) {
+ return;
}
- const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5);
+ const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6);
if (startEvent.defaultPrevented) {
return;
}
- if (actives) {
- actives.forEach((elemActive) => {
- if (container !== elemActive) {
- Collapse.collapseInterface(elemActive, "hide");
- }
- if (!activesData) {
- Data.set(elemActive, DATA_KEY$8, null);
- }
- });
+ 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;
- if (this._triggerArray.length) {
- this._triggerArray.forEach((element) => {
- element.classList.remove(CLASS_NAME_COLLAPSED);
- element.setAttribute("aria-expanded", true);
- });
- }
- this.setTransitioning(true);
+ 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$8);
+ this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
this._element.style[dimension] = "";
- this.setTransitioning(false);
- EventHandler.trigger(this._element, EVENT_SHOWN$5);
+ EventHandler.trigger(this._element, EVENT_SHOWN$6);
};
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
const scrollSize = `scroll${capitalizedDimension}`;
@@ -2872,10 +2713,10 @@
this._element.style[dimension] = `${this._element[scrollSize]}px`;
}
hide() {
- if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isTransitioning || !this._isShown()) {
return;
}
- const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5);
+ const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
if (startEvent.defaultPrevented) {
return;
}
@@ -2883,94 +2724,72 @@
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$8);
- const triggerArrayLength = this._triggerArray.length;
- if (triggerArrayLength > 0) {
- for (let i = 0; i < triggerArrayLength; i++) {
- const trigger = this._triggerArray[i];
- const elem = getElementFromSelector(trigger);
- if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) {
- trigger.classList.add(CLASS_NAME_COLLAPSED);
- trigger.setAttribute("aria-expanded", false);
- }
+ 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.setTransitioning(true);
+ this._isTransitioning = true;
const complete = () => {
- this.setTransitioning(false);
+ this._isTransitioning = false;
this._element.classList.remove(CLASS_NAME_COLLAPSING);
this._element.classList.add(CLASS_NAME_COLLAPSE);
- EventHandler.trigger(this._element, EVENT_HIDDEN$5);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$6);
};
this._element.style[dimension] = "";
this._queueCallback(complete, this._element, true);
}
- setTransitioning(isTransitioning) {
- this._isTransitioning = isTransitioning;
+ _isShown(element = this._element) {
+ return element.classList.contains(CLASS_NAME_SHOW$7);
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$8,
- ...config
- };
+ _configAfterMerge(config) {
config.toggle = Boolean(config.toggle);
- typeCheckConfig(NAME$9, config, DefaultType$8);
+ config.parent = getElement(config.parent);
return config;
}
_getDimension() {
- return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
- }
- _getParent() {
- let {
- parent
- } = this._config;
- parent = getElement(parent);
- const selector = `${SELECTOR_DATA_TOGGLE$4}[data-bs-parent="${parent}"]`;
- SelectorEngine.find(selector, parent).forEach((element) => {
- const selected = getElementFromSelector(element);
- this._addAriaAndCollapsedClass(selected, [element]);
- });
- return parent;
+ return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
}
- _addAriaAndCollapsedClass(element, triggerArray) {
- if (!element || !triggerArray.length) {
+ _initializeChildren() {
+ if (!this._config.parent) {
return;
}
- const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
- triggerArray.forEach((elem) => {
- if (isOpen) {
- elem.classList.remove(CLASS_NAME_COLLAPSED);
- } else {
- elem.classList.add(CLASS_NAME_COLLAPSED);
+ 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));
}
- elem.setAttribute("aria-expanded", isOpen);
- });
- }
- // Static
- static collapseInterface(element, config) {
- let data = Collapse.getInstance(element);
- const _config = {
- ...Default$8,
- ...Manipulator.getDataAttributes(element),
- ...typeof config === "object" && config ? config : {}
- };
- if (!data && _config.toggle && typeof config === "string" && /show|hide/.test(config)) {
- _config.toggle = false;
}
- if (!data) {
- data = new Collapse(element, _config);
+ }
+ _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));
+ }
+ _addAriaAndCollapsedClass(triggerArray, isOpen) {
+ if (!triggerArray.length) {
+ return;
}
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ for (const element of triggerArray) {
+ element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
+ element.setAttribute("aria-expanded", isOpen);
}
}
static jQueryInterface(config) {
+ const _config = {};
+ if (typeof config === "string" && /show|hide/.test(config)) {
+ _config.toggle = false;
+ }
return this.each(function() {
- Collapse.collapseInterface(this, config);
+ const data = Collapse.getOrCreateInstance(this, _config);
+ if (typeof config === "string") {
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
+ }
});
}
};
@@ -2978,51 +2797,39 @@
if (event.target.tagName === "A" || event.delegateTarget && event.delegateTarget.tagName === "A") {
event.preventDefault();
}
- const triggerData = Manipulator.getDataAttributes(this);
- const selector = getSelectorFromElement(this);
- const selectorElements = SelectorEngine.find(selector);
- selectorElements.forEach((element) => {
- const data = Collapse.getInstance(element);
- let config;
- if (data) {
- if (data._parent === null && typeof triggerData.parent === "string") {
- data._config.parent = triggerData.parent;
- data._parent = data._getParent();
- }
- config = "toggle";
- } else {
- config = triggerData;
- }
- Collapse.collapseInterface(element, config);
- });
+ for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {
+ Collapse.getOrCreateInstance(element, {
+ toggle: false
+ }).toggle();
+ }
});
defineJQueryPlugin(Collapse);
- var NAME$8 = "dropdown";
- var DATA_KEY$7 = "bs.dropdown";
- var EVENT_KEY$7 = `.${DATA_KEY$7}`;
- var DATA_API_KEY$4 = ".data-api";
+ var NAME$a = "dropdown";
+ var DATA_KEY$6 = "bs.dropdown";
+ var EVENT_KEY$6 = `.${DATA_KEY$6}`;
+ var DATA_API_KEY$3 = ".data-api";
var ESCAPE_KEY$2 = "Escape";
- var SPACE_KEY = "Space";
- var TAB_KEY = "Tab";
- var ARROW_UP_KEY = "ArrowUp";
- var ARROW_DOWN_KEY = "ArrowDown";
+ var TAB_KEY$1 = "Tab";
+ var ARROW_UP_KEY$1 = "ArrowUp";
+ var ARROW_DOWN_KEY$1 = "ArrowDown";
var RIGHT_MOUSE_BUTTON = 2;
- var REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
- var EVENT_HIDE$4 = `hide${EVENT_KEY$7}`;
- var EVENT_HIDDEN$4 = `hidden${EVENT_KEY$7}`;
- var EVENT_SHOW$4 = `show${EVENT_KEY$7}`;
- var EVENT_SHOWN$4 = `shown${EVENT_KEY$7}`;
- var EVENT_CLICK = `click${EVENT_KEY$7}`;
- var EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var CLASS_NAME_SHOW$7 = "show";
+ var EVENT_HIDE$5 = `hide${EVENT_KEY$6}`;
+ var EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`;
+ var EVENT_SHOW$5 = `show${EVENT_KEY$6}`;
+ var EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`;
+ var EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var CLASS_NAME_SHOW$6 = "show";
var CLASS_NAME_DROPUP = "dropup";
var CLASS_NAME_DROPEND = "dropend";
var CLASS_NAME_DROPSTART = "dropstart";
- var CLASS_NAME_NAVBAR = "navbar";
- var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]';
+ var CLASS_NAME_DROPUP_CENTER = "dropup-center";
+ var CLASS_NAME_DROPDOWN_CENTER = "dropdown-center";
+ var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
+ var SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;
var SELECTOR_MENU = ".dropdown-menu";
+ var SELECTOR_NAVBAR = ".navbar";
var SELECTOR_NAVBAR_NAV = ".navbar-nav";
var SELECTOR_VISIBLE_ITEMS = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)";
var PLACEMENT_TOP = isRTL() ? "top-end" : "top-start";
@@ -3031,97 +2838,69 @@
var PLACEMENT_BOTTOMEND = isRTL() ? "bottom-start" : "bottom-end";
var PLACEMENT_RIGHT = isRTL() ? "left-start" : "right-start";
var PLACEMENT_LEFT = isRTL() ? "right-start" : "left-start";
- var Default$7 = {
- offset: [0, 2],
+ var PLACEMENT_TOPCENTER = "top";
+ var PLACEMENT_BOTTOMCENTER = "bottom";
+ var Default$9 = {
+ autoClose: true,
boundary: "clippingParents",
- reference: "toggle",
display: "dynamic",
+ offset: [0, 2],
popperConfig: null,
- autoClose: true
+ reference: "toggle"
};
- var DefaultType$7 = {
- offset: "(array|string|function)",
+ var DefaultType$9 = {
+ autoClose: "(boolean|string)",
boundary: "(string|element)",
- reference: "(string|element|object)",
display: "string",
+ offset: "(array|string|function)",
popperConfig: "(null|object|function)",
- autoClose: "(boolean|string)"
+ reference: "(string|element|object)"
};
var Dropdown = class extends BaseComponent {
constructor(element, config) {
- super(element);
+ super(element, config);
this._popper = null;
- this._config = this._getConfig(config);
- this._menu = this._getMenuElement();
+ this._parent = this._element.parentNode;
+ 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();
- this._addEventListeners();
}
- // Getters
static get Default() {
- return Default$7;
+ return Default$9;
}
static get DefaultType() {
- return DefaultType$7;
+ return DefaultType$9;
}
static get NAME() {
- return NAME$8;
+ return NAME$a;
}
- // Public
toggle() {
- if (isDisabled(this._element)) {
- return;
- }
- const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
- if (isActive) {
- this.hide();
- return;
- }
- this.show();
+ return this._isShown() ? this.hide() : this.show();
}
show() {
- if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
+ if (isDisabled(this._element) || this._isShown()) {
return;
}
- const parent = Dropdown.getParentFromElement(this._element);
const relatedTarget = {
relatedTarget: this._element
};
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget);
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget);
if (showEvent.defaultPrevented) {
return;
}
- if (this._inNavbar) {
- Manipulator.setDataAttribute(this._menu, "popper", "none");
- } else {
- if (typeof lib_exports === "undefined") {
- throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
- }
- let referenceElement = this._element;
- if (this._config.reference === "parent") {
- referenceElement = parent;
- } else if (isElement2(this._config.reference)) {
- referenceElement = getElement(this._config.reference);
- } else if (typeof this._config.reference === "object") {
- referenceElement = this._config.reference;
- }
- const popperConfig = this._getPopperConfig();
- const isDisplayStatic = popperConfig.modifiers.find((modifier) => modifier.name === "applyStyles" && modifier.enabled === false);
- this._popper = createPopper3(referenceElement, this._menu, popperConfig);
- if (isDisplayStatic) {
- Manipulator.setDataAttribute(this._menu, "popper", "static");
+ this._createPopper();
+ if ("ontouchstart" in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
+ for (const element of [].concat(...document.body.children)) {
+ EventHandler.on(element, "mouseover", noop);
}
}
- if ("ontouchstart" in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
- [].concat(...document.body.children).forEach((elem) => EventHandler.on(elem, "mouseover", noop));
- }
this._element.focus();
this._element.setAttribute("aria-expanded", true);
- this._menu.classList.toggle(CLASS_NAME_SHOW$7);
- this._element.classList.toggle(CLASS_NAME_SHOW$7);
- EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
+ 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._menu.classList.contains(CLASS_NAME_SHOW$7)) {
+ if (isDisabled(this._element) || !this._isShown()) {
return;
}
const relatedTarget = {
@@ -3141,53 +2920,64 @@
this._popper.update();
}
}
- // Private
- _addEventListeners() {
- EventHandler.on(this._element, EVENT_CLICK, (event) => {
- event.preventDefault();
- this.toggle();
- });
- }
_completeHide(relatedTarget) {
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
}
if ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((elem) => EventHandler.off(elem, "mouseover", noop));
+ 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$7);
- this._element.classList.remove(CLASS_NAME_SHOW$7);
+ 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$4, relatedTarget);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget);
}
_getConfig(config) {
- config = {
- ...this.constructor.Default,
- ...Manipulator.getDataAttributes(this._element),
- ...config
- };
- typeCheckConfig(NAME$8, config, this.constructor.DefaultType);
+ config = super._getConfig(config);
if (typeof config.reference === "object" && !isElement2(config.reference) && typeof config.reference.getBoundingClientRect !== "function") {
- throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
+ throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
}
return config;
}
- _getMenuElement() {
- return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
+ _createPopper() {
+ if (typeof lib_exports === "undefined") {
+ throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
+ }
+ let referenceElement = this._element;
+ if (this._config.reference === "parent") {
+ referenceElement = this._parent;
+ } else if (isElement2(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 = createPopper3(referenceElement, this._menu, popperConfig);
+ }
+ _isShown() {
+ return this._menu.classList.contains(CLASS_NAME_SHOW$6);
}
_getPlacement() {
- const parentDropdown = this._element.parentNode;
+ 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;
+ }
const isEnd = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
@@ -3195,14 +2985,14 @@
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
}
_detectNavbar() {
- return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
+ return this._element.closest(SELECTOR_NAVBAR) !== null;
}
_getOffset() {
const {
offset: offset2
} = this._config;
if (typeof offset2 === "string") {
- return offset2.split(",").map((val) => Number.parseInt(val, 10));
+ return offset2.split(",").map((value) => Number.parseInt(value, 10));
}
if (typeof offset2 === "function") {
return (popperData) => offset2(popperData, this._element);
@@ -3224,7 +3014,8 @@
}
}]
};
- if (this._config.display === "static") {
+ if (this._inNavbar || this._config.display === "static") {
+ Manipulator.setDataAttribute(this._menu, "popper", "static");
defaultBsPopperConfig.modifiers = [{
name: "applyStyles",
enabled: false
@@ -3232,212 +3023,138 @@
}
return {
...defaultBsPopperConfig,
- ...typeof this._config.popperConfig === "function" ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
};
}
_selectMenuItem({
key,
target
}) {
- const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
+ const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((element) => isVisible(element));
if (!items.length) {
return;
}
- getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
}
- // Static
- static dropdownInterface(element, config) {
- const data = Dropdown.getOrCreateInstance(element, config);
- if (typeof config === "string") {
+ 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 jQueryInterface(config) {
- return this.each(function() {
- Dropdown.dropdownInterface(this, config);
});
}
static clearMenus(event) {
- if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY)) {
+ if (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY$1) {
return;
}
- const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
- for (let i = 0, len = toggles.length; i < len; i++) {
- const context = Dropdown.getInstance(toggles[i]);
+ 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;
}
- if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) {
+ 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;
+ }
+ 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) {
- 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;
- }
- if (context._menu.contains(event.target) && (event.type === "keyup" && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
- continue;
- }
- if (event.type === "click") {
- relatedTarget.clickEvent = event;
- }
- }
- context._completeHide(relatedTarget);
- }
- }
- static getParentFromElement(element) {
- return getElementFromSelector(element) || element.parentNode;
- }
- static dataApiKeydownHandler(event) {
- if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
- return;
- }
- const isActive = this.classList.contains(CLASS_NAME_SHOW$7);
- if (!isActive && event.key === ESCAPE_KEY$2) {
- return;
- }
- event.preventDefault();
- event.stopPropagation();
- if (isDisabled(this)) {
- return;
- }
- const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
- if (event.key === ESCAPE_KEY$2) {
- getToggleButton().focus();
- Dropdown.clearMenus();
- return;
- }
- if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
- if (!isActive) {
- getToggleButton().click();
- }
- Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
- return;
- }
- if (!isActive || event.key === SPACE_KEY) {
- Dropdown.clearMenus();
- }
- }
- };
- 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.dropdownInterface(this);
- });
- defineJQueryPlugin(Dropdown);
- var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";
- var SELECTOR_STICKY_CONTENT = ".sticky-top";
- var ScrollBarHelper = class {
- constructor() {
- this._element = document.body;
- }
- getWidth() {
- const documentWidth = document.documentElement.clientWidth;
- return Math.abs(window.innerWidth - documentWidth);
- }
- hide() {
- const width = this.getWidth();
- this._disableOverFlow();
- this._setElementAttributes(this._element, "paddingRight", (calculatedValue) => calculatedValue + width);
- this._setElementAttributes(SELECTOR_FIXED_CONTENT, "paddingRight", (calculatedValue) => calculatedValue + width);
- this._setElementAttributes(SELECTOR_STICKY_CONTENT, "marginRight", (calculatedValue) => calculatedValue - width);
- }
- _disableOverFlow() {
- this._saveInitialAttribute(this._element, "overflow");
- this._element.style.overflow = "hidden";
- }
- _setElementAttributes(selector, styleProp, callback) {
- const scrollbarWidth = this.getWidth();
- const manipulationCallBack = (element) => {
- if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
- return;
+ };
+ if (event.type === "click") {
+ relatedTarget.clickEvent = event;
}
- this._saveInitialAttribute(element, styleProp);
- const calculatedValue = window.getComputedStyle(element)[styleProp];
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
- };
- this._applyManipulationCallback(selector, manipulationCallBack);
- }
- reset() {
- this._resetElementAttributes(this._element, "overflow");
- this._resetElementAttributes(this._element, "paddingRight");
- this._resetElementAttributes(SELECTOR_FIXED_CONTENT, "paddingRight");
- this._resetElementAttributes(SELECTOR_STICKY_CONTENT, "marginRight");
- }
- _saveInitialAttribute(element, styleProp) {
- const actualValue = element.style[styleProp];
- if (actualValue) {
- Manipulator.setDataAttribute(element, styleProp, actualValue);
+ context._completeHide(relatedTarget);
}
}
- _resetElementAttributes(selector, styleProp) {
- const manipulationCallBack = (element) => {
- const value = Manipulator.getDataAttribute(element, styleProp);
- if (typeof value === "undefined") {
- element.style.removeProperty(styleProp);
- } else {
- Manipulator.removeDataAttribute(element, styleProp);
- element.style[styleProp] = value;
- }
- };
- this._applyManipulationCallback(selector, manipulationCallBack);
- }
- _applyManipulationCallback(selector, callBack) {
- if (isElement2(selector)) {
- callBack(selector);
- } else {
- SelectorEngine.find(selector, this._element).forEach(callBack);
+ static dataApiKeydownHandler(event) {
+ 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();
+ 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()) {
+ event.stopPropagation();
+ instance.hide();
+ getToggleButton.focus();
}
- }
- isOverflowing() {
- return this.getWidth() > 0;
}
};
- var Default$6 = {
- isVisible: true,
- // if false, we use the backdrop helper without adding any element to the dom
+ 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();
+ });
+ defineJQueryPlugin(Dropdown);
+ var NAME$9 = "backdrop";
+ var CLASS_NAME_FADE$4 = "fade";
+ var CLASS_NAME_SHOW$5 = "show";
+ var EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
+ var Default$8 = {
+ className: "modal-backdrop",
+ clickCallback: null,
isAnimated: false,
- rootElement: "body",
- // give the choice to place backdrop under different elements
- clickCallback: null
+ isVisible: true,
+ rootElement: "body"
};
- var DefaultType$6 = {
- isVisible: "boolean",
+ var DefaultType$8 = {
+ className: "string",
+ clickCallback: "(function|null)",
isAnimated: "boolean",
- rootElement: "(element|string)",
- clickCallback: "(function|null)"
+ isVisible: "boolean",
+ rootElement: "(element|string)"
};
- var NAME$7 = "backdrop";
- var CLASS_NAME_BACKDROP = "modal-backdrop";
- var CLASS_NAME_FADE$5 = "fade";
- var CLASS_NAME_SHOW$6 = "show";
- var EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
- var Backdrop = class {
+ var Backdrop = class extends Config {
constructor(config) {
+ super();
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
+ static get Default() {
+ return Default$8;
+ }
+ static get DefaultType() {
+ return DefaultType$8;
+ }
+ static get NAME() {
+ return NAME$9;
+ }
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
+ const element = this._getElement();
if (this._config.isAnimated) {
- reflow(this._getElement());
+ reflow(element);
}
- this._getElement().classList.add(CLASS_NAME_SHOW$6);
+ element.classList.add(CLASS_NAME_SHOW$5);
this._emulateAnimation(() => {
execute(callback);
});
@@ -3447,109 +3164,249 @@
execute(callback);
return;
}
- this._getElement().classList.remove(CLASS_NAME_SHOW$6);
+ this._getElement().classList.remove(CLASS_NAME_SHOW$5);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
}
- // Private
+ dispose() {
+ if (!this._isAppended) {
+ return;
+ }
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
+ this._element.remove();
+ this._isAppended = false;
+ }
_getElement() {
if (!this._element) {
const backdrop = document.createElement("div");
- backdrop.className = CLASS_NAME_BACKDROP;
+ backdrop.className = this._config.className;
if (this._config.isAnimated) {
- backdrop.classList.add(CLASS_NAME_FADE$5);
+ backdrop.classList.add(CLASS_NAME_FADE$4);
}
this._element = backdrop;
}
return this._element;
}
- _getConfig(config) {
- config = {
- ...Default$6,
- ...typeof config === "object" ? config : {}
- };
+ _configAfterMerge(config) {
config.rootElement = getElement(config.rootElement);
- typeCheckConfig(NAME$7, config, DefaultType$6);
return config;
}
_append() {
if (this._isAppended) {
return;
}
- this._config.rootElement.appendChild(this._getElement());
- EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
+ const element = this._getElement();
+ this._config.rootElement.append(element);
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
- dispose() {
- if (!this._isAppended) {
- return;
- }
- EventHandler.off(this._element, EVENT_MOUSEDOWN);
- this._element.remove();
- this._isAppended = false;
- }
_emulateAnimation(callback) {
executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
}
};
- var NAME$6 = "modal";
- var DATA_KEY$6 = "bs.modal";
- var EVENT_KEY$6 = `.${DATA_KEY$6}`;
- var DATA_API_KEY$3 = ".data-api";
- var ESCAPE_KEY$1 = "Escape";
- var Default$5 = {
- backdrop: true,
- keyboard: true,
- focus: true
+ var NAME$8 = "focustrap";
+ var DATA_KEY$5 = "bs.focustrap";
+ var EVENT_KEY$5 = `.${DATA_KEY$5}`;
+ var EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
+ var EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
+ var TAB_KEY = "Tab";
+ var TAB_NAV_FORWARD = "forward";
+ var TAB_NAV_BACKWARD = "backward";
+ var Default$7 = {
+ autofocus: true,
+ trapElement: null
};
- var DefaultType$5 = {
- backdrop: "(boolean|string)",
- keyboard: "boolean",
- focus: "boolean"
+ var DefaultType$7 = {
+ autofocus: "boolean",
+ trapElement: "element"
+ };
+ var FocusTrap = class extends Config {
+ constructor(config) {
+ super();
+ this._config = this._getConfig(config);
+ this._isActive = false;
+ this._lastTabNavDirection = null;
+ }
+ static get Default() {
+ return Default$7;
+ }
+ static get DefaultType() {
+ return DefaultType$7;
+ }
+ static get NAME() {
+ return NAME$8;
+ }
+ activate() {
+ if (this._isActive) {
+ return;
+ }
+ if (this._config.autofocus) {
+ this._config.trapElement.focus();
+ }
+ EventHandler.off(document, EVENT_KEY$5);
+ 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);
+ }
+ _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;
+ }
+ };
+ var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";
+ var SELECTOR_STICKY_CONTENT = ".sticky-top";
+ var PROPERTY_PADDING = "padding-right";
+ var PROPERTY_MARGIN = "margin-right";
+ var ScrollBarHelper = class {
+ constructor() {
+ this._element = document.body;
+ }
+ getWidth() {
+ const documentWidth = document.documentElement.clientWidth;
+ return Math.abs(window.innerWidth - documentWidth);
+ }
+ hide() {
+ const width = this.getWidth();
+ this._disableOverFlow();
+ this._setElementAttributes(this._element, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width);
+ 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;
+ }
+ _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);
+ 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 (isElement2(selector)) {
+ callBack(selector);
+ return;
+ }
+ for (const sel of SelectorEngine.find(selector, this._element)) {
+ callBack(sel);
+ }
+ }
};
- var EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
- var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`;
- var EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
- var EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
- var EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
- var EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$6}`;
- var EVENT_RESIZE = `resize${EVENT_KEY$6}`;
- var EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
- var EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
- var EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
- var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
- var EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var NAME$7 = "modal";
+ var DATA_KEY$4 = "bs.modal";
+ var EVENT_KEY$4 = `.${DATA_KEY$4}`;
+ var DATA_API_KEY$2 = ".data-api";
+ var ESCAPE_KEY$1 = "Escape";
+ var EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
+ var EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
+ var EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
+ var EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
+ var EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
+ var EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
+ var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
+ var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
+ var EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
+ var EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
var CLASS_NAME_OPEN = "modal-open";
- var CLASS_NAME_FADE$4 = "fade";
- var CLASS_NAME_SHOW$5 = "show";
+ var CLASS_NAME_FADE$3 = "fade";
+ var CLASS_NAME_SHOW$4 = "show";
var CLASS_NAME_STATIC = "modal-static";
+ var OPEN_SELECTOR$1 = ".modal.show";
var SELECTOR_DIALOG = ".modal-dialog";
var SELECTOR_MODAL_BODY = ".modal-body";
var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
- var SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
+ var Default$6 = {
+ backdrop: true,
+ focus: true,
+ keyboard: true
+ };
+ var DefaultType$6 = {
+ backdrop: "(boolean|string)",
+ focus: "boolean",
+ keyboard: "boolean"
+ };
var Modal = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
this._backdrop = this._initializeBackDrop();
+ this._focustrap = this._initializeFocusTrap();
this._isShown = false;
- this._ignoreBackdropClick = false;
this._isTransitioning = false;
this._scrollBar = new ScrollBarHelper();
+ this._addEventListeners();
}
- // Getters
static get Default() {
- return Default$5;
+ return Default$6;
+ }
+ static get DefaultType() {
+ return DefaultType$6;
}
static get NAME() {
- return NAME$6;
+ return NAME$7;
}
- // Public
toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
}
@@ -3557,141 +3414,110 @@
if (this._isShown || this._isTransitioning) {
return;
}
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
relatedTarget
});
if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
- if (this._isAnimated()) {
- this._isTransitioning = true;
- }
+ this._isTransitioning = true;
this._scrollBar.hide();
document.body.classList.add(CLASS_NAME_OPEN);
this._adjustDialog();
- this._setEscapeEvent();
- this._setResizeEvent();
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, (event) => this.hide(event));
- EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
- EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, (event) => {
- if (event.target === this._element) {
- this._ignoreBackdropClick = true;
- }
- });
- });
- this._showBackdrop(() => this._showElement(relatedTarget));
+ this._backdrop.show(() => this._showElement(relatedTarget));
}
- hide(event) {
- if (event && ["A", "AREA"].includes(event.target.tagName)) {
- event.preventDefault();
- }
+ hide() {
if (!this._isShown || this._isTransitioning) {
return;
}
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
if (hideEvent.defaultPrevented) {
return;
}
this._isShown = false;
- const isAnimated = this._isAnimated();
- if (isAnimated) {
- this._isTransitioning = true;
- }
- this._setEscapeEvent();
- this._setResizeEvent();
- EventHandler.off(document, EVENT_FOCUSIN$2);
- this._element.classList.remove(CLASS_NAME_SHOW$5);
- EventHandler.off(this._element, EVENT_CLICK_DISMISS$2);
- EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
- this._queueCallback(() => this._hideModal(), this._element, isAnimated);
+ this._isTransitioning = true;
+ this._focustrap.deactivate();
+ this._element.classList.remove(CLASS_NAME_SHOW$4);
+ this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
}
dispose() {
- [window, this._dialog].forEach((htmlElement) => EventHandler.off(htmlElement, EVENT_KEY$6));
+ EventHandler.off(window, EVENT_KEY$4);
+ EventHandler.off(this._dialog, EVENT_KEY$4);
this._backdrop.dispose();
+ this._focustrap.deactivate();
super.dispose();
- EventHandler.off(document, EVENT_FOCUSIN$2);
}
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()
});
}
- _getConfig(config) {
- config = {
- ...Default$5,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$6, config, DefaultType$5);
- return config;
+ _initializeFocusTrap() {
+ return new FocusTrap({
+ trapElement: this._element
+ });
}
_showElement(relatedTarget) {
- const isAnimated = this._isAnimated();
- const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
- if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
- document.body.appendChild(this._element);
+ 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;
}
- if (isAnimated) {
- reflow(this._element);
- }
- this._element.classList.add(CLASS_NAME_SHOW$5);
- if (this._config.focus) {
- this._enforceFocus();
- }
+ reflow(this._element);
+ this._element.classList.add(CLASS_NAME_SHOW$4);
const transitionComplete = () => {
if (this._config.focus) {
- this._element.focus();
+ this._focustrap.activate();
}
this._isTransitioning = false;
- EventHandler.trigger(this._element, EVENT_SHOWN$3, {
+ EventHandler.trigger(this._element, EVENT_SHOWN$4, {
relatedTarget
});
};
- this._queueCallback(transitionComplete, this._dialog, isAnimated);
+ this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
}
- _enforceFocus() {
- EventHandler.off(document, EVENT_FOCUSIN$2);
- EventHandler.on(document, EVENT_FOCUSIN$2, (event) => {
- if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
- this._element.focus();
+ _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();
});
- }
- _setEscapeEvent() {
- if (this._isShown) {
- EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, (event) => {
- if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
- event.preventDefault();
- this.hide();
- } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) {
+ EventHandler.on(window, EVENT_RESIZE$1, () => {
+ if (this._isShown && !this._isTransitioning) {
+ this._adjustDialog();
+ }
+ });
+ EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, (event) => {
+ 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();
}
});
- } else {
- EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
- }
- }
- _setResizeEvent() {
- if (this._isShown) {
- EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
- } else {
- EventHandler.off(window, EVENT_RESIZE);
- }
+ });
}
_hideModal() {
this._element.style.display = "none";
@@ -3703,76 +3529,51 @@
document.body.classList.remove(CLASS_NAME_OPEN);
this._resetAdjustments();
this._scrollBar.reset();
- EventHandler.trigger(this._element, EVENT_HIDDEN$3);
- });
- }
- _showBackdrop(callback) {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, (event) => {
- if (this._ignoreBackdropClick) {
- this._ignoreBackdropClick = false;
- return;
- }
- if (event.target !== event.currentTarget) {
- return;
- }
- if (this._config.backdrop === true) {
- this.hide();
- } else if (this._config.backdrop === "static") {
- this._triggerBackdropTransition();
- }
+ EventHandler.trigger(this._element, EVENT_HIDDEN$4);
});
- this._backdrop.show(callback);
}
_isAnimated() {
- return this._element.classList.contains(CLASS_NAME_FADE$4);
+ return this._element.classList.contains(CLASS_NAME_FADE$3);
}
_triggerBackdropTransition() {
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
if (hideEvent.defaultPrevented) {
return;
}
- const {
- classList,
- scrollHeight,
- style
- } = this._element;
- const isModalOverflowing = scrollHeight > document.documentElement.clientHeight;
- if (!isModalOverflowing && style.overflowY === "hidden" || classList.contains(CLASS_NAME_STATIC)) {
+ const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
+ const initialOverflowY = this._element.style.overflowY;
+ if (initialOverflowY === "hidden" || this._element.classList.contains(CLASS_NAME_STATIC)) {
return;
}
if (!isModalOverflowing) {
- style.overflowY = "hidden";
+ this._element.style.overflowY = "hidden";
}
- classList.add(CLASS_NAME_STATIC);
+ this._element.classList.add(CLASS_NAME_STATIC);
this._queueCallback(() => {
- classList.remove(CLASS_NAME_STATIC);
- if (!isModalOverflowing) {
- this._queueCallback(() => {
- style.overflowY = "";
- }, this._dialog);
- }
+ 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 && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
- this._element.style.paddingLeft = `${scrollbarWidth}px`;
+ if (isBodyOverflowing && !isModalOverflowing) {
+ const property = isRTL() ? "paddingLeft" : "paddingRight";
+ this._element.style[property] = `${scrollbarWidth}px`;
}
- if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
- this._element.style.paddingRight = `${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);
@@ -3787,68 +3588,76 @@
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function(event) {
- const target = getElementFromSelector(this);
+ const target = SelectorEngine.getElementFromSelector(this);
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
- EventHandler.one(target, EVENT_SHOW$3, (showEvent) => {
+ EventHandler.one(target, EVENT_SHOW$4, (showEvent) => {
if (showEvent.defaultPrevented) {
return;
}
- EventHandler.one(target, EVENT_HIDDEN$3, () => {
+ EventHandler.one(target, EVENT_HIDDEN$4, () => {
if (isVisible(this)) {
this.focus();
}
});
});
+ const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
+ if (alreadyOpen) {
+ Modal.getInstance(alreadyOpen).hide();
+ }
const data = Modal.getOrCreateInstance(target);
data.toggle(this);
});
+ enableDismissTrigger(Modal);
defineJQueryPlugin(Modal);
- var NAME$5 = "offcanvas";
- var DATA_KEY$5 = "bs.offcanvas";
- var EVENT_KEY$5 = `.${DATA_KEY$5}`;
- var DATA_API_KEY$2 = ".data-api";
- var EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`;
+ var NAME$6 = "offcanvas";
+ var DATA_KEY$3 = "bs.offcanvas";
+ var EVENT_KEY$3 = `.${DATA_KEY$3}`;
+ var DATA_API_KEY$1 = ".data-api";
+ var EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
var ESCAPE_KEY = "Escape";
- var Default$4 = {
+ var CLASS_NAME_SHOW$3 = "show";
+ var CLASS_NAME_SHOWING$1 = "showing";
+ var CLASS_NAME_HIDING = "hiding";
+ var CLASS_NAME_BACKDROP = "offcanvas-backdrop";
+ var OPEN_SELECTOR = ".offcanvas.show";
+ var EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
+ var EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
+ var EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
+ var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
+ var EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
+ var EVENT_RESIZE = `resize${EVENT_KEY$3}`;
+ var EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
+ var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
+ var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
+ var Default$5 = {
backdrop: true,
keyboard: true,
scroll: false
};
- var DefaultType$4 = {
- backdrop: "boolean",
+ var DefaultType$5 = {
+ backdrop: "(boolean|string)",
keyboard: "boolean",
scroll: "boolean"
};
- var CLASS_NAME_SHOW$4 = "show";
- var OPEN_SELECTOR = ".offcanvas.show";
- var EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
- var EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
- var EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
- var EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
- var EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$5}`;
- var EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
- var EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
- var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
- var SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
- var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
var Offcanvas = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._isShown = false;
this._backdrop = this._initializeBackDrop();
+ this._focustrap = this._initializeFocusTrap();
this._addEventListeners();
}
- // Getters
- static get NAME() {
- return NAME$5;
- }
static get Default() {
- return Default$4;
+ 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);
}
@@ -3856,25 +3665,27 @@
if (this._isShown) {
return;
}
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
relatedTarget
});
if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
- this._element.style.visibility = "visible";
this._backdrop.show();
if (!this._config.scroll) {
new ScrollBarHelper().hide();
- this._enforceFocusOnElement(this._element);
}
- this._element.removeAttribute("aria-hidden");
this._element.setAttribute("aria-modal", true);
this._element.setAttribute("role", "dialog");
- this._element.classList.add(CLASS_NAME_SHOW$4);
+ this._element.classList.add(CLASS_NAME_SHOWING$1);
const completeCallBack = () => {
- EventHandler.trigger(this._element, EVENT_SHOWN$2, {
+ 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
});
};
@@ -3884,68 +3695,65 @@
if (!this._isShown) {
return;
}
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
if (hideEvent.defaultPrevented) {
return;
}
- EventHandler.off(document, EVENT_FOCUSIN$1);
+ this._focustrap.deactivate();
this._element.blur();
this._isShown = false;
- this._element.classList.remove(CLASS_NAME_SHOW$4);
+ this._element.classList.add(CLASS_NAME_HIDING);
this._backdrop.hide();
const completeCallback = () => {
- this._element.setAttribute("aria-hidden", true);
+ this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
this._element.removeAttribute("aria-modal");
this._element.removeAttribute("role");
- this._element.style.visibility = "hidden";
if (!this._config.scroll) {
new ScrollBarHelper().reset();
}
- EventHandler.trigger(this._element, EVENT_HIDDEN$2);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$3);
};
this._queueCallback(completeCallback, this._element, true);
}
dispose() {
this._backdrop.dispose();
+ this._focustrap.deactivate();
super.dispose();
- EventHandler.off(document, EVENT_FOCUSIN$1);
- }
- // Private
- _getConfig(config) {
- config = {
- ...Default$4,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$5, config, DefaultType$4);
- return config;
}
_initializeBackDrop() {
+ const clickCallback = () => {
+ if (this._config.backdrop === "static") {
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
+ return;
+ }
+ this.hide();
+ };
+ const isVisible2 = Boolean(this._config.backdrop);
return new Backdrop({
- isVisible: this._config.backdrop,
+ className: CLASS_NAME_BACKDROP,
+ isVisible: isVisible2,
isAnimated: true,
rootElement: this._element.parentNode,
- clickCallback: () => this.hide()
+ clickCallback: isVisible2 ? clickCallback : null
});
}
- _enforceFocusOnElement(element) {
- EventHandler.off(document, EVENT_FOCUSIN$1);
- EventHandler.on(document, EVENT_FOCUSIN$1, (event) => {
- if (document !== event.target && element !== event.target && !element.contains(event.target)) {
- element.focus();
- }
+ _initializeFocusTrap() {
+ return new FocusTrap({
+ trapElement: this._element
});
- element.focus();
}
_addEventListeners() {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, (event) => {
- if (this._config.keyboard && event.key === ESCAPE_KEY) {
+ 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);
@@ -3960,49 +3768,41 @@
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function(event) {
- const target = getElementFromSelector(this);
+ const target = SelectorEngine.getElementFromSelector(this);
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
- EventHandler.one(target, EVENT_HIDDEN$2, () => {
+ EventHandler.one(target, EVENT_HIDDEN$3, () => {
if (isVisible(this)) {
this.focus();
}
});
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
- if (allReadyOpen && allReadyOpen !== target) {
- Offcanvas.getInstance(allReadyOpen).hide();
+ 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$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach((el) => Offcanvas.getOrCreateInstance(el).show()));
- defineJQueryPlugin(Offcanvas);
- var uriAttrs = /* @__PURE__ */ new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]);
- var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
- var 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;
- var allowedAttribute = (attr, allowedAttributeList) => {
- const attrName = attr.nodeName.toLowerCase();
- if (allowedAttributeList.includes(attrName)) {
- if (uriAttrs.has(attrName)) {
- return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
- }
- return true;
+ EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
+ for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
+ Offcanvas.getOrCreateInstance(selector).show();
}
- const regExp = allowedAttributeList.filter((attrRegex) => attrRegex instanceof RegExp);
- for (let i = 0, len = regExp.length; i < len; i++) {
- if (regExp[i].test(attrName)) {
- return true;
+ });
+ 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();
}
}
- return false;
- };
+ });
+ enableDismissTrigger(Offcanvas);
+ defineJQueryPlugin(Offcanvas);
+ var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
var DefaultAllowlist = {
- // Global attributes allowed on any supplied element below.
"*": ["class", "dir", "id", "lang", "role", ARIA_ATTRIBUTE_PATTERN],
a: ["target", "href", "title", "rel"],
area: [],
@@ -4010,7 +3810,10 @@
br: [],
col: [],
code: [],
+ dd: [],
div: [],
+ dl: [],
+ dt: [],
em: [],
hr: [],
h1: [],
@@ -4034,59 +3837,177 @@
u: [],
ul: []
};
- function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
+ var uriAttributes = new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]);
+ var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
+ var 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;
+ }
+ return allowedAttributeList.filter((attributeRegex) => attributeRegex instanceof RegExp).some((regex) => regex.test(attributeName));
+ };
+ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
if (!unsafeHtml.length) {
return unsafeHtml;
}
- if (sanitizeFn && typeof sanitizeFn === "function") {
- return sanitizeFn(unsafeHtml);
+ if (sanitizeFunction && typeof sanitizeFunction === "function") {
+ return sanitizeFunction(unsafeHtml);
}
const domParser = new window.DOMParser();
const createdDocument = domParser.parseFromString(unsafeHtml, "text/html");
- const allowlistKeys = Object.keys(allowList);
const elements = [].concat(...createdDocument.body.querySelectorAll("*"));
- for (let i = 0, len = elements.length; i < len; i++) {
- const el = elements[i];
- const elName = el.nodeName.toLowerCase();
- if (!allowlistKeys.includes(elName)) {
- el.remove();
+ for (const element of elements) {
+ const elementName = element.nodeName.toLowerCase();
+ if (!Object.keys(allowList).includes(elementName)) {
+ element.remove();
continue;
}
- const attributeList = [].concat(...el.attributes);
- const allowedAttributes = [].concat(allowList["*"] || [], allowList[elName] || []);
- attributeList.forEach((attr) => {
- if (!allowedAttribute(attr, allowedAttributes)) {
- el.removeAttribute(attr.nodeName);
+ 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;
}
- var NAME$4 = "tooltip";
- var DATA_KEY$4 = "bs.tooltip";
- var EVENT_KEY$4 = `.${DATA_KEY$4}`;
- var CLASS_PREFIX$1 = "bs-tooltip";
- var BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, "g");
- var DISALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set(["sanitize", "allowList", "sanitizeFn"]);
- var DefaultType$3 = {
- animation: "boolean",
- template: "string",
- title: "(string|element|function)",
- trigger: "string",
- delay: "(number|object)",
+ var NAME$5 = "TemplateFactory";
+ var Default$4 = {
+ allowList: DefaultAllowlist,
+ content: {},
+ extraClass: "",
+ html: false,
+ sanitize: true,
+ sanitizeFn: null,
+ template: "
"
+ };
+ var DefaultType$4 = {
+ allowList: "object",
+ content: "object",
+ extraClass: "(string|function)",
html: "boolean",
- selector: "(string|boolean)",
- placement: "(string|function)",
- offset: "(array|string|function)",
- container: "(string|element|boolean)",
- fallbackPlacements: "array",
- boundary: "(string|element)",
- customClass: "(string|function)",
sanitize: "boolean",
sanitizeFn: "(null|function)",
- allowList: "object",
- popperConfig: "(null|object|function)"
+ template: "string"
+ };
+ var DefaultContentType = {
+ entry: "(string|element|function|null)",
+ selector: "(string|element)"
+ };
+ var TemplateFactory = class extends Config {
+ constructor(config) {
+ super();
+ this._config = this._getConfig(config);
+ }
+ static get Default() {
+ return Default$4;
+ }
+ static get DefaultType() {
+ return DefaultType$4;
+ }
+ static get NAME() {
+ return NAME$5;
+ }
+ 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 (isElement2(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, [this]);
+ }
+ _putElementInTemplate(element, templateElement) {
+ if (this._config.html) {
+ templateElement.innerHTML = "";
+ templateElement.append(element);
+ return;
+ }
+ templateElement.textContent = element.textContent;
+ }
};
+ var NAME$4 = "tooltip";
+ var DISALLOWED_ATTRIBUTES = new Set(["sanitize", "allowList", "sanitizeFn"]);
+ var CLASS_NAME_FADE$2 = "fade";
+ var CLASS_NAME_MODAL = "modal";
+ var CLASS_NAME_SHOW$2 = "show";
+ var SELECTOR_TOOLTIP_INNER = ".tooltip-inner";
+ var SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
+ var EVENT_MODAL_HIDE = "hide.bs.modal";
+ var TRIGGER_HOVER = "hover";
+ var TRIGGER_FOCUS = "focus";
+ var TRIGGER_CLICK = "click";
+ var TRIGGER_MANUAL = "manual";
+ var EVENT_HIDE$2 = "hide";
+ var EVENT_HIDDEN$2 = "hidden";
+ var EVENT_SHOW$2 = "show";
+ var EVENT_SHOWN$2 = "shown";
+ var EVENT_INSERTED = "inserted";
+ var EVENT_CLICK$1 = "click";
+ var EVENT_FOCUSIN$1 = "focusin";
+ var EVENT_FOCUSOUT$1 = "focusout";
+ var EVENT_MOUSEENTER = "mouseenter";
+ var EVENT_MOUSELEAVE = "mouseleave";
var AttachmentMap = {
AUTO: "auto",
TOP: "top",
@@ -4095,75 +4016,71 @@
LEFT: isRTL() ? "right" : "left"
};
var Default$3 = {
+ allowList: DefaultAllowlist,
animation: true,
- template: '',
- trigger: "hover focus",
- title: "",
+ boundary: "clippingParents",
+ container: false,
+ customClass: "",
delay: 0,
+ fallbackPlacements: ["top", "right", "bottom", "left"],
html: false,
- selector: false,
+ offset: [0, 6],
placement: "top",
- offset: [0, 0],
- container: false,
- fallbackPlacements: ["top", "right", "bottom", "left"],
- boundary: "clippingParents",
- customClass: "",
+ popperConfig: null,
sanitize: true,
sanitizeFn: null,
- allowList: DefaultAllowlist,
- popperConfig: null
+ selector: false,
+ template: '',
+ title: "",
+ trigger: "hover focus"
};
- var Event$2 = {
- HIDE: `hide${EVENT_KEY$4}`,
- HIDDEN: `hidden${EVENT_KEY$4}`,
- SHOW: `show${EVENT_KEY$4}`,
- SHOWN: `shown${EVENT_KEY$4}`,
- INSERTED: `inserted${EVENT_KEY$4}`,
- CLICK: `click${EVENT_KEY$4}`,
- FOCUSIN: `focusin${EVENT_KEY$4}`,
- FOCUSOUT: `focusout${EVENT_KEY$4}`,
- MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
- MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
+ var 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"
};
- var CLASS_NAME_FADE$3 = "fade";
- var CLASS_NAME_MODAL = "modal";
- var CLASS_NAME_SHOW$3 = "show";
- var HOVER_STATE_SHOW = "show";
- var HOVER_STATE_OUT = "out";
- var SELECTOR_TOOLTIP_INNER = ".tooltip-inner";
- var TRIGGER_HOVER = "hover";
- var TRIGGER_FOCUS = "focus";
- var TRIGGER_CLICK = "click";
- var TRIGGER_MANUAL = "manual";
var Tooltip = class extends BaseComponent {
constructor(element, config) {
if (typeof lib_exports === "undefined") {
throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");
}
- super(element);
+ super(element, config);
this._isEnabled = true;
this._timeout = 0;
- this._hoverState = "";
+ this._isHovered = null;
this._activeTrigger = {};
this._popper = null;
- this._config = this._getConfig(config);
+ this._templateFactory = null;
+ this._newContent = null;
this.tip = null;
this._setListeners();
+ if (!this._config.selector) {
+ this._fixTitle();
+ }
}
- // Getters
static get Default() {
return Default$3;
}
- static get NAME() {
- return NAME$4;
- }
- static get Event() {
- return Event$2;
- }
static get DefaultType() {
return DefaultType$3;
}
- // Public
+ static get NAME() {
+ return NAME$4;
+ }
enable() {
this._isEnabled = true;
}
@@ -4173,216 +4090,180 @@
toggleEnabled() {
this._isEnabled = !this._isEnabled;
}
- toggle(event) {
+ toggle() {
if (!this._isEnabled) {
return;
}
- if (event) {
- const context = this._initializeOnDelegatedTarget(event);
- context._activeTrigger.click = !context._activeTrigger.click;
- if (context._isWithActiveTrigger()) {
- context._enter(null, context);
- } else {
- context._leave(null, context);
- }
- } else {
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
- this._leave(null, this);
- return;
- }
- this._enter(null, this);
+ this._activeTrigger.click = !this._activeTrigger.click;
+ if (this._isShown()) {
+ this._leave();
+ return;
}
+ this._enter();
}
dispose() {
clearTimeout(this._timeout);
- EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), "hide.bs.modal", this._hideModalHandler);
- if (this.tip) {
- this.tip.remove();
- }
- if (this._popper) {
- this._popper.destroy();
+ 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)) {
+ if (!(this._isWithContent() && this._isEnabled)) {
return;
}
- const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
+ const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
const shadowRoot = findShadowRoot(this._element);
- const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
+ const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
if (showEvent.defaultPrevented || !isInTheDom) {
return;
}
- const tip = this.getTipElement();
- const tipId = getUID(this.constructor.NAME);
- tip.setAttribute("id", tipId);
- this._element.setAttribute("aria-describedby", tipId);
- this.setContent();
- if (this._config.animation) {
- tip.classList.add(CLASS_NAME_FADE$3);
- }
- const placement = typeof this._config.placement === "function" ? this._config.placement.call(this, tip, this._element) : this._config.placement;
- const attachment = this._getAttachment(placement);
- this._addAttachmentClass(attachment);
+ this._disposePopper();
+ const tip = this._getTipElement();
+ this._element.setAttribute("aria-describedby", tip.getAttribute("id"));
const {
container
} = this._config;
- Data.set(tip, this.constructor.DATA_KEY, this);
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
- container.appendChild(tip);
- EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
- }
- if (this._popper) {
- this._popper.update();
- } else {
- this._popper = createPopper3(this._element, tip, this._getPopperConfig(attachment));
- }
- tip.classList.add(CLASS_NAME_SHOW$3);
- const customClass = typeof this._config.customClass === "function" ? this._config.customClass() : this._config.customClass;
- if (customClass) {
- tip.classList.add(...customClass.split(" "));
+ 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 ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((element) => {
+ for (const element of [].concat(...document.body.children)) {
EventHandler.on(element, "mouseover", noop);
- });
+ }
}
const complete = () => {
- const prevHoverState = this._hoverState;
- this._hoverState = null;
- EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
- if (prevHoverState === HOVER_STATE_OUT) {
- this._leave(null, this);
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
+ if (this._isHovered === false) {
+ this._leave();
}
+ this._isHovered = false;
};
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
- this._queueCallback(complete, this.tip, isAnimated);
+ this._queueCallback(complete, this.tip, this._isAnimated());
}
hide() {
- if (!this._popper) {
+ if (!this._isShown()) {
return;
}
- const tip = this.getTipElement();
- const complete = () => {
- if (this._isWithActiveTrigger()) {
- return;
- }
- if (this._hoverState !== HOVER_STATE_SHOW) {
- tip.remove();
- }
- this._cleanTipClass();
- this._element.removeAttribute("aria-describedby");
- EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
- if (this._popper) {
- this._popper.destroy();
- this._popper = null;
- }
- };
- const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
+ const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
if (hideEvent.defaultPrevented) {
return;
}
- tip.classList.remove(CLASS_NAME_SHOW$3);
+ const tip = this._getTipElement();
+ tip.classList.remove(CLASS_NAME_SHOW$2);
if ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((element) => EventHandler.off(element, "mouseover", noop));
+ 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;
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
- this._queueCallback(complete, this.tip, isAnimated);
- this._hoverState = "";
+ this._isHovered = null;
+ 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 !== null) {
+ if (this._popper) {
this._popper.update();
}
}
- // Protected
- isWithContent() {
- return Boolean(this.getTitle());
+ _isWithContent() {
+ return Boolean(this._getTitle());
}
- getTipElement() {
- if (this.tip) {
- return this.tip;
+ _getTipElement() {
+ if (!this.tip) {
+ this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
}
- const element = document.createElement("div");
- element.innerHTML = this._config.template;
- this.tip = element.children[0];
return this.tip;
}
- setContent() {
- const tip = this.getTipElement();
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
- tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
- }
- setElementContent(element, content) {
- if (element === null) {
- return;
- }
- if (isElement2(content)) {
- content = getElement(content);
- if (this._config.html) {
- if (content.parentNode !== element) {
- element.innerHTML = "";
- element.appendChild(content);
- }
- } else {
- element.textContent = content.textContent;
- }
- return;
+ _createTipElement(content) {
+ const tip = this._getTemplateFactory(content).toHtml();
+ if (!tip) {
+ return null;
}
- if (this._config.html) {
- if (this._config.sanitize) {
- content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
- }
- element.innerHTML = content;
- } else {
- element.textContent = content;
+ tip.classList.remove(CLASS_NAME_FADE$2, 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._isAnimated()) {
+ tip.classList.add(CLASS_NAME_FADE$2);
}
+ return tip;
}
- getTitle() {
- let title = this._element.getAttribute("data-bs-original-title");
- if (!title) {
- title = typeof this._config.title === "function" ? this._config.title.call(this._element) : this._config.title;
+ setContent(content) {
+ this._newContent = content;
+ if (this._isShown()) {
+ this._disposePopper();
+ this.show();
}
- return title;
}
- updateAttachment(attachment) {
- if (attachment === "right") {
- return "end";
- }
- if (attachment === "left") {
- return "start";
+ _getTemplateFactory(content) {
+ if (this._templateFactory) {
+ this._templateFactory.changeContent(content);
+ } else {
+ this._templateFactory = new TemplateFactory({
+ ...this._config,
+ content,
+ extraClass: this._resolvePossibleFunction(this._config.customClass)
+ });
}
- return attachment;
+ return this._templateFactory;
}
- // Private
- _initializeOnDelegatedTarget(event, context) {
- const dataKey = this.constructor.DATA_KEY;
- context = context || Data.get(event.delegateTarget, dataKey);
- if (!context) {
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
- Data.set(event.delegateTarget, dataKey, context);
- }
- return context;
+ _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());
+ }
+ _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 createPopper3(this._element, tip, this._getPopperConfig(attachment));
}
_getOffset() {
const {
offset: offset2
} = this._config;
if (typeof offset2 === "string") {
- return offset2.split(",").map((val) => Number.parseInt(val, 10));
+ return offset2.split(",").map((value) => Number.parseInt(value, 10));
}
if (typeof offset2 === "function") {
return (popperData) => offset2(popperData, this._element);
}
return offset2;
}
+ _resolvePossibleFunction(arg) {
+ return execute(arg, [this._element]);
+ }
_getPopperConfig(attachment) {
const defaultBsPopperConfig = {
placement: attachment,
@@ -4407,128 +4288,107 @@
element: `.${this.constructor.NAME}-arrow`
}
}, {
- name: "onChange",
+ name: "preSetPlacement",
enabled: true,
- phase: "afterWrite",
- fn: (data) => this._handlePopperPlacementChange(data)
- }],
- onFirstUpdate: (data) => {
- if (data.options.placement !== data.placement) {
- this._handlePopperPlacementChange(data);
+ phase: "beforeMain",
+ fn: (data) => {
+ this._getTipElement().setAttribute("data-popper-placement", data.state.placement);
}
- }
+ }]
};
return {
...defaultBsPopperConfig,
- ...typeof this._config.popperConfig === "function" ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
};
}
- _addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`);
- }
- _getAttachment(placement) {
- return AttachmentMap[placement.toUpperCase()];
- }
_setListeners() {
const triggers = this._config.trigger.split(" ");
- triggers.forEach((trigger) => {
+ for (const trigger of triggers) {
if (trigger === "click") {
- EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, (event) => this.toggle(event));
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, (event) => {
+ const context = this._initializeOnDelegatedTarget(event);
+ context.toggle();
+ });
} else if (trigger !== TRIGGER_MANUAL) {
- const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
- const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
- EventHandler.on(this._element, eventIn, this._config.selector, (event) => this._enter(event));
- EventHandler.on(this._element, eventOut, this._config.selector, (event) => this._leave(event));
+ 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(`.${CLASS_NAME_MODAL}`), "hide.bs.modal", this._hideModalHandler);
- if (this._config.selector) {
- this._config = {
- ...this._config,
- trigger: "manual",
- selector: ""
- };
- } else {
- this._fixTitle();
- }
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
}
_fixTitle() {
const title = this._element.getAttribute("title");
- const originalTitleType = typeof this._element.getAttribute("data-bs-original-title");
- if (title || originalTitleType !== "string") {
- this._element.setAttribute("data-bs-original-title", title || "");
- if (title && !this._element.getAttribute("aria-label") && !this._element.textContent) {
- this._element.setAttribute("aria-label", title);
- }
- this._element.setAttribute("title", "");
- }
- }
- _enter(event, context) {
- context = this._initializeOnDelegatedTarget(event, context);
- if (event) {
- context._activeTrigger[event.type === "focusin" ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
- }
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
- context._hoverState = HOVER_STATE_SHOW;
+ if (!title) {
return;
}
- clearTimeout(context._timeout);
- context._hoverState = HOVER_STATE_SHOW;
- if (!context._config.delay || !context._config.delay.show) {
- context.show();
- return;
+ if (!this._element.getAttribute("aria-label") && !this._element.textContent.trim()) {
+ this._element.setAttribute("aria-label", title);
}
- context._timeout = setTimeout(() => {
- if (context._hoverState === HOVER_STATE_SHOW) {
- context.show();
- }
- }, context._config.delay.show);
+ this._element.setAttribute("data-bs-original-title", title);
+ this._element.removeAttribute("title");
}
- _leave(event, context) {
- context = this._initializeOnDelegatedTarget(event, context);
- if (event) {
- context._activeTrigger[event.type === "focusout" ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
- }
- if (context._isWithActiveTrigger()) {
+ _enter() {
+ if (this._isShown() || this._isHovered) {
+ this._isHovered = true;
return;
}
- clearTimeout(context._timeout);
- context._hoverState = HOVER_STATE_OUT;
- if (!context._config.delay || !context._config.delay.hide) {
- context.hide();
+ this._isHovered = true;
+ this._setTimeout(() => {
+ if (this._isHovered) {
+ this.show();
+ }
+ }, this._config.delay.show);
+ }
+ _leave() {
+ if (this._isWithActiveTrigger()) {
return;
}
- context._timeout = setTimeout(() => {
- if (context._hoverState === HOVER_STATE_OUT) {
- context.hide();
+ this._isHovered = false;
+ this._setTimeout(() => {
+ if (!this._isHovered) {
+ this.hide();
}
- }, context._config.delay.hide);
+ }, this._config.delay.hide);
+ }
+ _setTimeout(handler, timeout) {
+ clearTimeout(this._timeout);
+ this._timeout = setTimeout(handler, timeout);
}
_isWithActiveTrigger() {
- for (const trigger in this._activeTrigger) {
- if (this._activeTrigger[trigger]) {
- return true;
- }
- }
- return false;
+ return Object.values(this._activeTrigger).includes(true);
}
_getConfig(config) {
const dataAttributes = Manipulator.getDataAttributes(this._element);
- Object.keys(dataAttributes).forEach((dataAttr) => {
- if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
- delete dataAttributes[dataAttr];
+ for (const dataAttribute of Object.keys(dataAttributes)) {
+ if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
+ delete dataAttributes[dataAttribute];
}
- });
+ }
config = {
- ...this.constructor.Default,
...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 = {
@@ -4542,153 +4402,90 @@
if (typeof config.content === "number") {
config.content = config.content.toString();
}
- typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
- if (config.sanitize) {
- config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
- }
return config;
}
_getDelegateConfig() {
const config = {};
- if (this._config) {
- for (const key in this._config) {
- if (this.constructor.Default[key] !== this._config[key]) {
- config[key] = this._config[key];
- }
+ 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;
}
- _cleanTipClass() {
- const tip = this.getTipElement();
- const tabClass = tip.getAttribute("class").match(BSCLS_PREFIX_REGEX$1);
- if (tabClass !== null && tabClass.length > 0) {
- tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
+ _disposePopper() {
+ if (this._popper) {
+ this._popper.destroy();
+ this._popper = null;
}
- }
- _handlePopperPlacementChange(popperData) {
- const {
- state
- } = popperData;
- if (!state) {
- return;
+ if (this.tip) {
+ this.tip.remove();
+ this.tip = null;
}
- this.tip = state.elements.popper;
- this._cleanTipClass();
- this._addAttachmentClass(this._getAttachment(state.placement));
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Tooltip.getOrCreateInstance(this, config);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
+ }
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
}
+ data[config]();
});
}
};
defineJQueryPlugin(Tooltip);
var NAME$3 = "popover";
- var DATA_KEY$3 = "bs.popover";
- var EVENT_KEY$3 = `.${DATA_KEY$3}`;
- var CLASS_PREFIX = "bs-popover";
- var BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, "g");
+ var SELECTOR_TITLE = ".popover-header";
+ var SELECTOR_CONTENT = ".popover-body";
var Default$2 = {
...Tooltip.Default,
- placement: "right",
- offset: [0, 8],
- trigger: "click",
content: "",
- template: ''
+ offset: [0, 8],
+ placement: "right",
+ template: '',
+ trigger: "click"
};
var DefaultType$2 = {
...Tooltip.DefaultType,
- content: "(string|element|function)"
+ content: "(null|string|element|function)"
};
- var Event$1 = {
- HIDE: `hide${EVENT_KEY$3}`,
- HIDDEN: `hidden${EVENT_KEY$3}`,
- SHOW: `show${EVENT_KEY$3}`,
- SHOWN: `shown${EVENT_KEY$3}`,
- INSERTED: `inserted${EVENT_KEY$3}`,
- CLICK: `click${EVENT_KEY$3}`,
- FOCUSIN: `focusin${EVENT_KEY$3}`,
- FOCUSOUT: `focusout${EVENT_KEY$3}`,
- MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
- MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
- };
- var CLASS_NAME_FADE$2 = "fade";
- var CLASS_NAME_SHOW$2 = "show";
- var SELECTOR_TITLE = ".popover-header";
- var SELECTOR_CONTENT = ".popover-body";
var Popover = class extends Tooltip {
- // Getters
static get Default() {
return Default$2;
}
- static get NAME() {
- return NAME$3;
- }
- static get Event() {
- return Event$1;
- }
static get DefaultType() {
return DefaultType$2;
}
- // Overrides
- isWithContent() {
- return this.getTitle() || this._getContent();
- }
- getTipElement() {
- if (this.tip) {
- return this.tip;
- }
- this.tip = super.getTipElement();
- if (!this.getTitle()) {
- SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
- }
- if (!this._getContent()) {
- SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
- }
- return this.tip;
+ static get NAME() {
+ return NAME$3;
}
- setContent() {
- const tip = this.getTipElement();
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
- let content = this._getContent();
- if (typeof content === "function") {
- content = content.call(this._element);
- }
- this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
+ _isWithContent() {
+ return this._getTitle() || this._getContent();
}
- // Private
- _addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
+ _getContentForTemplate() {
+ return {
+ [SELECTOR_TITLE]: this._getTitle(),
+ [SELECTOR_CONTENT]: this._getContent()
+ };
}
_getContent() {
- return this._element.getAttribute("data-bs-content") || this._config.content;
- }
- _cleanTipClass() {
- const tip = this.getTipElement();
- const tabClass = tip.getAttribute("class").match(BSCLS_PREFIX_REGEX);
- if (tabClass !== null && tabClass.length > 0) {
- tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
- }
+ return this._resolvePossibleFunction(this._config.content);
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Popover.getOrCreateInstance(this, config);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
}
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
});
}
};
@@ -4696,296 +4493,401 @@
var NAME$2 = "scrollspy";
var DATA_KEY$2 = "bs.scrollspy";
var EVENT_KEY$2 = `.${DATA_KEY$2}`;
- var DATA_API_KEY$1 = ".data-api";
- var Default$1 = {
- offset: 10,
- method: "auto",
- target: ""
- };
- var DefaultType$1 = {
- offset: "number",
- method: "string",
- target: "(string|element)"
- };
+ var DATA_API_KEY = ".data-api";
var EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
- var EVENT_SCROLL = `scroll${EVENT_KEY$2}`;
- var EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`;
+ var EVENT_CLICK = `click${EVENT_KEY$2}`;
+ var EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
var CLASS_NAME_DROPDOWN_ITEM = "dropdown-item";
var CLASS_NAME_ACTIVE$1 = "active";
var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
- var SELECTOR_NAV_LIST_GROUP$1 = ".nav, .list-group";
+ var SELECTOR_TARGET_LINKS = "[href]";
+ var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group";
var SELECTOR_NAV_LINKS = ".nav-link";
var SELECTOR_NAV_ITEMS = ".nav-item";
var SELECTOR_LIST_ITEMS = ".list-group-item";
- var SELECTOR_DROPDOWN$1 = ".dropdown";
+ var SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
+ var SELECTOR_DROPDOWN = ".dropdown";
var SELECTOR_DROPDOWN_TOGGLE$1 = ".dropdown-toggle";
- var METHOD_OFFSET = "offset";
- var METHOD_POSITION = "position";
+ var Default$1 = {
+ offset: null,
+ rootMargin: "0px 0px -25%",
+ smoothScroll: false,
+ target: null,
+ threshold: [0.1, 0.5, 1]
+ };
+ var DefaultType$1 = {
+ offset: "(number|null)",
+ rootMargin: "string",
+ smoothScroll: "boolean",
+ target: "element",
+ threshold: "array"
+ };
var ScrollSpy = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._scrollElement = this._element.tagName === "BODY" ? window : this._element;
- this._config = this._getConfig(config);
- this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
- this._offsets = [];
- this._targets = [];
+ super(element, config);
+ this._targetLinks = new Map();
+ this._observableSections = new Map();
+ this._rootElement = getComputedStyle(this._element).overflowY === "visible" ? null : this._element;
this._activeTarget = null;
- this._scrollHeight = 0;
- EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
+ this._observer = null;
+ this._previousScrollData = {
+ visibleEntryTop: 0,
+ parentScrollTop: 0
+ };
this.refresh();
- this._process();
}
- // Getters
static get Default() {
return Default$1;
}
+ static get DefaultType() {
+ return DefaultType$1;
+ }
static get NAME() {
return NAME$2;
}
- // Public
refresh() {
- const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
- const offsetMethod = this._config.method === "auto" ? autoMethod : this._config.method;
- const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
- this._offsets = [];
- this._targets = [];
- this._scrollHeight = this._getScrollHeight();
- const targets = SelectorEngine.find(this._selector);
- targets.map((element) => {
- const targetSelector = getSelectorFromElement(element);
- const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
- if (target) {
- const targetBCR = target.getBoundingClientRect();
- if (targetBCR.width || targetBCR.height) {
- return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
- }
- }
- return null;
- }).filter((item) => item).sort((a, b) => a[0] - b[0]).forEach((item) => {
- this._offsets.push(item[0]);
- this._targets.push(item[1]);
- });
+ 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() {
- EventHandler.off(this._scrollElement, EVENT_KEY$2);
+ this._observer.disconnect();
super.dispose();
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$1,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" && config ? config : {}
- };
- if (typeof config.target !== "string" && isElement2(config.target)) {
- let {
- id
- } = config.target;
- if (!id) {
- id = getUID(NAME$2);
- config.target.id = id;
- }
- config.target = `#${id}`;
+ _configAfterMerge(config) {
+ config.target = getElement(config.target) || document.body;
+ 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));
}
- typeCheckConfig(NAME$2, config, DefaultType$1);
return config;
}
- _getScrollTop() {
- return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
- }
- _getScrollHeight() {
- return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
+ _maybeEnableSmoothScroll() {
+ if (!this._config.smoothScroll) {
+ return;
+ }
+ 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;
+ }
+ root.scrollTop = height;
+ }
+ });
}
- _getOffsetHeight() {
- return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
+ _getNewObserver() {
+ const options = {
+ root: this._rootElement,
+ threshold: this._config.threshold,
+ rootMargin: this._config.rootMargin
+ };
+ return new IntersectionObserver((entries) => this._observerCallback(entries), options);
}
- _process() {
- const scrollTop = this._getScrollTop() + this._config.offset;
- const scrollHeight = this._getScrollHeight();
- const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
- if (this._scrollHeight !== scrollHeight) {
- this.refresh();
+ _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 (userScrollsDown && entryIsLowerThanPrevious) {
+ activate(entry);
+ if (!parentScrollTop) {
+ return;
+ }
+ continue;
+ }
+ if (!userScrollsDown && !entryIsLowerThanPrevious) {
+ activate(entry);
+ }
}
- if (scrollTop >= maxScroll) {
- const target = this._targets[this._targets.length - 1];
- if (this._activeTarget !== target) {
- this._activate(target);
+ }
+ _initializeTargetsAndObservables() {
+ this._targetLinks = new Map();
+ this._observableSections = new Map();
+ const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
+ for (const anchor of targetLinks) {
+ if (!anchor.hash || isDisabled(anchor)) {
+ continue;
+ }
+ const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
+ if (isVisible(observableSection)) {
+ this._targetLinks.set(decodeURI(anchor.hash), anchor);
+ this._observableSections.set(anchor.hash, observableSection);
}
+ }
+ }
+ _process(target) {
+ if (this._activeTarget === target) {
return;
}
- if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
- this._activeTarget = null;
- this._clear();
+ 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_DROPDOWN_ITEM)) {
+ SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
return;
}
- for (let i = this._offsets.length; i--; ) {
- const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === "undefined" || scrollTop < this._offsets[i + 1]);
- if (isActiveTarget) {
- this._activate(this._targets[i]);
+ 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);
}
}
}
- _activate(target) {
- this._activeTarget = target;
- this._clear();
- const queries = this._selector.split(",").map((selector) => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
- const link = SelectorEngine.findOne(queries.join(","));
- if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
- SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
- link.classList.add(CLASS_NAME_ACTIVE$1);
- } else {
- link.classList.add(CLASS_NAME_ACTIVE$1);
- SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach((listGroup) => {
- SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach((item) => item.classList.add(CLASS_NAME_ACTIVE$1));
- SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach((navItem) => {
- SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach((item) => 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);
}
- EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
- relatedTarget: target
- });
}
- _clear() {
- SelectorEngine.find(this._selector).filter((node) => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach((node) => node.classList.remove(CLASS_NAME_ACTIVE$1));
- }
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = ScrollSpy.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
- if (typeof data[config] === "undefined") {
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
};
- EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
- SelectorEngine.find(SELECTOR_DATA_SPY).forEach((spy) => new ScrollSpy(spy));
+ EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
+ for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
+ ScrollSpy.getOrCreateInstance(spy);
+ }
});
defineJQueryPlugin(ScrollSpy);
var NAME$1 = "tab";
var DATA_KEY$1 = "bs.tab";
var EVENT_KEY$1 = `.${DATA_KEY$1}`;
- var DATA_API_KEY = ".data-api";
var EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
var EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
var EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
var EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
- var EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`;
- var CLASS_NAME_DROPDOWN_MENU = "dropdown-menu";
+ var EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
+ var EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
+ var EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
+ var ARROW_LEFT_KEY = "ArrowLeft";
+ var ARROW_RIGHT_KEY = "ArrowRight";
+ var ARROW_UP_KEY = "ArrowUp";
+ var ARROW_DOWN_KEY = "ArrowDown";
+ var HOME_KEY = "Home";
+ var END_KEY = "End";
var CLASS_NAME_ACTIVE = "active";
var CLASS_NAME_FADE$1 = "fade";
var CLASS_NAME_SHOW$1 = "show";
- var SELECTOR_DROPDOWN = ".dropdown";
- var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group";
- var SELECTOR_ACTIVE = ".active";
- var SELECTOR_ACTIVE_UL = ":scope > li > .active";
- var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
+ var CLASS_DROPDOWN = "dropdown";
var SELECTOR_DROPDOWN_TOGGLE = ".dropdown-toggle";
- var SELECTOR_DROPDOWN_ACTIVE_CHILD = ":scope > .dropdown-menu .active";
+ var SELECTOR_DROPDOWN_MENU = ".dropdown-menu";
+ var NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`;
+ var SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
+ var SELECTOR_OUTER = ".nav-item, .list-group-item";
+ var SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
+ var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
+ var SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
+ var SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
var Tab = class extends BaseComponent {
- // Getters
+ constructor(element) {
+ super(element);
+ this._parent = this._element.closest(SELECTOR_TAB_PANEL);
+ if (!this._parent) {
+ return;
+ }
+ this._setInitialAttributes(this._parent, this._getChildren());
+ EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event));
+ }
static get NAME() {
return NAME$1;
}
- // Public
show() {
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
+ const innerElem = this._element;
+ if (this._elemIsActive(innerElem)) {
return;
}
- let previous;
- const target = getElementFromSelector(this._element);
- const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
- if (listElement) {
- const itemSelector = listElement.nodeName === "UL" || listElement.nodeName === "OL" ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
- previous = SelectorEngine.find(itemSelector, listElement);
- previous = previous[previous.length - 1];
- }
- const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, {
- relatedTarget: this._element
+ const active = this._getActiveElem();
+ const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
+ relatedTarget: innerElem
}) : null;
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, {
- relatedTarget: previous
+ const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
+ relatedTarget: active
});
- if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
+ if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
+ return;
+ }
+ this._deactivate(active, innerElem);
+ this._activate(innerElem, active);
+ }
+ _activate(element, relatedElem) {
+ if (!element) {
return;
}
- this._activate(this._element, listElement);
+ element.classList.add(CLASS_NAME_ACTIVE);
+ this._activate(SelectorEngine.getElementFromSelector(element));
const complete = () => {
- EventHandler.trigger(previous, EVENT_HIDDEN$1, {
- relatedTarget: this._element
+ if (element.getAttribute("role") !== "tab") {
+ element.classList.add(CLASS_NAME_SHOW$1);
+ return;
+ }
+ element.removeAttribute("tabindex");
+ element.setAttribute("aria-selected", true);
+ this._toggleDropDown(element, true);
+ EventHandler.trigger(element, EVENT_SHOWN$1, {
+ relatedTarget: relatedElem
});
- EventHandler.trigger(this._element, EVENT_SHOWN$1, {
- relatedTarget: previous
+ };
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
+ }
+ _deactivate(element, relatedElem) {
+ if (!element) {
+ return;
+ }
+ element.classList.remove(CLASS_NAME_ACTIVE);
+ element.blur();
+ this._deactivate(SelectorEngine.getElementFromSelector(element));
+ const complete = () => {
+ if (element.getAttribute("role") !== "tab") {
+ element.classList.remove(CLASS_NAME_SHOW$1);
+ return;
+ }
+ element.setAttribute("aria-selected", false);
+ element.setAttribute("tabindex", "-1");
+ this._toggleDropDown(element, false);
+ EventHandler.trigger(element, EVENT_HIDDEN$1, {
+ relatedTarget: relatedElem
});
};
- if (target) {
- this._activate(target, target.parentNode, complete);
- } else {
- complete();
- }
- }
- // Private
- _activate(element, container, callback) {
- const activeElements = container && (container.nodeName === "UL" || container.nodeName === "OL") ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
- const active = activeElements[0];
- const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1);
- const complete = () => this._transitionComplete(element, active, callback);
- if (active && isTransitioning) {
- active.classList.remove(CLASS_NAME_SHOW$1);
- this._queueCallback(complete, element, true);
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
+ }
+ _keydown(event) {
+ if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
+ return;
+ }
+ event.stopPropagation();
+ event.preventDefault();
+ const children = this._getChildren().filter((element) => !isDisabled(element));
+ let nextActiveElement;
+ if ([HOME_KEY, END_KEY].includes(event.key)) {
+ nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
} else {
- complete();
+ 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();
}
}
- _transitionComplete(element, active, callback) {
- if (active) {
- active.classList.remove(CLASS_NAME_ACTIVE);
- const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
- if (dropdownChild) {
- dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
- }
- if (active.getAttribute("role") === "tab") {
- active.setAttribute("aria-selected", false);
- }
+ _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);
}
- element.classList.add(CLASS_NAME_ACTIVE);
- if (element.getAttribute("role") === "tab") {
- element.setAttribute("aria-selected", true);
+ }
+ _setInitialAttributesOnChild(child) {
+ child = this._getInnerElement(child);
+ const isActive = this._elemIsActive(child);
+ const outerElem = this._getOuterElement(child);
+ child.setAttribute("aria-selected", isActive);
+ if (outerElem !== child) {
+ this._setAttributeIfNotExists(outerElem, "role", "presentation");
}
- reflow(element);
- if (element.classList.contains(CLASS_NAME_FADE$1)) {
- element.classList.add(CLASS_NAME_SHOW$1);
+ if (!isActive) {
+ child.setAttribute("tabindex", "-1");
}
- let parent = element.parentNode;
- if (parent && parent.nodeName === "LI") {
- parent = parent.parentNode;
+ this._setAttributeIfNotExists(child, "role", "tab");
+ this._setInitialAttributesOnTargetPanel(child);
+ }
+ _setInitialAttributesOnTargetPanel(child) {
+ const target = SelectorEngine.getElementFromSelector(child);
+ if (!target) {
+ return;
}
- if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
- const dropdownElement = element.closest(SELECTOR_DROPDOWN);
- if (dropdownElement) {
- SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach((dropdown) => dropdown.classList.add(CLASS_NAME_ACTIVE));
- }
- element.setAttribute("aria-expanded", true);
+ this._setAttributeIfNotExists(target, "role", "tabpanel");
+ if (child.id) {
+ this._setAttributeIfNotExists(target, "aria-labelledby", `${child.id}`);
+ }
+ }
+ _toggleDropDown(element, open) {
+ const outerElem = this._getOuterElement(element);
+ if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
+ return;
}
- if (callback) {
- callback();
+ const toggle = (selector, className) => {
+ const element2 = SelectorEngine.findOne(selector, outerElem);
+ if (element2) {
+ element2.classList.toggle(className, open);
+ }
+ };
+ toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
+ toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
+ outerElem.setAttribute("aria-expanded", open);
+ }
+ _setAttributeIfNotExists(element, attribute, value) {
+ if (!element.hasAttribute(attribute)) {
+ element.setAttribute(attribute, value);
}
}
- // Static
+ _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;
+ }
static jQueryInterface(config) {
return this.each(function() {
const data = Tab.getOrCreateInstance(this);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
+ }
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
}
+ data[config]();
});
}
};
@@ -4996,14 +4898,17 @@
if (isDisabled(this)) {
return;
}
- const data = Tab.getOrCreateInstance(this);
- data.show();
+ Tab.getOrCreateInstance(this).show();
+ });
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
+ for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
+ Tab.getOrCreateInstance(element);
+ }
});
defineJQueryPlugin(Tab);
var NAME = "toast";
var DATA_KEY = "bs.toast";
var EVENT_KEY = `.${DATA_KEY}`;
- var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
var EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
var EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
var EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
@@ -5026,27 +4931,23 @@
autohide: true,
delay: 5e3
};
- var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
var Toast = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._timeout = null;
this._hasMouseInteraction = false;
this._hasKeyboardInteraction = false;
this._setListeners();
}
- // Getters
- static get DefaultType() {
- return DefaultType;
- }
static get Default() {
return Default;
}
+ static get DefaultType() {
+ return DefaultType;
+ }
static get NAME() {
return NAME;
}
- // Public
show() {
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
if (showEvent.defaultPrevented) {
@@ -5058,17 +4959,16 @@
}
const complete = () => {
this._element.classList.remove(CLASS_NAME_SHOWING);
- this._element.classList.add(CLASS_NAME_SHOW);
EventHandler.trigger(this._element, EVENT_SHOWN);
this._maybeScheduleHide();
};
this._element.classList.remove(CLASS_NAME_HIDE);
reflow(this._element);
- this._element.classList.add(CLASS_NAME_SHOWING);
+ this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
}
hide() {
- if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (!this.isShown()) {
return;
}
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
@@ -5077,27 +4977,21 @@
}
const complete = () => {
this._element.classList.add(CLASS_NAME_HIDE);
+ this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
EventHandler.trigger(this._element, EVENT_HIDDEN);
};
- this._element.classList.remove(CLASS_NAME_SHOW);
+ this._element.classList.add(CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
}
dispose() {
this._clearTimeout();
- if (this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (this.isShown()) {
this._element.classList.remove(CLASS_NAME_SHOW);
}
super.dispose();
}
- // Private
- _getConfig(config) {
- config = {
- ...Default,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" && config ? config : {}
- };
- typeCheckConfig(NAME, config, this.constructor.DefaultType);
- return config;
+ isShown() {
+ return this._element.classList.contains(CLASS_NAME_SHOW);
}
_maybeScheduleHide() {
if (!this._config.autohide) {
@@ -5113,13 +5007,15 @@
_onInteraction(event, isInteracting) {
switch (event.type) {
case "mouseover":
- case "mouseout":
+ case "mouseout": {
this._hasMouseInteraction = isInteracting;
break;
+ }
case "focusin":
- case "focusout":
+ case "focusout": {
this._hasKeyboardInteraction = isInteracting;
break;
+ }
}
if (isInteracting) {
this._clearTimeout();
@@ -5132,7 +5028,6 @@
this._maybeScheduleHide();
}
_setListeners() {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
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));
@@ -5142,7 +5037,6 @@
clearTimeout(this._timeout);
this._timeout = null;
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Toast.getOrCreateInstance(this, config);
@@ -5155,6 +5049,7 @@
});
}
};
+ enableDismissTrigger(Toast);
defineJQueryPlugin(Toast);
// js/bs.ts
@@ -5341,12 +5236,8 @@
document.addEventListener("DOMContentLoaded", initConfig);
}
})();
-/*! Bundled license information:
-
-bootstrap/dist/js/bootstrap.esm.js:
- (*!
- * Bootstrap v5.0.2 (https://getbootstrap.com/)
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- *)
-*/
+/*!
+ * Bootstrap v5.3.3 (https://getbootstrap.com/)
+ * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
+ */
diff --git a/netbox_napalm_plugin/static/netbox_napalm_plugin/js/lldp.js b/netbox_napalm_plugin/static/netbox_napalm_plugin/js/lldp.js
index a3c2e71..dd87ebd 100644
--- a/netbox_napalm_plugin/static/netbox_napalm_plugin/js/lldp.js
+++ b/netbox_napalm_plugin/static/netbox_napalm_plugin/js/lldp.js
@@ -1,6 +1,8 @@
(() => {
var __defProp = Object.defineProperty;
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
+ __markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
@@ -193,7 +195,7 @@
// node_modules/@popperjs/core/lib/utils/userAgent.js
function getUAString() {
var uaData = navigator.userAgentData;
- if (uaData != null && uaData.brands) {
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
return uaData.brands.map(function(item) {
return item.brand + "/" + item.version;
}).join(" ");
@@ -287,10 +289,7 @@
// node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
function getDocumentElement(element) {
- return ((isElement(element) ? element.ownerDocument : (
- // $FlowFixMe[prop-missing]
- element.document
- )) || window.document).documentElement;
+ return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
}
// node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
@@ -298,22 +297,12 @@
if (getNodeName(element) === "html") {
return element;
}
- return (
- // this is a quicker (but less type safe) way to save quite some bytes from the bundle
- // $FlowFixMe[incompatible-return]
- // $FlowFixMe[prop-missing]
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
- element.parentNode || // DOM Element detected
- (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
- getDocumentElement(element)
- );
+ return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
}
// node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
function getTrueOffsetParent(element) {
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
- getComputedStyle2(element).position === "fixed") {
+ if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
return null;
}
return element.offsetParent;
@@ -437,15 +426,7 @@
return;
}
}
- if (true) {
- if (!isHTMLElement(arrowElement)) {
- console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', "To use an SVG arrow, wrap it in an HTMLElement that will be used as", "the arrow."].join(" "));
- }
- }
if (!contains(state.elements.popper, arrowElement)) {
- if (true) {
- console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', "element."].join(" "));
- }
return;
}
state.elements.arrow = arrowElement;
@@ -472,9 +453,8 @@
bottom: "auto",
left: "auto"
};
- function roundOffsetsByDPR(_ref) {
+ function roundOffsetsByDPR(_ref, win) {
var x = _ref.x, y = _ref.y;
- var win = window;
var dpr = win.devicePixelRatio || 1;
return {
x: round(x * dpr) / dpr || 0,
@@ -513,19 +493,13 @@
offsetParent = offsetParent;
if (placement === top || (placement === left || placement === right) && variation === end) {
sideY = bottom;
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
- // $FlowFixMe[prop-missing]
- offsetParent[heightProp]
- );
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
y -= offsetY - popperRect.height;
y *= gpuAcceleration ? 1 : -1;
}
if (placement === left || (placement === top || placement === bottom) && variation === end) {
sideX = right;
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
- // $FlowFixMe[prop-missing]
- offsetParent[widthProp]
- );
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
x -= offsetX - popperRect.width;
x *= gpuAcceleration ? 1 : -1;
}
@@ -536,7 +510,7 @@
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
x,
y
- }) : {
+ }, getWindow(popper2)) : {
x,
y
};
@@ -551,14 +525,6 @@
function computeStyles(_ref5) {
var state = _ref5.state, options = _ref5.options;
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
- if (true) {
- var transitionProperty = getComputedStyle2(state.elements.popper).transitionProperty || "";
- if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
- return transitionProperty.indexOf(property) >= 0;
- })) {
- console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
- }
- }
var commonStyles = {
placement: getBasePlacement(state.placement),
variation: getVariation(state.placement),
@@ -748,10 +714,7 @@
var win = getWindow(scrollParent);
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
- return isBody ? updatedList : (
- // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
- updatedList.concat(listScrollParents(getParentNode(target)))
- );
+ return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
}
// node_modules/@popperjs/core/lib/utils/rectToClientRect.js
@@ -918,9 +881,6 @@
});
if (allowedPlacements.length === 0) {
allowedPlacements = placements2;
- if (true) {
- console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" "));
- }
}
var overflows = allowedPlacements.reduce(function(acc, placement2) {
acc[placement2] = detectOverflow(state, {
@@ -966,7 +926,7 @@
}, []);
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
- var checksMap = /* @__PURE__ */ new Map();
+ var checksMap = new Map();
var makeFallbackChecks = true;
var firstFittingPlacement = placements2[0];
for (var i = 0; i < placements2.length; i++) {
@@ -1292,8 +1252,7 @@
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
- if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
- isScrollParent(documentElement)) {
+ if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
@@ -1314,8 +1273,8 @@
// node_modules/@popperjs/core/lib/utils/orderModifiers.js
function order(modifiers) {
- var map = /* @__PURE__ */ new Map();
- var visited = /* @__PURE__ */ new Set();
+ var map = new Map();
+ var visited = new Set();
var result = [];
modifiers.forEach(function(modifier) {
map.set(modifier.name, modifier);
@@ -1365,92 +1324,6 @@
};
}
- // node_modules/@popperjs/core/lib/utils/format.js
- function format(str) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- return [].concat(args).reduce(function(p, c) {
- return p.replace(/%s/, c);
- }, str);
- }
-
- // node_modules/@popperjs/core/lib/utils/validateModifiers.js
- var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
- var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
- var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
- function validateModifiers(modifiers) {
- modifiers.forEach(function(modifier) {
- [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self) {
- return self.indexOf(value) === index;
- }).forEach(function(key) {
- switch (key) {
- case "name":
- if (typeof modifier.name !== "string") {
- console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
- }
- break;
- case "enabled":
- if (typeof modifier.enabled !== "boolean") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
- }
- break;
- case "phase":
- if (modifierPhases.indexOf(modifier.phase) < 0) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
- }
- break;
- case "fn":
- if (typeof modifier.fn !== "function") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
- }
- break;
- case "effect":
- if (modifier.effect != null && typeof modifier.effect !== "function") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
- }
- break;
- case "requires":
- if (modifier.requires != null && !Array.isArray(modifier.requires)) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
- }
- break;
- case "requiresIfExists":
- if (!Array.isArray(modifier.requiresIfExists)) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
- }
- break;
- case "options":
- case "data":
- break;
- default:
- console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
- return '"' + s + '"';
- }).join(", ") + '; but "' + key + '" was provided.');
- }
- modifier.requires && modifier.requires.forEach(function(requirement) {
- if (modifiers.find(function(mod) {
- return mod.name === requirement;
- }) == null) {
- console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
- }
- });
- });
- });
- }
-
- // node_modules/@popperjs/core/lib/utils/uniqueBy.js
- function uniqueBy(arr, fn2) {
- var identifiers = /* @__PURE__ */ new Set();
- return arr.filter(function(item) {
- var identifier = fn2(item);
- if (!identifiers.has(identifier)) {
- identifiers.add(identifier);
- return true;
- }
- });
- }
-
// node_modules/@popperjs/core/lib/utils/mergeByName.js
function mergeByName(modifiers) {
var merged = modifiers.reduce(function(merged2, current) {
@@ -1467,8 +1340,6 @@
}
// node_modules/@popperjs/core/lib/createPopper.js
- var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
- var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
var DEFAULT_OPTIONS = {
placement: "bottom",
modifiers: [],
@@ -1519,45 +1390,15 @@
state.orderedModifiers = orderedModifiers.filter(function(m) {
return m.enabled;
});
- if (true) {
- var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
- var name = _ref.name;
- return name;
- });
- validateModifiers(modifiers);
- if (getBasePlacement(state.options.placement) === auto) {
- var flipModifier = state.orderedModifiers.find(function(_ref2) {
- var name = _ref2.name;
- return name === "flip";
- });
- if (!flipModifier) {
- console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
- }
- }
- var _getComputedStyle = getComputedStyle2(popper2), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
- if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
- return parseFloat(margin);
- })) {
- console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
- }
- }
runModifierEffects();
return instance.update();
},
- // Sync update – it will always be executed, even if not necessary. This
- // is useful for low frequency updates where sync behavior simplifies the
- // logic.
- // For high frequency updates (e.g. `resize` and `scroll` events), always
- // prefer the async Popper#update method
forceUpdate: function forceUpdate() {
if (isDestroyed) {
return;
}
var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
if (!areValidElements(reference3, popper3)) {
- if (true) {
- console.error(INVALID_ELEMENT_ERROR);
- }
return;
}
state.rects = {
@@ -1569,15 +1410,7 @@
state.orderedModifiers.forEach(function(modifier) {
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
});
- var __debug_loops__ = 0;
for (var index = 0; index < state.orderedModifiers.length; index++) {
- if (true) {
- __debug_loops__ += 1;
- if (__debug_loops__ > 100) {
- console.error(INFINITE_LOOP_ERROR);
- break;
- }
- }
if (state.reset === true) {
state.reset = false;
index = -1;
@@ -1594,8 +1427,6 @@
}
}
},
- // Async and optimistically optimized update – it will not be executed if
- // not necessary (debounced to run at most once-per-tick)
update: debounce(function() {
return new Promise(function(resolve) {
instance.forceUpdate();
@@ -1608,9 +1439,6 @@
}
};
if (!areValidElements(reference2, popper2)) {
- if (true) {
- console.error(INVALID_ELEMENT_ERROR);
- }
return instance;
}
instance.setOptions(options).then(function(state2) {
@@ -1619,8 +1447,8 @@
}
});
function runModifierEffects() {
- state.orderedModifiers.forEach(function(_ref3) {
- var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect4 = _ref3.effect;
+ state.orderedModifiers.forEach(function(_ref) {
+ var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect4 = _ref.effect;
if (typeof effect4 === "function") {
var cleanupFn = effect4({
state,
@@ -1658,57 +1486,50 @@
});
// node_modules/bootstrap/dist/js/bootstrap.esm.js
- var NODE_TEXT = 3;
- var 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;
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
- if (ancestor.matches(selector)) {
- parents.push(ancestor);
- }
- ancestor = ancestor.parentNode;
+ var elementMap = new Map();
+ var Data = {
+ set(element, key, instance) {
+ if (!elementMap.has(element)) {
+ elementMap.set(element, new Map());
}
- return parents;
+ 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: ${Array.from(instanceMap.keys())[0]}.`);
+ return;
+ }
+ instanceMap.set(key, instance);
},
- prev(element, selector) {
- let previous = element.previousElementSibling;
- while (previous) {
- if (previous.matches(selector)) {
- return [previous];
- }
- previous = previous.previousElementSibling;
+ get(element, key) {
+ if (elementMap.has(element)) {
+ return elementMap.get(element).get(key) || null;
}
- return [];
+ return null;
},
- next(element, selector) {
- let next = element.nextElementSibling;
- while (next) {
- if (next.matches(selector)) {
- return [next];
- }
- next = next.nextElementSibling;
+ remove(element, key) {
+ if (!elementMap.has(element)) {
+ return;
+ }
+ const instanceMap = elementMap.get(element);
+ instanceMap.delete(key);
+ if (instanceMap.size === 0) {
+ elementMap.delete(element);
}
- return [];
}
};
var MAX_UID = 1e6;
var MILLISECONDS_MULTIPLIER = 1e3;
var TRANSITION_END = "transitionend";
- var toType = (obj) => {
- if (obj === null || obj === void 0) {
- return `${obj}`;
+ var parseSelector = (selector) => {
+ if (selector && window.CSS && window.CSS.escape) {
+ selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
}
- return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
+ return selector;
+ };
+ var toType = (object) => {
+ if (object === null || object === void 0) {
+ return `${object}`;
+ }
+ return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
};
var getUID = (prefix) => {
do {
@@ -1716,31 +1537,6 @@
} while (document.getElementById(prefix));
return prefix;
};
- var getSelector = (element) => {
- let selector = element.getAttribute("data-bs-target");
- if (!selector || selector === "#") {
- let hrefAttr = element.getAttribute("href");
- if (!hrefAttr || !hrefAttr.includes("#") && !hrefAttr.startsWith(".")) {
- return null;
- }
- if (hrefAttr.includes("#") && !hrefAttr.startsWith("#")) {
- hrefAttr = `#${hrefAttr.split("#")[1]}`;
- }
- selector = hrefAttr && hrefAttr !== "#" ? hrefAttr.trim() : null;
- }
- return selector;
- };
- var getSelectorFromElement = (element) => {
- const selector = getSelector(element);
- if (selector) {
- return document.querySelector(selector) ? selector : null;
- }
- return null;
- };
- var getElementFromSelector = (element) => {
- const selector = getSelector(element);
- return selector ? document.querySelector(selector) : null;
- };
var getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
@@ -1761,39 +1557,43 @@
var triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
- var isElement2 = (obj) => {
- if (!obj || typeof obj !== "object") {
+ var isElement2 = (object) => {
+ if (!object || typeof object !== "object") {
return false;
}
- if (typeof obj.jquery !== "undefined") {
- obj = obj[0];
+ if (typeof object.jquery !== "undefined") {
+ object = object[0];
}
- return typeof obj.nodeType !== "undefined";
+ return typeof object.nodeType !== "undefined";
};
- var getElement = (obj) => {
- if (isElement2(obj)) {
- return obj.jquery ? obj[0] : obj;
+ var getElement = (object) => {
+ if (isElement2(object)) {
+ return object.jquery ? object[0] : object;
}
- if (typeof obj === "string" && obj.length > 0) {
- return SelectorEngine.findOne(obj);
+ if (typeof object === "string" && object.length > 0) {
+ return document.querySelector(parseSelector(object));
}
return null;
};
- var typeCheckConfig = (componentName, config, configTypes) => {
- Object.keys(configTypes).forEach((property) => {
- const expectedTypes = configTypes[property];
- const value = config[property];
- const valueType = value && isElement2(value) ? "element" : toType(value);
- if (!new RegExp(expectedTypes).test(valueType)) {
- throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
- }
- });
- };
var isVisible = (element) => {
if (!isElement2(element) || element.getClientRects().length === 0) {
return false;
}
- return getComputedStyle(element).getPropertyValue("visibility") === "visible";
+ 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;
};
var isDisabled = (element) => {
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
@@ -1825,13 +1625,12 @@
};
var noop = () => {
};
- var reflow = (element) => element.offsetHeight;
+ var reflow = (element) => {
+ element.offsetHeight;
+ };
var getjQuery = () => {
- const {
- jQuery
- } = window;
- if (jQuery && !document.body.hasAttribute("data-bs-no-jquery")) {
- return jQuery;
+ if (window.jQuery && !document.body.hasAttribute("data-bs-no-jquery")) {
+ return window.jQuery;
}
return null;
};
@@ -1840,7 +1639,9 @@
if (document.readyState === "loading") {
if (!DOMContentLoadedCallbacks.length) {
document.addEventListener("DOMContentLoaded", () => {
- DOMContentLoadedCallbacks.forEach((callback2) => callback2());
+ for (const callback2 of DOMContentLoadedCallbacks) {
+ callback2();
+ }
});
}
DOMContentLoadedCallbacks.push(callback);
@@ -1864,10 +1665,8 @@
}
});
};
- var execute = (callback) => {
- if (typeof callback === "function") {
- callback();
- }
+ var execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
+ return typeof possibleCallback === "function" ? possibleCallback(...args) : defaultValue;
};
var executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
if (!waitForTransition) {
@@ -1895,11 +1694,11 @@
}, emulatedDuration);
};
var getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
+ const listLength = list.length;
let index = list.indexOf(activeElement);
if (index === -1) {
- return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
}
- const listLength = list.length;
index += shouldGetNext ? 1 : -1;
if (isCycleAllowed) {
index = (index + listLength) % listLength;
@@ -1915,20 +1714,21 @@
mouseenter: "mouseover",
mouseleave: "mouseout"
};
- var customEventsRegex = /^(mouseenter|mouseleave)/i;
- var nativeEvents = /* @__PURE__ */ 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"]);
- function getUidEvent(element, uid) {
+ var 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"]);
+ function makeEventUid(element, uid) {
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
}
- function getEvent(element) {
- const uid = getUidEvent(element);
+ function getElementEvents(element) {
+ const uid = makeEventUid(element);
element.uidEvent = uid;
eventRegistry[uid] = eventRegistry[uid] || {};
return eventRegistry[uid];
}
function bootstrapHandler(element, fn2) {
return function handler(event) {
- event.delegateTarget = element;
+ hydrateObj(event, {
+ delegateTarget: element
+ });
if (handler.oneOff) {
EventHandler.off(element, event.type, fn2);
}
@@ -1941,77 +1741,63 @@
for (let {
target
} = event; target && target !== this; target = target.parentNode) {
- for (let i = domElements.length; i--; ) {
- if (domElements[i] === target) {
- event.delegateTarget = target;
- if (handler.oneOff) {
- EventHandler.off(element, event.type, selector, fn2);
- }
- return fn2.apply(target, [event]);
+ for (const domElement of domElements) {
+ if (domElement !== target) {
+ continue;
}
+ hydrateObj(event, {
+ delegateTarget: target
+ });
+ if (handler.oneOff) {
+ EventHandler.off(element, event.type, selector, fn2);
+ }
+ return fn2.apply(target, [event]);
}
}
- return null;
};
}
- function findHandler(events, handler, delegationSelector = null) {
- const uidEventList = Object.keys(events);
- for (let i = 0, len = uidEventList.length; i < len; i++) {
- const event = events[uidEventList[i]];
- if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
- return event;
- }
- }
- return null;
+ function findHandler(events, callable, delegationSelector = null) {
+ return Object.values(events).find((event) => event.callable === callable && event.delegationSelector === delegationSelector);
}
- function normalizeParams(originalTypeEvent, handler, delegationFn) {
- const delegation = typeof handler === "string";
- const originalHandler = delegation ? delegationFn : handler;
+ function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
+ const isDelegated = typeof handler === "string";
+ const callable = isDelegated ? delegationFunction : handler || delegationFunction;
let typeEvent = getTypeEvent(originalTypeEvent);
- const isNative = nativeEvents.has(typeEvent);
- if (!isNative) {
+ if (!nativeEvents.has(typeEvent)) {
typeEvent = originalTypeEvent;
}
- return [delegation, originalHandler, typeEvent];
+ return [isDelegated, callable, typeEvent];
}
- function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
+ function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
- if (!handler) {
- handler = delegationFn;
- delegationFn = null;
- }
- if (customEventsRegex.test(originalTypeEvent)) {
- const wrapFn = (fn3) => {
+ let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
+ if (originalTypeEvent in customEvents) {
+ const wrapFunction = (fn3) => {
return function(event) {
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
return fn3.call(this, event);
}
};
};
- if (delegationFn) {
- delegationFn = wrapFn(delegationFn);
- } else {
- handler = wrapFn(handler);
- }
+ callable = wrapFunction(callable);
}
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
- const events = getEvent(element);
+ const events = getElementEvents(element);
const handlers = events[typeEvent] || (events[typeEvent] = {});
- const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
- if (previousFn) {
- previousFn.oneOff = previousFn.oneOff && oneOff;
+ const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
+ if (previousFunction) {
+ previousFunction.oneOff = previousFunction.oneOff && oneOff;
return;
}
- const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ""));
- const fn2 = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
- fn2.delegationSelector = delegation ? handler : null;
- fn2.originalHandler = originalHandler;
+ const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ""));
+ const fn2 = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
+ fn2.delegationSelector = isDelegated ? handler : null;
+ fn2.callable = callable;
fn2.oneOff = oneOff;
fn2.uidEvent = uid;
handlers[uid] = fn2;
- element.addEventListener(typeEvent, fn2, delegation);
+ element.addEventListener(typeEvent, fn2, isDelegated);
}
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
const fn2 = findHandler(events[typeEvent], handler, delegationSelector);
@@ -2023,52 +1809,50 @@
}
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
const storeElementEvent = events[typeEvent] || {};
- Object.keys(storeElementEvent).forEach((handlerKey) => {
+ for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
if (handlerKey.includes(namespace)) {
- const event = storeElementEvent[handlerKey];
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
- });
+ }
}
function getTypeEvent(event) {
event = event.replace(stripNameRegex, "");
return customEvents[event] || event;
}
var EventHandler = {
- on(element, event, handler, delegationFn) {
- addHandler(element, event, handler, delegationFn, false);
+ on(element, event, handler, delegationFunction) {
+ addHandler(element, event, handler, delegationFunction, false);
},
- one(element, event, handler, delegationFn) {
- addHandler(element, event, handler, delegationFn, true);
+ one(element, event, handler, delegationFunction) {
+ addHandler(element, event, handler, delegationFunction, true);
},
- off(element, originalTypeEvent, handler, delegationFn) {
+ off(element, originalTypeEvent, handler, delegationFunction) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
+ const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
const inNamespace = typeEvent !== originalTypeEvent;
- const events = getEvent(element);
+ const events = getElementEvents(element);
+ const storeElementEvent = events[typeEvent] || {};
const isNamespace = originalTypeEvent.startsWith(".");
- if (typeof originalHandler !== "undefined") {
- if (!events || !events[typeEvent]) {
+ if (typeof callable !== "undefined") {
+ if (!Object.keys(storeElementEvent).length) {
return;
}
- removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
+ removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
return;
}
if (isNamespace) {
- Object.keys(events).forEach((elementEvent) => {
+ for (const elementEvent of Object.keys(events)) {
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
- });
+ }
}
- const storeElementEvent = events[typeEvent] || {};
- Object.keys(storeElementEvent).forEach((keyHandlers) => {
+ for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
const handlerKey = keyHandlers.replace(stripUidRegex, "");
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
- const event = storeElementEvent[keyHandlers];
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
- });
+ }
},
trigger(element, event, args) {
if (typeof event !== "string" || !element) {
@@ -2077,12 +1861,10 @@
const $ = getjQuery();
const typeEvent = getTypeEvent(event);
const inNamespace = event !== typeEvent;
- const isNative = nativeEvents.has(typeEvent);
- let jQueryEvent;
+ let jQueryEvent = null;
let bubbles = true;
let nativeDispatch = true;
let defaultPrevented = false;
- let evt = null;
if (inNamespace && $) {
jQueryEvent = $.Event(event, args);
$(element).trigger(jQueryEvent);
@@ -2090,89 +1872,154 @@
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
defaultPrevented = jQueryEvent.isDefaultPrevented();
}
- if (isNative) {
- evt = document.createEvent("HTMLEvents");
- evt.initEvent(typeEvent, bubbles, true);
- } else {
- evt = new CustomEvent(event, {
- bubbles,
- cancelable: true
- });
- }
- if (typeof args !== "undefined") {
- Object.keys(args).forEach((key) => {
- Object.defineProperty(evt, key, {
- get() {
- return args[key];
- }
- });
- });
- }
+ const evt = hydrateObj(new Event(event, {
+ bubbles,
+ cancelable: true
+ }), args);
if (defaultPrevented) {
evt.preventDefault();
}
if (nativeDispatch) {
element.dispatchEvent(evt);
}
- if (evt.defaultPrevented && typeof jQueryEvent !== "undefined") {
+ if (evt.defaultPrevented && jQueryEvent) {
jQueryEvent.preventDefault();
}
return evt;
}
};
- var elementMap = /* @__PURE__ */ new Map();
- var Data = {
- 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: ${Array.from(instanceMap.keys())[0]}.`);
- return;
- }
- instanceMap.set(key, instance);
- },
- get(element, key) {
- if (elementMap.has(element)) {
- return elementMap.get(element).get(key) || null;
+ 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;
+ }
+ 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()}`);
+ }
+ var Manipulator = {
+ setDataAttribute(element, key, value) {
+ element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
},
- remove(element, key) {
- if (!elementMap.has(element)) {
- return;
+ removeDataAttribute(element, key) {
+ element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
+ },
+ getDataAttributes(element) {
+ if (!element) {
+ return {};
}
- const instanceMap = elementMap.get(element);
- instanceMap.delete(key);
- if (instanceMap.size === 0) {
- elementMap.delete(element);
+ 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, pureKey.length);
+ attributes[pureKey] = normalizeData(element.dataset[key]);
}
+ return attributes;
+ },
+ getDataAttribute(element, key) {
+ return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
}
};
- var VERSION = "5.0.2";
- var BaseComponent = class {
- constructor(element) {
+ 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 = isElement2(element) ? Manipulator.getDataAttribute(element, "config") : {};
+ return {
+ ...this.constructor.Default,
+ ...typeof jsonConfig === "object" ? jsonConfig : {},
+ ...isElement2(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 = isElement2(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}".`);
+ }
+ }
+ }
+ };
+ var VERSION = "5.3.3";
+ var BaseComponent = class 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);
}
dispose() {
Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, this.constructor.EVENT_KEY);
- Object.getOwnPropertyNames(this).forEach((propertyName) => {
+ for (const propertyName of Object.getOwnPropertyNames(this)) {
this[propertyName] = null;
- });
+ }
}
_queueCallback(callback, element, isAnimated = true) {
executeAfterTransition(callback, element, isAnimated);
}
- /** Static */
+ _getConfig(config) {
+ config = this._mergeConfigObj(config, this._element);
+ config = this._configAfterMerge(config);
+ this._typeCheckConfig(config);
+ return config;
+ }
static getInstance(element) {
- return Data.get(element, this.DATA_KEY);
+ return Data.get(getElement(element), this.DATA_KEY);
}
static getOrCreateInstance(element, config = {}) {
return this.getInstance(element) || new this(element, typeof config === "object" ? config : null);
@@ -2180,94 +2027,158 @@
static get VERSION() {
return VERSION;
}
- static get NAME() {
- throw new Error('You have to implement the static method "NAME", for each component!');
- }
static get DATA_KEY() {
return `bs.${this.NAME}`;
}
static get EVENT_KEY() {
return `.${this.DATA_KEY}`;
}
- };
- var NAME$c = "alert";
- var DATA_KEY$b = "bs.alert";
- var EVENT_KEY$b = `.${DATA_KEY$b}`;
- var DATA_API_KEY$8 = ".data-api";
- var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
- var EVENT_CLOSE = `close${EVENT_KEY$b}`;
- var EVENT_CLOSED = `closed${EVENT_KEY$b}`;
- var EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
- var CLASS_NAME_ALERT = "alert";
- var CLASS_NAME_FADE$6 = "fade";
- var CLASS_NAME_SHOW$9 = "show";
- var Alert = class extends BaseComponent {
- // Getters
- static get NAME() {
- return NAME$c;
+ static eventName(name) {
+ return `${name}${this.EVENT_KEY}`;
}
- // Public
- close(element) {
- const rootElement = element ? this._getRootElement(element) : this._element;
- const customEvent = this._triggerCloseEvent(rootElement);
- if (customEvent === null || customEvent.defaultPrevented) {
- return;
+ };
+ var 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;
}
- this._removeElement(rootElement);
- }
- // Private
- _getRootElement(element) {
- return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
- }
- _triggerCloseEvent(element) {
- return EventHandler.trigger(element, EVENT_CLOSE);
- }
- _removeElement(element) {
- element.classList.remove(CLASS_NAME_SHOW$9);
- const isAnimated = element.classList.contains(CLASS_NAME_FADE$6);
- this._queueCallback(() => this._destroyElement(element), element, isAnimated);
- }
- _destroyElement(element) {
- element.remove();
- EventHandler.trigger(element, EVENT_CLOSED);
- }
- // Static
- static jQueryInterface(config) {
- return this.each(function() {
- const data = Alert.getOrCreateInstance(this);
- if (config === "close") {
- data[config](this);
- }
- });
+ if (hrefAttribute.includes("#") && !hrefAttribute.startsWith("#")) {
+ hrefAttribute = `#${hrefAttribute.split("#")[1]}`;
+ }
+ selector = hrefAttribute && hrefAttribute !== "#" ? hrefAttribute.trim() : null;
}
- static handleDismiss(alertInstance) {
- return function(event) {
- if (event) {
- event.preventDefault();
- }
- alertInstance.close(this);
- };
+ return selector ? selector.split(",").map((sel) => parseSelector(sel)).join(",") : null;
+ };
+ var 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 [];
+ },
+ 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) : [];
+ }
+ };
+ var 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);
+ instance[method]();
+ });
+ };
+ var NAME$f = "alert";
+ var DATA_KEY$a = "bs.alert";
+ var EVENT_KEY$b = `.${DATA_KEY$a}`;
+ var EVENT_CLOSE = `close${EVENT_KEY$b}`;
+ var EVENT_CLOSED = `closed${EVENT_KEY$b}`;
+ var CLASS_NAME_FADE$5 = "fade";
+ var CLASS_NAME_SHOW$8 = "show";
+ var Alert = class extends BaseComponent {
+ static get NAME() {
+ return NAME$f;
+ }
+ 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);
+ }
+ _destroyElement() {
+ this._element.remove();
+ EventHandler.trigger(this._element, EVENT_CLOSED);
+ this.dispose();
+ }
+ static jQueryInterface(config) {
+ return this.each(function() {
+ const data = Alert.getOrCreateInstance(this);
+ if (typeof config !== "string") {
+ return;
+ }
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config](this);
+ });
}
};
- EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
+ enableDismissTrigger(Alert, "close");
defineJQueryPlugin(Alert);
- var NAME$b = "button";
- var DATA_KEY$a = "bs.button";
- var EVENT_KEY$a = `.${DATA_KEY$a}`;
- var DATA_API_KEY$7 = ".data-api";
+ var NAME$e = "button";
+ var DATA_KEY$9 = "bs.button";
+ var EVENT_KEY$a = `.${DATA_KEY$9}`;
+ var DATA_API_KEY$6 = ".data-api";
var CLASS_NAME_ACTIVE$3 = "active";
var SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
- var EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`;
+ var EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
var Button = class extends BaseComponent {
- // Getters
static get NAME() {
- return NAME$b;
+ return NAME$e;
}
- // Public
toggle() {
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);
@@ -2284,105 +2195,119 @@
data.toggle();
});
defineJQueryPlugin(Button);
- function normalizeData(val) {
- if (val === "true") {
- return true;
+ var NAME$d = "swipe";
+ var EVENT_KEY$9 = ".bs.swipe";
+ var EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
+ var EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
+ var EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
+ var EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
+ var EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
+ var POINTER_TYPE_TOUCH = "touch";
+ var POINTER_TYPE_PEN = "pen";
+ var CLASS_NAME_POINTER_EVENT = "pointer-event";
+ var SWIPE_THRESHOLD = 40;
+ var Default$c = {
+ endCallback: null,
+ leftCallback: null,
+ rightCallback: null
+ };
+ var DefaultType$c = {
+ endCallback: "(function|null)",
+ leftCallback: "(function|null)",
+ rightCallback: "(function|null)"
+ };
+ var Swipe = class 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();
}
- if (val === "false") {
- return false;
+ static get Default() {
+ return Default$c;
}
- if (val === Number(val).toString()) {
- return Number(val);
+ static get DefaultType() {
+ return DefaultType$c;
}
- if (val === "" || val === "null") {
- return null;
+ static get NAME() {
+ return NAME$d;
}
- return val;
- }
- function normalizeDataKey(key) {
- return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`);
- }
- var 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 {};
+ dispose() {
+ EventHandler.off(this._element, EVENT_KEY$9);
+ }
+ _start(event) {
+ if (!this._supportPointerEvents) {
+ this._deltaX = event.touches[0].clientX;
+ return;
}
- const attributes = {};
- Object.keys(element.dataset).filter((key) => key.startsWith("bs")).forEach((key) => {
- let pureKey = key.replace(/^bs/, "");
- pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
- attributes[pureKey] = normalizeData(element.dataset[key]);
- });
- return attributes;
- },
- getDataAttribute(element, key) {
- return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
- },
- offset(element) {
- const rect = element.getBoundingClientRect();
- return {
- top: rect.top + document.body.scrollTop,
- left: rect.left + document.body.scrollLeft
- };
- },
- position(element) {
- return {
- top: element.offsetTop,
- left: element.offsetLeft
- };
+ 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 isSupported() {
+ return "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0;
}
};
- var NAME$a = "carousel";
- var DATA_KEY$9 = "bs.carousel";
- var EVENT_KEY$9 = `.${DATA_KEY$9}`;
- var DATA_API_KEY$6 = ".data-api";
- var ARROW_LEFT_KEY = "ArrowLeft";
- var ARROW_RIGHT_KEY = "ArrowRight";
+ var NAME$c = "carousel";
+ var DATA_KEY$8 = "bs.carousel";
+ var EVENT_KEY$8 = `.${DATA_KEY$8}`;
+ var DATA_API_KEY$5 = ".data-api";
+ var ARROW_LEFT_KEY$1 = "ArrowLeft";
+ var ARROW_RIGHT_KEY$1 = "ArrowRight";
var TOUCHEVENT_COMPAT_WAIT = 500;
- var SWIPE_THRESHOLD = 40;
- var Default$9 = {
- interval: 5e3,
- keyboard: true,
- slide: false,
- pause: "hover",
- wrap: true,
- touch: true
- };
- var DefaultType$9 = {
- interval: "(number|boolean)",
- keyboard: "boolean",
- slide: "(boolean|string)",
- pause: "(string|boolean)",
- wrap: "boolean",
- touch: "boolean"
- };
var ORDER_NEXT = "next";
var ORDER_PREV = "prev";
var DIRECTION_LEFT = "left";
var DIRECTION_RIGHT = "right";
- var KEY_TO_DIRECTION = {
- [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
- [ARROW_RIGHT_KEY]: DIRECTION_LEFT
- };
- var EVENT_SLIDE = `slide${EVENT_KEY$9}`;
- var EVENT_SLID = `slid${EVENT_KEY$9}`;
- var EVENT_KEYDOWN = `keydown${EVENT_KEY$9}`;
- var EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$9}`;
- var EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$9}`;
- var EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
- var EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
- var EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
- var EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
- var EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
- var EVENT_DRAG_START = `dragstart${EVENT_KEY$9}`;
- var EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$9}${DATA_API_KEY$6}`;
- var EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`;
+ var EVENT_SLIDE = `slide${EVENT_KEY$8}`;
+ var EVENT_SLID = `slid${EVENT_KEY$8}`;
+ var EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`;
+ var EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`;
+ var EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`;
+ var EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`;
+ var EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`;
+ var EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
var CLASS_NAME_CAROUSEL = "carousel";
var CLASS_NAME_ACTIVE$2 = "active";
var CLASS_NAME_SLIDE = "slide";
@@ -2390,43 +2315,56 @@
var CLASS_NAME_START = "carousel-item-start";
var CLASS_NAME_NEXT = "carousel-item-next";
var CLASS_NAME_PREV = "carousel-item-prev";
- var CLASS_NAME_POINTER_EVENT = "pointer-event";
- var SELECTOR_ACTIVE$1 = ".active";
- var SELECTOR_ACTIVE_ITEM = ".active.carousel-item";
+ var SELECTOR_ACTIVE = ".active";
var SELECTOR_ITEM = ".carousel-item";
+ var SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
var SELECTOR_ITEM_IMG = ".carousel-item img";
- var SELECTOR_NEXT_PREV = ".carousel-item-next, .carousel-item-prev";
var SELECTOR_INDICATORS = ".carousel-indicators";
- var SELECTOR_INDICATOR = "[data-bs-target]";
var SELECTOR_DATA_SLIDE = "[data-bs-slide], [data-bs-slide-to]";
var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
- var POINTER_TYPE_TOUCH = "touch";
- var POINTER_TYPE_PEN = "pen";
+ var KEY_TO_DIRECTION = {
+ [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT,
+ [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT
+ };
+ var Default$b = {
+ interval: 5e3,
+ keyboard: true,
+ pause: "hover",
+ ride: false,
+ touch: true,
+ wrap: true
+ };
+ var DefaultType$b = {
+ interval: "(number|boolean)",
+ keyboard: "boolean",
+ pause: "(string|boolean)",
+ ride: "(boolean|string)",
+ touch: "boolean",
+ wrap: "boolean"
+ };
var Carousel = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._items = null;
+ super(element, config);
this._interval = null;
this._activeElement = null;
- this._isPaused = false;
this._isSliding = false;
this.touchTimeout = null;
- this.touchStartX = 0;
- this.touchDeltaX = 0;
- this._config = this._getConfig(config);
+ this._swipeHelper = null;
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
- this._touchSupported = "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0;
- this._pointerEvent = Boolean(window.PointerEvent);
this._addEventListeners();
+ if (this._config.ride === CLASS_NAME_CAROUSEL) {
+ this.cycle();
+ }
}
- // Getters
static get Default() {
- return Default$9;
+ return Default$b;
+ }
+ static get DefaultType() {
+ return DefaultType$b;
}
static get NAME() {
- return NAME$a;
+ return NAME$c;
}
- // Public
next() {
this._slide(ORDER_NEXT);
}
@@ -2438,118 +2376,85 @@
prev() {
this._slide(ORDER_PREV);
}
- pause(event) {
- if (!event) {
- this._isPaused = true;
- }
- if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
+ pause() {
+ if (this._isSliding) {
triggerTransitionEnd(this._element);
- this.cycle(true);
}
- clearInterval(this._interval);
- this._interval = null;
+ this._clearInterval();
}
- cycle(event) {
- if (!event) {
- this._isPaused = false;
- }
- if (this._interval) {
- clearInterval(this._interval);
- this._interval = null;
+ cycle() {
+ this._clearInterval();
+ this._updateInterval();
+ this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
+ }
+ _maybeEnableCycle() {
+ if (!this._config.ride) {
+ return;
}
- if (this._config && this._config.interval && !this._isPaused) {
- this._updateInterval();
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
+ if (this._isSliding) {
+ EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
+ return;
}
+ this.cycle();
}
to(index) {
- this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
- const activeIndex = this._getItemIndex(this._activeElement);
- if (index > this._items.length - 1 || index < 0) {
+ 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) {
- this.pause();
- this.cycle();
return;
}
const order2 = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
- this._slide(order2, this._items[index]);
+ this._slide(order2, items[index]);
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$9,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$a, config, DefaultType$9);
- return config;
- }
- _handleSwipe() {
- const absDeltax = Math.abs(this.touchDeltaX);
- if (absDeltax <= SWIPE_THRESHOLD) {
- return;
- }
- const direction = absDeltax / this.touchDeltaX;
- this.touchDeltaX = 0;
- if (!direction) {
- return;
+ dispose() {
+ if (this._swipeHelper) {
+ this._swipeHelper.dispose();
}
- this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
+ super.dispose();
+ }
+ _configAfterMerge(config) {
+ config.defaultInterval = config.interval;
+ return config;
}
_addEventListeners() {
if (this._config.keyboard) {
- EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event));
+ EventHandler.on(this._element, EVENT_KEYDOWN$1, (event) => this._keydown(event));
}
if (this._config.pause === "hover") {
- EventHandler.on(this._element, EVENT_MOUSEENTER, (event) => this.pause(event));
- EventHandler.on(this._element, EVENT_MOUSELEAVE, (event) => this.cycle(event));
+ EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause());
+ EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle());
}
- if (this._config.touch && this._touchSupported) {
+ if (this._config.touch && Swipe.isSupported()) {
this._addTouchEventListeners();
}
}
_addTouchEventListeners() {
- const start2 = (event) => {
- if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
- this.touchStartX = event.clientX;
- } else if (!this._pointerEvent) {
- this.touchStartX = event.touches[0].clientX;
- }
- };
- const move = (event) => {
- this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
- };
- const end2 = (event) => {
- if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
- this.touchDeltaX = event.clientX - this.touchStartX;
+ 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;
}
- this._handleSwipe();
- if (this._config.pause === "hover") {
- this.pause();
- if (this.touchTimeout) {
- clearTimeout(this.touchTimeout);
- }
- this.touchTimeout = setTimeout((event2) => this.cycle(event2), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
+ this.pause();
+ if (this.touchTimeout) {
+ clearTimeout(this.touchTimeout);
}
+ this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
};
- SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach((itemImg) => {
- EventHandler.on(itemImg, EVENT_DRAG_START, (e) => e.preventDefault());
- });
- if (this._pointerEvent) {
- EventHandler.on(this._element, EVENT_POINTERDOWN, (event) => start2(event));
- EventHandler.on(this._element, EVENT_POINTERUP, (event) => end2(event));
- this._element.classList.add(CLASS_NAME_POINTER_EVENT);
- } else {
- EventHandler.on(this._element, EVENT_TOUCHSTART, (event) => start2(event));
- EventHandler.on(this._element, EVENT_TOUCHMOVE, (event) => move(event));
- EventHandler.on(this._element, EVENT_TOUCHEND, (event) => end2(event));
- }
+ 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)) {
@@ -2558,313 +2463,249 @@
const direction = KEY_TO_DIRECTION[event.key];
if (direction) {
event.preventDefault();
- this._slide(direction);
+ this._slide(this._directionToOrder(direction));
}
}
_getItemIndex(element) {
- this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
- return this._items.indexOf(element);
+ return this._getItems().indexOf(element);
}
- _getItemByOrder(order2, activeElement) {
- const isNext = order2 === ORDER_NEXT;
- return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
- }
- _triggerSlideEvent(relatedTarget, eventDirectionName) {
- const targetIndex = this._getItemIndex(relatedTarget);
- const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
- return EventHandler.trigger(this._element, EVENT_SLIDE, {
- relatedTarget,
- direction: eventDirectionName,
- from: fromIndex,
- to: targetIndex
- });
- }
- _setActiveIndicatorElement(element) {
- if (this._indicatorsElement) {
- const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
- activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
- activeIndicator.removeAttribute("aria-current");
- const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
- for (let i = 0; i < indicators.length; i++) {
- if (Number.parseInt(indicators[i].getAttribute("data-bs-slide-to"), 10) === this._getItemIndex(element)) {
- indicators[i].classList.add(CLASS_NAME_ACTIVE$2);
- indicators[i].setAttribute("aria-current", "true");
- break;
- }
- }
+ _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 || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
+ const element = this._activeElement || this._getActive();
if (!element) {
return;
}
const elementInterval = Number.parseInt(element.getAttribute("data-bs-interval"), 10);
- if (elementInterval) {
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
- this._config.interval = elementInterval;
- } else {
- this._config.interval = this._config.defaultInterval || this._config.interval;
- }
+ this._config.interval = elementInterval || this._config.defaultInterval;
}
- _slide(directionOrOrder, element) {
- const order2 = this._directionToOrder(directionOrOrder);
- const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
- const activeElementIndex = this._getItemIndex(activeElement);
- const nextElement = element || this._getItemByOrder(order2, activeElement);
- const nextElementIndex = this._getItemIndex(nextElement);
- const isCycling = Boolean(this._interval);
- const isNext = order2 === ORDER_NEXT;
- const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
- const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
- const eventDirectionName = this._orderToDirection(order2);
- if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) {
- this._isSliding = false;
+ _slide(order2, element = null) {
+ if (this._isSliding) {
return;
}
- if (this._isSliding) {
+ const activeElement = this._getActive();
+ const isNext = order2 === ORDER_NEXT;
+ const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
+ if (nextElement === activeElement) {
return;
}
- const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
+ const nextElementIndex = this._getItemIndex(nextElement);
+ const triggerEvent = (eventName) => {
+ return EventHandler.trigger(this._element, eventName, {
+ relatedTarget: nextElement,
+ direction: this._orderToDirection(order2),
+ from: this._getItemIndex(activeElement),
+ to: nextElementIndex
+ });
+ };
+ const slideEvent = triggerEvent(EVENT_SLIDE);
if (slideEvent.defaultPrevented) {
return;
}
if (!activeElement || !nextElement) {
return;
}
+ const isCycling = Boolean(this._interval);
+ this.pause();
this._isSliding = true;
- if (isCycling) {
- this.pause();
- }
- this._setActiveIndicatorElement(nextElement);
+ this._setActiveIndicatorElement(nextElementIndex);
this._activeElement = nextElement;
- const triggerSlidEvent = () => {
- EventHandler.trigger(this._element, EVENT_SLID, {
- relatedTarget: nextElement,
- direction: eventDirectionName,
- from: activeElementIndex,
- to: nextElementIndex
- });
- };
- if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
- 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;
- setTimeout(triggerSlidEvent, 0);
- };
- this._queueCallback(completeCallBack, activeElement, true);
- } else {
- activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
+ 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;
- triggerSlidEvent();
- }
+ triggerEvent(EVENT_SLID);
+ };
+ this._queueCallback(completeCallBack, activeElement, this._isAnimated());
if (isCycling) {
this.cycle();
}
}
- _directionToOrder(direction) {
- if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
- return direction;
+ _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(order2) {
- if (![ORDER_NEXT, ORDER_PREV].includes(order2)) {
- return order2;
- }
if (isRTL()) {
return order2 === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return order2 === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
}
- // Static
- static carouselInterface(element, config) {
- const data = Carousel.getOrCreateInstance(element, config);
- let {
- _config
- } = data;
- if (typeof config === "object") {
- _config = {
- ..._config,
- ...config
- };
- }
- const action = typeof config === "string" ? config : _config.slide;
- if (typeof config === "number") {
- data.to(config);
- } else if (typeof action === "string") {
- if (typeof data[action] === "undefined") {
- throw new TypeError(`No method named "${action}"`);
- }
- data[action]();
- } else if (_config.interval && _config.ride) {
- data.pause();
- data.cycle();
- }
- }
static jQueryInterface(config) {
return this.each(function() {
- Carousel.carouselInterface(this, config);
+ const data = Carousel.getOrCreateInstance(this, config);
+ if (typeof config === "number") {
+ data.to(config);
+ return;
+ }
+ if (typeof config === "string") {
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
+ }
});
}
- static dataApiClickHandler(event) {
- const target = getElementFromSelector(this);
- if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
- return;
- }
- const config = {
- ...Manipulator.getDataAttributes(target),
- ...Manipulator.getDataAttributes(this)
- };
- const slideIndex = this.getAttribute("data-bs-slide-to");
- if (slideIndex) {
- config.interval = false;
- }
- Carousel.carouselInterface(target, config);
- if (slideIndex) {
- Carousel.getInstance(target).to(slideIndex);
- }
- event.preventDefault();
- }
};
- EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
- EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
+ 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 (let i = 0, len = carousels.length; i < len; i++) {
- Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
+ for (const carousel of carousels) {
+ Carousel.getOrCreateInstance(carousel);
}
});
defineJQueryPlugin(Carousel);
- var NAME$9 = "collapse";
- var DATA_KEY$8 = "bs.collapse";
- var EVENT_KEY$8 = `.${DATA_KEY$8}`;
- var DATA_API_KEY$5 = ".data-api";
- var Default$8 = {
- toggle: true,
- parent: ""
- };
- var DefaultType$8 = {
- toggle: "boolean",
- parent: "(string|element)"
- };
- var EVENT_SHOW$5 = `show${EVENT_KEY$8}`;
- var EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`;
- var EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
- var EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
- var EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
- var CLASS_NAME_SHOW$8 = "show";
+ var NAME$b = "collapse";
+ var DATA_KEY$7 = "bs.collapse";
+ var EVENT_KEY$7 = `.${DATA_KEY$7}`;
+ var DATA_API_KEY$4 = ".data-api";
+ var EVENT_SHOW$6 = `show${EVENT_KEY$7}`;
+ var EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`;
+ var EVENT_HIDE$6 = `hide${EVENT_KEY$7}`;
+ var EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`;
+ var EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
+ var CLASS_NAME_SHOW$7 = "show";
var CLASS_NAME_COLLAPSE = "collapse";
var CLASS_NAME_COLLAPSING = "collapsing";
var CLASS_NAME_COLLAPSED = "collapsed";
+ var CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
+ var CLASS_NAME_HORIZONTAL = "collapse-horizontal";
var WIDTH = "width";
var HEIGHT = "height";
- var SELECTOR_ACTIVES = ".show, .collapsing";
+ var SELECTOR_ACTIVES = ".collapse.show, .collapse.collapsing";
var SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
+ var Default$a = {
+ parent: null,
+ toggle: true
+ };
+ var DefaultType$a = {
+ parent: "(null|element)",
+ toggle: "boolean"
+ };
var Collapse = class extends BaseComponent {
constructor(element, config) {
- super(element);
+ super(element, config);
this._isTransitioning = false;
- this._config = this._getConfig(config);
- this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$4}[href="#${this._element.id}"],${SELECTOR_DATA_TOGGLE$4}[data-bs-target="#${this._element.id}"]`);
+ this._triggerArray = [];
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
- for (let i = 0, len = toggleList.length; i < len; i++) {
- const elem = toggleList[i];
- const selector = getSelectorFromElement(elem);
- const filterElement = SelectorEngine.find(selector).filter((foundElem) => foundElem === this._element);
+ 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._selector = selector;
this._triggerArray.push(elem);
}
}
- this._parent = this._config.parent ? this._getParent() : null;
+ this._initializeChildren();
if (!this._config.parent) {
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
+ this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
}
if (this._config.toggle) {
this.toggle();
}
}
- // Getters
static get Default() {
- return Default$8;
+ return Default$a;
+ }
+ static get DefaultType() {
+ return DefaultType$a;
}
static get NAME() {
- return NAME$9;
+ return NAME$b;
}
- // Public
toggle() {
- if (this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isShown()) {
this.hide();
} else {
this.show();
}
}
show() {
- if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isTransitioning || this._isShown()) {
return;
}
- let actives;
- let activesData;
- if (this._parent) {
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter((elem) => {
- if (typeof this._config.parent === "string") {
- return elem.getAttribute("data-bs-parent") === this._config.parent;
- }
- return elem.classList.contains(CLASS_NAME_COLLAPSE);
- });
- if (actives.length === 0) {
- actives = null;
- }
+ let activeChildren = [];
+ if (this._config.parent) {
+ activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter((element) => element !== this._element).map((element) => Collapse.getOrCreateInstance(element, {
+ toggle: false
+ }));
}
- const container = SelectorEngine.findOne(this._selector);
- if (actives) {
- const tempActiveData = actives.find((elem) => container !== elem);
- activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
- if (activesData && activesData._isTransitioning) {
- return;
- }
+ if (activeChildren.length && activeChildren[0]._isTransitioning) {
+ return;
}
- const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5);
+ const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6);
if (startEvent.defaultPrevented) {
return;
}
- if (actives) {
- actives.forEach((elemActive) => {
- if (container !== elemActive) {
- Collapse.collapseInterface(elemActive, "hide");
- }
- if (!activesData) {
- Data.set(elemActive, DATA_KEY$8, null);
- }
- });
+ 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;
- if (this._triggerArray.length) {
- this._triggerArray.forEach((element) => {
- element.classList.remove(CLASS_NAME_COLLAPSED);
- element.setAttribute("aria-expanded", true);
- });
- }
- this.setTransitioning(true);
+ 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$8);
+ this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
this._element.style[dimension] = "";
- this.setTransitioning(false);
- EventHandler.trigger(this._element, EVENT_SHOWN$5);
+ EventHandler.trigger(this._element, EVENT_SHOWN$6);
};
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
const scrollSize = `scroll${capitalizedDimension}`;
@@ -2872,10 +2713,10 @@
this._element.style[dimension] = `${this._element[scrollSize]}px`;
}
hide() {
- if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isTransitioning || !this._isShown()) {
return;
}
- const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5);
+ const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
if (startEvent.defaultPrevented) {
return;
}
@@ -2883,94 +2724,72 @@
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$8);
- const triggerArrayLength = this._triggerArray.length;
- if (triggerArrayLength > 0) {
- for (let i = 0; i < triggerArrayLength; i++) {
- const trigger = this._triggerArray[i];
- const elem = getElementFromSelector(trigger);
- if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) {
- trigger.classList.add(CLASS_NAME_COLLAPSED);
- trigger.setAttribute("aria-expanded", false);
- }
+ 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.setTransitioning(true);
+ this._isTransitioning = true;
const complete = () => {
- this.setTransitioning(false);
+ this._isTransitioning = false;
this._element.classList.remove(CLASS_NAME_COLLAPSING);
this._element.classList.add(CLASS_NAME_COLLAPSE);
- EventHandler.trigger(this._element, EVENT_HIDDEN$5);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$6);
};
this._element.style[dimension] = "";
this._queueCallback(complete, this._element, true);
}
- setTransitioning(isTransitioning) {
- this._isTransitioning = isTransitioning;
+ _isShown(element = this._element) {
+ return element.classList.contains(CLASS_NAME_SHOW$7);
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$8,
- ...config
- };
+ _configAfterMerge(config) {
config.toggle = Boolean(config.toggle);
- typeCheckConfig(NAME$9, config, DefaultType$8);
+ config.parent = getElement(config.parent);
return config;
}
_getDimension() {
- return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
- }
- _getParent() {
- let {
- parent
- } = this._config;
- parent = getElement(parent);
- const selector = `${SELECTOR_DATA_TOGGLE$4}[data-bs-parent="${parent}"]`;
- SelectorEngine.find(selector, parent).forEach((element) => {
- const selected = getElementFromSelector(element);
- this._addAriaAndCollapsedClass(selected, [element]);
- });
- return parent;
+ return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
}
- _addAriaAndCollapsedClass(element, triggerArray) {
- if (!element || !triggerArray.length) {
+ _initializeChildren() {
+ if (!this._config.parent) {
return;
}
- const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
- triggerArray.forEach((elem) => {
- if (isOpen) {
- elem.classList.remove(CLASS_NAME_COLLAPSED);
- } else {
- elem.classList.add(CLASS_NAME_COLLAPSED);
+ 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));
}
- elem.setAttribute("aria-expanded", isOpen);
- });
- }
- // Static
- static collapseInterface(element, config) {
- let data = Collapse.getInstance(element);
- const _config = {
- ...Default$8,
- ...Manipulator.getDataAttributes(element),
- ...typeof config === "object" && config ? config : {}
- };
- if (!data && _config.toggle && typeof config === "string" && /show|hide/.test(config)) {
- _config.toggle = false;
}
- if (!data) {
- data = new Collapse(element, _config);
+ }
+ _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));
+ }
+ _addAriaAndCollapsedClass(triggerArray, isOpen) {
+ if (!triggerArray.length) {
+ return;
}
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ for (const element of triggerArray) {
+ element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
+ element.setAttribute("aria-expanded", isOpen);
}
}
static jQueryInterface(config) {
+ const _config = {};
+ if (typeof config === "string" && /show|hide/.test(config)) {
+ _config.toggle = false;
+ }
return this.each(function() {
- Collapse.collapseInterface(this, config);
+ const data = Collapse.getOrCreateInstance(this, _config);
+ if (typeof config === "string") {
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
+ }
});
}
};
@@ -2978,51 +2797,39 @@
if (event.target.tagName === "A" || event.delegateTarget && event.delegateTarget.tagName === "A") {
event.preventDefault();
}
- const triggerData = Manipulator.getDataAttributes(this);
- const selector = getSelectorFromElement(this);
- const selectorElements = SelectorEngine.find(selector);
- selectorElements.forEach((element) => {
- const data = Collapse.getInstance(element);
- let config;
- if (data) {
- if (data._parent === null && typeof triggerData.parent === "string") {
- data._config.parent = triggerData.parent;
- data._parent = data._getParent();
- }
- config = "toggle";
- } else {
- config = triggerData;
- }
- Collapse.collapseInterface(element, config);
- });
+ for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {
+ Collapse.getOrCreateInstance(element, {
+ toggle: false
+ }).toggle();
+ }
});
defineJQueryPlugin(Collapse);
- var NAME$8 = "dropdown";
- var DATA_KEY$7 = "bs.dropdown";
- var EVENT_KEY$7 = `.${DATA_KEY$7}`;
- var DATA_API_KEY$4 = ".data-api";
+ var NAME$a = "dropdown";
+ var DATA_KEY$6 = "bs.dropdown";
+ var EVENT_KEY$6 = `.${DATA_KEY$6}`;
+ var DATA_API_KEY$3 = ".data-api";
var ESCAPE_KEY$2 = "Escape";
- var SPACE_KEY = "Space";
- var TAB_KEY = "Tab";
- var ARROW_UP_KEY = "ArrowUp";
- var ARROW_DOWN_KEY = "ArrowDown";
+ var TAB_KEY$1 = "Tab";
+ var ARROW_UP_KEY$1 = "ArrowUp";
+ var ARROW_DOWN_KEY$1 = "ArrowDown";
var RIGHT_MOUSE_BUTTON = 2;
- var REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
- var EVENT_HIDE$4 = `hide${EVENT_KEY$7}`;
- var EVENT_HIDDEN$4 = `hidden${EVENT_KEY$7}`;
- var EVENT_SHOW$4 = `show${EVENT_KEY$7}`;
- var EVENT_SHOWN$4 = `shown${EVENT_KEY$7}`;
- var EVENT_CLICK = `click${EVENT_KEY$7}`;
- var EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var CLASS_NAME_SHOW$7 = "show";
+ var EVENT_HIDE$5 = `hide${EVENT_KEY$6}`;
+ var EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`;
+ var EVENT_SHOW$5 = `show${EVENT_KEY$6}`;
+ var EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`;
+ var EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var CLASS_NAME_SHOW$6 = "show";
var CLASS_NAME_DROPUP = "dropup";
var CLASS_NAME_DROPEND = "dropend";
var CLASS_NAME_DROPSTART = "dropstart";
- var CLASS_NAME_NAVBAR = "navbar";
- var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]';
+ var CLASS_NAME_DROPUP_CENTER = "dropup-center";
+ var CLASS_NAME_DROPDOWN_CENTER = "dropdown-center";
+ var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
+ var SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;
var SELECTOR_MENU = ".dropdown-menu";
+ var SELECTOR_NAVBAR = ".navbar";
var SELECTOR_NAVBAR_NAV = ".navbar-nav";
var SELECTOR_VISIBLE_ITEMS = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)";
var PLACEMENT_TOP = isRTL() ? "top-end" : "top-start";
@@ -3031,97 +2838,69 @@
var PLACEMENT_BOTTOMEND = isRTL() ? "bottom-start" : "bottom-end";
var PLACEMENT_RIGHT = isRTL() ? "left-start" : "right-start";
var PLACEMENT_LEFT = isRTL() ? "right-start" : "left-start";
- var Default$7 = {
- offset: [0, 2],
+ var PLACEMENT_TOPCENTER = "top";
+ var PLACEMENT_BOTTOMCENTER = "bottom";
+ var Default$9 = {
+ autoClose: true,
boundary: "clippingParents",
- reference: "toggle",
display: "dynamic",
+ offset: [0, 2],
popperConfig: null,
- autoClose: true
+ reference: "toggle"
};
- var DefaultType$7 = {
- offset: "(array|string|function)",
+ var DefaultType$9 = {
+ autoClose: "(boolean|string)",
boundary: "(string|element)",
- reference: "(string|element|object)",
display: "string",
+ offset: "(array|string|function)",
popperConfig: "(null|object|function)",
- autoClose: "(boolean|string)"
+ reference: "(string|element|object)"
};
var Dropdown = class extends BaseComponent {
constructor(element, config) {
- super(element);
+ super(element, config);
this._popper = null;
- this._config = this._getConfig(config);
- this._menu = this._getMenuElement();
+ this._parent = this._element.parentNode;
+ 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();
- this._addEventListeners();
}
- // Getters
static get Default() {
- return Default$7;
+ return Default$9;
}
static get DefaultType() {
- return DefaultType$7;
+ return DefaultType$9;
}
static get NAME() {
- return NAME$8;
+ return NAME$a;
}
- // Public
toggle() {
- if (isDisabled(this._element)) {
- return;
- }
- const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
- if (isActive) {
- this.hide();
- return;
- }
- this.show();
+ return this._isShown() ? this.hide() : this.show();
}
show() {
- if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
+ if (isDisabled(this._element) || this._isShown()) {
return;
}
- const parent = Dropdown.getParentFromElement(this._element);
const relatedTarget = {
relatedTarget: this._element
};
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget);
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget);
if (showEvent.defaultPrevented) {
return;
}
- if (this._inNavbar) {
- Manipulator.setDataAttribute(this._menu, "popper", "none");
- } else {
- if (typeof lib_exports === "undefined") {
- throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
- }
- let referenceElement = this._element;
- if (this._config.reference === "parent") {
- referenceElement = parent;
- } else if (isElement2(this._config.reference)) {
- referenceElement = getElement(this._config.reference);
- } else if (typeof this._config.reference === "object") {
- referenceElement = this._config.reference;
- }
- const popperConfig = this._getPopperConfig();
- const isDisplayStatic = popperConfig.modifiers.find((modifier) => modifier.name === "applyStyles" && modifier.enabled === false);
- this._popper = createPopper3(referenceElement, this._menu, popperConfig);
- if (isDisplayStatic) {
- Manipulator.setDataAttribute(this._menu, "popper", "static");
+ this._createPopper();
+ if ("ontouchstart" in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
+ for (const element of [].concat(...document.body.children)) {
+ EventHandler.on(element, "mouseover", noop);
}
}
- if ("ontouchstart" in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
- [].concat(...document.body.children).forEach((elem) => EventHandler.on(elem, "mouseover", noop));
- }
this._element.focus();
this._element.setAttribute("aria-expanded", true);
- this._menu.classList.toggle(CLASS_NAME_SHOW$7);
- this._element.classList.toggle(CLASS_NAME_SHOW$7);
- EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
+ 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._menu.classList.contains(CLASS_NAME_SHOW$7)) {
+ if (isDisabled(this._element) || !this._isShown()) {
return;
}
const relatedTarget = {
@@ -3141,53 +2920,64 @@
this._popper.update();
}
}
- // Private
- _addEventListeners() {
- EventHandler.on(this._element, EVENT_CLICK, (event) => {
- event.preventDefault();
- this.toggle();
- });
- }
_completeHide(relatedTarget) {
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
}
if ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((elem) => EventHandler.off(elem, "mouseover", noop));
+ 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$7);
- this._element.classList.remove(CLASS_NAME_SHOW$7);
+ 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$4, relatedTarget);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget);
}
_getConfig(config) {
- config = {
- ...this.constructor.Default,
- ...Manipulator.getDataAttributes(this._element),
- ...config
- };
- typeCheckConfig(NAME$8, config, this.constructor.DefaultType);
+ config = super._getConfig(config);
if (typeof config.reference === "object" && !isElement2(config.reference) && typeof config.reference.getBoundingClientRect !== "function") {
- throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
+ throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
}
return config;
}
- _getMenuElement() {
- return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
+ _createPopper() {
+ if (typeof lib_exports === "undefined") {
+ throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
+ }
+ let referenceElement = this._element;
+ if (this._config.reference === "parent") {
+ referenceElement = this._parent;
+ } else if (isElement2(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 = createPopper3(referenceElement, this._menu, popperConfig);
+ }
+ _isShown() {
+ return this._menu.classList.contains(CLASS_NAME_SHOW$6);
}
_getPlacement() {
- const parentDropdown = this._element.parentNode;
+ 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;
+ }
const isEnd = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
@@ -3195,14 +2985,14 @@
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
}
_detectNavbar() {
- return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
+ return this._element.closest(SELECTOR_NAVBAR) !== null;
}
_getOffset() {
const {
offset: offset2
} = this._config;
if (typeof offset2 === "string") {
- return offset2.split(",").map((val) => Number.parseInt(val, 10));
+ return offset2.split(",").map((value) => Number.parseInt(value, 10));
}
if (typeof offset2 === "function") {
return (popperData) => offset2(popperData, this._element);
@@ -3224,7 +3014,8 @@
}
}]
};
- if (this._config.display === "static") {
+ if (this._inNavbar || this._config.display === "static") {
+ Manipulator.setDataAttribute(this._menu, "popper", "static");
defaultBsPopperConfig.modifiers = [{
name: "applyStyles",
enabled: false
@@ -3232,212 +3023,138 @@
}
return {
...defaultBsPopperConfig,
- ...typeof this._config.popperConfig === "function" ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
};
}
_selectMenuItem({
key,
target
}) {
- const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
+ const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((element) => isVisible(element));
if (!items.length) {
return;
}
- getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
}
- // Static
- static dropdownInterface(element, config) {
- const data = Dropdown.getOrCreateInstance(element, config);
- if (typeof config === "string") {
+ 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 jQueryInterface(config) {
- return this.each(function() {
- Dropdown.dropdownInterface(this, config);
});
}
static clearMenus(event) {
- if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY)) {
+ if (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY$1) {
return;
}
- const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
- for (let i = 0, len = toggles.length; i < len; i++) {
- const context = Dropdown.getInstance(toggles[i]);
+ 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;
}
- if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) {
+ 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;
+ }
+ 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) {
- 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;
- }
- if (context._menu.contains(event.target) && (event.type === "keyup" && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
- continue;
- }
- if (event.type === "click") {
- relatedTarget.clickEvent = event;
- }
- }
- context._completeHide(relatedTarget);
- }
- }
- static getParentFromElement(element) {
- return getElementFromSelector(element) || element.parentNode;
- }
- static dataApiKeydownHandler(event) {
- if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
- return;
- }
- const isActive = this.classList.contains(CLASS_NAME_SHOW$7);
- if (!isActive && event.key === ESCAPE_KEY$2) {
- return;
- }
- event.preventDefault();
- event.stopPropagation();
- if (isDisabled(this)) {
- return;
- }
- const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
- if (event.key === ESCAPE_KEY$2) {
- getToggleButton().focus();
- Dropdown.clearMenus();
- return;
- }
- if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
- if (!isActive) {
- getToggleButton().click();
- }
- Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
- return;
- }
- if (!isActive || event.key === SPACE_KEY) {
- Dropdown.clearMenus();
- }
- }
- };
- 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.dropdownInterface(this);
- });
- defineJQueryPlugin(Dropdown);
- var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";
- var SELECTOR_STICKY_CONTENT = ".sticky-top";
- var ScrollBarHelper = class {
- constructor() {
- this._element = document.body;
- }
- getWidth() {
- const documentWidth = document.documentElement.clientWidth;
- return Math.abs(window.innerWidth - documentWidth);
- }
- hide() {
- const width = this.getWidth();
- this._disableOverFlow();
- this._setElementAttributes(this._element, "paddingRight", (calculatedValue) => calculatedValue + width);
- this._setElementAttributes(SELECTOR_FIXED_CONTENT, "paddingRight", (calculatedValue) => calculatedValue + width);
- this._setElementAttributes(SELECTOR_STICKY_CONTENT, "marginRight", (calculatedValue) => calculatedValue - width);
- }
- _disableOverFlow() {
- this._saveInitialAttribute(this._element, "overflow");
- this._element.style.overflow = "hidden";
- }
- _setElementAttributes(selector, styleProp, callback) {
- const scrollbarWidth = this.getWidth();
- const manipulationCallBack = (element) => {
- if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
- return;
+ };
+ if (event.type === "click") {
+ relatedTarget.clickEvent = event;
}
- this._saveInitialAttribute(element, styleProp);
- const calculatedValue = window.getComputedStyle(element)[styleProp];
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
- };
- this._applyManipulationCallback(selector, manipulationCallBack);
- }
- reset() {
- this._resetElementAttributes(this._element, "overflow");
- this._resetElementAttributes(this._element, "paddingRight");
- this._resetElementAttributes(SELECTOR_FIXED_CONTENT, "paddingRight");
- this._resetElementAttributes(SELECTOR_STICKY_CONTENT, "marginRight");
- }
- _saveInitialAttribute(element, styleProp) {
- const actualValue = element.style[styleProp];
- if (actualValue) {
- Manipulator.setDataAttribute(element, styleProp, actualValue);
+ context._completeHide(relatedTarget);
}
}
- _resetElementAttributes(selector, styleProp) {
- const manipulationCallBack = (element) => {
- const value = Manipulator.getDataAttribute(element, styleProp);
- if (typeof value === "undefined") {
- element.style.removeProperty(styleProp);
- } else {
- Manipulator.removeDataAttribute(element, styleProp);
- element.style[styleProp] = value;
- }
- };
- this._applyManipulationCallback(selector, manipulationCallBack);
- }
- _applyManipulationCallback(selector, callBack) {
- if (isElement2(selector)) {
- callBack(selector);
- } else {
- SelectorEngine.find(selector, this._element).forEach(callBack);
+ static dataApiKeydownHandler(event) {
+ 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();
+ 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()) {
+ event.stopPropagation();
+ instance.hide();
+ getToggleButton.focus();
}
- }
- isOverflowing() {
- return this.getWidth() > 0;
}
};
- var Default$6 = {
- isVisible: true,
- // if false, we use the backdrop helper without adding any element to the dom
+ 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();
+ });
+ defineJQueryPlugin(Dropdown);
+ var NAME$9 = "backdrop";
+ var CLASS_NAME_FADE$4 = "fade";
+ var CLASS_NAME_SHOW$5 = "show";
+ var EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
+ var Default$8 = {
+ className: "modal-backdrop",
+ clickCallback: null,
isAnimated: false,
- rootElement: "body",
- // give the choice to place backdrop under different elements
- clickCallback: null
+ isVisible: true,
+ rootElement: "body"
};
- var DefaultType$6 = {
- isVisible: "boolean",
+ var DefaultType$8 = {
+ className: "string",
+ clickCallback: "(function|null)",
isAnimated: "boolean",
- rootElement: "(element|string)",
- clickCallback: "(function|null)"
+ isVisible: "boolean",
+ rootElement: "(element|string)"
};
- var NAME$7 = "backdrop";
- var CLASS_NAME_BACKDROP = "modal-backdrop";
- var CLASS_NAME_FADE$5 = "fade";
- var CLASS_NAME_SHOW$6 = "show";
- var EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
- var Backdrop = class {
+ var Backdrop = class extends Config {
constructor(config) {
+ super();
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
+ static get Default() {
+ return Default$8;
+ }
+ static get DefaultType() {
+ return DefaultType$8;
+ }
+ static get NAME() {
+ return NAME$9;
+ }
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
+ const element = this._getElement();
if (this._config.isAnimated) {
- reflow(this._getElement());
+ reflow(element);
}
- this._getElement().classList.add(CLASS_NAME_SHOW$6);
+ element.classList.add(CLASS_NAME_SHOW$5);
this._emulateAnimation(() => {
execute(callback);
});
@@ -3447,109 +3164,249 @@
execute(callback);
return;
}
- this._getElement().classList.remove(CLASS_NAME_SHOW$6);
+ this._getElement().classList.remove(CLASS_NAME_SHOW$5);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
}
- // Private
+ dispose() {
+ if (!this._isAppended) {
+ return;
+ }
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
+ this._element.remove();
+ this._isAppended = false;
+ }
_getElement() {
if (!this._element) {
const backdrop = document.createElement("div");
- backdrop.className = CLASS_NAME_BACKDROP;
+ backdrop.className = this._config.className;
if (this._config.isAnimated) {
- backdrop.classList.add(CLASS_NAME_FADE$5);
+ backdrop.classList.add(CLASS_NAME_FADE$4);
}
this._element = backdrop;
}
return this._element;
}
- _getConfig(config) {
- config = {
- ...Default$6,
- ...typeof config === "object" ? config : {}
- };
+ _configAfterMerge(config) {
config.rootElement = getElement(config.rootElement);
- typeCheckConfig(NAME$7, config, DefaultType$6);
return config;
}
_append() {
if (this._isAppended) {
return;
}
- this._config.rootElement.appendChild(this._getElement());
- EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
+ const element = this._getElement();
+ this._config.rootElement.append(element);
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
- dispose() {
- if (!this._isAppended) {
- return;
- }
- EventHandler.off(this._element, EVENT_MOUSEDOWN);
- this._element.remove();
- this._isAppended = false;
- }
_emulateAnimation(callback) {
executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
}
};
- var NAME$6 = "modal";
- var DATA_KEY$6 = "bs.modal";
- var EVENT_KEY$6 = `.${DATA_KEY$6}`;
- var DATA_API_KEY$3 = ".data-api";
- var ESCAPE_KEY$1 = "Escape";
- var Default$5 = {
- backdrop: true,
- keyboard: true,
- focus: true
+ var NAME$8 = "focustrap";
+ var DATA_KEY$5 = "bs.focustrap";
+ var EVENT_KEY$5 = `.${DATA_KEY$5}`;
+ var EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
+ var EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
+ var TAB_KEY = "Tab";
+ var TAB_NAV_FORWARD = "forward";
+ var TAB_NAV_BACKWARD = "backward";
+ var Default$7 = {
+ autofocus: true,
+ trapElement: null
};
- var DefaultType$5 = {
- backdrop: "(boolean|string)",
- keyboard: "boolean",
- focus: "boolean"
+ var DefaultType$7 = {
+ autofocus: "boolean",
+ trapElement: "element"
+ };
+ var FocusTrap = class extends Config {
+ constructor(config) {
+ super();
+ this._config = this._getConfig(config);
+ this._isActive = false;
+ this._lastTabNavDirection = null;
+ }
+ static get Default() {
+ return Default$7;
+ }
+ static get DefaultType() {
+ return DefaultType$7;
+ }
+ static get NAME() {
+ return NAME$8;
+ }
+ activate() {
+ if (this._isActive) {
+ return;
+ }
+ if (this._config.autofocus) {
+ this._config.trapElement.focus();
+ }
+ EventHandler.off(document, EVENT_KEY$5);
+ 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);
+ }
+ _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;
+ }
+ };
+ var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";
+ var SELECTOR_STICKY_CONTENT = ".sticky-top";
+ var PROPERTY_PADDING = "padding-right";
+ var PROPERTY_MARGIN = "margin-right";
+ var ScrollBarHelper = class {
+ constructor() {
+ this._element = document.body;
+ }
+ getWidth() {
+ const documentWidth = document.documentElement.clientWidth;
+ return Math.abs(window.innerWidth - documentWidth);
+ }
+ hide() {
+ const width = this.getWidth();
+ this._disableOverFlow();
+ this._setElementAttributes(this._element, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width);
+ 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;
+ }
+ _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);
+ 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 (isElement2(selector)) {
+ callBack(selector);
+ return;
+ }
+ for (const sel of SelectorEngine.find(selector, this._element)) {
+ callBack(sel);
+ }
+ }
};
- var EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
- var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`;
- var EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
- var EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
- var EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
- var EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$6}`;
- var EVENT_RESIZE = `resize${EVENT_KEY$6}`;
- var EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
- var EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
- var EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
- var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
- var EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var NAME$7 = "modal";
+ var DATA_KEY$4 = "bs.modal";
+ var EVENT_KEY$4 = `.${DATA_KEY$4}`;
+ var DATA_API_KEY$2 = ".data-api";
+ var ESCAPE_KEY$1 = "Escape";
+ var EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
+ var EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
+ var EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
+ var EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
+ var EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
+ var EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
+ var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
+ var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
+ var EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
+ var EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
var CLASS_NAME_OPEN = "modal-open";
- var CLASS_NAME_FADE$4 = "fade";
- var CLASS_NAME_SHOW$5 = "show";
+ var CLASS_NAME_FADE$3 = "fade";
+ var CLASS_NAME_SHOW$4 = "show";
var CLASS_NAME_STATIC = "modal-static";
+ var OPEN_SELECTOR$1 = ".modal.show";
var SELECTOR_DIALOG = ".modal-dialog";
var SELECTOR_MODAL_BODY = ".modal-body";
var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
- var SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
+ var Default$6 = {
+ backdrop: true,
+ focus: true,
+ keyboard: true
+ };
+ var DefaultType$6 = {
+ backdrop: "(boolean|string)",
+ focus: "boolean",
+ keyboard: "boolean"
+ };
var Modal = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
this._backdrop = this._initializeBackDrop();
+ this._focustrap = this._initializeFocusTrap();
this._isShown = false;
- this._ignoreBackdropClick = false;
this._isTransitioning = false;
this._scrollBar = new ScrollBarHelper();
+ this._addEventListeners();
}
- // Getters
static get Default() {
- return Default$5;
+ return Default$6;
+ }
+ static get DefaultType() {
+ return DefaultType$6;
}
static get NAME() {
- return NAME$6;
+ return NAME$7;
}
- // Public
toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
}
@@ -3557,141 +3414,110 @@
if (this._isShown || this._isTransitioning) {
return;
}
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
relatedTarget
});
if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
- if (this._isAnimated()) {
- this._isTransitioning = true;
- }
+ this._isTransitioning = true;
this._scrollBar.hide();
document.body.classList.add(CLASS_NAME_OPEN);
this._adjustDialog();
- this._setEscapeEvent();
- this._setResizeEvent();
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, (event) => this.hide(event));
- EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
- EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, (event) => {
- if (event.target === this._element) {
- this._ignoreBackdropClick = true;
- }
- });
- });
- this._showBackdrop(() => this._showElement(relatedTarget));
+ this._backdrop.show(() => this._showElement(relatedTarget));
}
- hide(event) {
- if (event && ["A", "AREA"].includes(event.target.tagName)) {
- event.preventDefault();
- }
+ hide() {
if (!this._isShown || this._isTransitioning) {
return;
}
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
if (hideEvent.defaultPrevented) {
return;
}
this._isShown = false;
- const isAnimated = this._isAnimated();
- if (isAnimated) {
- this._isTransitioning = true;
- }
- this._setEscapeEvent();
- this._setResizeEvent();
- EventHandler.off(document, EVENT_FOCUSIN$2);
- this._element.classList.remove(CLASS_NAME_SHOW$5);
- EventHandler.off(this._element, EVENT_CLICK_DISMISS$2);
- EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
- this._queueCallback(() => this._hideModal(), this._element, isAnimated);
+ this._isTransitioning = true;
+ this._focustrap.deactivate();
+ this._element.classList.remove(CLASS_NAME_SHOW$4);
+ this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
}
dispose() {
- [window, this._dialog].forEach((htmlElement) => EventHandler.off(htmlElement, EVENT_KEY$6));
+ EventHandler.off(window, EVENT_KEY$4);
+ EventHandler.off(this._dialog, EVENT_KEY$4);
this._backdrop.dispose();
+ this._focustrap.deactivate();
super.dispose();
- EventHandler.off(document, EVENT_FOCUSIN$2);
}
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()
});
}
- _getConfig(config) {
- config = {
- ...Default$5,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$6, config, DefaultType$5);
- return config;
+ _initializeFocusTrap() {
+ return new FocusTrap({
+ trapElement: this._element
+ });
}
_showElement(relatedTarget) {
- const isAnimated = this._isAnimated();
- const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
- if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
- document.body.appendChild(this._element);
+ 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;
}
- if (isAnimated) {
- reflow(this._element);
- }
- this._element.classList.add(CLASS_NAME_SHOW$5);
- if (this._config.focus) {
- this._enforceFocus();
- }
+ reflow(this._element);
+ this._element.classList.add(CLASS_NAME_SHOW$4);
const transitionComplete = () => {
if (this._config.focus) {
- this._element.focus();
+ this._focustrap.activate();
}
this._isTransitioning = false;
- EventHandler.trigger(this._element, EVENT_SHOWN$3, {
+ EventHandler.trigger(this._element, EVENT_SHOWN$4, {
relatedTarget
});
};
- this._queueCallback(transitionComplete, this._dialog, isAnimated);
+ this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
}
- _enforceFocus() {
- EventHandler.off(document, EVENT_FOCUSIN$2);
- EventHandler.on(document, EVENT_FOCUSIN$2, (event) => {
- if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
- this._element.focus();
+ _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();
});
- }
- _setEscapeEvent() {
- if (this._isShown) {
- EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, (event) => {
- if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
- event.preventDefault();
- this.hide();
- } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) {
+ EventHandler.on(window, EVENT_RESIZE$1, () => {
+ if (this._isShown && !this._isTransitioning) {
+ this._adjustDialog();
+ }
+ });
+ EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, (event) => {
+ 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();
}
});
- } else {
- EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
- }
- }
- _setResizeEvent() {
- if (this._isShown) {
- EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
- } else {
- EventHandler.off(window, EVENT_RESIZE);
- }
+ });
}
_hideModal() {
this._element.style.display = "none";
@@ -3703,76 +3529,51 @@
document.body.classList.remove(CLASS_NAME_OPEN);
this._resetAdjustments();
this._scrollBar.reset();
- EventHandler.trigger(this._element, EVENT_HIDDEN$3);
- });
- }
- _showBackdrop(callback) {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, (event) => {
- if (this._ignoreBackdropClick) {
- this._ignoreBackdropClick = false;
- return;
- }
- if (event.target !== event.currentTarget) {
- return;
- }
- if (this._config.backdrop === true) {
- this.hide();
- } else if (this._config.backdrop === "static") {
- this._triggerBackdropTransition();
- }
+ EventHandler.trigger(this._element, EVENT_HIDDEN$4);
});
- this._backdrop.show(callback);
}
_isAnimated() {
- return this._element.classList.contains(CLASS_NAME_FADE$4);
+ return this._element.classList.contains(CLASS_NAME_FADE$3);
}
_triggerBackdropTransition() {
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
if (hideEvent.defaultPrevented) {
return;
}
- const {
- classList,
- scrollHeight,
- style
- } = this._element;
- const isModalOverflowing = scrollHeight > document.documentElement.clientHeight;
- if (!isModalOverflowing && style.overflowY === "hidden" || classList.contains(CLASS_NAME_STATIC)) {
+ const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
+ const initialOverflowY = this._element.style.overflowY;
+ if (initialOverflowY === "hidden" || this._element.classList.contains(CLASS_NAME_STATIC)) {
return;
}
if (!isModalOverflowing) {
- style.overflowY = "hidden";
+ this._element.style.overflowY = "hidden";
}
- classList.add(CLASS_NAME_STATIC);
+ this._element.classList.add(CLASS_NAME_STATIC);
this._queueCallback(() => {
- classList.remove(CLASS_NAME_STATIC);
- if (!isModalOverflowing) {
- this._queueCallback(() => {
- style.overflowY = "";
- }, this._dialog);
- }
+ 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 && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
- this._element.style.paddingLeft = `${scrollbarWidth}px`;
+ if (isBodyOverflowing && !isModalOverflowing) {
+ const property = isRTL() ? "paddingLeft" : "paddingRight";
+ this._element.style[property] = `${scrollbarWidth}px`;
}
- if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
- this._element.style.paddingRight = `${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);
@@ -3787,68 +3588,76 @@
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function(event) {
- const target = getElementFromSelector(this);
+ const target = SelectorEngine.getElementFromSelector(this);
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
- EventHandler.one(target, EVENT_SHOW$3, (showEvent) => {
+ EventHandler.one(target, EVENT_SHOW$4, (showEvent) => {
if (showEvent.defaultPrevented) {
return;
}
- EventHandler.one(target, EVENT_HIDDEN$3, () => {
+ EventHandler.one(target, EVENT_HIDDEN$4, () => {
if (isVisible(this)) {
this.focus();
}
});
});
+ const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
+ if (alreadyOpen) {
+ Modal.getInstance(alreadyOpen).hide();
+ }
const data = Modal.getOrCreateInstance(target);
data.toggle(this);
});
+ enableDismissTrigger(Modal);
defineJQueryPlugin(Modal);
- var NAME$5 = "offcanvas";
- var DATA_KEY$5 = "bs.offcanvas";
- var EVENT_KEY$5 = `.${DATA_KEY$5}`;
- var DATA_API_KEY$2 = ".data-api";
- var EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`;
+ var NAME$6 = "offcanvas";
+ var DATA_KEY$3 = "bs.offcanvas";
+ var EVENT_KEY$3 = `.${DATA_KEY$3}`;
+ var DATA_API_KEY$1 = ".data-api";
+ var EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
var ESCAPE_KEY = "Escape";
- var Default$4 = {
+ var CLASS_NAME_SHOW$3 = "show";
+ var CLASS_NAME_SHOWING$1 = "showing";
+ var CLASS_NAME_HIDING = "hiding";
+ var CLASS_NAME_BACKDROP = "offcanvas-backdrop";
+ var OPEN_SELECTOR = ".offcanvas.show";
+ var EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
+ var EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
+ var EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
+ var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
+ var EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
+ var EVENT_RESIZE = `resize${EVENT_KEY$3}`;
+ var EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
+ var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
+ var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
+ var Default$5 = {
backdrop: true,
keyboard: true,
scroll: false
};
- var DefaultType$4 = {
- backdrop: "boolean",
+ var DefaultType$5 = {
+ backdrop: "(boolean|string)",
keyboard: "boolean",
scroll: "boolean"
};
- var CLASS_NAME_SHOW$4 = "show";
- var OPEN_SELECTOR = ".offcanvas.show";
- var EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
- var EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
- var EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
- var EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
- var EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$5}`;
- var EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
- var EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
- var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
- var SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
- var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
var Offcanvas = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._isShown = false;
this._backdrop = this._initializeBackDrop();
+ this._focustrap = this._initializeFocusTrap();
this._addEventListeners();
}
- // Getters
- static get NAME() {
- return NAME$5;
- }
static get Default() {
- return Default$4;
+ 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);
}
@@ -3856,25 +3665,27 @@
if (this._isShown) {
return;
}
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
relatedTarget
});
if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
- this._element.style.visibility = "visible";
this._backdrop.show();
if (!this._config.scroll) {
new ScrollBarHelper().hide();
- this._enforceFocusOnElement(this._element);
}
- this._element.removeAttribute("aria-hidden");
this._element.setAttribute("aria-modal", true);
this._element.setAttribute("role", "dialog");
- this._element.classList.add(CLASS_NAME_SHOW$4);
+ this._element.classList.add(CLASS_NAME_SHOWING$1);
const completeCallBack = () => {
- EventHandler.trigger(this._element, EVENT_SHOWN$2, {
+ 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
});
};
@@ -3884,68 +3695,65 @@
if (!this._isShown) {
return;
}
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
if (hideEvent.defaultPrevented) {
return;
}
- EventHandler.off(document, EVENT_FOCUSIN$1);
+ this._focustrap.deactivate();
this._element.blur();
this._isShown = false;
- this._element.classList.remove(CLASS_NAME_SHOW$4);
+ this._element.classList.add(CLASS_NAME_HIDING);
this._backdrop.hide();
const completeCallback = () => {
- this._element.setAttribute("aria-hidden", true);
+ this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
this._element.removeAttribute("aria-modal");
this._element.removeAttribute("role");
- this._element.style.visibility = "hidden";
if (!this._config.scroll) {
new ScrollBarHelper().reset();
}
- EventHandler.trigger(this._element, EVENT_HIDDEN$2);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$3);
};
this._queueCallback(completeCallback, this._element, true);
}
dispose() {
this._backdrop.dispose();
+ this._focustrap.deactivate();
super.dispose();
- EventHandler.off(document, EVENT_FOCUSIN$1);
- }
- // Private
- _getConfig(config) {
- config = {
- ...Default$4,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$5, config, DefaultType$4);
- return config;
}
_initializeBackDrop() {
+ const clickCallback = () => {
+ if (this._config.backdrop === "static") {
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
+ return;
+ }
+ this.hide();
+ };
+ const isVisible2 = Boolean(this._config.backdrop);
return new Backdrop({
- isVisible: this._config.backdrop,
+ className: CLASS_NAME_BACKDROP,
+ isVisible: isVisible2,
isAnimated: true,
rootElement: this._element.parentNode,
- clickCallback: () => this.hide()
+ clickCallback: isVisible2 ? clickCallback : null
});
}
- _enforceFocusOnElement(element) {
- EventHandler.off(document, EVENT_FOCUSIN$1);
- EventHandler.on(document, EVENT_FOCUSIN$1, (event) => {
- if (document !== event.target && element !== event.target && !element.contains(event.target)) {
- element.focus();
- }
+ _initializeFocusTrap() {
+ return new FocusTrap({
+ trapElement: this._element
});
- element.focus();
}
_addEventListeners() {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, (event) => {
- if (this._config.keyboard && event.key === ESCAPE_KEY) {
+ 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);
@@ -3960,49 +3768,41 @@
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function(event) {
- const target = getElementFromSelector(this);
+ const target = SelectorEngine.getElementFromSelector(this);
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
- EventHandler.one(target, EVENT_HIDDEN$2, () => {
+ EventHandler.one(target, EVENT_HIDDEN$3, () => {
if (isVisible(this)) {
this.focus();
}
});
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
- if (allReadyOpen && allReadyOpen !== target) {
- Offcanvas.getInstance(allReadyOpen).hide();
+ 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$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach((el) => Offcanvas.getOrCreateInstance(el).show()));
- defineJQueryPlugin(Offcanvas);
- var uriAttrs = /* @__PURE__ */ new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]);
- var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
- var 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;
- var allowedAttribute = (attr, allowedAttributeList) => {
- const attrName = attr.nodeName.toLowerCase();
- if (allowedAttributeList.includes(attrName)) {
- if (uriAttrs.has(attrName)) {
- return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
- }
- return true;
+ EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
+ for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
+ Offcanvas.getOrCreateInstance(selector).show();
}
- const regExp = allowedAttributeList.filter((attrRegex) => attrRegex instanceof RegExp);
- for (let i = 0, len = regExp.length; i < len; i++) {
- if (regExp[i].test(attrName)) {
- return true;
+ });
+ 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();
}
}
- return false;
- };
+ });
+ enableDismissTrigger(Offcanvas);
+ defineJQueryPlugin(Offcanvas);
+ var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
var DefaultAllowlist = {
- // Global attributes allowed on any supplied element below.
"*": ["class", "dir", "id", "lang", "role", ARIA_ATTRIBUTE_PATTERN],
a: ["target", "href", "title", "rel"],
area: [],
@@ -4010,7 +3810,10 @@
br: [],
col: [],
code: [],
+ dd: [],
div: [],
+ dl: [],
+ dt: [],
em: [],
hr: [],
h1: [],
@@ -4034,59 +3837,177 @@
u: [],
ul: []
};
- function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
+ var uriAttributes = new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]);
+ var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
+ var 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;
+ }
+ return allowedAttributeList.filter((attributeRegex) => attributeRegex instanceof RegExp).some((regex) => regex.test(attributeName));
+ };
+ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
if (!unsafeHtml.length) {
return unsafeHtml;
}
- if (sanitizeFn && typeof sanitizeFn === "function") {
- return sanitizeFn(unsafeHtml);
+ if (sanitizeFunction && typeof sanitizeFunction === "function") {
+ return sanitizeFunction(unsafeHtml);
}
const domParser = new window.DOMParser();
const createdDocument = domParser.parseFromString(unsafeHtml, "text/html");
- const allowlistKeys = Object.keys(allowList);
const elements = [].concat(...createdDocument.body.querySelectorAll("*"));
- for (let i = 0, len = elements.length; i < len; i++) {
- const el = elements[i];
- const elName = el.nodeName.toLowerCase();
- if (!allowlistKeys.includes(elName)) {
- el.remove();
+ for (const element of elements) {
+ const elementName = element.nodeName.toLowerCase();
+ if (!Object.keys(allowList).includes(elementName)) {
+ element.remove();
continue;
}
- const attributeList = [].concat(...el.attributes);
- const allowedAttributes = [].concat(allowList["*"] || [], allowList[elName] || []);
- attributeList.forEach((attr) => {
- if (!allowedAttribute(attr, allowedAttributes)) {
- el.removeAttribute(attr.nodeName);
+ 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;
}
- var NAME$4 = "tooltip";
- var DATA_KEY$4 = "bs.tooltip";
- var EVENT_KEY$4 = `.${DATA_KEY$4}`;
- var CLASS_PREFIX$1 = "bs-tooltip";
- var BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, "g");
- var DISALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set(["sanitize", "allowList", "sanitizeFn"]);
- var DefaultType$3 = {
- animation: "boolean",
- template: "string",
- title: "(string|element|function)",
- trigger: "string",
- delay: "(number|object)",
+ var NAME$5 = "TemplateFactory";
+ var Default$4 = {
+ allowList: DefaultAllowlist,
+ content: {},
+ extraClass: "",
+ html: false,
+ sanitize: true,
+ sanitizeFn: null,
+ template: ""
+ };
+ var DefaultType$4 = {
+ allowList: "object",
+ content: "object",
+ extraClass: "(string|function)",
html: "boolean",
- selector: "(string|boolean)",
- placement: "(string|function)",
- offset: "(array|string|function)",
- container: "(string|element|boolean)",
- fallbackPlacements: "array",
- boundary: "(string|element)",
- customClass: "(string|function)",
sanitize: "boolean",
sanitizeFn: "(null|function)",
- allowList: "object",
- popperConfig: "(null|object|function)"
+ template: "string"
+ };
+ var DefaultContentType = {
+ entry: "(string|element|function|null)",
+ selector: "(string|element)"
+ };
+ var TemplateFactory = class extends Config {
+ constructor(config) {
+ super();
+ this._config = this._getConfig(config);
+ }
+ static get Default() {
+ return Default$4;
+ }
+ static get DefaultType() {
+ return DefaultType$4;
+ }
+ static get NAME() {
+ return NAME$5;
+ }
+ 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 (isElement2(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, [this]);
+ }
+ _putElementInTemplate(element, templateElement) {
+ if (this._config.html) {
+ templateElement.innerHTML = "";
+ templateElement.append(element);
+ return;
+ }
+ templateElement.textContent = element.textContent;
+ }
};
+ var NAME$4 = "tooltip";
+ var DISALLOWED_ATTRIBUTES = new Set(["sanitize", "allowList", "sanitizeFn"]);
+ var CLASS_NAME_FADE$2 = "fade";
+ var CLASS_NAME_MODAL = "modal";
+ var CLASS_NAME_SHOW$2 = "show";
+ var SELECTOR_TOOLTIP_INNER = ".tooltip-inner";
+ var SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
+ var EVENT_MODAL_HIDE = "hide.bs.modal";
+ var TRIGGER_HOVER = "hover";
+ var TRIGGER_FOCUS = "focus";
+ var TRIGGER_CLICK = "click";
+ var TRIGGER_MANUAL = "manual";
+ var EVENT_HIDE$2 = "hide";
+ var EVENT_HIDDEN$2 = "hidden";
+ var EVENT_SHOW$2 = "show";
+ var EVENT_SHOWN$2 = "shown";
+ var EVENT_INSERTED = "inserted";
+ var EVENT_CLICK$1 = "click";
+ var EVENT_FOCUSIN$1 = "focusin";
+ var EVENT_FOCUSOUT$1 = "focusout";
+ var EVENT_MOUSEENTER = "mouseenter";
+ var EVENT_MOUSELEAVE = "mouseleave";
var AttachmentMap = {
AUTO: "auto",
TOP: "top",
@@ -4095,75 +4016,71 @@
LEFT: isRTL() ? "right" : "left"
};
var Default$3 = {
+ allowList: DefaultAllowlist,
animation: true,
- template: '',
- trigger: "hover focus",
- title: "",
+ boundary: "clippingParents",
+ container: false,
+ customClass: "",
delay: 0,
+ fallbackPlacements: ["top", "right", "bottom", "left"],
html: false,
- selector: false,
+ offset: [0, 6],
placement: "top",
- offset: [0, 0],
- container: false,
- fallbackPlacements: ["top", "right", "bottom", "left"],
- boundary: "clippingParents",
- customClass: "",
+ popperConfig: null,
sanitize: true,
sanitizeFn: null,
- allowList: DefaultAllowlist,
- popperConfig: null
+ selector: false,
+ template: '',
+ title: "",
+ trigger: "hover focus"
};
- var Event$2 = {
- HIDE: `hide${EVENT_KEY$4}`,
- HIDDEN: `hidden${EVENT_KEY$4}`,
- SHOW: `show${EVENT_KEY$4}`,
- SHOWN: `shown${EVENT_KEY$4}`,
- INSERTED: `inserted${EVENT_KEY$4}`,
- CLICK: `click${EVENT_KEY$4}`,
- FOCUSIN: `focusin${EVENT_KEY$4}`,
- FOCUSOUT: `focusout${EVENT_KEY$4}`,
- MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
- MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
+ var 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"
};
- var CLASS_NAME_FADE$3 = "fade";
- var CLASS_NAME_MODAL = "modal";
- var CLASS_NAME_SHOW$3 = "show";
- var HOVER_STATE_SHOW = "show";
- var HOVER_STATE_OUT = "out";
- var SELECTOR_TOOLTIP_INNER = ".tooltip-inner";
- var TRIGGER_HOVER = "hover";
- var TRIGGER_FOCUS = "focus";
- var TRIGGER_CLICK = "click";
- var TRIGGER_MANUAL = "manual";
var Tooltip = class extends BaseComponent {
constructor(element, config) {
if (typeof lib_exports === "undefined") {
throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");
}
- super(element);
+ super(element, config);
this._isEnabled = true;
this._timeout = 0;
- this._hoverState = "";
+ this._isHovered = null;
this._activeTrigger = {};
this._popper = null;
- this._config = this._getConfig(config);
+ this._templateFactory = null;
+ this._newContent = null;
this.tip = null;
this._setListeners();
+ if (!this._config.selector) {
+ this._fixTitle();
+ }
}
- // Getters
static get Default() {
return Default$3;
}
- static get NAME() {
- return NAME$4;
- }
- static get Event() {
- return Event$2;
- }
static get DefaultType() {
return DefaultType$3;
}
- // Public
+ static get NAME() {
+ return NAME$4;
+ }
enable() {
this._isEnabled = true;
}
@@ -4173,216 +4090,180 @@
toggleEnabled() {
this._isEnabled = !this._isEnabled;
}
- toggle(event) {
+ toggle() {
if (!this._isEnabled) {
return;
}
- if (event) {
- const context = this._initializeOnDelegatedTarget(event);
- context._activeTrigger.click = !context._activeTrigger.click;
- if (context._isWithActiveTrigger()) {
- context._enter(null, context);
- } else {
- context._leave(null, context);
- }
- } else {
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
- this._leave(null, this);
- return;
- }
- this._enter(null, this);
+ this._activeTrigger.click = !this._activeTrigger.click;
+ if (this._isShown()) {
+ this._leave();
+ return;
}
+ this._enter();
}
dispose() {
clearTimeout(this._timeout);
- EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), "hide.bs.modal", this._hideModalHandler);
- if (this.tip) {
- this.tip.remove();
- }
- if (this._popper) {
- this._popper.destroy();
+ 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)) {
+ if (!(this._isWithContent() && this._isEnabled)) {
return;
}
- const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
+ const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
const shadowRoot = findShadowRoot(this._element);
- const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
+ const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
if (showEvent.defaultPrevented || !isInTheDom) {
return;
}
- const tip = this.getTipElement();
- const tipId = getUID(this.constructor.NAME);
- tip.setAttribute("id", tipId);
- this._element.setAttribute("aria-describedby", tipId);
- this.setContent();
- if (this._config.animation) {
- tip.classList.add(CLASS_NAME_FADE$3);
- }
- const placement = typeof this._config.placement === "function" ? this._config.placement.call(this, tip, this._element) : this._config.placement;
- const attachment = this._getAttachment(placement);
- this._addAttachmentClass(attachment);
+ this._disposePopper();
+ const tip = this._getTipElement();
+ this._element.setAttribute("aria-describedby", tip.getAttribute("id"));
const {
container
} = this._config;
- Data.set(tip, this.constructor.DATA_KEY, this);
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
- container.appendChild(tip);
- EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
- }
- if (this._popper) {
- this._popper.update();
- } else {
- this._popper = createPopper3(this._element, tip, this._getPopperConfig(attachment));
- }
- tip.classList.add(CLASS_NAME_SHOW$3);
- const customClass = typeof this._config.customClass === "function" ? this._config.customClass() : this._config.customClass;
- if (customClass) {
- tip.classList.add(...customClass.split(" "));
+ 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 ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((element) => {
+ for (const element of [].concat(...document.body.children)) {
EventHandler.on(element, "mouseover", noop);
- });
+ }
}
const complete = () => {
- const prevHoverState = this._hoverState;
- this._hoverState = null;
- EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
- if (prevHoverState === HOVER_STATE_OUT) {
- this._leave(null, this);
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
+ if (this._isHovered === false) {
+ this._leave();
}
+ this._isHovered = false;
};
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
- this._queueCallback(complete, this.tip, isAnimated);
+ this._queueCallback(complete, this.tip, this._isAnimated());
}
hide() {
- if (!this._popper) {
+ if (!this._isShown()) {
return;
}
- const tip = this.getTipElement();
- const complete = () => {
- if (this._isWithActiveTrigger()) {
- return;
- }
- if (this._hoverState !== HOVER_STATE_SHOW) {
- tip.remove();
- }
- this._cleanTipClass();
- this._element.removeAttribute("aria-describedby");
- EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
- if (this._popper) {
- this._popper.destroy();
- this._popper = null;
- }
- };
- const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
+ const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
if (hideEvent.defaultPrevented) {
return;
}
- tip.classList.remove(CLASS_NAME_SHOW$3);
+ const tip = this._getTipElement();
+ tip.classList.remove(CLASS_NAME_SHOW$2);
if ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((element) => EventHandler.off(element, "mouseover", noop));
+ 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;
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
- this._queueCallback(complete, this.tip, isAnimated);
- this._hoverState = "";
+ this._isHovered = null;
+ 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 !== null) {
+ if (this._popper) {
this._popper.update();
}
}
- // Protected
- isWithContent() {
- return Boolean(this.getTitle());
+ _isWithContent() {
+ return Boolean(this._getTitle());
}
- getTipElement() {
- if (this.tip) {
- return this.tip;
+ _getTipElement() {
+ if (!this.tip) {
+ this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
}
- const element = document.createElement("div");
- element.innerHTML = this._config.template;
- this.tip = element.children[0];
return this.tip;
}
- setContent() {
- const tip = this.getTipElement();
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
- tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
- }
- setElementContent(element, content) {
- if (element === null) {
- return;
- }
- if (isElement2(content)) {
- content = getElement(content);
- if (this._config.html) {
- if (content.parentNode !== element) {
- element.innerHTML = "";
- element.appendChild(content);
- }
- } else {
- element.textContent = content.textContent;
- }
- return;
+ _createTipElement(content) {
+ const tip = this._getTemplateFactory(content).toHtml();
+ if (!tip) {
+ return null;
}
- if (this._config.html) {
- if (this._config.sanitize) {
- content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
- }
- element.innerHTML = content;
- } else {
- element.textContent = content;
+ tip.classList.remove(CLASS_NAME_FADE$2, 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._isAnimated()) {
+ tip.classList.add(CLASS_NAME_FADE$2);
}
+ return tip;
}
- getTitle() {
- let title = this._element.getAttribute("data-bs-original-title");
- if (!title) {
- title = typeof this._config.title === "function" ? this._config.title.call(this._element) : this._config.title;
+ setContent(content) {
+ this._newContent = content;
+ if (this._isShown()) {
+ this._disposePopper();
+ this.show();
}
- return title;
}
- updateAttachment(attachment) {
- if (attachment === "right") {
- return "end";
- }
- if (attachment === "left") {
- return "start";
+ _getTemplateFactory(content) {
+ if (this._templateFactory) {
+ this._templateFactory.changeContent(content);
+ } else {
+ this._templateFactory = new TemplateFactory({
+ ...this._config,
+ content,
+ extraClass: this._resolvePossibleFunction(this._config.customClass)
+ });
}
- return attachment;
+ return this._templateFactory;
}
- // Private
- _initializeOnDelegatedTarget(event, context) {
- const dataKey = this.constructor.DATA_KEY;
- context = context || Data.get(event.delegateTarget, dataKey);
- if (!context) {
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
- Data.set(event.delegateTarget, dataKey, context);
- }
- return context;
+ _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());
+ }
+ _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 createPopper3(this._element, tip, this._getPopperConfig(attachment));
}
_getOffset() {
const {
offset: offset2
} = this._config;
if (typeof offset2 === "string") {
- return offset2.split(",").map((val) => Number.parseInt(val, 10));
+ return offset2.split(",").map((value) => Number.parseInt(value, 10));
}
if (typeof offset2 === "function") {
return (popperData) => offset2(popperData, this._element);
}
return offset2;
}
+ _resolvePossibleFunction(arg) {
+ return execute(arg, [this._element]);
+ }
_getPopperConfig(attachment) {
const defaultBsPopperConfig = {
placement: attachment,
@@ -4407,128 +4288,107 @@
element: `.${this.constructor.NAME}-arrow`
}
}, {
- name: "onChange",
+ name: "preSetPlacement",
enabled: true,
- phase: "afterWrite",
- fn: (data) => this._handlePopperPlacementChange(data)
- }],
- onFirstUpdate: (data) => {
- if (data.options.placement !== data.placement) {
- this._handlePopperPlacementChange(data);
+ phase: "beforeMain",
+ fn: (data) => {
+ this._getTipElement().setAttribute("data-popper-placement", data.state.placement);
}
- }
+ }]
};
return {
...defaultBsPopperConfig,
- ...typeof this._config.popperConfig === "function" ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
};
}
- _addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`);
- }
- _getAttachment(placement) {
- return AttachmentMap[placement.toUpperCase()];
- }
_setListeners() {
const triggers = this._config.trigger.split(" ");
- triggers.forEach((trigger) => {
+ for (const trigger of triggers) {
if (trigger === "click") {
- EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, (event) => this.toggle(event));
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, (event) => {
+ const context = this._initializeOnDelegatedTarget(event);
+ context.toggle();
+ });
} else if (trigger !== TRIGGER_MANUAL) {
- const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
- const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
- EventHandler.on(this._element, eventIn, this._config.selector, (event) => this._enter(event));
- EventHandler.on(this._element, eventOut, this._config.selector, (event) => this._leave(event));
+ 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(`.${CLASS_NAME_MODAL}`), "hide.bs.modal", this._hideModalHandler);
- if (this._config.selector) {
- this._config = {
- ...this._config,
- trigger: "manual",
- selector: ""
- };
- } else {
- this._fixTitle();
- }
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
}
_fixTitle() {
const title = this._element.getAttribute("title");
- const originalTitleType = typeof this._element.getAttribute("data-bs-original-title");
- if (title || originalTitleType !== "string") {
- this._element.setAttribute("data-bs-original-title", title || "");
- if (title && !this._element.getAttribute("aria-label") && !this._element.textContent) {
- this._element.setAttribute("aria-label", title);
- }
- this._element.setAttribute("title", "");
- }
- }
- _enter(event, context) {
- context = this._initializeOnDelegatedTarget(event, context);
- if (event) {
- context._activeTrigger[event.type === "focusin" ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
- }
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
- context._hoverState = HOVER_STATE_SHOW;
+ if (!title) {
return;
}
- clearTimeout(context._timeout);
- context._hoverState = HOVER_STATE_SHOW;
- if (!context._config.delay || !context._config.delay.show) {
- context.show();
- return;
+ if (!this._element.getAttribute("aria-label") && !this._element.textContent.trim()) {
+ this._element.setAttribute("aria-label", title);
}
- context._timeout = setTimeout(() => {
- if (context._hoverState === HOVER_STATE_SHOW) {
- context.show();
- }
- }, context._config.delay.show);
+ this._element.setAttribute("data-bs-original-title", title);
+ this._element.removeAttribute("title");
}
- _leave(event, context) {
- context = this._initializeOnDelegatedTarget(event, context);
- if (event) {
- context._activeTrigger[event.type === "focusout" ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
- }
- if (context._isWithActiveTrigger()) {
+ _enter() {
+ if (this._isShown() || this._isHovered) {
+ this._isHovered = true;
return;
}
- clearTimeout(context._timeout);
- context._hoverState = HOVER_STATE_OUT;
- if (!context._config.delay || !context._config.delay.hide) {
- context.hide();
+ this._isHovered = true;
+ this._setTimeout(() => {
+ if (this._isHovered) {
+ this.show();
+ }
+ }, this._config.delay.show);
+ }
+ _leave() {
+ if (this._isWithActiveTrigger()) {
return;
}
- context._timeout = setTimeout(() => {
- if (context._hoverState === HOVER_STATE_OUT) {
- context.hide();
+ this._isHovered = false;
+ this._setTimeout(() => {
+ if (!this._isHovered) {
+ this.hide();
}
- }, context._config.delay.hide);
+ }, this._config.delay.hide);
+ }
+ _setTimeout(handler, timeout) {
+ clearTimeout(this._timeout);
+ this._timeout = setTimeout(handler, timeout);
}
_isWithActiveTrigger() {
- for (const trigger in this._activeTrigger) {
- if (this._activeTrigger[trigger]) {
- return true;
- }
- }
- return false;
+ return Object.values(this._activeTrigger).includes(true);
}
_getConfig(config) {
const dataAttributes = Manipulator.getDataAttributes(this._element);
- Object.keys(dataAttributes).forEach((dataAttr) => {
- if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
- delete dataAttributes[dataAttr];
+ for (const dataAttribute of Object.keys(dataAttributes)) {
+ if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
+ delete dataAttributes[dataAttribute];
}
- });
+ }
config = {
- ...this.constructor.Default,
...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 = {
@@ -4542,153 +4402,90 @@
if (typeof config.content === "number") {
config.content = config.content.toString();
}
- typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
- if (config.sanitize) {
- config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
- }
return config;
}
_getDelegateConfig() {
const config = {};
- if (this._config) {
- for (const key in this._config) {
- if (this.constructor.Default[key] !== this._config[key]) {
- config[key] = this._config[key];
- }
+ 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;
}
- _cleanTipClass() {
- const tip = this.getTipElement();
- const tabClass = tip.getAttribute("class").match(BSCLS_PREFIX_REGEX$1);
- if (tabClass !== null && tabClass.length > 0) {
- tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
+ _disposePopper() {
+ if (this._popper) {
+ this._popper.destroy();
+ this._popper = null;
}
- }
- _handlePopperPlacementChange(popperData) {
- const {
- state
- } = popperData;
- if (!state) {
- return;
+ if (this.tip) {
+ this.tip.remove();
+ this.tip = null;
}
- this.tip = state.elements.popper;
- this._cleanTipClass();
- this._addAttachmentClass(this._getAttachment(state.placement));
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Tooltip.getOrCreateInstance(this, config);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
+ }
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
}
+ data[config]();
});
}
};
defineJQueryPlugin(Tooltip);
var NAME$3 = "popover";
- var DATA_KEY$3 = "bs.popover";
- var EVENT_KEY$3 = `.${DATA_KEY$3}`;
- var CLASS_PREFIX = "bs-popover";
- var BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, "g");
+ var SELECTOR_TITLE = ".popover-header";
+ var SELECTOR_CONTENT = ".popover-body";
var Default$2 = {
...Tooltip.Default,
- placement: "right",
- offset: [0, 8],
- trigger: "click",
content: "",
- template: ''
+ offset: [0, 8],
+ placement: "right",
+ template: '',
+ trigger: "click"
};
var DefaultType$2 = {
...Tooltip.DefaultType,
- content: "(string|element|function)"
+ content: "(null|string|element|function)"
};
- var Event$1 = {
- HIDE: `hide${EVENT_KEY$3}`,
- HIDDEN: `hidden${EVENT_KEY$3}`,
- SHOW: `show${EVENT_KEY$3}`,
- SHOWN: `shown${EVENT_KEY$3}`,
- INSERTED: `inserted${EVENT_KEY$3}`,
- CLICK: `click${EVENT_KEY$3}`,
- FOCUSIN: `focusin${EVENT_KEY$3}`,
- FOCUSOUT: `focusout${EVENT_KEY$3}`,
- MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
- MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
- };
- var CLASS_NAME_FADE$2 = "fade";
- var CLASS_NAME_SHOW$2 = "show";
- var SELECTOR_TITLE = ".popover-header";
- var SELECTOR_CONTENT = ".popover-body";
var Popover = class extends Tooltip {
- // Getters
static get Default() {
return Default$2;
}
- static get NAME() {
- return NAME$3;
- }
- static get Event() {
- return Event$1;
- }
static get DefaultType() {
return DefaultType$2;
}
- // Overrides
- isWithContent() {
- return this.getTitle() || this._getContent();
- }
- getTipElement() {
- if (this.tip) {
- return this.tip;
- }
- this.tip = super.getTipElement();
- if (!this.getTitle()) {
- SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
- }
- if (!this._getContent()) {
- SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
- }
- return this.tip;
+ static get NAME() {
+ return NAME$3;
}
- setContent() {
- const tip = this.getTipElement();
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
- let content = this._getContent();
- if (typeof content === "function") {
- content = content.call(this._element);
- }
- this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
+ _isWithContent() {
+ return this._getTitle() || this._getContent();
}
- // Private
- _addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
+ _getContentForTemplate() {
+ return {
+ [SELECTOR_TITLE]: this._getTitle(),
+ [SELECTOR_CONTENT]: this._getContent()
+ };
}
_getContent() {
- return this._element.getAttribute("data-bs-content") || this._config.content;
- }
- _cleanTipClass() {
- const tip = this.getTipElement();
- const tabClass = tip.getAttribute("class").match(BSCLS_PREFIX_REGEX);
- if (tabClass !== null && tabClass.length > 0) {
- tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
- }
+ return this._resolvePossibleFunction(this._config.content);
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Popover.getOrCreateInstance(this, config);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
}
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
});
}
};
@@ -4696,296 +4493,401 @@
var NAME$2 = "scrollspy";
var DATA_KEY$2 = "bs.scrollspy";
var EVENT_KEY$2 = `.${DATA_KEY$2}`;
- var DATA_API_KEY$1 = ".data-api";
- var Default$1 = {
- offset: 10,
- method: "auto",
- target: ""
- };
- var DefaultType$1 = {
- offset: "number",
- method: "string",
- target: "(string|element)"
- };
+ var DATA_API_KEY = ".data-api";
var EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
- var EVENT_SCROLL = `scroll${EVENT_KEY$2}`;
- var EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`;
+ var EVENT_CLICK = `click${EVENT_KEY$2}`;
+ var EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
var CLASS_NAME_DROPDOWN_ITEM = "dropdown-item";
var CLASS_NAME_ACTIVE$1 = "active";
var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
- var SELECTOR_NAV_LIST_GROUP$1 = ".nav, .list-group";
+ var SELECTOR_TARGET_LINKS = "[href]";
+ var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group";
var SELECTOR_NAV_LINKS = ".nav-link";
var SELECTOR_NAV_ITEMS = ".nav-item";
var SELECTOR_LIST_ITEMS = ".list-group-item";
- var SELECTOR_DROPDOWN$1 = ".dropdown";
+ var SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
+ var SELECTOR_DROPDOWN = ".dropdown";
var SELECTOR_DROPDOWN_TOGGLE$1 = ".dropdown-toggle";
- var METHOD_OFFSET = "offset";
- var METHOD_POSITION = "position";
+ var Default$1 = {
+ offset: null,
+ rootMargin: "0px 0px -25%",
+ smoothScroll: false,
+ target: null,
+ threshold: [0.1, 0.5, 1]
+ };
+ var DefaultType$1 = {
+ offset: "(number|null)",
+ rootMargin: "string",
+ smoothScroll: "boolean",
+ target: "element",
+ threshold: "array"
+ };
var ScrollSpy = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._scrollElement = this._element.tagName === "BODY" ? window : this._element;
- this._config = this._getConfig(config);
- this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
- this._offsets = [];
- this._targets = [];
+ super(element, config);
+ this._targetLinks = new Map();
+ this._observableSections = new Map();
+ this._rootElement = getComputedStyle(this._element).overflowY === "visible" ? null : this._element;
this._activeTarget = null;
- this._scrollHeight = 0;
- EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
+ this._observer = null;
+ this._previousScrollData = {
+ visibleEntryTop: 0,
+ parentScrollTop: 0
+ };
this.refresh();
- this._process();
}
- // Getters
static get Default() {
return Default$1;
}
+ static get DefaultType() {
+ return DefaultType$1;
+ }
static get NAME() {
return NAME$2;
}
- // Public
refresh() {
- const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
- const offsetMethod = this._config.method === "auto" ? autoMethod : this._config.method;
- const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
- this._offsets = [];
- this._targets = [];
- this._scrollHeight = this._getScrollHeight();
- const targets = SelectorEngine.find(this._selector);
- targets.map((element) => {
- const targetSelector = getSelectorFromElement(element);
- const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
- if (target) {
- const targetBCR = target.getBoundingClientRect();
- if (targetBCR.width || targetBCR.height) {
- return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
- }
- }
- return null;
- }).filter((item) => item).sort((a, b) => a[0] - b[0]).forEach((item) => {
- this._offsets.push(item[0]);
- this._targets.push(item[1]);
- });
+ 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() {
- EventHandler.off(this._scrollElement, EVENT_KEY$2);
+ this._observer.disconnect();
super.dispose();
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$1,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" && config ? config : {}
- };
- if (typeof config.target !== "string" && isElement2(config.target)) {
- let {
- id
- } = config.target;
- if (!id) {
- id = getUID(NAME$2);
- config.target.id = id;
- }
- config.target = `#${id}`;
+ _configAfterMerge(config) {
+ config.target = getElement(config.target) || document.body;
+ 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));
}
- typeCheckConfig(NAME$2, config, DefaultType$1);
return config;
}
- _getScrollTop() {
- return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
- }
- _getScrollHeight() {
- return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
+ _maybeEnableSmoothScroll() {
+ if (!this._config.smoothScroll) {
+ return;
+ }
+ 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;
+ }
+ root.scrollTop = height;
+ }
+ });
}
- _getOffsetHeight() {
- return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
+ _getNewObserver() {
+ const options = {
+ root: this._rootElement,
+ threshold: this._config.threshold,
+ rootMargin: this._config.rootMargin
+ };
+ return new IntersectionObserver((entries) => this._observerCallback(entries), options);
}
- _process() {
- const scrollTop = this._getScrollTop() + this._config.offset;
- const scrollHeight = this._getScrollHeight();
- const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
- if (this._scrollHeight !== scrollHeight) {
- this.refresh();
+ _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 (userScrollsDown && entryIsLowerThanPrevious) {
+ activate(entry);
+ if (!parentScrollTop) {
+ return;
+ }
+ continue;
+ }
+ if (!userScrollsDown && !entryIsLowerThanPrevious) {
+ activate(entry);
+ }
}
- if (scrollTop >= maxScroll) {
- const target = this._targets[this._targets.length - 1];
- if (this._activeTarget !== target) {
- this._activate(target);
+ }
+ _initializeTargetsAndObservables() {
+ this._targetLinks = new Map();
+ this._observableSections = new Map();
+ const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
+ for (const anchor of targetLinks) {
+ if (!anchor.hash || isDisabled(anchor)) {
+ continue;
+ }
+ const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
+ if (isVisible(observableSection)) {
+ this._targetLinks.set(decodeURI(anchor.hash), anchor);
+ this._observableSections.set(anchor.hash, observableSection);
}
+ }
+ }
+ _process(target) {
+ if (this._activeTarget === target) {
return;
}
- if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
- this._activeTarget = null;
- this._clear();
+ 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_DROPDOWN_ITEM)) {
+ SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
return;
}
- for (let i = this._offsets.length; i--; ) {
- const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === "undefined" || scrollTop < this._offsets[i + 1]);
- if (isActiveTarget) {
- this._activate(this._targets[i]);
+ 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);
}
}
}
- _activate(target) {
- this._activeTarget = target;
- this._clear();
- const queries = this._selector.split(",").map((selector) => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
- const link = SelectorEngine.findOne(queries.join(","));
- if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
- SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
- link.classList.add(CLASS_NAME_ACTIVE$1);
- } else {
- link.classList.add(CLASS_NAME_ACTIVE$1);
- SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach((listGroup) => {
- SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach((item) => item.classList.add(CLASS_NAME_ACTIVE$1));
- SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach((navItem) => {
- SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach((item) => 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);
}
- EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
- relatedTarget: target
- });
}
- _clear() {
- SelectorEngine.find(this._selector).filter((node) => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach((node) => node.classList.remove(CLASS_NAME_ACTIVE$1));
- }
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = ScrollSpy.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
- if (typeof data[config] === "undefined") {
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
};
- EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
- SelectorEngine.find(SELECTOR_DATA_SPY).forEach((spy) => new ScrollSpy(spy));
+ EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
+ for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
+ ScrollSpy.getOrCreateInstance(spy);
+ }
});
defineJQueryPlugin(ScrollSpy);
var NAME$1 = "tab";
var DATA_KEY$1 = "bs.tab";
var EVENT_KEY$1 = `.${DATA_KEY$1}`;
- var DATA_API_KEY = ".data-api";
var EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
var EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
var EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
var EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
- var EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`;
- var CLASS_NAME_DROPDOWN_MENU = "dropdown-menu";
+ var EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
+ var EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
+ var EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
+ var ARROW_LEFT_KEY = "ArrowLeft";
+ var ARROW_RIGHT_KEY = "ArrowRight";
+ var ARROW_UP_KEY = "ArrowUp";
+ var ARROW_DOWN_KEY = "ArrowDown";
+ var HOME_KEY = "Home";
+ var END_KEY = "End";
var CLASS_NAME_ACTIVE = "active";
var CLASS_NAME_FADE$1 = "fade";
var CLASS_NAME_SHOW$1 = "show";
- var SELECTOR_DROPDOWN = ".dropdown";
- var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group";
- var SELECTOR_ACTIVE = ".active";
- var SELECTOR_ACTIVE_UL = ":scope > li > .active";
- var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
+ var CLASS_DROPDOWN = "dropdown";
var SELECTOR_DROPDOWN_TOGGLE = ".dropdown-toggle";
- var SELECTOR_DROPDOWN_ACTIVE_CHILD = ":scope > .dropdown-menu .active";
+ var SELECTOR_DROPDOWN_MENU = ".dropdown-menu";
+ var NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`;
+ var SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
+ var SELECTOR_OUTER = ".nav-item, .list-group-item";
+ var SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
+ var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
+ var SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
+ var SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
var Tab = class extends BaseComponent {
- // Getters
+ constructor(element) {
+ super(element);
+ this._parent = this._element.closest(SELECTOR_TAB_PANEL);
+ if (!this._parent) {
+ return;
+ }
+ this._setInitialAttributes(this._parent, this._getChildren());
+ EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event));
+ }
static get NAME() {
return NAME$1;
}
- // Public
show() {
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
+ const innerElem = this._element;
+ if (this._elemIsActive(innerElem)) {
return;
}
- let previous;
- const target = getElementFromSelector(this._element);
- const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
- if (listElement) {
- const itemSelector = listElement.nodeName === "UL" || listElement.nodeName === "OL" ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
- previous = SelectorEngine.find(itemSelector, listElement);
- previous = previous[previous.length - 1];
- }
- const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, {
- relatedTarget: this._element
+ const active = this._getActiveElem();
+ const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
+ relatedTarget: innerElem
}) : null;
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, {
- relatedTarget: previous
+ const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
+ relatedTarget: active
});
- if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
+ if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
+ return;
+ }
+ this._deactivate(active, innerElem);
+ this._activate(innerElem, active);
+ }
+ _activate(element, relatedElem) {
+ if (!element) {
return;
}
- this._activate(this._element, listElement);
+ element.classList.add(CLASS_NAME_ACTIVE);
+ this._activate(SelectorEngine.getElementFromSelector(element));
const complete = () => {
- EventHandler.trigger(previous, EVENT_HIDDEN$1, {
- relatedTarget: this._element
+ if (element.getAttribute("role") !== "tab") {
+ element.classList.add(CLASS_NAME_SHOW$1);
+ return;
+ }
+ element.removeAttribute("tabindex");
+ element.setAttribute("aria-selected", true);
+ this._toggleDropDown(element, true);
+ EventHandler.trigger(element, EVENT_SHOWN$1, {
+ relatedTarget: relatedElem
});
- EventHandler.trigger(this._element, EVENT_SHOWN$1, {
- relatedTarget: previous
+ };
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
+ }
+ _deactivate(element, relatedElem) {
+ if (!element) {
+ return;
+ }
+ element.classList.remove(CLASS_NAME_ACTIVE);
+ element.blur();
+ this._deactivate(SelectorEngine.getElementFromSelector(element));
+ const complete = () => {
+ if (element.getAttribute("role") !== "tab") {
+ element.classList.remove(CLASS_NAME_SHOW$1);
+ return;
+ }
+ element.setAttribute("aria-selected", false);
+ element.setAttribute("tabindex", "-1");
+ this._toggleDropDown(element, false);
+ EventHandler.trigger(element, EVENT_HIDDEN$1, {
+ relatedTarget: relatedElem
});
};
- if (target) {
- this._activate(target, target.parentNode, complete);
- } else {
- complete();
- }
- }
- // Private
- _activate(element, container, callback) {
- const activeElements = container && (container.nodeName === "UL" || container.nodeName === "OL") ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
- const active = activeElements[0];
- const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1);
- const complete = () => this._transitionComplete(element, active, callback);
- if (active && isTransitioning) {
- active.classList.remove(CLASS_NAME_SHOW$1);
- this._queueCallback(complete, element, true);
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
+ }
+ _keydown(event) {
+ if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
+ return;
+ }
+ event.stopPropagation();
+ event.preventDefault();
+ const children = this._getChildren().filter((element) => !isDisabled(element));
+ let nextActiveElement;
+ if ([HOME_KEY, END_KEY].includes(event.key)) {
+ nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
} else {
- complete();
+ 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();
}
}
- _transitionComplete(element, active, callback) {
- if (active) {
- active.classList.remove(CLASS_NAME_ACTIVE);
- const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
- if (dropdownChild) {
- dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
- }
- if (active.getAttribute("role") === "tab") {
- active.setAttribute("aria-selected", false);
- }
+ _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);
}
- element.classList.add(CLASS_NAME_ACTIVE);
- if (element.getAttribute("role") === "tab") {
- element.setAttribute("aria-selected", true);
+ }
+ _setInitialAttributesOnChild(child) {
+ child = this._getInnerElement(child);
+ const isActive = this._elemIsActive(child);
+ const outerElem = this._getOuterElement(child);
+ child.setAttribute("aria-selected", isActive);
+ if (outerElem !== child) {
+ this._setAttributeIfNotExists(outerElem, "role", "presentation");
}
- reflow(element);
- if (element.classList.contains(CLASS_NAME_FADE$1)) {
- element.classList.add(CLASS_NAME_SHOW$1);
+ if (!isActive) {
+ child.setAttribute("tabindex", "-1");
}
- let parent = element.parentNode;
- if (parent && parent.nodeName === "LI") {
- parent = parent.parentNode;
+ this._setAttributeIfNotExists(child, "role", "tab");
+ this._setInitialAttributesOnTargetPanel(child);
+ }
+ _setInitialAttributesOnTargetPanel(child) {
+ const target = SelectorEngine.getElementFromSelector(child);
+ if (!target) {
+ return;
}
- if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
- const dropdownElement = element.closest(SELECTOR_DROPDOWN);
- if (dropdownElement) {
- SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach((dropdown) => dropdown.classList.add(CLASS_NAME_ACTIVE));
- }
- element.setAttribute("aria-expanded", true);
+ this._setAttributeIfNotExists(target, "role", "tabpanel");
+ if (child.id) {
+ this._setAttributeIfNotExists(target, "aria-labelledby", `${child.id}`);
+ }
+ }
+ _toggleDropDown(element, open) {
+ const outerElem = this._getOuterElement(element);
+ if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
+ return;
}
- if (callback) {
- callback();
+ const toggle = (selector, className) => {
+ const element2 = SelectorEngine.findOne(selector, outerElem);
+ if (element2) {
+ element2.classList.toggle(className, open);
+ }
+ };
+ toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
+ toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
+ outerElem.setAttribute("aria-expanded", open);
+ }
+ _setAttributeIfNotExists(element, attribute, value) {
+ if (!element.hasAttribute(attribute)) {
+ element.setAttribute(attribute, value);
}
}
- // Static
+ _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;
+ }
static jQueryInterface(config) {
return this.each(function() {
const data = Tab.getOrCreateInstance(this);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
+ }
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
}
+ data[config]();
});
}
};
@@ -4996,14 +4898,17 @@
if (isDisabled(this)) {
return;
}
- const data = Tab.getOrCreateInstance(this);
- data.show();
+ Tab.getOrCreateInstance(this).show();
+ });
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
+ for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
+ Tab.getOrCreateInstance(element);
+ }
});
defineJQueryPlugin(Tab);
var NAME = "toast";
var DATA_KEY = "bs.toast";
var EVENT_KEY = `.${DATA_KEY}`;
- var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
var EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
var EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
var EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
@@ -5026,27 +4931,23 @@
autohide: true,
delay: 5e3
};
- var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
var Toast = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._timeout = null;
this._hasMouseInteraction = false;
this._hasKeyboardInteraction = false;
this._setListeners();
}
- // Getters
- static get DefaultType() {
- return DefaultType;
- }
static get Default() {
return Default;
}
+ static get DefaultType() {
+ return DefaultType;
+ }
static get NAME() {
return NAME;
}
- // Public
show() {
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
if (showEvent.defaultPrevented) {
@@ -5058,17 +4959,16 @@
}
const complete = () => {
this._element.classList.remove(CLASS_NAME_SHOWING);
- this._element.classList.add(CLASS_NAME_SHOW);
EventHandler.trigger(this._element, EVENT_SHOWN);
this._maybeScheduleHide();
};
this._element.classList.remove(CLASS_NAME_HIDE);
reflow(this._element);
- this._element.classList.add(CLASS_NAME_SHOWING);
+ this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
}
hide() {
- if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (!this.isShown()) {
return;
}
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
@@ -5077,27 +4977,21 @@
}
const complete = () => {
this._element.classList.add(CLASS_NAME_HIDE);
+ this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
EventHandler.trigger(this._element, EVENT_HIDDEN);
};
- this._element.classList.remove(CLASS_NAME_SHOW);
+ this._element.classList.add(CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
}
dispose() {
this._clearTimeout();
- if (this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (this.isShown()) {
this._element.classList.remove(CLASS_NAME_SHOW);
}
super.dispose();
}
- // Private
- _getConfig(config) {
- config = {
- ...Default,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" && config ? config : {}
- };
- typeCheckConfig(NAME, config, this.constructor.DefaultType);
- return config;
+ isShown() {
+ return this._element.classList.contains(CLASS_NAME_SHOW);
}
_maybeScheduleHide() {
if (!this._config.autohide) {
@@ -5113,13 +5007,15 @@
_onInteraction(event, isInteracting) {
switch (event.type) {
case "mouseover":
- case "mouseout":
+ case "mouseout": {
this._hasMouseInteraction = isInteracting;
break;
+ }
case "focusin":
- case "focusout":
+ case "focusout": {
this._hasKeyboardInteraction = isInteracting;
break;
+ }
}
if (isInteracting) {
this._clearTimeout();
@@ -5132,7 +5028,6 @@
this._maybeScheduleHide();
}
_setListeners() {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
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));
@@ -5142,7 +5037,6 @@
clearTimeout(this._timeout);
this._timeout = null;
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Toast.getOrCreateInstance(this, config);
@@ -5155,6 +5049,7 @@
});
}
};
+ enableDismissTrigger(Toast);
defineJQueryPlugin(Toast);
// js/bs.ts
@@ -5304,8 +5199,7 @@
// js/lldp.ts
var CISCO_IOS_PATTERN = new RegExp(/^([A-Z][A-Za-z]+)[^0-9]*([0-9/]+)$/);
- var CISCO_IOS_OVERRIDES = /* @__PURE__ */ new Map([
- // Cisco IOS abbreviates 25G (TwentyFiveGigE) interfaces as 'Twe'.
+ var CISCO_IOS_OVERRIDES = new Map([
["TwentyFiveGigE", "Twe"]
]);
function getData(row, query, attr) {
@@ -5384,12 +5278,8 @@
document.addEventListener("DOMContentLoaded", initLldpNeighbors);
}
})();
-/*! Bundled license information:
-
-bootstrap/dist/js/bootstrap.esm.js:
- (*!
- * Bootstrap v5.0.2 (https://getbootstrap.com/)
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- *)
-*/
+/*!
+ * Bootstrap v5.3.3 (https://getbootstrap.com/)
+ * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
+ */
diff --git a/netbox_napalm_plugin/static/netbox_napalm_plugin/js/status.js b/netbox_napalm_plugin/static/netbox_napalm_plugin/js/status.js
index a446530..9f395df 100644
--- a/netbox_napalm_plugin/static/netbox_napalm_plugin/js/status.js
+++ b/netbox_napalm_plugin/static/netbox_napalm_plugin/js/status.js
@@ -5,38 +5,35 @@
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
+ return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
+ __markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+ var __reExport = (target, module, desc) => {
+ if (module && typeof module === "object" || typeof module === "function") {
+ for (let key of __getOwnPropNames(module))
+ if (!__hasOwnProp.call(target, key) && key !== "default")
+ __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
}
- return to;
+ return target;
+ };
+ var __toModule = (module) => {
+ return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
};
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
- ));
// node_modules/dayjs/dayjs.min.js
var require_dayjs_min = __commonJS({
"node_modules/dayjs/dayjs.min.js"(exports, module) {
!function(t, e) {
- "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
+ typeof exports == "object" && typeof module != "undefined" ? module.exports = e() : typeof define == "function" && define.amd ? define(e) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs = e();
}(exports, function() {
"use strict";
- var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
} }, m = function(t2, e2, n2) {
@@ -48,23 +45,23 @@
}, m: function t2(e2, n2) {
if (e2.date() < n2.date())
return -t2(n2, e2);
- var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
}, a: function(t2) {
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
}, p: function(t2) {
- return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
+ return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
}, u: function(t2) {
- return void 0 === t2;
+ return t2 === void 0;
} }, g = "en", D = {};
D[g] = M;
- var p = function(t2) {
- return t2 instanceof _;
- }, S = function t2(e2, n2, r2) {
+ var p = "$isDayjsObject", S = function(t2) {
+ return t2 instanceof _ || !(!t2 || !t2[p]);
+ }, w = function t2(e2, n2, r2) {
var i2;
if (!e2)
return g;
- if ("string" == typeof e2) {
+ if (typeof e2 == "string") {
var s2 = e2.toLowerCase();
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
var u2 = e2.split("-");
@@ -75,30 +72,30 @@
D[a2] = e2, i2 = a2;
}
return !r2 && i2 && (g = i2), i2 || !r2 && g;
- }, w = function(t2, e2) {
- if (p(t2))
+ }, O = function(t2, e2) {
+ if (S(t2))
return t2.clone();
- var n2 = "object" == typeof e2 ? e2 : {};
+ var n2 = typeof e2 == "object" ? e2 : {};
return n2.date = t2, n2.args = arguments, new _(n2);
- }, O = v;
- O.l = S, O.i = p, O.w = function(t2, e2) {
- return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
+ }, b = v;
+ b.l = w, b.i = S, b.w = function(t2, e2) {
+ return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
};
var _ = function() {
function M2(t2) {
- this.$L = S(t2.locale, null, true), this.parse(t2);
+ this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
}
var m2 = M2.prototype;
return m2.parse = function(t2) {
this.$d = function(t3) {
var e2 = t3.date, n2 = t3.utc;
- if (null === e2)
- return /* @__PURE__ */ new Date(NaN);
- if (O.u(e2))
- return /* @__PURE__ */ new Date();
+ if (e2 === null)
+ return new Date(NaN);
+ if (b.u(e2))
+ return new Date();
if (e2 instanceof Date)
return new Date(e2);
- if ("string" == typeof e2 && !/Z$/i.test(e2)) {
+ if (typeof e2 == "string" && !/Z$/i.test(e2)) {
var r2 = e2.match($);
if (r2) {
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
@@ -106,38 +103,38 @@
}
}
return new Date(e2);
- }(t2), this.$x = t2.x || {}, this.init();
+ }(t2), this.init();
}, m2.init = function() {
var t2 = this.$d;
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
}, m2.$utils = function() {
- return O;
+ return b;
}, m2.isValid = function() {
return !(this.$d.toString() === l);
}, m2.isSame = function(t2, e2) {
- var n2 = w(t2);
+ var n2 = O(t2);
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
}, m2.isAfter = function(t2, e2) {
- return w(t2) < this.startOf(e2);
+ return O(t2) < this.startOf(e2);
}, m2.isBefore = function(t2, e2) {
- return this.endOf(e2) < w(t2);
+ return this.endOf(e2) < O(t2);
}, m2.$g = function(t2, e2, n2) {
- return O.u(t2) ? this[e2] : this.set(n2, t2);
+ return b.u(t2) ? this[e2] : this.set(n2, t2);
}, m2.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, m2.valueOf = function() {
return this.$d.getTime();
}, m2.startOf = function(t2, e2) {
- var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), l2 = function(t3, e3) {
- var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
+ var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
+ var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
return r2 ? i2 : i2.endOf(a);
}, $2 = function(t3, e3) {
- return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
+ return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
- switch (h2) {
- case c:
+ switch (f2) {
+ case h:
return r2 ? l2(1, 0) : l2(31, 11);
- case f:
+ case c:
return r2 ? l2(1, M3) : l2(0, M3 + 1);
case o:
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
@@ -157,8 +154,8 @@
}, m2.endOf = function(t2) {
return this.startOf(t2, false);
}, m2.$set = function(t2, e2) {
- var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
- if (o2 === f || o2 === c) {
+ var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
+ if (o2 === c || o2 === h) {
var y2 = this.clone().set(d, 1);
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
} else
@@ -167,57 +164,139 @@
}, m2.set = function(t2, e2) {
return this.clone().$set(t2, e2);
}, m2.get = function(t2) {
- return this[O.p(t2)]();
- }, m2.add = function(r2, h2) {
+ return this[b.p(t2)]();
+ }, m2.add = function(r2, f2) {
var d2, l2 = this;
r2 = Number(r2);
- var $2 = O.p(h2), y2 = function(t2) {
- var e2 = w(l2);
- return O.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
+ var $2 = b.p(f2), y2 = function(t2) {
+ var e2 = O(l2);
+ return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
};
- if ($2 === f)
- return this.set(f, this.$M + r2);
if ($2 === c)
- return this.set(c, this.$y + r2);
+ return this.set(c, this.$M + r2);
+ if ($2 === h)
+ return this.set(h, this.$y + r2);
if ($2 === a)
return y2(1);
if ($2 === o)
return y2(7);
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
- return O.w(m3, this);
+ return b.w(m3, this);
}, m2.subtract = function(t2, e2) {
return this.add(-1 * t2, e2);
}, m2.format = function(t2) {
var e2 = this, n2 = this.$locale();
if (!this.isValid())
return n2.invalidDate || l;
- var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
- }, c2 = function(t3) {
- return O.s(s2 % 12 || 12, t3, "0");
- }, d2 = n2.meridiem || function(t3, e3, n3) {
+ }, d2 = function(t3) {
+ return b.s(s2 % 12 || 12, t3, "0");
+ }, $2 = f2 || function(t3, e3, n3) {
var r3 = t3 < 12 ? "AM" : "PM";
return n3 ? r3.toLowerCase() : r3;
- }, $2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
- return r2.replace(y, function(t3, e3) {
- return e3 || $2[t3] || i2.replace(":", "");
+ };
+ return r2.replace(y, function(t3, r3) {
+ return r3 || function(t4) {
+ switch (t4) {
+ case "YY":
+ return String(e2.$y).slice(-2);
+ case "YYYY":
+ return b.s(e2.$y, 4, "0");
+ case "M":
+ return a2 + 1;
+ case "MM":
+ return b.s(a2 + 1, 2, "0");
+ case "MMM":
+ return h2(n2.monthsShort, a2, c2, 3);
+ case "MMMM":
+ return h2(c2, a2);
+ case "D":
+ return e2.$D;
+ case "DD":
+ return b.s(e2.$D, 2, "0");
+ case "d":
+ return String(e2.$W);
+ case "dd":
+ return h2(n2.weekdaysMin, e2.$W, o2, 2);
+ case "ddd":
+ return h2(n2.weekdaysShort, e2.$W, o2, 3);
+ case "dddd":
+ return o2[e2.$W];
+ case "H":
+ return String(s2);
+ case "HH":
+ return b.s(s2, 2, "0");
+ case "h":
+ return d2(1);
+ case "hh":
+ return d2(2);
+ case "a":
+ return $2(s2, u2, true);
+ case "A":
+ return $2(s2, u2, false);
+ case "m":
+ return String(u2);
+ case "mm":
+ return b.s(u2, 2, "0");
+ case "s":
+ return String(e2.$s);
+ case "ss":
+ return b.s(e2.$s, 2, "0");
+ case "SSS":
+ return b.s(e2.$ms, 3, "0");
+ case "Z":
+ return i2;
+ }
+ return null;
+ }(t3) || i2.replace(":", "");
});
}, m2.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, m2.diff = function(r2, d2, l2) {
- var $2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, v2 = this - M3, g2 = O.m(this, M3);
- return g2 = ($2 = {}, $2[c] = g2 / 12, $2[f] = g2, $2[h] = g2 / 3, $2[o] = (v2 - m3) / 6048e5, $2[a] = (v2 - m3) / 864e5, $2[u] = v2 / n, $2[s] = v2 / e, $2[i] = v2 / t, $2)[y2] || v2, l2 ? g2 : O.a(g2);
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
+ return b.m(y2, m3);
+ };
+ switch (M3) {
+ case h:
+ $2 = D2() / 12;
+ break;
+ case c:
+ $2 = D2();
+ break;
+ case f:
+ $2 = D2() / 3;
+ break;
+ case o:
+ $2 = (g2 - v2) / 6048e5;
+ break;
+ case a:
+ $2 = (g2 - v2) / 864e5;
+ break;
+ case u:
+ $2 = g2 / n;
+ break;
+ case s:
+ $2 = g2 / e;
+ break;
+ case i:
+ $2 = g2 / t;
+ break;
+ default:
+ $2 = g2;
+ }
+ return l2 ? $2 : b.a($2);
}, m2.daysInMonth = function() {
- return this.endOf(f).$D;
+ return this.endOf(c).$D;
}, m2.$locale = function() {
return D[this.$L];
}, m2.locale = function(t2, e2) {
if (!t2)
return this.$L;
- var n2 = this.clone(), r2 = S(t2, e2, true);
+ var n2 = this.clone(), r2 = w(t2, e2, true);
return r2 && (n2.$L = r2), n2;
}, m2.clone = function() {
- return O.w(this.$d, this);
+ return b.w(this.$d, this);
}, m2.toDate = function() {
return new Date(this.valueOf());
}, m2.toJSON = function() {
@@ -227,16 +306,16 @@
}, m2.toString = function() {
return this.$d.toUTCString();
}, M2;
- }(), T = _.prototype;
- return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
- T[t2[1]] = function(e2) {
+ }(), k = _.prototype;
+ return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
+ k[t2[1]] = function(e2) {
return this.$g(e2, t2[0], t2[1]);
};
- }), w.extend = function(t2, e2) {
- return t2.$i || (t2(e2, _, w), t2.$i = true), w;
- }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
- return w(1e3 * t2);
- }, w.en = D[g], w.Ls = D, w.p = {}, w;
+ }), O.extend = function(t2, e2) {
+ return t2.$i || (t2(e2, _, O), t2.$i = true), O;
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
+ return O(1e3 * t2);
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
});
}
});
@@ -245,7 +324,7 @@
var require_utc = __commonJS({
"node_modules/dayjs/plugin/utc.js"(exports, module) {
!function(t, i) {
- "object" == typeof exports && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_utc = i();
+ typeof exports == "object" && typeof module != "undefined" ? module.exports = i() : typeof define == "function" && define.amd ? define(i) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs_plugin_utc = i();
}(exports, function() {
"use strict";
var t = "minute", i = /[+-]\d\d(?::?\d\d)?/g, e = /([+-]|\d\d)/g;
@@ -277,19 +356,19 @@
var n2 = this.$utils().u;
if (n2(s2))
return this.$u ? 0 : n2(this.$offset) ? a.call(this) : this.$offset;
- if ("string" == typeof s2 && (s2 = function(t2) {
- void 0 === t2 && (t2 = "");
+ if (typeof s2 == "string" && (s2 = function(t2) {
+ t2 === void 0 && (t2 = "");
var s3 = t2.match(i);
if (!s3)
return null;
var f3 = ("" + s3[0]).match(e) || ["-", 0, 0], n3 = f3[0], u3 = 60 * +f3[1] + +f3[2];
- return 0 === u3 ? 0 : "+" === n3 ? u3 : -u3;
- }(s2), null === s2))
+ return u3 === 0 ? 0 : n3 === "+" ? u3 : -u3;
+ }(s2), s2 === null))
return this;
var u2 = Math.abs(s2) <= 16 ? 60 * s2 : s2, o2 = this;
if (f2)
- return o2.$offset = u2, o2.$u = 0 === s2, o2;
- if (0 !== s2) {
+ return o2.$offset = u2, o2.$u = s2 === 0, o2;
+ if (s2 !== 0) {
var r2 = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
(o2 = this.local().add(u2 + r2, t)).$offset = u2, o2.$x.$localOffset = r2;
} else
@@ -312,7 +391,7 @@
};
var l = u.toDate;
u.toDate = function(t2) {
- return "s" === t2 && this.$offset ? n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : l.call(this);
+ return t2 === "s" && this.$offset ? n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : l.call(this);
};
var c = u.diff;
u.diff = function(t2, i2, e2) {
@@ -330,15 +409,15 @@
var require_timezone = __commonJS({
"node_modules/dayjs/plugin/timezone.js"(exports, module) {
!function(t, e) {
- "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_timezone = e();
+ typeof exports == "object" && typeof module != "undefined" ? module.exports = e() : typeof define == "function" && define.amd ? define(e) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs_plugin_timezone = e();
}(exports, function() {
"use strict";
var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, e = {};
return function(n, i, o) {
var r, a = function(t2, n2, i2) {
- void 0 === i2 && (i2 = {});
+ i2 === void 0 && (i2 = {});
var o2 = new Date(t2), r2 = function(t3, n3) {
- void 0 === n3 && (n3 = {});
+ n3 === void 0 && (n3 = {});
var i3 = n3.timeZoneName || "short", o3 = t3 + "|" + i3, r3 = e[o3];
return r3 || (r3 = new Intl.DateTimeFormat("en-US", { hour12: false, timeZone: t3, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: i3 }), e[o3] = r3), r3;
}(n2, i2);
@@ -348,12 +427,12 @@
var f2 = i2[u2], s2 = f2.type, m = f2.value, c = t[s2];
c >= 0 && (r2[c] = parseInt(m, 10));
}
- var d = r2[3], l = 24 === d ? 0 : d, v = r2[0] + "-" + r2[1] + "-" + r2[2] + " " + l + ":" + r2[4] + ":" + r2[5] + ":000", h = +e2;
- return (o.utc(v).valueOf() - (h -= h % 1e3)) / 6e4;
+ var d = r2[3], l = d === 24 ? 0 : d, h = r2[0] + "-" + r2[1] + "-" + r2[2] + " " + l + ":" + r2[4] + ":" + r2[5] + ":000", v = +e2;
+ return (o.utc(h).valueOf() - (v -= v % 1e3)) / 6e4;
}, f = i.prototype;
f.tz = function(t2, e2) {
- void 0 === t2 && (t2 = r);
- var n2 = this.utcOffset(), i2 = this.toDate(), a2 = i2.toLocaleString("en-US", { timeZone: t2 }), u2 = Math.round((i2 - new Date(a2)) / 1e3 / 60), f2 = o(a2).$set("millisecond", this.$ms).utcOffset(15 * -Math.round(i2.getTimezoneOffset() / 15) - u2, true);
+ t2 === void 0 && (t2 = r);
+ var n2 = this.utcOffset(), i2 = this.toDate(), a2 = i2.toLocaleString("en-US", { timeZone: t2 }), u2 = Math.round((i2 - new Date(a2)) / 1e3 / 60), f2 = o(a2, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(15 * -Math.round(i2.getTimezoneOffset() / 15) - u2, true);
if (e2) {
var s2 = f2.utcOffset();
f2 = f2.add(n2 - s2, "minute");
@@ -361,7 +440,7 @@
return f2.$x.$timezone = t2, f2;
}, f.offsetName = function(t2) {
var e2 = this.$x.$timezone || o.tz.guess(), n2 = a(this.valueOf(), e2, { timeZoneName: t2 }).find(function(t3) {
- return "timezonename" === t3.type.toLowerCase();
+ return t3.type.toLowerCase() === "timezonename";
});
return n2 && n2.value;
};
@@ -369,11 +448,11 @@
f.startOf = function(t2, e2) {
if (!this.$x || !this.$x.$timezone)
return s.call(this, t2, e2);
- var n2 = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"));
+ var n2 = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
return s.call(n2, t2, e2).tz(this.$x.$timezone, true);
}, o.tz = function(t2, e2, n2) {
var i2 = n2 && e2, a2 = n2 || e2 || r, f2 = u(+o(), a2);
- if ("string" != typeof t2)
+ if (typeof t2 != "string")
return o(t2).tz(a2);
var s2 = function(t3, e3, n3) {
var i3 = t3 - 60 * e3 * 1e3, o2 = u(i3, n3);
@@ -397,13 +476,13 @@
var require_duration = __commonJS({
"node_modules/dayjs/plugin/duration.js"(exports, module) {
!function(t, s) {
- "object" == typeof exports && "undefined" != typeof module ? module.exports = s() : "function" == typeof define && define.amd ? define(s) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_duration = s();
+ typeof exports == "object" && typeof module != "undefined" ? module.exports = s() : typeof define == "function" && define.amd ? define(s) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs_plugin_duration = s();
}(exports, function() {
"use strict";
- var t, s, n = 1e3, i = 6e4, e = 36e5, r = 864e5, o = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, u = 31536e6, h = 2592e6, a = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, d = { years: u, months: h, days: r, hours: e, minutes: i, seconds: n, milliseconds: 1, weeks: 6048e5 }, c = function(t2) {
- return t2 instanceof p;
+ var t, s, n = 1e3, i = 6e4, e = 36e5, r = 864e5, o = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, u = 31536e6, d = 2628e6, a = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, h = { years: u, months: d, days: r, hours: e, minutes: i, seconds: n, milliseconds: 1, weeks: 6048e5 }, c = function(t2) {
+ return t2 instanceof g;
}, f = function(t2, s2, n2) {
- return new p(t2, n2, s2.$l);
+ return new g(t2, n2, s2.$l);
}, m = function(t2) {
return s.p(t2) + "s";
}, l = function(t2) {
@@ -412,24 +491,24 @@
return l(t2) ? Math.ceil(t2) : Math.floor(t2);
}, y = function(t2) {
return Math.abs(t2);
- }, g = function(t2, s2) {
+ }, v = function(t2, s2) {
return t2 ? l(t2) ? { negative: true, format: "" + y(t2) + s2 } : { negative: false, format: "" + t2 + s2 } : { negative: false, format: "" };
- }, p = function() {
+ }, g = function() {
function l2(t2, s2, n2) {
var i2 = this;
- if (this.$d = {}, this.$l = n2, void 0 === t2 && (this.$ms = 0, this.parseFromMilliseconds()), s2)
- return f(t2 * d[m(s2)], this);
- if ("number" == typeof t2)
+ if (this.$d = {}, this.$l = n2, t2 === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), s2)
+ return f(t2 * h[m(s2)], this);
+ if (typeof t2 == "number")
return this.$ms = t2, this.parseFromMilliseconds(), this;
- if ("object" == typeof t2)
+ if (typeof t2 == "object")
return Object.keys(t2).forEach(function(s3) {
i2.$d[m(s3)] = t2[s3];
}), this.calMilliseconds(), this;
- if ("string" == typeof t2) {
+ if (typeof t2 == "string") {
var e2 = t2.match(a);
if (e2) {
var r2 = e2.slice(2).map(function(t3) {
- return null != t3 ? Number(t3) : 0;
+ return t3 != null ? Number(t3) : 0;
});
return this.$d.years = r2[0], this.$d.months = r2[1], this.$d.weeks = r2[2], this.$d.days = r2[3], this.$d.hours = r2[4], this.$d.minutes = r2[5], this.$d.seconds = r2[6], this.calMilliseconds(), this;
}
@@ -440,18 +519,18 @@
return y2.calMilliseconds = function() {
var t2 = this;
this.$ms = Object.keys(this.$d).reduce(function(s2, n2) {
- return s2 + (t2.$d[n2] || 0) * d[n2];
+ return s2 + (t2.$d[n2] || 0) * h[n2];
}, 0);
}, y2.parseFromMilliseconds = function() {
var t2 = this.$ms;
- this.$d.years = $(t2 / u), t2 %= u, this.$d.months = $(t2 / h), t2 %= h, this.$d.days = $(t2 / r), t2 %= r, this.$d.hours = $(t2 / e), t2 %= e, this.$d.minutes = $(t2 / i), t2 %= i, this.$d.seconds = $(t2 / n), t2 %= n, this.$d.milliseconds = t2;
+ this.$d.years = $(t2 / u), t2 %= u, this.$d.months = $(t2 / d), t2 %= d, this.$d.days = $(t2 / r), t2 %= r, this.$d.hours = $(t2 / e), t2 %= e, this.$d.minutes = $(t2 / i), t2 %= i, this.$d.seconds = $(t2 / n), t2 %= n, this.$d.milliseconds = t2;
}, y2.toISOString = function() {
- var t2 = g(this.$d.years, "Y"), s2 = g(this.$d.months, "M"), n2 = +this.$d.days || 0;
+ var t2 = v(this.$d.years, "Y"), s2 = v(this.$d.months, "M"), n2 = +this.$d.days || 0;
this.$d.weeks && (n2 += 7 * this.$d.weeks);
- var i2 = g(n2, "D"), e2 = g(this.$d.hours, "H"), r2 = g(this.$d.minutes, "M"), o2 = this.$d.seconds || 0;
- this.$d.milliseconds && (o2 += this.$d.milliseconds / 1e3);
- var u2 = g(o2, "S"), h2 = t2.negative || s2.negative || i2.negative || e2.negative || r2.negative || u2.negative, a2 = e2.format || r2.format || u2.format ? "T" : "", d2 = (h2 ? "-" : "") + "P" + t2.format + s2.format + i2.format + a2 + e2.format + r2.format + u2.format;
- return "P" === d2 || "-P" === d2 ? "P0D" : d2;
+ var i2 = v(n2, "D"), e2 = v(this.$d.hours, "H"), r2 = v(this.$d.minutes, "M"), o2 = this.$d.seconds || 0;
+ this.$d.milliseconds && (o2 += this.$d.milliseconds / 1e3, o2 = Math.round(1e3 * o2) / 1e3);
+ var u2 = v(o2, "S"), d2 = t2.negative || s2.negative || i2.negative || e2.negative || r2.negative || u2.negative, a2 = e2.format || r2.format || u2.format ? "T" : "", h2 = (d2 ? "-" : "") + "P" + t2.format + s2.format + i2.format + a2 + e2.format + r2.format + u2.format;
+ return h2 === "P" || h2 === "-P" ? "P0D" : h2;
}, y2.toJSON = function() {
return this.toISOString();
}, y2.format = function(t2) {
@@ -460,13 +539,13 @@
return s2 || String(i2[t3]);
});
}, y2.as = function(t2) {
- return this.$ms / d[m(t2)];
+ return this.$ms / h[m(t2)];
}, y2.get = function(t2) {
var s2 = this.$ms, n2 = m(t2);
- return "milliseconds" === n2 ? s2 %= 1e3 : s2 = "weeks" === n2 ? $(s2 / d[n2]) : this.$d[n2], 0 === s2 ? 0 : s2;
+ return n2 === "milliseconds" ? s2 %= 1e3 : s2 = n2 === "weeks" ? $(s2 / h[n2]) : this.$d[n2], s2 || 0;
}, y2.add = function(t2, s2, n2) {
var i2;
- return i2 = s2 ? t2 * d[m(s2)] : c(t2) ? t2.$ms : f(t2, this).$ms, f(this.$ms + i2 * (n2 ? -1 : 1), this);
+ return i2 = s2 ? t2 * h[m(s2)] : c(t2) ? t2.$ms : f(t2, this).$ms, f(this.$ms + i2 * (n2 ? -1 : 1), this);
}, y2.subtract = function(t2, s2) {
return this.add(t2, s2, true);
}, y2.locale = function(t2) {
@@ -476,6 +555,8 @@
return f(this.$ms, this);
}, y2.humanize = function(s2) {
return t().add(this.$ms, "ms").locale(this.$l).fromNow(!s2);
+ }, y2.valueOf = function() {
+ return this.asMilliseconds();
}, y2.milliseconds = function() {
return this.get("milliseconds");
}, y2.asMilliseconds = function() {
@@ -509,7 +590,9 @@
}, y2.asYears = function() {
return this.as("years");
}, l2;
- }();
+ }(), p = function(t2, s2, n2) {
+ return t2.add(s2.years() * n2, "y").add(s2.months() * n2, "M").add(s2.days() * n2, "d").add(s2.hours() * n2, "h").add(s2.minutes() * n2, "m").add(s2.seconds() * n2, "s").add(s2.milliseconds() * n2, "ms");
+ };
return function(n2, i2, e2) {
t = e2, s = e2().$utils(), e2.duration = function(t2, s2) {
var n3 = e2.locale();
@@ -517,9 +600,9 @@
}, e2.isDuration = c;
var r2 = i2.prototype.add, o2 = i2.prototype.subtract;
i2.prototype.add = function(t2, s2) {
- return c(t2) && (t2 = t2.asMilliseconds()), r2.bind(this)(t2, s2);
+ return c(t2) ? p(this, t2, 1) : r2.bind(this)(t2, s2);
}, i2.prototype.subtract = function(t2, s2) {
- return c(t2) && (t2 = t2.asMilliseconds()), o2.bind(this)(t2, s2);
+ return c(t2) ? p(this, t2, -1) : o2.bind(this)(t2, s2);
};
};
});
@@ -530,7 +613,7 @@
var require_advancedFormat = __commonJS({
"node_modules/dayjs/plugin/advancedFormat.js"(exports, module) {
!function(e, t) {
- "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_advancedFormat = t();
+ typeof exports == "object" && typeof module != "undefined" ? module.exports = t() : typeof define == "function" && define.amd ? define(t) : (e = typeof globalThis != "undefined" ? globalThis : e || self).dayjs_plugin_advancedFormat = t();
}(exports, function() {
"use strict";
return function(e, t) {
@@ -553,13 +636,13 @@
return r2.ordinal(t2.week(), "W");
case "w":
case "ww":
- return s.s(t2.week(), "w" === e3 ? 1 : 2, "0");
+ return s.s(t2.week(), e3 === "w" ? 1 : 2, "0");
case "W":
case "WW":
- return s.s(t2.isoWeek(), "W" === e3 ? 1 : 2, "0");
+ return s.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
case "k":
case "kk":
- return s.s(String(0 === t2.$H ? 24 : t2.$H), "k" === e3 ? 1 : 2, "0");
+ return s.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
case "X":
return Math.floor(t2.$d.getTime() / 1e3);
case "x":
@@ -580,11 +663,11 @@
});
// js/status.ts
- var import_dayjs = __toESM(require_dayjs_min());
- var import_utc = __toESM(require_utc());
- var import_timezone = __toESM(require_timezone());
- var import_duration = __toESM(require_duration());
- var import_advancedFormat = __toESM(require_advancedFormat());
+ var import_dayjs = __toModule(require_dayjs_min());
+ var import_utc = __toModule(require_utc());
+ var import_timezone = __toModule(require_timezone());
+ var import_duration = __toModule(require_duration());
+ var import_advancedFormat = __toModule(require_advancedFormat());
// node_modules/@popperjs/core/lib/index.js
var lib_exports = {};
@@ -774,7 +857,7 @@
// node_modules/@popperjs/core/lib/utils/userAgent.js
function getUAString() {
var uaData = navigator.userAgentData;
- if (uaData != null && uaData.brands) {
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
return uaData.brands.map(function(item) {
return item.brand + "/" + item.version;
}).join(" ");
@@ -868,10 +951,7 @@
// node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
function getDocumentElement(element) {
- return ((isElement(element) ? element.ownerDocument : (
- // $FlowFixMe[prop-missing]
- element.document
- )) || window.document).documentElement;
+ return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
}
// node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
@@ -879,22 +959,12 @@
if (getNodeName(element) === "html") {
return element;
}
- return (
- // this is a quicker (but less type safe) way to save quite some bytes from the bundle
- // $FlowFixMe[incompatible-return]
- // $FlowFixMe[prop-missing]
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
- element.parentNode || // DOM Element detected
- (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
- getDocumentElement(element)
- );
+ return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
}
// node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
function getTrueOffsetParent(element) {
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
- getComputedStyle2(element).position === "fixed") {
+ if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
return null;
}
return element.offsetParent;
@@ -1018,15 +1088,7 @@
return;
}
}
- if (true) {
- if (!isHTMLElement(arrowElement)) {
- console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', "To use an SVG arrow, wrap it in an HTMLElement that will be used as", "the arrow."].join(" "));
- }
- }
if (!contains(state.elements.popper, arrowElement)) {
- if (true) {
- console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', "element."].join(" "));
- }
return;
}
state.elements.arrow = arrowElement;
@@ -1053,9 +1115,8 @@
bottom: "auto",
left: "auto"
};
- function roundOffsetsByDPR(_ref) {
+ function roundOffsetsByDPR(_ref, win) {
var x = _ref.x, y = _ref.y;
- var win = window;
var dpr = win.devicePixelRatio || 1;
return {
x: round(x * dpr) / dpr || 0,
@@ -1094,19 +1155,13 @@
offsetParent = offsetParent;
if (placement === top || (placement === left || placement === right) && variation === end) {
sideY = bottom;
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
- // $FlowFixMe[prop-missing]
- offsetParent[heightProp]
- );
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
y -= offsetY - popperRect.height;
y *= gpuAcceleration ? 1 : -1;
}
if (placement === left || (placement === top || placement === bottom) && variation === end) {
sideX = right;
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
- // $FlowFixMe[prop-missing]
- offsetParent[widthProp]
- );
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
x -= offsetX - popperRect.width;
x *= gpuAcceleration ? 1 : -1;
}
@@ -1117,7 +1172,7 @@
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
x,
y
- }) : {
+ }, getWindow(popper2)) : {
x,
y
};
@@ -1132,14 +1187,6 @@
function computeStyles(_ref5) {
var state = _ref5.state, options = _ref5.options;
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
- if (true) {
- var transitionProperty = getComputedStyle2(state.elements.popper).transitionProperty || "";
- if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
- return transitionProperty.indexOf(property) >= 0;
- })) {
- console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
- }
- }
var commonStyles = {
placement: getBasePlacement(state.placement),
variation: getVariation(state.placement),
@@ -1329,10 +1376,7 @@
var win = getWindow(scrollParent);
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
- return isBody ? updatedList : (
- // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
- updatedList.concat(listScrollParents(getParentNode(target)))
- );
+ return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
}
// node_modules/@popperjs/core/lib/utils/rectToClientRect.js
@@ -1499,9 +1543,6 @@
});
if (allowedPlacements.length === 0) {
allowedPlacements = placements2;
- if (true) {
- console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" "));
- }
}
var overflows = allowedPlacements.reduce(function(acc, placement2) {
acc[placement2] = detectOverflow(state, {
@@ -1547,7 +1588,7 @@
}, []);
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
- var checksMap = /* @__PURE__ */ new Map();
+ var checksMap = new Map();
var makeFallbackChecks = true;
var firstFittingPlacement = placements2[0];
for (var i = 0; i < placements2.length; i++) {
@@ -1873,8 +1914,7 @@
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
- if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
- isScrollParent(documentElement)) {
+ if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
@@ -1895,8 +1935,8 @@
// node_modules/@popperjs/core/lib/utils/orderModifiers.js
function order(modifiers) {
- var map = /* @__PURE__ */ new Map();
- var visited = /* @__PURE__ */ new Set();
+ var map = new Map();
+ var visited = new Set();
var result = [];
modifiers.forEach(function(modifier) {
map.set(modifier.name, modifier);
@@ -1946,92 +1986,6 @@
};
}
- // node_modules/@popperjs/core/lib/utils/format.js
- function format(str) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- return [].concat(args).reduce(function(p, c) {
- return p.replace(/%s/, c);
- }, str);
- }
-
- // node_modules/@popperjs/core/lib/utils/validateModifiers.js
- var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
- var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
- var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
- function validateModifiers(modifiers) {
- modifiers.forEach(function(modifier) {
- [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self2) {
- return self2.indexOf(value) === index;
- }).forEach(function(key) {
- switch (key) {
- case "name":
- if (typeof modifier.name !== "string") {
- console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
- }
- break;
- case "enabled":
- if (typeof modifier.enabled !== "boolean") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
- }
- break;
- case "phase":
- if (modifierPhases.indexOf(modifier.phase) < 0) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
- }
- break;
- case "fn":
- if (typeof modifier.fn !== "function") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
- }
- break;
- case "effect":
- if (modifier.effect != null && typeof modifier.effect !== "function") {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
- }
- break;
- case "requires":
- if (modifier.requires != null && !Array.isArray(modifier.requires)) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
- }
- break;
- case "requiresIfExists":
- if (!Array.isArray(modifier.requiresIfExists)) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
- }
- break;
- case "options":
- case "data":
- break;
- default:
- console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
- return '"' + s + '"';
- }).join(", ") + '; but "' + key + '" was provided.');
- }
- modifier.requires && modifier.requires.forEach(function(requirement) {
- if (modifiers.find(function(mod) {
- return mod.name === requirement;
- }) == null) {
- console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
- }
- });
- });
- });
- }
-
- // node_modules/@popperjs/core/lib/utils/uniqueBy.js
- function uniqueBy(arr, fn2) {
- var identifiers = /* @__PURE__ */ new Set();
- return arr.filter(function(item) {
- var identifier = fn2(item);
- if (!identifiers.has(identifier)) {
- identifiers.add(identifier);
- return true;
- }
- });
- }
-
// node_modules/@popperjs/core/lib/utils/mergeByName.js
function mergeByName(modifiers) {
var merged = modifiers.reduce(function(merged2, current) {
@@ -2048,8 +2002,6 @@
}
// node_modules/@popperjs/core/lib/createPopper.js
- var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
- var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
var DEFAULT_OPTIONS = {
placement: "bottom",
modifiers: [],
@@ -2100,45 +2052,15 @@
state.orderedModifiers = orderedModifiers.filter(function(m) {
return m.enabled;
});
- if (true) {
- var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
- var name = _ref.name;
- return name;
- });
- validateModifiers(modifiers);
- if (getBasePlacement(state.options.placement) === auto) {
- var flipModifier = state.orderedModifiers.find(function(_ref2) {
- var name = _ref2.name;
- return name === "flip";
- });
- if (!flipModifier) {
- console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
- }
- }
- var _getComputedStyle = getComputedStyle2(popper2), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
- if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
- return parseFloat(margin);
- })) {
- console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
- }
- }
runModifierEffects();
return instance.update();
},
- // Sync update – it will always be executed, even if not necessary. This
- // is useful for low frequency updates where sync behavior simplifies the
- // logic.
- // For high frequency updates (e.g. `resize` and `scroll` events), always
- // prefer the async Popper#update method
forceUpdate: function forceUpdate() {
if (isDestroyed) {
return;
}
var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
if (!areValidElements(reference3, popper3)) {
- if (true) {
- console.error(INVALID_ELEMENT_ERROR);
- }
return;
}
state.rects = {
@@ -2150,15 +2072,7 @@
state.orderedModifiers.forEach(function(modifier) {
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
});
- var __debug_loops__ = 0;
for (var index = 0; index < state.orderedModifiers.length; index++) {
- if (true) {
- __debug_loops__ += 1;
- if (__debug_loops__ > 100) {
- console.error(INFINITE_LOOP_ERROR);
- break;
- }
- }
if (state.reset === true) {
state.reset = false;
index = -1;
@@ -2175,8 +2089,6 @@
}
}
},
- // Async and optimistically optimized update – it will not be executed if
- // not necessary (debounced to run at most once-per-tick)
update: debounce(function() {
return new Promise(function(resolve) {
instance.forceUpdate();
@@ -2189,9 +2101,6 @@
}
};
if (!areValidElements(reference2, popper2)) {
- if (true) {
- console.error(INVALID_ELEMENT_ERROR);
- }
return instance;
}
instance.setOptions(options).then(function(state2) {
@@ -2200,8 +2109,8 @@
}
});
function runModifierEffects() {
- state.orderedModifiers.forEach(function(_ref3) {
- var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect4 = _ref3.effect;
+ state.orderedModifiers.forEach(function(_ref) {
+ var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect4 = _ref.effect;
if (typeof effect4 === "function") {
var cleanupFn = effect4({
state,
@@ -2239,57 +2148,50 @@
});
// node_modules/bootstrap/dist/js/bootstrap.esm.js
- var NODE_TEXT = 3;
- var 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;
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
- if (ancestor.matches(selector)) {
- parents.push(ancestor);
- }
- ancestor = ancestor.parentNode;
+ var elementMap = new Map();
+ var Data = {
+ set(element, key, instance) {
+ if (!elementMap.has(element)) {
+ elementMap.set(element, new Map());
}
- return parents;
+ 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: ${Array.from(instanceMap.keys())[0]}.`);
+ return;
+ }
+ instanceMap.set(key, instance);
},
- prev(element, selector) {
- let previous = element.previousElementSibling;
- while (previous) {
- if (previous.matches(selector)) {
- return [previous];
- }
- previous = previous.previousElementSibling;
+ get(element, key) {
+ if (elementMap.has(element)) {
+ return elementMap.get(element).get(key) || null;
}
- return [];
+ return null;
},
- next(element, selector) {
- let next = element.nextElementSibling;
- while (next) {
- if (next.matches(selector)) {
- return [next];
- }
- next = next.nextElementSibling;
+ remove(element, key) {
+ if (!elementMap.has(element)) {
+ return;
+ }
+ const instanceMap = elementMap.get(element);
+ instanceMap.delete(key);
+ if (instanceMap.size === 0) {
+ elementMap.delete(element);
}
- return [];
}
};
var MAX_UID = 1e6;
var MILLISECONDS_MULTIPLIER = 1e3;
var TRANSITION_END = "transitionend";
- var toType = (obj) => {
- if (obj === null || obj === void 0) {
- return `${obj}`;
+ var parseSelector = (selector) => {
+ if (selector && window.CSS && window.CSS.escape) {
+ selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
+ }
+ return selector;
+ };
+ var toType = (object) => {
+ if (object === null || object === void 0) {
+ return `${object}`;
}
- return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
+ return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
};
var getUID = (prefix) => {
do {
@@ -2297,31 +2199,6 @@
} while (document.getElementById(prefix));
return prefix;
};
- var getSelector = (element) => {
- let selector = element.getAttribute("data-bs-target");
- if (!selector || selector === "#") {
- let hrefAttr = element.getAttribute("href");
- if (!hrefAttr || !hrefAttr.includes("#") && !hrefAttr.startsWith(".")) {
- return null;
- }
- if (hrefAttr.includes("#") && !hrefAttr.startsWith("#")) {
- hrefAttr = `#${hrefAttr.split("#")[1]}`;
- }
- selector = hrefAttr && hrefAttr !== "#" ? hrefAttr.trim() : null;
- }
- return selector;
- };
- var getSelectorFromElement = (element) => {
- const selector = getSelector(element);
- if (selector) {
- return document.querySelector(selector) ? selector : null;
- }
- return null;
- };
- var getElementFromSelector = (element) => {
- const selector = getSelector(element);
- return selector ? document.querySelector(selector) : null;
- };
var getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
@@ -2342,39 +2219,43 @@
var triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
- var isElement2 = (obj) => {
- if (!obj || typeof obj !== "object") {
+ var isElement2 = (object) => {
+ if (!object || typeof object !== "object") {
return false;
}
- if (typeof obj.jquery !== "undefined") {
- obj = obj[0];
+ if (typeof object.jquery !== "undefined") {
+ object = object[0];
}
- return typeof obj.nodeType !== "undefined";
+ return typeof object.nodeType !== "undefined";
};
- var getElement = (obj) => {
- if (isElement2(obj)) {
- return obj.jquery ? obj[0] : obj;
+ var getElement = (object) => {
+ if (isElement2(object)) {
+ return object.jquery ? object[0] : object;
}
- if (typeof obj === "string" && obj.length > 0) {
- return SelectorEngine.findOne(obj);
+ if (typeof object === "string" && object.length > 0) {
+ return document.querySelector(parseSelector(object));
}
return null;
};
- var typeCheckConfig = (componentName, config, configTypes) => {
- Object.keys(configTypes).forEach((property) => {
- const expectedTypes = configTypes[property];
- const value = config[property];
- const valueType = value && isElement2(value) ? "element" : toType(value);
- if (!new RegExp(expectedTypes).test(valueType)) {
- throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
- }
- });
- };
var isVisible = (element) => {
if (!isElement2(element) || element.getClientRects().length === 0) {
return false;
}
- return getComputedStyle(element).getPropertyValue("visibility") === "visible";
+ 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;
};
var isDisabled = (element) => {
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
@@ -2406,13 +2287,12 @@
};
var noop = () => {
};
- var reflow = (element) => element.offsetHeight;
+ var reflow = (element) => {
+ element.offsetHeight;
+ };
var getjQuery = () => {
- const {
- jQuery
- } = window;
- if (jQuery && !document.body.hasAttribute("data-bs-no-jquery")) {
- return jQuery;
+ if (window.jQuery && !document.body.hasAttribute("data-bs-no-jquery")) {
+ return window.jQuery;
}
return null;
};
@@ -2421,7 +2301,9 @@
if (document.readyState === "loading") {
if (!DOMContentLoadedCallbacks.length) {
document.addEventListener("DOMContentLoaded", () => {
- DOMContentLoadedCallbacks.forEach((callback2) => callback2());
+ for (const callback2 of DOMContentLoadedCallbacks) {
+ callback2();
+ }
});
}
DOMContentLoadedCallbacks.push(callback);
@@ -2445,10 +2327,8 @@
}
});
};
- var execute = (callback) => {
- if (typeof callback === "function") {
- callback();
- }
+ var execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
+ return typeof possibleCallback === "function" ? possibleCallback(...args) : defaultValue;
};
var executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
if (!waitForTransition) {
@@ -2476,11 +2356,11 @@
}, emulatedDuration);
};
var getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
+ const listLength = list.length;
let index = list.indexOf(activeElement);
if (index === -1) {
- return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
}
- const listLength = list.length;
index += shouldGetNext ? 1 : -1;
if (isCycleAllowed) {
index = (index + listLength) % listLength;
@@ -2496,20 +2376,21 @@
mouseenter: "mouseover",
mouseleave: "mouseout"
};
- var customEventsRegex = /^(mouseenter|mouseleave)/i;
- var nativeEvents = /* @__PURE__ */ 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"]);
- function getUidEvent(element, uid) {
+ var 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"]);
+ function makeEventUid(element, uid) {
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
}
- function getEvent(element) {
- const uid = getUidEvent(element);
+ function getElementEvents(element) {
+ const uid = makeEventUid(element);
element.uidEvent = uid;
eventRegistry[uid] = eventRegistry[uid] || {};
return eventRegistry[uid];
}
function bootstrapHandler(element, fn2) {
return function handler(event) {
- event.delegateTarget = element;
+ hydrateObj(event, {
+ delegateTarget: element
+ });
if (handler.oneOff) {
EventHandler.off(element, event.type, fn2);
}
@@ -2522,77 +2403,63 @@
for (let {
target
} = event; target && target !== this; target = target.parentNode) {
- for (let i = domElements.length; i--; ) {
- if (domElements[i] === target) {
- event.delegateTarget = target;
- if (handler.oneOff) {
- EventHandler.off(element, event.type, selector, fn2);
- }
- return fn2.apply(target, [event]);
+ for (const domElement of domElements) {
+ if (domElement !== target) {
+ continue;
+ }
+ hydrateObj(event, {
+ delegateTarget: target
+ });
+ if (handler.oneOff) {
+ EventHandler.off(element, event.type, selector, fn2);
}
+ return fn2.apply(target, [event]);
}
}
- return null;
};
}
- function findHandler(events, handler, delegationSelector = null) {
- const uidEventList = Object.keys(events);
- for (let i = 0, len = uidEventList.length; i < len; i++) {
- const event = events[uidEventList[i]];
- if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
- return event;
- }
- }
- return null;
+ function findHandler(events, callable, delegationSelector = null) {
+ return Object.values(events).find((event) => event.callable === callable && event.delegationSelector === delegationSelector);
}
- function normalizeParams(originalTypeEvent, handler, delegationFn) {
- const delegation = typeof handler === "string";
- const originalHandler = delegation ? delegationFn : handler;
+ function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
+ const isDelegated = typeof handler === "string";
+ const callable = isDelegated ? delegationFunction : handler || delegationFunction;
let typeEvent = getTypeEvent(originalTypeEvent);
- const isNative = nativeEvents.has(typeEvent);
- if (!isNative) {
+ if (!nativeEvents.has(typeEvent)) {
typeEvent = originalTypeEvent;
}
- return [delegation, originalHandler, typeEvent];
+ return [isDelegated, callable, typeEvent];
}
- function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
+ function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
- if (!handler) {
- handler = delegationFn;
- delegationFn = null;
- }
- if (customEventsRegex.test(originalTypeEvent)) {
- const wrapFn = (fn3) => {
+ let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
+ if (originalTypeEvent in customEvents) {
+ const wrapFunction = (fn3) => {
return function(event) {
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
return fn3.call(this, event);
}
};
};
- if (delegationFn) {
- delegationFn = wrapFn(delegationFn);
- } else {
- handler = wrapFn(handler);
- }
+ callable = wrapFunction(callable);
}
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
- const events = getEvent(element);
+ const events = getElementEvents(element);
const handlers = events[typeEvent] || (events[typeEvent] = {});
- const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
- if (previousFn) {
- previousFn.oneOff = previousFn.oneOff && oneOff;
+ const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
+ if (previousFunction) {
+ previousFunction.oneOff = previousFunction.oneOff && oneOff;
return;
}
- const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ""));
- const fn2 = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
- fn2.delegationSelector = delegation ? handler : null;
- fn2.originalHandler = originalHandler;
+ const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ""));
+ const fn2 = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
+ fn2.delegationSelector = isDelegated ? handler : null;
+ fn2.callable = callable;
fn2.oneOff = oneOff;
fn2.uidEvent = uid;
handlers[uid] = fn2;
- element.addEventListener(typeEvent, fn2, delegation);
+ element.addEventListener(typeEvent, fn2, isDelegated);
}
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
const fn2 = findHandler(events[typeEvent], handler, delegationSelector);
@@ -2604,52 +2471,50 @@
}
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
const storeElementEvent = events[typeEvent] || {};
- Object.keys(storeElementEvent).forEach((handlerKey) => {
+ for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
if (handlerKey.includes(namespace)) {
- const event = storeElementEvent[handlerKey];
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
- });
+ }
}
function getTypeEvent(event) {
event = event.replace(stripNameRegex, "");
return customEvents[event] || event;
}
var EventHandler = {
- on(element, event, handler, delegationFn) {
- addHandler(element, event, handler, delegationFn, false);
+ on(element, event, handler, delegationFunction) {
+ addHandler(element, event, handler, delegationFunction, false);
},
- one(element, event, handler, delegationFn) {
- addHandler(element, event, handler, delegationFn, true);
+ one(element, event, handler, delegationFunction) {
+ addHandler(element, event, handler, delegationFunction, true);
},
- off(element, originalTypeEvent, handler, delegationFn) {
+ off(element, originalTypeEvent, handler, delegationFunction) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
+ const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
const inNamespace = typeEvent !== originalTypeEvent;
- const events = getEvent(element);
+ const events = getElementEvents(element);
+ const storeElementEvent = events[typeEvent] || {};
const isNamespace = originalTypeEvent.startsWith(".");
- if (typeof originalHandler !== "undefined") {
- if (!events || !events[typeEvent]) {
+ if (typeof callable !== "undefined") {
+ if (!Object.keys(storeElementEvent).length) {
return;
}
- removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
+ removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
return;
}
if (isNamespace) {
- Object.keys(events).forEach((elementEvent) => {
+ for (const elementEvent of Object.keys(events)) {
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
- });
+ }
}
- const storeElementEvent = events[typeEvent] || {};
- Object.keys(storeElementEvent).forEach((keyHandlers) => {
+ for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
const handlerKey = keyHandlers.replace(stripUidRegex, "");
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
- const event = storeElementEvent[keyHandlers];
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
- });
+ }
},
trigger(element, event, args) {
if (typeof event !== "string" || !element) {
@@ -2658,12 +2523,10 @@
const $ = getjQuery();
const typeEvent = getTypeEvent(event);
const inNamespace = event !== typeEvent;
- const isNative = nativeEvents.has(typeEvent);
- let jQueryEvent;
+ let jQueryEvent = null;
let bubbles = true;
let nativeDispatch = true;
let defaultPrevented = false;
- let evt = null;
if (inNamespace && $) {
jQueryEvent = $.Event(event, args);
$(element).trigger(jQueryEvent);
@@ -2671,89 +2534,154 @@
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
defaultPrevented = jQueryEvent.isDefaultPrevented();
}
- if (isNative) {
- evt = document.createEvent("HTMLEvents");
- evt.initEvent(typeEvent, bubbles, true);
- } else {
- evt = new CustomEvent(event, {
- bubbles,
- cancelable: true
- });
- }
- if (typeof args !== "undefined") {
- Object.keys(args).forEach((key) => {
- Object.defineProperty(evt, key, {
- get() {
- return args[key];
- }
- });
- });
- }
+ const evt = hydrateObj(new Event(event, {
+ bubbles,
+ cancelable: true
+ }), args);
if (defaultPrevented) {
evt.preventDefault();
}
if (nativeDispatch) {
element.dispatchEvent(evt);
}
- if (evt.defaultPrevented && typeof jQueryEvent !== "undefined") {
+ if (evt.defaultPrevented && jQueryEvent) {
jQueryEvent.preventDefault();
}
return evt;
}
};
- var elementMap = /* @__PURE__ */ new Map();
- var Data = {
- 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: ${Array.from(instanceMap.keys())[0]}.`);
- return;
- }
- instanceMap.set(key, instance);
- },
- get(element, key) {
- if (elementMap.has(element)) {
- return elementMap.get(element).get(key) || null;
+ 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;
+ }
+ 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()}`);
+ }
+ var Manipulator = {
+ setDataAttribute(element, key, value) {
+ element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
},
- remove(element, key) {
- if (!elementMap.has(element)) {
- return;
+ removeDataAttribute(element, key) {
+ element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
+ },
+ getDataAttributes(element) {
+ if (!element) {
+ return {};
}
- const instanceMap = elementMap.get(element);
- instanceMap.delete(key);
- if (instanceMap.size === 0) {
- elementMap.delete(element);
+ 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, pureKey.length);
+ attributes[pureKey] = normalizeData(element.dataset[key]);
+ }
+ return attributes;
+ },
+ getDataAttribute(element, key) {
+ return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
+ }
+ };
+ 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 = isElement2(element) ? Manipulator.getDataAttribute(element, "config") : {};
+ return {
+ ...this.constructor.Default,
+ ...typeof jsonConfig === "object" ? jsonConfig : {},
+ ...isElement2(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 = isElement2(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}".`);
+ }
}
}
};
- var VERSION = "5.0.2";
- var BaseComponent = class {
- constructor(element) {
+ var VERSION = "5.3.3";
+ var BaseComponent = class 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);
}
dispose() {
Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, this.constructor.EVENT_KEY);
- Object.getOwnPropertyNames(this).forEach((propertyName) => {
+ for (const propertyName of Object.getOwnPropertyNames(this)) {
this[propertyName] = null;
- });
+ }
}
_queueCallback(callback, element, isAnimated = true) {
executeAfterTransition(callback, element, isAnimated);
}
- /** Static */
+ _getConfig(config) {
+ config = this._mergeConfigObj(config, this._element);
+ config = this._configAfterMerge(config);
+ this._typeCheckConfig(config);
+ return config;
+ }
static getInstance(element) {
- return Data.get(element, this.DATA_KEY);
+ return Data.get(getElement(element), this.DATA_KEY);
}
static getOrCreateInstance(element, config = {}) {
return this.getInstance(element) || new this(element, typeof config === "object" ? config : null);
@@ -2761,94 +2689,158 @@
static get VERSION() {
return VERSION;
}
- static get NAME() {
- throw new Error('You have to implement the static method "NAME", for each component!');
- }
static get DATA_KEY() {
return `bs.${this.NAME}`;
}
static get EVENT_KEY() {
return `.${this.DATA_KEY}`;
}
+ static eventName(name) {
+ return `${name}${this.EVENT_KEY}`;
+ }
+ };
+ var 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;
};
- var NAME$c = "alert";
- var DATA_KEY$b = "bs.alert";
- var EVENT_KEY$b = `.${DATA_KEY$b}`;
- var DATA_API_KEY$8 = ".data-api";
- var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
+ var 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 [];
+ },
+ 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) : [];
+ }
+ };
+ var 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);
+ instance[method]();
+ });
+ };
+ var NAME$f = "alert";
+ var DATA_KEY$a = "bs.alert";
+ var EVENT_KEY$b = `.${DATA_KEY$a}`;
var EVENT_CLOSE = `close${EVENT_KEY$b}`;
var EVENT_CLOSED = `closed${EVENT_KEY$b}`;
- var EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
- var CLASS_NAME_ALERT = "alert";
- var CLASS_NAME_FADE$6 = "fade";
- var CLASS_NAME_SHOW$9 = "show";
+ var CLASS_NAME_FADE$5 = "fade";
+ var CLASS_NAME_SHOW$8 = "show";
var Alert = class extends BaseComponent {
- // Getters
static get NAME() {
- return NAME$c;
+ return NAME$f;
}
- // Public
- close(element) {
- const rootElement = element ? this._getRootElement(element) : this._element;
- const customEvent = this._triggerCloseEvent(rootElement);
- if (customEvent === null || customEvent.defaultPrevented) {
+ close() {
+ const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
+ if (closeEvent.defaultPrevented) {
return;
}
- this._removeElement(rootElement);
- }
- // Private
- _getRootElement(element) {
- return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
- }
- _triggerCloseEvent(element) {
- return EventHandler.trigger(element, EVENT_CLOSE);
- }
- _removeElement(element) {
- element.classList.remove(CLASS_NAME_SHOW$9);
- const isAnimated = element.classList.contains(CLASS_NAME_FADE$6);
- this._queueCallback(() => this._destroyElement(element), element, isAnimated);
+ 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);
}
- _destroyElement(element) {
- element.remove();
- EventHandler.trigger(element, EVENT_CLOSED);
+ _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 (config === "close") {
- data[config](this);
+ if (typeof config !== "string") {
+ return;
}
- });
- }
- static handleDismiss(alertInstance) {
- return function(event) {
- if (event) {
- event.preventDefault();
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
}
- alertInstance.close(this);
- };
+ data[config](this);
+ });
}
};
- EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
+ enableDismissTrigger(Alert, "close");
defineJQueryPlugin(Alert);
- var NAME$b = "button";
- var DATA_KEY$a = "bs.button";
- var EVENT_KEY$a = `.${DATA_KEY$a}`;
- var DATA_API_KEY$7 = ".data-api";
+ var NAME$e = "button";
+ var DATA_KEY$9 = "bs.button";
+ var EVENT_KEY$a = `.${DATA_KEY$9}`;
+ var DATA_API_KEY$6 = ".data-api";
var CLASS_NAME_ACTIVE$3 = "active";
var SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
- var EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`;
+ var EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
var Button = class extends BaseComponent {
- // Getters
static get NAME() {
- return NAME$b;
+ return NAME$e;
}
- // Public
toggle() {
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);
@@ -2865,105 +2857,119 @@
data.toggle();
});
defineJQueryPlugin(Button);
- function normalizeData(val) {
- if (val === "true") {
- return true;
+ var NAME$d = "swipe";
+ var EVENT_KEY$9 = ".bs.swipe";
+ var EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
+ var EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
+ var EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
+ var EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
+ var EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
+ var POINTER_TYPE_TOUCH = "touch";
+ var POINTER_TYPE_PEN = "pen";
+ var CLASS_NAME_POINTER_EVENT = "pointer-event";
+ var SWIPE_THRESHOLD = 40;
+ var Default$c = {
+ endCallback: null,
+ leftCallback: null,
+ rightCallback: null
+ };
+ var DefaultType$c = {
+ endCallback: "(function|null)",
+ leftCallback: "(function|null)",
+ rightCallback: "(function|null)"
+ };
+ var Swipe = class 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();
}
- if (val === "false") {
- return false;
+ static get Default() {
+ return Default$c;
}
- if (val === Number(val).toString()) {
- return Number(val);
+ static get DefaultType() {
+ return DefaultType$c;
}
- if (val === "" || val === "null") {
- return null;
+ static get NAME() {
+ return NAME$d;
}
- return val;
- }
- function normalizeDataKey(key) {
- return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`);
- }
- var 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 {};
+ dispose() {
+ EventHandler.off(this._element, EVENT_KEY$9);
+ }
+ _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));
}
- const attributes = {};
- Object.keys(element.dataset).filter((key) => key.startsWith("bs")).forEach((key) => {
- let pureKey = key.replace(/^bs/, "");
- pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
- attributes[pureKey] = normalizeData(element.dataset[key]);
- });
- return attributes;
- },
- getDataAttribute(element, key) {
- return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
- },
- offset(element) {
- const rect = element.getBoundingClientRect();
- return {
- top: rect.top + document.body.scrollTop,
- left: rect.left + document.body.scrollLeft
- };
- },
- position(element) {
- return {
- top: element.offsetTop,
- left: element.offsetLeft
- };
+ }
+ _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;
}
};
- var NAME$a = "carousel";
- var DATA_KEY$9 = "bs.carousel";
- var EVENT_KEY$9 = `.${DATA_KEY$9}`;
- var DATA_API_KEY$6 = ".data-api";
- var ARROW_LEFT_KEY = "ArrowLeft";
- var ARROW_RIGHT_KEY = "ArrowRight";
+ var NAME$c = "carousel";
+ var DATA_KEY$8 = "bs.carousel";
+ var EVENT_KEY$8 = `.${DATA_KEY$8}`;
+ var DATA_API_KEY$5 = ".data-api";
+ var ARROW_LEFT_KEY$1 = "ArrowLeft";
+ var ARROW_RIGHT_KEY$1 = "ArrowRight";
var TOUCHEVENT_COMPAT_WAIT = 500;
- var SWIPE_THRESHOLD = 40;
- var Default$9 = {
- interval: 5e3,
- keyboard: true,
- slide: false,
- pause: "hover",
- wrap: true,
- touch: true
- };
- var DefaultType$9 = {
- interval: "(number|boolean)",
- keyboard: "boolean",
- slide: "(boolean|string)",
- pause: "(string|boolean)",
- wrap: "boolean",
- touch: "boolean"
- };
var ORDER_NEXT = "next";
var ORDER_PREV = "prev";
var DIRECTION_LEFT = "left";
var DIRECTION_RIGHT = "right";
- var KEY_TO_DIRECTION = {
- [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
- [ARROW_RIGHT_KEY]: DIRECTION_LEFT
- };
- var EVENT_SLIDE = `slide${EVENT_KEY$9}`;
- var EVENT_SLID = `slid${EVENT_KEY$9}`;
- var EVENT_KEYDOWN = `keydown${EVENT_KEY$9}`;
- var EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$9}`;
- var EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$9}`;
- var EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
- var EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
- var EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
- var EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
- var EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
- var EVENT_DRAG_START = `dragstart${EVENT_KEY$9}`;
- var EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$9}${DATA_API_KEY$6}`;
- var EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`;
+ var EVENT_SLIDE = `slide${EVENT_KEY$8}`;
+ var EVENT_SLID = `slid${EVENT_KEY$8}`;
+ var EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`;
+ var EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`;
+ var EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`;
+ var EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`;
+ var EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`;
+ var EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
var CLASS_NAME_CAROUSEL = "carousel";
var CLASS_NAME_ACTIVE$2 = "active";
var CLASS_NAME_SLIDE = "slide";
@@ -2971,43 +2977,56 @@
var CLASS_NAME_START = "carousel-item-start";
var CLASS_NAME_NEXT = "carousel-item-next";
var CLASS_NAME_PREV = "carousel-item-prev";
- var CLASS_NAME_POINTER_EVENT = "pointer-event";
- var SELECTOR_ACTIVE$1 = ".active";
- var SELECTOR_ACTIVE_ITEM = ".active.carousel-item";
+ var SELECTOR_ACTIVE = ".active";
var SELECTOR_ITEM = ".carousel-item";
+ var SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
var SELECTOR_ITEM_IMG = ".carousel-item img";
- var SELECTOR_NEXT_PREV = ".carousel-item-next, .carousel-item-prev";
var SELECTOR_INDICATORS = ".carousel-indicators";
- var SELECTOR_INDICATOR = "[data-bs-target]";
var SELECTOR_DATA_SLIDE = "[data-bs-slide], [data-bs-slide-to]";
var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
- var POINTER_TYPE_TOUCH = "touch";
- var POINTER_TYPE_PEN = "pen";
+ var KEY_TO_DIRECTION = {
+ [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT,
+ [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT
+ };
+ var Default$b = {
+ interval: 5e3,
+ keyboard: true,
+ pause: "hover",
+ ride: false,
+ touch: true,
+ wrap: true
+ };
+ var DefaultType$b = {
+ interval: "(number|boolean)",
+ keyboard: "boolean",
+ pause: "(string|boolean)",
+ ride: "(boolean|string)",
+ touch: "boolean",
+ wrap: "boolean"
+ };
var Carousel = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._items = null;
+ super(element, config);
this._interval = null;
this._activeElement = null;
- this._isPaused = false;
this._isSliding = false;
this.touchTimeout = null;
- this.touchStartX = 0;
- this.touchDeltaX = 0;
- this._config = this._getConfig(config);
+ this._swipeHelper = null;
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
- this._touchSupported = "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0;
- this._pointerEvent = Boolean(window.PointerEvent);
this._addEventListeners();
+ if (this._config.ride === CLASS_NAME_CAROUSEL) {
+ this.cycle();
+ }
}
- // Getters
static get Default() {
- return Default$9;
+ return Default$b;
+ }
+ static get DefaultType() {
+ return DefaultType$b;
}
static get NAME() {
- return NAME$a;
+ return NAME$c;
}
- // Public
next() {
this._slide(ORDER_NEXT);
}
@@ -3019,118 +3038,85 @@
prev() {
this._slide(ORDER_PREV);
}
- pause(event) {
- if (!event) {
- this._isPaused = true;
- }
- if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
+ pause() {
+ if (this._isSliding) {
triggerTransitionEnd(this._element);
- this.cycle(true);
}
- clearInterval(this._interval);
- this._interval = null;
+ this._clearInterval();
}
- cycle(event) {
- if (!event) {
- this._isPaused = false;
- }
- if (this._interval) {
- clearInterval(this._interval);
- this._interval = null;
+ cycle() {
+ this._clearInterval();
+ this._updateInterval();
+ this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
+ }
+ _maybeEnableCycle() {
+ if (!this._config.ride) {
+ return;
}
- if (this._config && this._config.interval && !this._isPaused) {
- this._updateInterval();
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
+ if (this._isSliding) {
+ EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
+ return;
}
+ this.cycle();
}
to(index) {
- this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
- const activeIndex = this._getItemIndex(this._activeElement);
- if (index > this._items.length - 1 || index < 0) {
+ 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) {
- this.pause();
- this.cycle();
return;
}
const order2 = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
- this._slide(order2, this._items[index]);
+ this._slide(order2, items[index]);
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$9,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$a, config, DefaultType$9);
- return config;
- }
- _handleSwipe() {
- const absDeltax = Math.abs(this.touchDeltaX);
- if (absDeltax <= SWIPE_THRESHOLD) {
- return;
- }
- const direction = absDeltax / this.touchDeltaX;
- this.touchDeltaX = 0;
- if (!direction) {
- return;
+ dispose() {
+ if (this._swipeHelper) {
+ this._swipeHelper.dispose();
}
- this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
+ super.dispose();
+ }
+ _configAfterMerge(config) {
+ config.defaultInterval = config.interval;
+ return config;
}
_addEventListeners() {
if (this._config.keyboard) {
- EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event));
+ EventHandler.on(this._element, EVENT_KEYDOWN$1, (event) => this._keydown(event));
}
if (this._config.pause === "hover") {
- EventHandler.on(this._element, EVENT_MOUSEENTER, (event) => this.pause(event));
- EventHandler.on(this._element, EVENT_MOUSELEAVE, (event) => this.cycle(event));
+ EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause());
+ EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle());
}
- if (this._config.touch && this._touchSupported) {
+ if (this._config.touch && Swipe.isSupported()) {
this._addTouchEventListeners();
}
}
_addTouchEventListeners() {
- const start2 = (event) => {
- if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
- this.touchStartX = event.clientX;
- } else if (!this._pointerEvent) {
- this.touchStartX = event.touches[0].clientX;
- }
- };
- const move = (event) => {
- this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
- };
- const end2 = (event) => {
- if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
- this.touchDeltaX = event.clientX - this.touchStartX;
+ 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;
}
- this._handleSwipe();
- if (this._config.pause === "hover") {
- this.pause();
- if (this.touchTimeout) {
- clearTimeout(this.touchTimeout);
- }
- this.touchTimeout = setTimeout((event2) => this.cycle(event2), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
+ this.pause();
+ if (this.touchTimeout) {
+ clearTimeout(this.touchTimeout);
}
+ this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
};
- SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach((itemImg) => {
- EventHandler.on(itemImg, EVENT_DRAG_START, (e) => e.preventDefault());
- });
- if (this._pointerEvent) {
- EventHandler.on(this._element, EVENT_POINTERDOWN, (event) => start2(event));
- EventHandler.on(this._element, EVENT_POINTERUP, (event) => end2(event));
- this._element.classList.add(CLASS_NAME_POINTER_EVENT);
- } else {
- EventHandler.on(this._element, EVENT_TOUCHSTART, (event) => start2(event));
- EventHandler.on(this._element, EVENT_TOUCHMOVE, (event) => move(event));
- EventHandler.on(this._element, EVENT_TOUCHEND, (event) => end2(event));
- }
+ 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)) {
@@ -3139,313 +3125,249 @@
const direction = KEY_TO_DIRECTION[event.key];
if (direction) {
event.preventDefault();
- this._slide(direction);
+ this._slide(this._directionToOrder(direction));
}
}
_getItemIndex(element) {
- this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
- return this._items.indexOf(element);
- }
- _getItemByOrder(order2, activeElement) {
- const isNext = order2 === ORDER_NEXT;
- return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
- }
- _triggerSlideEvent(relatedTarget, eventDirectionName) {
- const targetIndex = this._getItemIndex(relatedTarget);
- const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
- return EventHandler.trigger(this._element, EVENT_SLIDE, {
- relatedTarget,
- direction: eventDirectionName,
- from: fromIndex,
- to: targetIndex
- });
+ return this._getItems().indexOf(element);
}
- _setActiveIndicatorElement(element) {
- if (this._indicatorsElement) {
- const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
- activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
- activeIndicator.removeAttribute("aria-current");
- const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
- for (let i = 0; i < indicators.length; i++) {
- if (Number.parseInt(indicators[i].getAttribute("data-bs-slide-to"), 10) === this._getItemIndex(element)) {
- indicators[i].classList.add(CLASS_NAME_ACTIVE$2);
- indicators[i].setAttribute("aria-current", "true");
- break;
- }
- }
+ _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 || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
+ const element = this._activeElement || this._getActive();
if (!element) {
return;
}
const elementInterval = Number.parseInt(element.getAttribute("data-bs-interval"), 10);
- if (elementInterval) {
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
- this._config.interval = elementInterval;
- } else {
- this._config.interval = this._config.defaultInterval || this._config.interval;
- }
+ this._config.interval = elementInterval || this._config.defaultInterval;
}
- _slide(directionOrOrder, element) {
- const order2 = this._directionToOrder(directionOrOrder);
- const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
- const activeElementIndex = this._getItemIndex(activeElement);
- const nextElement = element || this._getItemByOrder(order2, activeElement);
- const nextElementIndex = this._getItemIndex(nextElement);
- const isCycling = Boolean(this._interval);
- const isNext = order2 === ORDER_NEXT;
- const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
- const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
- const eventDirectionName = this._orderToDirection(order2);
- if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) {
- this._isSliding = false;
+ _slide(order2, element = null) {
+ if (this._isSliding) {
return;
}
- if (this._isSliding) {
+ const activeElement = this._getActive();
+ const isNext = order2 === ORDER_NEXT;
+ const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
+ if (nextElement === activeElement) {
return;
}
- const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
+ const nextElementIndex = this._getItemIndex(nextElement);
+ const triggerEvent = (eventName) => {
+ return EventHandler.trigger(this._element, eventName, {
+ relatedTarget: nextElement,
+ direction: this._orderToDirection(order2),
+ from: this._getItemIndex(activeElement),
+ to: nextElementIndex
+ });
+ };
+ const slideEvent = triggerEvent(EVENT_SLIDE);
if (slideEvent.defaultPrevented) {
return;
}
if (!activeElement || !nextElement) {
return;
}
+ const isCycling = Boolean(this._interval);
+ this.pause();
this._isSliding = true;
- if (isCycling) {
- this.pause();
- }
- this._setActiveIndicatorElement(nextElement);
+ this._setActiveIndicatorElement(nextElementIndex);
this._activeElement = nextElement;
- const triggerSlidEvent = () => {
- EventHandler.trigger(this._element, EVENT_SLID, {
- relatedTarget: nextElement,
- direction: eventDirectionName,
- from: activeElementIndex,
- to: nextElementIndex
- });
- };
- if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
- 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;
- setTimeout(triggerSlidEvent, 0);
- };
- this._queueCallback(completeCallBack, activeElement, true);
- } else {
- activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
+ 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;
- triggerSlidEvent();
- }
+ triggerEvent(EVENT_SLID);
+ };
+ this._queueCallback(completeCallBack, activeElement, this._isAnimated());
if (isCycling) {
this.cycle();
}
}
- _directionToOrder(direction) {
- if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
- return direction;
+ _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(order2) {
- if (![ORDER_NEXT, ORDER_PREV].includes(order2)) {
- return order2;
- }
if (isRTL()) {
return order2 === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return order2 === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
}
- // Static
- static carouselInterface(element, config) {
- const data = Carousel.getOrCreateInstance(element, config);
- let {
- _config
- } = data;
- if (typeof config === "object") {
- _config = {
- ..._config,
- ...config
- };
- }
- const action = typeof config === "string" ? config : _config.slide;
- if (typeof config === "number") {
- data.to(config);
- } else if (typeof action === "string") {
- if (typeof data[action] === "undefined") {
- throw new TypeError(`No method named "${action}"`);
- }
- data[action]();
- } else if (_config.interval && _config.ride) {
- data.pause();
- data.cycle();
- }
- }
static jQueryInterface(config) {
return this.each(function() {
- Carousel.carouselInterface(this, config);
+ const data = Carousel.getOrCreateInstance(this, config);
+ if (typeof config === "number") {
+ data.to(config);
+ return;
+ }
+ if (typeof config === "string") {
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
+ }
});
}
- static dataApiClickHandler(event) {
- const target = getElementFromSelector(this);
- if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
- return;
- }
- const config = {
- ...Manipulator.getDataAttributes(target),
- ...Manipulator.getDataAttributes(this)
- };
- const slideIndex = this.getAttribute("data-bs-slide-to");
- if (slideIndex) {
- config.interval = false;
- }
- Carousel.carouselInterface(target, config);
- if (slideIndex) {
- Carousel.getInstance(target).to(slideIndex);
- }
- event.preventDefault();
- }
};
- EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
- EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
+ 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 (let i = 0, len = carousels.length; i < len; i++) {
- Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
+ for (const carousel of carousels) {
+ Carousel.getOrCreateInstance(carousel);
}
});
defineJQueryPlugin(Carousel);
- var NAME$9 = "collapse";
- var DATA_KEY$8 = "bs.collapse";
- var EVENT_KEY$8 = `.${DATA_KEY$8}`;
- var DATA_API_KEY$5 = ".data-api";
- var Default$8 = {
- toggle: true,
- parent: ""
- };
- var DefaultType$8 = {
- toggle: "boolean",
- parent: "(string|element)"
- };
- var EVENT_SHOW$5 = `show${EVENT_KEY$8}`;
- var EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`;
- var EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
- var EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
- var EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
- var CLASS_NAME_SHOW$8 = "show";
+ var NAME$b = "collapse";
+ var DATA_KEY$7 = "bs.collapse";
+ var EVENT_KEY$7 = `.${DATA_KEY$7}`;
+ var DATA_API_KEY$4 = ".data-api";
+ var EVENT_SHOW$6 = `show${EVENT_KEY$7}`;
+ var EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`;
+ var EVENT_HIDE$6 = `hide${EVENT_KEY$7}`;
+ var EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`;
+ var EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
+ var CLASS_NAME_SHOW$7 = "show";
var CLASS_NAME_COLLAPSE = "collapse";
var CLASS_NAME_COLLAPSING = "collapsing";
var CLASS_NAME_COLLAPSED = "collapsed";
+ var CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
+ var CLASS_NAME_HORIZONTAL = "collapse-horizontal";
var WIDTH = "width";
var HEIGHT = "height";
- var SELECTOR_ACTIVES = ".show, .collapsing";
+ var SELECTOR_ACTIVES = ".collapse.show, .collapse.collapsing";
var SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
+ var Default$a = {
+ parent: null,
+ toggle: true
+ };
+ var DefaultType$a = {
+ parent: "(null|element)",
+ toggle: "boolean"
+ };
var Collapse = class extends BaseComponent {
constructor(element, config) {
- super(element);
+ super(element, config);
this._isTransitioning = false;
- this._config = this._getConfig(config);
- this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$4}[href="#${this._element.id}"],${SELECTOR_DATA_TOGGLE$4}[data-bs-target="#${this._element.id}"]`);
+ this._triggerArray = [];
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
- for (let i = 0, len = toggleList.length; i < len; i++) {
- const elem = toggleList[i];
- const selector = getSelectorFromElement(elem);
- const filterElement = SelectorEngine.find(selector).filter((foundElem) => foundElem === this._element);
+ 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._selector = selector;
this._triggerArray.push(elem);
}
}
- this._parent = this._config.parent ? this._getParent() : null;
+ this._initializeChildren();
if (!this._config.parent) {
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
+ this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
}
if (this._config.toggle) {
this.toggle();
}
}
- // Getters
static get Default() {
- return Default$8;
+ return Default$a;
+ }
+ static get DefaultType() {
+ return DefaultType$a;
}
static get NAME() {
- return NAME$9;
+ return NAME$b;
}
- // Public
toggle() {
- if (this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isShown()) {
this.hide();
} else {
this.show();
}
}
show() {
- if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isTransitioning || this._isShown()) {
return;
}
- let actives;
- let activesData;
- if (this._parent) {
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter((elem) => {
- if (typeof this._config.parent === "string") {
- return elem.getAttribute("data-bs-parent") === this._config.parent;
- }
- return elem.classList.contains(CLASS_NAME_COLLAPSE);
- });
- if (actives.length === 0) {
- actives = null;
- }
+ let activeChildren = [];
+ if (this._config.parent) {
+ activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter((element) => element !== this._element).map((element) => Collapse.getOrCreateInstance(element, {
+ toggle: false
+ }));
}
- const container = SelectorEngine.findOne(this._selector);
- if (actives) {
- const tempActiveData = actives.find((elem) => container !== elem);
- activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
- if (activesData && activesData._isTransitioning) {
- return;
- }
+ if (activeChildren.length && activeChildren[0]._isTransitioning) {
+ return;
}
- const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5);
+ const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6);
if (startEvent.defaultPrevented) {
return;
}
- if (actives) {
- actives.forEach((elemActive) => {
- if (container !== elemActive) {
- Collapse.collapseInterface(elemActive, "hide");
- }
- if (!activesData) {
- Data.set(elemActive, DATA_KEY$8, null);
- }
- });
+ 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;
- if (this._triggerArray.length) {
- this._triggerArray.forEach((element) => {
- element.classList.remove(CLASS_NAME_COLLAPSED);
- element.setAttribute("aria-expanded", true);
- });
- }
- this.setTransitioning(true);
+ 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$8);
+ this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
this._element.style[dimension] = "";
- this.setTransitioning(false);
- EventHandler.trigger(this._element, EVENT_SHOWN$5);
+ EventHandler.trigger(this._element, EVENT_SHOWN$6);
};
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
const scrollSize = `scroll${capitalizedDimension}`;
@@ -3453,10 +3375,10 @@
this._element.style[dimension] = `${this._element[scrollSize]}px`;
}
hide() {
- if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) {
+ if (this._isTransitioning || !this._isShown()) {
return;
}
- const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5);
+ const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
if (startEvent.defaultPrevented) {
return;
}
@@ -3464,94 +3386,72 @@
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$8);
- const triggerArrayLength = this._triggerArray.length;
- if (triggerArrayLength > 0) {
- for (let i = 0; i < triggerArrayLength; i++) {
- const trigger = this._triggerArray[i];
- const elem = getElementFromSelector(trigger);
- if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) {
- trigger.classList.add(CLASS_NAME_COLLAPSED);
- trigger.setAttribute("aria-expanded", false);
- }
+ 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.setTransitioning(true);
+ this._isTransitioning = true;
const complete = () => {
- this.setTransitioning(false);
+ this._isTransitioning = false;
this._element.classList.remove(CLASS_NAME_COLLAPSING);
this._element.classList.add(CLASS_NAME_COLLAPSE);
- EventHandler.trigger(this._element, EVENT_HIDDEN$5);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$6);
};
this._element.style[dimension] = "";
this._queueCallback(complete, this._element, true);
}
- setTransitioning(isTransitioning) {
- this._isTransitioning = isTransitioning;
+ _isShown(element = this._element) {
+ return element.classList.contains(CLASS_NAME_SHOW$7);
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$8,
- ...config
- };
+ _configAfterMerge(config) {
config.toggle = Boolean(config.toggle);
- typeCheckConfig(NAME$9, config, DefaultType$8);
+ config.parent = getElement(config.parent);
return config;
}
_getDimension() {
- return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
- }
- _getParent() {
- let {
- parent
- } = this._config;
- parent = getElement(parent);
- const selector = `${SELECTOR_DATA_TOGGLE$4}[data-bs-parent="${parent}"]`;
- SelectorEngine.find(selector, parent).forEach((element) => {
- const selected = getElementFromSelector(element);
- this._addAriaAndCollapsedClass(selected, [element]);
- });
- return parent;
+ return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
}
- _addAriaAndCollapsedClass(element, triggerArray) {
- if (!element || !triggerArray.length) {
+ _initializeChildren() {
+ if (!this._config.parent) {
return;
}
- const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
- triggerArray.forEach((elem) => {
- if (isOpen) {
- elem.classList.remove(CLASS_NAME_COLLAPSED);
- } else {
- elem.classList.add(CLASS_NAME_COLLAPSED);
+ 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));
}
- elem.setAttribute("aria-expanded", isOpen);
- });
- }
- // Static
- static collapseInterface(element, config) {
- let data = Collapse.getInstance(element);
- const _config = {
- ...Default$8,
- ...Manipulator.getDataAttributes(element),
- ...typeof config === "object" && config ? config : {}
- };
- if (!data && _config.toggle && typeof config === "string" && /show|hide/.test(config)) {
- _config.toggle = false;
}
- if (!data) {
- data = new Collapse(element, _config);
+ }
+ _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));
+ }
+ _addAriaAndCollapsedClass(triggerArray, isOpen) {
+ if (!triggerArray.length) {
+ return;
}
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ for (const element of triggerArray) {
+ element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
+ element.setAttribute("aria-expanded", isOpen);
}
}
static jQueryInterface(config) {
+ const _config = {};
+ if (typeof config === "string" && /show|hide/.test(config)) {
+ _config.toggle = false;
+ }
return this.each(function() {
- Collapse.collapseInterface(this, config);
+ const data = Collapse.getOrCreateInstance(this, _config);
+ if (typeof config === "string") {
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
+ }
});
}
};
@@ -3559,51 +3459,39 @@
if (event.target.tagName === "A" || event.delegateTarget && event.delegateTarget.tagName === "A") {
event.preventDefault();
}
- const triggerData = Manipulator.getDataAttributes(this);
- const selector = getSelectorFromElement(this);
- const selectorElements = SelectorEngine.find(selector);
- selectorElements.forEach((element) => {
- const data = Collapse.getInstance(element);
- let config;
- if (data) {
- if (data._parent === null && typeof triggerData.parent === "string") {
- data._config.parent = triggerData.parent;
- data._parent = data._getParent();
- }
- config = "toggle";
- } else {
- config = triggerData;
- }
- Collapse.collapseInterface(element, config);
- });
+ for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {
+ Collapse.getOrCreateInstance(element, {
+ toggle: false
+ }).toggle();
+ }
});
defineJQueryPlugin(Collapse);
- var NAME$8 = "dropdown";
- var DATA_KEY$7 = "bs.dropdown";
- var EVENT_KEY$7 = `.${DATA_KEY$7}`;
- var DATA_API_KEY$4 = ".data-api";
+ var NAME$a = "dropdown";
+ var DATA_KEY$6 = "bs.dropdown";
+ var EVENT_KEY$6 = `.${DATA_KEY$6}`;
+ var DATA_API_KEY$3 = ".data-api";
var ESCAPE_KEY$2 = "Escape";
- var SPACE_KEY = "Space";
- var TAB_KEY = "Tab";
- var ARROW_UP_KEY = "ArrowUp";
- var ARROW_DOWN_KEY = "ArrowDown";
+ var TAB_KEY$1 = "Tab";
+ var ARROW_UP_KEY$1 = "ArrowUp";
+ var ARROW_DOWN_KEY$1 = "ArrowDown";
var RIGHT_MOUSE_BUTTON = 2;
- var REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
- var EVENT_HIDE$4 = `hide${EVENT_KEY$7}`;
- var EVENT_HIDDEN$4 = `hidden${EVENT_KEY$7}`;
- var EVENT_SHOW$4 = `show${EVENT_KEY$7}`;
- var EVENT_SHOWN$4 = `shown${EVENT_KEY$7}`;
- var EVENT_CLICK = `click${EVENT_KEY$7}`;
- var EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
- var CLASS_NAME_SHOW$7 = "show";
+ var EVENT_HIDE$5 = `hide${EVENT_KEY$6}`;
+ var EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`;
+ var EVENT_SHOW$5 = `show${EVENT_KEY$6}`;
+ var EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`;
+ var EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var CLASS_NAME_SHOW$6 = "show";
var CLASS_NAME_DROPUP = "dropup";
var CLASS_NAME_DROPEND = "dropend";
var CLASS_NAME_DROPSTART = "dropstart";
- var CLASS_NAME_NAVBAR = "navbar";
- var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]';
+ var CLASS_NAME_DROPUP_CENTER = "dropup-center";
+ var CLASS_NAME_DROPDOWN_CENTER = "dropdown-center";
+ var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
+ var SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;
var SELECTOR_MENU = ".dropdown-menu";
+ var SELECTOR_NAVBAR = ".navbar";
var SELECTOR_NAVBAR_NAV = ".navbar-nav";
var SELECTOR_VISIBLE_ITEMS = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)";
var PLACEMENT_TOP = isRTL() ? "top-end" : "top-start";
@@ -3612,97 +3500,69 @@
var PLACEMENT_BOTTOMEND = isRTL() ? "bottom-start" : "bottom-end";
var PLACEMENT_RIGHT = isRTL() ? "left-start" : "right-start";
var PLACEMENT_LEFT = isRTL() ? "right-start" : "left-start";
- var Default$7 = {
- offset: [0, 2],
+ var PLACEMENT_TOPCENTER = "top";
+ var PLACEMENT_BOTTOMCENTER = "bottom";
+ var Default$9 = {
+ autoClose: true,
boundary: "clippingParents",
- reference: "toggle",
display: "dynamic",
+ offset: [0, 2],
popperConfig: null,
- autoClose: true
+ reference: "toggle"
};
- var DefaultType$7 = {
- offset: "(array|string|function)",
+ var DefaultType$9 = {
+ autoClose: "(boolean|string)",
boundary: "(string|element)",
- reference: "(string|element|object)",
display: "string",
+ offset: "(array|string|function)",
popperConfig: "(null|object|function)",
- autoClose: "(boolean|string)"
+ reference: "(string|element|object)"
};
var Dropdown = class extends BaseComponent {
constructor(element, config) {
- super(element);
+ super(element, config);
this._popper = null;
- this._config = this._getConfig(config);
- this._menu = this._getMenuElement();
+ this._parent = this._element.parentNode;
+ 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();
- this._addEventListeners();
}
- // Getters
static get Default() {
- return Default$7;
+ return Default$9;
}
static get DefaultType() {
- return DefaultType$7;
+ return DefaultType$9;
}
static get NAME() {
- return NAME$8;
+ return NAME$a;
}
- // Public
toggle() {
- if (isDisabled(this._element)) {
- return;
- }
- const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
- if (isActive) {
- this.hide();
- return;
- }
- this.show();
+ return this._isShown() ? this.hide() : this.show();
}
show() {
- if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
+ if (isDisabled(this._element) || this._isShown()) {
return;
}
- const parent = Dropdown.getParentFromElement(this._element);
const relatedTarget = {
relatedTarget: this._element
};
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget);
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget);
if (showEvent.defaultPrevented) {
return;
}
- if (this._inNavbar) {
- Manipulator.setDataAttribute(this._menu, "popper", "none");
- } else {
- if (typeof lib_exports === "undefined") {
- throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
- }
- let referenceElement = this._element;
- if (this._config.reference === "parent") {
- referenceElement = parent;
- } else if (isElement2(this._config.reference)) {
- referenceElement = getElement(this._config.reference);
- } else if (typeof this._config.reference === "object") {
- referenceElement = this._config.reference;
- }
- const popperConfig = this._getPopperConfig();
- const isDisplayStatic = popperConfig.modifiers.find((modifier) => modifier.name === "applyStyles" && modifier.enabled === false);
- this._popper = createPopper3(referenceElement, this._menu, popperConfig);
- if (isDisplayStatic) {
- Manipulator.setDataAttribute(this._menu, "popper", "static");
+ this._createPopper();
+ if ("ontouchstart" in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
+ for (const element of [].concat(...document.body.children)) {
+ EventHandler.on(element, "mouseover", noop);
}
}
- if ("ontouchstart" in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
- [].concat(...document.body.children).forEach((elem) => EventHandler.on(elem, "mouseover", noop));
- }
this._element.focus();
this._element.setAttribute("aria-expanded", true);
- this._menu.classList.toggle(CLASS_NAME_SHOW$7);
- this._element.classList.toggle(CLASS_NAME_SHOW$7);
- EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
+ 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._menu.classList.contains(CLASS_NAME_SHOW$7)) {
+ if (isDisabled(this._element) || !this._isShown()) {
return;
}
const relatedTarget = {
@@ -3722,53 +3582,64 @@
this._popper.update();
}
}
- // Private
- _addEventListeners() {
- EventHandler.on(this._element, EVENT_CLICK, (event) => {
- event.preventDefault();
- this.toggle();
- });
- }
_completeHide(relatedTarget) {
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
}
if ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((elem) => EventHandler.off(elem, "mouseover", noop));
+ 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$7);
- this._element.classList.remove(CLASS_NAME_SHOW$7);
+ 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$4, relatedTarget);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget);
}
_getConfig(config) {
- config = {
- ...this.constructor.Default,
- ...Manipulator.getDataAttributes(this._element),
- ...config
- };
- typeCheckConfig(NAME$8, config, this.constructor.DefaultType);
+ config = super._getConfig(config);
if (typeof config.reference === "object" && !isElement2(config.reference) && typeof config.reference.getBoundingClientRect !== "function") {
- throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
+ throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
}
return config;
}
- _getMenuElement() {
- return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
+ _createPopper() {
+ if (typeof lib_exports === "undefined") {
+ throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
+ }
+ let referenceElement = this._element;
+ if (this._config.reference === "parent") {
+ referenceElement = this._parent;
+ } else if (isElement2(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 = createPopper3(referenceElement, this._menu, popperConfig);
+ }
+ _isShown() {
+ return this._menu.classList.contains(CLASS_NAME_SHOW$6);
}
_getPlacement() {
- const parentDropdown = this._element.parentNode;
+ 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;
+ }
const isEnd = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
@@ -3776,14 +3647,14 @@
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
}
_detectNavbar() {
- return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
+ return this._element.closest(SELECTOR_NAVBAR) !== null;
}
_getOffset() {
const {
offset: offset2
} = this._config;
if (typeof offset2 === "string") {
- return offset2.split(",").map((val) => Number.parseInt(val, 10));
+ return offset2.split(",").map((value) => Number.parseInt(value, 10));
}
if (typeof offset2 === "function") {
return (popperData) => offset2(popperData, this._element);
@@ -3805,7 +3676,8 @@
}
}]
};
- if (this._config.display === "static") {
+ if (this._inNavbar || this._config.display === "static") {
+ Manipulator.setDataAttribute(this._menu, "popper", "static");
defaultBsPopperConfig.modifiers = [{
name: "applyStyles",
enabled: false
@@ -3813,212 +3685,138 @@
}
return {
...defaultBsPopperConfig,
- ...typeof this._config.popperConfig === "function" ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
};
}
_selectMenuItem({
key,
target
}) {
- const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
+ const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((element) => isVisible(element));
if (!items.length) {
return;
}
- getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
}
- // Static
- static dropdownInterface(element, config) {
- const data = Dropdown.getOrCreateInstance(element, config);
- if (typeof config === "string") {
+ 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 jQueryInterface(config) {
- return this.each(function() {
- Dropdown.dropdownInterface(this, config);
});
}
static clearMenus(event) {
- if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY)) {
+ if (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY$1) {
return;
}
- const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
- for (let i = 0, len = toggles.length; i < len; i++) {
- const context = Dropdown.getInstance(toggles[i]);
+ 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;
}
- if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) {
+ 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;
+ }
+ 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) {
- 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;
- }
- if (context._menu.contains(event.target) && (event.type === "keyup" && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
- continue;
- }
- if (event.type === "click") {
- relatedTarget.clickEvent = event;
- }
- }
- context._completeHide(relatedTarget);
- }
- }
- static getParentFromElement(element) {
- return getElementFromSelector(element) || element.parentNode;
- }
- static dataApiKeydownHandler(event) {
- if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
- return;
- }
- const isActive = this.classList.contains(CLASS_NAME_SHOW$7);
- if (!isActive && event.key === ESCAPE_KEY$2) {
- return;
- }
- event.preventDefault();
- event.stopPropagation();
- if (isDisabled(this)) {
- return;
- }
- const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
- if (event.key === ESCAPE_KEY$2) {
- getToggleButton().focus();
- Dropdown.clearMenus();
- return;
- }
- if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
- if (!isActive) {
- getToggleButton().click();
- }
- Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
- return;
- }
- if (!isActive || event.key === SPACE_KEY) {
- Dropdown.clearMenus();
- }
- }
- };
- 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.dropdownInterface(this);
- });
- defineJQueryPlugin(Dropdown);
- var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";
- var SELECTOR_STICKY_CONTENT = ".sticky-top";
- var ScrollBarHelper = class {
- constructor() {
- this._element = document.body;
- }
- getWidth() {
- const documentWidth = document.documentElement.clientWidth;
- return Math.abs(window.innerWidth - documentWidth);
- }
- hide() {
- const width = this.getWidth();
- this._disableOverFlow();
- this._setElementAttributes(this._element, "paddingRight", (calculatedValue) => calculatedValue + width);
- this._setElementAttributes(SELECTOR_FIXED_CONTENT, "paddingRight", (calculatedValue) => calculatedValue + width);
- this._setElementAttributes(SELECTOR_STICKY_CONTENT, "marginRight", (calculatedValue) => calculatedValue - width);
- }
- _disableOverFlow() {
- this._saveInitialAttribute(this._element, "overflow");
- this._element.style.overflow = "hidden";
- }
- _setElementAttributes(selector, styleProp, callback) {
- const scrollbarWidth = this.getWidth();
- const manipulationCallBack = (element) => {
- if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
- return;
+ };
+ if (event.type === "click") {
+ relatedTarget.clickEvent = event;
}
- this._saveInitialAttribute(element, styleProp);
- const calculatedValue = window.getComputedStyle(element)[styleProp];
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
- };
- this._applyManipulationCallback(selector, manipulationCallBack);
- }
- reset() {
- this._resetElementAttributes(this._element, "overflow");
- this._resetElementAttributes(this._element, "paddingRight");
- this._resetElementAttributes(SELECTOR_FIXED_CONTENT, "paddingRight");
- this._resetElementAttributes(SELECTOR_STICKY_CONTENT, "marginRight");
- }
- _saveInitialAttribute(element, styleProp) {
- const actualValue = element.style[styleProp];
- if (actualValue) {
- Manipulator.setDataAttribute(element, styleProp, actualValue);
+ context._completeHide(relatedTarget);
}
}
- _resetElementAttributes(selector, styleProp) {
- const manipulationCallBack = (element) => {
- const value = Manipulator.getDataAttribute(element, styleProp);
- if (typeof value === "undefined") {
- element.style.removeProperty(styleProp);
- } else {
- Manipulator.removeDataAttribute(element, styleProp);
- element.style[styleProp] = value;
- }
- };
- this._applyManipulationCallback(selector, manipulationCallBack);
- }
- _applyManipulationCallback(selector, callBack) {
- if (isElement2(selector)) {
- callBack(selector);
- } else {
- SelectorEngine.find(selector, this._element).forEach(callBack);
+ static dataApiKeydownHandler(event) {
+ 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();
+ 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()) {
+ event.stopPropagation();
+ instance.hide();
+ getToggleButton.focus();
}
- }
- isOverflowing() {
- return this.getWidth() > 0;
}
};
- var Default$6 = {
- isVisible: true,
- // if false, we use the backdrop helper without adding any element to the dom
+ 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();
+ });
+ defineJQueryPlugin(Dropdown);
+ var NAME$9 = "backdrop";
+ var CLASS_NAME_FADE$4 = "fade";
+ var CLASS_NAME_SHOW$5 = "show";
+ var EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
+ var Default$8 = {
+ className: "modal-backdrop",
+ clickCallback: null,
isAnimated: false,
- rootElement: "body",
- // give the choice to place backdrop under different elements
- clickCallback: null
+ isVisible: true,
+ rootElement: "body"
};
- var DefaultType$6 = {
- isVisible: "boolean",
+ var DefaultType$8 = {
+ className: "string",
+ clickCallback: "(function|null)",
isAnimated: "boolean",
- rootElement: "(element|string)",
- clickCallback: "(function|null)"
+ isVisible: "boolean",
+ rootElement: "(element|string)"
};
- var NAME$7 = "backdrop";
- var CLASS_NAME_BACKDROP = "modal-backdrop";
- var CLASS_NAME_FADE$5 = "fade";
- var CLASS_NAME_SHOW$6 = "show";
- var EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
- var Backdrop = class {
+ var Backdrop = class extends Config {
constructor(config) {
+ super();
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
+ static get Default() {
+ return Default$8;
+ }
+ static get DefaultType() {
+ return DefaultType$8;
+ }
+ static get NAME() {
+ return NAME$9;
+ }
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
+ const element = this._getElement();
if (this._config.isAnimated) {
- reflow(this._getElement());
+ reflow(element);
}
- this._getElement().classList.add(CLASS_NAME_SHOW$6);
+ element.classList.add(CLASS_NAME_SHOW$5);
this._emulateAnimation(() => {
execute(callback);
});
@@ -4028,109 +3826,249 @@
execute(callback);
return;
}
- this._getElement().classList.remove(CLASS_NAME_SHOW$6);
+ this._getElement().classList.remove(CLASS_NAME_SHOW$5);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
}
- // Private
+ dispose() {
+ if (!this._isAppended) {
+ return;
+ }
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
+ this._element.remove();
+ this._isAppended = false;
+ }
_getElement() {
if (!this._element) {
const backdrop = document.createElement("div");
- backdrop.className = CLASS_NAME_BACKDROP;
+ backdrop.className = this._config.className;
if (this._config.isAnimated) {
- backdrop.classList.add(CLASS_NAME_FADE$5);
+ backdrop.classList.add(CLASS_NAME_FADE$4);
}
this._element = backdrop;
}
return this._element;
}
- _getConfig(config) {
- config = {
- ...Default$6,
- ...typeof config === "object" ? config : {}
- };
+ _configAfterMerge(config) {
config.rootElement = getElement(config.rootElement);
- typeCheckConfig(NAME$7, config, DefaultType$6);
return config;
}
_append() {
if (this._isAppended) {
return;
}
- this._config.rootElement.appendChild(this._getElement());
- EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
+ const element = this._getElement();
+ this._config.rootElement.append(element);
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
- dispose() {
- if (!this._isAppended) {
- return;
- }
- EventHandler.off(this._element, EVENT_MOUSEDOWN);
- this._element.remove();
- this._isAppended = false;
- }
_emulateAnimation(callback) {
executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
}
};
- var NAME$6 = "modal";
- var DATA_KEY$6 = "bs.modal";
- var EVENT_KEY$6 = `.${DATA_KEY$6}`;
- var DATA_API_KEY$3 = ".data-api";
- var ESCAPE_KEY$1 = "Escape";
- var Default$5 = {
- backdrop: true,
- keyboard: true,
- focus: true
+ var NAME$8 = "focustrap";
+ var DATA_KEY$5 = "bs.focustrap";
+ var EVENT_KEY$5 = `.${DATA_KEY$5}`;
+ var EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
+ var EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
+ var TAB_KEY = "Tab";
+ var TAB_NAV_FORWARD = "forward";
+ var TAB_NAV_BACKWARD = "backward";
+ var Default$7 = {
+ autofocus: true,
+ trapElement: null
};
- var DefaultType$5 = {
- backdrop: "(boolean|string)",
- keyboard: "boolean",
- focus: "boolean"
+ var DefaultType$7 = {
+ autofocus: "boolean",
+ trapElement: "element"
+ };
+ var FocusTrap = class extends Config {
+ constructor(config) {
+ super();
+ this._config = this._getConfig(config);
+ this._isActive = false;
+ this._lastTabNavDirection = null;
+ }
+ static get Default() {
+ return Default$7;
+ }
+ static get DefaultType() {
+ return DefaultType$7;
+ }
+ static get NAME() {
+ return NAME$8;
+ }
+ activate() {
+ if (this._isActive) {
+ return;
+ }
+ if (this._config.autofocus) {
+ this._config.trapElement.focus();
+ }
+ EventHandler.off(document, EVENT_KEY$5);
+ 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);
+ }
+ _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;
+ }
+ };
+ var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";
+ var SELECTOR_STICKY_CONTENT = ".sticky-top";
+ var PROPERTY_PADDING = "padding-right";
+ var PROPERTY_MARGIN = "margin-right";
+ var ScrollBarHelper = class {
+ constructor() {
+ this._element = document.body;
+ }
+ getWidth() {
+ const documentWidth = document.documentElement.clientWidth;
+ return Math.abs(window.innerWidth - documentWidth);
+ }
+ hide() {
+ const width = this.getWidth();
+ this._disableOverFlow();
+ this._setElementAttributes(this._element, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width);
+ 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;
+ }
+ _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);
+ 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 (isElement2(selector)) {
+ callBack(selector);
+ return;
+ }
+ for (const sel of SelectorEngine.find(selector, this._element)) {
+ callBack(sel);
+ }
+ }
};
- var EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
- var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`;
- var EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
- var EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
- var EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
- var EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$6}`;
- var EVENT_RESIZE = `resize${EVENT_KEY$6}`;
- var EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
- var EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
- var EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
- var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
- var EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
+ var NAME$7 = "modal";
+ var DATA_KEY$4 = "bs.modal";
+ var EVENT_KEY$4 = `.${DATA_KEY$4}`;
+ var DATA_API_KEY$2 = ".data-api";
+ var ESCAPE_KEY$1 = "Escape";
+ var EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
+ var EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
+ var EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
+ var EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
+ var EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
+ var EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
+ var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
+ var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
+ var EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
+ var EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
var CLASS_NAME_OPEN = "modal-open";
- var CLASS_NAME_FADE$4 = "fade";
- var CLASS_NAME_SHOW$5 = "show";
+ var CLASS_NAME_FADE$3 = "fade";
+ var CLASS_NAME_SHOW$4 = "show";
var CLASS_NAME_STATIC = "modal-static";
+ var OPEN_SELECTOR$1 = ".modal.show";
var SELECTOR_DIALOG = ".modal-dialog";
var SELECTOR_MODAL_BODY = ".modal-body";
var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
- var SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
+ var Default$6 = {
+ backdrop: true,
+ focus: true,
+ keyboard: true
+ };
+ var DefaultType$6 = {
+ backdrop: "(boolean|string)",
+ focus: "boolean",
+ keyboard: "boolean"
+ };
var Modal = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
this._backdrop = this._initializeBackDrop();
+ this._focustrap = this._initializeFocusTrap();
this._isShown = false;
- this._ignoreBackdropClick = false;
this._isTransitioning = false;
this._scrollBar = new ScrollBarHelper();
+ this._addEventListeners();
}
- // Getters
static get Default() {
- return Default$5;
+ return Default$6;
+ }
+ static get DefaultType() {
+ return DefaultType$6;
}
static get NAME() {
- return NAME$6;
+ return NAME$7;
}
- // Public
toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
}
@@ -4138,141 +4076,110 @@
if (this._isShown || this._isTransitioning) {
return;
}
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
relatedTarget
});
if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
- if (this._isAnimated()) {
- this._isTransitioning = true;
- }
+ this._isTransitioning = true;
this._scrollBar.hide();
document.body.classList.add(CLASS_NAME_OPEN);
this._adjustDialog();
- this._setEscapeEvent();
- this._setResizeEvent();
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, (event) => this.hide(event));
- EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
- EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, (event) => {
- if (event.target === this._element) {
- this._ignoreBackdropClick = true;
- }
- });
- });
- this._showBackdrop(() => this._showElement(relatedTarget));
+ this._backdrop.show(() => this._showElement(relatedTarget));
}
- hide(event) {
- if (event && ["A", "AREA"].includes(event.target.tagName)) {
- event.preventDefault();
- }
+ hide() {
if (!this._isShown || this._isTransitioning) {
return;
}
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
if (hideEvent.defaultPrevented) {
return;
}
this._isShown = false;
- const isAnimated = this._isAnimated();
- if (isAnimated) {
- this._isTransitioning = true;
- }
- this._setEscapeEvent();
- this._setResizeEvent();
- EventHandler.off(document, EVENT_FOCUSIN$2);
- this._element.classList.remove(CLASS_NAME_SHOW$5);
- EventHandler.off(this._element, EVENT_CLICK_DISMISS$2);
- EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
- this._queueCallback(() => this._hideModal(), this._element, isAnimated);
+ this._isTransitioning = true;
+ this._focustrap.deactivate();
+ this._element.classList.remove(CLASS_NAME_SHOW$4);
+ this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
}
dispose() {
- [window, this._dialog].forEach((htmlElement) => EventHandler.off(htmlElement, EVENT_KEY$6));
+ EventHandler.off(window, EVENT_KEY$4);
+ EventHandler.off(this._dialog, EVENT_KEY$4);
this._backdrop.dispose();
+ this._focustrap.deactivate();
super.dispose();
- EventHandler.off(document, EVENT_FOCUSIN$2);
}
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()
});
}
- _getConfig(config) {
- config = {
- ...Default$5,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$6, config, DefaultType$5);
- return config;
+ _initializeFocusTrap() {
+ return new FocusTrap({
+ trapElement: this._element
+ });
}
_showElement(relatedTarget) {
- const isAnimated = this._isAnimated();
- const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
- if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
- document.body.appendChild(this._element);
+ 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;
}
- if (isAnimated) {
- reflow(this._element);
- }
- this._element.classList.add(CLASS_NAME_SHOW$5);
- if (this._config.focus) {
- this._enforceFocus();
- }
+ reflow(this._element);
+ this._element.classList.add(CLASS_NAME_SHOW$4);
const transitionComplete = () => {
if (this._config.focus) {
- this._element.focus();
+ this._focustrap.activate();
}
this._isTransitioning = false;
- EventHandler.trigger(this._element, EVENT_SHOWN$3, {
+ EventHandler.trigger(this._element, EVENT_SHOWN$4, {
relatedTarget
});
};
- this._queueCallback(transitionComplete, this._dialog, isAnimated);
+ this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
}
- _enforceFocus() {
- EventHandler.off(document, EVENT_FOCUSIN$2);
- EventHandler.on(document, EVENT_FOCUSIN$2, (event) => {
- if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
- this._element.focus();
+ _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();
});
- }
- _setEscapeEvent() {
- if (this._isShown) {
- EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, (event) => {
- if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
- event.preventDefault();
- this.hide();
- } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) {
+ EventHandler.on(window, EVENT_RESIZE$1, () => {
+ if (this._isShown && !this._isTransitioning) {
+ this._adjustDialog();
+ }
+ });
+ EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, (event) => {
+ 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();
}
});
- } else {
- EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
- }
- }
- _setResizeEvent() {
- if (this._isShown) {
- EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
- } else {
- EventHandler.off(window, EVENT_RESIZE);
- }
+ });
}
_hideModal() {
this._element.style.display = "none";
@@ -4284,76 +4191,51 @@
document.body.classList.remove(CLASS_NAME_OPEN);
this._resetAdjustments();
this._scrollBar.reset();
- EventHandler.trigger(this._element, EVENT_HIDDEN$3);
- });
- }
- _showBackdrop(callback) {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, (event) => {
- if (this._ignoreBackdropClick) {
- this._ignoreBackdropClick = false;
- return;
- }
- if (event.target !== event.currentTarget) {
- return;
- }
- if (this._config.backdrop === true) {
- this.hide();
- } else if (this._config.backdrop === "static") {
- this._triggerBackdropTransition();
- }
+ EventHandler.trigger(this._element, EVENT_HIDDEN$4);
});
- this._backdrop.show(callback);
}
_isAnimated() {
- return this._element.classList.contains(CLASS_NAME_FADE$4);
+ return this._element.classList.contains(CLASS_NAME_FADE$3);
}
_triggerBackdropTransition() {
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
if (hideEvent.defaultPrevented) {
return;
}
- const {
- classList,
- scrollHeight,
- style
- } = this._element;
- const isModalOverflowing = scrollHeight > document.documentElement.clientHeight;
- if (!isModalOverflowing && style.overflowY === "hidden" || classList.contains(CLASS_NAME_STATIC)) {
+ const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
+ const initialOverflowY = this._element.style.overflowY;
+ if (initialOverflowY === "hidden" || this._element.classList.contains(CLASS_NAME_STATIC)) {
return;
}
if (!isModalOverflowing) {
- style.overflowY = "hidden";
+ this._element.style.overflowY = "hidden";
}
- classList.add(CLASS_NAME_STATIC);
+ this._element.classList.add(CLASS_NAME_STATIC);
this._queueCallback(() => {
- classList.remove(CLASS_NAME_STATIC);
- if (!isModalOverflowing) {
- this._queueCallback(() => {
- style.overflowY = "";
- }, this._dialog);
- }
+ 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 && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
- this._element.style.paddingLeft = `${scrollbarWidth}px`;
+ if (isBodyOverflowing && !isModalOverflowing) {
+ const property = isRTL() ? "paddingLeft" : "paddingRight";
+ this._element.style[property] = `${scrollbarWidth}px`;
}
- if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
- this._element.style.paddingRight = `${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);
@@ -4368,68 +4250,76 @@
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function(event) {
- const target = getElementFromSelector(this);
+ const target = SelectorEngine.getElementFromSelector(this);
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
- EventHandler.one(target, EVENT_SHOW$3, (showEvent) => {
+ EventHandler.one(target, EVENT_SHOW$4, (showEvent) => {
if (showEvent.defaultPrevented) {
return;
}
- EventHandler.one(target, EVENT_HIDDEN$3, () => {
+ EventHandler.one(target, EVENT_HIDDEN$4, () => {
if (isVisible(this)) {
this.focus();
}
});
});
+ const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
+ if (alreadyOpen) {
+ Modal.getInstance(alreadyOpen).hide();
+ }
const data = Modal.getOrCreateInstance(target);
data.toggle(this);
});
+ enableDismissTrigger(Modal);
defineJQueryPlugin(Modal);
- var NAME$5 = "offcanvas";
- var DATA_KEY$5 = "bs.offcanvas";
- var EVENT_KEY$5 = `.${DATA_KEY$5}`;
- var DATA_API_KEY$2 = ".data-api";
- var EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`;
+ var NAME$6 = "offcanvas";
+ var DATA_KEY$3 = "bs.offcanvas";
+ var EVENT_KEY$3 = `.${DATA_KEY$3}`;
+ var DATA_API_KEY$1 = ".data-api";
+ var EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
var ESCAPE_KEY = "Escape";
- var Default$4 = {
+ var CLASS_NAME_SHOW$3 = "show";
+ var CLASS_NAME_SHOWING$1 = "showing";
+ var CLASS_NAME_HIDING = "hiding";
+ var CLASS_NAME_BACKDROP = "offcanvas-backdrop";
+ var OPEN_SELECTOR = ".offcanvas.show";
+ var EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
+ var EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
+ var EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
+ var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
+ var EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
+ var EVENT_RESIZE = `resize${EVENT_KEY$3}`;
+ var EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
+ var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
+ var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
+ var Default$5 = {
backdrop: true,
keyboard: true,
scroll: false
};
- var DefaultType$4 = {
- backdrop: "boolean",
+ var DefaultType$5 = {
+ backdrop: "(boolean|string)",
keyboard: "boolean",
scroll: "boolean"
};
- var CLASS_NAME_SHOW$4 = "show";
- var OPEN_SELECTOR = ".offcanvas.show";
- var EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
- var EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
- var EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
- var EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
- var EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$5}`;
- var EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
- var EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
- var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
- var SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
- var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
var Offcanvas = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._isShown = false;
this._backdrop = this._initializeBackDrop();
+ this._focustrap = this._initializeFocusTrap();
this._addEventListeners();
}
- // Getters
- static get NAME() {
- return NAME$5;
- }
static get Default() {
- return Default$4;
+ 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);
}
@@ -4437,25 +4327,27 @@
if (this._isShown) {
return;
}
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
relatedTarget
});
if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
- this._element.style.visibility = "visible";
this._backdrop.show();
if (!this._config.scroll) {
new ScrollBarHelper().hide();
- this._enforceFocusOnElement(this._element);
}
- this._element.removeAttribute("aria-hidden");
this._element.setAttribute("aria-modal", true);
this._element.setAttribute("role", "dialog");
- this._element.classList.add(CLASS_NAME_SHOW$4);
+ this._element.classList.add(CLASS_NAME_SHOWING$1);
const completeCallBack = () => {
- EventHandler.trigger(this._element, EVENT_SHOWN$2, {
+ 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
});
};
@@ -4465,68 +4357,65 @@
if (!this._isShown) {
return;
}
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
if (hideEvent.defaultPrevented) {
return;
}
- EventHandler.off(document, EVENT_FOCUSIN$1);
+ this._focustrap.deactivate();
this._element.blur();
this._isShown = false;
- this._element.classList.remove(CLASS_NAME_SHOW$4);
+ this._element.classList.add(CLASS_NAME_HIDING);
this._backdrop.hide();
const completeCallback = () => {
- this._element.setAttribute("aria-hidden", true);
+ this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
this._element.removeAttribute("aria-modal");
this._element.removeAttribute("role");
- this._element.style.visibility = "hidden";
if (!this._config.scroll) {
new ScrollBarHelper().reset();
}
- EventHandler.trigger(this._element, EVENT_HIDDEN$2);
+ EventHandler.trigger(this._element, EVENT_HIDDEN$3);
};
this._queueCallback(completeCallback, this._element, true);
}
dispose() {
this._backdrop.dispose();
+ this._focustrap.deactivate();
super.dispose();
- EventHandler.off(document, EVENT_FOCUSIN$1);
- }
- // Private
- _getConfig(config) {
- config = {
- ...Default$4,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" ? config : {}
- };
- typeCheckConfig(NAME$5, config, DefaultType$4);
- return config;
}
_initializeBackDrop() {
+ const clickCallback = () => {
+ if (this._config.backdrop === "static") {
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
+ return;
+ }
+ this.hide();
+ };
+ const isVisible2 = Boolean(this._config.backdrop);
return new Backdrop({
- isVisible: this._config.backdrop,
+ className: CLASS_NAME_BACKDROP,
+ isVisible: isVisible2,
isAnimated: true,
rootElement: this._element.parentNode,
- clickCallback: () => this.hide()
+ clickCallback: isVisible2 ? clickCallback : null
});
}
- _enforceFocusOnElement(element) {
- EventHandler.off(document, EVENT_FOCUSIN$1);
- EventHandler.on(document, EVENT_FOCUSIN$1, (event) => {
- if (document !== event.target && element !== event.target && !element.contains(event.target)) {
- element.focus();
- }
+ _initializeFocusTrap() {
+ return new FocusTrap({
+ trapElement: this._element
});
- element.focus();
}
_addEventListeners() {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, (event) => {
- if (this._config.keyboard && event.key === ESCAPE_KEY) {
+ 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);
@@ -4541,49 +4430,41 @@
}
};
EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function(event) {
- const target = getElementFromSelector(this);
+ const target = SelectorEngine.getElementFromSelector(this);
if (["A", "AREA"].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
- EventHandler.one(target, EVENT_HIDDEN$2, () => {
+ EventHandler.one(target, EVENT_HIDDEN$3, () => {
if (isVisible(this)) {
this.focus();
}
});
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
- if (allReadyOpen && allReadyOpen !== target) {
- Offcanvas.getInstance(allReadyOpen).hide();
+ 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$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach((el) => Offcanvas.getOrCreateInstance(el).show()));
- defineJQueryPlugin(Offcanvas);
- var uriAttrs = /* @__PURE__ */ new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]);
- var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
- var 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;
- var allowedAttribute = (attr, allowedAttributeList) => {
- const attrName = attr.nodeName.toLowerCase();
- if (allowedAttributeList.includes(attrName)) {
- if (uriAttrs.has(attrName)) {
- return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
- }
- return true;
+ EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
+ for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
+ Offcanvas.getOrCreateInstance(selector).show();
}
- const regExp = allowedAttributeList.filter((attrRegex) => attrRegex instanceof RegExp);
- for (let i = 0, len = regExp.length; i < len; i++) {
- if (regExp[i].test(attrName)) {
- return true;
+ });
+ 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();
}
}
- return false;
- };
+ });
+ enableDismissTrigger(Offcanvas);
+ defineJQueryPlugin(Offcanvas);
+ var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
var DefaultAllowlist = {
- // Global attributes allowed on any supplied element below.
"*": ["class", "dir", "id", "lang", "role", ARIA_ATTRIBUTE_PATTERN],
a: ["target", "href", "title", "rel"],
area: [],
@@ -4591,7 +4472,10 @@
br: [],
col: [],
code: [],
+ dd: [],
div: [],
+ dl: [],
+ dt: [],
em: [],
hr: [],
h1: [],
@@ -4615,59 +4499,177 @@
u: [],
ul: []
};
- function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
+ var uriAttributes = new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]);
+ var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
+ var 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;
+ }
+ return allowedAttributeList.filter((attributeRegex) => attributeRegex instanceof RegExp).some((regex) => regex.test(attributeName));
+ };
+ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
if (!unsafeHtml.length) {
return unsafeHtml;
}
- if (sanitizeFn && typeof sanitizeFn === "function") {
- return sanitizeFn(unsafeHtml);
+ if (sanitizeFunction && typeof sanitizeFunction === "function") {
+ return sanitizeFunction(unsafeHtml);
}
const domParser = new window.DOMParser();
const createdDocument = domParser.parseFromString(unsafeHtml, "text/html");
- const allowlistKeys = Object.keys(allowList);
const elements = [].concat(...createdDocument.body.querySelectorAll("*"));
- for (let i = 0, len = elements.length; i < len; i++) {
- const el = elements[i];
- const elName = el.nodeName.toLowerCase();
- if (!allowlistKeys.includes(elName)) {
- el.remove();
+ for (const element of elements) {
+ const elementName = element.nodeName.toLowerCase();
+ if (!Object.keys(allowList).includes(elementName)) {
+ element.remove();
continue;
}
- const attributeList = [].concat(...el.attributes);
- const allowedAttributes = [].concat(allowList["*"] || [], allowList[elName] || []);
- attributeList.forEach((attr) => {
- if (!allowedAttribute(attr, allowedAttributes)) {
- el.removeAttribute(attr.nodeName);
+ 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;
}
- var NAME$4 = "tooltip";
- var DATA_KEY$4 = "bs.tooltip";
- var EVENT_KEY$4 = `.${DATA_KEY$4}`;
- var CLASS_PREFIX$1 = "bs-tooltip";
- var BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, "g");
- var DISALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set(["sanitize", "allowList", "sanitizeFn"]);
- var DefaultType$3 = {
- animation: "boolean",
- template: "string",
- title: "(string|element|function)",
- trigger: "string",
- delay: "(number|object)",
+ var NAME$5 = "TemplateFactory";
+ var Default$4 = {
+ allowList: DefaultAllowlist,
+ content: {},
+ extraClass: "",
+ html: false,
+ sanitize: true,
+ sanitizeFn: null,
+ template: ""
+ };
+ var DefaultType$4 = {
+ allowList: "object",
+ content: "object",
+ extraClass: "(string|function)",
html: "boolean",
- selector: "(string|boolean)",
- placement: "(string|function)",
- offset: "(array|string|function)",
- container: "(string|element|boolean)",
- fallbackPlacements: "array",
- boundary: "(string|element)",
- customClass: "(string|function)",
sanitize: "boolean",
sanitizeFn: "(null|function)",
- allowList: "object",
- popperConfig: "(null|object|function)"
+ template: "string"
+ };
+ var DefaultContentType = {
+ entry: "(string|element|function|null)",
+ selector: "(string|element)"
+ };
+ var TemplateFactory = class extends Config {
+ constructor(config) {
+ super();
+ this._config = this._getConfig(config);
+ }
+ static get Default() {
+ return Default$4;
+ }
+ static get DefaultType() {
+ return DefaultType$4;
+ }
+ static get NAME() {
+ return NAME$5;
+ }
+ 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 (isElement2(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, [this]);
+ }
+ _putElementInTemplate(element, templateElement) {
+ if (this._config.html) {
+ templateElement.innerHTML = "";
+ templateElement.append(element);
+ return;
+ }
+ templateElement.textContent = element.textContent;
+ }
};
+ var NAME$4 = "tooltip";
+ var DISALLOWED_ATTRIBUTES = new Set(["sanitize", "allowList", "sanitizeFn"]);
+ var CLASS_NAME_FADE$2 = "fade";
+ var CLASS_NAME_MODAL = "modal";
+ var CLASS_NAME_SHOW$2 = "show";
+ var SELECTOR_TOOLTIP_INNER = ".tooltip-inner";
+ var SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
+ var EVENT_MODAL_HIDE = "hide.bs.modal";
+ var TRIGGER_HOVER = "hover";
+ var TRIGGER_FOCUS = "focus";
+ var TRIGGER_CLICK = "click";
+ var TRIGGER_MANUAL = "manual";
+ var EVENT_HIDE$2 = "hide";
+ var EVENT_HIDDEN$2 = "hidden";
+ var EVENT_SHOW$2 = "show";
+ var EVENT_SHOWN$2 = "shown";
+ var EVENT_INSERTED = "inserted";
+ var EVENT_CLICK$1 = "click";
+ var EVENT_FOCUSIN$1 = "focusin";
+ var EVENT_FOCUSOUT$1 = "focusout";
+ var EVENT_MOUSEENTER = "mouseenter";
+ var EVENT_MOUSELEAVE = "mouseleave";
var AttachmentMap = {
AUTO: "auto",
TOP: "top",
@@ -4676,75 +4678,71 @@
LEFT: isRTL() ? "right" : "left"
};
var Default$3 = {
+ allowList: DefaultAllowlist,
animation: true,
- template: '',
- trigger: "hover focus",
- title: "",
+ boundary: "clippingParents",
+ container: false,
+ customClass: "",
delay: 0,
+ fallbackPlacements: ["top", "right", "bottom", "left"],
html: false,
- selector: false,
+ offset: [0, 6],
placement: "top",
- offset: [0, 0],
- container: false,
- fallbackPlacements: ["top", "right", "bottom", "left"],
- boundary: "clippingParents",
- customClass: "",
+ popperConfig: null,
sanitize: true,
sanitizeFn: null,
- allowList: DefaultAllowlist,
- popperConfig: null
+ selector: false,
+ template: '',
+ title: "",
+ trigger: "hover focus"
};
- var Event$2 = {
- HIDE: `hide${EVENT_KEY$4}`,
- HIDDEN: `hidden${EVENT_KEY$4}`,
- SHOW: `show${EVENT_KEY$4}`,
- SHOWN: `shown${EVENT_KEY$4}`,
- INSERTED: `inserted${EVENT_KEY$4}`,
- CLICK: `click${EVENT_KEY$4}`,
- FOCUSIN: `focusin${EVENT_KEY$4}`,
- FOCUSOUT: `focusout${EVENT_KEY$4}`,
- MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
- MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
+ var 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"
};
- var CLASS_NAME_FADE$3 = "fade";
- var CLASS_NAME_MODAL = "modal";
- var CLASS_NAME_SHOW$3 = "show";
- var HOVER_STATE_SHOW = "show";
- var HOVER_STATE_OUT = "out";
- var SELECTOR_TOOLTIP_INNER = ".tooltip-inner";
- var TRIGGER_HOVER = "hover";
- var TRIGGER_FOCUS = "focus";
- var TRIGGER_CLICK = "click";
- var TRIGGER_MANUAL = "manual";
var Tooltip = class extends BaseComponent {
constructor(element, config) {
if (typeof lib_exports === "undefined") {
throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");
}
- super(element);
+ super(element, config);
this._isEnabled = true;
this._timeout = 0;
- this._hoverState = "";
+ this._isHovered = null;
this._activeTrigger = {};
this._popper = null;
- this._config = this._getConfig(config);
+ this._templateFactory = null;
+ this._newContent = null;
this.tip = null;
this._setListeners();
+ if (!this._config.selector) {
+ this._fixTitle();
+ }
}
- // Getters
static get Default() {
return Default$3;
}
- static get NAME() {
- return NAME$4;
- }
- static get Event() {
- return Event$2;
- }
static get DefaultType() {
return DefaultType$3;
}
- // Public
+ static get NAME() {
+ return NAME$4;
+ }
enable() {
this._isEnabled = true;
}
@@ -4754,216 +4752,180 @@
toggleEnabled() {
this._isEnabled = !this._isEnabled;
}
- toggle(event) {
+ toggle() {
if (!this._isEnabled) {
return;
}
- if (event) {
- const context = this._initializeOnDelegatedTarget(event);
- context._activeTrigger.click = !context._activeTrigger.click;
- if (context._isWithActiveTrigger()) {
- context._enter(null, context);
- } else {
- context._leave(null, context);
- }
- } else {
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
- this._leave(null, this);
- return;
- }
- this._enter(null, this);
+ this._activeTrigger.click = !this._activeTrigger.click;
+ if (this._isShown()) {
+ this._leave();
+ return;
}
+ this._enter();
}
dispose() {
clearTimeout(this._timeout);
- EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), "hide.bs.modal", this._hideModalHandler);
- if (this.tip) {
- this.tip.remove();
- }
- if (this._popper) {
- this._popper.destroy();
+ 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)) {
+ if (!(this._isWithContent() && this._isEnabled)) {
return;
}
- const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
+ const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
const shadowRoot = findShadowRoot(this._element);
- const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
+ const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
if (showEvent.defaultPrevented || !isInTheDom) {
return;
}
- const tip = this.getTipElement();
- const tipId = getUID(this.constructor.NAME);
- tip.setAttribute("id", tipId);
- this._element.setAttribute("aria-describedby", tipId);
- this.setContent();
- if (this._config.animation) {
- tip.classList.add(CLASS_NAME_FADE$3);
- }
- const placement = typeof this._config.placement === "function" ? this._config.placement.call(this, tip, this._element) : this._config.placement;
- const attachment = this._getAttachment(placement);
- this._addAttachmentClass(attachment);
+ this._disposePopper();
+ const tip = this._getTipElement();
+ this._element.setAttribute("aria-describedby", tip.getAttribute("id"));
const {
container
} = this._config;
- Data.set(tip, this.constructor.DATA_KEY, this);
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
- container.appendChild(tip);
- EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
- }
- if (this._popper) {
- this._popper.update();
- } else {
- this._popper = createPopper3(this._element, tip, this._getPopperConfig(attachment));
- }
- tip.classList.add(CLASS_NAME_SHOW$3);
- const customClass = typeof this._config.customClass === "function" ? this._config.customClass() : this._config.customClass;
- if (customClass) {
- tip.classList.add(...customClass.split(" "));
+ 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 ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((element) => {
+ for (const element of [].concat(...document.body.children)) {
EventHandler.on(element, "mouseover", noop);
- });
+ }
}
const complete = () => {
- const prevHoverState = this._hoverState;
- this._hoverState = null;
- EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
- if (prevHoverState === HOVER_STATE_OUT) {
- this._leave(null, this);
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
+ if (this._isHovered === false) {
+ this._leave();
}
+ this._isHovered = false;
};
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
- this._queueCallback(complete, this.tip, isAnimated);
+ this._queueCallback(complete, this.tip, this._isAnimated());
}
hide() {
- if (!this._popper) {
+ if (!this._isShown()) {
return;
}
- const tip = this.getTipElement();
- const complete = () => {
- if (this._isWithActiveTrigger()) {
- return;
- }
- if (this._hoverState !== HOVER_STATE_SHOW) {
- tip.remove();
- }
- this._cleanTipClass();
- this._element.removeAttribute("aria-describedby");
- EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
- if (this._popper) {
- this._popper.destroy();
- this._popper = null;
- }
- };
- const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
+ const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
if (hideEvent.defaultPrevented) {
return;
}
- tip.classList.remove(CLASS_NAME_SHOW$3);
+ const tip = this._getTipElement();
+ tip.classList.remove(CLASS_NAME_SHOW$2);
if ("ontouchstart" in document.documentElement) {
- [].concat(...document.body.children).forEach((element) => EventHandler.off(element, "mouseover", noop));
+ 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;
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
- this._queueCallback(complete, this.tip, isAnimated);
- this._hoverState = "";
+ this._isHovered = null;
+ 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 !== null) {
+ if (this._popper) {
this._popper.update();
}
}
- // Protected
- isWithContent() {
- return Boolean(this.getTitle());
+ _isWithContent() {
+ return Boolean(this._getTitle());
}
- getTipElement() {
- if (this.tip) {
- return this.tip;
+ _getTipElement() {
+ if (!this.tip) {
+ this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
}
- const element = document.createElement("div");
- element.innerHTML = this._config.template;
- this.tip = element.children[0];
return this.tip;
}
- setContent() {
- const tip = this.getTipElement();
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
- tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
- }
- setElementContent(element, content) {
- if (element === null) {
- return;
- }
- if (isElement2(content)) {
- content = getElement(content);
- if (this._config.html) {
- if (content.parentNode !== element) {
- element.innerHTML = "";
- element.appendChild(content);
- }
- } else {
- element.textContent = content.textContent;
- }
- return;
+ _createTipElement(content) {
+ const tip = this._getTemplateFactory(content).toHtml();
+ if (!tip) {
+ return null;
}
- if (this._config.html) {
- if (this._config.sanitize) {
- content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
- }
- element.innerHTML = content;
- } else {
- element.textContent = content;
+ tip.classList.remove(CLASS_NAME_FADE$2, 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._isAnimated()) {
+ tip.classList.add(CLASS_NAME_FADE$2);
}
+ return tip;
}
- getTitle() {
- let title = this._element.getAttribute("data-bs-original-title");
- if (!title) {
- title = typeof this._config.title === "function" ? this._config.title.call(this._element) : this._config.title;
+ setContent(content) {
+ this._newContent = content;
+ if (this._isShown()) {
+ this._disposePopper();
+ this.show();
}
- return title;
}
- updateAttachment(attachment) {
- if (attachment === "right") {
- return "end";
- }
- if (attachment === "left") {
- return "start";
+ _getTemplateFactory(content) {
+ if (this._templateFactory) {
+ this._templateFactory.changeContent(content);
+ } else {
+ this._templateFactory = new TemplateFactory({
+ ...this._config,
+ content,
+ extraClass: this._resolvePossibleFunction(this._config.customClass)
+ });
}
- return attachment;
+ return this._templateFactory;
}
- // Private
- _initializeOnDelegatedTarget(event, context) {
- const dataKey = this.constructor.DATA_KEY;
- context = context || Data.get(event.delegateTarget, dataKey);
- if (!context) {
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
- Data.set(event.delegateTarget, dataKey, context);
- }
- return context;
+ _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());
+ }
+ _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 createPopper3(this._element, tip, this._getPopperConfig(attachment));
}
_getOffset() {
const {
offset: offset2
} = this._config;
if (typeof offset2 === "string") {
- return offset2.split(",").map((val) => Number.parseInt(val, 10));
+ return offset2.split(",").map((value) => Number.parseInt(value, 10));
}
if (typeof offset2 === "function") {
return (popperData) => offset2(popperData, this._element);
}
return offset2;
}
+ _resolvePossibleFunction(arg) {
+ return execute(arg, [this._element]);
+ }
_getPopperConfig(attachment) {
const defaultBsPopperConfig = {
placement: attachment,
@@ -4988,128 +4950,107 @@
element: `.${this.constructor.NAME}-arrow`
}
}, {
- name: "onChange",
+ name: "preSetPlacement",
enabled: true,
- phase: "afterWrite",
- fn: (data) => this._handlePopperPlacementChange(data)
- }],
- onFirstUpdate: (data) => {
- if (data.options.placement !== data.placement) {
- this._handlePopperPlacementChange(data);
+ phase: "beforeMain",
+ fn: (data) => {
+ this._getTipElement().setAttribute("data-popper-placement", data.state.placement);
}
- }
+ }]
};
return {
...defaultBsPopperConfig,
- ...typeof this._config.popperConfig === "function" ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
};
}
- _addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`);
- }
- _getAttachment(placement) {
- return AttachmentMap[placement.toUpperCase()];
- }
_setListeners() {
const triggers = this._config.trigger.split(" ");
- triggers.forEach((trigger) => {
+ for (const trigger of triggers) {
if (trigger === "click") {
- EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, (event) => this.toggle(event));
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, (event) => {
+ const context = this._initializeOnDelegatedTarget(event);
+ context.toggle();
+ });
} else if (trigger !== TRIGGER_MANUAL) {
- const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
- const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
- EventHandler.on(this._element, eventIn, this._config.selector, (event) => this._enter(event));
- EventHandler.on(this._element, eventOut, this._config.selector, (event) => this._leave(event));
+ 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(`.${CLASS_NAME_MODAL}`), "hide.bs.modal", this._hideModalHandler);
- if (this._config.selector) {
- this._config = {
- ...this._config,
- trigger: "manual",
- selector: ""
- };
- } else {
- this._fixTitle();
- }
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
}
_fixTitle() {
const title = this._element.getAttribute("title");
- const originalTitleType = typeof this._element.getAttribute("data-bs-original-title");
- if (title || originalTitleType !== "string") {
- this._element.setAttribute("data-bs-original-title", title || "");
- if (title && !this._element.getAttribute("aria-label") && !this._element.textContent) {
- this._element.setAttribute("aria-label", title);
- }
- this._element.setAttribute("title", "");
- }
- }
- _enter(event, context) {
- context = this._initializeOnDelegatedTarget(event, context);
- if (event) {
- context._activeTrigger[event.type === "focusin" ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
- }
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
- context._hoverState = HOVER_STATE_SHOW;
+ if (!title) {
return;
}
- clearTimeout(context._timeout);
- context._hoverState = HOVER_STATE_SHOW;
- if (!context._config.delay || !context._config.delay.show) {
- context.show();
- return;
+ if (!this._element.getAttribute("aria-label") && !this._element.textContent.trim()) {
+ this._element.setAttribute("aria-label", title);
}
- context._timeout = setTimeout(() => {
- if (context._hoverState === HOVER_STATE_SHOW) {
- context.show();
- }
- }, context._config.delay.show);
+ this._element.setAttribute("data-bs-original-title", title);
+ this._element.removeAttribute("title");
}
- _leave(event, context) {
- context = this._initializeOnDelegatedTarget(event, context);
- if (event) {
- context._activeTrigger[event.type === "focusout" ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
- }
- if (context._isWithActiveTrigger()) {
+ _enter() {
+ if (this._isShown() || this._isHovered) {
+ this._isHovered = true;
return;
}
- clearTimeout(context._timeout);
- context._hoverState = HOVER_STATE_OUT;
- if (!context._config.delay || !context._config.delay.hide) {
- context.hide();
+ this._isHovered = true;
+ this._setTimeout(() => {
+ if (this._isHovered) {
+ this.show();
+ }
+ }, this._config.delay.show);
+ }
+ _leave() {
+ if (this._isWithActiveTrigger()) {
return;
}
- context._timeout = setTimeout(() => {
- if (context._hoverState === HOVER_STATE_OUT) {
- context.hide();
+ this._isHovered = false;
+ this._setTimeout(() => {
+ if (!this._isHovered) {
+ this.hide();
}
- }, context._config.delay.hide);
+ }, this._config.delay.hide);
+ }
+ _setTimeout(handler, timeout) {
+ clearTimeout(this._timeout);
+ this._timeout = setTimeout(handler, timeout);
}
_isWithActiveTrigger() {
- for (const trigger in this._activeTrigger) {
- if (this._activeTrigger[trigger]) {
- return true;
- }
- }
- return false;
+ return Object.values(this._activeTrigger).includes(true);
}
_getConfig(config) {
const dataAttributes = Manipulator.getDataAttributes(this._element);
- Object.keys(dataAttributes).forEach((dataAttr) => {
- if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
- delete dataAttributes[dataAttr];
+ for (const dataAttribute of Object.keys(dataAttributes)) {
+ if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
+ delete dataAttributes[dataAttribute];
}
- });
+ }
config = {
- ...this.constructor.Default,
...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 = {
@@ -5123,153 +5064,90 @@
if (typeof config.content === "number") {
config.content = config.content.toString();
}
- typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
- if (config.sanitize) {
- config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
- }
return config;
}
_getDelegateConfig() {
const config = {};
- if (this._config) {
- for (const key in this._config) {
- if (this.constructor.Default[key] !== this._config[key]) {
- config[key] = this._config[key];
- }
+ 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;
}
- _cleanTipClass() {
- const tip = this.getTipElement();
- const tabClass = tip.getAttribute("class").match(BSCLS_PREFIX_REGEX$1);
- if (tabClass !== null && tabClass.length > 0) {
- tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
+ _disposePopper() {
+ if (this._popper) {
+ this._popper.destroy();
+ this._popper = null;
}
- }
- _handlePopperPlacementChange(popperData) {
- const {
- state
- } = popperData;
- if (!state) {
- return;
+ if (this.tip) {
+ this.tip.remove();
+ this.tip = null;
}
- this.tip = state.elements.popper;
- this._cleanTipClass();
- this._addAttachmentClass(this._getAttachment(state.placement));
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Tooltip.getOrCreateInstance(this, config);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
+ }
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
}
+ data[config]();
});
}
};
defineJQueryPlugin(Tooltip);
var NAME$3 = "popover";
- var DATA_KEY$3 = "bs.popover";
- var EVENT_KEY$3 = `.${DATA_KEY$3}`;
- var CLASS_PREFIX = "bs-popover";
- var BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, "g");
+ var SELECTOR_TITLE = ".popover-header";
+ var SELECTOR_CONTENT = ".popover-body";
var Default$2 = {
...Tooltip.Default,
- placement: "right",
- offset: [0, 8],
- trigger: "click",
content: "",
- template: ''
+ offset: [0, 8],
+ placement: "right",
+ template: '',
+ trigger: "click"
};
var DefaultType$2 = {
...Tooltip.DefaultType,
- content: "(string|element|function)"
+ content: "(null|string|element|function)"
};
- var Event$1 = {
- HIDE: `hide${EVENT_KEY$3}`,
- HIDDEN: `hidden${EVENT_KEY$3}`,
- SHOW: `show${EVENT_KEY$3}`,
- SHOWN: `shown${EVENT_KEY$3}`,
- INSERTED: `inserted${EVENT_KEY$3}`,
- CLICK: `click${EVENT_KEY$3}`,
- FOCUSIN: `focusin${EVENT_KEY$3}`,
- FOCUSOUT: `focusout${EVENT_KEY$3}`,
- MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
- MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
- };
- var CLASS_NAME_FADE$2 = "fade";
- var CLASS_NAME_SHOW$2 = "show";
- var SELECTOR_TITLE = ".popover-header";
- var SELECTOR_CONTENT = ".popover-body";
var Popover = class extends Tooltip {
- // Getters
static get Default() {
return Default$2;
}
- static get NAME() {
- return NAME$3;
- }
- static get Event() {
- return Event$1;
- }
static get DefaultType() {
return DefaultType$2;
}
- // Overrides
- isWithContent() {
- return this.getTitle() || this._getContent();
- }
- getTipElement() {
- if (this.tip) {
- return this.tip;
- }
- this.tip = super.getTipElement();
- if (!this.getTitle()) {
- SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
- }
- if (!this._getContent()) {
- SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
- }
- return this.tip;
+ static get NAME() {
+ return NAME$3;
}
- setContent() {
- const tip = this.getTipElement();
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
- let content = this._getContent();
- if (typeof content === "function") {
- content = content.call(this._element);
- }
- this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
+ _isWithContent() {
+ return this._getTitle() || this._getContent();
}
- // Private
- _addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
+ _getContentForTemplate() {
+ return {
+ [SELECTOR_TITLE]: this._getTitle(),
+ [SELECTOR_CONTENT]: this._getContent()
+ };
}
_getContent() {
- return this._element.getAttribute("data-bs-content") || this._config.content;
- }
- _cleanTipClass() {
- const tip = this.getTipElement();
- const tabClass = tip.getAttribute("class").match(BSCLS_PREFIX_REGEX);
- if (tabClass !== null && tabClass.length > 0) {
- tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
- }
+ return this._resolvePossibleFunction(this._config.content);
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Popover.getOrCreateInstance(this, config);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
}
+ if (typeof data[config] === "undefined") {
+ throw new TypeError(`No method named "${config}"`);
+ }
+ data[config]();
});
}
};
@@ -5277,296 +5155,401 @@
var NAME$2 = "scrollspy";
var DATA_KEY$2 = "bs.scrollspy";
var EVENT_KEY$2 = `.${DATA_KEY$2}`;
- var DATA_API_KEY$1 = ".data-api";
- var Default$1 = {
- offset: 10,
- method: "auto",
- target: ""
- };
- var DefaultType$1 = {
- offset: "number",
- method: "string",
- target: "(string|element)"
- };
+ var DATA_API_KEY = ".data-api";
var EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
- var EVENT_SCROLL = `scroll${EVENT_KEY$2}`;
- var EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`;
+ var EVENT_CLICK = `click${EVENT_KEY$2}`;
+ var EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
var CLASS_NAME_DROPDOWN_ITEM = "dropdown-item";
var CLASS_NAME_ACTIVE$1 = "active";
var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
- var SELECTOR_NAV_LIST_GROUP$1 = ".nav, .list-group";
+ var SELECTOR_TARGET_LINKS = "[href]";
+ var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group";
var SELECTOR_NAV_LINKS = ".nav-link";
var SELECTOR_NAV_ITEMS = ".nav-item";
var SELECTOR_LIST_ITEMS = ".list-group-item";
- var SELECTOR_DROPDOWN$1 = ".dropdown";
+ var SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
+ var SELECTOR_DROPDOWN = ".dropdown";
var SELECTOR_DROPDOWN_TOGGLE$1 = ".dropdown-toggle";
- var METHOD_OFFSET = "offset";
- var METHOD_POSITION = "position";
+ var Default$1 = {
+ offset: null,
+ rootMargin: "0px 0px -25%",
+ smoothScroll: false,
+ target: null,
+ threshold: [0.1, 0.5, 1]
+ };
+ var DefaultType$1 = {
+ offset: "(number|null)",
+ rootMargin: "string",
+ smoothScroll: "boolean",
+ target: "element",
+ threshold: "array"
+ };
var ScrollSpy = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._scrollElement = this._element.tagName === "BODY" ? window : this._element;
- this._config = this._getConfig(config);
- this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
- this._offsets = [];
- this._targets = [];
+ super(element, config);
+ this._targetLinks = new Map();
+ this._observableSections = new Map();
+ this._rootElement = getComputedStyle(this._element).overflowY === "visible" ? null : this._element;
this._activeTarget = null;
- this._scrollHeight = 0;
- EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
+ this._observer = null;
+ this._previousScrollData = {
+ visibleEntryTop: 0,
+ parentScrollTop: 0
+ };
this.refresh();
- this._process();
}
- // Getters
static get Default() {
return Default$1;
}
+ static get DefaultType() {
+ return DefaultType$1;
+ }
static get NAME() {
return NAME$2;
}
- // Public
refresh() {
- const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
- const offsetMethod = this._config.method === "auto" ? autoMethod : this._config.method;
- const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
- this._offsets = [];
- this._targets = [];
- this._scrollHeight = this._getScrollHeight();
- const targets = SelectorEngine.find(this._selector);
- targets.map((element) => {
- const targetSelector = getSelectorFromElement(element);
- const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
- if (target) {
- const targetBCR = target.getBoundingClientRect();
- if (targetBCR.width || targetBCR.height) {
- return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
- }
- }
- return null;
- }).filter((item) => item).sort((a, b) => a[0] - b[0]).forEach((item) => {
- this._offsets.push(item[0]);
- this._targets.push(item[1]);
- });
+ 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() {
- EventHandler.off(this._scrollElement, EVENT_KEY$2);
+ this._observer.disconnect();
super.dispose();
}
- // Private
- _getConfig(config) {
- config = {
- ...Default$1,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" && config ? config : {}
- };
- if (typeof config.target !== "string" && isElement2(config.target)) {
- let {
- id
- } = config.target;
- if (!id) {
- id = getUID(NAME$2);
- config.target.id = id;
- }
- config.target = `#${id}`;
+ _configAfterMerge(config) {
+ config.target = getElement(config.target) || document.body;
+ 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));
}
- typeCheckConfig(NAME$2, config, DefaultType$1);
return config;
}
- _getScrollTop() {
- return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
- }
- _getScrollHeight() {
- return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
+ _maybeEnableSmoothScroll() {
+ if (!this._config.smoothScroll) {
+ return;
+ }
+ 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;
+ }
+ root.scrollTop = height;
+ }
+ });
}
- _getOffsetHeight() {
- return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
+ _getNewObserver() {
+ const options = {
+ root: this._rootElement,
+ threshold: this._config.threshold,
+ rootMargin: this._config.rootMargin
+ };
+ return new IntersectionObserver((entries) => this._observerCallback(entries), options);
}
- _process() {
- const scrollTop = this._getScrollTop() + this._config.offset;
- const scrollHeight = this._getScrollHeight();
- const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
- if (this._scrollHeight !== scrollHeight) {
- this.refresh();
+ _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 (userScrollsDown && entryIsLowerThanPrevious) {
+ activate(entry);
+ if (!parentScrollTop) {
+ return;
+ }
+ continue;
+ }
+ if (!userScrollsDown && !entryIsLowerThanPrevious) {
+ activate(entry);
+ }
}
- if (scrollTop >= maxScroll) {
- const target = this._targets[this._targets.length - 1];
- if (this._activeTarget !== target) {
- this._activate(target);
+ }
+ _initializeTargetsAndObservables() {
+ this._targetLinks = new Map();
+ this._observableSections = new Map();
+ const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
+ for (const anchor of targetLinks) {
+ if (!anchor.hash || isDisabled(anchor)) {
+ continue;
+ }
+ const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
+ if (isVisible(observableSection)) {
+ this._targetLinks.set(decodeURI(anchor.hash), anchor);
+ this._observableSections.set(anchor.hash, observableSection);
}
+ }
+ }
+ _process(target) {
+ if (this._activeTarget === target) {
return;
}
- if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
- this._activeTarget = null;
- this._clear();
+ 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_DROPDOWN_ITEM)) {
+ SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
return;
}
- for (let i = this._offsets.length; i--; ) {
- const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === "undefined" || scrollTop < this._offsets[i + 1]);
- if (isActiveTarget) {
- this._activate(this._targets[i]);
+ 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);
}
}
}
- _activate(target) {
- this._activeTarget = target;
- this._clear();
- const queries = this._selector.split(",").map((selector) => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
- const link = SelectorEngine.findOne(queries.join(","));
- if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
- SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
- link.classList.add(CLASS_NAME_ACTIVE$1);
- } else {
- link.classList.add(CLASS_NAME_ACTIVE$1);
- SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach((listGroup) => {
- SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach((item) => item.classList.add(CLASS_NAME_ACTIVE$1));
- SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach((navItem) => {
- SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach((item) => 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);
}
- EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
- relatedTarget: target
- });
}
- _clear() {
- SelectorEngine.find(this._selector).filter((node) => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach((node) => node.classList.remove(CLASS_NAME_ACTIVE$1));
- }
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = ScrollSpy.getOrCreateInstance(this, config);
if (typeof config !== "string") {
return;
}
- if (typeof data[config] === "undefined") {
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
};
- EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
- SelectorEngine.find(SELECTOR_DATA_SPY).forEach((spy) => new ScrollSpy(spy));
+ EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
+ for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
+ ScrollSpy.getOrCreateInstance(spy);
+ }
});
defineJQueryPlugin(ScrollSpy);
var NAME$1 = "tab";
var DATA_KEY$1 = "bs.tab";
var EVENT_KEY$1 = `.${DATA_KEY$1}`;
- var DATA_API_KEY = ".data-api";
var EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
var EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
var EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
var EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
- var EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`;
- var CLASS_NAME_DROPDOWN_MENU = "dropdown-menu";
+ var EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
+ var EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
+ var EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
+ var ARROW_LEFT_KEY = "ArrowLeft";
+ var ARROW_RIGHT_KEY = "ArrowRight";
+ var ARROW_UP_KEY = "ArrowUp";
+ var ARROW_DOWN_KEY = "ArrowDown";
+ var HOME_KEY = "Home";
+ var END_KEY = "End";
var CLASS_NAME_ACTIVE = "active";
var CLASS_NAME_FADE$1 = "fade";
var CLASS_NAME_SHOW$1 = "show";
- var SELECTOR_DROPDOWN = ".dropdown";
- var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group";
- var SELECTOR_ACTIVE = ".active";
- var SELECTOR_ACTIVE_UL = ":scope > li > .active";
- var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
+ var CLASS_DROPDOWN = "dropdown";
var SELECTOR_DROPDOWN_TOGGLE = ".dropdown-toggle";
- var SELECTOR_DROPDOWN_ACTIVE_CHILD = ":scope > .dropdown-menu .active";
+ var SELECTOR_DROPDOWN_MENU = ".dropdown-menu";
+ var NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`;
+ var SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
+ var SELECTOR_OUTER = ".nav-item, .list-group-item";
+ var SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
+ var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
+ var SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
+ var SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
var Tab = class extends BaseComponent {
- // Getters
+ constructor(element) {
+ super(element);
+ this._parent = this._element.closest(SELECTOR_TAB_PANEL);
+ if (!this._parent) {
+ return;
+ }
+ this._setInitialAttributes(this._parent, this._getChildren());
+ EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event));
+ }
static get NAME() {
return NAME$1;
}
- // Public
show() {
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
+ const innerElem = this._element;
+ if (this._elemIsActive(innerElem)) {
return;
}
- let previous;
- const target = getElementFromSelector(this._element);
- const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
- if (listElement) {
- const itemSelector = listElement.nodeName === "UL" || listElement.nodeName === "OL" ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
- previous = SelectorEngine.find(itemSelector, listElement);
- previous = previous[previous.length - 1];
- }
- const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, {
- relatedTarget: this._element
+ const active = this._getActiveElem();
+ const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
+ relatedTarget: innerElem
}) : null;
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, {
- relatedTarget: previous
+ const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
+ relatedTarget: active
});
- if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
+ if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
+ return;
+ }
+ this._deactivate(active, innerElem);
+ this._activate(innerElem, active);
+ }
+ _activate(element, relatedElem) {
+ if (!element) {
return;
}
- this._activate(this._element, listElement);
+ element.classList.add(CLASS_NAME_ACTIVE);
+ this._activate(SelectorEngine.getElementFromSelector(element));
const complete = () => {
- EventHandler.trigger(previous, EVENT_HIDDEN$1, {
- relatedTarget: this._element
+ if (element.getAttribute("role") !== "tab") {
+ element.classList.add(CLASS_NAME_SHOW$1);
+ return;
+ }
+ element.removeAttribute("tabindex");
+ element.setAttribute("aria-selected", true);
+ this._toggleDropDown(element, true);
+ EventHandler.trigger(element, EVENT_SHOWN$1, {
+ relatedTarget: relatedElem
});
- EventHandler.trigger(this._element, EVENT_SHOWN$1, {
- relatedTarget: previous
+ };
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
+ }
+ _deactivate(element, relatedElem) {
+ if (!element) {
+ return;
+ }
+ element.classList.remove(CLASS_NAME_ACTIVE);
+ element.blur();
+ this._deactivate(SelectorEngine.getElementFromSelector(element));
+ const complete = () => {
+ if (element.getAttribute("role") !== "tab") {
+ element.classList.remove(CLASS_NAME_SHOW$1);
+ return;
+ }
+ element.setAttribute("aria-selected", false);
+ element.setAttribute("tabindex", "-1");
+ this._toggleDropDown(element, false);
+ EventHandler.trigger(element, EVENT_HIDDEN$1, {
+ relatedTarget: relatedElem
});
};
- if (target) {
- this._activate(target, target.parentNode, complete);
- } else {
- complete();
- }
- }
- // Private
- _activate(element, container, callback) {
- const activeElements = container && (container.nodeName === "UL" || container.nodeName === "OL") ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
- const active = activeElements[0];
- const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1);
- const complete = () => this._transitionComplete(element, active, callback);
- if (active && isTransitioning) {
- active.classList.remove(CLASS_NAME_SHOW$1);
- this._queueCallback(complete, element, true);
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
+ }
+ _keydown(event) {
+ if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
+ return;
+ }
+ event.stopPropagation();
+ event.preventDefault();
+ const children = this._getChildren().filter((element) => !isDisabled(element));
+ let nextActiveElement;
+ if ([HOME_KEY, END_KEY].includes(event.key)) {
+ nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
} else {
- complete();
+ 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();
}
}
- _transitionComplete(element, active, callback) {
- if (active) {
- active.classList.remove(CLASS_NAME_ACTIVE);
- const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
- if (dropdownChild) {
- dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
- }
- if (active.getAttribute("role") === "tab") {
- active.setAttribute("aria-selected", false);
- }
+ _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);
}
- element.classList.add(CLASS_NAME_ACTIVE);
- if (element.getAttribute("role") === "tab") {
- element.setAttribute("aria-selected", true);
+ }
+ _setInitialAttributesOnChild(child) {
+ child = this._getInnerElement(child);
+ const isActive = this._elemIsActive(child);
+ const outerElem = this._getOuterElement(child);
+ child.setAttribute("aria-selected", isActive);
+ if (outerElem !== child) {
+ this._setAttributeIfNotExists(outerElem, "role", "presentation");
}
- reflow(element);
- if (element.classList.contains(CLASS_NAME_FADE$1)) {
- element.classList.add(CLASS_NAME_SHOW$1);
+ if (!isActive) {
+ child.setAttribute("tabindex", "-1");
}
- let parent = element.parentNode;
- if (parent && parent.nodeName === "LI") {
- parent = parent.parentNode;
+ this._setAttributeIfNotExists(child, "role", "tab");
+ this._setInitialAttributesOnTargetPanel(child);
+ }
+ _setInitialAttributesOnTargetPanel(child) {
+ const target = SelectorEngine.getElementFromSelector(child);
+ if (!target) {
+ return;
}
- if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
- const dropdownElement = element.closest(SELECTOR_DROPDOWN);
- if (dropdownElement) {
- SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach((dropdown) => dropdown.classList.add(CLASS_NAME_ACTIVE));
- }
- element.setAttribute("aria-expanded", true);
+ this._setAttributeIfNotExists(target, "role", "tabpanel");
+ if (child.id) {
+ this._setAttributeIfNotExists(target, "aria-labelledby", `${child.id}`);
+ }
+ }
+ _toggleDropDown(element, open) {
+ const outerElem = this._getOuterElement(element);
+ if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
+ return;
}
- if (callback) {
- callback();
+ const toggle = (selector, className) => {
+ const element2 = SelectorEngine.findOne(selector, outerElem);
+ if (element2) {
+ element2.classList.toggle(className, open);
+ }
+ };
+ toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
+ toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
+ outerElem.setAttribute("aria-expanded", open);
+ }
+ _setAttributeIfNotExists(element, attribute, value) {
+ if (!element.hasAttribute(attribute)) {
+ element.setAttribute(attribute, value);
}
}
- // Static
+ _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;
+ }
static jQueryInterface(config) {
return this.each(function() {
const data = Tab.getOrCreateInstance(this);
- if (typeof config === "string") {
- if (typeof data[config] === "undefined") {
- throw new TypeError(`No method named "${config}"`);
- }
- data[config]();
+ if (typeof config !== "string") {
+ return;
+ }
+ if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
+ throw new TypeError(`No method named "${config}"`);
}
+ data[config]();
});
}
};
@@ -5577,14 +5560,17 @@
if (isDisabled(this)) {
return;
}
- const data = Tab.getOrCreateInstance(this);
- data.show();
+ Tab.getOrCreateInstance(this).show();
+ });
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
+ for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
+ Tab.getOrCreateInstance(element);
+ }
});
defineJQueryPlugin(Tab);
var NAME = "toast";
var DATA_KEY = "bs.toast";
var EVENT_KEY = `.${DATA_KEY}`;
- var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
var EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
var EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
var EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
@@ -5607,27 +5593,23 @@
autohide: true,
delay: 5e3
};
- var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
var Toast = class extends BaseComponent {
constructor(element, config) {
- super(element);
- this._config = this._getConfig(config);
+ super(element, config);
this._timeout = null;
this._hasMouseInteraction = false;
this._hasKeyboardInteraction = false;
this._setListeners();
}
- // Getters
- static get DefaultType() {
- return DefaultType;
- }
static get Default() {
return Default;
}
+ static get DefaultType() {
+ return DefaultType;
+ }
static get NAME() {
return NAME;
}
- // Public
show() {
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
if (showEvent.defaultPrevented) {
@@ -5639,17 +5621,16 @@
}
const complete = () => {
this._element.classList.remove(CLASS_NAME_SHOWING);
- this._element.classList.add(CLASS_NAME_SHOW);
EventHandler.trigger(this._element, EVENT_SHOWN);
this._maybeScheduleHide();
};
this._element.classList.remove(CLASS_NAME_HIDE);
reflow(this._element);
- this._element.classList.add(CLASS_NAME_SHOWING);
+ this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
}
hide() {
- if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (!this.isShown()) {
return;
}
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
@@ -5658,27 +5639,21 @@
}
const complete = () => {
this._element.classList.add(CLASS_NAME_HIDE);
+ this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
EventHandler.trigger(this._element, EVENT_HIDDEN);
};
- this._element.classList.remove(CLASS_NAME_SHOW);
+ this._element.classList.add(CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
}
dispose() {
this._clearTimeout();
- if (this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (this.isShown()) {
this._element.classList.remove(CLASS_NAME_SHOW);
}
super.dispose();
}
- // Private
- _getConfig(config) {
- config = {
- ...Default,
- ...Manipulator.getDataAttributes(this._element),
- ...typeof config === "object" && config ? config : {}
- };
- typeCheckConfig(NAME, config, this.constructor.DefaultType);
- return config;
+ isShown() {
+ return this._element.classList.contains(CLASS_NAME_SHOW);
}
_maybeScheduleHide() {
if (!this._config.autohide) {
@@ -5694,13 +5669,15 @@
_onInteraction(event, isInteracting) {
switch (event.type) {
case "mouseover":
- case "mouseout":
+ case "mouseout": {
this._hasMouseInteraction = isInteracting;
break;
+ }
case "focusin":
- case "focusout":
+ case "focusout": {
this._hasKeyboardInteraction = isInteracting;
break;
+ }
}
if (isInteracting) {
this._clearTimeout();
@@ -5713,7 +5690,6 @@
this._maybeScheduleHide();
}
_setListeners() {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
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));
@@ -5723,7 +5699,6 @@
clearTimeout(this._timeout);
this._timeout = null;
}
- // Static
static jQueryInterface(config) {
return this.each(function() {
const data = Toast.getOrCreateInstance(this, config);
@@ -5736,6 +5711,7 @@
});
}
};
+ enableDismissTrigger(Toast);
defineJQueryPlugin(Toast);
// js/bs.ts
@@ -5920,7 +5896,7 @@
];
var formatKeys = ["years", "months", "days", "hours", "minutes", "seconds"];
function getUptime(seconds) {
- const relDate = /* @__PURE__ */ new Date();
+ const relDate = new Date();
const offset2 = relDate.getTimezoneOffset();
const relNow = (0, import_dayjs.default)(relDate);
const relThen = relNow.subtract(seconds, "seconds");
@@ -6058,18 +6034,8 @@
const goodIcon = createElement("i", {}, ["mdi", "mdi-check-bold", "text-success"]);
const badIcon = createElement("i", {}, ["mdi", "mdi-close", "text-warning"]);
const kCell = createElement("td", { innerText: fan }, ["border-end", "text-end"]);
- const vCell = createElement(
- "td",
- {},
- ["border-start", "text-start"],
- [status ? goodIcon : badIcon]
- );
- const row = createElement(
- "tr",
- {},
- [`table-${status ? "success" : "warning"}`],
- [kCell, vCell]
- );
+ const vCell = createElement("td", {}, ["border-start", "text-start"], [status ? goodIcon : badIcon]);
+ const row = createElement("tr", {}, [`table-${status ? "success" : "warning"}`], [kCell, vCell]);
next.insertAdjacentElement("beforebegin", row);
}
}
@@ -6087,18 +6053,8 @@
const goodIcon = createElement("i", {}, ["mdi", "mdi-check-bold", "text-success"]);
const badIcon = createElement("i", {}, ["mdi", "mdi-close", "text-warning"]);
const kCell = createElement("td", { innerText: psu }, ["border-end", "text-end"]);
- const vCell = createElement(
- "td",
- {},
- ["border-start", "text-start"],
- [status ? goodIcon : badIcon]
- );
- const row = createElement(
- "tr",
- {},
- [`table-${status ? "success" : "warning"}`],
- [kCell, vCell]
- );
+ const vCell = createElement("td", {}, ["border-start", "text-start"], [status ? goodIcon : badIcon]);
+ const row = createElement("tr", {}, [`table-${status ? "success" : "warning"}`], [kCell, vCell]);
next.insertAdjacentElement("beforebegin", row);
}
}
@@ -6130,11 +6086,7 @@
if (!hasError(data.get_environment)) {
processEnvironment(data.get_environment);
} else {
- createToast(
- "danger",
- "Error Fetching Device Environment Data",
- data.get_environment.error
- ).show();
+ createToast("danger", "Error Fetching Device Environment Data", data.get_environment.error).show();
}
}
return;
@@ -6149,12 +6101,8 @@
document.addEventListener("DOMContentLoaded", initStatus);
}
})();
-/*! Bundled license information:
-
-bootstrap/dist/js/bootstrap.esm.js:
- (*!
- * Bootstrap v5.0.2 (https://getbootstrap.com/)
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- *)
-*/
+/*!
+ * Bootstrap v5.3.3 (https://getbootstrap.com/)
+ * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
+ */