diff --git a/.Rbuildignore b/.Rbuildignore deleted file mode 100644 index f10061b19..000000000 --- a/.Rbuildignore +++ /dev/null @@ -1,26 +0,0 @@ -^LICENSE$ -^inst/data-raw$ -^appveyor\.yml$ -.ignore -.editorconfig -.gitignore -^\.travis\.yml$ -^.*\.Rproj$ -^\.Rproj\.user$ -^man-roxygen$ -^attic$ -^docs$ -^pkgdown$ -inst/trigger-mlr3book.sh -README\.Rmd -cran\-comments\.md -^CRAN-RELEASE$ -^\.ccache$ -^\.github$ -^clang-.* -^sandbox$ -README.html -^\.vscode$ -^\.lintr$ -^\.pre-commit-config\.yaml$ -^pkgdown/_pkgdown\.yml$ diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 1b8da5d5c..000000000 --- a/.editorconfig +++ /dev/null @@ -1,21 +0,0 @@ -# See http://editorconfig.org -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -indent_style = space -trim_trailing_whitespace = true - -[*.{r,R,md,Rmd}] -indent_size = 2 - -[*.{c,h}] -indent_size = 4 - -[*.{cpp,hpp}] -indent_size = 2 - -[{NEWS.md,DESCRIPTION,LICENSE}] -max_line_length = 80 diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 5ace4600a..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" diff --git a/.github/workflows/dev-cmd-check.yml b/.github/workflows/dev-cmd-check.yml deleted file mode 100644 index 0e17ba4ed..000000000 --- a/.github/workflows/dev-cmd-check.yml +++ /dev/null @@ -1,47 +0,0 @@ -# dev cmd check workflow of the mlr3 ecosystem v0.2.0 -# https://github.com/mlr-org/actions -on: - workflow_dispatch: - push: - branches: - - main - pull_request: - branches: - - main - -name: dev-check - -jobs: - check-package: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.dev-package }} - - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - strategy: - fail-fast: false - matrix: - config: - - {os: ubuntu-latest, r: 'release', dev-package: 'mlr-org/mlr3'} - - steps: - - uses: actions/checkout@v4 - - - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::rcmdcheck - needs: check - - - name: Install dev versions - run: pak::pkg_install(c('${{ matrix.config.dev-package }}')) - shell: Rscript {0} - - - uses: r-lib/actions/check-r-package@v2 diff --git a/.github/workflows/pkgdown.yml b/.github/workflows/pkgdown.yml deleted file mode 100644 index 1b70135e5..000000000 --- a/.github/workflows/pkgdown.yml +++ /dev/null @@ -1,51 +0,0 @@ -# pkgdown workflow of the mlr3 ecosystem v0.1.0 -# https://github.com/mlr-org/actions -on: - push: - branches: - - main - pull_request: - branches: - - main - release: - types: - - published - workflow_dispatch: - -name: pkgdown - -jobs: - pkgdown: - runs-on: ubuntu-latest - - concurrency: - group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - - - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::pkgdown, local::. - needs: website - - - name: Install template - run: pak::pkg_install("mlr-org/mlr3pkgdowntemplate") - shell: Rscript {0} - - - name: Build site - run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) - shell: Rscript {0} - - - name: Deploy to GitHub pages 🚀 - if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.7.3 - with: - clean: false - branch: gh-pages - folder: docs diff --git a/.github/workflows/r-cmd-check.yml b/.github/workflows/r-cmd-check.yml deleted file mode 100644 index d6135b1d1..000000000 --- a/.github/workflows/r-cmd-check.yml +++ /dev/null @@ -1,44 +0,0 @@ -# r cmd check workflow of the mlr3 ecosystem v0.2.0 -# https://github.com/mlr-org/actions -on: - workflow_dispatch: - push: - branches: - - main - pull_request: - branches: - - main - -name: R-CMD-check - -jobs: - r-cmd-check: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - strategy: - fail-fast: false - matrix: - config: - - {os: ubuntu-latest, r: 'devel'} - - {os: ubuntu-latest, r: 'release'} - - steps: - - uses: actions/checkout@v4 - - - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::rcmdcheck - needs: check - - - uses: r-lib/actions/check-r-package@v2 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index dce3cf7f0..000000000 --- a/.gitignore +++ /dev/null @@ -1,108 +0,0 @@ - -# Created by https://www.toptal.com/developers/gitignore/api/r -# Edit at https://www.toptal.com/developers/gitignore?templates=r -### R ### -# History files -.Rhistory -.Rapp.history -# Session Data files -.RData -# User-specific files -.Ruserdata -# Example code in package build process -*-Ex.R -# Output files from R CMD build -/*.tar.gz -# Output files from R CMD check -/*.Rcheck/ -# RStudio files -.Rproj.user/ -# produced vignettes -vignettes/*.html -vignettes/*.pdf -# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 -.httr-oauth -# knitr and R markdown default cache directories -*_cache/ -/cache/ -# Temporary files created by R markdown -*.utf8.md -*.knit.md -# R Environment Variables -.Renviron -### R.Bookdown Stack ### -# R package: bookdown caching files -/*_files/ -# End of https://www.toptal.com/developers/gitignore/api/r -docs/ -# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode -# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace -### VisualStudioCode Patch ### -# Ignore all local history of files -.history -# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode -# Created by https://www.toptal.com/developers/gitignore/api/macos -# Edit at https://www.toptal.com/developers/gitignore?templates=macos -### macOS ### -# General -.DS_Store -.AppleDouble -.LSOverride -# Icon must end with two \r -Icon -# Thumbnails -._* -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk -# End of https://www.toptal.com/developers/gitignore/api/macos -# Created by https://www.toptal.com/developers/gitignore/api/windows -# Edit at https://www.toptal.com/developers/gitignore?templates=windows -### Windows ### -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db -# Dump file -*.stackdump -# Folder config file -[Dd]esktop.ini -# Recycle Bin used on file shares -$RECYCLE.BIN/ -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp -# Windows shortcuts -*.lnk -# End of https://www.toptal.com/developers/gitignore/api/windows - -tests/testthat/Rplots.pdf -src/*.o -src/*.so -src/*.dll -CRAN-RELEASE -.vscode -check/* -docs diff --git a/.ignore b/.ignore deleted file mode 100644 index 5ad99b9ca..000000000 --- a/.ignore +++ /dev/null @@ -1,5 +0,0 @@ -man/ -docs/ -inst/doc/ -attic/ -vignettes/*.html diff --git a/.lintr b/.lintr deleted file mode 100644 index 8391db79f..000000000 --- a/.lintr +++ /dev/null @@ -1,9 +0,0 @@ -linters: linters_with_defaults( - # lintr defaults: https://lintr.r-lib.org/reference/default_linters.html - # the following setup changes/removes certain linters - assignment_linter = NULL, # do not force using <- for assignments - object_name_linter = object_name_linter(c("snake_case", "CamelCase")), - cyclocomp_linter = NULL, # do not check function complexity - commented_code_linter = NULL, # allow code in comments - line_length_linter = line_length_linter(180L) - ) diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/.nojekyll @@ -0,0 +1 @@ + diff --git a/404.html b/404.html new file mode 100644 index 000000000..ffdf563ea --- /dev/null +++ b/404.html @@ -0,0 +1,111 @@ + + + + + + + +Page not found (404) • mlr3proba + + + + + + + + + + + + + + + + Skip to contents + + +
+
+
+ +Content not found. Please use links in the navbar. + +
+
+ + + +
+ + + + + + + diff --git a/CNAME b/CNAME new file mode 100644 index 000000000..0f6e99a11 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +mlr3proba.mlr-org.com diff --git a/DESCRIPTION b/DESCRIPTION deleted file mode 100644 index 321b5c382..000000000 --- a/DESCRIPTION +++ /dev/null @@ -1,169 +0,0 @@ -Package: mlr3proba -Title: Probabilistic Supervised Learning for 'mlr3' -Version: 0.8.2 -Authors@R: c( - person("Raphael", "Sonabend", , "raphaelsonabend@gmail.com", role = "aut", - comment = c(ORCID = "0000-0001-9225-4654")), - person("Franz", "Kiraly", , "f.kiraly@ucl.ac.uk", role = "aut"), - person("Michel", "Lang", , "michellang@gmail.com", role = "aut", - comment = c(ORCID = "0000-0001-9754-0393")), - person("Nurul Ain", "Toha", , "nurul.toha.15@ucl.ac.uk", role = "ctb"), - person("Andreas", "Bender", , "bender.at.R@gmail.com", role = "ctb", - comment = c(ORCID = "0000-0001-5628-8611")), - person("John", "Zobolas", , "bblodfon@gmail.com", role = c("cre", "aut"), - comment = c(ORCID = "0000-0002-3609-8674")), - person("Lukas", "Burk", , "github@quantenbrot.de", role = "ctb", - comment = c(ORCID = "0000-0001-7528-3795")), - person("Philip", "Studener", , "philip.studener@gmx.de", role = "aut"), - person("Maximilian", "Mücke", , "muecke.maximilian@gmail.com", role = "ctb", - comment = c(ORCID = "0009-0000-9432-9795")), - person("Lee Xingzhuo", "Li", , "xingzhuo_li@yahoo.com.au", role = "ctb", - comment = c(ORCID = "0000-0001-5259-5198")), - person("Markus", "Goeswein", , "markus.goeswein@outlook.de", role = "ctb") - ) -Description: Provides extensions for probabilistic supervised learning for - 'mlr3'. This currently includes survival analysis, competing risks and - density estimation. -License: LGPL-3 -URL: https://mlr3proba.mlr-org.com, https://github.com/mlr-org/mlr3proba -BugReports: https://github.com/mlr-org/mlr3proba/issues -Depends: - mlr3 (>= 1.0.0), - R (>= 3.5.0) -Imports: - checkmate, - data.table, - distr6 (>= 1.8.4), - ggplot2, - mlr3misc (>= 0.8.0), - mlr3pipelines (>= 0.7.0), - paradox (>= 1.0.0), - R6, - Rcpp (>= 1.0.4), - survival -Suggests: - abind, - coxed, - GGally, - glmnet, - knitr, - lgr, - lifecycle, - mirai, - mlr3learners (>= 0.10.0), - mlr3viz, - pammtools, - param6 (>= 0.2.4), - polspline, - pracma, - riskRegression, - rpart, - set6 (>= 0.2.6), - simsurv, - survAUC, - testthat (>= 3.0.0) -LinkingTo: - Rcpp -Remotes: - mlr-org/mlr3, - jkropko/coxed@bc92e25, - xoopR/distr6, - xoopR/param6, - xoopR/set6 -ByteCompile: true -Config/testthat/edition: 3 -Encoding: UTF-8 -LazyData: true -NeedsCompilation: no -Roxygen: list(markdown = TRUE, r6 = TRUE) -RoxygenNote: 7.3.2 -Collate: - 'LearnerCompRisks.R' - 'aaa.R' - 'LearnerCompRisksAalenJohansen.R' - 'LearnerDens.R' - 'LearnerDensHistogram.R' - 'LearnerDensKDE.R' - 'LearnerSurv.R' - 'LearnerSurvCoxPH.R' - 'LearnerSurvKaplan.R' - 'LearnerSurvRpart.R' - 'MeasureCompRisks.R' - 'MeasureCompRisksAUC.R' - 'MeasureDens.R' - 'MeasureDensLogloss.R' - 'MeasureRegrLogloss.R' - 'MeasureSurv.R' - 'MeasureSurvAUC.R' - 'MeasureSurvCalibrationAlpha.R' - 'MeasureSurvCalibrationBeta.R' - 'MeasureSurvChamblessAUC.R' - 'MeasureSurvCindex.R' - 'MeasureSurvDCalibration.R' - 'MeasureSurvGraf.R' - 'MeasureSurvHungAUC.R' - 'MeasureSurvICI.R' - 'MeasureSurvIntLogloss.R' - 'MeasureSurvLogloss.R' - 'MeasureSurvMAE.R' - 'MeasureSurvMSE.R' - 'MeasureSurvNagelkR2.R' - 'MeasureSurvOQuigleyR2.R' - 'MeasureSurvRCLL.R' - 'MeasureSurvRMSE.R' - 'MeasureSurvSchmid.R' - 'MeasureSurvSongAUC.R' - 'MeasureSurvSongTNR.R' - 'MeasureSurvSongTPR.R' - 'MeasureSurvUnoAUC.R' - 'MeasureSurvUnoTNR.R' - 'MeasureSurvUnoTPR.R' - 'MeasureSurvXuR2.R' - 'PipeOpBreslow.R' - 'PipeOpCrankCompositor.R' - 'PipeOpDistrCompositor.R' - 'PipeOpPredClassifSurvDiscTime.R' - 'PipeOpPredClassifSurvIPCW.R' - 'PipeOpPredRegrSurvPEM.R' - 'PipeOpProbregrCompositor.R' - 'PipeOpResponseCompositor.R' - 'PipeOpSurvAvg.R' - 'PipeOpTaskSurvClassifDiscTime.R' - 'PipeOpTaskSurvClassifIPCW.R' - 'PipeOpTaskSurvRegrPEM.R' - 'PredictionCompRisks.R' - 'PredictionDataCompRisks.R' - 'PredictionDataDens.R' - 'PredictionDataSurv.R' - 'PredictionDens.R' - 'PredictionSurv.R' - 'RcppExports.R' - 'TaskCompRisks.R' - 'TaskDens.R' - 'TaskGeneratorCoxed.R' - 'TaskGeneratorSimdens.R' - 'TaskGeneratorSimsurv.R' - 'TaskSurv.R' - 'Task_zzz.R' - 'as_prediction_cmprsk.R' - 'as_prediction_dens.R' - 'as_prediction_surv.R' - 'as_task_cmprisk.R' - 'as_task_dens.R' - 'as_task_surv.R' - 'assertions.R' - 'autoplot.R' - 'bibentries.R' - 'breslow.R' - 'data.R' - 'default_fallback.R' - 'helper_measures.R' - 'helpers.R' - 'histogram.R' - 'mlr3proba-package.R' - 'pecs.R' - 'pipelines.R' - 'plot_probregr.R' - 'surv_return.R' - 'weighted_survival_score.R' - 'zzz.R' diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0a041280b..000000000 --- a/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/LICENSE-text.html b/LICENSE-text.html new file mode 100644 index 000000000..351d81ca2 --- /dev/null +++ b/LICENSE-text.html @@ -0,0 +1,244 @@ + +License • mlr3proba + Skip to contents + + +
+
+
+ +
                   GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/NAMESPACE b/NAMESPACE deleted file mode 100644 index dc2f64890..000000000 --- a/NAMESPACE +++ /dev/null @@ -1,154 +0,0 @@ -# Generated by roxygen2: do not edit by hand - -S3method(as.data.table,PredictionCompRisks) -S3method(as.data.table,PredictionDens) -S3method(as.data.table,PredictionSurv) -S3method(as_prediction,PredictionDataCompRisks) -S3method(as_prediction,PredictionDataDens) -S3method(as_prediction,PredictionDataSurv) -S3method(as_prediction_cmprsk,PredictionCompRisks) -S3method(as_prediction_cmprsk,data.frame) -S3method(as_prediction_dens,PredictionDens) -S3method(as_prediction_dens,data.frame) -S3method(as_prediction_surv,PredictionSurv) -S3method(as_prediction_surv,data.frame) -S3method(as_task_cmprsk,DataBackend) -S3method(as_task_cmprsk,TaskCompRisks) -S3method(as_task_cmprsk,data.frame) -S3method(as_task_dens,DataBackend) -S3method(as_task_dens,TaskDens) -S3method(as_task_dens,data.frame) -S3method(as_task_surv,DataBackend) -S3method(as_task_surv,TaskSurv) -S3method(as_task_surv,data.frame) -S3method(autoplot,PredictionSurv) -S3method(autoplot,TaskDens) -S3method(autoplot,TaskSurv) -S3method(c,PredictionDataCompRisks) -S3method(c,PredictionDataDens) -S3method(c,PredictionDataSurv) -S3method(check_prediction_data,PredictionDataCompRisks) -S3method(check_prediction_data,PredictionDataDens) -S3method(check_prediction_data,PredictionDataSurv) -S3method(default_fallback,LearnerCompRisks) -S3method(default_fallback,LearnerDens) -S3method(default_fallback,LearnerSurv) -S3method(filter_prediction_data,PredictionDataCompRisks) -S3method(filter_prediction_data,PredictionDataSurv) -S3method(is_missing_prediction_data,PredictionDataCompRisks) -S3method(is_missing_prediction_data,PredictionDataDens) -S3method(is_missing_prediction_data,PredictionDataSurv) -S3method(pecs,PredictionSurv) -S3method(pecs,list) -S3method(plot,TaskDens) -S3method(plot,TaskSurv) -export(.surv_return) -export(LearnerCompRisks) -export(LearnerCompRisksAalenJohansen) -export(LearnerDens) -export(LearnerDensHistogram) -export(LearnerDensKDE) -export(LearnerSurv) -export(LearnerSurvCoxPH) -export(LearnerSurvKaplan) -export(LearnerSurvRpart) -export(MeasureCompRisks) -export(MeasureCompRisksAUC) -export(MeasureDens) -export(MeasureDensLogloss) -export(MeasureRegrLogloss) -export(MeasureSurv) -export(MeasureSurvAUC) -export(MeasureSurvCalibrationAlpha) -export(MeasureSurvCalibrationBeta) -export(MeasureSurvChamblessAUC) -export(MeasureSurvCindex) -export(MeasureSurvDCalibration) -export(MeasureSurvGraf) -export(MeasureSurvHungAUC) -export(MeasureSurvICI) -export(MeasureSurvIntLogloss) -export(MeasureSurvLogloss) -export(MeasureSurvMAE) -export(MeasureSurvMSE) -export(MeasureSurvNagelkR2) -export(MeasureSurvOQuigleyR2) -export(MeasureSurvRCLL) -export(MeasureSurvRMSE) -export(MeasureSurvSchmid) -export(MeasureSurvSongAUC) -export(MeasureSurvSongTNR) -export(MeasureSurvSongTPR) -export(MeasureSurvUnoAUC) -export(MeasureSurvUnoTNR) -export(MeasureSurvUnoTPR) -export(MeasureSurvXuR2) -export(PipeOpBreslow) -export(PipeOpCrankCompositor) -export(PipeOpDistrCompositor) -export(PipeOpPredClassifSurvDiscTime) -export(PipeOpPredClassifSurvIPCW) -export(PipeOpPredRegrSurvPEM) -export(PipeOpProbregr) -export(PipeOpResponseCompositor) -export(PipeOpSurvAvg) -export(PipeOpTaskSurvClassifDiscTime) -export(PipeOpTaskSurvClassifIPCW) -export(PipeOpTaskSurvRegrPEM) -export(PredictionCompRisks) -export(PredictionDens) -export(PredictionSurv) -export(TaskCompRisks) -export(TaskDens) -export(TaskGeneratorCoxed) -export(TaskGeneratorSimdens) -export(TaskGeneratorSimsurv) -export(TaskSurv) -export(as_prediction_cmprsk) -export(as_prediction_dens) -export(as_prediction_surv) -export(as_task_cmprsk) -export(as_task_dens) -export(as_task_surv) -export(assert_cif_list) -export(assert_surv) -export(assert_surv_matrix) -export(breslow) -export(get_mortality) -export(pecs) -export(pipeline_survtoclassif_IPCW) -export(pipeline_survtoclassif_disctime) -export(pipeline_survtoregr_pem) -export(plot_probregr) -import(checkmate) -import(data.table) -import(distr6) -import(ggplot2) -import(mlr3) -import(mlr3misc) -import(paradox) -importFrom(R6,R6Class) -importFrom(Rcpp,sourceCpp) -importFrom(mlr3,default_fallback) -importFrom(mlr3pipelines,"%>>%") -importFrom(mlr3pipelines,Graph) -importFrom(mlr3pipelines,as_graph) -importFrom(mlr3pipelines,gunion) -importFrom(mlr3pipelines,pipeline_greplicate) -importFrom(mlr3pipelines,po) -importFrom(mlr3pipelines,ppl) -importFrom(stats,density) -importFrom(stats,median) -importFrom(stats,model.frame) -importFrom(stats,model.matrix) -importFrom(stats,predict) -importFrom(stats,quantile) -importFrom(stats,sd) -importFrom(stats,setNames) -importFrom(survival,Surv) -importFrom(utils,data) -importFrom(utils,getFromNamespace) -importFrom(utils,head) -importFrom(utils,tail) -useDynLib(mlr3proba) -useDynLib(mlr3proba, .registration = TRUE) diff --git a/NEWS.md b/NEWS.md deleted file mode 100644 index 0d5b6adf9..000000000 --- a/NEWS.md +++ /dev/null @@ -1,425 +0,0 @@ -# mlr3proba dev - -* feat: add `default_fallback()` (returns `surv.kaplan`) -* feat: add `importance`, `weights` and `selected_features` properties in Kaplan-Meier for compatibility with other survival learners when it is used as a fallback learner - -# mlr3proba 0.8.2 - -* fix: `coxed` package was removed from CRAN so now we install the latest working CRAN version (`0.3.3`) from GitHub -* feat: event-weighted mean AUC(t) as default score in `msr("cmprsk.auc")` -* feat: The pipeops `PipeOpTaskSurvRegrPEM` and `PipeOpTaskSurvClassifDiscTime` now apply the data transformation on an internal validation task if it exists. This enables the use of e.g `xgboost` regression or classification learners with `early_stopping` on the corresponding pipelines. - -# mlr3proba 0.8.1 - -* feat: `surv.logloss` and `surv.rcll` now use linear interpolation of S(t) to calculate the density f(t) -* fix: `surv.mae`/`surv.mse`/`surv.rmse` scores return `NA` when test set has only censored observations -* fix: fix bug in msr(`surv.brier`) that resulted in 0 division instead of `eps` division (`Inf` values are filtered out so this was kinda masking the inflation of ISBS) -* refactor: remove `se` argument from most of the scores (not practically used) -* refactor: remove `method` argument from integrated survival scores (the previous default, `method = 2`, time-weighted integration, is now always used) -* **BREACKING CHANGE**: we removed all experimental `proper` scoring rules (and `remove_obs` argument). -Scores yield the same results as before with the default option `proper = FALSE` -* refactor: all private functions start with `.` now and are adequately (privately) documented. Code was refactored for clarity -* refactor: all internal `Rcpp` measure functions -* refine doc in lots of measures - -# mlr3proba 0.8.0 - -* Compatibility with `mlr3` v1.0.0 (`weights_learner`) and `mlr3pipelines` v0.8.0 -* fix: allow cloning of measure objects -* fix: `as.data.table()` for `PredictionSurv` objects holds now one survival curve per observation as it should -* refactor: `TaskSurv` uses only right, left or interval censoring, simplified code a lot in the methods -* feat: add `TaskCompRisks` class and `as_task_cmprk()` S3 methods (support for right-censored data only) -* feat: New `PipeOp`s: `PipeOpTaskSurvRegrPEM`, `PipeOpPredRegrPEM` -* feat: New pipeline (**reduction method**): `pipeline_survtoregr_pem` - -# mlr3proba 0.7.4 - -* fix + update `MeasureSurv`: survival measure labels are now printed and the `obs_loss` property is now supported -* feat: add `na.rm` parameter to `msr("surv.calib_index")` to avoid `NaN` scores - -# mlr3proba 0.7.3 - -* feat: added new calibration measure => `msr("surv.calib_index")` -* refactor + feat: `autoplot.PredictionSurv` - * The default `"calib"` plot uses the survival matrix directly now which is faster - * `"dcalib"` has extra barplot + better documentation - * Added new `type = "scalib"` which constructs the smoothed calibration plots as in Austin et al. (2020) - * **BREAKING CHANGE**: `"preds"` is now called `"isd"` (individual survival distribution). `row_ids` can now be used to filter the observations for which you draw the survival curves. - -# mlr3proba 0.7.2 - -* fix: `lrn("surv.coxph")` is now trained with `model=TRUE` which fixes an issue with using observation weights [stackoverflow link](https://stackoverflow.com/questions/79297386/mlr3-predicted-values-for-surv-coxph-learner-with-case-weights). -* cleanup: remove `tsk("unemployment")` and associated files -* cleanup: remove unused references - -# mlr3proba 0.7.1 - -* cleanup: removed all `PipeOp`s and pipelines related to survival => regression reduction techniques (see #414) -* fix: `$predict_type` of `survtoclassif_disctime` and `survtoclassif_IPCW` was `prob` (classification type) and not `crank` (survival type) -* fix: G(t) is not filtered when `t_max|p_max` is specified in scoring rules (didn't influence evaluation at all) -* docs: Clarified the use and impact of using `t_max` in scoring rules, added examples in scoring rules and AUC scores -* feat: Added new argument `remove_obs` in scoring rules to remove observations with observed time `t > t_max` as a processing step to alleviate IPCW issues. -This was before 'hard-coded' which made the Integrated Brier Score (`msr("surv.graf")`) differ minimally from other implementations and the original definition. - -# mlr3proba 0.7.0 - -* Add `mlr3pipelines` to `Imports` and set minimum latest version from CRAN (`0.7.0`) -* Refactor code to minimize namespace calling and imports such as `mlr3pipelines::` or `R6::` -* Doc updates: add experimental badge in a some PipeOps + add references in others -* Add argument `scale_lp` for AFT `distrcompose` pipeop + respective pipeline - -# mlr3proba 0.6.9 - -* New `PipeOp`s: `PipeOpTaskSurvClassifIPCW`, `PipeOpPredClassifSurvIPCW` -* New pipeline (**reduction method**): `pipeline_survtoclassif_IPCW` -* Improved the way Integrated Brier score handles the `times` argument and the `t_max`, especially when the survival matrix has one time point (column) -* Improved documentation of integrated survival scores -* Improved documentation of all pipelines -* Temp fix of math-rendering issue in package website -* Add experimental `lifecycle` badge for 3 pipelines (`survtoregr`, `distrcompositor` and `probregr`) - these are currently either not supported by literature or tested enough. - -# mlr3proba 0.6.8 - -* `Rcpp` code optimizations -* Fixed ERV scoring to comply with `mlr3` dev version (no bugs before) -* Skipping `survtoregr` pipelines due to bugs (to be refactored in the future) - -# mlr3proba 0.6.7 - -* Deprecate `crank` to `distr` composition in `distrcompose` pipeop (only from `lp` => `distr` works now) -* Add `get_mortality()` function (from `survivalmodels::surv_to_risk()` -* Add Rcpp function `assert_surv_matrix()` -* Update and simplify `crankcompose` pipeop and respective pipeline (no `response` is created anymore) -* Add `responsecompositor` pipeline with `rmst` and `median` - -# mlr3proba 0.6.6 - -* Small fixes and refactoring to the discrete-time pipeops - -# mlr3proba 0.6.5 - -* Add support for discrete-time survival analysis -* New `PipeOp`s: `PipeOpTaskSurvClassifDiscTime`, `PipeOpPredClassifSurvDiscTime` -* New pipeline (**reduction method**): `pipeline_survtoclassif_disctime` - -# mlr3proba 0.6.4 - -* Add useR! 2024 tutorial -* Lots of refactoring, improving code quality, migration to testthat v3, etc. (thanks to @m-muecke) - -# mlr3proba 0.6.3 - -* Add new tasks from `survival` package: `veteran`, `pbc`, `mgus`, `gbsg` - * Refined docs for loaded tasks, `task$help()` works as it should now - * All loaded tasks have now **complete cases** (no features with missing values) -* Refined docs for task generators -* Added task generator from `coxed` package -* Added new methods for `TaskSurv`: `cens_prop()`, `admin_cens_prop()`, `dep_cens_prop()` and `prop_haz()` - -# mlr3proba 0.6.2 - -* Updates in `surv.cindex` measure - * added `p_max` (same as `surv.graf`) - * refactor `cutoff` to `t_max` - -# mlr3proba 0.6.1 - -* Compatibility with upcoming 'paradox' release. -* Fix bug when applying `t_max` in `surv.graf` and similar time-integrated scores. - -# mlr3proba 0.6.0 - -* Optimized `surv.logloss` and `calib_alpha` measures (bypassing `distr6`) -* Update/refine all measure docs (naming conventions from upcoming scoring rules paper) + doc templates -* fix very rare bugs in `calib_alpha`, `surv.logloss` and `surv.graf` (version with proper = FALSE) - -# mlr3proba 0.5.9 - -* Fix several old issues (#348, #301, #281) -* `distrcompositor` and `crankcompositor` deprecated functions were completely removed - -# mlr3proba 0.5.8 - -* Fix Breslow issues (`phash` warning and `Inf` lp predictions) - -# mlr3proba 0.5.7 - -* Add `breslow` function for estimating the cumulative baseline hazard of proportional hazard models -* Add `PipeOpBreslow` to wrap a survival learner and generate `distr` predictions from `lp` predictions -* Add option `breslow` estimator option in `distrcompositor` - -# mlr3proba 0.5.6 - -* Add `extend_quantile` to `autoplot.PredictionSurv` for `type = "dcalib"`, which imputes NAs with the maximum observed survival time -* Fixes default in `autoplot.PredictionSurv`, now `"calib"` -* Update `msr("surv.dcalib")` default for `truncate` to `Inf` - -# mlr3proba 0.5.5 - -* Add `$reverse()` method to `TaskSurv`, which returns the same task but with 1-status. -* Add `reverse` parameter to `TaskSurv$kaplan()` method, which calculates Kaplan-Meier on the censoring distribution of the task (1-status). - -# mlr3proba 0.5.4 - -* Fix bottlenecks in Dcalib and RCLL - -# mlr3proba 0.5.3 - -* Add support for learners that can predict multiple posterior distributions by using `distr6::Arrdist` - -# mlr3proba 0.5.2 - -* Add `plot_probregr` for plotting probabilistic regression distribution predictions -* Fix big bug in `surv.rcll` creating erroneous results as distributions were not being subsetted correctly - -# mlr3proba 0.5.1 - -* Add `regr.logloss` - -# mlr3proba 0.5.0 - -* Possibly small breaking change, renamed `PipeOpProbregrCompositor` to `PipeOpProbregr` and default distribution now `"Uniform"`. -* Renamed `probregrcompositor` pipeline to `probregr` and default distribution now `"Uniform"`. -* Bumped minor version to highlight all fixes in measures below -* Bugfix in setting Uno's AUC parameters -* Bugfix in RCLL when no censoring -* Bugfix in all learners when making single predictions - -# mlr3proba 0.4.17 - -* Fix bug in `surv.rcll` when individual scores are `NA`. - -# mlr3proba 0.4.16 - -* Remove `theme_mlr3` from plots. -* Fix bug in `surv.logloss` when using `IPCW = TRUE` - -# mlr3proba 0.4.15 - -* Fix bug in `surv.cindex` caused when probability of censoring was 0. Added `eps` parameter to control this. - -# mlr3proba 0.4.14 - -* Fix bug in converting distr6 distributions to matrices when creating `PredictionSurv` -* Fix bug in RCLL - -# mlr3proba 0.4.13 - -* Fix minor bug in 'SG' cindex method - -# mlr3proba 0.4.12 - -* Fix bug in survavg pipeline causing unequal weights not to be applied - -# mlr3proba 0.4.11 - -* Fix minor bug in scoring rules - -# mlr3proba 0.4.10 - -* Added `ERV` parameter to scoring rule measures to return more interpretable scoring rules. Explained Residual Variation is the percentage decrease between a scoring rule comparing a Kaplan-Meier baseline to the learner of interest. - -# mlr3proba 0.4.9 - -* Fixed bug in surv.logloss causing IPCW weighting to not be applied correctly - -# mlr3proba 0.4.8 - -* Bug fixes in AUC measures - -# mlr3proba 0.4.7 - -* Add right-censored log loss -* Fix bug in {rpart} where model was being discarded when set to be kept. Parameter `model` now called `keep_model`. - -# mlr3proba 0.4.6 - -* Patch for upstream breakages -* Add `TaskSurv$kaplan` method -* {survivalmodels} now imported (previously suggested) - -# mlr3proba 0.4.5 - -* Improved reduction from survival matrix predictions to ranking predictions -* Fixed cindex bug when all predictions equal -* Fix for valgrind - -# mlr3proba 0.4.4 - -* Minor change to how distributions are created to better support improper distributions -* Fixed bug in `simsurv` task that made it impossible to predict the target - -# mlr3proba 0.4.3 - -* Massive speed-up in distrcompositor PipeOp/pipeline -* More informative error given if `$distr` called for a learner that does not support this return type -* Fix massive bottleneck in scoring rule measures -* Add Density coercions `as_task_dens` and `as_prediction_dens` -* Measures now use parameter sets like learners. This streamlines the interface but unfortunately means ids can no longer be set dynamically. -* Add parameters `t_max` and `p_max` to Graf, Schmid and Integrated Log-loss as an alternative to `times`. `t_max` is equivalent to `times = seq(t_max)` and `p_max` is the proportion of censoring to integrate up to in the dataset. -* Fix bug in Rcpp code that was causing erroneous values for calculating the cindex in datasets greater than 20,000 observations. - -# mlr3proba 0.4.2 - -* Patch for linux - -# mlr3proba 0.4.1 - -* Remove `mlr3extralearners` from Suggests -* Add `response` to `as_prediction_surv` -* Now exported a couple cpp functions and `assert_surv` -* `mlr3` is now in `Depends` not `imports` -* `distr` predictions are now internally stored as matrices to significantly reduce prediction object sizes -* Tasks now support strata property - -# mlr3proba 0.4.0 - -* Deprecated measures from 0.2.0 have now been deleted. -* IPCW measures such as `surv.graf`, `surv.schmid`, and `surv.intlogloss` now allow training data to be passed to the score function with `task` and `train_set` to allow the censoring distribution to be estimated on the training data. This is automatically applied for resample and benchmark results. -* IPCW measures such as `surv.graf`, `surv.schmid`, and `surv.intlogloss` now include a parameter `proper` to determine what weighting scheme should be applied by the estimated censoring distribution, The current method (Graf, 1999) `proper = FALSE`, weights observations either by their event time or 'current' time depending if they're dead or not, the new method `proper = TRUE` weights observations by event time. The `proper = TRUE` method is strictly proper when censoring and survival times are independent and G is estimated on large enough data. The `proper = FALSE` method is never proper. The default is currently `proper = FALSE` to enable backward compatibility, this will be changed to `proper = TRUE` in v0.6.0. -* The `rm_cens` parameter in `surv.logloss` has been deprecated in favour of `IPCW`. `rm_cens` will be removed in v0.6.0. If `rm_cens` or `IPCW` are `TRUE` then censored observations are removed and the score is weighted by an estimate of the censoring distribution at individual event times. Otherwise if `rm_cens` and `IPCW` are `FALSE` then no deletion or weighting takes place. The `IPCW = TRUE` method is strictly proper when censoring and survival times are independent and G is estimated on large enough data. The `ipcw = FALSE` method is never proper. -* Add `surv.dcalib` for the D-Calibration measure from Haider et al. (2020). - -# mlr3proba 0.3.2 - -* Patched bug causing ``"interval2"`` task type not to work -* Fixed bug causing pipelines not to function correctly in `$aggregate` - -# mlr3proba 0.3.1 - -* Reverted removal of `"interval2"` - -# mlr3proba 0.3.0 - -* Commonly used survival quantities have been added as active bindings to `TaskSurv` including `times` (observed survival times), `status` (observed survival indicator), `unique_times` (set of sorted unique outcome times), `unique_event_times` (set of sorted unique failure times), `risk_set` (set of observations alive 'just before' a given time) -* `"interval2"` censoring type has been removed from `TaskSurv` as this is covered by the other types -* Default values have now been given to the `time` and `event` arguments in `TaskSurv` -* `PredictionDens` can now include `distr` return type (equivalent to `learner$model`) - -# mlr3proba 0.2.6 - -* Minor internal fixes - -# mlr3proba 0.2.5 - -* `PipeOpCrankCompositor` updated to fix bottleneck in computation via `mean`. Now `Inf` or `NA` is replaced by `0` for `response` and imputed with the median for `crank` -* Bug in `distr` predict types fixed that lead to fitting degenerate distributions and returning incorrect values for mean survival time and `crank` - -# mlr3proba 0.2.4 - -* CRITICAL BUG FIX - `compose_crank` was previously returning ranks with the reverse ordering so that higher ranks implied higher risk not lower. - -# mlr3proba 0.2.3 - -* All learners that previously lived in the mlr3learners organisation are now in the [mlr3extralearners](https://github.com/mlr-org/mlr3extralearners) repository. -* Fixed bottleneck in `MeasureSurvLogloss` -* Bugfix in `MeasureSurvCalibrationAlpha` -* Patch for valgrind -* `TaskDens` now inherits from `TaskUnsupervised` which means `target`/`truth` has been removed. No specification of a `target` column is required, instead a one-column matrix-like object or numeric vector should be passed to the task `backend` and the density will be estimated for this column, or two columns and one set as `weight`. -* Fixed bug in `load_eruption` to fix name of data columns -* Added calibration plot for comparing average predicted survival distribution to Kaplan-Meier to [mlr3viz](https://github.com/mlr-org/mlr3viz) -* Removed unneccessary `pracma` dependency in learners -* Fix in `PipeOpDistrCompositor`, previously base distribution was only using the first predicted distribution, now the baseline is taken by averaging over all predictions with uniform weights - -# mlr3proba 0.2.2 - -* Default kernel for `LearnerDensityKDE` is now `Epan` to reduce imports -* Minor internal patches for mlr3 0.6.0 -* Bug fix in `MeasureSurvCalibrationBeta` now returns `NA` not error if `lp` predict type not available - -# mlr3proba 0.2.1 - -* Removed `PredictionRegr` causing masking issues with `{mlr3}` -* Bug fix in `PipeOpDistrCompositor` causing some `cdf` predictions to be lost -* Internal fixes for `mlr3pipelines`: public train and predict methods to private -* Added four datasets and tasks: `grace`, `actg`, `gbcs`, `whas` -* Add `overwrite` to `crankcompositor` pipeop and pipeline -* Bug fix in `surv.kaplan` `crank` prediction - -# mlr3proba 0.2.0 - -### Added Functionality - -* `MeasureSurvCindex` added. Generalises all c-index measures with a fast C++ implementation -* Akritas estimator added to `mlr3learners/mlr3learners.proba` -* Added scoring rule `MeasureSurvSchmid` -* Addd calibration measures `MeasureSurvCalibrationBeta` and `MeasureSurvCalibrationAlpha` -* `surv.brier` alias added for `surv.graf` -* `response` parameter added to `PipeOpCrankCompositor` and `crankcompositor` to now optionally fill `response` predict type with same values as `crank` -* Added `PipeOpProbregrCompostior` and `compose_probregr` for composition to `distr` return type from (a) regression learner(s) predicting `response` and `se` -* Added `PipeOpSurvAvg` and `surv_averager` pipeline for weighted model averaging of distr, lp, crank, and response predictions. - -### Deprecated Functionality - -* The following measures are deprecated use `MeasureSurvCindex` instead with following parameters: `MeasureSurvBeggC`, use defaults; `MeasureSurvHarrellC`, use defaults; `MeasureSurvUnoC`, use `weight_meth = 'G/2'`; `MeasureSurvGonenC`, use `weight_method = 'GH'` -* `MeasureSurvGrafSE`, `MeasureSurvLoglossSE`, `MeasureSurvIntLoglossSE`, `MeasureSurvRMSESE`, `MeasureSurvMSESE`, and `MeasureSurvMAESE` all deprecated and will be deleted in v0.4.0. Use `msr("surv.graf", se = TRUE)` instead (for example). -* Measures renamed such that `surv.nagelkR2` is now `surv.nagelk_r2`, analogously for all R2, AUC, TPR, and TNR measures. Old constructors will be deleted in v0.4.0. -* Renamed `distrcompose` and `crankcompose` to `distr_compose` and `crank_compose`. Old ids will be deleted in v0.4.0. - -### Edited Functionality - -* Measures renamed such that `surv.nagelkR2` is now `surv.nagelk_r2`, analogously for all R2, AUC, TPR, and TNR measures. Old constructors will be deleted in v0.4.0. -* `MeasureSurvGraf` and `MeasureSurvIntLogloss` now have much faster C++ implementation - -### Moved Functionality - -- `LearnerSurvGlmnet`, `LearnerSurvCVGlmnet`, `LearnerSurvXgboost` and `LearnerSurvRanger` have been moved to `mlr-org/mlr3learners` - -- `LearnerSurvGBM` has been moved to https://www.github.com/mlr3learners/mlr3learners.gbm - -- `LearnerSurvMboost`, `LearnerSurvGlmBoost`, `LearnerSurvGamboost`, `LearnerSurvBlackboost` have been moved to https://www.github.com/mlr3learners/mlr3learners.mboost - - - -# mlr3proba 0.1.6 - -* Early release due to backward compatibility error introduced by an upstream dependency -* Minor updates to `mboost` family of learners: added `gehan` family, fixed parameters for `cindex`, added support for: `weights`, `response` predict type, `importance`, `selected_features` -* Minor internal changes -* All density learners except `LearnerDensHist` and `LearnerDensKDE` have been moved to the `mlr3learners org` -* The following survival learners have been moved to the `mlr3learners org`, LearnerSurv: `Flexible`, `ObliqueRSF`, `Penalized`, `RandomForestSRC` -* Bugfix in `LearnerSurvXgboost` previously `lp` was erroneously returned as `exp(lp)` -* Now licenced under LPGL-3 - -# mlr3proba 0.1.5 - -* `LearnerSurvParametric` and `LearnerSurvNelson` moved to `mlr3learners/mlr3learners.survival ` repo -* `LearnerSurvCoxboost` and `LearnerSurvCVCoxboost` moved to `mlr3learners/mlr3learners.coxboost ` repo -* `LearnerSurvSVM` moved to `mlr3learners/mlr3learners.survivalsvm` repo -* In the next release, all learners except for `LearnerSurvKaplan`, `LearnerSurvCoxPH`, and `LearnerDensHist` will be moved to the `mlr3learners` org -* Minor internal changes - -# mlr3proba 0.1.4 - -* Density estimation has now been added to mlr3proba, see `TaskDens`, `LearnerDens`, `PredictionDens`, and `MeasureDens`. -* Added `mlr_tasks_faithful` and `mlr_tasks_precip` for density task examples -* Added `mlr_task_generators_simdens` for generating density tasks -* Added learners for density estimation, see `mlr3::mlr_learners$keys("^dens")` for the full list -* In line with mlr3 0.1.7, public methods `train_internal`, `predict_internal`, `score_internal` are now private methods `.train`,`.predict`,`.score` -* Converted to roxygen2 R6 documentation - -# mlr3proba 0.1.3 - -* Changed `lp` in `surv.parametric` to include the intercept, which is in line with `survival::survreg`. Now `exp(pred$lp)` is equal to the predicted survival time for AFTs -* Moved `mboost` to `suggests` -* Added `response` predict type, which predicts the time until event. Currently only supported for AFT models in `surv.parametric` -* Added measures for `response` predict type: `MeasureSurvMAE, MeasureSurvMAESE, MeasureSurvMSE, MeasureSurvMSESE, MeasureSurvRMSE, MeasureSurvRMSESE` - -# mlr3proba 0.1.2 - -* Fixed error in r-patched-solaris -* Added `mode` option to `crankcompositor` -* Fixes bug resulting from `R62S3` incompatibility - -# mlr3proba 0.1.1 - -* Added `method` argument to integrated scores and added weighting by bin-width -* Added notes to IGS documentation regarding default methods and comparison to other packages -* Added `method` to `MeasureSurvIntegrated` constructor and fields -* Fixed mistake in documentation of: `TaskSurv`, `MeasureSurvUnoC` -* Added missing `LearnerSurvRpart` parameter `parms` and `cost` -* Fixed errors in r-patched-solaris and r-devel debian-clang - -# mlr3proba 0.1.0 - -* Initial upload to CRAN. diff --git a/R/LearnerCompRisks.R b/R/LearnerCompRisks.R deleted file mode 100644 index d0960c816..000000000 --- a/R/LearnerCompRisks.R +++ /dev/null @@ -1,47 +0,0 @@ -#' @title Competing Risks Learner -#' -#' @description -#' This Learner specializes [Learner][mlr3::Learner] for competing risks problems: -#' -#' - `task_type` is set to `"cmprsk"` -#' - Creates [Prediction][mlr3::Prediction]s of class [PredictionCompRisks]. -#' - The only currently available option for `predict_types` is `"cif"`, which -#' represents the predicted **cumulative incidence function** for each observation -#' in the test set. -#' -#' @template param_id -#' @template param_param_set -#' @template param_predict_types -#' @template param_feature_types -#' @template param_learner_properties -#' @template param_packages -#' @template param_label -#' @template param_man -#' -#' @family Learner -#' @export -#' @examples -#' library(mlr3) -#' # get all survival learners from mlr_learners: -#' lrns = mlr_learners$mget(mlr_learners$keys("^cmprsk")) -#' names(lrns) -#' -#' # get a specific learner from mlr_learners: -#' mlr_learners$get("cmprsk.aalen") -#' lrn("cmprsk.aalen") -LearnerCompRisks = R6Class("LearnerCompRisks", - inherit = Learner, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id, param_set = ps(), predict_types = "cif", - feature_types = character(), properties = character(), - packages = character(), label = NA_character_, man = NA_character_) { - - super$initialize( - id = id, task_type = "cmprsk", param_set = param_set, predict_types = predict_types, - feature_types = feature_types, properties = properties, - packages = c("mlr3proba", packages), label = label, man = man - ) - } - ) -) diff --git a/R/LearnerCompRisksAalenJohansen.R b/R/LearnerCompRisksAalenJohansen.R deleted file mode 100644 index 298623cc6..000000000 --- a/R/LearnerCompRisksAalenJohansen.R +++ /dev/null @@ -1,78 +0,0 @@ -#' @title Aalen Johansen Competing Risks Learner -#' @templateVar fullname LearnerCompRisksAalenJohansen -#' @templateVar id cmprsk.aalen -#' @template cmprsk_learner -#' -#' @description -#' -#' This learner estimates the Cumulative Incidence Function (CIF) for competing -#' risks using the empirical Aalen-Johansen (AJ) estimator. -#' -#' Transition probabilities to each event are computed from the training data via -#' the [survfit][survival::survfit.formula()] function and predictions are made -#' at all unique times (both events and censoring) observed in the training set. -#' -#' @references -#' `r format_bib("aalen_1978")` -#' -#' @templateVar msr_id all -#' @template example_cmprsk -#' @export -LearnerCompRisksAalenJohansen = R6Class("LearnerCompRisksAalenJohansen", - inherit = LearnerCompRisks, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - param_set = ps( - model = p_lgl(default = FALSE, tags = "train") - ) - - super$initialize( - id = "cmprsk.aalen", - param_set = param_set, - predict_types = "cif", - feature_types = c("logical", "integer", "numeric", "factor"), - properties = "weights", - packages = "survival", - label = "Aalen Johansen Estimator", - man = "mlr3proba::mlr_learners_cmprsk.aalen" - ) - } - ), - - private = list( - .train = function(task) { - pv = self$param_set$get_values(tags = "train") - pv$weights = private$.get_weights(task) - - invoke(survival::survfit, - formula = task$formula(1), - data = task$data(cols = task$target_names), - .args = pv) - }, - - .predict = function(task) { - trans_mat = self$model$pstate - trans_mat = trans_mat[, -1] # remove (s0) => prob of staying censored (state 0) - - times = self$model$time # unique train set time points - n_obs = task$nrow # number of test observations - cif_list = stats::setNames(vector("list", ncol(trans_mat)), colnames(trans_mat)) - - for (i in seq_along(cif_list)) { - cif_list[[i]] = matrix( - data = rep(trans_mat[, i], times = n_obs), - nrow = n_obs, - byrow = TRUE, - dimnames = list(NULL, times) - ) - } - - list(cif = cif_list) - } - ) -) - -#' @include aaa.R -register_learner("cmprsk.aalen", LearnerCompRisksAalenJohansen) diff --git a/R/LearnerDens.R b/R/LearnerDens.R deleted file mode 100644 index fb6d73397..000000000 --- a/R/LearnerDens.R +++ /dev/null @@ -1,48 +0,0 @@ -#' @title Density Learner -#' -#' @description -#' This Learner specializes [Learner][mlr3::Learner] for density estimation problems: -#' -#' * `task_type` is set to `"dens"` -#' * Creates [Prediction][mlr3::Prediction]s of class [PredictionDens]. -#' * Possible values for `predict_types` are: -#' - `"pdf"`: Evaluates estimated probability density function for each value in the test set. -#' - `"cdf"`: Evaluates estimated cumulative distribution function for each value in the test set. -#' -#' @template param_id -#' @template param_param_set -#' @template param_predict_types -#' @template param_feature_types -#' @template param_learner_properties -#' @template param_packages -#' @template param_label -#' @template param_man -#' -#' @family Learner -#' @export -#' @examples -#' library(mlr3) -#' # get all density learners from mlr_learners: -#' lrns = mlr_learners$mget(mlr_learners$keys("^dens")) -#' names(lrns) -#' -#' # get a specific learner from mlr_learners: -#' mlr_learners$get("dens.hist") -#' lrn("dens.hist") -LearnerDens = R6Class("LearnerDens", - inherit = Learner, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id, param_set = ps(), - predict_types = "cdf", feature_types = character(), - properties = character(), - packages = character(), - label = NA_character_, - man = NA_character_) { - super$initialize( - id = id, task_type = "dens", param_set = param_set, - predict_types = predict_types, feature_types = feature_types, properties = properties, - packages = c("mlr3proba", packages), label = label, man = man) - } - ) -) diff --git a/R/LearnerDensHistogram.R b/R/LearnerDensHistogram.R deleted file mode 100644 index 21a116579..000000000 --- a/R/LearnerDensHistogram.R +++ /dev/null @@ -1,43 +0,0 @@ -#' @template dens_learner -#' @templateVar title Histogram -#' @templateVar fullname LearnerDensHistogram -#' @templateVar caller [graphics::hist()] -#' -#' @export -LearnerDensHistogram = R6Class("LearnerDensHistogram", - inherit = LearnerDens, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "dens.hist", - param_set = ps( - breaks = p_uty(default = "Sturges", tags = "train") - ), - feature_types = c("integer", "numeric"), - predict_types = c("pdf", "cdf", "distr"), - packages = "distr6", - label = "Histogram Density Estimator", - man = "mlr3proba::mlr_learners_dens.hist" - ) - } - ), - - private = list( - .train = function(task) { - pars = self$param_set$get_values(tags = "train") - fit = invoke(.histogram, dat = task$data()[[1L]], .args = pars) - set_class(list(distr = fit$distr, hist = fit$hist), "dens.hist") - }, - - .predict = function(task) { - newdata = task$data()[[1L]] - list(pdf = self$model$distr$pdf(newdata), cdf = self$model$distr$cdf(newdata), - distr = self$model$distr) - } - ) -) - -#' @include aaa.R -register_learner("dens.hist", LearnerDensHistogram) diff --git a/R/LearnerDensKDE.R b/R/LearnerDensKDE.R deleted file mode 100644 index 0dae07205..000000000 --- a/R/LearnerDensKDE.R +++ /dev/null @@ -1,94 +0,0 @@ -#' @template dens_learner -#' @templateVar title Kernel -#' @templateVar fullname LearnerDensKDE -#' @templateVar caller kernels implemented in \link[distr6]{distr6} -#' @details The default bandwidth uses Silverman's rule-of-thumb for Gaussian kernels, however for -#' non-Gaussian kernels it is recommended to use \CRANpkg{mlr3tuning} to tune the bandwidth with -#' cross-validation. Other density learners can be used for automated bandwidth selection. -#' The default kernel is Epanechnikov (chosen to reduce dependencies). -#' -#' @references -#' `r format_bib("silverman_1986")` -#' -#' @export -LearnerDensKDE = R6Class("LearnerDensKDE", - inherit = LearnerDens, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - kernel = p_fct(levels = subset(distr6::listKernels(), select = "ShortName")[[1L]], - default = "Epan", tags = "train"), - bandwidth = p_dbl(0, tags = "train", special_vals = list("silver")) - ) - - ps$set_values(kernel = "Epan", bandwidth = "silver") - - super$initialize( - id = "dens.kde", - param_set = ps, - predict_types = c("pdf", "distr"), - feature_types = c("integer", "numeric"), - properties = "missings", - packages = "distr6", - label = "Kernel Density Estimator", - man = "mlr3proba::mlr_learners_dens.kde" - ) - } - ), - - private = list( - .train = function(task) { - - if (self$param_set$values$kernel == "Norm" && !requireNamespace("pracma", quietly = TRUE)) { - stop("{pracma} is required for Normal kernel, reverting to Epanechnikov.") - self$param_set$values$kernel == "Epan" - } - - data = task$data()[[1L]] - - kernel = get(as.character(subset( - distr6::listKernels(), - ShortName == self$param_set$values$kernel, - ClassName)))$new() - - - bw = if (isTRUE(self$param_set$values$bandwidth == "silver")) { - 0.9 * min(sd(data), stats::IQR(data, na.rm = TRUE) / 1.349, na.rm = TRUE) * - length(data)^-0.2 - } else { - self$param_set$values$bandwidth - } - - pdf = function(x) {} # nolint - - body(pdf) = substitute({ - if (length(x) == 1L) { - return(1 / (rows * bw) * sum(kernel$pdf((x - train) / bw))) - } else { - x = matrix(x, nrow = length(x), ncol = rows) - train_mat = matrix(train, nrow = nrow(x), ncol = rows, byrow = TRUE) - return(1 / (rows * bw) * colSums(apply((x - train_mat) / bw, 1L, kernel$pdf))) - } - }, list( - rows = task$nrow, - train = data, - bw = bw, - kernel = kernel)) - - Distribution$new( - name = paste(self$param_set$values$kernel, "KDE"), - short_name = paste0(self$param_set$values$kernel, "_KDE"), - type = set6::Reals$new(), - pdf = pdf) - }, - - .predict = function(task) { - list(pdf = self$model$pdf(task$data()[[1L]]), - distr = self$model) - } - ) -) - -register_learner("dens.kde", LearnerDensKDE) diff --git a/R/LearnerSurv.R b/R/LearnerSurv.R deleted file mode 100644 index 9022d3276..000000000 --- a/R/LearnerSurv.R +++ /dev/null @@ -1,50 +0,0 @@ -#' @title Survival Learner -#' -#' @description -#' This Learner specializes [Learner][mlr3::Learner] for survival problems: -#' -#' * `task_type` is set to `"surv"` -#' * Creates [Prediction][mlr3::Prediction]s of class [PredictionSurv]. -#' * Possible values for `predict_types` are: -#' - `"distr"`: Predicts a probability distribution for each observation in the test set, -#' uses \link[distr6]{distr6}. -#' - `"lp"`: Predicts a linear predictor for each observation in the test set. -#' - `"crank"`: Predicts a continuous ranking for each observation in the test set. -#' - `"response"`: Predicts a survival time for each observation in the test set. -#' -#' @template param_id -#' @template param_param_set -#' @template param_predict_types -#' @template param_feature_types -#' @template param_learner_properties -#' @template param_packages -#' @template param_label -#' @template param_man -#' -#' @family Learner -#' @export -#' @examples -#' library(mlr3) -#' # get all survival learners from mlr_learners: -#' lrns = mlr_learners$mget(mlr_learners$keys("^surv")) -#' names(lrns) -#' -#' # get a specific learner from mlr_learners: -#' mlr_learners$get("surv.coxph") -#' lrn("surv.coxph") -LearnerSurv = R6Class("LearnerSurv", - inherit = Learner, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id, param_set = ps(), predict_types = "distr", - feature_types = character(), properties = character(), - packages = character(), label = NA_character_, man = NA_character_) { - - super$initialize( - id = id, task_type = "surv", param_set = param_set, predict_types = predict_types, - feature_types = feature_types, properties = properties, - packages = c("mlr3proba", packages), label = label, man = man - ) - } - ) -) diff --git a/R/LearnerSurvCoxPH.R b/R/LearnerSurvCoxPH.R deleted file mode 100644 index b1484b79e..000000000 --- a/R/LearnerSurvCoxPH.R +++ /dev/null @@ -1,62 +0,0 @@ -#' @templateVar title Cox Proportional Hazards -#' @templateVar fullname LearnerSurvCoxPH -#' @templateVar caller [survival::coxph()] -#' @templateVar distr by [survival::survfit.coxph()] -#' @templateVar lp by [survival::predict.coxph()] -#' @templateVar id surv.coxph -#' @template surv_learner -#' -#' @references -#' `r format_bib("cox_1972")` -#' -#' @export -LearnerSurvCoxPH = R6Class("LearnerSurvCoxPH", - inherit = LearnerSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "surv.coxph", - param_set = ps( - ties = p_fct(default = "efron", levels = c("efron", "breslow", "exact"), tags = "train"), - singular.ok = p_lgl(default = TRUE, tags = "train"), - type = p_fct(default = "efron", levels = c("efron", "aalen", "kalbfleisch-prentice"), tags = "predict"), - stype = p_int(1L, 2L, default = 2L, tags = "predict") - ), - predict_types = c("crank", "distr", "lp"), - feature_types = c("logical", "integer", "numeric", "factor"), - properties = "weights", - packages = c("survival", "distr6"), - label = "Cox Proportional Hazards", - man = "mlr3proba::mlr_learners_surv.coxph" - ) - } - ), - - private = list( - .train = function(task) { - pv = self$param_set$get_values(tags = "train") - pv$weights = private$.get_weights(task) - - invoke(survival::coxph, formula = task$formula(), data = task$data(), - .args = pv, model = TRUE) - }, - - .predict = function(task) { - newdata = ordered_features(task, self) - pv = self$param_set$get_values(tags = "predict") - - # Get survival predictions via `survfit` - fit = invoke(survival::survfit, formula = self$model, newdata = newdata, - se.fit = FALSE, .args = pv) - - # Get linear predictors - lp = invoke(predict, self$model, type = "lp", newdata = newdata) - - .surv_return(times = fit$time, surv = t(fit$surv), lp = lp) - } - ) -) - -register_learner("surv.coxph", LearnerSurvCoxPH) diff --git a/R/LearnerSurvKaplan.R b/R/LearnerSurvKaplan.R deleted file mode 100644 index dbccdc38a..000000000 --- a/R/LearnerSurvKaplan.R +++ /dev/null @@ -1,83 +0,0 @@ -#' @templateVar title Kaplan-Meier Estimator -#' @templateVar fullname LearnerSurvKaplan -#' @templateVar caller [survival::survfit()] -#' @templateVar distr by estimating the survival function with [survival::survfit()] -#' @templateVar id surv.kaplan -#' @template surv_learner -#' -#' @references -#' `r format_bib("kaplan_1958")` -#' -#' @export -LearnerSurvKaplan = R6Class("LearnerSurvKaplan", - inherit = LearnerSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "surv.kaplan", - predict_types = c("crank", "distr"), - feature_types = c("logical", "integer", "numeric", "character", "factor", "ordered"), - properties = c("missings", "weights", "importance", "selected_features"), - packages = c("survival", "distr6"), - label = "Kaplan-Meier Estimator", - man = "mlr3proba::mlr_learners_surv.kaplan" - ) - }, - - #' @description - #' All features have a score of `0` for this learner. - #' #' This method exists solely for compatibility with the `mlr3` ecosystem, - #' as this learner is used as a fallback for other survival learners that - #' require an `importance()` method. - #' - #' @return Named `numeric()`. - importance = function() { - if (is.null(self$model)) { - stopf("No model stored") - } - - fn = self$model$features - named_vector(fn, 0) - }, - - #' @description - #' Selected features are always the empty set for this learner. - #' This method is implemented only for compatibility with the `mlr3` API, - #' as this learner does not perform feature selection. - #' - #' @return `character(0)`. - selected_features = function() { - if (is.null(self$model)) { - stopf("No model stored") - } - - character() - } - ), - - private = list( - .train = function(task) { - fit = invoke( - survival::survfit, - formula = task$formula(1), - data = task$data(), - .args = list(weights = private$.get_weights(task)) - ) - - # keep features for importance - list(model = fit, features = task$feature_names) - }, - - .predict = function(task) { - times = self$model$model$time - surv = matrix(rep(self$model$model$surv, task$nrow), ncol = length(times), - nrow = task$nrow, byrow = TRUE) - - .surv_return(times = times, surv = surv) - } - ) -) - -register_learner("surv.kaplan", LearnerSurvKaplan) diff --git a/R/LearnerSurvRpart.R b/R/LearnerSurvRpart.R deleted file mode 100644 index b10c081c6..000000000 --- a/R/LearnerSurvRpart.R +++ /dev/null @@ -1,93 +0,0 @@ -#' @templateVar title Rpart Survival Trees -#' @templateVar fullname LearnerSurvRpart -#' @templateVar caller [rpart::rpart()] -#' @templateVar crank using [rpart::predict.rpart()] -#' @templateVar id surv.rpart -#' @template surv_learner -#' -#' @section Initial parameter values: -#' -#' - `xval` is set to 0 in order to save some computation time. -#' - `model` has been renamed to `keep_model`. -#' -#' @references -#' `r format_bib("breiman_1984")` -#' -#' @export -LearnerSurvRpart = R6Class("LearnerSurvRpart", - inherit = LearnerSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - parms = p_dbl(default = 1, tags = "train"), - minbucket = p_int(1L, tags = "train"), - minsplit = p_int(1L, default = 20L, tags = "train"), - cp = p_dbl(0, 1, default = 0.01, tags = "train"), - maxcompete = p_int(0L, default = 4L, tags = "train"), - maxsurrogate = p_int(0L, default = 5L, tags = "train"), - maxdepth = p_int(1L, 30L, default = 30L, tags = "train"), - usesurrogate = p_int(0L, 2L, default = 2L, tags = "train"), - surrogatestyle = p_int(0L, 1L, default = 0L, tags = "train"), - xval = p_int(0L, default = 10L, tags = "train"), - cost = p_uty(tags = "train"), - keep_model = p_lgl(default = FALSE, tags = "train") - ) - - ps$set_values(xval = 0L) - - super$initialize( - id = "surv.rpart", - param_set = ps, - predict_types = c("crank"), - feature_types = c("logical", "integer", "numeric", "character", "factor", "ordered"), - properties = c("weights", "missings", "importance", "selected_features"), - packages = c("rpart", "distr6", "survival"), - label = "Survival Tree", - man = "mlr3proba::mlr_learners_surv.rpart" - ) - }, - - #' @description - #' The importance scores are extracted from the model slot `variable.importance`. - #' @return Named `numeric()`. - importance = function() { - if (is.null(self$model)) { - stopf("No model stored") - } - # importance is only present if there is at least on split - sort(self$model$variable.importance %??% set_names(numeric()), decreasing = TRUE) - }, - - #' @description - #' Selected features are extracted from the model slot `frame$var`. - #' @return `character()`. - selected_features = function() { - if (is.null(self$model)) { - stopf("No model stored") - } - unique(setdiff(self$model$frame$var, "")) - } - ), - - private = list( - .train = function(task) { - pv = self$param_set$get_values(tags = "train") - names(pv) = replace(names(pv), names(pv) == "keep_model", "model") - pv$weights = private$.get_weights(task) - - invoke(rpart::rpart, formula = task$formula(), data = task$data(), - method = "exp", .args = pv) - }, - - .predict = function(task) { - newdata = ordered_features(task, self) - p = invoke(predict, object = self$model, newdata = newdata) - - list(crank = p) - } - ) -) - -register_learner("surv.rpart", LearnerSurvRpart) diff --git a/R/MeasureCompRisks.R b/R/MeasureCompRisks.R deleted file mode 100644 index 5fddd15c0..000000000 --- a/R/MeasureCompRisks.R +++ /dev/null @@ -1,66 +0,0 @@ -#' @title Competing Risks Measure -#' -#' @description -#' This measure specializes [Measure][mlr3::Measure] for competing risk problems. -#' -#' * `task_type` is set to `"cmprsk"`. -#' * `predict_type` is set to `"cif"`. -#' -#' Predefined measures can be found in the [dictionary][mlr3misc::Dictionary] [mlr3::mlr_measures]. -#' -#' @template param_id -#' @template param_param_set -#' @template param_range -#' @template param_minimize -#' @template param_average -#' @template param_aggregator -#' @template param_predict_type -#' @template param_measure_properties -#' @template param_predict_sets -#' @template param_task_properties -#' @template param_packages -#' @template param_label -#' @template param_man -#' @param obs_loss (`function` or `NULL`)\cr -#' The observation-wise loss function, e.g. [zero-one][mlr3measures::zero_one] for classification error. -#' @param trafo (`list()` or `NULL`)\cr -#' An optional list with two elements, containing the transformation `"fn"` and its derivative `"deriv"`. -#' The transformation function is the function that is applied after aggregating the pointwise losses, i.e. -#' this requires an `$obs_loss` to be present. An example is `sqrt` for RMSE (regression). -#' -#' @family Measure -#' @seealso -#' Default survival measure: `TODO` -#' @export -MeasureCompRisks = R6Class( - "MeasureCompRisks", - inherit = Measure, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id, param_set = ps(), range, minimize = NA, average = "macro", - aggregator = NULL, obs_loss = NULL, properties = character(), predict_type = "cif", - predict_sets = "test", task_properties = character(), packages = character(), - label = NA_character_, man = NA_character_, trafo = NULL) { - - super$initialize( - id, - task_type = "cmprsk", - param_set = param_set, - range = range, - minimize = minimize, - average = average, - aggregator = aggregator, - obs_loss = obs_loss, - properties = properties, - predict_type = predict_type, - predict_sets = predict_sets, - task_properties = task_properties, - packages = c("mlr3proba", packages), - label = label, - man = man, - trafo = NULL - ) - } - ) -) diff --git a/R/MeasureCompRisksAUC.R b/R/MeasureCompRisksAUC.R deleted file mode 100644 index 4b15d96a4..000000000 --- a/R/MeasureCompRisksAUC.R +++ /dev/null @@ -1,152 +0,0 @@ -#' @template cmprsk_measure -#' @templateVar title Blanche's AUC -#' @templateVar fullname MeasureCompRisksAUC -#' -#' @aliases MeasureCompRisksAUC mlr_measures_cmprsk.auc -#' -#' @description -#' Calculates the cause-specific time-dependent ROC-AUC at a **specific time point**, -#' as described in Blanche et al. (2013). -#' -#' By default, this measure returns a **cause-independent AUC(t)** score, -#' calculated as a weighted average of the cause-specific AUCs. -#' The weights correspond to the relative event frequencies of each cause, -#' following Equation (7) in Heyard et al. (2020). -#' -#' @details -#' Calls [riskRegression::Score()] with: -#' - `metric = "auc"` -#' - `cens.method = "ipcw"` -#' - `cens.model = "km"` -#' -#' Notes on the `riskRegression` implementation: -#' 1. IPCW weights are estimated using the **test data only**. -#' 2. No extrapolation is supported: if `time_horizon` exceeds the maximum observed -#' time on the test data, an error is thrown. -#' 3. The choice of `time_horizon` is critical: if, at that time, no events of a -#' given cause have occurred and all predicted CIFs are zero, `riskRegression` -#' will return `NaN` for that cause-specific AUC (and subsequently for the -#' summary AUC). -#' -#' @section Parameter details: -#' - `cause` (`numeric(1)|"mean"`)\cr -#' Integer number indicating which cause to use. -#' Default value is `"mean"` which returns a weighted mean of the cause-specific AUCs. -#' - `time_horizon` (`numeric(1)`)\cr -#' Single time point at which to return the score. -#' If `NULL`, the **median time point** from the test set is used. -#' -#' @references -#' `r format_bib("blanche_2013", "heyard_2020")` -#' -#' @templateVar msr_id auc -#' @template example_cmprsk -#' @export -MeasureCompRisksAUC = R6Class( - "MeasureCompRisksAUC", - inherit = MeasureCompRisks, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - param_set = ps( - cause = p_int(lower = 1, init = "mean", special_vals = list("mean")), - time_horizon = p_dbl(lower = 0, default = NULL, special_vals = list(NULL)) - ) - - super$initialize( - id = "cmprsk.auc", - param_set = param_set, - range = c(0, 1), - minimize = FALSE, - properties = "na_score", - packages = "riskRegression", - label = "Blanche's Time-dependent IPCW ROC-AUC score", - man = "mlr3proba::mlr_measures_cmprsk.auc" - ) - } - ), - - private = list( - .score = function(prediction, task, ...) { - pv = self$param_set$values - - # Prepare test set data (for IPCW) - # uses test set observations as it needs to match exactly the number of - # rows (observations) in the predicted CIF matrix - data = data.table( - time = prediction$truth[, 1L], - event = prediction$truth[, 2L] - ) - form = formulate(lhs = "Hist(time, event)", rhs = "1", env = getNamespace("prodlim")) - - # Define evaluation time (single time point for AUC) - time_horizon = if (is.null(pv$time_horizon)) { - median(data$time) - } else { - assert_number(pv$time_horizon, lower = 0, finite = TRUE, na.ok = FALSE) - } - - # list of predicted CIF matrices - cif_list = prediction$cif - causes = names(cif_list) - - cause = pv$cause - if (test_int(cause)) { - cause = as.character(cause) - - # check if cause exists - if (cause %nin% causes) { - stopf("Invalid cause. Use one of: %s", paste(causes, collapse = ", ")) - } - - # get cause-specific CIF - cif_mat = cif_list[[cause]] - - # get CIF on the time horizon - mat = .interp_cif(cif_mat, eval_times = time_horizon) - - # calculate AUC(t) score - res = .riskRegr_score( - mat_list = list(mat), - metric = "auc", - data = data, - formula = form, - times = time_horizon, - cause = cause - ) - - times = NULL # fix: no global binding - res$AUC$score[times == time_horizon][["AUC"]] - } else { - # iterate through cause-specific CIFs, get AUC(t) - aucs = vapply(causes, function(cause) { - # get cause-specific CIF - cif_mat = cif_list[[cause]] - - # get CIF on the time horizon - mat = .interp_cif(cif_mat, eval_times = time_horizon) - - # calculate AUC(t) score - res = .riskRegr_score( - mat_list = list(mat), - metric = "auc", - data = data, - formula = form, - times = time_horizon, - cause = cause - ) - - times = NULL # fix: no global binding - res$AUC$score[times == time_horizon][["AUC"]] - }, numeric(1L)) - - event = data[event != 0, event] # remove censored obs (if they exist) - w = prop.table(table(event)) # observed proportions per cause - sum(w[names(aucs)] * aucs) # weighted mean - } - } - ) -) - -register_measure("cmprsk.auc", MeasureCompRisksAUC) diff --git a/R/MeasureDens.R b/R/MeasureDens.R deleted file mode 100644 index cd278c2e4..000000000 --- a/R/MeasureDens.R +++ /dev/null @@ -1,44 +0,0 @@ -#' @title Density Measure -#' -#' @description -#' This measure specializes [Measure][mlr3::Measure] for survival problems. -#' -#' * `task_type` is set to `"dens"`. -#' * Possible values for `predict_type` are `"pdf"` and `"cdf"`. -#' -#' Predefined measures can be found in the [dictionary][mlr3misc::Dictionary] [mlr3::mlr_measures]. -#' -#' @template param_id -#' @template param_param_set -#' @template param_range -#' @template param_minimize -#' @template param_average -#' @template param_aggregator -#' @template param_predict_type -#' @template param_measure_properties -#' @template param_predict_sets -#' @template param_task_properties -#' @template param_packages -#' @template param_label -#' @template param_man -#' -#' @family Measure -#' @seealso -#' Default density measures: [`dens.logloss`][mlr_measures_dens.logloss] -#' @export -MeasureDens = R6Class("MeasureDens", - inherit = Measure, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id, param_set = ps(), range, minimize = NA, aggregator = NULL, - properties = character(), predict_type = "pdf", task_properties = character(), - packages = character(), label = NA_character_, man = NA_character_) { - super$initialize(id, - task_type = "dens", param_set = param_set, range = range, minimize = minimize, - aggregator = aggregator, properties = properties, predict_type = predict_type, - task_properties = task_properties, packages = c("mlr3proba", packages), - label = label, man = man) - } - ) -) diff --git a/R/MeasureDensLogloss.R b/R/MeasureDensLogloss.R deleted file mode 100644 index 173d43849..000000000 --- a/R/MeasureDensLogloss.R +++ /dev/null @@ -1,50 +0,0 @@ -#' @template dens_measure -#' @templateVar title Log Loss -#' @templateVar inherit [MeasureDens] -#' @templateVar fullname MeasureDensLogloss -#' @templateVar eps 1e-15 -#' @template param_eps -#' -#' @description -#' Calculates the cross-entropy, or logarithmic (log), loss. -#' -#' @details -#' The Log Loss, in the context of probabilistic predictions, is defined as the negative log -#' probability density function, \eqn{f}, evaluated at the observed value, \eqn{y}, -#' \deqn{L(f, y) = -\log(f(y))}{L(f, y) = -log(f(y))} -#' -#' @family Density estimation measures -#' @export -MeasureDensLogloss = R6Class("MeasureDensLogloss", - inherit = MeasureDens, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - eps = p_dbl(0, 1, default = 1e-15) - ) - ps$values$eps = 1e-15 - - super$initialize( - id = "dens.logloss", - range = c(0, Inf), - minimize = TRUE, - predict_type = "pdf", - man = "mlr3proba::mlr_measures_dens.logloss", - label = "Log Loss", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, ...) { - pdf = prediction$pdf - pdf[pdf == 0] = self$param_set$values$eps - mean(-log(pdf)) - } - ) -) - -register_measure("dens.logloss", MeasureDensLogloss) diff --git a/R/MeasureRegrLogloss.R b/R/MeasureRegrLogloss.R deleted file mode 100644 index e485cb26a..000000000 --- a/R/MeasureRegrLogloss.R +++ /dev/null @@ -1,57 +0,0 @@ -#' @template regr_measure -#' @templateVar title Log Loss -#' @templateVar inherit [MeasureRegr] -#' @templateVar fullname MeasureRegrLogloss -#' @templateVar eps 1e-15 -#' @template param_eps -#' -#' @description -#' Calculates the cross-entropy, or logarithmic (log), loss. -#' -#' @details -#' The Log Loss, in the context of probabilistic predictions, is defined as the negative log -#' probability density function, \eqn{f}, evaluated at the observed value, \eqn{y}, -#' \deqn{L(f, y) = -\log(f(y))}{L(f, y) = -log(f(y))} -#' -#' @export -MeasureRegrLogloss = R6Class("MeasureRegrLogloss", - inherit = MeasureRegr, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - eps = p_dbl(0, 1, default = 1e-15) - ) - ps$values$eps = 1e-15 - - super$initialize( - id = "regr.logloss", - range = c(0, Inf), - minimize = TRUE, - predict_type = "distr", - man = "mlr3proba::mlr_measures_regr.logloss", - label = "Log Loss", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, ...) { - distr = prediction$distr - truth = prediction$truth - - if (inherits(distr, c("Matdist", "Arrdist"))) { - pdf = diag(distr$pdf(truth)) - } else { - pdf = as.numeric(distr$pdf(data = matrix(truth, nrow = 1L))) - } - - pdf[pdf == 0] = self$param_set$values$eps - mean(-log(pdf)) - } - ) -) - -register_measure("regr.logloss", MeasureRegrLogloss) diff --git a/R/MeasureSurv.R b/R/MeasureSurv.R deleted file mode 100644 index 750461de5..000000000 --- a/R/MeasureSurv.R +++ /dev/null @@ -1,65 +0,0 @@ -#' @title Survival Measure -#' -#' @description -#' This measure specializes [Measure][mlr3::Measure] for survival problems. -#' -#' * `task_type` is set to `"surv"`. -#' * Possible values for `predict_type` are `"distr"`, `"lp"`, `"crank"`, and `"response"`. -#' -#' Predefined measures can be found in the [dictionary][mlr3misc::Dictionary] [mlr3::mlr_measures]. -#' -#' @template param_id -#' @template param_param_set -#' @template param_range -#' @template param_minimize -#' @template param_average -#' @template param_aggregator -#' @template param_predict_type -#' @template param_measure_properties -#' @template param_predict_sets -#' @template param_task_properties -#' @template param_packages -#' @template param_label -#' @template param_man -#' @param obs_loss (`function` or `NULL`)\cr -#' The observation-wise loss function, e.g. [zero-one][mlr3measures::zero_one] for classification error. -#' @param trafo (`list()` or `NULL`)\cr -#' An optional list with two elements, containing the transformation `"fn"` and its derivative `"deriv"`. -#' The transformation function is the function that is applied after aggregating the pointwise losses, i.e. -#' this requires an `$obs_loss` to be present. An example is `sqrt` for RMSE (regression). -#' -#' @family Measure -#' @seealso -#' Default survival measure: [`surv.cindex`][mlr_measures_surv.cindex] -#' @export -MeasureSurv = R6Class("MeasureSurv", - inherit = Measure, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id, param_set = ps(), range, minimize = NA, average = "macro", - aggregator = NULL, obs_loss = NULL, properties = character(), predict_type = "distr", - predict_sets = "test", task_properties = character(), packages = character(), - label = NA_character_, man = NA_character_, trafo = NULL) { - - super$initialize( - id, - task_type = "surv", - param_set = param_set, - range = range, - minimize = minimize, - average = average, - aggregator = aggregator, - obs_loss = obs_loss, - properties = properties, - predict_type = predict_type, - predict_sets = predict_sets, - task_properties = task_properties, - packages = c("mlr3proba", packages), - label = label, - man = man, - trafo = NULL - ) - } - ) -) diff --git a/R/MeasureSurvAUC.R b/R/MeasureSurvAUC.R deleted file mode 100644 index 9df9f35fd..000000000 --- a/R/MeasureSurvAUC.R +++ /dev/null @@ -1,67 +0,0 @@ -#' @title Abstract Class for survAUC Measures -#' @description This is an abstract class that should not be constructed directly. -#' -#' @template param_integrated -#' @template param_times -#' @template param_id -#' @template param_measure_properties -#' @template param_label -#' @template param_man -#' @template param_param_set -#' @export -MeasureSurvAUC = R6Class("MeasureSurvAUC", - inherit = MeasureSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id, properties = character(), label = NA_character_, - man = NA_character_, param_set = ps()) { - if (class(self)[[1L]] == "MeasureSurvAUC") { - stop("This is an abstract class that should not be constructed directly.") - } - - super$initialize( - id = id, - range = c(0, 1), - minimize = FALSE, - packages = "survAUC", - predict_type = "lp", - properties = properties, - label = label, - man = man, - param_set = param_set - ) - } - ), - - private = list( - .score = function(prediction, learner, task, train_set, FUN, ...) { - args = list() - ps = self$param_set$values - - if ("requires_train_set" %in% self$properties) { - args$Surv.rsp = task$truth(train_set) # nolint - } - if ("requires_learner" %in% self$properties) { - args$lp = learner$model$linear.predictors - } - - args$times = ps$times - if (length(args$times) == 0L) { - args$times = sort(unique(prediction$truth[, 1L])) - } - - if ("Surv.rsp.new" %in% names(formals(FUN))) { - args$Surv.rsp.new = prediction$truth # nolint - } - - auc = invoke(FUN, lpnew = prediction$lp, .args = args) - - if (is.null(ps$integrated) || !ps$integrated || grepl("tnr|tpr", self$id)) { - auc - } else { - auc$iauc - } - } - ) -) diff --git a/R/MeasureSurvCalibrationAlpha.R b/R/MeasureSurvCalibrationAlpha.R deleted file mode 100644 index 2420e7941..000000000 --- a/R/MeasureSurvCalibrationAlpha.R +++ /dev/null @@ -1,128 +0,0 @@ -#' @template surv_measure -#' @templateVar title Van Houwelingen's Calibration Alpha -#' @templateVar fullname MeasureSurvCalibrationAlpha -#' @templateVar eps 1e-3 -#' @template param_eps -#' -#' @description -#' This calibration method is defined by estimating -#' \deqn{\hat{\alpha} = \frac{\sum_{i=1}^n \delta_i}{\sum_{i=1}^n H_i(T_i)}} -#' where \eqn{\delta} is the observed censoring indicator from the test data -#' \eqn{n} observations), \eqn{H_i} is the predicted cumulative hazard, and \eqn{T_i} -#' is the observed survival time (event or censoring). -#' -#' The standard error is given by -#' \deqn{\hat{\alpha_{se}} = e^{1/\sqrt{\sum \delta_i}}} -#' -#' The model is well calibrated if the estimated \eqn{\hat{\alpha}} coefficient -#' (returned score) is equal to 1. -#' -#' @section Parameter details: -#' - `se` (`logical(1)`)\cr -#' If `TRUE` then return standard error of the measure, otherwise the score -#' itself (default). -#' - `method` (`character(1)`)\cr -#' Returns \eqn{\hat{\alpha}} if equal to `ratio` (default) and -#' \eqn{|1-\hat{\alpha}|} if equal to `diff`. -#' With `diff`, the output score can be minimized and for example be used for -#' tuning purposes. This parameter takes effect only if `se` is `FALSE`. -#' - `truncate` (`double(1)`) \cr -#' This parameter controls the upper bound of the output score. -#' We use `truncate = Inf` by default (so no truncation) and it's up to the user -#' **to set this up reasonably** given the chosen `method`. -#' Note that truncation may severely limit automated tuning with this measure -#' using `method = diff`. -#' -#' @references -#' `r format_bib("vanhouwelingen_2000")` -#' -#' @family calibration survival measures -#' @family distr survival measures -#' @export -MeasureSurvCalibrationAlpha = R6Class("MeasureSurvCalibrationAlpha", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - #' @param method defines which output score to return, see "Parameter - #' details" section. - initialize = function(method = "ratio") { - assert_choice(method, choices = c("ratio", "diff")) - - ps = ps( - eps = p_dbl(0, 1, default = 1e-3), - se = p_lgl(default = FALSE), - method = p_fct(c("ratio", "diff"), default = "ratio"), - truncate = p_dbl(default = Inf) - ) - ps$set_values(eps = 1e-3, se = FALSE, method = method, truncate = Inf) - range = if (method == "ratio") c(-Inf, Inf) else c(0, Inf) - minimize = method != "ratio" - - super$initialize( - id = "surv.calib_alpha", - range = range, - minimize = minimize, - predict_type = "distr", - label = "Van Houwelingen's Alpha", - man = "mlr3proba::mlr_measures_surv.calib_alpha", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, ...) { - truth = prediction$truth - all_times = truth[, 1L] # both event times and censoring times - status = truth[, 2L] - n_events = sum(status) - - ps = self$param_set$values - if (ps$se) { - return(exp(1 / sqrt(n_events))) - } else { - distr = prediction$data$distr - - # Bypass distr6 construction if underlying distr represented by array - if (inherits(distr, "array")) { - surv = distr - if (length(dim(surv)) == 3L) { - # survival 3d array, extract median - surv = .ext_surv_mat(arr = surv, which.curve = 0.5) - } - times = as.numeric(colnames(surv)) - - extend_times_cdf = getFromNamespace("C_Vec_WeightedDiscreteCdf", ns = "distr6") - # get survival probability for each test obs at observed time - surv_all = diag( - extend_times_cdf(all_times, times, cdf = t(1 - surv), FALSE, FALSE) - ) - - # H(t) = -log(S(t)) - cumhaz = -log(surv_all) - } else { - if (inherits(distr, "VectorDistribution")) { - cumhaz = as.numeric( - distr$cumHazard(data = matrix(all_times, nrow = 1L)) - ) - } else { - cumhaz = diag(as.matrix(distr$cumHazard(all_times))) - } - } - - # Inf => case where censoring occurs at last time point - # 0 => case where survival probabilities are all 1 - cumhaz[cumhaz == Inf | cumhaz == 0] = ps$eps - out = n_events / sum(cumhaz) - - if (ps$method == "diff") { - out = abs(1 - out) - } - - return(min(ps$truncate, out)) - } - } - ) -) - -register_measure("surv.calib_alpha", MeasureSurvCalibrationAlpha) diff --git a/R/MeasureSurvCalibrationBeta.R b/R/MeasureSurvCalibrationBeta.R deleted file mode 100644 index d1d061b27..000000000 --- a/R/MeasureSurvCalibrationBeta.R +++ /dev/null @@ -1,92 +0,0 @@ -#' @template surv_measure -#' @templateVar title Van Houwelingen's Calibration Beta -#' @templateVar fullname MeasureSurvCalibrationBeta -#' -#' @description -#' This calibration method fits the predicted linear predictor from a Cox PH -#' model as the only predictor in a new Cox PH model with the test data as -#' the response. -#' \deqn{h(t|x) = h_0(t)e^{\beta \times lp}} -#' where \eqn{lp} is the predicted linear predictor on the test data. -#' -#' The model is well calibrated if the estimated \eqn{\hat{\beta}} coefficient -#' (returned score) is equal to 1. -#' -#' **Note**: Assumes fitted model is Cox PH (i.e. has an `lp` prediction type). -#' -#' @section Parameter details: -#' - `se` (`logical(1)`)\cr -#' If `TRUE` then return standard error of the measure which is the standard -#' error of the estimated coefficient \eqn{se_{\hat{\beta}}} from the Cox PH model. -#' If `FALSE` (default) then returns the estimated coefficient \eqn{\hat{\beta}}. -#' - `method` (`character(1)`)\cr -#' Returns \eqn{\hat{\beta}} if equal to `ratio` (default) and \eqn{|1-\hat{\beta}|} -#' if `diff`. -#' With `diff`, the output score can be minimized and for example be used for -#' tuning purposes. -#' This parameter takes effect only if `se` is `FALSE`. -#' -#' @references -#' `r format_bib("vanhouwelingen_2000")` -#' -#' @family calibration survival measures -#' @family lp survival measures -#' @export -MeasureSurvCalibrationBeta = R6Class("MeasureSurvCalibrationBeta", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - #' @param method defines which output score to return, see "Parameter - #' details" section. - initialize = function(method = "ratio") { - assert_choice(method, choices = c("ratio", "diff")) - - ps = ps( - se = p_lgl(default = FALSE), - method = p_fct(c("ratio", "diff"), default = "ratio") - ) - ps$set_values(se = FALSE, method = method) - range = if (method == "ratio") c(-Inf, Inf) else c(0, Inf) - minimize = method != "ratio" - - super$initialize( - id = "surv.calib_beta", - range = range, - minimize = minimize, - predict_type = "lp", - label = "Van Houwelingen's Beta", - man = "mlr3proba::mlr_measures_surv.calib_beta", - param_set = ps, - properties = "na_score" - ) - } - ), - - private = list( - .score = function(prediction, ...) { - df = data.frame(truth = prediction$truth, lp = prediction$lp) - fit = try(summary(survival::coxph(truth ~ lp, data = df)), silent = TRUE) - - if (inherits(fit, "try-error")) { - return(NA) - } - - ps = self$param_set$values - - if (ps$se) { - return(fit$coefficients[, "se(coef)"]) - } else { - out = fit$coefficients[, "coef"] - - if (ps$method == "diff") { - out = abs(1 - out) - } - - return(out) - } - - } - ) -) - -register_measure("surv.calib_beta", MeasureSurvCalibrationBeta) diff --git a/R/MeasureSurvChamblessAUC.R b/R/MeasureSurvChamblessAUC.R deleted file mode 100644 index b12ec4493..000000000 --- a/R/MeasureSurvChamblessAUC.R +++ /dev/null @@ -1,68 +0,0 @@ -#' @template surv_measure -#' @templateVar title Chambless and Diao's AUC -#' @templateVar fullname MeasureSurvChamblessAUC -#' @template measure_survAUC -#' @template param_integrated -#' @template param_times -#' -#' @description -#' Calls [survAUC::AUC.cd()]. -#' -#' Assumes Cox PH model specification. -#' -#' @references -#' `r format_bib("chambless_2006")` -#' -#' @family AUC survival measures -#' @family lp survival measures -#' @template example_auc_measures -#' @export -MeasureSurvChamblessAUC = R6Class("MeasureSurvChamblessAUC", - inherit = MeasureSurvAUC, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - integrated = p_lgl(default = TRUE), - times = p_uty() - ) - ps$values$integrated = TRUE - - super$initialize( - id = "surv.chambless_auc", - properties = c("requires_learner", "requires_task", "requires_train_set"), - label = "Chambless and Diao's AUC", - man = "mlr3proba::mlr_measures_surv.chambless_auc", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, learner, task, train_set, ...) { - if (!inherits(learner, "LearnerSurvCoxPH")) { - stop("Only compatible with Cox PH models") - } - - ps = self$param_set$values - if (!ps$integrated) { - msg = "If `integrated=FALSE` then `times` should be a scalar numeric." - assert_numeric(ps$times, len = 1L, .var.name = msg) - } else { - if (!is.null(ps$times) && length(ps$times) == 1L) { - ps$integrated = FALSE - } - } - - super$.score( - prediction = prediction, - learner = learner, - task = task, - train_set = train_set, - FUN = survAUC::AUC.cd) - } - ) -) - -register_measure("surv.chambless_auc", MeasureSurvChamblessAUC) diff --git a/R/MeasureSurvCindex.R b/R/MeasureSurvCindex.R deleted file mode 100644 index 353c98c21..000000000 --- a/R/MeasureSurvCindex.R +++ /dev/null @@ -1,145 +0,0 @@ -#' @template surv_measure -#' @templateVar title Concordance Statistics -#' @templateVar fullname MeasureSurvCindex -#' @templateVar eps 1e-3 -#' @template param_eps -#' -#' @description -#' Calculates weighted concordance statistics, which, depending on the chosen -#' weighting method (`weight_meth`) and tied times parameter (`tiex`), are -#' equivalent to several proposed methods. -#' By default, no weighting is applied and this is equivalent to Harrell's C-index. -#' -#' @details -#' For the Kaplan-Meier estimate of the **training survival** distribution (\eqn{S}), -#' and the Kaplan-Meier estimate of the **training censoring** distribution (\eqn{G}), -#' we have the following options for time-independent concordance statistics -#' (C-indexes) given the weighted method: -#' -#' `weight_meth`: -#' -#' - `"I"` = No weighting. (Harrell) -#' - `"GH"` = Gonen and Heller's Concordance Index -#' - `"G"` = Weights concordance by \eqn{1/G}. -#' - `"G2"` = Weights concordance by \eqn{1/G^2}. (Uno et al.) -#' - `"SG"` = Weights concordance by \eqn{S/G} (Shemper et al.) -#' - `"S"` = Weights concordance by \eqn{S} (Peto and Peto) -#' -#' The last three require training data. `"GH"` is only applicable to [LearnerSurvCoxPH]. -#' -#' The implementation is slightly different from [survival::concordance]. -#' Firstly this implementation is faster, and secondly the weights are computed -#' on the training dataset whereas in [survival::concordance] the weights are -#' computed on the same testing data. -#' -#' @section Parameter details: -#' - `t_max` (`numeric(1)`)\cr -#' Cutoff time (i.e. time horizon) to evaluate concordance up to. -#' - `p_max` (`numeric(1)`)\cr -#' The proportion of censoring to evaluate concordance up to in the given dataset. -#' When `t_max` is specified, this parameter is ignored. -#' - `weight_meth` (`character(1)`)\cr -#' Method for weighting concordance. Default `"I"` is Harrell's C. See details. -#' - `tiex` (`numeric(1)`)\cr -#' Weighting applied to tied rankings, default is to give them half (0.5) weighting. -#' -#' @references -#' `r format_bib("peto_1972", "harrell_1982", "gonen_2005", "schemper_2009", "uno_2011")` -#' -#' @template param_range -#' @template param_minimize -#' @template param_packages -#' @template param_predict_type -#' @template param_measure_properties -#' -#' @examples -#' library(mlr3) -#' task = tsk("rats") -#' learner = lrn("surv.coxph") -#' part = partition(task) # train/test split -#' learner$train(task, part$train) -#' p = learner$predict(task, part$test) -#' -#' # Harrell's C-index -#' p$score(msr("surv.cindex")) # same as `p$score()` -#' -#' # Uno's C-index -#' p$score(msr("surv.cindex", weight_meth = "G2"), -#' task = task, train_set = part$train) -#' -#' # Harrell's C-index evaluated up to a specific time horizon -#' p$score(msr("surv.cindex", t_max = 97)) -#' -#' # Harrell's C-index evaluated up to the time corresponding to 30% of censoring -#' p$score(msr("surv.cindex", p_max = 0.3)) -#' -#' @export -MeasureSurvCindex = R6Class("MeasureSurvCindex", - inherit = MeasureSurv, - public = list( - #' @description This is an abstract class that should not be constructed directly. - initialize = function() { - ps = ps( - t_max = p_dbl(0), - p_max = p_dbl(0, 1), - weight_meth = p_fct(levels = c("I", "G", "G2", "SG", "S", "GH"), default = "I"), - tiex = p_dbl(0, 1, default = 0.5), - eps = p_dbl(0, 1, default = 1e-3) - ) - ps$set_values(weight_meth = "I", tiex = 0.5, eps = 1e-3) - - super$initialize( - id = "surv.cindex", - range = c(0, 1), - minimize = FALSE, - predict_type = "crank", - properties = "na_score", - label = "Concordance Index", - man = "mlr3proba::mlr_measures_surv.cindex", - param_set = ps - ) - - invisible(self) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - ps = self$param_set$values - - # Determine cutoff time horizon (t_max) - t_max = ps$t_max - if (is.null(t_max) && !is.null(ps$p_max)) { - truth = prediction$truth - unique_times = unique(sort(truth[, 1L])) - surv = survival::survfit(truth ~ 1) - censored_proportion = 1 - (surv$n.risk / surv$n) - indx = which(censored_proportion > ps$p_max) - - # First time point that surpasses `p_max` censoring - t_max = if (length(indx) > 0L) surv$time[indx[1L]] else NULL - } - - # Select weighting method - weight_meth = ps$weight_meth - - if (weight_meth == "I") { - return(.cindex(prediction$truth, prediction$crank, t_max, weight_meth, ps$tiex)) - } - - if (weight_meth == "GH") { - return(.gonen(prediction$crank, ps$tiex)) - } - - # All other methods require task and train_set - if (is.null(task) || is.null(train_set)) { - stopf("'task' and 'train_set' are required for weighted C-index method '%s'", weight_meth) - } - - train_truth = task$truth(train_set) - .cindex(prediction$truth, prediction$crank, t_max, weight_meth, ps$tiex, train_truth, ps$eps) - } - ) -) - -register_measure("surv.cindex", MeasureSurvCindex) diff --git a/R/MeasureSurvDCalibration.R b/R/MeasureSurvDCalibration.R deleted file mode 100644 index 7b6ea1623..000000000 --- a/R/MeasureSurvDCalibration.R +++ /dev/null @@ -1,128 +0,0 @@ -#' @template surv_measure -#' @templateVar title D-Calibration -#' @templateVar fullname MeasureSurvDCalibration -#' -#' @description -#' `r lifecycle::badge("experimental")` -#' -#' This calibration method is defined by calculating the following statistic: -#' \deqn{s = B/n \sum_i (P_i - n/B)^2} -#' where \eqn{B} is number of 'buckets' (that equally divide \eqn{[0,1]} into intervals), -#' \eqn{n} is the number of predictions, and \eqn{P_i} is the observed proportion -#' of observations in the \eqn{i}th interval. An observation is assigned to the -#' \eqn{i}th bucket, if its predicted survival probability at the time of event -#' falls within the corresponding interval. -#' This statistic assumes that censoring time is independent of death time. -#' -#' A model is well D-calibrated if \eqn{s \sim Unif(B)}, tested with `chisq.test` -#' (\eqn{p > 0.05} if well-calibrated, i.e. higher p-values are preferred). -#' Model \eqn{i} is better calibrated than model \eqn{j} if \eqn{s(i) < s(j)}, -#' meaning that *lower values* of this measure are preferred. -#' -#' @details -#' This measure can either return the test statistic or the p-value from the `chisq.test`. -#' The former is useful for model comparison whereas the latter is useful for determining if a model -#' is well-calibrated. If `chisq = FALSE` and `s` is the predicted value then you can manually -#' compute the p.value with `pchisq(s, B - 1, lower.tail = FALSE)`. -#' -#' **NOTE**: This measure is still experimental both theoretically and in implementation. Results -#' should therefore only be taken as an indicator of performance and not for -#' conclusive judgements about model calibration. -#' -#' @section Parameter details: -#' - `B` (`integer(1)`) \cr -#' Number of buckets to test for uniform predictions over. -#' Default of `10` is recommended by Haider et al. (2020). -#' Changing this parameter affects `truncate`. -#' - `chisq` (`logical(1)`) \cr -#' If `TRUE` returns the p-value of the corresponding chisq.test instead of the measure. -#' Default is `FALSE` and returns the statistic `s`. -#' You can manually get the p-value by executing `pchisq(s, B - 1, lower.tail = FALSE)`. -#' The null hypothesis is that the model is D-calibrated. -#' - `truncate` (`double(1)`) \cr -#' This parameter controls the upper bound of the output statistic, when `chisq` is `FALSE`. -#' We use `truncate = Inf` by default but values between \eqn{10-16} are sufficient -#' for most purposes, which correspond to p-values of \eqn{0.35-0.06} for the `chisq.test` using -#' the default \eqn{B = 10} buckets. -#' Values \eqn{B > 10} translate to even lower p-values and thus less D-calibrated models. -#' If the number of buckets \eqn{B} changes, you probably will want to -#' change the `truncate` value as well to correspond to the same p-value significance. -#' Note that truncation may severely limit automated tuning with this measure. -#' -#' @references -#' `r format_bib("haider_2020")` -#' -#' @family calibration survival measures -#' @family distr survival measures -#' @export -MeasureSurvDCalibration = R6Class("MeasureSurvDCalibration", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - B = p_int(1L, default = 10L), - chisq = p_lgl(default = FALSE), - truncate = p_dbl(0, Inf, default = Inf) - ) - ps$set_values(B = 10L, chisq = FALSE, truncate = Inf) - - super$initialize( - id = "surv.dcalib", - range = c(0, Inf), - minimize = TRUE, - predict_type = "distr", - label = "D-Calibration", - man = "mlr3proba::mlr_measures_surv.dcalib", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, ...) { - ps = self$param_set$values - B = ps$B - - # initialize buckets - bj = numeric(B) - true_times = prediction$truth[, 1L] - - # predict individual probability of death at observed event time - surv = .get_surv_matrix(prediction) - times = as.numeric(colnames(surv)) - - extend_times = getFromNamespace("C_Vec_WeightedDiscreteCdf", ns = "distr6") - si = diag(extend_times(true_times, times, cdf = t(1 - surv), FALSE, FALSE)) - - # replace zeros - si = map_dbl(si, function(.x) max(.x, 1e-5)) - # index of associated bucket - js = ceiling(B * si) - - # could remove loop for dead observations but needed for censored ones and minimal overhead - # in combining both - for (i in seq_along(si)) { - ji = js[[i]] - if (prediction$truth[i, 2L] == 1L) { - # dead observations contribute 1 to their index - bj[ji] = bj[ji] + 1 - } else { - # censored observations spread across buckets with most weighting on penultimate - for (k in seq.int(ji - 1)) { - bj[k] = bj[k] + 1 / (B * si[[i]]) - } - bj[ji] = bj[ji] + (1 - (ji - 1) / (B * si[[i]])) - } - } - - if (ps$chisq) { - return(stats::chisq.test(bj)$p.value) - } else { - return(min(ps$truncate, (B / length(si)) * sum((bj - length(si) / B)^2))) - } - } - ) -) - -register_measure("surv.dcalib", MeasureSurvDCalibration) diff --git a/R/MeasureSurvGraf.R b/R/MeasureSurvGraf.R deleted file mode 100644 index a672db1ed..000000000 --- a/R/MeasureSurvGraf.R +++ /dev/null @@ -1,132 +0,0 @@ -#' @template surv_measure -#' @templateVar title Integrated Brier Score -#' @templateVar fullname MeasureSurvGraf -#' @template param_integrated -#' @template param_times -#' @template param_tmax -#' @template param_pmax -#' @templateVar eps 1e-3 -#' @template param_eps -#' @template param_erv -#' -#' @aliases MeasureSurvBrier mlr_measures_surv.brier -#' -#' @description -#' Calculates the **Integrated Survival Brier Score** (ISBS), Integrated Graf Score -#' or squared survival loss. -#' -#' @details -#' This measure has two dimensions: (test set) observations and time points. -#' For a specific individual \eqn{i} from the test set, with observed survival -#' outcome \eqn{(t_i, \delta_i)} (time and censoring indicator) and predicted -#' survival function \eqn{S_i(t)}, the *observation-wise* estimator of the loss, -#' integrated across the time dimension up to the time cutoff \eqn{\tau^*}, is: -#' -#' \deqn{L_{ISBS}(S_i, t_i, \delta_i) = \int^{\tau^*}_0 \frac{S_i^2(\tau) \text{I}(t_i \leq \tau, \delta_i=1)}{G(t_i)} + \frac{(1-S_i(\tau))^2 \text{I}(t_i > \tau)}{G(\tau)} \ d\tau} -#' -#' where \eqn{G} is the Kaplan-Meier estimate of the censoring distribution. -#' -#' The implementation uses the trapezoidal rule to approximate the integral over -#' time and the integral is normalized by the range of available evaluation times -#' (\eqn{\tau_{\text{max}} - \tau_{\text{min}}}). -#' -#' To get a single score across all \eqn{N} observations of the test set, we -#' return the average of the time-integrated observation-wise scores: -#' \deqn{\sum_{i=1}^N L(S_i, t_i, \delta_i) / N} -#' -#' @template properness -#' @templateVar id ISBS -#' @template which_times -#' @template details_trainG -#' @template details_tmax -#' @template implementation_diffs -#' -#' @references -#' `r format_bib("graf_1999", "sonabend_2024", "kvamme_2023")` -#' -#' @family Probabilistic survival measures -#' @family distr survival measures -#' @template example_scoring_rules -#' @export -MeasureSurvGraf = R6Class("MeasureSurvGraf", - inherit = MeasureSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param ERV (`logical(1)`)\cr - #' Standardize measure against a Kaplan-Meier baseline - #' (Explained Residual Variation) - initialize = function(ERV = FALSE) { - assert_logical(ERV) - - ps = ps( - integrated = p_lgl(default = TRUE), - times = p_uty(), - t_max = p_dbl(0), - p_max = p_dbl(0, 1), - eps = p_dbl(0, 1, default = 1e-3), - ERV = p_lgl(default = FALSE) - ) - ps$set_values(integrated = TRUE, eps = 1e-3, ERV = ERV) - - range = if (ERV) c(-Inf, 1) else c(0, Inf) - - super$initialize( - param_set = ps, - id = "surv.graf", - range = range, - minimize = !ERV, - packages = "distr6", - predict_type = "distr", - label = "Integrated Brier Score", - man = "mlr3proba::mlr_measures_surv.graf", - ) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - ps = self$param_set$values - - # ERV score - if (ps$ERV) return(.scoring_rule_erv(self, prediction, task, train_set)) - - nok = sum(!is.null(ps$times), !is.null(ps$t_max), !is.null(ps$p_max)) > 1 - if (nok) { - stop("Only one of `times`, `t_max`, and `p_max` should be provided") - } - - if (!ps$integrated) { - msg = "If `integrated=FALSE` then `times` should be a scalar numeric." - assert_numeric(ps$times, len = 1L, .var.name = msg) - } else { - if (!is.null(ps$times) && length(ps$times) == 1L) { - ps$integrated = FALSE - } - } - - x = as.integer(!is.null(task)) + as.integer(!is.null(train_set)) - if (x == 1) { - stop("Either 'task' and 'train_set' should be passed to measure or neither.") - } else if (x) { - train = task$truth(train_set) - } else { - train = NULL - } - - # `score` is a matrix, IBS(i,j) => [test_obs x times] - score = .weighted_survival_score( - loss = "graf", - truth = prediction$truth, - distribution = prediction$data$distr, - times = ps$times, t_max = ps$t_max, p_max = ps$p_max, - train = train, eps = ps$eps - ) - - .integrated_score(score, ps$integrated) - } - ) -) - -register_measure("surv.graf", MeasureSurvGraf) -register_measure("surv.brier", MeasureSurvGraf) diff --git a/R/MeasureSurvHungAUC.R b/R/MeasureSurvHungAUC.R deleted file mode 100644 index c8cf41ce1..000000000 --- a/R/MeasureSurvHungAUC.R +++ /dev/null @@ -1,63 +0,0 @@ -#' @template surv_measure -#' @templateVar title Hung and Chiang's AUC -#' @templateVar fullname MeasureSurvHungAUC -#' @template measure_survAUC -#' @template param_integrated -#' @template param_times -#' -#' @description -#' Calls [survAUC::AUC.hc()]. -#' -#' Assumes random censoring. -#' -#' @references -#' `r format_bib("hung_2010")` -#' -#' @family AUC survival measures -#' @family lp survival measures -#' @template example_auc_measures -#' @export -MeasureSurvHungAUC = R6Class("MeasureSurvHungAUC", - inherit = MeasureSurvAUC, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - integrated = p_lgl(default = TRUE), - times = p_uty() - ) - ps$values$integrated = TRUE - - super$initialize( - id = "surv.hung_auc", - properties = c("requires_task", "requires_train_set"), - label = "Hung and Chiang's AUC", - man = "mlr3proba::mlr_measures_surv.hung_auc", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - ps = self$param_set$values - if (!ps$integrated) { - msg = "If `integrated=FALSE` then `times` should be a scalar numeric." - assert_numeric(ps$times, len = 1, .var.name = msg) - } else { - if (!is.null(ps$times) && length(ps$times) == 1) { - ps$integrated = FALSE - } - } - - super$.score( - prediction = prediction, - task = task, - train_set = train_set, - FUN = survAUC::AUC.hc, - ...) - } - ) -) - -register_measure("surv.hung_auc", MeasureSurvHungAUC) diff --git a/R/MeasureSurvICI.R b/R/MeasureSurvICI.R deleted file mode 100644 index d39279bb7..000000000 --- a/R/MeasureSurvICI.R +++ /dev/null @@ -1,162 +0,0 @@ -#' @template surv_measure -#' @templateVar title Integrated Calibration Index -#' @templateVar fullname MeasureSurvICI -#' @templateVar eps 1e-4 -#' @template param_eps -#' -#' @description -#' Calculates the Integrated Calibration Index (ICI), which evaluates -#' **point-calibration** (i.e. at a specific time point), see Austin et al. (2020). -#' -#' @details -#' Each individual \eqn{i} from the test set, has an observed survival outcome -#' \eqn{(t_i, \delta_i)} (time and censoring indicator) and predicted survival -#' function \eqn{S_i(t)}. -#' The predicted probability of an event occurring before a specific time point -#' \eqn{t_0}, is defined as \eqn{\hat{P_i}(t_0) = F_i(t_0) = 1 - S_i(t_0)}. -#' -#' Using hazard regression (via the \CRANpkg{polspline} R package), a *smoothed* -#' calibration curve is estimated by fitting the following model: -#' \deqn{log(h(t)) = g(log(− log(1 − \hat{P}_{t_0})), t)} -#' -#' Note that we substitute probabilities \eqn{\hat{P}_{t_0} = 0} with a small -#' \eqn{\epsilon} number to avoid arithmetic issues (\eqn{log(0)}). Same with -#' \eqn{\hat{P}_{t_0} = 1}, we use \eqn{1 - \epsilon}. -#' From this model, the *smoothed* probability of occurrence at \eqn{t_0} for -#' observation \eqn{i} is obtained as \eqn{\hat{P}_i^c(t_0)}. -#' -#' The **Integrated Calibration Index** is then computed across the \eqn{N} -#' test set observations as: -#' \deqn{ICI = \frac{1}{N} \sum_{i=1}^N | \hat{P}_i^c(t_0) - \hat{P}_i(t_0) |} -#' -#' Therefore, a perfect calibration (smoothed probabilities match predicted -#' probabilities for all observations) yields \eqn{ICI = 0}, while the worst -#' possible score is \eqn{ICI = 1}. -#' -#' @section Parameter details: -#' - `time` (`numeric(1)`)\cr -#' The specific time point \eqn{t_0} at which calibration is evaluated. -#' If `NULL`, the median observed time from the test set is used. -#' - `method` (`character(1)`)\cr -#' Specifies the summary statistic used to calculate the final calibration score. -#' - `"ICI"` (default): Uses the mean of absolute differences \eqn{| \hat{P}_i^c(t_0) - \hat{P}_i(t_0) |} across all observations. -#' - `"E50"`: Uses the median of absolute differences instead of the mean. -#' - `"E90"`: Uses the 90th percentile of absolute differences, emphasizing higher deviations. -#' - `"Emax"`: Uses the maximum absolute difference, capturing the largest discrepancy between predicted and smoothed probabilities. -#' - `na.rm` (`logical(1)`)\cr -#' If `TRUE` (default) then removes any NAs/NaNs in the smoothed probabilities -#' \eqn{\hat{P}_i^c(t_0)} that may arise. A warning is issued nonetheless in such -#' cases. -#' -#' @references -#' `r format_bib("austin_2020")` -#' -#' @family calibration survival measures -#' @family distr survival measures -#' @examples -#' library(mlr3) -#' -#' # Define a survival Task -#' task = tsk("lung") -#' -#' # Create train and test set -#' part = partition(task) -#' -#' # Train Cox learner on the train set -#' cox = lrn("surv.coxph") -#' cox$train(task, row_ids = part$train) -#' -#' # Make predictions for the test set -#' p = cox$predict(task, row_ids = part$test) -#' -#' # ICI at median test set time -#' p$score(msr("surv.calib_index")) -#' -#' # ICI at specific time point -#' p$score(msr("surv.calib_index", time = 365)) -#' -#' # E50 at specific time point -#' p$score(msr("surv.calib_index", method = "E50", time = 365)) -#' -#' @export -MeasureSurvICI = R6Class("MeasureSurvICI", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - param_set = ps( - time = p_dbl(0, Inf), - eps = p_dbl(0, 1, default = 1e-4), - method = p_fct(default = "ICI", levels = c("ICI", "E50", "E90", "Emax")), - na.rm = p_lgl(default = TRUE) - ) - param_set$set_values(method = "ICI", eps = 1e-4, na.rm = TRUE) - - super$initialize( - id = "surv.calib_index", - packages = c("polspline"), - range = c(0, 1), - minimize = TRUE, - predict_type = "distr", - label = "Integrated Calibration Index", - man = "mlr3proba::mlr_measures_surv.calib_index", - param_set = param_set - ) - } - ), - - private = list( - .score = function(prediction, ...) { - # test set survival outcome - times = prediction$truth[, 1L] - status = prediction$truth[, 2L] - - # get predicted survival matrix - surv = .get_surv_matrix(prediction) - - # parameter values - pv = self$param_set$values - - # time point for calibration - time = pv$time %??% median(times) - - # get cdf at the specified time point - extend_times_cdf = getFromNamespace("C_Vec_WeightedDiscreteCdf", ns = "distr6") - pred_times = as.numeric(colnames(surv)) - cdf = as.vector(extend_times_cdf(time, pred_times, cdf = t(1 - surv), TRUE, FALSE)) - # to avoid log(0) later, same as in paper's Appendix - eps = pv$eps - cdf[cdf == 1] = 1 - eps - cdf[cdf == 0] = eps - - # get the cdf complement (survival) log-log transformed - cll = log(-log(1 - cdf)) - - hare_fit = polspline::hare(data = times, delta = status, cov = as.matrix(cll)) - smoothed_cdf = polspline::phare(q = time, cov = cll, fit = hare_fit) - if (anyNA(smoothed_cdf)) { - warning("`polspline::phare` fit resulted in NaN smoothed probabilities") - } - - method = pv$method - na.rm = pv$na.rm - if (method == "ICI") { - # Mean difference (ICI) - result = mean(abs(cdf - smoothed_cdf), na.rm = na.rm) - } else if (method == "E50") { - # Median (E50) - result = median(abs(cdf - smoothed_cdf), na.rm = na.rm) - } else if (method == "E90") { - # 90th percentile (E90) - result = quantile(abs(cdf - smoothed_cdf), probs = 0.9, na.rm = na.rm) - } else if (method == "Emax") { - # Maximum absolute difference (Emax) - result = max(abs(cdf - smoothed_cdf), na.rm = na.rm) - } - - result - } - ) -) - -register_measure("surv.calib_index", MeasureSurvICI) diff --git a/R/MeasureSurvIntLogloss.R b/R/MeasureSurvIntLogloss.R deleted file mode 100644 index 507d8b73e..000000000 --- a/R/MeasureSurvIntLogloss.R +++ /dev/null @@ -1,129 +0,0 @@ -#' @template surv_measure -#' @templateVar title Integrated Log-Likelihood -#' @templateVar fullname MeasureSurvIntLogloss -#' @template param_integrated -#' @template param_times -#' @template param_tmax -#' @template param_pmax -#' @templateVar eps 1e-3 -#' @template param_eps -#' @template param_erv -#' -#' @description -#' Calculates the **Integrated Survival Log-Likelihood** (ISLL) or Integrated -#' Logarithmic (log) Loss, aka integrated cross entropy. -#' -#' @details -#' This measure has two dimensions: (test set) observations and time points. -#' For a specific individual \eqn{i} from the test set, with observed survival -#' outcome \eqn{(t_i, \delta_i)} (time and censoring indicator) and predicted -#' survival function \eqn{S_i(t)}, the *observation-wise* estimator of the loss, -#' integrated across the time dimension up to the time cutoff \eqn{\tau^*}, is: -#' -#' \deqn{L_{ISLL}(S_i, t_i, \delta_i) = - \int^{\tau^*}_0 \frac{log[1-S_i(\tau)] \text{I}(t_i \leq \tau, \delta_i=1)}{G(t_i)} + \frac{\log[S_i(\tau)] \text{I}(t_i > \tau)}{G(\tau)} \ d\tau} -#' -#' where \eqn{G} is the Kaplan-Meier estimate of the censoring distribution. -#' -#' The implementation uses the trapezoidal rule to approximate the integral over -#' time and the integral is normalized by the range of available evaluation times -#' (\eqn{\tau_{\text{max}} - \tau_{\text{min}}}). -#' -#' To get a single score across all \eqn{N} observations of the test set, we -#' return the average of the time-integrated observation-wise scores: -#' \deqn{\sum_{i=1}^N L(S_i, t_i, \delta_i) / N} -#' -#' @template properness -#' @templateVar id ISLL -#' @template which_times -#' @template details_trainG -#' @template details_tmax -#' @template implementation_diffs -#' -#' @references -#' `r format_bib("graf_1999", "sonabend_2024", "kvamme_2023")` -#' -#' @family Probabilistic survival measures -#' @family distr survival measures -#' @template example_scoring_rules -#' @export -MeasureSurvIntLogloss = R6Class("MeasureSurvIntLogloss", - inherit = MeasureSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param ERV (`logical(1)`)\cr - #' Standardize measure against a Kaplan-Meier baseline - #' (Explained Residual Variation) - initialize = function(ERV = FALSE) { - assert_logical(ERV) - - ps = ps( - integrated = p_lgl(default = TRUE), - times = p_uty(), - t_max = p_dbl(0), - p_max = p_dbl(0, 1), - eps = p_dbl(0, 1, default = 1e-3), - ERV = p_lgl(default = FALSE) - ) - ps$set_values(integrated = TRUE, eps = 1e-3, ERV = ERV) - - range = if (ERV) c(-Inf, 1) else c(0, Inf) - - super$initialize( - param_set = ps, - id = "surv.intlogloss", - range = range, - minimize = !ERV, - packages = "distr6", - predict_type = "distr", - label = "Integrated Log Loss", - man = "mlr3proba::mlr_measures_surv.intlogloss" - ) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - ps = self$param_set$values - - # ERV score - if (ps$ERV) return(.scoring_rule_erv(self, prediction, task, train_set)) - - nok = sum(!is.null(ps$times), !is.null(ps$t_max), !is.null(ps$p_max)) > 1 - if (nok) { - stop("Only one of `times`, `t_max`, and `p_max` should be provided") - } - - if (!ps$integrated) { - msg = "If `integrated=FALSE` then `times` should be a scalar numeric." - assert_numeric(ps$times, len = 1L, .var.name = msg) - } else { - if (!is.null(ps$times) && length(ps$times) == 1L) { - ps$integrated = FALSE - } - } - - x = as.integer(!is.null(task)) + as.integer(!is.null(train_set)) - if (x == 1) { - stop("Either 'task' and 'train_set' should be passed to measure or neither.") - } else if (x) { - train = task$truth(train_set) - } else { - train = NULL - } - - # `score` is a matrix, ISLL(i,j) => [test_obs x times] - score = .weighted_survival_score( - loss = "logloss", - truth = prediction$truth, - distribution = prediction$data$distr, - times = ps$times, t_max = ps$t_max, p_max = ps$p_max, - train = train, eps = ps$eps - ) - - .integrated_score(score, ps$integrated) - } - ) -) - -register_measure("surv.intlogloss", MeasureSurvIntLogloss) diff --git a/R/MeasureSurvLogloss.R b/R/MeasureSurvLogloss.R deleted file mode 100644 index b86edb02a..000000000 --- a/R/MeasureSurvLogloss.R +++ /dev/null @@ -1,101 +0,0 @@ -#' @template surv_measure -#' @templateVar title Negative Log-Likelihood -#' @templateVar fullname MeasureSurvLogloss -#' @templateVar eps 1e-6 -#' @template param_eps -#' @template param_erv -#' -#' @description -#' Calculates the cross-entropy, or negative log-likelihood (NLL) or logarithmic (log) loss. -#' -#' @details -#' The (observation-wise) Log-Likelihood is defined as the negative logarithm of -#' the predicted probability density function \eqn{f_i}, evaluated at the -#' observation time \eqn{t_i} (event or censoring): -#' -#' \deqn{L_{NLL}(S_i,t_i) = -\log{[f_i(t_i)]}} -#' -#' This loss does not take into account the censoring status of an observation, -#' treating all outcomes as events, and is also an improper scoring rule, -#' see Sonabend et al. (2024). -#' See section **Interpolation** for implementation details. -#' -#' To get a single score across all \eqn{N} observations of the test set, we -#' return the average of the observation-wise scores: -#' -#' \deqn{\sum_{i=1}^N L_{NLL}(S_i, t_i) / N} -#' -#' @template details_interp -#' -#' @references -#' `r format_bib("sonabend_2024")` -#' -#' @family Probabilistic survival measures -#' @family distr survival measures -#' @export -MeasureSurvLogloss = R6Class("MeasureSurvLogloss", - inherit = MeasureSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param ERV (`logical(1)`)\cr - #' Standardize measure against a Kaplan-Meier baseline - #' (Explained Residual Variation) - initialize = function(ERV = FALSE) { - assert_logical(ERV) - - ps = ps( - eps = p_dbl(0, 1, default = 1e-6), - ERV = p_lgl(default = FALSE) - ) - ps$set_values(eps = 1e-6, ERV = ERV) - - range = if (ERV) c(-Inf, 1) else c(0, Inf) - - super$initialize( - id = "surv.logloss", - range = range, - minimize = !ERV, - predict_type = "distr", - label = "Negative Log-Likelihood", - man = "mlr3proba::mlr_measures_surv.logloss", - param_set = ps - ) - - invisible(self) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - pv = self$param_set$values - - if (pv$ERV) { - return(.scoring_rule_erv(self, prediction, task, train_set)) - } - - truth = prediction$truth - n_obs = length(truth) - test_times = truth[, 1L] - - # get survival matrix - surv_mat = .get_surv_matrix(prediction) - pred_times = as.numeric(colnames(surv_mat)) - - res = vapply(seq_len(n_obs), function(obs_index) { - # event time or censoring time - outcome_time = test_times[obs_index] - - # predicted survival curve for observation - surv_pred = list(surv = surv_mat[obs_index, ], time = pred_times) - - # predicted pdf at observed time - .interp_pdf(surv_pred, outcome_time) - }, numeric(1)) - - mean(-log(pmax(pv$eps, res))) - } - ) -) - -register_measure("surv.logloss", MeasureSurvLogloss) diff --git a/R/MeasureSurvMAE.R b/R/MeasureSurvMAE.R deleted file mode 100644 index d72e17d36..000000000 --- a/R/MeasureSurvMAE.R +++ /dev/null @@ -1,39 +0,0 @@ -#' @template surv_measure -#' @templateVar title Mean Absolute Error -#' @templateVar fullname MeasureSurvMAE -#' -#' @description -#' Calculates the mean absolute error (MAE). -#' -#' The MAE is defined by -#' \deqn{\frac{1}{n} \sum |t - \hat{t}|}{1/n \sum |t - t*|} -#' where \eqn{t} is the true value and \eqn{\hat{t}}{t*} is the prediction. -#' -#' Censored observations in the test set are ignored. -#' -#' @family response survival measures -#' @export -MeasureSurvMAE = R6Class("MeasureSurvMAE", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "surv.mae", - range = c(0, Inf), - minimize = TRUE, - predict_type = "response", - label = "Mean Absolute Error", - man = "mlr3proba::mlr_measures_surv.mae" - ) - } - ), - - private = list( - .score = function(prediction, ...) { - mean(.obs_surv_errors(prediction$truth, prediction$response, method = "abs")) - } - ) -) - -register_measure("surv.mae", MeasureSurvMAE) diff --git a/R/MeasureSurvMSE.R b/R/MeasureSurvMSE.R deleted file mode 100644 index 8a6b30a47..000000000 --- a/R/MeasureSurvMSE.R +++ /dev/null @@ -1,39 +0,0 @@ -#' @template surv_measure -#' @templateVar title Mean Squared Error -#' @templateVar fullname MeasureSurvMSE -#' -#' @description -#' Calculates the mean squared error (MSE). -#' -#' The MSE is defined by -#' \deqn{\frac{1}{n} \sum ((t - \hat{t})^2)}{1/n \sum ((t - t*)^2)} -#' where \eqn{t} is the true value and \eqn{\hat{t}}{t*} is the prediction. -#' -#' Censored observations in the test set are ignored. -#' -#' @family response survival measures -#' @export -MeasureSurvMSE = R6Class("MeasureSurvMSE", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "surv.mse", - range = c(0, Inf), - minimize = TRUE, - predict_type = "response", - man = "mlr3proba::mlr_measures_surv.mse", - label = "Mean Squared Error" - ) - } - ), - - private = list( - .score = function(prediction, ...) { - mean(.obs_surv_errors(prediction$truth, prediction$response, method = "squared")) - } - ) -) - -register_measure("surv.mse", MeasureSurvMSE) diff --git a/R/MeasureSurvNagelkR2.R b/R/MeasureSurvNagelkR2.R deleted file mode 100644 index fd3990806..000000000 --- a/R/MeasureSurvNagelkR2.R +++ /dev/null @@ -1,47 +0,0 @@ -#' @template surv_measure -#' @templateVar title Nagelkerke's R2 -#' @templateVar fullname MeasureSurvNagelkR2 -#' @description -#' Calls [survAUC::Nagelk()]. -#' -#' Assumes Cox PH model specification. -#' -#' @template measure_survAUC -#' -#' @references -#' `r format_bib("nagelkerke_1991")` -#' -#' @family R2 survival measures -#' @family lp survival measures -#' @export -MeasureSurvNagelkR2 = R6Class("MeasureSurvNagelkR2", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "surv.nagelk_r2", - range = c(0, 1), - minimize = FALSE, - packages = "survAUC", - predict_type = "lp", - properties = c("requires_task", "requires_train_set", "requires_learner"), - label = "Nagelkerke's R2", - man = "mlr3proba::mlr_measures_surv.nagelk_r2" - ) - } - ), - - private = list( - .score = function(prediction, learner, task, train_set, ...) { - if (!inherits(learner, "LearnerSurvCoxPH")) { - stop("Only compatible with Cox PH models") - } - - surv_train = task$truth(train_set) - survAUC::Nagelk(surv_train, prediction$lp, rep(0, length(prediction$lp))) - } - ) -) - -register_measure("surv.nagelk_r2", MeasureSurvNagelkR2) diff --git a/R/MeasureSurvOQuigleyR2.R b/R/MeasureSurvOQuigleyR2.R deleted file mode 100644 index 5893d5d62..000000000 --- a/R/MeasureSurvOQuigleyR2.R +++ /dev/null @@ -1,47 +0,0 @@ -#' @template surv_measure -#' @templateVar title O'Quigley, Xu, and Stare's R2 -#' @templateVar fullname MeasureSurvOQuigleyR2 -#' @description -#' Calls [survAUC::OXS()]. -#' -#' Assumes Cox PH model specification. -#' -#' @template measure_survAUC -#' -#' @references -#' `r format_bib("oquigley_2005")` -#' -#' @family R2 survival measures -#' @family lp survival measures -#' @export -MeasureSurvOQuigleyR2 = R6Class("MeasureSurvOQuigleyR2", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "surv.oquigley_r2", - range = c(0, 1), - minimize = FALSE, - packages = "survAUC", - predict_type = "lp", - properties = c("requires_task", "requires_train_set", "requires_learner"), - label = "O'Quigley, Xu, and Stare's R2", - man = "mlr3proba::mlr_measures_surv.oquigley_r2" - ) - } - ), - - private = list( - .score = function(prediction, learner, task, train_set, ...) { - if (!inherits(learner, "LearnerSurvCoxPH")) { - stop("Only compatible with Cox PH models") - } - - surv_train = task$truth(train_set) - survAUC::OXS(surv_train, prediction$lp, rep(0, length(prediction$lp))) - } - ) -) - -register_measure("surv.oquigley_r2", MeasureSurvOQuigleyR2) diff --git a/R/MeasureSurvRCLL.R b/R/MeasureSurvRCLL.R deleted file mode 100644 index 02d3199da..000000000 --- a/R/MeasureSurvRCLL.R +++ /dev/null @@ -1,108 +0,0 @@ -#' @template surv_measure -#' @templateVar title Right-Censored Log Loss -#' @templateVar fullname MeasureSurvRCLL -#' @templateVar eps 1e-6 -#' @template param_eps -#' @template param_erv -#' -#' @description -#' Calculates the right-censored log-likelihood (RCLL) or logarithmic loss, -#' introduced by Avati et al. (2020). -#' -#' @details -#' The observation-wise RCLL is defined by: -#' -#' \deqn{L_{RCLL}(S_i, t_i, \delta_i) = -log[\delta_i f_i(t_i) + (1 - \delta_i) S_i(t_i)]} -#' -#' where \eqn{\delta_i} is the censoring indicator, \eqn{f_i} the predicted probability -#' density function and \eqn{S_i} the predicted survival function for observation \eqn{i}. -#' RCLL is proper given that censoring and survival distribution are independent, see Rindt et al. (2022). -#' Simulation studies by Sonabend et al. (2024) provide strong empirical evidence -#' supporting the properness of this score. -#' See section **Interpolation** for implementation details. -#' -#' To get a single score across all \eqn{N} observations of the test set, we -#' return the average of the observation-wise scores: -#' -#' \deqn{\sum_{i=1}^N L_{RCLL}(S_i, t_i, \delta_i) / N} -#' -#' @template details_interp -#' -#' @references -#' `r format_bib("avati_2020", "rindt_2022", "sonabend_2024")` -#' -#' @family Probabilistic survival measures -#' @family distr survival measures -#' @export -MeasureSurvRCLL = R6Class("MeasureSurvRCLL", - inherit = MeasureSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param ERV (`logical(1)`)\cr - #' Standardize measure against a Kaplan-Meier baseline - #' (Explained Residual Variation) - initialize = function(ERV = FALSE) { - assert_logical(ERV) - - ps = ps( - eps = p_dbl(0, 1, default = 1e-6), - ERV = p_lgl(default = FALSE) - ) - ps$set_values(eps = 1e-6, ERV = ERV) - - range = if (ERV) c(-Inf, 1) else c(0, Inf) - - super$initialize( - id = "surv.rcll", - minimize = !ERV, - predict_type = "distr", - label = "Right-Censored Log-Likelihood", - man = "mlr3proba::mlr_measures_surv.rcll", - range = range, - param_set = ps - ) - - invisible(self) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - pv = self$param_set$values - - if (pv$ERV) { - return(.scoring_rule_erv(self, prediction, task, train_set)) - } - - truth = prediction$truth - n_obs = length(truth) - test_times = truth[, 1L] - test_status = truth[, 2L] - - # get survival matrix - surv_mat = .get_surv_matrix(prediction) - pred_times = as.numeric(colnames(surv_mat)) - - res = vapply(seq_len(n_obs), function(obs_index) { - # event time or censoring time - outcome_time = test_times[obs_index] - - # predicted survival curve for observation - surv_pred = list(surv = surv_mat[obs_index, ], time = pred_times) - - if (test_status[obs_index] == 1) { - # event => use f(t) - .interp_pdf(surv_pred, outcome_time) - } else { - # censored => use S(t) - .interp_surv(surv_pred, outcome_time) - } - }, numeric(1)) - - mean(-log(pmax(pv$eps, res))) - } - ) -) - -register_measure("surv.rcll", MeasureSurvRCLL) diff --git a/R/MeasureSurvRMSE.R b/R/MeasureSurvRMSE.R deleted file mode 100644 index d82824b3d..000000000 --- a/R/MeasureSurvRMSE.R +++ /dev/null @@ -1,40 +0,0 @@ -#' @template surv_measure -#' @templateVar title Root Mean Squared Error -#' @templateVar fullname MeasureSurvRMSE -#' -#' @description -#' Calculates the root mean squared error (RMSE). -#' -#' The RMSE is defined by -#' \deqn{\sqrt{\frac{1}{n} \sum ((t - \hat{t})^2)}}{\sqrt(1/n \sum ((t - t*)^2))} -#' where \eqn{t} is the true value and \eqn{\hat{t}}{t*} is the prediction. -#' -#' Censored observations in the test set are ignored. -#' -#' @family response survival measures -#' @export -MeasureSurvRMSE = R6Class("MeasureSurvRMSE", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "surv.rmse", - range = c(0, Inf), - minimize = TRUE, - predict_type = "response", - label = "Root Mean Squared Error", - man = "mlr3proba::mlr_measures_surv.rmse", - properties = "na_score" - ) - } - ), - - private = list( - .score = function(prediction, ...) { - sqrt(mean(.obs_surv_errors(prediction$truth, prediction$response, method = "squared"))) - } - ) -) - -register_measure("surv.rmse", MeasureSurvRMSE) diff --git a/R/MeasureSurvSchmid.R b/R/MeasureSurvSchmid.R deleted file mode 100644 index 9530489ee..000000000 --- a/R/MeasureSurvSchmid.R +++ /dev/null @@ -1,126 +0,0 @@ -#' @template surv_measure -#' @templateVar title Integrated Schmid Score -#' @templateVar fullname MeasureSurvSchmid -#' @template param_integrated -#' @template param_times -#' @template param_tmax -#' @template param_pmax -#' @templateVar eps 1e-3 -#' @template param_eps -#' @template param_erv -#' -#' @description -#' Calculates the **Integrated Schmid Score** (ISS), aka integrated absolute loss. -#' -#' @details -#' This measure has two dimensions: (test set) observations and time points. -#' For a specific individual \eqn{i} from the test set, with observed survival -#' outcome \eqn{(t_i, \delta_i)} (time and censoring indicator) and predicted -#' survival function \eqn{S_i(t)}, the *observation-wise* estimator of the loss, -#' integrated across the time dimension up to the time cutoff \eqn{\tau^*}, is: -#' -#' \deqn{L_{ISS}(S_i, t_i, \delta_i) = \int^{\tau^*}_0 \frac{S_i(\tau) \text{I}(t_i \leq \tau, \delta=1)}{G(t_i)} + \frac{(1-S_i(\tau)) \text{I}(t_i > \tau)}{G(\tau)} \ d\tau} -#' -#' where \eqn{G} is the Kaplan-Meier estimate of the censoring distribution. -#' -#' The implementation uses the trapezoidal rule to approximate the integral over -#' time and the integral is normalized by the range of available evaluation times -#' (\eqn{\tau_{\text{max}} - \tau_{\text{min}}}). -#' -#' To get a single score across all \eqn{N} observations of the test set, we -#' return the average of the time-integrated observation-wise scores: -#' \deqn{\sum_{i=1}^N L(S_i, t_i, \delta_i) / N} -#' -#' @template properness -#' @templateVar id ISS -#' @template which_times -#' @template details_trainG -#' @template details_tmax -#' @template implementation_diffs -#' -#' @references -#' `r format_bib("schemper_2000", "schmid_2011", "sonabend_2024", "kvamme_2023")` -#' -#' @family Probabilistic survival measures -#' @family distr survival measures -#' @template example_scoring_rules -#' @export -MeasureSurvSchmid = R6Class("MeasureSurvSchmid", - inherit = MeasureSurv, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param ERV (`logical(1)`)\cr - #' Standardize measure against a Kaplan-Meier baseline - #' (Explained Residual Variation) - initialize = function(ERV = FALSE) { - assert_logical(ERV) - - ps = ps( - integrated = p_lgl(default = TRUE), - times = p_uty(), - t_max = p_dbl(0), - p_max = p_dbl(0, 1), - eps = p_dbl(0, 1, default = 1e-3), - ERV = p_lgl(default = FALSE) - ) - ps$set_values(integrated = TRUE, eps = 1e-3, ERV = ERV) - - range = if (ERV) c(-Inf, 1) else c(0, Inf) - - super$initialize( - param_set = ps, - id = "surv.schmid", - range = range, - minimize = !ERV, - packages = "distr6", - predict_type = "distr", - label = "Integrated Schmid Score", - man = "mlr3proba::mlr_measures_surv.schmid", - ) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - ps = self$param_set$values - - # ERV score - if (ps$ERV) return(.scoring_rule_erv(self, prediction, task, train_set)) - nok = sum(!is.null(ps$times), !is.null(ps$t_max), !is.null(ps$p_max)) > 1 - if (nok) { - stop("Only one of `times`, `t_max`, and `p_max` should be provided") - } - if (!ps$integrated) { - msg = "If `integrated=FALSE` then `times` should be a scalar numeric." - assert_numeric(ps$times, len = 1L, .var.name = msg) - } else { - if (!is.null(ps$times) && length(ps$times) == 1L) { - ps$integrated = FALSE - } - } - - x = as.integer(!is.null(task)) + as.integer(!is.null(train_set)) - if (x == 1) { - stop("Either 'task' and 'train_set' should be passed to measure or neither.") - } else if (x) { - train = task$truth(train_set) - } else { - train = NULL - } - - # `score` is a matrix, ISS(i,j) => [test_obs x times] - score = .weighted_survival_score( - loss = "schmid", - truth = prediction$truth, - distribution = prediction$data$distr, - times = ps$times, t_max = ps$t_max, p_max = ps$p_max, - train = train, eps = ps$eps - ) - - .integrated_score(score, ps$integrated) - } - ) -) - -register_measure("surv.schmid", MeasureSurvSchmid) diff --git a/R/MeasureSurvSongAUC.R b/R/MeasureSurvSongAUC.R deleted file mode 100644 index d173f4029..000000000 --- a/R/MeasureSurvSongAUC.R +++ /dev/null @@ -1,71 +0,0 @@ -#' @template surv_measure -#' @templateVar title Song and Zhou's AUC -#' @templateVar fullname MeasureSurvSongAUC -#' @template measure_survAUC -#' @template param_times -#' @template param_integrated -#' @template param_type_auc -#' -#' @description -#' Calls [survAUC::AUC.sh()]. -#' -#' Assumes Cox PH model specification. -#' -#' @references -#' `r format_bib("song_2008")` -#' -#' @family AUC survival measures -#' @family lp survival measures -#' @template example_auc_measures -#' @export -MeasureSurvSongAUC = R6Class("MeasureSurvSongAUC", - inherit = MeasureSurvAUC, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - times = p_uty(), - integrated = p_lgl(default = TRUE), - type = p_fct(c("incident", "cumulative"), default = "incident") - ) - ps$set_values(integrated = TRUE, type = "incident") - - super$initialize( - id = "surv.song_auc", - properties = c("requires_learner", "requires_task", "requires_train_set"), - man = "mlr3proba::mlr_measures_surv.song_auc", - label = "Song and Zhou's AUC", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, learner, task, train_set, ...) { - if (!inherits(learner, "LearnerSurvCoxPH")) { - stop("surv.song_auc only compatible with Cox PH models") - } - - ps = self$param_set$values - if (!ps$integrated) { - msg = "If `integrated=FALSE` then `times` should be a scalar numeric." - assert_numeric(ps$times, len = 1, .var.name = msg) - } else { - if (!is.null(ps$times) && length(ps$times) == 1) { - ps$integrated = FALSE - } - } - - super$.score( - prediction = prediction, - learner = learner, - task = task, - train_set = train_set, - FUN = survAUC::AUC.sh, - type = ps$type, - ...) - } - ) -) - -register_measure("surv.song_auc", MeasureSurvSongAUC) diff --git a/R/MeasureSurvSongTNR.R b/R/MeasureSurvSongTNR.R deleted file mode 100644 index 843731296..000000000 --- a/R/MeasureSurvSongTNR.R +++ /dev/null @@ -1,67 +0,0 @@ -#' @template surv_measure -#' @templateVar title Song and Zhou's TNR -#' @templateVar fullname MeasureSurvSongTNR -#' @template measure_survAUC -#' @template param_times -#' @template param_thresh -#' -#' @description -#' Calls [survAUC::spec.sh()]. -#' -#' Assumes Cox PH model specification. -#' -#' `times` and `lp_thresh` are arbitrarily set to `0` to prevent crashing, these -#' should be further specified. -#' -#' @references -#' `r format_bib("song_2008")` -#' -#' @family AUC survival measures -#' @family lp survival measures -#' @export -MeasureSurvSongTNR = R6Class("MeasureSurvSongTNR", - inherit = MeasureSurvAUC, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - times = p_dbl(0), - lp_thresh = p_dbl(default = 0) - ) - ps$set_values(lp_thresh = 0) - - super$initialize( - id = "surv.song_tnr", - properties = c("requires_task", "requires_train_set", "requires_learner"), - man = "mlr3proba::mlr_measures_surv.song_tnr", - label = "Song and Zhou's TNR", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, learner, task, train_set, ...) { - if (is.null(self$param_set$values$times)) { - stop("`times` must be non-NULL") - } - - if (!inherits(learner, "LearnerSurvCoxPH")) { - stop("Only compatible with Cox PH models") - } - - tnr = super$.score( - prediction = prediction, - learner = learner, - task = task, - train_set = train_set, - FUN = survAUC::spec.sh, - ... - ) - - tnr[, findInterval(self$param_set$values$lp_thresh, sort(unique(prediction$lp)))] - } - ) -) - -register_measure("surv.song_tnr", MeasureSurvSongTNR) diff --git a/R/MeasureSurvSongTPR.R b/R/MeasureSurvSongTPR.R deleted file mode 100644 index b3eea6626..000000000 --- a/R/MeasureSurvSongTPR.R +++ /dev/null @@ -1,69 +0,0 @@ -#' @template surv_measure -#' @templateVar title Song and Zhou's TPR -#' @templateVar fullname MeasureSurvSongTPR -#' @template measure_survAUC -#' @template param_times -#' @template param_thresh -#' -#' @description -#' Calls [survAUC::sens.sh()]. -#' -#' Assumes Cox PH model specification. -#' -#' `times` and `lp_thresh` are arbitrarily set to `0` to prevent crashing, these -#' should be further specified. -#' -#' @references -#' `r format_bib("song_2008")` -#' -#' @family AUC survival measures -#' @family lp survival measures -#' @export -MeasureSurvSongTPR = R6Class("MeasureSurvSongTPR", - inherit = MeasureSurvAUC, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - times = p_dbl(0), - lp_thresh = p_dbl(default = 0), - type = p_fct(c("incident", "cumulative"), default = "incident") - ) - ps$set_values(lp_thresh = 0, type = "incident") - - super$initialize( - id = "surv.song_tpr", - properties = c("requires_task", "requires_train_set", "requires_learner"), - man = "mlr3proba::mlr_measures_surv.song_tpr", - label = "Song and Zhou's TPR", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, learner, task, train_set, ...) { - if (is.null(self$param_set$values$times)) { - stop("`times` must be non-NULL") - } - - if (!inherits(learner, "LearnerSurvCoxPH")) { - stop("Only compatible with Cox PH models") - } - - tpr = super$.score( - prediction = prediction, - learner = learner, - task = task, - train_set = train_set, - FUN = survAUC::sens.sh, - type = self$param_set$values$type, - ... - ) - - tpr[, findInterval(self$param_set$values$lp_thresh, sort(unique(prediction$lp)))] - } - ) -) - -register_measure("surv.song_tpr", MeasureSurvSongTPR) diff --git a/R/MeasureSurvUnoAUC.R b/R/MeasureSurvUnoAUC.R deleted file mode 100644 index 9c5c3ffe4..000000000 --- a/R/MeasureSurvUnoAUC.R +++ /dev/null @@ -1,70 +0,0 @@ -#' @template surv_measure -#' @templateVar title Uno's AUC -#' @templateVar fullname MeasureSurvUnoAUC -#' -#' @description -#' Calls [survAUC::AUC.uno()]. -#' -#' Assumes random censoring. -#' -#' @template measure_survAUC -#' @template param_integrated -#' @template param_times -#' -#' @references -#' `r format_bib("uno_2007")` -#' -#' @family AUC survival measures -#' @family lp survival measures -#' @template example_auc_measures -#' @export -MeasureSurvUnoAUC = R6Class("MeasureSurvUnoAUC", - inherit = MeasureSurvAUC, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - integrated = p_lgl(default = TRUE), - times = p_uty() - ) - ps$values$integrated = TRUE - - super$initialize( - param_set = ps, - id = "surv.uno_auc", - properties = c("requires_task", "requires_train_set"), - label = "Uno's AUC", - man = "mlr3proba::mlr_measures_surv.uno_auc" - ) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - ps = self$param_set$values - if (!ps$integrated) { - msg = "If `integrated=FALSE` then `times` should be a scalar numeric." - assert_numeric(ps$times, len = 1, .var.name = msg) - } else { - if (!is.null(ps$times) && length(ps$times) == 1L) { - ps$integrated = FALSE - } - } - - x = super$.score( - prediction = prediction, - task = task, - train_set = train_set, - FUN = survAUC::AUC.uno, - ... - ) - if (is.list(x)) { - x$iauc - } else { - x - } - } - ) -) - -register_measure("surv.uno_auc", MeasureSurvUnoAUC) diff --git a/R/MeasureSurvUnoTNR.R b/R/MeasureSurvUnoTNR.R deleted file mode 100644 index e73ac9d1e..000000000 --- a/R/MeasureSurvUnoTNR.R +++ /dev/null @@ -1,59 +0,0 @@ -#' @template surv_measure -#' @templateVar title Uno's TNR -#' @templateVar fullname MeasureSurvUnoTNR -#' @template measure_survAUC -#' @template param_times2 -#' @template param_thresh -#' -#' @description -#' Calls [survAUC::spec.uno()]. -#' -#' Assumes random censoring. -#' -#' `times` and `lp_thresh` are arbitrarily set to `0` to prevent crashing, these -#' should be further specified. -#' -#' @references -#' `r format_bib("uno_2007")` -#' -#' @family AUC survival measures -#' @family lp survival measures -#' @export -MeasureSurvUnoTNR = R6Class("MeasureSurvUnoTNR", - inherit = MeasureSurvAUC, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - times = p_dbl(0), - lp_thresh = p_dbl(default = 0) - ) - ps$set_values(lp_thresh = 0) - - super$initialize( - param_set = ps, - id = "surv.uno_tnr", - label = "Uno's TNR", - man = "mlr3proba::mlr_measures_surv.uno_tnr" - ) - } - ), - - private = list( - .score = function(prediction, ...) { - if (is.null(self$param_set$values$times)) { - stop("`times` must be non-NULL") - } - - tnr = super$.score( - prediction = prediction, - FUN = survAUC::spec.uno, - task = task - ) - - tnr[, findInterval(self$param_set$values$lp_thresh, sort(unique(prediction$lp)))] - } - ) -) - -register_measure("surv.uno_tnr", MeasureSurvUnoTNR) diff --git a/R/MeasureSurvUnoTPR.R b/R/MeasureSurvUnoTPR.R deleted file mode 100644 index d994a3f0c..000000000 --- a/R/MeasureSurvUnoTPR.R +++ /dev/null @@ -1,61 +0,0 @@ -#' @template surv_measure -#' @templateVar title Uno's TPR -#' @templateVar fullname MeasureSurvUnoTPR -#' @template measure_survAUC -#' @template param_times2 -#' @template param_thresh -#' -#' @description -#' Calls [survAUC::sens.uno()]. -#' -#' Assumes random censoring. -#' -#' `times` and `lp_thresh` are arbitrarily set to `0` to prevent crashing, these -#' should be further specified. -#' -#' @references -#' `r format_bib("uno_2007")` -#' -#' @family AUC survival measures -#' @family lp survival measures -#' @export -MeasureSurvUnoTPR = R6Class("MeasureSurvUnoTPR", - inherit = MeasureSurvAUC, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - times = p_dbl(0), - lp_thresh = p_dbl(default = 0) - ) - ps$set_values(lp_thresh = 0) - - super$initialize( - id = "surv.uno_tpr", - properties = c("requires_task", "requires_train_set"), - man = "mlr3proba::mlr_measures_surv.uno_tpr", - label = "Uno's TPR", - param_set = ps - ) - } - ), - - private = list( - .score = function(prediction, task, train_set, ...) { - if (is.null(self$param_set$values$times)) { - stop("`times` must be non-NULL") - } - - tpr = super$.score( - prediction = prediction, - task = task, - train_set = train_set, - FUN = survAUC::sens.uno - ) - - tpr[, findInterval(self$param_set$values$lp_thresh, sort(unique(prediction$lp)))] - } - ) -) - -register_measure("surv.uno_tpr", MeasureSurvUnoTPR) diff --git a/R/MeasureSurvXuR2.R b/R/MeasureSurvXuR2.R deleted file mode 100644 index e777a3b71..000000000 --- a/R/MeasureSurvXuR2.R +++ /dev/null @@ -1,47 +0,0 @@ -#' @template surv_measure -#' @templateVar title Xu and O'Quigley's R2 -#' @templateVar fullname MeasureSurvXuR2 -#' @description -#' Calls [survAUC::XO()]. -#' -#' Assumes Cox PH model specification. -#' -#' @template measure_survAUC -#' -#' @references -#' `r format_bib("xu_1999")` -#' -#' @family R2 survival measures -#' @family lp survival measures -#' @export -MeasureSurvXuR2 = R6Class("MeasureSurvXuR2", - inherit = MeasureSurv, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - super$initialize( - id = "surv.xu_r2", - range = c(0, 1), - minimize = FALSE, - packages = "survAUC", - predict_type = "lp", - properties = c("requires_task", "requires_train_set", "requires_learner"), - label = "Xu and O'Quigley's R2", - man = "mlr3proba::mlr_measures_surv.xu_r2" - ) - } - ), - - private = list( - .score = function(prediction, learner, task, train_set, ...) { - if (!inherits(learner, "LearnerSurvCoxPH")) { - stop("Only compatible with Cox PH models") - } - - surv_train = task$truth(train_set) - survAUC::XO(surv_train, prediction$lp, numeric(length(prediction$lp))) - } - ) -) - -register_measure("surv.xu_r2", MeasureSurvXuR2) diff --git a/R/PipeOpBreslow.R b/R/PipeOpBreslow.R deleted file mode 100644 index 9a2195f95..000000000 --- a/R/PipeOpBreslow.R +++ /dev/null @@ -1,184 +0,0 @@ -#' @title Wrap a learner into a PipeOp with survival predictions estimated by the Breslow estimator -#' @name mlr_pipeops_compose_breslow_distr -#' @template param_pipelines -#' @description -#' Composes a survival distribution (`distr`) using the linear predictor -#' predictions (`lp`) from a given [LearnerSurv] during training and prediction, -#' utilizing the [breslow estimator][breslow]. The specified `learner` must be -#' capable of generating `lp`-type predictions (e.g., a Cox-type model). -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [Dictionary][mlr3misc::Dictionary] [mlr_pipeops][mlr3pipelines::mlr_pipeops] -#' or with the associated sugar function [po()][mlr3pipelines::po]: -#' ``` -#' PipeOpBreslow$new(learner) -#' mlr_pipeops$get("breslowcompose", learner) -#' po("breslowcompose", learner, breslow.overwrite = TRUE) -#' ``` -#' -#' @section Input and Output Channels: -#' [PipeOpBreslow] is like a [LearnerSurv]. -#' It has one input channel, named `input` that takes a [TaskSurv] during training -#' and another [TaskSurv] during prediction. -#' [PipeOpBreslow] has one output channel named `output`, producing `NULL` during -#' training and a [PredictionSurv] during prediction. -#' -#' @section State: -#' The `$state` slot stores the `times` and `status` survival target variables of -#' the train [TaskSurv] as well as the `lp` predictions on the train set. -#' -#' @section Parameters: -#' The parameters are: -#' * `breslow.overwrite` :: `logical(1)` \cr -#' If `FALSE` (default) then the compositor does nothing and returns the -#' input `learner`'s [PredictionSurv]. -#' If `TRUE` or in the case that the input `learner` doesn't have `distr` -#' predictions, then the `distr` is overwritten with the `distr` composed -#' from `lp` and the train set information using [breslow]. -#' This is useful for changing the prediction `distr` from one model form to -#' another. -#' @seealso [pipeline_distrcompositor] -#' @references -#' `r format_bib("breslow_1972", "lin_2007")` -#' @export -#' @family survival compositors -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' task = tsk("rats") -#' part = partition(task, ratio = 0.8) -#' train_task = task$clone()$filter(part$train) -#' test_task = task$clone()$filter(part$test) -#' -#' learner = lrn("surv.coxph") # learner with lp predictions -#' b = po("breslowcompose", learner = learner, breslow.overwrite = TRUE) -#' -#' b$train(list(train_task)) -#' p = b$predict(list(test_task))[[1L]] -#' } -PipeOpBreslow = R6Class("PipeOpBreslow", - inherit = mlr3pipelines::PipeOp, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param learner ([LearnerSurv])\cr - #' Survival learner which must provide `lp`-type predictions - #' @param id (character(1))\cr - #' Identifier of the resulting object. If `NULL` (default), it will be set - #' as the `id` of the input `learner`. - initialize = function(learner, id = NULL, param_vals = list()) { - assert_learner(learner, task_type = "surv") - if ("lp" %nin% learner$predict_types) { - stopf("Learner %s must provide lp predictions", learner$id) - } - - # id of the PipeOp is the id of the learner - private$.learner = as_learner(learner, clone = TRUE) - id = id %??% private$.learner$id - - # define `breslow.overwrite` parameter - private$.breslow_ps = ps( - overwrite = p_lgl(tags = c("predict", "required")) - ) - private$.breslow_ps$set_values(overwrite = FALSE) - if ("set_id" %in% names(private$.learner$param_set)) { - # old paradox - private$.learner$param_set$set_id = "" - private$.breslow_ps$set_id = "breslow" - } - super$initialize( - id = id, - param_set = alist(breslow = private$.breslow_ps, private$.learner$param_set), - param_vals = param_vals, - input = data.table(name = "input", train = "TaskSurv", predict = "TaskSurv"), - output = data.table(name = "output", train = "NULL", predict = "PredictionSurv"), - packages = private$.learner$packages - ) - } - ), - - active = list( - #' @field learner ([mlr3::Learner])\cr - #' The input survival learner. - learner = function(rhs) { - assert_ro_binding(rhs) - private$.learner - } - ), - - private = list( - .train = function(inputs) { - task = inputs[[1]] - learner = private$.learner - - # train learner - learner$train(task) - - # predictions on the train set - p = learner$predict(task) - - # Breslow works only with non-NA `lp` predictions - if (anyMissing(p$lp)) { - stopf("Missing lp predictions") - } - - # keep the training data that Breslow estimator needs - self$state = list( - learner = learner, - times = task$times(), - status = task$status(), - lp_train = p$lp - ) - - list(NULL) - }, - - .predict = function(inputs) { - task = inputs[[1]] - learner = self$state$learner - - if (is.null(learner$model)) { - stopf("Cannot predict, Learner '%s' has not been trained yet", learner$id) - } - - # predictions on the test set - p = learner$predict(task) - - pv = self$param_set$get_values(tags = "predict") - overwrite = pv$breslow.overwrite - - # If learner predicts `distr` and overwrite is FALSE don't use breslow - if ("distr" %in% learner$predict_types & !overwrite) { - pred = list(p) - } else { - # Breslow works only with non-NA `lp` predictions - if (anyMissing(p$lp)) { - stopf("Missing lp predictions!") - } - - distr = breslow( - times = self$state$times, - status = self$state$status, - lp_train = self$state$lp_train, - lp_test = p$lp - ) - - pred = list(PredictionSurv$new( - row_ids = p$row_ids, - truth = p$truth, - crank = p$crank, - lp = p$lp, - distr = distr - )) - } - - pred - }, - - .breslow_ps = NULL, - .learner = NULL, - .additional_phash_input = function() private$.learner$phash - ) -) diff --git a/R/PipeOpCrankCompositor.R b/R/PipeOpCrankCompositor.R deleted file mode 100644 index 91543bac7..000000000 --- a/R/PipeOpCrankCompositor.R +++ /dev/null @@ -1,128 +0,0 @@ -#' @title PipeOpCrankCompositor -#' @name mlr_pipeops_crankcompose -#' @template param_pipelines -#' -#' @description -#' Uses a predicted `distr` in a [PredictionSurv] to estimate (or 'compose') a `crank` prediction. -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] or with the associated sugar -#' function [mlr3pipelines::po()]: -#' ``` -#' PipeOpCrankCompositor$new() -#' mlr_pipeops$get("crankcompose") -#' po("crankcompose") -#' ``` -#' -#' @section Input and Output Channels: -#' [PipeOpCrankCompositor] has one input channel named `"input"`, which takes `NULL` during training and [PredictionSurv] during prediction. -#' -#' [PipeOpCrankCompositor] has one output channel named `"output"`, producing `NULL` during training and a [PredictionSurv] during prediction. -#' -#' The output during prediction is the [PredictionSurv] from the input but with the `crank` predict type overwritten by the given estimation method. -#' -#' @section State: -#' The `$state` is left empty (`list()`). -#' -#' @section Parameters: -#' * `method` :: `character(1)` \cr -#' Determines what method should be used to produce a continuous ranking from the distribution. -#' Currently only `mort` is supported, which is the sum of the cumulative hazard, also called *expected/ensemble mortality*, see Ishwaran et al. (2008). -#' For more details, see [get_mortality()]. -#' * `overwrite` :: `logical(1)` \cr -#' If `FALSE` (default) and the prediction already has a `crank` prediction, then the compositor returns the input prediction unchanged. -#' If `TRUE`, then the `crank` will be overwritten. -#' -#' @seealso [pipeline_crankcompositor] -#' @references -#' `r format_bib("sonabend_2022", "ishwaran_2008")` -#' @family survival compositors -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3pipelines) -#' task = tsk("rats") -#' -#' # change the crank prediction type of a Cox's model predictions -#' pred = lrn("surv.coxph")$train(task)$predict(task) -#' poc = po("crankcompose", param_vals = list(overwrite = TRUE)) -#' poc$train(list(NULL)) # need to train first, even if nothing happens -#' poc$predict(list(pred))[[1L]] -#' } -#' @export -PipeOpCrankCompositor = R6Class("PipeOpCrankCompositor", - inherit = mlr3pipelines::PipeOp, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id = "crankcompose", param_vals = list()) { - param_set = ps( - method = p_fct(default = "mort", levels = c("mort"), tags = "predict"), - overwrite = p_lgl(default = FALSE, tags = "predict") - ) - param_set$set_values(method = "mort", overwrite = FALSE) - - super$initialize( - id = id, - param_set = param_set, - param_vals = param_vals, - input = data.table(name = "input", train = "NULL", predict = "PredictionSurv"), - output = data.table(name = "output", train = "NULL", predict = "PredictionSurv"), - packages = c("mlr3proba") - ) - } - ), - - private = list( - .train = function(inputs) { - self$state = list() - list(NULL) - }, - - .predict = function(inputs) { - pred = inputs[[1L]] - overwrite = self$param_set$values$overwrite - # it's impossible for a learner not to predict crank in mlr3proba, - # but let's check either way: - has_crank = !all(is.na(pred$crank)) - - if (!overwrite & has_crank) { - # return prediction as is - return(list(pred)) - } else { - # compose crank from distr prediction - assert("distr" %in% pred$predict_types) - - # get survival matrix - if (inherits(pred$data$distr, "array")) { - surv = pred$data$distr - if (length(dim(surv)) == 3L) { - # survival 3d array, extract median - surv = .ext_surv_mat(arr = surv, which.curve = 0.5) - } - } else { - stop("Distribution prediction does not have a survival matrix or array - in the $data$distr slot") - } - - method = self$param_set$values$method - if (method == "mort") { - crank = get_mortality(surv) - } - - p = PredictionSurv$new( - row_ids = pred$row_ids, - truth = pred$truth, - crank = crank, # update only `crank` - distr = pred$distr, - lp = pred$lp, - response = pred$response - ) - - return(list(p)) - } - } - ) -) - -register_pipeop("crankcompose", PipeOpCrankCompositor) diff --git a/R/PipeOpDistrCompositor.R b/R/PipeOpDistrCompositor.R deleted file mode 100644 index 0df20ab0f..000000000 --- a/R/PipeOpDistrCompositor.R +++ /dev/null @@ -1,199 +0,0 @@ -#' @title PipeOpDistrCompositor -#' @name mlr_pipeops_distrcompose -#' @template param_pipelines -#' -#' @description -#' `r lifecycle::badge("experimental")` -#' -#' Estimates (or 'composes') a survival distribution from a predicted baseline -#' survival distribution (`distr`) and a linear predictor (`lp`) from two [PredictionSurv]s. -#' -#' Compositor Assumptions: -#' * The baseline `distr` is a discrete estimator, e.g. [surv.kaplan][LearnerSurvKaplan]. -#' * The composed `distr` is of a linear form -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] or with the associated sugar -#' function [mlr3pipelines::po()]: -#' ``` -#' PipeOpDistrCompositor$new() -#' mlr_pipeops$get("distrcompose") -#' po("distrcompose") -#' ``` -#' -#' @section Input and Output Channels: -#' [PipeOpDistrCompositor] has two input channels, `"base"` and `"pred"`. -#' Both input channels take `NULL` during training and [PredictionSurv] during prediction. -#' -#' [PipeOpDistrCompositor] has one output channel named `"output"`, producing -#' `NULL` during training and a [PredictionSurv] during prediction. -#' -#' The output during prediction is the [PredictionSurv] from the `"pred"` input -#' but with an extra (or overwritten) column for the `distr` predict type; which -#' is composed from the `distr` of `"base"` and the `lp` of `"pred"`. -#' If no `lp` predictions have been made or exist, then the `"pred"` is returned unchanged. -#' -#' @section State: -#' The `$state` is left empty (`list()`). -#' -#' @section Parameters: -#' The parameters are: -#' * `form` :: `character(1)` \cr -#' Determines the form that the predicted linear survival model should take. This is either, -#' accelerated-failure time, `aft`, proportional hazards, `ph`, or proportional odds, `po`. -#' Default `aft`. -#' * `overwrite` :: `logical(1)` \cr -#' If `FALSE` (default) then if the "pred" input already has a `distr`, the compositor does -#' nothing and returns the given [PredictionSurv]. If `TRUE`, then the `distr` is overwritten -#' with the `distr` composed from `lp` - this is useful for changing the prediction -#' `distr` from one model form to another. -#' * `scale_lp` :: `logical(1)` \cr -#' This option is only applicable to `form` equal to `"aft"`. If `TRUE`, it -#' min-max scales the linear prediction scores to be in the interval \eqn{[0,1]}, -#' avoiding extrapolation of the baseline \eqn{S_0(t)} on the transformed time -#' points \eqn{\frac{t}{\exp(lp)}}, as these will be \eqn{\in [\frac{t}{e}, t]}, -#' and so always smaller than the maximum time point for which we have estimated -#' \eqn{S_0(t)}. -#' Note that this is just a **heuristic** to get reasonable results in the -#' case you observe survival predictions to be e.g. constant after the AFT -#' composition and it definitely provides no guarantee for creating calibrated -#' distribution predictions (as none of these methods do). Therefore, it is -#' set to `FALSE` by default. -#' -#' @section Internals: -#' The respective `form`s above have respective survival distributions: -#' \deqn{aft: S(t) = S_0(\frac{t}{\exp(lp)})} -#' \deqn{ph: S(t) = S_0(t)^{\exp(lp)}} -#' \deqn{po: S(t) = \frac{S_0(t)}{\exp(-lp) + (1-\exp(-lp)) S_0(t)}} -#' where \eqn{S_0} is the estimated baseline survival distribution, and \eqn{lp} is the -#' predicted linear predictor. -#' -#' For an example use of the `"aft"` composition using Kaplan-Meier as a baseline -#' distribution, see Norman et al. (2024). -#' -#' @seealso [pipeline_distrcompositor] -#' @references -#' `r format_bib("norman_2024")` -#' @export -#' @family survival compositors -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' task = tsk("rats") -#' -#' base = lrn("surv.kaplan")$train(task)$predict(task) -#' pred = lrn("surv.coxph")$train(task)$predict(task) -#' # let's change the distribution prediction of Cox (Breslow-based) to an AFT form: -#' pod = po("distrcompose", param_vals = list(form = "aft", overwrite = TRUE)) -#' pod$train(list(NULL, NULL)) # need to train first, even if nothing happens -#' pod$predict(list(base = base, pred = pred))[[1]] -#' } -PipeOpDistrCompositor = R6Class("PipeOpDistrCompositor", - inherit = mlr3pipelines::PipeOp, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id = "distrcompose", param_vals = list()) { - param_set = ps( - form = p_fct(default = "aft", levels = c("aft", "ph", "po"), tags = "predict"), - overwrite = p_lgl(default = FALSE, tags = "predict"), - scale_lp = p_lgl(default = FALSE, tags = "predict") - ) - param_set$set_values(form = "aft", overwrite = FALSE, scale_lp = FALSE) - - super$initialize( - id = id, - param_set = param_set, - param_vals = param_vals, - input = data.table(name = c("base", "pred"), train = "NULL", predict = "PredictionSurv"), - output = data.table(name = "output", train = "NULL", predict = "PredictionSurv"), - packages = c("mlr3proba", "distr6") - ) - } - ), - - private = list( - .train = function(inputs) { - self$state = list() - list(NULL) - }, - - .predict = function(inputs) { - base = inputs$base - pred = inputs$pred - - # if no `lp` predictions, we return the survival prediction object unchanged - if (is.null(pred$lp)) { - return(list(pred)) - } - - overwrite = assert_logical(self$param_set$values$overwrite) - if ("distr" %in% pred$predict_types & !overwrite) { - return(list(pred)) - } else { - assert("distr" %in% base$predict_types) - - # check: targets are the same - assert_true(identical(base$truth, pred$truth)) - - form = self$param_set$values$form - nr = length(pred$data$row_ids) - - # we need 'lp' predictions - lp = pred$lp - - if (inherits(base$data$distr, "Distribution")) { - base = distr6::as.MixtureDistribution(base$distr) - times = unlist(base[1L]$properties$support$elements) - nc = length(times) - survmat = matrix(1 - base$cdf(times), nrow = nr, ncol = nc, byrow = TRUE) - } else { - # average survival probability across observations (on the test set) - avg_surv = colMeans(base$data$distr) - times = as.numeric(names(avg_surv)) - nc = length(times) - survmat = matrix(avg_surv, nrow = nr, ncol = nc, byrow = TRUE) - } - - timesmat = matrix(times, nrow = nr, ncol = nc, byrow = TRUE) - lpmat = matrix(lp, nrow = nr, ncol = nc) - - # compose survival distribution - if (form == "ph") { - cdf = 1 - (survmat ^ exp(lpmat)) - } else if (form == "aft") { - # add heuristic to keep the transformed t/exp(lp) time points within - # the domain of S_0(t) - if (self$param_set$values$scale_lp) { - lpmat = (lpmat - min(lpmat)) / (max(lpmat) - min(lpmat)) - } - # calculate cdf = 1 - S_0(t) on the time points t/exp(lp) - mtc = findInterval(timesmat / exp(lpmat), times) - mtc[mtc == 0] = NA - cdf = 1 - matrix(survmat[1L, mtc], nr, nc, FALSE) - cdf[is.na(cdf)] = 0 - } else if (form == "po") { - cdf = 1 - (survmat * ((exp(-lpmat) + ((1 - exp(-lpmat)) * survmat))^-1)) - cdf[survmat == 1] = 0 - } - - distr = .surv_return(times = times, surv = 1 - cdf)$distr - - p = PredictionSurv$new( - row_ids = pred$row_ids, - truth = pred$truth, - crank = pred$crank, - lp = pred$lp, - response = pred$response, - distr = distr # overwrite only the distribution - ) - - return(list(p)) - } - } - ) -) - -register_pipeop("distrcompose", PipeOpDistrCompositor) diff --git a/R/PipeOpPredClassifSurvDiscTime.R b/R/PipeOpPredClassifSurvDiscTime.R deleted file mode 100644 index 6146a38e6..000000000 --- a/R/PipeOpPredClassifSurvDiscTime.R +++ /dev/null @@ -1,121 +0,0 @@ -#' @title PipeOpPredClassifSurvDiscTime -#' @name mlr_pipeops_trafopred_classifsurv_disctime -#' -#' @description -#' Transform [PredictionClassif][mlr3::PredictionClassif] to [PredictionSurv] by converting -#' event probabilities of a pseudo status variable (discrete time hazards) -#' to survival probabilities using the product rule (Tutz et al. 2016): -#' -#' \deqn{P_k = p_k\cdot ... \cdot p_1} -#' -#' Where: -#' - We assume that continuous time is divided into time intervals -#' \eqn{[0, t_1), [t_1, t_2), ..., [t_n, \infty)} -#' - \eqn{P_k = P(T > t_k)} is the survival probability at time \eqn{t_k} -#' - \eqn{h_k} is the discrete-time hazard (classifier prediction), i.e. the -#' conditional probability for an event in the \eqn{k}-interval. -#' - \eqn{p_k = 1 - h_k = P(T \ge t_k | T \ge t_{k-1})} -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] -#' or with the associated sugar function [mlr3pipelines::po()]: -#' ``` -#' PipeOpPredClassifSurvDiscTime$new() -#' mlr_pipeops$get("trafopred_classifsurv_disctime") -#' po("trafopred_classifsurv_disctime") -#' ``` -#' -#' @section Input and Output Channels: -#' The input is a [PredictionClassif][mlr3::PredictionClassif] and a -#' [data.table][data.table::data.table] with the transformed data both generated -#' by [PipeOpTaskSurvClassifDiscTime]. -#' The output is the input [PredictionClassif][mlr3::PredictionClassif] -#' transformed to a [PredictionSurv]. -#' Only works during prediction phase. -#' -#' @references -#' `r format_bib("tutz_2016")` -#' @seealso [pipeline_survtoclassif_disctime] -#' @family Transformation PipeOps -#' @export -PipeOpPredClassifSurvDiscTime = R6Class("PipeOpPredClassifSurvDiscTime", - inherit = mlr3pipelines::PipeOp, - - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param id (character(1))\cr - #' Identifier of the resulting object. - initialize = function(id = "trafopred_classifsurv_disctime") { - super$initialize( - id = id, - input = data.table( - name = c("input", "transformed_data"), - train = c("NULL", "data.table"), - predict = c("PredictionClassif", "data.table") - ), - output = data.table( - name = "output", - train = "NULL", - predict = "PredictionSurv" - ) - ) - } - ), - - active = list( - #' @field predict_type (`character(1)`)\cr - #' Returns the active predict type of this PipeOp, which is `"crank"` - predict_type = function(rhs) { - assert_ro_binding(rhs) - "crank" - } - ), - - private = list( - .predict = function(input) { - pred = input[[1]] - data = input[[2]] - assert_true(!is.null(pred$prob)) - # probability of having the event (1) in each respective interval - # is the discrete-time hazard - data = cbind(data, dt_hazard = pred$prob[, "1"]) - - # From theory, convert hazards to surv as prod(1 - h(t)) - rows_per_id = nrow(data) / length(unique(data$id)) - surv = t(vapply(unique(data$id), function(unique_id) { - cumprod(1 - data[data$id == unique_id, ][["dt_hazard"]]) - }, numeric(rows_per_id))) - - unique_end_times = sort(unique(data$tend)) - # coerce to distribution and crank - pred_list = .surv_return(times = unique_end_times, surv = surv) - - # select the real tend values by only selecting the last row of each id - # basically a slightly more complex unique() - real_tend = data$obs_times[seq_len(nrow(data)) %% rows_per_id == 0] - - ids = unique(data$id) - # select last row for every id => observed times - id = disc_status = NULL # to fix note - data = data[, .SD[.N, list(disc_status)], by = id] - - # create prediction object - p = PredictionSurv$new( - row_ids = ids, - crank = pred_list$crank, distr = pred_list$distr, - truth = Surv(real_tend, as.integer(as.character(data$disc_status))) - ) - - list(p) - }, - - .train = function(input) { - self$state = list() - list(input) - } - ) -) - -register_pipeop("trafopred_classifsurv_disctime", PipeOpPredClassifSurvDiscTime) diff --git a/R/PipeOpPredClassifSurvIPCW.R b/R/PipeOpPredClassifSurvIPCW.R deleted file mode 100644 index 333acdca6..000000000 --- a/R/PipeOpPredClassifSurvIPCW.R +++ /dev/null @@ -1,108 +0,0 @@ -#' @title PipeOpPredClassifSurvIPCW -#' @name mlr_pipeops_trafopred_classifsurv_IPCW -#' -#' @description -#' Transform [PredictionClassif][mlr3::PredictionClassif] to [PredictionSurv] -#' using the **I**nverse **P**robability of **C**ensoring **W**eights (IPCW) -#' method by Vock et al. (2016). -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] -#' or with the associated sugar function [mlr3pipelines::po()]: -#' ``` -#' PipeOpPredClassifSurvIPCW$new() -#' mlr_pipeops$get("trafopred_classifsurv_IPCW") -#' po("trafopred_classifsurv_IPCW") -#' ``` -#' -#' @section Input and Output Channels: -#' The input is a [PredictionClassif][mlr3::PredictionClassif] and a -#' [data.table][data.table::data.table] containing observed times, -#' censoring indicators and row ids, all generated by [PipeOpTaskSurvClassifIPCW] -#' during the prediction phase. -#' -#' The output is the input [PredictionClassif][mlr3::PredictionClassif] transformed -#' to a [PredictionSurv]. -#' Each input classification probability prediction corresponds to the -#' probability of having the event up to the specified cutoff time -#' \eqn{\hat{\pi}(\textbf{X}_i) = P(T_i < \tau|\textbf{X}_i)}, -#' see Vock et al. (2016) and [PipeOpTaskSurvClassifIPCW]. -#' Therefore, these predictions serve as **continuous risk scores** that can be -#' directly interpreted as `crank` predictions in the right-censored survival -#' setting. We also map them to the survival distribution prediction `distr`, -#' at the specified cutoff time point \eqn{\tau}, i.e. as -#' \eqn{S_i(\tau) = 1 - \hat{\pi}(\textbf{X}_i)}. -#' Survival measures that use the survival distribution (eg [ISBS][mlr_measures_surv.brier]) -#' should be evaluated exactly at the cutoff time point \eqn{\tau}. -#' -#' @references -#' `r format_bib("vock_2016")` -#' -#' @seealso [pipeline_survtoclassif_IPCW] -#' @family Transformation PipeOps -#' @export -PipeOpPredClassifSurvIPCW = R6Class("PipeOpPredClassifSurvIPCW", - inherit = mlr3pipelines::PipeOp, - - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param id (character(1))\cr - #' Identifier of the resulting object. - initialize = function(id = "trafopred_classifsurv_IPCW") { - super$initialize( - id = id, - input = data.table( - name = c("input", "data"), - train = c("NULL", "NULL"), - predict = c("PredictionClassif", "list") - ), - output = data.table( - name = "output", - train = "NULL", - predict = "PredictionSurv" - ) - ) - } - ), - - active = list( - #' @field predict_type (`character(1)`)\cr - #' Returns the active predict type of this PipeOp, which is `"crank"` - predict_type = function(rhs) { - assert_ro_binding(rhs) - "crank" - } - ), - - private = list( - .predict = function(input) { - pred = input[[1]] # classification predictions - data = input[[2]] # row_ids, times, status, tau - - # risk => prob of having the event up until the cutoff time - risk = pred$prob[, "1"] - surv = matrix(data = 1 - risk, ncol = 1) - colnames(surv) = data$tau - - p = PredictionSurv$new( - # the original row ids - row_ids = data$row_ids, - # the original truth (times, status) - truth = Surv(time = data$times, event = data$status), - crank = risk, - distr = surv - ) - - list(p) - }, - - .train = function(input) { - self$state = list() - list(input) - } - ) -) - -register_pipeop("trafopred_classifsurv_IPCW", PipeOpPredClassifSurvIPCW) diff --git a/R/PipeOpPredRegrSurvPEM.R b/R/PipeOpPredRegrSurvPEM.R deleted file mode 100644 index b8ab3fe3d..000000000 --- a/R/PipeOpPredRegrSurvPEM.R +++ /dev/null @@ -1,119 +0,0 @@ -#' @title PipeOpPredRegrSurvPEM -#' @name mlr_pipeops_trafopred_regrsurv_pem -#' -#' @description -#' Transform [PredictionRegr][mlr3::PredictionRegr] to [PredictionSurv]. -#' The predicted piece-wise constant hazards contained in [PredictionRegr][mlr3::PredictionRegr] are transformed into survival probabilities and wrapped in a -#' [PredictionSurv][mlr3::PredictionRegr] object. -#' -#' We compute the survival probability from the predicted hazards using the following relation: -#' \deqn{S(t | \mathbf{x}) = \exp \left( - \int_{0}^{t} \lambda(s | \mathbf{x}) \, ds \right) = \exp \left( - \sum_{j = 1}^{J} \lambda(j | \mathbf{x}) d_j\, \right),} -#' where \eqn{j = 1, \ldots, J} denotes the interval, \eqn{t} the time, and \eqn{d_j} the duration of interval \eqn{j}. -#' -#' For a more detailed description of PEM, refer to [pipeline_survtoregr_pem] or the referred article. -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] -#' or with the associated sugar function [mlr3pipelines::po()]: -#' ``` -#' PipeOpPredRegrSurvPEM$new() -#' mlr_pipeops$get("trafopred_regrsurv_pem") -#' po("trafopred_regrsurv_pem") -#' ``` -#' -#' @section Input and Output Channels: -#' The input consists of a [PredictionRegr][mlr3::PredictionRegr] and a -#' [data.table][data.table::data.table] containing the transformed data. -#' The [PredictionRegr][mlr3::PredictionRegr] is provided by the [mlr3::LearnerRegr], -#' while the [data.table][data.table::data.table] is generated by [PipeOpTaskSurvRegrPEM]. -#' The output is the input [PredictionRegr][mlr3::PredictionRegr] transformed to -#' a [PredictionSurv]. -#' Only works during prediction phase. -#' -#' @references -#' `r format_bib("bender_2018")` -#' -#' @seealso [pipeline_survtoregr_pem] -#' @family PipeOps -#' @family Transformation PipeOps -#' @export -PipeOpPredRegrSurvPEM = R6Class( - "PipeOpPredRegrSurvPEM", - inherit = mlr3pipelines::PipeOp, - - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param id (character(1))\cr - #' Identifier of the resulting object. - initialize = function(id = "trafopred_regrsurv_pem") { - super$initialize( - id = id, - input = data.table( - name = c("input", "transformed_data"), - train = c("NULL", "data.table"), - predict = c("PredictionRegr", "data.table") - ), - output = data.table( - name = "output", - train = "NULL", - predict = "PredictionSurv" - ) - ) - } - ), - - active = list( - #' @field predict_type (`character(1)`)\cr - #' Returns the active predict type of this PipeOp, which is `"crank"` - predict_type = function(rhs) { - assert_ro_binding(rhs) - "crank" - } - ), - - private = list( - .predict = function(input) { - pred = input[[1]] # predicted hazards provided by the regression learner - data = input[[2]] # transformed data - assert_true(!is.null(pred$response)) - - data = cbind(data, dt_hazard = pred$response) - - # From theory, convert hazards to surv as exp(-cumsum(h(t) * exp(offset))) - rows_per_id = nrow(data) / length(unique(data$id)) - - surv = t(vapply(unique(data$id), function(unique_id) { - exp(-cumsum(data[data$id == unique_id, ][["dt_hazard"]] * exp(data[data$id == unique_id, ][["offset"]]))) - }, numeric(rows_per_id))) - - unique_end_times = sort(unique(data$tend)) - # coerce to distribution and crank - pred_list = .surv_return(times = unique_end_times, surv = surv) - - # select the real tend values by only selecting the last row of each id - # basically a slightly more complex unique() - real_tend = data$obs_times[seq_len(nrow(data)) %% rows_per_id == 0] - - ids = unique(data$id) - # select last row for every id => observed times - id = pem_status = NULL # to fix note - data = data[, .SD[.N, list(pem_status)], by = id] - - # create prediction object - p = PredictionSurv$new( - row_ids = ids, - crank = pred_list$crank, distr = pred_list$distr, - truth = Surv(real_tend, as.integer(as.character(data$pem_status)))) - - list(p) - }, - - .train = function(input) { - self$state = list() - list(input) - } - ) -) -register_pipeop("trafopred_regrsurv_pem", PipeOpPredRegrSurvPEM) diff --git a/R/PipeOpProbregrCompositor.R b/R/PipeOpProbregrCompositor.R deleted file mode 100644 index 2ec9bfca4..000000000 --- a/R/PipeOpProbregrCompositor.R +++ /dev/null @@ -1,143 +0,0 @@ -#' @title PipeOpProbregr -#' @name mlr_pipeops_compose_probregr -#' @template param_pipelines -#' -#' @description -#' `r lifecycle::badge("experimental")` -#' -#' Combines a predicted `response` and `se` from [PredictionRegr][mlr3::PredictionRegr] -#' with a specified probability distribution to estimate (or 'compose') a `distr` prediction. -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] or with the associated sugar -#' function [mlr3pipelines::po()]: -#' ``` -#' PipeOpProbregr$new() -#' mlr_pipeops$get("compose_probregr") -#' po("compose_probregr") -#' ``` -#' -#' @section Input and Output Channels: -#' [PipeOpProbregr] has two input channels named `"input_response"` and `"input_se"`, -#' which take `NULL` during training and two [PredictionRegr][mlr3::PredictionRegr]s -#' during prediction, these should respectively contain the `response` and `se` -#' return type, the same object can be passed twice. -#' -#' The output during prediction is a [PredictionRegr][mlr3::PredictionRegr] with -#' the "response" from `input_response`, the "se" from `input_se` and a "distr" -#' created from combining the two. -#' -#' @section State: -#' The `$state` is left empty (`list()`). -#' -#' @section Parameters: -#' * `dist` :: `character(1)` \cr -#' Location-scale distribution to use for composition. Current choices are -#' `"Uniform"` (default), `"Normal"`, `"Cauchy"`, `"Gumbel"`, `"Laplace"`, -#' `"Logistic"`. All implemented via \link[distr6]{distr6}. -#' -#' @section Internals: -#' The composition is created by substituting the `response` and `se` predictions into the -#' distribution location and scale parameters respectively. -#' -#' @export -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines", "rpart"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' set.seed(1) -#' task = tsk("boston_housing") -#' -#' # Option 1: Use a learner that can predict se -#' learn = lrn("regr.featureless", predict_type = "se") -#' pred = learn$train(task)$predict(task) -#' poc = po("compose_probregr") -#' poc$train(list(NULL, NULL)) -#' poc$predict(list(pred, pred))[[1]] -#' -#' # Option 2: Use two learners, one for response and the other for se -#' learn_response = lrn("regr.rpart") -#' learn_se = lrn("regr.featureless", predict_type = "se") -#' pred_response = learn_response$train(task)$predict(task) -#' pred_se = learn_se$train(task)$predict(task) -#' poc = po("compose_probregr") -#' poc$train(list(NULL, NULL)) -#' poc$predict(list(pred_response, pred_se))[[1]] -#' } -PipeOpProbregr = R6Class("PipeOpProbregr", - inherit = mlr3pipelines::PipeOp, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id = "compose_probregr", param_vals = list()) { - param_set = ps( - dist = p_fct(default = "Uniform", - levels = c("Uniform", - distr6::listDistributions(filter = list(Tags = "locscale"), simplify = TRUE)), - tags = "predict") - ) - param_set$set_values(dist = "Uniform") - - super$initialize( - id = id, - param_set = param_set, - param_vals = param_vals, - input = data.table(name = c("input_response", "input_se"), train = "NULL", - predict = c("PredictionRegr", "PredictionRegr")), - output = data.table(name = "output", train = "NULL", predict = "PredictionRegr"), - packages = c("mlr3proba", "distr6") - ) - } - ), - - private = list( - .train = function(inputs) { - self$state = list() - list(NULL) - }, - - .predict = function(inputs) { - pred_response = inputs$input_response - pred_se = inputs$input_se - - if ("se" %nin% pred_se$predict_types) { - stopf("'se' is not a predict_type in %s.", pred_se$id) - } - - response = pred_response$response - se = pred_se$se - - assert(all(pred_response$truth == pred_se$truth)) - assert(all(pred_response$row_ids == pred_se$row_ids)) - - pv = self$param_set$values - dist = pv$dist - - if (is.null(dist) || dist %in% c("Uniform")) { - params = data.table( - lower = response - se * sqrt(3), - upper = response + se * sqrt(3) - ) - } else if (dist == "Normal") { - params = data.table(mean = response, sd = se) - } else if (dist %in% c("Cauchy", "Gumbel")) { - params = data.table(location = response, scale = se) - } else if (dist %in% c("Laplace", "Logistic")) { - params = data.table(mean = response, scale = se) - } - - list( - PredictionRegr$new( - row_ids = pred_response$row_ids, - truth = pred_response$truth, - response = response, - se = se, - distr = distr6::VectorDistribution$new(distribution = dist, params = params) - ) - ) - } - ) -) - -register_pipeop("compose_probregr", PipeOpProbregr) diff --git a/R/PipeOpResponseCompositor.R b/R/PipeOpResponseCompositor.R deleted file mode 100644 index c25445bcd..000000000 --- a/R/PipeOpResponseCompositor.R +++ /dev/null @@ -1,189 +0,0 @@ -#' @title PipeOpResponseCompositor -#' @name mlr_pipeops_responsecompose -#' @template param_pipelines -#' -#' @description -#' Uses a predicted survival distribution (`distr`) in a [PredictionSurv] to estimate (or 'compose') an expected survival time (`response`) prediction. -#' Practically, this `PipeOp` summarizes an observation's survival curve/distribution to a single number which can be either the restricted mean survival time or the median survival time. -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] or with the associated sugar -#' function [mlr3pipelines::po()]: -#' ``` -#' PipeOpResponseCompositor$new() -#' mlr_pipeops$get("responsecompose") -#' po("responsecompose") -#' ``` -#' -#' @section Input and Output Channels: -#' [PipeOpResponseCompositor] has one input channel named `"input"`, which takes -#' `NULL` during training and [PredictionSurv] during prediction. -#' -#' [PipeOpResponseCompositor] has one output channel named `"output"`, producing `NULL` during training -#' and a [PredictionSurv] during prediction. -#' -#' The output during prediction is the [PredictionSurv] from the input but with the `response` -#' predict type overwritten by the given method. -#' -#' @section State: -#' The `$state` is left empty (`list()`). -#' -#' @section Parameters: -#' - `method` :: `character(1)` \cr -#' Determines what method should be used to produce a survival time (response) from the survival distribution. -#' Available methods are `"rmst"` and `"median"`, corresponding to the *restricted mean survival time* and the *median survival time* respectively. -#' - `tau` :: `numeric(1)` \cr -#' Determines the time point up to which we calculate the restricted mean survival time (works only for the `"rmst"` method). -#' If `NULL` (default), all the available time points in the predicted survival distribution will be used. -#' * `add_crank` :: `logical(1)` \cr -#' If `TRUE` then `crank` predict type will be set as `-response` (as higher survival times correspond to lower risk). -#' Works only if `overwrite` is `TRUE`. -#' * `overwrite` :: `logical(1)` \cr -#' If `FALSE` (default) and the prediction already has a `response` prediction, then the compositor returns the input prediction unchanged. -#' If `TRUE`, then the `response` (and the `crank`, if `add_crank` is `TRUE`) will be overwritten. -#' -#' @section Internals: -#' The restricted mean survival time is the default/preferred method and is calculated as follows: -#' \deqn{T_{i,rmst} \approx \sum_{t_j \in [0,\tau]} (t_j - t_{j-1}) S_i(t_j)} -#' -#' where \eqn{T} is the expected survival time, \eqn{\tau} is the time cutoff/horizon and \eqn{S_i(t_j)} are the predicted survival probabilities of observation \eqn{i} for all the \eqn{t_j} time points. -#' -#' The \eqn{T_{i,median}} survival time is just the first time point for which the survival probability is less than \eqn{0.5}. -#' If no such time point exists (e.g. when the survival distribution is not proper due to high censoring) we return the last time point. -#' This is **not a good estimate to use in general**, only a reasonable substitute in such cases. -#' -#' @references -#' `r format_bib("zhao_2016")` -#' -#' @seealso [pipeline_responsecompositor] -#' @family survival compositors -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3pipelines) -#' task = tsk("rats") -#' -#' # add survival time prediction type to the predictions of a Cox model -#' # Median survival time as response -#' pred = lrn("surv.coxph")$train(task)$predict(task) -#' por = po("responsecompose", param_vals = list(method = "median", overwrite = TRUE)) -#' por$train(list(NULL)) # need to train first, even if nothing happens -#' por$predict(list(pred))[[1L]] -#' # mostly improper survival distributions, "median" sets the survival time -#' # to the last time point -#' -#' # RMST (default) as response, while also changing the `crank` to `-response` -#' por = po("responsecompose", param_vals = list(overwrite = TRUE, add_crank = TRUE)) -#' por$train(list(NULL)) -#' por$predict(list(pred))[[1L]] -#' } -#' @export -PipeOpResponseCompositor = R6Class("PipeOpResponseCompositor", - inherit = mlr3pipelines::PipeOp, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id = "responsecompose", param_vals = list()) { - param_set = ps( - method = p_fct(default = "rmst", levels = c("rmst", "median"), tags = "predict"), - tau = p_dbl(0, default = NULL, special_vals = list(NULL), tags = "predict"), - add_crank = p_lgl(default = FALSE, tags = "predict"), - overwrite = p_lgl(default = FALSE, tags = "predict") - ) - - param_set$set_values(method = "rmst", add_crank = FALSE, overwrite = FALSE) - - super$initialize( - id = id, - param_set = param_set, - param_vals = param_vals, - input = data.table(name = "input", train = "NULL", predict = "PredictionSurv"), - output = data.table(name = "output", train = "NULL", predict = "PredictionSurv"), - packages = c("mlr3proba") - ) - } - ), - - private = list( - .train = function(inputs) { - self$state = list() - list(NULL) - }, - - .predict = function(inputs) { - pred = inputs[[1L]] - overwrite = self$param_set$values$overwrite - has_response = !is.null(pred$response) - - if (!overwrite & has_response) { - # return prediction as is - return(list(pred)) - } else { - # compose response (survival time) from distr prediction - assert("distr" %in% pred$predict_types) - - # get survival matrix - if (inherits(pred$data$distr, "array")) { - surv = pred$data$distr - if (length(dim(surv)) == 3L) { - # survival 3d array, extract median - surv = .ext_surv_mat(arr = surv, which.curve = 0.5) - } - } else { - stop("Distribution prediction does not have a survival matrix or array - in the $data$distr slot") - } - - # time points - times = as.numeric(colnames(surv)) - - method = self$param_set$values$method - if (method == "rmst") { - tau = self$param_set$values$tau - within_range = !is.null(tau) && tau <= max(times) && tau >= min(times) - if (within_range) { - # subset survival matrix and times - surv = surv[, times <= tau, drop = FALSE] - times = times[times <= tau] - } - - # calculate the restricted mean survival time - weights = c(times[1], diff(times)) # time intervals as weights - response = apply(surv, 1, function(surv_probs) { - sum(weights * surv_probs) - }) - } else { # median - t_max = tail(times, 1) # last time point - response = apply(surv, 1, function(surv_probs) { - # first survival probability that is < 0.5 - median_time_index = match(TRUE, surv_probs < 0.5) - if (!is.na(median_time_index)) times[median_time_index] else t_max - }) - } - - add_crank = self$param_set$values$add_crank - if (add_crank) { - # higher risk, lower survival time - crank = -response - } else { - # otherwise, leave crank unchanged - crank = pred$crank - } - - # update only `response` (and maybe `crank`) - p = PredictionSurv$new( - row_ids = pred$row_ids, - truth = pred$truth, - crank = crank, - distr = pred$distr, - lp = pred$lp, - response = response - ) - - return(list(p)) - } - } - ) -) - -register_pipeop("responsecompose", PipeOpResponseCompositor) diff --git a/R/PipeOpSurvAvg.R b/R/PipeOpSurvAvg.R deleted file mode 100644 index a745c9e36..000000000 --- a/R/PipeOpSurvAvg.R +++ /dev/null @@ -1,126 +0,0 @@ -#' @title PipeOpSurvAvg -#' @template param_pipelines -#' @name mlr_pipeops_survavg -#' -#' @description -#' Perform (weighted) prediction averaging from survival [PredictionSurv]s by connecting -#' `PipeOpSurvAvg` to multiple [PipeOpLearner][mlr3pipelines::PipeOpLearner] outputs. -#' -#' The resulting prediction will aggregate any predict types that are contained within all inputs. -#' Any predict types missing from at least one input will be set to `NULL`. These are aggregated -#' as follows: -#' * `"response"`, `"crank"`, and `"lp"` are all a weighted average from the incoming predictions. -#' * `"distr"` is a [distr6::VectorDistribution] containing [distr6::MixtureDistribution]s. -#' -#' Weights can be set as a parameter; if none are provided, defaults to -#' equal weights for each prediction. -#' -#' @section Input and Output Channels: -#' Input and output channels are inherited from [PipeOpEnsemble][mlr3pipelines::PipeOpEnsemble] -#' with a [PredictionSurv] for inputs and outputs. -#' -#' @section State: -#' The `$state` is left empty (`list()`). -#' -#' @section Parameters: -#' The parameters are the parameters inherited from the -#' [PipeOpEnsemble][mlr3pipelines::PipeOpEnsemble]. -#' -#' @section Internals: -#' Inherits from [PipeOpEnsemble][mlr3pipelines::PipeOpEnsemble] by implementing the -#' `private$weighted_avg_predictions()` method. -#' -#' @seealso [pipeline_survaverager] -#' @family PipeOps -#' @family Ensembles -#' @export -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' -#' task = tsk("rats") -#' p1 = lrn("surv.coxph")$train(task)$predict(task) -#' p2 = lrn("surv.kaplan")$train(task)$predict(task) -#' poc = po("survavg", param_vals = list(weights = c(0.2, 0.8))) -#' poc$train(list(NULL)) # need to train first, even if nothing happens -#' poc$predict(list(p1, p2)) -#' } -PipeOpSurvAvg = R6Class("PipeOpSurvAvg", - inherit = mlr3pipelines::PipeOpEnsemble, - - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' - #' @param innum (`numeric(1)`)\cr - #' Determines the number of input channels. - #' If `innum` is 0 (default), a vararg input channel is created that can take an arbitrary - #' number of inputs. - #' @param ... (`ANY`)\cr - #' Additional arguments passed to [mlr3pipelines::PipeOpEnsemble]. - initialize = function(innum = 0, id = "survavg", - param_vals = list(), ...) { - super$initialize(innum = innum, - id = id, - param_vals = param_vals, - prediction_type = "PredictionSurv", - packages = "mlr3proba", - ...) - } - ), - private = list( - weighted_avg_predictions = function(inputs, weights, row_ids, truth) { - response_matrix = map(inputs, "response") - - if (some(response_matrix, is.null)) { - response = NULL - } else { - response = c(simplify2array(response_matrix) %*% weights) - } - - crank_matrix = map(inputs, "crank") - if (some(crank_matrix, is.null)) { - crank = NULL - } else { - crank = c(simplify2array(crank_matrix) %*% weights) - } - - lp_matrix = map(inputs, "lp") - if (some(lp_matrix, is.null)) { - lp = NULL - } else { - lp = c(simplify2array(lp_matrix) %*% weights) - } - - if (length(unique(weights)) == 1L) { - weights = "uniform" - } - - distr = map(inputs, "distr") - - ok = map_lgl(distr, function(.x) { - test_class(.x, "Matdist") || test_class(.x, "Arrdist") - }) - - if (all(ok)) { - distr = distr6::mixMatrix(distr, weights) - } else { - ok = map_lgl(distr, function(.x) { - test_class(.x, "VectorDistribution") - }) - if (all(ok)) { - distr = distr6::mixturiseVector(distr, weights) - } else { - distr = NULL - } - } - - PredictionSurv$new(row_ids = row_ids, truth = truth, - response = response, crank = crank, - lp = lp, distr = distr) - } - ) -) - -register_pipeop("survavg", PipeOpSurvAvg) diff --git a/R/PipeOpTaskSurvClassifDiscTime.R b/R/PipeOpTaskSurvClassifDiscTime.R deleted file mode 100644 index 0a3f992bb..000000000 --- a/R/PipeOpTaskSurvClassifDiscTime.R +++ /dev/null @@ -1,202 +0,0 @@ -#' @title PipeOpTaskSurvClassifDiscTime -#' @name mlr_pipeops_trafotask_survclassif_disctime -#' @template param_pipelines -#' -#' @description -#' Transform [TaskSurv] to [TaskClassif][mlr3::TaskClassif] by dividing continuous -#' time into multiple time intervals for each observation. -#' This transformation creates a new target variable `disc_status` that indicates -#' whether an event occurred within each time interval. -#' This approach facilitates survival analysis within a classification framework -#' using discrete time intervals (Tutz et al. 2016). -#' -#' Note that this data transformation is compatible with learners that support -#' the `"validation"` property and can track performance on holdout data during -#' training, enabling early stopping and logging. -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] -#' or with the associated sugar function [mlr3pipelines::po()]: -#' ``` -#' PipeOpTaskSurvClassifDiscTime$new() -#' mlr_pipeops$get("trafotask_survclassif_disctime") -#' po("trafotask_survclassif_disctime") -#' ``` -#' -#' @section Input and Output Channels: -#' [PipeOpTaskSurvClassifDiscTime] has one input channel named "input", and two -#' output channels, one named "output" and the other "transformed_data". -#' -#' During training, the "output" is the "input" [TaskSurv] transformed to a -#' [TaskClassif][mlr3::TaskClassif]. -#' The target column is named `"disc_status"` and indicates whether an event occurred -#' in each time interval. -#' An additional numeric feature named `"tend"` contains the end time point of each interval. -#' Lastly, the "output" task has a column with the original observation ids, -#' under the role `"original_ids"`. -#' The "transformed_data" is an empty [data.table][data.table::data.table]. -#' -#' During prediction, the "input" [TaskSurv] is transformed to the "output" -#' [TaskClassif][mlr3::TaskClassif] with `"disc_status"` as target and the `"tend"` -#' feature included. -#' The "transformed_data" is a [data.table][data.table::data.table] with columns -#' the `"disc_status"` target of the "output" task, the `"id"` (original observation ids), -#' `"obs_times"` (observed times per `"id"`) and `"tend"` (end time of each interval). -#' This "transformed_data" is only meant to be used with the [PipeOpPredClassifSurvDiscTime]. -#' -#' @section State: -#' The `$state` contains information about the `cut` parameter used. -#' -#' @section Parameters: -#' The parameters are -#' -#' * `cut :: numeric()`\cr -#' Split points, used to partition the data into intervals based on the `time` column. -#' If unspecified, all unique event times will be used. -#' If `cut` is a single integer, it will be interpreted as the number of equidistant -#' intervals from 0 until the maximum event time. -#' * `max_time :: numeric(1)`\cr -#' If `cut` is unspecified, this will be the last possible event time. -#' All event times after `max_time` will be administratively censored at `max_time.` -#' Needs to be greater than the minimum event time in the given task. -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3learners) -#' library(mlr3pipelines) -#' -#' task = tsk("lung") -#' -#' # transform the survival task to a classification task -#' # all unique event times are used as cutpoints -#' po_disc = po("trafotask_survclassif_disctime") -#' task_classif = po_disc$train(list(task))[[1L]] -#' -#' # the end time points of the discrete time intervals -#' unique(task_classif$data(cols = "tend"))[[1L]] -#' -#' # train a classification learner -#' learner = lrn("classif.log_reg", predict_type = "prob") -#' learner$train(task_classif) -#' } -#' -#' @references -#' `r format_bib("tutz_2016")` -#' -#' @seealso [pipeline_survtoclassif_disctime] -#' @family Transformation PipeOps -#' @export -PipeOpTaskSurvClassifDiscTime = R6Class("PipeOpTaskSurvClassifDiscTime", - inherit = mlr3pipelines::PipeOp, - - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id = "trafotask_survclassif_disctime") { - param_set = ps( - cut = p_uty(default = NULL), - max_time = p_dbl(0, default = NULL, special_vals = list(NULL)) - ) - super$initialize( - id = id, - packages = c("pammtools"), - param_set = param_set, - input = data.table( - name = "input", - train = "TaskSurv", - predict = "TaskSurv" - ), - output = data.table( - name = c("output", "transformed_data"), - train = c("TaskClassif", "data.table"), - predict = c("TaskClassif", "data.table") - ) - ) - } - ), - - private = list( - .train = function(input) { - task = input[[1L]] - pv = self$param_set$values - cut = assert_numeric(pv$cut, null.ok = TRUE, lower = 0) - max_time = pv$max_time - - res = .discretize_surv_task(task, cut = cut, max_time = max_time, reduction_id = "disc") - task_disc = res$task - self$state$cut = res$cut - - # If internal validation task exists, transform it as well - if (!is.null(task$internal_valid_task)) { - res_val = .discretize_surv_task( - task$internal_valid_task, - cut = self$state$cut, - max_time = max_time, - reduction_id = "disc" - ) - task_disc$internal_valid_task = res_val$task - } - - list(task_disc, data.table()) - }, - - .predict = function(input) { - task = input[[1]] - data = task$data() - - # extract `cut` from `state` - cut = self$state$cut - - time_var = task$target_names[1] - event_var = task$target_names[2] - - max_time = max(cut) - time = data[[time_var]] - # setting time variable to max_time ensures that the ped data spans - # over all intervals for every subject irrespective of event time - data[[time_var]] = max_time - - status = data[[event_var]] - data[[event_var]] = 1 - - # update form - form = formulate(sprintf("Surv(%s, %s)", time_var, event_var), ".") - - long_data = as.data.table(pammtools::as_ped(data, formula = form, cut = cut)) - setnames(long_data, old = "ped_status", new = "disc_status") - - disc_status = id = tend = obs_times = NULL # fixing global binding notes of data.table - long_data[, disc_status := 0] - # set correct id - rows_per_id = nrow(long_data) / length(unique(long_data$id)) - long_data$obs_times = rep(time, each = rows_per_id) - ids = rep(task$row_ids, each = rows_per_id) - long_data[, id := ids] - - # set correct disc_status - reps = long_data[, data.table(count = sum(tend >= obs_times)), by = id]$count - status = rep(status, times = reps) - long_data[long_data[, .I[tend >= obs_times], by = id]$V1, disc_status := status] - long_data$disc_status = factor(long_data$disc_status, levels = c("0", "1")) - - # remove some columns from `long_data` - long_data[, c("offset", "tstart", "interval", "obs_times") := NULL] - task_disc = TaskClassif$new(paste0(task$id, "_disc"), long_data, - target = "disc_status", positive = "1") - task_disc$set_col_roles("id", roles = "original_ids") - - # map observed times back - reps = table(long_data$id) - long_data$obs_times = rep(time, each = rows_per_id) - # subset transformed data - columns_to_keep = c("id", "obs_times", "tend", "disc_status") - long_data = long_data[, columns_to_keep, with = FALSE] - - list(task_disc, long_data) - } - ) -) - -register_pipeop("trafotask_survclassif_disctime", PipeOpTaskSurvClassifDiscTime) diff --git a/R/PipeOpTaskSurvClassifIPCW.R b/R/PipeOpTaskSurvClassifIPCW.R deleted file mode 100644 index 6bd76a09c..000000000 --- a/R/PipeOpTaskSurvClassifIPCW.R +++ /dev/null @@ -1,221 +0,0 @@ -#' @title PipeOpTaskSurvClassifIPCW -#' @name mlr_pipeops_trafotask_survclassif_IPCW -#' @template param_pipelines -#' -#' @description -#' Transform [TaskSurv] to [TaskClassif][mlr3::TaskClassif] using the **I**nverse -#' **P**robability of **C**ensoring **W**eights (IPCW) method by Vock et al. (2016). -#' -#' Let \eqn{T_i} be the observed times (event or censoring) and \eqn{\delta_i} -#' the censoring indicators for each observation \eqn{i} in the training set. -#' The IPCW technique consists of two steps: first we estimate the censoring -#' distribution \eqn{\hat{G}(t)} using the Kaplan-Meier estimator from the -#' training data. Then we calculate the observation weights given a cutoff time -#' \eqn{\tau} as: -#' -#' \deqn{\omega_i = 1/\hat{G}{(min(T_i,\tau))}} -#' -#' Observations that are censored prior to \eqn{\tau} are assigned zero weights, i.e. -#' \eqn{\omega_i = 0}. -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] -#' or with the associated sugar function [mlr3pipelines::po()]: -#' ``` -#' PipeOpTaskSurvClassifIPCW$new() -#' mlr_pipeops$get("trafotask_survclassif_IPCW") -#' po("trafotask_survclassif_IPCW") -#' ``` -#' -#' @section Input and Output Channels: -#' [PipeOpTaskSurvClassifIPCW] has one input channel named "input", and two -#' output channels, one named "output" and the other "data". -#' -#' Training transforms the "input" [TaskSurv] to a [TaskClassif][mlr3::TaskClassif], -#' which is the "output". -#' The target column is named `"status"` and indicates whether **an event occurred** -#' **before the cutoff time** \eqn{\tau} (`1` = yes, `0` = no). -#' The observed times column is removed from the "output" task. -#' The transformed task has the property `"weights_learner"` (the \eqn{\omega_i}). -#' The "data" is `NULL`. -#' -#' During prediction, the "input" [TaskSurv] is transformed to the "output" -#' [TaskClassif][mlr3::TaskClassif] with `"status"` as target (again indicating -#' if the event occurred before the cutoff time). -#' The "data" is a [data.table][data.table::data.table] containing the observed `times` \eqn{T_i} and -#' censoring indicators/`status` \eqn{\delta_i} of each subject as well as the corresponding -#' `row_ids`. -#' This "data" is only meant to be used with the [PipeOpPredClassifSurvIPCW]. -#' -#' @section Parameters: -#' The parameters are -#' -#' * `tau` :: `numeric()`\cr -#' Predefined time point for IPCW. Observations with time larger than \eqn{\tau} are censored. -#' Must be less or equal to the maximum event time. -#' * `eps` :: `numeric()`\cr -#' Small value to replace \eqn{G(t) = 0} censoring probabilities to prevent -#' infinite weights (a warning is triggered if this happens). -#' -#' @references -#' `r format_bib("vock_2016")` -#' -#' @seealso [pipeline_survtoclassif_IPCW] -#' @family Transformation PipeOps -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3learners) -#' library(mlr3pipelines) -#' -#' task = tsk("lung") -#' -#' # split task to train and test subtasks -#' part = partition(task) -#' task_train = task$clone()$filter(part$train) -#' task_test = task$clone()$filter(part$test) -#' -#' # define IPCW pipeop -#' po_ipcw = po("trafotask_survclassif_IPCW", tau = 365) -#' -#' # during training, output is a classification task with weights -#' task_classif_train = po_ipcw$train(list(task_train))[[1]] -#' task_classif_train -#' -#' # during prediction, output is a classification task (no weights) -#' task_classif_test = po_ipcw$predict(list(task_test))[[1]] -#' task_classif_test -#' -#' # train classif learner on the train task with weights -#' learner = lrn("classif.rpart", predict_type = "prob") -#' learner$train(task_classif_train) -#' -#' # predict using the test output task -#' p = learner$predict(task_classif_test) -#' -#' # use classif measures for evaluation -#' p$confusion -#' p$score() -#' p$score(msr("classif.auc")) -#' } -#' @export -PipeOpTaskSurvClassifIPCW = R6Class("PipeOpTaskSurvClassifIPCW", - inherit = mlr3pipelines::PipeOp, - - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id = "trafotask_survclassif_IPCW") { - param_set = ps( - tau = p_dbl(0), - eps = p_dbl(0, init = 1e-3) - ) - - super$initialize( - id = id, - param_set = param_set, - input = data.table( - name = "input", - train = "TaskSurv", - predict = "TaskSurv" - ), - output = data.table( - name = c("output", "data"), - train = c("TaskClassif", "NULL"), - predict = c("TaskClassif", "list") - ) - ) - } - ), - - private = list( - .train = function(input) { - task = input[[1]] - - # checks - assert_true(task$cens_type == "right") - tau = assert_number(self$param_set$values$tau, null.ok = FALSE) - max_event_time = max(task$unique_event_times()) - stopifnot(tau <= max_event_time) - - # G(t): KM estimate of the censoring distribution - times = task$times() - status = task$status() - cens_fit = survival::survfit(Surv(times, 1 - status) ~ 1) - # make a G(t) one-column matrix => to use in `distr6` function later - cens_surv = matrix(cens_fit$surv, ncol = 1) # rows => times - - # apply the cutoff to `times` - cut_times = times - cut_times[cut_times > tau] = tau - # get G(t) at the observed cutoff'ed times efficiently - extend_times = getFromNamespace("C_Vec_WeightedDiscreteCdf", ns = "distr6") - cens_probs = extend_times(cut_times, cens_fit$time, cdf = 1 - cens_surv, FALSE, FALSE)[,1] - - # substitute `eps` for observations: G(t) = 0 (this should never happen though!) - if (any(cens_probs == 0)) { - warning("At least one t: G(t) = 0, will substitute with eps to avoid very large weights") - cens_probs[cens_probs == 0] = self$param_set$values$eps - } - - # calculate the IPC weights - ipc_weights = 1 / cens_probs - - data = task$data() - time_var = task$target_names[1] - status_var = task$target_names[2] - - # add weights to original data - data[["ipc_weights"]] = ipc_weights - # zero weights for censored observations before the cutoff time - ids = status == 0 & times <= tau - data[ids, "ipc_weights" := 0] - # update target: status = 0 after cutoff (remains the same before cutoff) - status[times > tau] = 0 - data[[status_var]] = factor(status, levels = c("0", "1")) - # remove target time variable - data[[time_var]] = NULL - - # create classification task - task_ipcw = TaskClassif$new(id = paste0(task$id, "_IPCW"), backend = data, - target = status_var, positive = "1") - task_ipcw$set_col_roles("ipc_weights", roles = "weights_learner") - - # keep this in the state to show that pipeop was trained - self$state = list() - # pass on classif task - list(task_ipcw, NULL) - }, - - .predict = function(input) { - task = input[[1]] - times = task$times() - status = task$status() - data = task$data() - time_var = task$target_names[1] - status_var = task$target_names[2] - tau = assert_numeric(self$param_set$values$tau, null.ok = FALSE) - - # update target: status = 0 after cutoff (remains the same before cutoff) - status[times > tau] = 0 - data[[status_var]] = factor(status, levels = c("0", "1")) - # remove target time variable - data[[time_var]] = NULL - # create classification task - task_classif = TaskClassif$new(id = paste0(task$id, "_IPCW"), backend = data, - target = "status", positive = "1") - - # keep original row_ids, times and status as well the tau time point - data = list( - row_ids = task$row_ids, - times = task$times(), - status = task$status(), - tau = tau - ) - list(task_classif, data) - } - ) -) - -register_pipeop("trafotask_survclassif_IPCW", PipeOpTaskSurvClassifIPCW) diff --git a/R/PipeOpTaskSurvRegrPEM.R b/R/PipeOpTaskSurvRegrPEM.R deleted file mode 100644 index 6f86e5d8d..000000000 --- a/R/PipeOpTaskSurvRegrPEM.R +++ /dev/null @@ -1,215 +0,0 @@ -#' @title PipeOpTaskSurvRegrPEM -#' @name mlr_pipeops_trafotask_survregr_pem -#' @template param_pipelines -#' -#' @description -#' Transform [TaskSurv] to [TaskRegr][mlr3::TaskRegr] by dividing continuous -#' time into multiple time intervals for each observation. -#' This transformation creates a new target variable `pem_status` that indicates -#' whether an event occurred within each time interval. -#' The piece-wise exponential modeling approach (PEM) facilitates survival analysis -#' within a regression framework using discrete time intervals (Bender et al. 2018). -#' -#' Note that this data transformation is compatible with learners that support -#' the `"validation"` property and can track performance on holdout data during -#' training, enabling early stopping and logging. -#' -#' @section Dictionary: -#' This [PipeOp][mlr3pipelines::PipeOp] can be instantiated via the -#' [dictionary][mlr3misc::Dictionary] [mlr3pipelines::mlr_pipeops] -#' or with the associated sugar function [mlr3pipelines::po()]: -#' ``` -#' PipeOpTaskSurvRegrPEM$new() -#' mlr_pipeops$get("trafotask_survregr_pem") -#' po("trafotask_survregr_pem") -#' ``` -#' -#' @section Input and Output Channels: -#' [PipeOpTaskSurvRegrPEM] has one input channel named "input", and two -#' output channels, one named "output" and the other "transformed_data". -#' -#' During training, the "output" is the "input" [TaskSurv] transformed to a -#' [TaskRegr][mlr3::TaskRegr]. -#' The target column is named `"pem_status"` and indicates whether an event occurred -#' in each time interval. -#' An additional numeric feature named `"tend"` contains the end time point of each interval. -#' Lastly, the "output" task has an offset column `"offset"`. -#' The offset, also referred to as *exposure*, is the **logarithm of time spent in interval** \eqn{j}, i.e. \eqn{log(t_j)}. -#' The "transformed_data" is an empty [data.table][data.table::data.table]. -#' -#' During prediction, the "input" [TaskSurv] is transformed to the "output" -#' [TaskRegr][mlr3::TaskRegr] with `"pem_status"` as target, `"tend"` included as feature and -#' and the `"offset"` column which is assigned the offset `"col_role"`. -#' The "transformed_data" is a [data.table][data.table::data.table] with columns the `"pem_status"` -#' target of the "output" task, the `"id"` (original observation ids), -#' `"obs_times"` (observed times per `"id"`) and `"tend"` (end time of each interval). -#' This "transformed_data" is only meant to be used with the [PipeOpPredRegrSurvPEM]. -#' -#' @section State: -#' The `$state` contains information about the `cut` parameter used. -#' -#' @section Parameters: -#' The parameters are -#' -#' * `cut :: numeric()`\cr -#' Split points, used to partition the data into intervals based on the `time` column. -#' If unspecified, all unique event times will be used. -#' If `cut` is a single integer, it will be interpreted as the number of equidistant -#' intervals from 0 until the maximum event time. -#' * `max_time :: numeric(1)`\cr -#' If `cut` is unspecified, this will be the last possible event time. -#' All event times after `max_time` will be administratively censored at `max_time.` -#' Needs to be greater than the minimum event time in the given task. -#' -#' @examplesIf (mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3extralearners"), quietly = TRUE)) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3learners) -#' library(mlr3pipelines) -#' -#' task = tsk("lung") -#' -#' # transform the survival task to a regression task -#' # all unique event times are used as cutpoints -#' po_pem = po("trafotask_survregr_pem") -#' task_regr = po_pem$train(list(task))[[1L]] -#' -#' # the end time points of the discrete time intervals -#' unique(task_regr$data(cols = "tend")[[1L]]) -#' -#' # train a regression learner that supports poisson regression -#' # e.g. regr.gam -#' # won't run unless learner can accept offset column role -#' learner = lrn("regr.gam", formula = pem_status ~ s(age) + s(tend), family = "poisson") -#' learner$train(task_regr) -#' -#' # e.g. regr.xgboost, note prior data processing steps -#' learner = as_learner( -#' po("modelmatrix", formula = ~ as.factor(tend) + .) %>>% -#' lrn("regr.xgboost", objective = "count:poisson", nrounds = 100, eta = 0.1) -#' ) -#' learner$train(task_regr) -#' } -#' -#' @references -#' `r format_bib("bender_2018")` -#' -#' @seealso [pipeline_survtoregr_pem] -#' @family PipeOps -#' @family Transformation PipeOps -#' @export -PipeOpTaskSurvRegrPEM = R6Class("PipeOpTaskSurvRegrPEM", - inherit = mlr3pipelines::PipeOp, - - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - initialize = function(id = "trafotask_survregr_pem") { - param_set = ps( - cut = p_uty(default = NULL), - max_time = p_dbl(0, default = NULL, special_vals = list(NULL)) - ) - super$initialize( - id = id, - packages = c("pammtools"), - param_set = param_set, - input = data.table( - name = "input", - train = "TaskSurv", - predict = "TaskSurv" - ), - output = data.table( - name = c("output", "transformed_data"), - train = c("TaskRegr", "data.table"), - predict = c("TaskRegr", "data.table") - ) - ) - } - ), - - private = list( - .train = function(input) { - task = input[[1L]] - pv = self$param_set$values - cut = assert_numeric(pv$cut, null.ok = TRUE, lower = 0) - max_time = pv$max_time - - res = .discretize_surv_task(task, cut = cut, max_time = max_time, reduction_id = "pem") - task_pem = res$task - self$state$cut = res$cut - - # If internal validation task exists, transform it as well - if (!is.null(task$internal_valid_task)) { - res_val = .discretize_surv_task( - task$internal_valid_task, - cut = self$state$cut, - max_time = max_time, - reduction_id = "pem" - ) - task_pem$internal_valid_task = res_val$task - } - - list(task_pem, data.table()) - }, - - .predict = function(input) { - task = input[[1]] - data = task$data() - - # extract `cut` from `state` - cut = self$state$cut - - time_var = task$target_names[1] - event_var = task$target_names[2] - - max_time = max(cut) - - time = data[[time_var]] - # setting time variable to max_time ensures that the ped data spans - # over all intervals for every subject irrespective of event time - data[[time_var]] = max_time - - status = data[[event_var]] - data[[event_var]] = 1 - - ped_formula = formulate(sprintf("Surv(%s, %s)", time_var, event_var), ".") - long_data = pammtools::as_ped(data = data, formula = ped_formula, - cut = cut, max_time = max_time) - long_data = as.data.table(long_data) - setnames(long_data, old = "ped_status", new = "pem_status") - - pem_status = id = tend = obs_times = NULL # fixing global binding notes of data.table - long_data[, pem_status := 0] - - # set correct id - rows_per_id = nrow(long_data) / length(unique(long_data$id)) - long_data$obs_times = rep(time, each = rows_per_id) - ids = rep(task$row_ids, each = rows_per_id) - long_data[, id := ids] - - # set correct pem_status - reps = long_data[, data.table(count = sum(tend >= obs_times)), by = id]$count - status = rep(status, times = reps) - long_data[long_data[, .I[tend >= obs_times], by = id]$V1, pem_status := status] - - # remove some columns from `long_data` - long_data[, c("tstart", "interval", "obs_times") := NULL] - task_pem = TaskRegr$new(paste0(task$id, "_pem"), long_data, - target = "pem_status") - task_pem$set_col_roles("id", roles = "original_ids") - task_pem$set_col_roles("offset", roles = "offset") - - # map observed times back - reps = table(long_data$id) - long_data$obs_times = rep(time, each = rows_per_id) - - # subset transformed data - columns_to_keep = c("id", "obs_times", "tend", "pem_status", "offset") - long_data = long_data[, columns_to_keep, with = FALSE] - - list(task_pem, long_data) - } - ) -) - -register_pipeop("trafotask_survregr_pem", PipeOpTaskSurvRegrPEM) diff --git a/R/PredictionCompRisks.R b/R/PredictionCompRisks.R deleted file mode 100644 index 8f1868a7a..000000000 --- a/R/PredictionCompRisks.R +++ /dev/null @@ -1,113 +0,0 @@ -#' @title Prediction Object for Competing Risks -#' -#' @description -#' This object stores the predictions returned by a learner of class [LearnerCompRisks]. -#' -#' The `task_type` is set to `"cmprsk"`. -#' -#' For accessing survival and hazard functions, as well as other complex methods -#' from a [LearnerCompRisks] object is not possible atm. -#' -#' @family Prediction -#' @examples -#' library(mlr3) -#' task = tsk("pbc") -#' learner = lrn("cmprsk.aalen") -#' part = partition(task) -#' p = learner$train(task, part$train)$predict(task, part$test) -#' p -#' -#' # CIF list: 1 matrix (obs x times) per competing event -#' names(p$cif) # competing events -#' # CIF matrix for competing event 1 (first 5 test observations and 20 time points) -#' p$cif[["1"]][1:5, 1:20] -#' # CIF matrix for competing event 2 (first 5 test observations and 20 time points) -#' p$cif[["2"]][1:5, 1:20] -#' -#' # data.table conversion -#' tab = as.data.table(p) -#' tab$CIF[[1]] # for first test observation, list of CIF vectors -#' -#' @export -PredictionCompRisks = R6Class("PredictionCompRisks", - inherit = Prediction, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' - #' @details - #' The `cif` input currently is a list of CIF matrices. - #' In the future the `cif` field should coerce this to a (TODO) CIF container - #' to get all survival and hazard functions using interpolation. - #' - #' @param task ([TaskSurv])\cr - #' Task, used to extract defaults for `row_ids` and `truth`. - #' - #' @param row_ids (`integer()`)\cr - #' Row ids of the predicted observations, i.e. the row ids of the test set. - #' - #' @param truth (`survival::Surv()`)\cr - #' True (observed) response. - #' - #' @param cif (`list()`)\cr - #' A `list` of two or more `matrix` objects. - #' Each matrix represents a different competing event and it stores the - #' **Cumulative Incidence function** for each test observation. - #' In each matrix, rows represent observations and columns time points. - #' The names of the `list` must correspond to the competing event names - #' (`task$cmp_events`). - #' - #' @param check (`logical(1)`)\cr - #' If `TRUE`, performs argument checks and predict type conversions. - initialize = function(task = NULL, row_ids = task$row_ids, truth = task$truth(), - cif = NULL, check = TRUE) { - pdata = list(row_ids = row_ids, truth = truth, cif = cif) - pdata = discard(pdata, is.null) - class(pdata) = c("PredictionDataCompRisks", "PredictionData") - - if (check) { - pdata = check_prediction_data(pdata) - } - - self$task_type = "cmprsk" - self$man = "mlr3proba::PredictionCompRisks" - self$data = pdata - self$predict_types = intersect("cif", names(pdata)) - } - ), - - active = list( - #' @field truth (`Surv`)\cr - #' True (observed) outcome. - truth = function() { - self$data$truth - }, - - #' @field cif (`list()`)\cr - #' Access the stored CIFs. - cif = function() { - # TODO: convert to `survdistr` object with methods for easier conversion and interpolation - self$data$cif - } - ) -) - -#' @export -as.data.table.PredictionCompRisks = function(x, ...) { - tab = as.data.table(x$data["row_ids"]) - tab$time = x$data$truth[, 1L] - tab$event = x$data$truth[, 2L] - n_obs = length(x$row_ids) - - if ("cif" %in% x$predict_types && n_obs > 0) { - tab$CIF = lapply(1:n_obs, function(i) { - # we use a list since there is a possibility that each CIF matrix has - # different number of time points (columns) per competing risk - cif_list = lapply(x$cif, function(mat) mat[i, , drop = TRUE]) - names(cif_list) = names(x$cif) # preserve the competing risk names/ids - cif_list - }) - } - - setcolorder(tab, c("row_ids", "time", "event"))[] -} diff --git a/R/PredictionDataCompRisks.R b/R/PredictionDataCompRisks.R deleted file mode 100644 index a013a94a6..000000000 --- a/R/PredictionDataCompRisks.R +++ /dev/null @@ -1,99 +0,0 @@ -# Here we define some mlr3-mandatory S3 methods of the `PredictionDataSurv` object - -#' @export -as_prediction.PredictionDataCompRisks = function(x, check = TRUE, ...) { - invoke(PredictionCompRisks$new, check = check, .args = x) -} - -#' @export -check_prediction_data.PredictionDataCompRisks = function(pdata, ...) { - n_obs = length(assert_row_ids(pdata$row_ids)) - assert_surv(pdata$truth, "Surv", len = n_obs, any.missing = TRUE, null.ok = TRUE) - n_cmp_events = length(attr(pdata$truth, "states")) - assert_cif_list(pdata$cif, n_obs, n_cmp_events) - - pdata -} - -#' @export -is_missing_prediction_data.PredictionDataCompRisks = function(pdata, ...) { - miss = logical(length(pdata$row_ids)) - - # no missing values allowed in CIF list of matrices, see `assert_cif_list()` - pdata$row_ids[miss] -} - -#' @export -c.PredictionDataCompRisks = function(..., keep_duplicates = TRUE) { - dots = list(...) - assert_list(dots, types = "PredictionDataCompRisks") - assert_flag(keep_duplicates) - if (length(dots) == 1L) { - return(dots[[1L]]) - } - - predict_types = names(mlr_reflections$learner_predict_types$cmprsk) - predict_types = map(dots, function(x) intersect(names(x), predict_types)) - if (!every(predict_types[-1L], setequal, y = predict_types[[1L]])) { - stopf("Cannot combine predictions: Different prediction types") - } - - predict_types = predict_types[[1L]] - row_ids = do.call(c, map(dots, "row_ids")) - # row ids to keep (default => all) - ii = if (keep_duplicates) seq_along(row_ids) else which(!duplicated(row_ids, fromLast = TRUE)) - - # combine `truth` and `row_ids` (easy to combine via `c`) - elems = c("row_ids", "truth") - result = named_list(elems) - result$row_ids = row_ids[ii] - for (elem in elems) { - result[[elem]] = do.call(c, map(dots, elem))[ii] - } - - if ("cif" %in% predict_types) { - # Extract CIF lists - cif_lists = map(dots, "cif") - - # Check that all CIF lists have the same number of competing risks - # Note: we assume that the causes are in the same order, eg "1", "2", etc. - # so just checking for their number is enough - n_cmp_events = unique(sapply(cif_lists, length)) - if (length(n_cmp_events) != 1) { - stop("Error: Can't combine CIFs with different numbers of competing events") - } - - # Merge a list of CIF matrices (function from `distr6`) - # We use this as the time points may be different between predicted CIFs - # for a particular competing event (cause) and this function uses - # constant interpolation to "fill in" the CIF values for the union of time points - merge_cols = getFromNamespace(".merge_cols", ns = "distr6") - - # Check time points for each cause and merge accordingly - merged_cifs = vector("list", n_cmp_events) - for (cause_idx in seq_len(n_cmp_events)) { - cause_cifs = lapply(cif_lists, function(cif) cif[[cause_idx]]) - # CIF is like a CDF, so this function works as it should (constant interpolation) - merged_cifs[[cause_idx]] = do.call(rbind, merge_cols(cause_cifs, "cdf"))[ii, ] - } - # add the causes names - names(merged_cifs) = names(cif_lists[[1]]) - result$cif = merged_cifs - } - - set_class(result, "PredictionDataCompRisks") -} - -#' @export -filter_prediction_data.PredictionDataCompRisks = function(pdata, row_ids, ...) { - keep = pdata$row_ids %in% row_ids - pdata$row_ids = pdata$row_ids[keep] - pdata$truth = pdata$truth[keep] - - if (!is.null(pdata$cif)) { - # simply keep the observations (rows) in each CIF matrix - pdata$cif = lapply(pdata$cif, function(mat) mat[keep, , drop = FALSE]) - } - - pdata -} diff --git a/R/PredictionDataDens.R b/R/PredictionDataDens.R deleted file mode 100644 index 88c2247a6..000000000 --- a/R/PredictionDataDens.R +++ /dev/null @@ -1,69 +0,0 @@ -#' @export -as_prediction.PredictionDataDens = function(x, check = TRUE, ...) { # nolint - invoke(PredictionDens$new, check = check, .args = x) -} - -#' @export -check_prediction_data.PredictionDataDens = function(pdata, ...) { # nolint - row_ids = assert_row_ids(pdata$row_ids) - n = length(row_ids) - - assert_numeric(pdata$pdf, len = n, any.missing = FALSE, null.ok = TRUE) - assert_numeric(pdata$cdf, len = n, any.missing = FALSE, null.ok = TRUE) - - if (!is.null(pdata$distr)) { - assert_class(pdata$distr, "Distribution") - } - - pdata -} - -#' @export -is_missing_prediction_data.PredictionDataDens = function(pdata, ...) { # nolint - miss = logical(length(pdata$row_ids)) - - if (!is.null(pdata$pdf)) { - miss = is.na(pdata$pdf) - } - - if (!is.null(pdata$cdf)) { - miss = miss | is.na(pdata$cdf) - } - - pdata$row_ids[miss] -} - - -#' @export -c.PredictionDataDens = function(..., keep_duplicates = TRUE) { # nolint - - dots = list(...) - assert_list(dots, "PredictionDataDens") - assert_flag(keep_duplicates) - if (length(dots) == 1L) { - return(dots[[1L]]) - } - - predict_types = names(mlr_reflections$learner_predict_types$dens) - predict_types = map(dots, function(x) intersect(names(x), predict_types)) - if (!every(predict_types[-1L], setequal, y = predict_types[[1L]])) { - stopf("Cannot combine predictions: Different prediction types") - } - - predict_types = predict_types[[1L]] - row_ids = do.call(c, map(dots, "row_ids")) - ii = if (keep_duplicates) seq_along(row_ids) else which(!duplicated(row_ids, fromLast = TRUE)) - - elems = c("truth", intersect(c("pdf", "cdf"), predict_types)) - result = named_list(elems) - result$row_ids = row_ids[ii] - for (elem in elems) { - result[[elem]] = do.call(c, map(dots, elem))[ii] - } - - if ("distr" %in% predict_types) { - result$distr = do.call(c, map(dots, function(.x) rep(.x$distr, length(.x$row_ids)))) - } - - set_class(result, "PredictionDataDens") -} diff --git a/R/PredictionDataSurv.R b/R/PredictionDataSurv.R deleted file mode 100644 index 1f9ea0ac6..000000000 --- a/R/PredictionDataSurv.R +++ /dev/null @@ -1,157 +0,0 @@ -# Here we define some mlr3-mandatory S3 methods of the `PredictionDataSurv` object - -#' @export -as_prediction.PredictionDataSurv = function(x, check = TRUE, ...) { - invoke(PredictionSurv$new, check = check, .args = x) -} - -#' @export -check_prediction_data.PredictionDataSurv = function(pdata, ...) { - n = length(assert_row_ids(pdata$row_ids)) - assert_surv(pdata$truth, "Surv", len = n, any.missing = TRUE, null.ok = TRUE) - assert_numeric(pdata$crank, len = n, any.missing = FALSE, null.ok = FALSE) - assert_numeric(pdata$response, len = n, any.missing = FALSE, null.ok = TRUE) - assert_numeric(pdata$lp, len = n, any.missing = FALSE, null.ok = TRUE) - if (inherits(pdata$distr, "VectorDistribution")) { - assert(nrow(pdata$distr$modelTable) == n) - } else if (inherits(pdata$distr, c("Matdist", "Arrdist"))) { - assert(nrow(gprm(pdata$distr, "pdf")) == n) - } else if (class(pdata$distr)[1L] == "array") { # from Arrdist - assert_array(pdata$distr, d = 3, any.missing = FALSE, null.ok = TRUE) - } else { - assert_matrix(pdata$distr, nrows = n, any.missing = FALSE, null.ok = TRUE) - } - pdata -} - -#' @export -is_missing_prediction_data.PredictionDataSurv = function(pdata, ...) { # nolint - miss = logical(length(pdata$row_ids)) - - if (!is.null(pdata$crank)) { - miss = is.na(pdata$crank) - } - - if (!is.null(pdata$lp)) { - miss = miss | is.na(pdata$lp) - } - - if (!is.null(pdata$response)) { - miss = miss | is.na(pdata$response) - } - - pdata$row_ids[miss] -} - -#' @export -c.PredictionDataSurv = function(..., keep_duplicates = TRUE) { - dots = list(...) - assert_list(dots, "PredictionDataSurv") - assert_flag(keep_duplicates) - if (length(dots) == 1L) { - return(dots[[1L]]) - } - - predict_types = names(mlr_reflections$learner_predict_types$surv) - predict_types = map(dots, function(x) intersect(names(x), predict_types)) - if (!every(predict_types[-1L], setequal, y = predict_types[[1L]])) { - stopf("Cannot combine predictions: Different prediction types") - } - - predict_types = predict_types[[1L]] - row_ids = do.call(c, map(dots, "row_ids")) - ii = if (keep_duplicates) seq_along(row_ids) else which(!duplicated(row_ids, fromLast = TRUE)) - - elems = c("truth", intersect(c("crank", "lp", "response"), predict_types)) - result = named_list(elems) - result$row_ids = row_ids[ii] - for (elem in elems) { - result[[elem]] = do.call(c, map(dots, elem))[ii] - } - - if ("distr" %in% predict_types) { - distr_list = map(dots, "distr") - test_dist = unique(map_lgl(distr_list, testDistribution)) - - # Mix of distributions and arrays? Convert arrays to distributions! - if (length(test_dist) == 2L) { - distr_list = map(distr_list, function(.x) { - if (testDistribution(.x)) { - .x - } else { - as.Distribution(1 - .x, fun = "cdf", - decorators = c("CoreStatistics", "ExoticStatistics")) - } - }) - test_dist = TRUE - } - - # All distributions? Concatenate! - if (test_dist) { - result$distr = do.call(c, c(distr_list, - list(decorators = c("CoreStatistics", "ExoticStatistics")))) - } else { - dims = map_int(distr_list, function(.x) length(dim(.x))) - # If mix of arrays and matrices, convert arrays to median survival matrices - if (length(unique(dims)) > 1L) { - distr_list = lapply(distr_list, function(.x) { - if (length(dim(.x)) == 3L) { - .ext_surv_mat(.x, which.curve = 0.5) - } else { - .x - } - }) - } - # All objects are now either 3d arrays or 2d matrices - # row-bind arrays and ensure all have same column names - # by automatically converting to pdf then back to surv - merge_cols = getFromNamespace(".merge_cols", ns = "distr6") - merged_array = merge_cols(distr_list, "surv") - # abind works with matrices as well - result$distr = abind::abind(merged_array, along = 1, force.array = FALSE) - } - } - - set_class(result, "PredictionDataSurv") -} - -#' @export -filter_prediction_data.PredictionDataSurv = function(pdata, row_ids, ...) { - keep = pdata$row_ids %in% row_ids - pdata$row_ids = pdata$row_ids[keep] - pdata$truth = pdata$truth[keep] - - if (!is.null(pdata$crank)) { - pdata$crank = pdata$crank[keep] - } - - if (!is.null(pdata$lp)) { - pdata$lp = pdata$lp[keep] - } - - if (!is.null(pdata$response)) { - pdata$response = pdata$response[keep] - } - - if (!is.null(pdata$distr)) { - distr = pdata$distr - - if (testDistribution(distr)) { # distribution - ok = inherits(distr, c("VectorDistribution", "Matdist", "Arrdist")) && - length(keep) > 1L # e.g.: Arrdist(1xYxZ) and keep = FALSE - if (ok) { - pdata$distr = distr[keep] # we can subset row/samples like this - } else { - pdata$distr = base::switch(keep, distr) # one distribution only - } - } else { - if (length(dim(distr)) == 2L) { # 2d matrix - pdata$distr = distr[keep, , drop = FALSE] - } else { # 3d array - pdata$distr = distr[keep, , , drop = FALSE] - } - } - } - - pdata -} diff --git a/R/PredictionDens.R b/R/PredictionDens.R deleted file mode 100644 index bbd58fbde..000000000 --- a/R/PredictionDens.R +++ /dev/null @@ -1,88 +0,0 @@ -#' @title Prediction Object for Density -#' -#' @description -#' This object stores the predictions returned by a learner of class [LearnerDens]. -#' -#' The `task_type` is set to `"dens"`. -#' -#' @family Prediction -#' @export -#' @examples -#' library(mlr3) -#' task = mlr_tasks$get("precip") -#' learner = mlr_learners$get("dens.hist") -#' p = learner$train(task)$predict(task) -#' head(as.data.table(p)) -PredictionDens = R6Class("PredictionDens", - inherit = Prediction, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' - #' @param task ([TaskSurv])\cr - #' Task, used to extract defaults for `row_ids`. - #' - #' @param row_ids (`integer()`)\cr - #' Row ids of the predicted observations, i.e. the row ids of the test set. - #' - #' @param pdf (`numeric()`)\cr - #' Numeric vector of estimated probability density function, evaluated at values in test set. - #' One element for each observation in the test set. - #' - #' @param cdf (`numeric()`)\cr - #' Numeric vector of estimated cumulative distribution function, evaluated at values in test - #' set. One element for each observation in the test set. - #' - #' @param distr ([Distribution][distr6::Distribution])\cr - #' [Distribution][distr6::Distribution] from \link[distr6]{distr6}. - #' The distribution from which `pdf` and `cdf` are derived. - #' - #' @param check (`logical(1)`)\cr - #' If `TRUE`, performs argument checks and predict type conversions. - initialize = function(task = NULL, row_ids = task$row_ids, pdf = NULL, - cdf = NULL, distr = NULL, check = TRUE) { - pdata = list(row_ids = row_ids, pdf = pdf, cdf = cdf, distr = distr) - pdata = discard(pdata, is.null) - class(pdata) = c("PredictionDataDens", "PredictionData") - - if (check) { - pdata = check_prediction_data(pdata) - } - - self$task_type = "dens" - self$man = "mlr3proba::PredictionDens" - self$data = pdata - self$predict_types = intersect(c("pdf", "cdf", "distr"), names(pdata)) - } - ), - - active = list( - #' @field pdf (`numeric()`)\cr - #' Access the stored predicted probability density function. - pdf = function() { - self$data$pdf %??% rep(NA_real_, length(self$data$row_ids)) - }, - - #' @field cdf (`numeric()`)\cr - #' Access the stored predicted cumulative distribution function. - cdf = function() { - self$data$cdf %??% rep(NA_real_, length(self$data$row_ids)) - }, - - #' @field distr ([Distribution][distr6::Distribution])\cr - #' Access the stored estimated distribution. - distr = function() { - self$data$distr %??% NA_real_ - } - ) -) - - -#' @export -as.data.table.PredictionDens = function(x, ...) { # nolint - tab = as.data.table(x$data[c("row_ids", "pdf", "cdf")]) - if ("distr" %in% x$predict_types) { - tab$distr = list(list(x$distr)) - } - tab -} diff --git a/R/PredictionSurv.R b/R/PredictionSurv.R deleted file mode 100644 index 46c323cfd..000000000 --- a/R/PredictionSurv.R +++ /dev/null @@ -1,227 +0,0 @@ -#' @title Prediction Object for Survival -#' -#' @description -#' This object stores the predictions returned by a learner of class [LearnerSurv]. -#' -#' The `task_type` is set to `"surv"`. -#' -#' For accessing survival and hazard functions, as well as other complex methods -#' from a [PredictionSurv] object, see public methods on [distr6::ExoticStatistics()] -#' and example below. -#' -#' @family Prediction -#' @examples -#' library(mlr3) -#' task = tsk("rats") -#' learner = lrn("surv.kaplan") -#' p = learner$train(task, row_ids = 1:26)$predict(task, row_ids = 27:30) -#' head(as.data.table(p)) -#' -#' p$distr # distr6::Matdist class (test obs x time points) -#' -#' # survival probabilities of the 4 test rats at two time points -#' p$distr$survival(c(20, 100)) -#' @export -PredictionSurv = R6Class("PredictionSurv", - inherit = Prediction, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' - #' @details - #' Upon **initialization**, if the `distr` input is a [Distribution][distr6::Distribution], - #' we try to coerce it either to a survival matrix or a survival array and store it - #' in the `$data$distr` slot for internal use. - #' - #' If the stored `$data$distr` is a [Distribution][distr6::Distribution] object, - #' the active field `$distr` (**external user API**) returns it without modification. - #' Otherwise, if `$data$distr` is a survival matrix or array, `$distr` - #' constructs a distribution out of the `$data$distr` object, which will be a - #' [Matdist][distr6::Matdist] or [Arrdist][distr6::Arrdist] respectively. - #' - #' Note that if a survival 3d array is stored in `$data$distr`, the `$distr` - #' field returns an [Arrdist][distr6::Arrdist] initialized with `which.curve = 0.5` - #' by default (i.e. the median curve). This means that measures that require - #' a `distr` prediction like [MeasureSurvGraf], [MeasureSurvRCLL], etc. - #' will use the median survival probabilities. - #' Note that it is possible to manually change `which.curve` after construction - #' of the predicted distribution but we advise against this as it may lead to - #' inconsistent results. - #' - #' @param task ([TaskSurv])\cr - #' Task, used to extract defaults for `row_ids` and `truth`. - #' - #' @param row_ids (`integer()`)\cr - #' Row ids of the predicted observations, i.e. the row ids of the test set. - #' - #' @param truth (`survival::Surv()`)\cr - #' True (observed) response. - #' - #' @param crank (`numeric()`)\cr - #' Numeric vector of predicted continuous rankings (or relative risks). One element for each - #' observation in the test set. For a pair of continuous ranks, a higher rank indicates that - #' the observation is more likely to experience the event. - #' - #' @param distr (`matrix()|[distr6::Arrdist]|[distr6::Matdist]|[distr6::VectorDistribution]`)\cr - #' Either a matrix of predicted survival probabilities, a [distr6::VectorDistribution], - #' a [distr6::Matdist] or an [distr6::Arrdist]. - #' If a matrix/array then column names must be given and correspond to survival times. - #' Rows of matrix correspond to individual predictions. It is advised that the - #' first column should be time `0` with all entries `1` and the last - #' with all entries `0`. If a `VectorDistribution` then each distribution in the vector - #' should correspond to a predicted survival distribution. - #' - #' @param lp (`numeric()`)\cr - #' Numeric vector of linear predictor scores. One element for each observation in the test - #' set. \eqn{lp = X\beta} where \eqn{X} is a matrix of covariates and \eqn{\beta} is a vector - #' of estimated coefficients. - #' - #' @param response (`numeric()`)\cr - #' Numeric vector of predicted survival times. - #' One element for each observation in the test set. - #' - #' @param check (`logical(1)`)\cr - #' If `TRUE`, performs argument checks and predict type conversions. - initialize = function(task = NULL, row_ids = task$row_ids, truth = task$truth(), crank = NULL, - distr = NULL, lp = NULL, response = NULL, check = TRUE) { - - if (inherits(distr, "Distribution")) { - # coerce to matrix/array if possible - distr = private$.simplify_distr(distr) - } - - pdata = list(row_ids = row_ids, truth = truth, crank = crank, distr = distr, - lp = lp, response = response) - pdata = discard(pdata, is.null) - class(pdata) = c("PredictionDataSurv", "PredictionData") - - if (check) { - pdata = check_prediction_data(pdata) - } - - self$task_type = "surv" - self$man = "mlr3proba::PredictionSurv" - self$data = pdata - self$predict_types = intersect(c("crank", "distr", "lp", "response"), names(pdata)) - } - ), - - active = list( - #' @field truth (`Surv`)\cr - #' True (observed) outcome. - truth = function() { - self$data$truth - }, - - #' @field crank (`numeric()`)\cr - #' Access the stored predicted continuous ranking. - crank = function() { - self$data$crank %??% rep(NA_real_, length(self$data$row_ids)) - }, - - #' @field distr ([distr6::Matdist]|[distr6::Arrdist]|[distr6::VectorDistribution])\cr - #' Convert the stored survival array or matrix to a survival distribution. - distr = function() { - if (inherits(self$data$distr, "Distribution")) { - return(self$data$distr) - } - - private$.distrify_survarray(self$data$distr) - }, - - #' @field lp (`numeric()`)\cr - #' Access the stored predicted linear predictor. - lp = function() { - self$data$lp - }, - - #' @field response (`numeric()`)\cr - #' Access the stored predicted survival time. - response = function() { - self$data$response - } - ), - - private = list( - .distr = function() self$data$distr %??% NA_real_, - .simplify_distr = function(x) { - if (inherits(x, c("Matdist", "Arrdist"))) { - 1 - gprm(x, "cdf") # matrix or 3d array - } else { - if (!inherits(x, "VectorDistribution")) { - stop("'x' is not a 'VectorDistribution'") - } - - ## check all distributions equal - return x if not - if (x$distlist) { - return(x) - } - - ## check all distributions are WeightedDiscrete - return x if not - if (all(x$modelTable$Distribution != "WeightedDiscrete")) { - return(x) - } - - times = x$getParameterValue("x") - time1 = times[[1L]] - - ## check all times equal - return x if not - if (!all(map_lgl(times, identical, y = time1))) { - return(x) - } - - surv = 1 - do.call(rbind, x$getParameterValue("cdf")) - rownames(surv) = NULL - colnames(surv) = time1 - surv - } - }, - .distrify_survarray = function(x) { - if (inherits(x, "array") && nrow(x) > 0L) { # can be matrix as well - # create Matdist or Arrdist (default => median curve) - distr6::as.Distribution(1 - x, fun = "cdf", - decorators = c("CoreStatistics", "ExoticStatistics")) - } else { - NULL - } - } - ) -) - -#' @export -as.data.table.PredictionSurv = function(x, ...) { - tab = as.data.table(x$data[c("row_ids", "crank", "lp", "response")]) - tab$time = x$data$truth[, 1L] - tab$status = as.logical(x$data$truth[, 2L]) - - n_obs = length(x$row_ids) - if ("distr" %in% x$predict_types && n_obs > 0) { - distr = x$data$distr - # get survival matrix/array - surv = if (inherits(distr, "Distribution")) - 1 - distr6::gprm(distr, "cdf") - else distr - - # If survival array, take the median - surv_mat = if (length(dim(surv)) == 3L) .ext_surv_mat(surv, 0.5) else surv - - # Edge case with 1 observation coming from a `distr6::WeightedDisc` - if (is.vector(surv_mat)) { - surv_mat = matrix(surv_mat, nrow = 1, dimnames = list(NULL, names(surv_mat))) - } - - # split survival matrix to 1 vector (curve) per observation - # wrapped in a list for nice printing - tab$distr = lapply(1:n_obs, function(i) { - list(surv_mat[i, , drop = TRUE]) - }) - - # strange edge issue with 1 row `data.table` => extra list is removed! - # so we put them back in: - if (nrow(tab) == 1) { - tab$distr = list(list(tab$distr)) - } - } - - setcolorder(tab, c("row_ids", "time", "status"))[] -} diff --git a/R/RcppExports.R b/R/RcppExports.R deleted file mode 100644 index 594ebb942..000000000 --- a/R/RcppExports.R +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by using Rcpp::compileAttributes() -> do not edit by hand -# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 - -c_assert_surv <- function(mat) { - .Call(`_mlr3proba_c_assert_surv`, mat) -} - -c_score_logloss <- function(obs_times, times, cdf, eps) { - .Call(`_mlr3proba_c_score_logloss`, obs_times, times, cdf, eps) -} - -c_score_graf_schmid <- function(obs_times, times, cdf, power = 2L) { - .Call(`_mlr3proba_c_score_graf_schmid`, obs_times, times, cdf, power) -} - -c_apply_ipcw_weights <- function(score, unique_times, truth, cens, eps) { - .Call(`_mlr3proba_c_apply_ipcw_weights`, score, unique_times, truth, cens, eps) -} - -c_concordance <- function(time, status, crank, t_max, weight_meth, cens, surv, tiex) { - .Call(`_mlr3proba_c_concordance`, time, status, crank, t_max, weight_meth, cens, surv, tiex) -} - -c_gonen <- function(crank, tiex) { - .Call(`_mlr3proba_c_gonen`, crank, tiex) -} - diff --git a/R/TaskCompRisks.R b/R/TaskCompRisks.R deleted file mode 100644 index a972c824d..000000000 --- a/R/TaskCompRisks.R +++ /dev/null @@ -1,232 +0,0 @@ -#' @title Competing Risks Task -#' -#' @description -#' This task extends [mlr3::Task] and [mlr3::TaskSupervised] to handle survival -#' problems with **competing risks**. -#' The target variable consists of survival times and an event indicator, which -#' must be a non-negative integer in the set \eqn{(0,1,2,...,K)}. -#' \eqn{0} represents censored observations, while other integers correspond to -#' distinct competing events. -#' Every row corresponds to one subject/observation. -#' -#' Predefined tasks are stored in [mlr3::mlr_tasks]. -#' -#' The `task_type` is set to `"cmprsk"`. -#' -#' **Note:** Currently only right-censoring is supported. -#' -#' @template param_rows -#' -#' @family Task -#' @examples -#' library(mlr3) -#' task = tsk("pbc") -#' -#' # meta data -#' task$target_names # target is always (time, status) for right-censoring tasks -#' task$feature_names -#' task$formula() -#' -#' # survival data -#' task$truth() # survival::Surv() object -#' task$times() # (unsorted) times -#' task$event() # event indicators (0 = censored, >0 = different causes) -#' task$unique_times() # sorted unique times -#' task$unique_event_times() # sorted unique event times (from any cause) -#' task$aalen_johansen(strata = "sex") # Aalen-Johansen estimator -#' -#' # proportion of censored observations across all dataset -#' task$cens_prop() -#' -#' @export -TaskCompRisks = R6Class("TaskCompRisks", - inherit = TaskSupervised, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' - #' @details - #' Only right-censoring competing risk tasks are currently supported. - #' - #' @template param_id - #' @template param_backend - #' @param time (`character(1)`)\cr - #' Name of the column for event time. - #' @param event (`character(1)`)\cr - #' Name of the column giving the event indicator (\eqn{0} corresponds to - #' censoring, values \eqn{> 0} correspond to competing events. - #' @param label (`character(1)`)\cr - #' Label for the new instance. - initialize = function(id, backend, time = "time", event = "event", - label = NA_character_) { - # only right-censoring supported - private$.cens_type = "right" - backend = as_data_backend(backend) - - # check event is an integer starting from 0 - event_col = get_private(backend)$.data[, event, with = FALSE][[1L]] - assert_integerish(event_col, lower = 0L, any.missing = FALSE) - - # check that there is at least two competing events - n_cmp_events = sum(unique(event_col) != 0) - if (n_cmp_events < 2) { - stopf("Define at least two competing events, there are only %i in the data", - n_cmp_events) - } - - # keep all the event levels - private$.event_levels = levels(as.factor(event_col)) - - super$initialize( - id = id, task_type = "cmprsk", backend = backend, - target = c(time, event), label = label - ) - }, - - #' @description - #' True response for specified `row_ids`. This is the multi-state format - #' using [Surv][survival::Surv()] with the `event` target column as a `factor`: - #' `Surv(time, as.factor(event))` - #' - #' Defaults to all rows with role `"use"`. - #' - #' @return [survival::Surv()]. - truth = function(rows = NULL) { - tn = self$target_names - data = self$data(rows = rows, cols = self$target_names) - times = data[[tn[1L]]] - events = data[[tn[2L]]] - - args = list( - time = times, - # levels is needed, otherwise subsetting `Surv()` doesn't work as it should - event = factor(events, levels = c("0", self$cmp_events)) - ) - - invoke(Surv, .args = args) - }, - - #' @description - #' Creates a formula for competing risk models with [survival::Surv()] on - #' the LHS (left hand side). - #' - #' @param rhs - #' If `NULL`, RHS (right hand side) is `"."`, otherwise RHS is `"rhs"`. - #' - #' @return [stats::formula()]. - formula = function(rhs = NULL) { - tn = self$target_names - lhs = sprintf("Surv(%s, as.factor(%s))", tn[1L], tn[2L]) - formulate(lhs, rhs %??% ".", env = getNamespace("survival")) - }, - - #' @description - #' Returns the (unsorted) outcome times. - #' @return `numeric()` - times = function(rows = NULL) { - truth = self$truth(rows) - as.numeric(truth[, 1L]) - }, - - #' @description - #' Returns the event indicator. - #' @return `integer()` - event = function(rows = NULL) { - truth = self$truth(rows) - as.integer(truth[, 2L]) - }, - - #' @description - #' Returns the unique events (excluding censoring). - #' @return `integer()` - unique_events = function(rows = NULL) { - events = self$event(rows) - sort(setdiff(events, 0)) - }, - - #' @description - #' Returns the sorted unique outcome times. - #' @return `numeric()` - unique_times = function(rows = NULL) { - sort(unique(self$times(rows))) - }, - - #' @description - #' Returns the sorted unique event outcome times (by any cause). - #' @return `numeric()` - unique_event_times = function(rows = NULL) { - sort(unique(self$times(rows)[self$event(rows) != 0])) - }, - - #' @description - #' Calls [survival::survfit()] to calculate the Aalen–Johansen estimator. - #' - #' @param strata (`character()`)\cr - #' Stratification variables to use. - #' @param rows (`integer()`)\cr - #' Subset of row indices. - #' @param ... (any)\cr - #' Additional arguments passed down to [survival::survfit.formula()]. - #' @return [survival::survfit.object]. - aalen_johansen = function(strata = NULL, rows = NULL, ...) { - assert_character(strata, null.ok = TRUE) - f = self$formula(strata %??% 1) - cols = c(self$target_names, intersect(self$backend$colnames, strata)) - data = self$data(rows = rows, cols = cols) - survival::survfit(f, data = data, ...) - }, - - #' @description - #' Returns the **proportion of censoring** for this competing risks task. - #' By default, this is returned for all observations, otherwise only the - #' specified ones (`rows`). - #' - #' @return `numeric()` - cens_prop = function(rows = NULL) { - event = self$event(rows) - total_censored = sum(event == 0) - n_obs = length(event) - - total_censored / n_obs - }, - - #' @description - #' Subsets the task, keeping only the rows specified via row ids `rows`. - #' This operation mutates the task in-place. - #' - #' @return Returns the object itself, but modified **by reference.** - filter = function(rows = NULL) { - # check that we don't remove the competing events from the data - uevents = self$unique_events(rows) - if (length(uevents) != length(self$cmp_events)) { - stopf("Can't filter task %s: %i competing events found, but row filtering results in %i unique competing event(s)", self$id, length(self$cmp_events), length(uevents)) #nolint - } - - super$filter(rows) - } - ), - - active = list( - #' @field cens_type (`character(1)`)\cr - #' Returns the type of censoring. - #' - #' Currently, only the `"right"` censoring type is fully supported. - #' The API might change in the future to support left and interval censoring. - cens_type = function(rhs) { - assert_ro_binding(rhs) - private$.cens_type - }, - - #' @field cmp_events (`character(1)`)\cr - #' Returns the names of the competing events. - cmp_events = function(rhs) { - assert_ro_binding(rhs) - setdiff(private$.event_levels, "0") - } - ), - - private = list( - .cens_type = NULL, - .event_levels = NULL - ) -) diff --git a/R/TaskDens.R b/R/TaskDens.R deleted file mode 100644 index 1b942fa81..000000000 --- a/R/TaskDens.R +++ /dev/null @@ -1,42 +0,0 @@ -#' @title Density Task -#' -#' @description -#' This task specializes [TaskUnsupervised][mlr3::TaskUnsupervised] for density estimation problems. -#' The data in `backend` should be a numeric vector or a one column matrix-like object. -#' The `task_type` is set to `"density"`. -#' -#' Predefined tasks are stored in the [dictionary][mlr3misc::Dictionary] [mlr_tasks][mlr3::mlr_tasks]. -#' -#' @template param_rows -#' @template param_id -#' @template param_backend -#' @template param_label -#' -#' @family Task -#' @export -#' @examples -#' task = TaskDens$new("precip", backend = precip) -#' task$task_type -TaskDens = R6Class("TaskDens", - inherit = TaskUnsupervised, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' @param backend ([mlr3::DataBackend])\cr - #' Either a [DataBackend][mlr3::DataBackend], a matrix-like object, or a numeric vector. - #' If weights are used then two columns expected, otherwise one column. The weight column - #' must be clearly specified (via `[Task]$col_roles`) or the learners will break. - initialize = function(id, backend, label = NA_character_) { - - if (test_numeric(backend)) { - backend = data.frame(x = backend) - } else if (test_class(backend, "DataBackend")) { - assert_numeric(backend$ncol, lower = 2, upper = 3) - } else { - assert_numeric(ncol(backend), lower = 1, upper = 2) - } - - super$initialize(id = id, task_type = "dens", backend = backend, label = label) - } - ) -) diff --git a/R/TaskGeneratorCoxed.R b/R/TaskGeneratorCoxed.R deleted file mode 100644 index 9b8d08f1d..000000000 --- a/R/TaskGeneratorCoxed.R +++ /dev/null @@ -1,84 +0,0 @@ -#' @title Survival Task Generator for Package 'coxed' -#' -#' @name mlr_task_generators_coxed -#' -#' @description -#' A [TaskGenerator][mlr3::TaskGenerator] calling [coxed::sim.survdata()]. -#' -#' This generator creates a survival dataset using `coxed`, and exposes -#' some parameters from the [coxed::sim.survdata()] function. -#' We don't include the parameters `X` (user-specified variables), `covariate`, -#' `low`, `high`, `compare`, `beta` and `hazard.fun` for this generator. -#' The latter means that no user-specified hazard function can be used and the -#' generated datasets always use the *flexible-hazard* method from the package. -#' -#' @templateVar id coxed -#' @template task_generator -#' -#' @template seealso_task_generator -#' @references -#' `r format_bib("harden_2019")` -#' @examplesIf mlr3misc::require_namespaces("coxed", quietly = TRUE) -#' library(mlr3) -#' -#' # time horizon = 365 days, censoring proportion = 60%, 6 covariates normally -#' # distributed with mean = 1 and sd = 2, independent censoring, no time-varying -#' # effects -#' gen = tgen("coxed", T = 365, type = "none", censor = 0.6, xvars = 6, -#' mu = 1, sd = 2, censor.cond = FALSE) -#' gen$generate(50) -#' -#' # same as above, but with time-varying coefficients -#' gen$param_set$set_values(type = "tvbeta") -#' gen$generate(50) -#' @export -TaskGeneratorCoxed = R6Class("TaskGeneratorCoxed", - inherit = TaskGenerator, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - param_set = ps( - T = p_dbl(1, default = 100), # time-horizon - type = p_fct(default = "none", levels = c("none", "tvbeta")), # time-varying coefficients - knots = p_int(1L, default = 8L), # for flexible-hazard method - spline = p_lgl(default = TRUE), # for flexible-hazard method - xvars = p_int(1L, default = 3L), # number of covariates to generate - mu = p_uty(default = 0), # mean for `xvars` - sd = p_uty(default = 0.5), # sd for `xvars` - censor = p_dbl(0, 1, default = 0.1), # censoring proportion - censor.cond = p_lgl(default = FALSE) # conditional censoring - ) - - param_set$set_values(type = "none") - - super$initialize( - id = "coxed", - task_type = "surv", - packages = "coxed", - param_set = param_set, - label = "Survival Data Generator from package 'coxed'", - man = "mlr3proba::mlr_task_generators_coxed" - ) - }, - - #' @description - #' Opens the corresponding help page referenced by field `$man`. - help = function() { - open_help(self$man) - } - ), - - private = list( - .generate = function(n) { - require_namespaces("coxed") - - data = invoke(coxed::sim.survdata, N = n, .args = self$param_set$values)[[1]] - data = map_at(data, "failed", as.integer) - - TaskSurv$new(id = self$id, backend = data, time = "y", - event = "failed", type = "right") - } - ) -) - -register_task_generator("coxed", TaskGeneratorCoxed) diff --git a/R/TaskGeneratorSimdens.R b/R/TaskGeneratorSimdens.R deleted file mode 100644 index 923a1051a..000000000 --- a/R/TaskGeneratorSimdens.R +++ /dev/null @@ -1,61 +0,0 @@ -#' @title Density Task Generator for Package 'distr6' -#' -#' @name mlr_task_generators_simdens -#' -#' @description -#' A [mlr3::TaskGenerator] calling [distr6::distrSimulate()]. -#' See [distr6::distrSimulate()] for an explanation of the hyperparameters. -#' See [distr6::listDistributions()] for the names of the available distributions. -#' -#' @templateVar id simdens -#' @template task_generator -#' -#' @template seealso_task_generator -#' @export -#' @examples -#' # generate 20 samples from a standard Normal distribution -#' dens_gen = tgen("simdens") -#' dens_gen$param_set -#' -#' task = dens_gen$generate(20) -#' head(task) -#' -#' # generate 50 samples from a Binomial distribution with specific parameters -#' dens_gen = tgen("simdens", distribution = "Bernoulli", pars = list(prob = 0.8)) -#' task = dens_gen$generate(50) -#' task$data()[["x"]] -TaskGeneratorSimdens = R6Class("TaskGeneratorSimdens", - inherit = TaskGenerator, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - param_set = ps( - distribution = p_fct(default = "Normal", levels = distr6::listDistributions(simplify = TRUE)), - pars = p_uty() - ) - super$initialize( - id = "simdens", - task_type = "dens", - packages = "distr6", - param_set = param_set, - label = "Density Generator for package 'distr6'", - man = "mlr3proba::mlr_task_generators_simdens" - ) - }, - - #' @description - #' Opens the corresponding help page referenced by field `$man`. - help = function() { - open_help(self$man) - } - ), - - private = list( - .generate = function(n) { - data = invoke(distr6::distrSimulate, n = n, .args = self$param_set$values) - TaskDens$new(self$id, backend = data) - } - ) -) - -register_task_generator("simdens", TaskGeneratorSimdens) diff --git a/R/TaskGeneratorSimsurv.R b/R/TaskGeneratorSimsurv.R deleted file mode 100644 index 2765102f8..000000000 --- a/R/TaskGeneratorSimsurv.R +++ /dev/null @@ -1,86 +0,0 @@ -#' @title Survival Task Generator for Package 'simsurv' -#' -#' @name mlr_task_generators_simsurv -#' -#' @description -#' A [mlr3::TaskGenerator] calling [simsurv::simsurv()] from package \CRANpkg{simsurv}. -#' -#' This generator currently only exposes a small subset of the flexibility of \CRANpkg{simsurv}, -#' and just creates a small dataset with the following numerical covariates: -#' -#' - `treatment`: Bernoulli distributed with hazard ratio `0.5`. -#' - `height`: Normally distributed with hazard ratio `1`. -#' - `weight`: normally distributed with hazard ratio `1`. -#' -#' See [simsurv::simsurv()] for an explanation of the hyperparameters. -#' Initial values for hyperparameters are `lambdas` = 0.1, `gammas` = 1.5 and `maxt` = 5. -#' The last one, by default generates samples which are administratively censored at \eqn{\tau = 5}, so increase this value if you want to change this. -#' -#' @templateVar id simsurv -#' @template task_generator -#' -#' @template seealso_task_generator -#' @references -#' `r format_bib("brilleman_2021")` -#' @examplesIf mlr3misc::require_namespaces(c("simsurv"), quietly = TRUE) -#' # generate 20 samples with Weibull survival distribution -#' gen = tgen("simsurv") -#' task = gen$generate(20) -#' head(task) -#' -#' # generate 100 samples with exponential survival distribution and tau = 40 -#' gen = tgen("simsurv", dist = "exponential", gammas = NULL, maxt = 40) -#' task = gen$generate(100) -#' head(task) -#' @export -TaskGeneratorSimsurv = R6Class("TaskGeneratorSimsurv", - inherit = TaskGenerator, - public = list( - #' @description Creates a new instance of this [R6][R6::R6Class] class. - initialize = function() { - ps = ps( - dist = p_fct(levels = c("weibull", "exponential", "gompertz"), default = "weibull"), - lambdas = p_dbl(0, special_vals = list(NULL), tags = "required"), - gammas = p_dbl(0, special_vals = list(NULL), tags = "required"), - maxt = p_dbl(0, tags = "required") - ) - ps$set_values(lambdas = 0.1, gammas = 1.5, maxt = 5) - - super$initialize( - id = "simsurv", - task_type = "surv", - packages = "simsurv", - param_set = ps, - label = "Survival Data Generator from package 'simsurv'", - man = "mlr3proba::mlr_task_generators_simsurv" - ) - }, - - #' @description - #' Opens the corresponding help page referenced by field `$man`. - help = function() { - open_help(self$man) - } - ), - - private = list( - .generate = function(n) { - require_namespaces("simsurv") - - pv = self$param_set$values - covs = data.table( - treatment = stats::rbinom(n, 1L, 0.5), - height = stats::rnorm(n, 170, 10), - weight = stats::rnorm(n, 80, 10) - ) - betas = c(treatment = -0.5, height = -0.00004, weight = -0.00005) - - data = setDT(invoke(simsurv::simsurv, x = covs, betas = betas, .args = pv)) # nolint - data = rcbind(data, covs) - TaskSurv$new(id = "simsurv", backend = remove_named(data, "id"), - time = "eventtime", event = "status") - } - ) -) - -register_task_generator("simsurv", TaskGeneratorSimsurv) diff --git a/R/TaskSurv.R b/R/TaskSurv.R deleted file mode 100644 index c5b508f81..000000000 --- a/R/TaskSurv.R +++ /dev/null @@ -1,396 +0,0 @@ -#' @title Survival Task -#' -#' @description -#' This task specializes [mlr3::Task] and [mlr3::TaskSupervised] for -#' **single-event survival** problems. -#' The target is comprised of survival times and an event indicator (\eqn{0} -#' represents censored observations, \eqn{1} represents observations that had the -#' event). -#' Every row corresponds to one subject/observation. -#' -#' Predefined tasks are stored in [mlr3::mlr_tasks]. -#' -#' The `task_type` is set to `"surv"`. -#' -#' **Note:** Currently only right-censoring is supported, though it possible to -#' create tasks with left and interval censoring using the [Surv][survival::Surv()] -#' interface. -#' -#' @template param_rows -#' -#' @references -#' `r format_bib("grambsch_1994")` -#' -#' @family Task -#' @examples -#' library(mlr3) -#' task = tsk("lung") -#' -#' # meta data -#' task$target_names # target is always (time, status) for right-censoring tasks -#' task$feature_names -#' task$formula() -#' -#' # survival data -#' task$truth() # survival::Surv() object -#' task$times() # (unsorted) times -#' task$status() # event indicators (1 = death, 0 = censored) -#' task$unique_times() # sorted unique times -#' task$unique_event_times() # sorted unique event times -#' task$kaplan(strata = "sex") # stratified Kaplan-Meier -#' task$kaplan(reverse = TRUE) # Kaplan-Meier of the censoring distribution -#' -#' # proportion of censored observations across all dataset -#' task$cens_prop() -#' # proportion of censored observations at or after the 95% time quantile -#' task$admin_cens_prop(quantile_prob = 0.95) -#' # proportion of variables that are significantly associated with the -#' # censoring status via a logistic regression model -#' task$dep_cens_prop() # 0 indicates independent censoring -#' # data barely satisfies proportional hazards assumption (p > 0.05) -#' task$prop_haz() -#' # veteran data is definitely non-PH (p << 0.05) -#' tsk("veteran")$prop_haz() -#' @export -TaskSurv = R6Class("TaskSurv", - inherit = TaskSupervised, - public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. - #' - #' @details - #' Depending on the censoring type (`"type"`), the output of a survival - #' task's `"$target_names"` is a `character()` vector with values the names - #' of the target columns. - #' Specifically, the output is as follows (and in the specified order): - #' - #' - For `type` = `"right"` or `"left"`: (`"time"`, `"event"`) - #' - For `type` = `"interval"`: (`"time"`, `"time2"`) - #' - #' @template param_id - #' @template param_backend - #' @template param_time - #' @template param_event - #' @template param_time2 - #' @template param_type - #' @param label (`character(1)`)\cr - #' Label for the new instance. - initialize = function(id, backend, time = "time", event = "event", time2 = "time2", - type = "right", label = NA_character_) { - cens_type = assert_choice(type, c("right", "left", "interval")) - private$.cens_type = cens_type - backend = as_data_backend(backend) - - if (cens_type == "interval") { - super$initialize( - id = id, task_type = "surv", backend = backend, - target = c(time, time2), label = label - ) - } else { - # check event is 0 or 1 - event_col = get_private(backend)$.data[, event, with = FALSE][[1L]] - assert_integerish(event_col, lower = 0L, upper = 1L, any.missing = FALSE) - - super$initialize( - id = id, task_type = "surv", backend = backend, - target = c(time, event), label = label - ) - } - }, - - #' @description - #' True response for specified `row_ids`. This is the survival outcome - #' using the [Surv][survival::Surv()] format and depends on the censoring - #' type. Defaults to all rows with role `"use"`. - #' - #' For censoring type: - #' - #' - `"right|left"`: `Surv(time, event, type = "right|left")` - #' - `"interval"`: `Surv(time, time2, type = "interval2")` - #' - #' @return [survival::Surv()]. - truth = function(rows = NULL) { - tn = self$target_names - cens_type = self$cens_type - data = self$data(rows, cols = self$target_names) - args = list(time = data[[tn[1L]]]) - - if (cens_type == "interval") { - args$time2 = data[[tn[2L]]] - # the "interval" type in `Surv()` has the the event - # and is not so much used, "interval2" is the one we want here - args$type = "interval2" - } else { - args$event = as.integer(data[[tn[2L]]]) - args$type = cens_type # "right" or "left" - } - - invoke(Surv, .args = args) - }, - - #' @description - #' Creates a formula for survival models with [survival::Surv()] on the LHS - #' (left hand side). - #' - #' @param rhs - #' If `NULL`, RHS (right hand side) is `"."`, otherwise RHS is `"rhs"`. - #' @param reverse - #' If `TRUE` then formula calculated with 1 - status. Only applicable to `"right"` - #' or `"left"` censoring. - #' - #' @return [stats::formula()]. - formula = function(rhs = NULL, reverse = FALSE) { - # formula appends the rhs argument to Surv(time, (time2), event)~ - tn = self$target_names - cens_type = self$cens_type - - if (cens_type == "interval") { - lhs = sprintf("Surv(%s, %s, type = '%s')", tn[1L], tn[2L], "interval2") - } else { - if (reverse) { - lhs = sprintf("Surv(%s, 1 - %s, type = '%s')", tn[1L], tn[2L], cens_type) - } else { - lhs = sprintf("Surv(%s, %s, type = '%s')", tn[1L], tn[2L], cens_type) - } - } - - formulate(lhs, rhs %??% ".", env = getNamespace("survival")) - }, - - #' @description - #' Returns the (unsorted) outcome times. - #' @return `numeric()` - times = function(rows = NULL) { - if (self$cens_type == "interval") stop("Not supported for interval-censored data") - - truth = self$truth(rows) - - as.numeric(truth[, 1L]) - }, - - #' @description - #' Returns the event indicator (aka censoring/survival indicator). - #' If censoring type is `"right"` or `"left"` then `1` is event and `0` is censored. - #' If censoring type is `"interval"` then `0` means right-censored, `1` is - #' event, `2` is left-censored and `3` is interval-censored. - #' - #' See [survival::Surv()]. - #' - #' @return `integer()` - status = function(rows = NULL) { - truth = self$truth(rows) - - if (self$cens_type == "interval") { - status = truth[, 3L] - } else { - status = truth[, 2L] - } - - as.integer(status) - }, - - #' @description - #' Returns the sorted unique outcome times. - #' @return `numeric()` - unique_times = function(rows = NULL) { - sort(unique(self$times(rows))) - }, - - #' @description - #' Returns the sorted unique event (or failure) outcome times. - #' @return `numeric()` - unique_event_times = function(rows = NULL) { - sort(unique(self$times(rows)[self$status(rows) == 1])) # event => 1 - }, - - #' @description - #' Calls [survival::survfit()] to calculate the Kaplan-Meier estimator. - #' - #' @param strata (`character()`)\cr - #' Stratification variables to use. - #' @param rows (`integer()`)\cr - #' Subset of row indices. - #' @param reverse (`logical()`)\cr - #' If `TRUE` calculates Kaplan-Meier of censoring distribution (1-status). Default `FALSE`. - #' @param ... (any)\cr - #' Additional arguments passed down to [survival::survfit.formula()]. - #' @return [survival::survfit.object]. - kaplan = function(strata = NULL, rows = NULL, reverse = FALSE, ...) { - assert_character(strata, null.ok = TRUE) - f = self$formula(strata %??% 1, reverse) - cols = c(self$target_names, intersect(self$backend$colnames, strata)) - data = self$data(rows = rows, cols = cols) - survival::survfit(f, data = data, ...) - }, - - #' @description - #' Returns the same task with the status variable reversed, i.e., 1 - status. - #' - #' @return [mlr3proba::TaskSurv]. - reverse = function() { - if (self$cens_type == "interval") stop("Not supported for interval-censored data") - - data = copy(self$data()) - data[, (self$target_names[2L]) := 1 - get(self$target_names[2L])] - as_task_surv(data, time = self$target_names[1L], event = self$target_names[2L], - type = self$cens_type, id = paste0(self$id, "_reverse")) - }, - - #' @description - #' Returns the **proportion of censoring** for this survival task. - #' This the proportion of censored observations in case of `"right"` or - #' `"left"` censoring, otherwise the proportion of left (2), right (0) and - #' interval censored (3) observations when censoring type is `"interval"`. - #' - #' By default, this is returned for all observations, otherwise only the - #' specified ones (`rows`). - #' - #' @return `numeric()` - cens_prop = function(rows = NULL) { - status = self$status(rows) - - tbl_status = table(status, exclude = 1) # 1 => event - cens_props = as.vector(tbl_status) / length(status) - - if (self$cens_type == "interval") { - set_names(cens_props, names(tbl_status)) # can be 0, 2 or 3, see `$status()` - } else { - cens_props - } - }, - - #' @description - #' Returns an estimated proportion of **administratively censored - #' observations** (i.e. censored at or after a user-specified time point). - #' Our main assumption here is that in an administratively censored dataset, - #' the maximum censoring time is likely close to the maximum event time and - #' so we expect higher proportion of censored subjects near the study end date. - #' - #' Only designed for `"right"` censoring. - #' - #' @param admin_time (`numeric(1)`) \cr - #' Administrative censoring time (in case it is known *a priori*). - #' @param quantile_prob (`numeric(1)`) \cr - #' Quantile probability value with which we calculate the cutoff time for - #' administrative censoring. Ignored, if `admin_time` is given. - #' By default, `quantile_prob` is equal to \eqn{0.99}, which translates to a - #' time point very close to the maximum outcome time in the dataset. - #' A lower value will result in an earlier time point and therefore in a more - #' *relaxed* definition (i.e. higher proportion) of administrative censoring. - #' - #' @return `numeric()` - admin_cens_prop = function(rows = NULL, admin_time = NULL, quantile_prob = 0.99) { - if (self$cens_type != "right") stopf("Not supported for %s-censored data", self$cens_type) - - assert_number(quantile_prob, lower = 0.8, upper = 1, null.ok = FALSE) - assert_number(admin_time, lower = 0, null.ok = TRUE) - - times = self$times(rows) - status = self$status(rows) - - # Get administrative time - if (is.null(admin_time)) { - t_max = unname(round(stats::quantile(times, probs = quantile_prob))) - } else { - t_max = min(admin_time, max(times)) - } - - # Identify total censored observations - total_censored = sum(status == 0) - if (total_censored == 0) return(0) - - # Count the number of observations censored at or after the max time - admin_censored = sum(status == 0 & times >= t_max) - - # proportion of administrative censoring - admin_censored / total_censored - }, - - #' @description - #' Returns the proportion of covariates (task features) that are found to be - #' significantly associated with censoring. - #' This function fits a logistic regression model via [glm][stats::glm] with - #' the censoring status as the response and using all features as predictors. - #' If a covariate is significantly associated with the censoring status, - #' it suggests that censoring may be *informative* (dependent) rather than - #' *random* (non-informative). - #' This methodology is more suitable for **low-dimensional datasets** where - #' the number of features is relatively small compared to the number of - #' observations. - #' - #' Only designed for `"right"` censoring. - #' - #' @param sign_level (`numeric(1)`) \cr - #' Significance level for each coefficient's p-value from the logistic - #' regression model. Default is \eqn{0.05}. - #' @param method (`character(1)`) \cr - #' Method to adjust p-values for multiple comparisons, see [p.adjust.methods]. - #' Default is `"holm"`. - #' - #' @return `numeric()` - dep_cens_prop = function(rows = NULL, method = "holm", sign_level = 0.05) { - if (self$cens_type != "right") stopf("Not supported for %s-censored data", self$cens_type) - - status_var = self$target_names[[2L]] - glm_summary = summary(stats::glm( - formula = formulate(lhs = status_var, rhs = "."), - data = self$data(cols = c(self$feature_names, status_var)), - family = stats::binomial(link = "logit") - )) - - # extract the p-values - p_values = glm_summary$coefficients[, "Pr(>|z|)"] - p_values_adj = stats::p.adjust(p_values, method = method) - n_coefs = length(p_values_adj) - 1 # exclude the intercept, include dummy-encoded variables - n_signif = sum(p_values_adj[-1L] <= sign_level) - - n_signif / n_coefs - }, - - #' @description - #' Checks if the data satisfy the *proportional hazards (PH)* assumption using - #' the Grambsch-Therneau test, `r cite_bib("grambsch_1994")`. - #' Uses [cox.zph][survival::cox.zph()]. - #' This method should be used only for **low-dimensional datasets** where - #' the number of features is relatively small compared to the number of - #' observations. - #' - #' Only designed for `"right"` censoring. - #' - #' @return `numeric()` \cr - #' If no errors, the p-value of the global chi-square test. - #' A p-value \eqn{< 0.05} is an indication of possible PH violation. - prop_haz = function() { - if (self$cens_type != "right") stopf("Not supported for %s-censored data", self$cens_type) - - cox = lrn("surv.coxph") - cox$encapsulate("evaluate", fallback = lrn("surv.kaplan")) - cox$train(self) - ok = (length(cox$errors) == 0L) & (length(cox$warnings) == 0L) - - # cox model didn't converge, train didn't succeed, etc - if (!ok) stop("Error/warning during cox model fitting") - - zph_test = survival::cox.zph(fit = cox$model) - p_value = zph_test$table["GLOBAL", "p"] - - p_value - } - ), - - active = list( - #' @field cens_type (`character(1)`)\cr - #' Returns the type of censoring, one of `"right"`, `"left"` or `"interval"`. - #' - #' Currently, only the `"right"` censoring type is fully supported, the rest - #' are experimental and the API might change in the future. - cens_type = function(rhs) { - assert_ro_binding(rhs) - private$.cens_type - } - ), - - private = list( - .cens_type = NULL - ) -) diff --git a/R/Task_zzz.R b/R/Task_zzz.R deleted file mode 100644 index 6cdef5b58..000000000 --- a/R/Task_zzz.R +++ /dev/null @@ -1,383 +0,0 @@ -#' @title German Breast Cancer Study Survival Task -#' -#' @name mlr_tasks_gbsg -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id gbsg -#' @templateVar data gbsg -#' @templateVar data_pkg survival -#' @template task -#' @template seealso_task -#' -#' @section Pre-processing: -#' - Removed column `pid`. -#' - Column `meno` has been converted to `factor` and 0/1 values have been -#' replaced with `premenopausal` and `postmenopausal` respectively. -#' - Column `hormon` has been converted to `factor` and 0/1 values have been -#' replaced with `no` and `yes` respectively. -#' - Column `grade` has been converted to `factor`. -#' - Renamed target column `rfstime` to `time`. -NULL - -load_gbsg = function() { - data = survival::gbsg - data$pid = NULL - data$meno = factor(ifelse(data$meno == 0, "premenopausal", "postmenopausal"), - levels = c("premenopausal", "postmenopausal")) - data$hormon = factor(ifelse(data$hormon == 0, "no", "yes"), - levels = c("no", "yes")) - data$grade = factor(data$grade) - colnames(data)[colnames(data) == "rfstime"] = "time" - - b = as_data_backend(data) - task = TaskSurv$new("gbsg", b, time = "time", event = "status", - label = "German Breast Cancer") - b$hash = task$man = "mlr3proba::mlr_tasks_gbsc" - - task -} - -#' @title Primary Biliary Cholangitis Competing Risks Task -#' -#' @name mlr_tasks_pbc -#' @templateVar type CompRisks -#' @templateVar task_type competing risks -#' @templateVar id pbc -#' @templateVar data pbc -#' @templateVar data_pkg survival -#' @template task -#' @template seealso_task -#' -#' @section Pre-processing: -#' - Removed column `id`. -#' - Kept only complete cases (no missing values). -#' - Column `age` has been converted to `integer`. -#' - Columns `trt`, `stage`, `hepato`, `edema` and `ascites` have been converted -#' to `factor`s. -#' - Column `trt` has levels `Dpenicillmain` and `placebo` instead of 1 and 2. -#' - Column `status` has 0 for censored, 1 for transplant and 2 for death. -#' - Column `time` as been converted from days to months. -NULL - -load_pbc = function() { - data = survival::pbc - data = stats::na.omit(data) - data$id = NULL - data = map_at(data, c("age"), as.integer) - data = map_at(data, c("spiders", "hepato", "edema", "ascites"), as.factor) - data$trt = factor(ifelse(data$trt == 1, "Dpenicillmain", "placebo"), - levels = c("Dpenicillmain", "placebo")) - data$stage = factor(data$stage) - data$time = floor(data$time / 30.44) # convert to months - - b = as_data_backend(data) - task = TaskCompRisks$new("pbc", b, time = "time", event = "status", - label = "Primary Biliary Cholangitis") - b$hash = task$man = "mlr3proba::mlr_tasks_pbc" - - task -} - -#' @title Monoclonal Gammopathy Survival Task -#' -#' @name mlr_tasks_mgus -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id mgus -#' @templateVar data mgus -#' @templateVar data_pkg survival -#' @template task -#' @template seealso_task -#' -#' @section Pre-processing: -#' - Removed columns `id`, `pcdx` and `pctime`. -#' - Renamed target columns from (`fultime`, `death`) to (`time`, `status`). -#' - Kept only complete cases (no missing values). -NULL - -load_mgus = function() { - data = survival::mgus - data[, c("id", "pcdx", "pctime")] = NULL - colnames(data)[colnames(data) == "futime"] = "time" - colnames(data)[colnames(data) == "death"] = "status" - data = stats::na.omit(data) - - b = as_data_backend(data) - task = TaskSurv$new("mgus", b, time = "time", event = "status", label = "MGUS") - b$hash = task$man = "mlr3proba::mlr_tasks_mgus" - - task -} - -#' @title Veteran Survival Task -#' -#' @name mlr_tasks_veteran -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id veteran -#' @templateVar data veteran -#' @templateVar data_pkg survival -#' @template task -#' @template seealso_task -#' -#' @section Pre-processing: -#' - Columns `age`, `time`, `status`, `diagtime` and `karno` have been converted -#' to `integer`. -#' - Columns `trt`, `prior` have been converted to `factor`s. Prior therapy -#' values are `no`/`yes` instead of 0/10. -NULL - -load_veteran = function() { - data = survival::veteran - data = map_at(data, c("age", "time", "status", "diagtime", "karno"), as.integer) - data = map_at(data, c("trt", "prior"), as.factor) - data$trt = factor(data$trt, levels = c("1", "2")) - data$prior = factor(ifelse(data$prior == 0, "no", "yes"), levels = c("no", "yes")) - - b = as_data_backend(data) - task = TaskSurv$new("veteran", b, time = "time", event = "status", label = "Veteran") - b$hash = task$man = "mlr3proba::mlr_tasks_veteran" - - task -} - -#' @title Rats Survival Task -#' -#' @name mlr_tasks_rats -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id rats -#' @templateVar data rats -#' @templateVar data_pkg survival -#' @template task -#' @template seealso_task -#' -#' @section Pre-processing: -#' - Column `sex` has been converted to a `factor`, all others have been -#' converted to `integer`. -NULL - -load_rats = function() { - data = survival::rats - data = map_at(data, c("rx", "time", "status"), as.integer) - data$sex = factor(data$sex, levels = c("f", "m")) - - b = as_data_backend(data) - task = TaskSurv$new("rats", b, time = "time", event = "status", label = "Rats") - b$hash = task$man = "mlr3proba::mlr_tasks_rats" - - task -} - -#' @title Lung Cancer Survival Task -#' -#' @name mlr_tasks_lung -#' -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id lung -#' @templateVar data lung -#' @templateVar data_pkg survival -#' @template task -#' @template seealso_task -#' -#' @section Pre-processing: -#' - Column `inst` has been removed. -#' - Column `sex` has been converted to a `factor`, all others have been -#' converted to `integer`. -#' - Kept only complete cases (no missing values). -NULL - -load_lung = function() { - data = survival::lung - data$inst = NULL - data = map_dtc(data, as.integer) - data$status = as.integer(data$status == 2L) - data$sex = factor(ifelse(data$sex == 1L, "m", "f"), levels = c("f", "m")) - data = stats::na.omit(data) - - b = as_data_backend(data) - task = TaskSurv$new("lung", b, time = "time", event = "status", label = "Lung Cancer") - b$hash = task$man = "mlr3proba::mlr_tasks_lung" - - task -} - -#' @title ACTG 320 Survival Task -#' -#' @name mlr_tasks_actg -#' -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id actg -#' @templateVar data actg -#' @template task -#' @template seealso_task -#' -#' @section Pre-processing: -#' - Column `sex` has been renamed to `sexF` and `censor` has been renamed to `status`. -#' - Columns `id`, `time_d`, and `censor_d` have been removed so target is `time` -#' to AIDS diagnosis (in days). -NULL - -load_actg = function() { - data = load_dataset("actg", "mlr3proba") - data[, c("id", "time_d", "censor_d")] = NULL - colnames(data)[6L] = "sexF" - colnames(data)[2L] = "status" - - b = as_data_backend(data) - task = TaskSurv$new("actg", b, time = "time", event = "status", label = "ACTG 320") - b$hash = task$man = "mlr3proba::mlr_tasks_actg" - - task -} - -#' @title German Breast Cancer Study Survival Task -#' -#' @name mlr_tasks_gbcs -#' -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id gbcs -#' @templateVar data gbcs -#' @template task -#' @template seealso_task -#' -#' @section Preprocessing: -#' - Column `id` and all date columns have been removed, as well as `rectime` -#' and `censrec`. -#' - Target columns (`survtime`, `censdead`) have been renamed to (`time`, `status`). -NULL - -load_gbcs = function() { - data = load_dataset("gbcs", "mlr3proba") - data[, c("id", "diagdate", "recdate", "deathdate", "rectime", "censrec")] = NULL - colnames(data)[9:10] = c("time", "status") - - b = as_data_backend(data) - task = TaskSurv$new("gbcs", b, time = "time", event = "status", label = "German Breast Cancer") - b$hash = task$man = "mlr3proba::mlr_tasks_gbcs" - - task -} - -#' @title GRACE 1000 Survival Task -#' -#' @name mlr_tasks_grace -#' -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id grace -#' @templateVar data grace -#' @template task -#' @template seealso_task -#' -#' @section Preprocessing: -#' - Column `id` is removed. -#' - Target columns (`days`, `death`) have been renamed to (`time`, `status`). -NULL - -load_grace = function() { - data = load_dataset("grace", "mlr3proba") - data[, "id"] = NULL - colnames(data)[1:2] = c("time", "status") - - b = as_data_backend(data) - task = TaskSurv$new("grace", b, time = "time", event = "status", label = "GRACE 1000") - b$hash = task$man = "mlr3proba::mlr_tasks_grace" - - task -} - -#' @title Worcester Heart Attack Study (WHAS) Survival Task -#' -#' @name mlr_tasks_whas -#' -#' @templateVar type Surv -#' @templateVar task_type survival -#' @templateVar id whas -#' @templateVar data whas -#' @template task -#' @template seealso_task -#' -#' @section Preprocessing: -#' - Columns `id`, `yrgrp`, and `dstat` are removed. -#' - Column `sex` is renamed to `sexF`, `lenfol` to `time`, and `fstat` to `status`. -#' - Target is total follow-up time from hospital admission. -NULL - -load_whas = function() { - data = load_dataset("whas", "mlr3proba") - data[, c("id", "yrgrp", "dstat")] = NULL - colnames(data)[2L] = "sexF" - colnames(data)[10:11] = c("time", "status") - - b = as_data_backend(data) - task = TaskSurv$new("whas", b, time = "time", event = "status", - label = "Worcester Heart Attack") - b$hash = task$man = "mlr3proba::mlr_tasks_whas" - - task -} - -#' @title Annual Precipitation Density Task -#' -#' @name mlr_tasks_precip -#' -#' @templateVar type Dens -#' @templateVar task_type density -#' @templateVar id precip -#' @templateVar data precip -#' @template task -#' @template seealso_task -#' -#' @section Preprocessing: -#' - Only the `precip` column is kept in this task. -#' -NULL - -load_precip = function(id = "precip") { - b = as_data_backend(data.table(precip = load_dataset("precip", "datasets", - keep_rownames = TRUE))) - task = TaskDens$new(id, b, label = "Annual Precipitation") - b$hash = task$man = "mlr3proba::mlr_tasks_precip" - task -} - -#' @title Old Faithful Eruptions Density Task -#' -#' @name mlr_tasks_faithful -#' -#' @templateVar type Dens -#' @templateVar task_type density -#' @templateVar id faithful -#' @templateVar data faithful -#' @template task -#' @template seealso_task -#' -#' @section Preprocessing: -#' - Only the `eruptions` column is kept in this task. -#' -NULL - -load_faithful = function(id = "faithful") { - b = as_data_backend(data.table(eruptions = load_dataset("faithful", "datasets", - keep_rownames = TRUE)$eruptions)) - task = TaskDens$new(id, b, label = "Old Faithful Eruptions") - b$hash = task$man = "mlr3proba::mlr_tasks_faithful" - task -} - -register_task("gbsg", load_gbsg) -register_task("pbc", load_pbc) -register_task("mgus", load_mgus) -register_task("veteran", load_veteran) -register_task("rats", load_rats) -register_task("lung", load_lung) -register_task("actg", load_actg) -register_task("gbcs", load_gbcs) -register_task("grace", load_grace) -register_task("whas", load_whas) -register_task("precip", load_precip) -register_task("faithful", load_faithful) diff --git a/R/aaa.R b/R/aaa.R deleted file mode 100644 index 7fcd136e6..000000000 --- a/R/aaa.R +++ /dev/null @@ -1,131 +0,0 @@ -# These elements need to be at the top of the Collate: order! - -mlr3proba_learners = new.env() -mlr3proba_tasks = new.env() -mlr3proba_measures = new.env() -mlr3proba_task_gens = new.env() -mlr3proba_pipeops = new.env() -mlr3proba_graphs = new.env() - -register_learner = function(name, constructor) { - assert_class(constructor, "R6ClassGenerator") - if (name %in% names(mlr3proba_learners)) stopf("learner %s registered twice", name) - mlr3proba_learners[[name]] = constructor -} - -register_task = function(name, constructor) { - if (name %in% names(mlr3proba_tasks)) stopf("task %s registered twice", name) - mlr3proba_tasks[[name]] = constructor -} - -register_measure = function(name, constructor) { - if (name %in% names(mlr3proba_measures)) stopf("measure %s registered twice", name) - mlr3proba_measures[[name]] = constructor -} - -register_task_generator = function(name, constructor) { - if (name %in% names(mlr3proba_task_gens)) stopf("task generator %s registered twice", name) - mlr3proba_task_gens[[name]] = constructor -} - -register_pipeop = function(name, constructor) { - if (name %in% names(mlr3proba_pipeops)) stopf("pipeop %s registered twice", name) - mlr3proba_pipeops[[name]] = constructor -} - -register_graph = function(name, constructor) { - if (name %in% names(mlr3proba_graphs)) stopf("graph %s registered twice", name) - mlr3proba_graphs[[name]] = constructor -} - -register_reflections = function() { - x = utils::getFromNamespace("mlr_reflections", ns = "mlr3") - - # task types - x$task_types = x$task_types[!c("surv", "dens", "cmprsk")] - x$task_types = setkeyv(rbind(x$task_types, rowwise_table( - ~type, ~package, ~task, ~learner, ~prediction, ~prediction_data, ~measure, - "surv", "mlr3proba", "TaskSurv", "LearnerSurv", "PredictionSurv", "PredictionDataSurv", "MeasureSurv", - "dens", "mlr3proba", "TaskDens", "LearnerDens", "PredictionDens", "PredictionDataDens", "MeasureDens", - "cmprsk", "mlr3proba", "TaskCompRisks", "LearnerCompRisks", "PredictionCompRisks", "PredictionDataCompRisks", "MeasureCompRisks" - )), "type") - - # task column roles - x$task_col_roles$surv = x$task_col_roles$regr - x$task_col_roles$cmprsk = x$task_col_roles$regr - x$task_col_roles$dens = c("feature", "target", "label", "order", "group", "weights_learner", "stratum") - x$task_col_roles$classif = unique(c(x$task_col_roles$classif, "original_ids")) # for discrete time - x$task_col_roles$regr = unique(c(x$task_col_roles$regr, "original_ids")) # for pem - - # task properties - x$task_properties$surv = x$task_properties$regr - x$task_properties$cmprsk = x$task_properties$regr - x$task_properties$dens = x$task_properties$regr - - # learner properties - x$learner_properties$surv = x$learner_properties$regr - x$learner_properties$cmprsk = x$learner_properties$regr - x$learner_properties$dens = x$learner_properties$regr - - # learner predict types - x$learner_predict_types$surv = list( - # for survival we all predict types are possible in theory via transformations - crank = c("crank", "lp", "distr", "response"), - distr = c("crank", "lp", "distr", "response"), - lp = c("crank", "lp", "distr", "response"), - response = c("crank", "lp", "distr", "response") - ) - x$learner_predict_types$cmprsk = list(cif = "cif") - x$learner_predict_types$dens = list( - pdf = c("pdf", "cdf", "distr"), - cdf = c("pdf", "cdf", "distr"), - distr = c("pdf", "cdf", "distr") - ) - - # measure - x$measure_properties$surv = x$measure_properties$regr - x$measure_properties$cmprsk = x$measure_properties$regr - x$measure_properties$dens = x$measure_properties$regr - x$default_measures$surv = "surv.cindex" - x$default_measures$cmprsk = "cmprsk.auc" - x$default_measures$dens = "dens.logloss" -} - -register_mlr3 = function() { - # reflections - register_reflections() - - # tasks - mlr_tasks = utils::getFromNamespace("mlr_tasks", ns = "mlr3") - iwalk(as.list(mlr3proba_tasks), function(obj, name) mlr_tasks$add(name, obj)) # nolint - - # task generators - mlr_task_gens = utils::getFromNamespace("mlr_task_generators", ns = "mlr3") - iwalk(as.list(mlr3proba_task_gens), function(obj, name) mlr_task_gens$add(name, obj)) # nolint - - # learners - mlr_learners = utils::getFromNamespace("mlr_learners", ns = "mlr3") - iwalk(as.list(mlr3proba_learners), function(obj, name) mlr_learners$add(name, obj)) # nolint - - # measures - mlr_measures = utils::getFromNamespace("mlr_measures", ns = "mlr3") - iwalk(as.list(mlr3proba_measures), function(obj, name) mlr_measures$add(name, obj)) # nolint -} - -register_mlr3pipelines = function() { - mlr3pipelines::add_class_hierarchy_cache(c("PredictionSurv", "Prediction")) - - # pipeops - mlr_pipeops = utils::getFromNamespace("mlr_pipeops", ns = "mlr3pipelines") - iwalk(as.list(mlr3proba_pipeops), function(obj, name) mlr_pipeops$add(name, obj)) # nolint - - # Breslow PipeOp needs one more argument so we do it manually - mlr_pipeops$add("breslowcompose", PipeOpBreslow, - list(R6Class("Learner", public = list( - id = "breslowcompose", task_type = "surv", predict_types = "lp", - packages = c("mlr3", "mlr3proba"), param_set = ps()))$new())) - - # graphs - mlr_graphs = utils::getFromNamespace("mlr_graphs", ns = "mlr3pipelines") - iwalk(as.list(mlr3proba_graphs), function(obj, name) mlr_graphs$add(name, obj)) # nolint -} diff --git a/R/as_prediction_cmprsk.R b/R/as_prediction_cmprsk.R deleted file mode 100644 index 424e88ff0..000000000 --- a/R/as_prediction_cmprsk.R +++ /dev/null @@ -1,54 +0,0 @@ -#' @title Convert to a Competing Risk Prediction -#' -#' @description -#' Convert object to a [PredictionCompRisks]. -#' -#' @inheritParams mlr3::as_prediction -#' -#' @return [PredictionCompRisks]. -#' @export -#' @examples -#' library(mlr3) -#' task = tsk("pbc") -#' learner = lrn("cmprsk.aalen") -#' learner$train(task) -#' p = learner$predict(task) -#' -#' # convert to a data.table -#' tab = as.data.table(p) -#' -#' # convert back to a Prediction -#' as_prediction_cmprsk(tab) -as_prediction_cmprsk = function(x, ...) { - UseMethod("as_prediction_cmprsk") -} - -#' @rdname as_prediction_cmprsk -#' @export -as_prediction_cmprsk.PredictionCompRisks = function(x, ...) { # nolint - x -} - -#' @rdname as_prediction_cmprsk -#' @export -as_prediction_cmprsk.data.frame = function(x, ...) { - mandatory = c("row_ids", "time", "event") - optional = c("CIF") - assert_names(names(x), must.include = mandatory, subset.of = c(mandatory, optional)) - - cmp_event_ids = unique(unlist(lapply(x$CIF, names))) - cif = if ("CIF" %in% names(x)) { - # Reconstruct the list of matrices (one per competing risk) - mat_list = lapply(cmp_event_ids, function(event_id) { - do.call(rbind, lapply(x$CIF, function(obs_cif) obs_cif[[event_id]])) - }) - set_names(mat_list, cmp_event_ids) - } else NULL - - invoke( - PredictionCompRisks$new, - truth = Surv(x$time, factor(x$event, levels = c("0", sort(cmp_event_ids)))), - cif = cif, - .args = x[, -intersect(c("time", "event", "CIF"), names(x)), with = FALSE] - ) -} diff --git a/R/as_prediction_dens.R b/R/as_prediction_dens.R deleted file mode 100644 index 101b372a0..000000000 --- a/R/as_prediction_dens.R +++ /dev/null @@ -1,51 +0,0 @@ -#' @title Convert to a Density Prediction -#' -#' @description -#' Convert object to a [PredictionDens]. -#' -#' @inheritParams mlr3::as_prediction -#' -#' @return [PredictionDens]. -#' @export -#' @examples -#' library(mlr3) -#' task = tsk("precip") -#' learner = lrn("dens.hist") -#' learner$train(task) -#' p = learner$predict(task) -#' -#' # convert to a data.table -#' tab = as.data.table(p) -#' -#' # convert back to a Prediction -#' as_prediction_dens(tab) -as_prediction_dens = function(x, ...) { - UseMethod("as_prediction_dens") -} - -#' @rdname as_prediction_dens -#' @export -as_prediction_dens.PredictionDens = function(x, ...) { # nolint - x -} - -#' @rdname as_prediction_dens -#' @export -as_prediction_dens.data.frame = function(x, ...) { # nolint - mandatory = c("row_ids") - optional = c("pdf", "cdf", "distr") - - assert_names(names(x), must.include = mandatory) - assert_names(names(x), subset.of = c(mandatory, optional)) - - if ("distr" %in% names(x)) { - distr = x$distr[[1L]] - } else { - distr = NULL - } - - invoke(PredictionDens$new, - distr = distr, - .args = x[, -"distr", with = FALSE], - ) -} diff --git a/R/as_prediction_surv.R b/R/as_prediction_surv.R deleted file mode 100644 index 349974bc1..000000000 --- a/R/as_prediction_surv.R +++ /dev/null @@ -1,63 +0,0 @@ -#' @title Convert to a Survival Prediction -#' -#' @description -#' Convert object to a [PredictionSurv]. -#' -#' @inheritParams mlr3::as_prediction -#' -#' @return [PredictionSurv]. -#' @export -#' @examples -#' library(mlr3) -#' task = tsk("rats") -#' learner = lrn("surv.coxph") -#' learner$train(task) -#' p = learner$predict(task) -#' -#' # convert to a data.table -#' tab = as.data.table(p) -#' -#' # convert back to a Prediction -#' as_prediction_surv(tab) -as_prediction_surv = function(x, ...) { - UseMethod("as_prediction_surv") -} - -#' @rdname as_prediction_surv -#' @export -as_prediction_surv.PredictionSurv = function(x, ...) { # nolint - x -} - -#' @rdname as_prediction_surv -#' @export -as_prediction_surv.data.frame = function(x, ...) { # nolint - mandatory = c("row_ids", "time", "status") - optional = c("crank", "lp", "distr", "response") - assert_names(names(x), must.include = mandatory, subset.of = c(mandatory, optional)) - - distr = if ("distr" %in% names(x)) { - times = names(x$distr[[1L]][[1L]]) - - # Reconstruct the survival matrix from the list of vectors - surv_mat = do.call(rbind, lapply(x$distr, function(l) { matrix(l[[1L]], nrow = 1) })) - set_col_names(surv_mat, times) - } else NULL - - if ("crank" %nin% names(x)) { - if ("lp" %in% names(x)) { - x$crank = x$lp - } else if ("response" %in% names(x)) { - x$crank = -x$response - } else { - x$crank = -apply(1 - distr, 1L, function(.x) sum(c(.x[1L], diff(.x)) * x$time)) - } - } - - invoke( - PredictionSurv$new, - truth = Surv(x$time, x$status), - distr = distr, - .args = x[, -intersect(c("time", "status", "distr"), names(x)), with = FALSE] - ) -} diff --git a/R/as_task_cmprisk.R b/R/as_task_cmprisk.R deleted file mode 100644 index 0fac85a60..000000000 --- a/R/as_task_cmprisk.R +++ /dev/null @@ -1,47 +0,0 @@ -#' @title Convert to a Competing Risks Task -#' -#' @description -#' Convert object to a competing risks task ([TaskCompRisks]). -#' -#' @param x (`any`)\cr -#' Object to convert, e.g. a `data.frame()`. -#' @param ... (`any`)\cr -#' Additional arguments. -#' @export -as_task_cmprsk = function(x, ...) { - UseMethod("as_task_cmprsk") -} - -#' @rdname as_task_cmprsk -#' @param clone (`logical(1)`)\cr -#' If `TRUE`, ensures that the returned object is not the same as the input `x`. -#' @export -as_task_cmprsk.TaskCompRisks = function(x, clone = FALSE, ...) { - if (clone) x$clone() else x -} - -#' @rdname as_task_cmprsk -#' @template param_time -#' @template param_event -#' @param id (`character(1)`)\cr -#' Id for the new task. -#' Defaults to the (deparsed and substituted) name of `x`. -#' @export -as_task_cmprsk.data.frame = function(x, time = "time", event = "event", - id = deparse(substitute(x)), ...) { - assert_data_frame(x, min.rows = 1L, min.cols = 1L, col.names = "unique") - - ii = which(map_lgl(keep(x, is.double), anyInfinite)) - if (length(ii)) { - warningf("Detected columns with unsupported Inf values in data: %s", str_collapse(names(ii))) - } - - TaskCompRisks$new(id = id, backend = x, time = time, event = event, ...) -} - -#' @rdname as_task_cmprsk -#' @export -as_task_cmprsk.DataBackend = function(x, time = "time", event = "event", - id = deparse(substitute(x)), ...) { - TaskCompRisks$new(id = id, backend = x, time = time, event = event, ...) -} diff --git a/R/as_task_dens.R b/R/as_task_dens.R deleted file mode 100644 index 46c619263..000000000 --- a/R/as_task_dens.R +++ /dev/null @@ -1,39 +0,0 @@ -#' @title Convert to a Density Task -#' -#' @description -#' Convert object to a density task ([TaskDens]). -#' -#' @param x (`any`)\cr -#' Object to convert, e.g. a `data.frame()`. -#' @param ... (`any`)\cr -#' Additional arguments. -#' @export -as_task_dens = function(x, ...) { - UseMethod("as_task_dens") -} - - -#' @rdname as_task_dens -#' @param clone (`logical(1)`)\cr -#' If `TRUE`, ensures that the returned object is not the same as the input `x`. -#' @export -as_task_dens.TaskDens = function(x, clone = FALSE, ...) { # nolint - if (clone) x$clone() else x -} - - -#' @rdname as_task_dens -#' @param id (`character(1)`)\cr -#' Id for the new task. -#' Defaults to the (deparsed and substituted) name of `x`. -#' @export -as_task_dens.data.frame = function(x, id = deparse(substitute(x)), ...) { # nolint - TaskDens$new(id = id, backend = x) -} - - -#' @rdname as_task_dens -#' @export -as_task_dens.DataBackend = function(x, id = deparse(substitute(x)), ...) { # nolint - TaskDens$new(id = id, backend = x) -} diff --git a/R/as_task_surv.R b/R/as_task_surv.R deleted file mode 100644 index 9888c2db8..000000000 --- a/R/as_task_surv.R +++ /dev/null @@ -1,54 +0,0 @@ -#' @title Convert to a Survival Task -#' -#' @description -#' Convert object to a survival task ([TaskSurv]). -#' -#' @param x (`any`)\cr -#' Object to convert, e.g. a `data.frame()`. -#' @param ... (`any`)\cr -#' Additional arguments. -#' @export -as_task_surv = function(x, ...) { - UseMethod("as_task_surv") -} - -#' @rdname as_task_surv -#' @param clone (`logical(1)`)\cr -#' If `TRUE`, ensures that the returned object is not the same as the input `x`. -#' @export -as_task_surv.TaskSurv = function(x, clone = FALSE, ...) { - if (clone) x$clone() else x -} - -#' @rdname as_task_surv -#' @template param_time -#' @template param_event -#' @template param_time2 -#' @template param_type -#' @param id (`character(1)`)\cr -#' Id for the new task. -#' Defaults to the (deparsed and substituted) name of `x`. -#' @export -as_task_surv.data.frame = function(x, time = "time", event = "event", time2 = "time2", - type = "right", id = deparse(substitute(x)), ...) { - assert_data_frame(x, min.rows = 1L, min.cols = 1L, col.names = "unique") - - x_dbl = keep(x, is.double) - if (type == "interval") { - # don't check `time` and `time2` columns as they should may have some Infs - x_dbl = x_dbl[setdiff(names(x_dbl), c(time, time2))] - } - - ii = which(map_lgl(x_dbl, anyInfinite)) - if (length(ii)) { - warningf("Detected columns with unsupported Inf values in data: %s", str_collapse(names(ii))) - } - - TaskSurv$new(id = id, backend = x, time = time, event = event, time2 = time2, type = type) -} - -#' @rdname as_task_surv -#' @export -as_task_surv.DataBackend = function(x, time = "time", event = "event", time2, type = "right", id = deparse(substitute(x)), ...) { - TaskSurv$new(id = id, backend = x, time = time, event = event, time2 = time2, type = type) -} diff --git a/R/assertions.R b/R/assertions.R deleted file mode 100644 index cc20cc751..000000000 --- a/R/assertions.R +++ /dev/null @@ -1,89 +0,0 @@ -#' @title Assert survival object -#' @description Asserts `x` is a [survival::Surv] object with added checks -#' @param x Object to check -#' @param len If non-NULL checks object is length `len` -#' @param any.missing If `FALSE` then errors if there are any NAs in `x` -#' @param null.ok If `FALSE` then errors if `x` is NULL, otherwise passes -#' @param .var.name Optional variable name to return if assertion fails -#' @export -assert_surv = function(x, len = NULL, any.missing = TRUE, null.ok = FALSE, .var.name = vname(x)) { # nolint - assert_class(x, "Surv", null.ok = null.ok, .var.name = .var.name) - assert_matrix(x, any.missing = any.missing, nrows = len, null.ok = null.ok, .var.name = .var.name) -} - -#' @title Assert survival matrix -#' -#' @description Asserts if the given input matrix is a (discrete) survival -#' probabilities matrix using \CRANpkg{Rcpp}. -#' The following checks are performed: -#' -#' 1. All values are probabilities, i.e. \eqn{S(t) \in [0,1]} -#' 2. Column names correspond to time-points and should therefore be coercable to -#' `numeric` and increasing -#' 3. Per row/observation, the survival probabilities decrease non-strictly, i.e. -#' \eqn{S(t) \ge S(t+1)} -#' -#' @param x (`matrix()`)\cr -#' A matrix of (predicted) survival probabilities. -#' Rows are observations, columns are (increasing) time points. -#' -#' @return if the assertion fails an error occurs, otherwise `NULL` is returned -#' invisibly. -#' -#' @examples -#' x = matrix(data = c(1,0.6,0.4,0.8,0.8,0.7), nrow = 2, ncol = 3, byrow = TRUE) -#' colnames(x) = c(12, 34, 42) -#' x -#' -#' assert_surv_matrix(x) -#' -#' @export -assert_surv_matrix = function(x) { - times = assert_numeric(as.numeric(colnames(x)), any.missing = FALSE) - - if (is.null(times) || !identical(order(times), seq(ncol(x)))) { - stop("Survival matrix column names must be increasing numeric (time points)") - } - - if (!c_assert_surv(x)) { - stop("Survival probabilities must be (non-strictly) decreasing and between [0, 1]") - } - - invisible(NULL) -} - -#' @title Assert CIF list -#' -#' @description Asserts if the given input list is a list of Cumulative Incidence -#' matrices. -#' -#' @param x (`list()`)\cr -#' A list of CIF matrices, each one with dimensions (observations x times). -#' @param n_rows (`numeric(1)`)\cr -#' Expected number of rows of each matrix element of the input list. -#' @param n_cmp_events (`numeric(1)`)\cr -#' Expected number of competing events which is the number of elements in input -#' CIF list. -#' -#' @return if the assertion fails an error occurs, otherwise `NULL` is returned -#' invisibly. -#' -#' @export -assert_cif_list = function(x, n_rows = NULL, n_cmp_events = NULL) { - # List of matrices, with at least 2 elements/competing risks - assert_list(x, types = "matrix", any.missing = FALSE, min.len = 2, - len = n_cmp_events, names = "named") - for (mat in x) { - # Each element a matrix - assert_matrix(mat, any.missing = FALSE, min.rows = 1, min.cols = 1, col.names = "named") - # check `nrow` == `n_obs` - if (!is.null(n_rows)) { - assert_true(nrow(mat) == n_rows, .var.name = sprintf("CIF matrix has %i rows and not %i (number of observations)", nrow(mat), n_rows)) - } - # check column names => time points - assert_numeric(as.numeric(colnames(mat)), lower = 0, unique = TRUE, sorted = TRUE, - any.missing = FALSE, null.ok = FALSE, .var.name = "Colnames must be coersable to positive, unique, increasing numeric time points") - } - - invisible(NULL) -} diff --git a/R/autoplot.R b/R/autoplot.R deleted file mode 100644 index 1f98f5480..000000000 --- a/R/autoplot.R +++ /dev/null @@ -1,402 +0,0 @@ -#' @title Plot for Survival Tasks -#' -#' @description -#' Generates plots for [mlr3proba::TaskSurv], depending on argument `type`: -#' * `"target"`: Calls [GGally::ggsurv()] on a [survival::survfit()] object. -#' This computes the **Kaplan-Meier survival curve** for the observations if this task. -#' * `"duo"`: Passes data and additional arguments down to [GGally::ggduo()]. -#' `columnsX` is target, `columnsY` is features. -#' * `"pairs"`: Passes data and additional arguments down to -#' [GGally::ggpairs()]. -#' Color is set to target column. -#' -#' @param object ([mlr3proba::TaskSurv]). -#' @param type (`character(1)`):\cr -#' Type of the plot. See above for available choices. -#' @template param_theme -#' @param reverse (`logical()`)\cr -#' If `TRUE` and `type = 'target'`, it plots the Kaplan-Meier curve of the -#' censoring distribution. Default is `FALSE`. -#' @param ... (`any`): -#' Additional arguments. -#' `rhs` is passed down to `$formula` of [mlr3proba::TaskSurv] for stratification -#' for type `"target"`. Other arguments are passed to the respective underlying plot -#' functions. -#' -#' @return [ggplot2::ggplot()] object. -#' -#' @template section_theme -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3viz", "ggplot2"), quietly = TRUE) -#' library(mlr3) -#' library(mlr3viz) -#' library(mlr3proba) -#' library(ggplot2) -#' -#' task = tsk("lung") -#' task$head() -#' -#' autoplot(task) # KM -#' autoplot(task) # KM of the censoring distribution -#' autoplot(task, rhs = "sex") -#' autoplot(task, type = "duo") -#' @export -autoplot.TaskSurv = function(object, type = "target", theme = theme_minimal(), reverse = FALSE, ...) { # nolint - assert_choice(type, choices = c("target", "duo", "pairs"), null.ok = FALSE) - require_namespaces(c("survival", "GGally")) - - switch(type, - "target" = { - ddd = list(...) - - sf = survival::survfit( - object$formula(rhs = ddd$rhs %??% 1, reverse = reverse), - data = object$data() - ) - - plot = GGally::ggsurv(sf, remove_named(ddd, "rhs")) - plot + theme - }, - - "duo" = { - GGally::ggduo(object$data(), - columnsX = object$target_names, - columnsY = object$feature_names, ...) + - theme - }, - - "pairs" = { - GGally::ggpairs(object$data(), ...) + - theme - }, - - stopf("Unknown plot type '%s'", type) - ) -} - -#' @export -plot.TaskSurv = function(x, ...) { - print(autoplot(x, ...)) -} - -#' @title Plot for Density Tasks -#' -#' @description -#' Generates plots for [mlr3proba::TaskDens]. -#' -#' @param object ([mlr3proba::TaskDens]). -#' @param type (`character(1)`): -#' Type of the plot. Available choices: -#' * `"dens"`: histogram density estimator (default) with [ggplot2::geom_histogram()]. -#' * `"freq"`: histogram frequency plot with [ggplot2::geom_histogram()]. -#' * `"overlay"`: histogram with overlaid density plot with [ggplot2::geom_histogram()] and -#' [ggplot2::geom_density()]. -#' * `"freqpoly"`: frequency polygon plot with [ggplot2::geom_freqpoly]. -#' @template param_theme -#' @param ... (`any`): -#' Additional arguments, possibly passed down to the underlying plot functions. -#' @return [ggplot2::ggplot()] object. -#' -#' @template section_theme -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3viz", "ggplot2"), quietly = TRUE) -#' library(mlr3) -#' library(mlr3proba) -#' library(mlr3viz) -#' library(ggplot2) -#' task = tsk("precip") -#' task$head() -#' -#' autoplot(task, bins = 15) -#' autoplot(task, type = "freq", bins = 15) -#' autoplot(task, type = "overlay", bins = 15) -#' autoplot(task, type = "freqpoly", bins = 15) -#' @export -autoplot.TaskDens = function(object, type = "dens", theme = theme_minimal(), ...) { # nolint - assert_choice(type, c("dens", "freq", "overlay", "freqpoly"), null.ok = FALSE) - - p = ggplot(data = object$data(), aes(x = .data[[object$feature_names]]), ...) - - switch(type, - "dens" = { - p + - geom_histogram(aes(y = after_stat(density)), fill = "white", color = "black", ...) + - ylab("Density") + - theme - }, - - "freq" = { - p + geom_histogram(fill = "white", color = "black", ...) + - ylab("Count") + - theme - }, - - "overlay" = { - p + - geom_histogram(aes(y = after_stat(density)), colour = "black", fill = "white", ...) + - geom_density(alpha = 0.2, fill = "#5dadc8") + - ylab("Density") + - theme - }, - - "freqpoly" = { - p + - geom_freqpoly(...) + - theme - }, - - stopf("Unknown plot type '%s'", type) - ) -} - -#' @export -plot.TaskDens = function(x, ...) { - print(autoplot(x, ...)) -} - -#' @title Plot for PredictionSurv -#' -#' @description -#' Generates plots for [mlr3proba::PredictionSurv], depending on argument `type`: -#' -#' - `"calib"` (default): **Calibration plot** comparing the average predicted -#' survival distribution (`Pred`) to a Kaplan-Meier prediction (`KM`), this is -#' *not* a comparison of a stratified `crank` or `lp`. -#' - `"dcalib"`: **Distribution calibration plot**. -#' A model is considered D-calibrated if, for any given quantile `p`, the -#' proportion of observed outcomes occurring before the predicted time quantile, -#' matches `p`. For example, 50% of events should occur before the predicted -#' median survival time (i.e. the time corresponding to a predicted survival -#' probability of 0.5). -#' Good calibration means that the resulting line plot will lie close to the -#' straight line \eqn{y = x}. -#' Note that we impute `NA`s from the predicted quantile function with the -#' maximum observed outcome time. -#' - `"scalib"`: **Smoothed calibration plot** at a specific time point. -#' For a range of probabilities of event occurrence in \eqn{[0,1]} (x-axis), -#' the y-axis has the smoothed observed proportions calculated using hazard -#' regression (model is fitted using the predicted probabilities). -#' See Austin et al. (2020) and [MeasureSurvICI] for more details. -#' Good calibration means that the resulting line plot will lie close to the -#' straight line \eqn{y = x}. -#' - `"isd"`: Plot the predicted **i**ndividual **s**urvival **d**istributions -#' (survival curves) for the test set's observations. -#' -#' @section Notes: -#' -#' 1. `object` must have a `distr` prediction, as all plot `type`s use the -#' predicted survival distribution/matrix. -#' 2. `type = "dcalib"` is drawn a bit differently from Haider et al. (2020), -#' though its still conceptually the same. -#' -#' @param object ([mlr3proba::PredictionSurv]). -#' @param type (`character(1)`) \cr -#' Type of the plot, see Description. -#' @param row_ids (`integer()`) \cr -#' If `type = "isd"`, specific observation ids (from the test set) for which -#' we draw their predicted survival distributions. -#' @param times (`numeric()`) \cr -#' If `type = "calib"` then `times` is the values on the x-axis to plot over. -#' If `NULL`, we use all time points from the predicted survival matrix (`object$data$distr`). -#' @param cuts (`integer(1)`) \cr -#' If `type = "calib"`, number of cuts in \eqn{(0,1)}, which define the bins on -#' the x-axis of the D-calibration plot. Default is `11`. -#' @param time (`numeric(1)`) \cr -#' If `type = "scalib"`, a specific time point at which the smoothed calibration -#' plot is constructed. -#' @template param_theme -#' @param ... (`any`): -#' Additional arguments, currently unused. -#' -#' @template section_theme -#' -#' @references -#' `r format_bib("haider_2020", "austin_2020")` -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3viz", "ggplot2"), quietly = TRUE) -#' library(mlr3) -#' library(mlr3proba) -#' library(mlr3viz) -#' -#' learner = lrn("surv.coxph") -#' task = tsk("gbcs") -#' p = learner$train(task, row_ids = 1:600)$predict(task, row_ids = 601:686) -#' -#' # calibration by comparison of average prediction to Kaplan-Meier -#' autoplot(p) -#' -#' # same as above, use specific time points -#' autoplot(p, times = seq(1, 1000, 5)) -#' -#' # Distribution-calibration (D-Calibration) -#' autoplot(p, type = "dcalib") -#' -#' # Smoothed Calibration (S-Calibration) -#' autoplot(p, type = "scalib", time = 1750) -#' -#' # Predicted survival curves (all observations) -#' autoplot(p, type = "isd") -#' -#' # Predicted survival curves (specific observations) -#' autoplot(p, type = "isd", row_ids = c(601, 651, 686)) -#' -#' @export -autoplot.PredictionSurv = function(object, type = "calib", - times = NULL, row_ids = NULL, cuts = 11L, time = NULL, theme = theme_minimal(), ...) { - assert_choice(type, c("calib", "dcalib", "scalib", "isd"), null.ok = FALSE) - assert("distr" %in% object$predict_types) - assert_number(cuts, na.ok = FALSE, lower = 1L, null.ok = FALSE) - assert_numeric(row_ids, any.missing = FALSE, lower = 1, null.ok = TRUE) - - switch(type, - "calib" = { - # get predicted survival matrix - if (inherits(object$data$distr, "array")) { - surv = object$data$distr - if (length(dim(surv)) == 3L) { - # survival 3d array, extract median - surv = .ext_surv_mat(arr = surv, which.curve = 0.5) - } - } else { - stop("Distribution prediction does not have a survival matrix or array - in the $data$distr slot") - } - # get predicted time points - pred_times = as.numeric(colnames(surv)) - # which time points to use for plotting - times = times %??% pred_times - - # function to request S(t) for points "in-between" - extend_times = getFromNamespace("C_Vec_WeightedDiscreteCdf", ns = "distr6") - # rows => times, cols => obs - surv2 = extend_times(times, pred_times, cdf = t(1 - surv), FALSE, FALSE) - - # average predicted probability across test set observations - pred_surv = rowMeans(surv2) - - # fit a Kaplan-Meier on the test data - km_fit = survival::survfit(object$truth ~ 1) - # make a S(t) one-column matrix (by default same probability for every observation) - km_surv = matrix(km_fit$surv, ncol = 1) # rows => times - # get KM's S(t) at the predicted time points - km_surv = extend_times(times, km_fit$time, cdf = 1 - km_surv, FALSE, FALSE)[,1] - - data = data.table( - x = times, - y = c(km_surv, pred_surv), - Group = rep(c("KM", "Pred"), each = length(times)) - ) - - ggplot(data, aes(x = .data[["x"]], y = .data[["y"]], group = .data[["Group"]], - color = .data[["Group"]])) + - geom_line() + - labs(x = "Time", y = "Average Survival Probability") + - theme + - theme(legend.title = element_blank()) - }, - - "dcalib" = { - p = seq.int(0, 1, length.out = cuts) - true_times = object$truth[, 1L] - q = map_dbl(p, function(.x) { - # time points at which observations had `.x` survival - qi = as.numeric(object$distr$quantile(.x)) - qi[is.na(qi)] = max(true_times) - sum(true_times <= qi) / length(object$row_ids) - }) - - ggplot(data = data.table(p, q), aes(x = p, y = q)) + - geom_bar(stat = "identity", fill = "#5dadc8") + - geom_line(color = "black") + - scale_x_continuous(breaks = p) + - annotate("segment", x = 0, y = 0, xend = 1, yend = 1, alpha = 0.5, - linetype = "dashed") + - labs(x = "Survival Probability (Bins)", - y = "Observed Proportion") + - theme - }, - - "scalib" = { - requireNamespace("polspline") - # test set survival outcome - times = object$truth[, 1L] - status = object$truth[, 2L] - # time point for plotting calibration curve - time = assert_number(time, na.ok = FALSE, lower = 0, null.ok = FALSE) - - # get predicted survival matrix - if (inherits(object$data$distr, "array")) { - surv = object$data$distr - if (length(dim(surv)) == 3L) { - # survival 3d array, extract median - surv = .ext_surv_mat(arr = surv, which.curve = 0.5) - } - } else { - stop("Distribution prediction does not have a survival matrix or array - in the $data$distr slot") - } - - # get cdf at the specified time point - extend_times_cdf = getFromNamespace("C_Vec_WeightedDiscreteCdf", ns = "distr6") - pred_times = as.numeric(colnames(surv)) - cdf = as.vector(extend_times_cdf(time, pred_times, cdf = t(1 - surv), TRUE, FALSE)) - # to avoid log(0) later, same as in paper's Appendix - cdf[cdf == 1] = 0.9999 - - # get the cdf complement (survival) log-log transformed - cll = log(-log(1 - cdf)) - - hare_fit = polspline::hare(data = times, delta = status, cov = as.matrix(cll)) - - # make a wide-range of cdf probabilities - cdf_grid = seq(0.001, 0.999, 0.001) - cll_grid = log(-log(1 - cdf_grid)) - - smoothed_cdf_grid = polspline::phare(q = time, cov = cll_grid, fit = hare_fit) - if (anyNA(smoothed_cdf_grid)) { - warning("`polspline::phare` fit resulted in NaN smoothed probabilities") - } - - pred = obs = NULL - data = data.table(pred = cdf_grid, obs = smoothed_cdf_grid) - - ggplot(data, aes(x = pred, y = obs)) + - geom_line() + - annotate("segment", x = 0, y = 0, xend = 1, yend = 1, alpha = 0.5, - linetype = "dashed") + - labs(x = "Predicted probability", - y = "Observed probability", - title = paste0("t = ", time)) + - theme - }, - - "isd" = { - surv = object$data$distr # assume this is 2d survival matrix - data = data.table( - row_id = as.factor(object$row_ids), - time = rep(as.numeric(colnames(surv)), each = nrow(surv)), - surv_prob = invoke(c, .args = as.data.table(surv)) - ) - - # filter data to specific ids - if (!is.null(row_ids)) { - data = data[get("row_id") %in% row_ids] - } - - p = ggplot(data, aes(x = .data[["time"]], y = .data[["surv_prob"]], - group = .data[["row_id"]], color = .data[["row_id"]])) + - geom_line() + - labs(x = "Time", y = "Survival Probability") + - theme - - # usually too many observations, so don't draw legend - if (is.null(row_ids)) { - p = p + theme(legend.position = "none") - } - - p - }, - - stopf("Unknown plot type '%s'", type) - ) -} diff --git a/R/bibentries.R b/R/bibentries.R deleted file mode 100644 index f3619af81..000000000 --- a/R/bibentries.R +++ /dev/null @@ -1,473 +0,0 @@ -bibentries = c( - breiman_1984 = bibentry("book", - title = "Classification And Regression Trees", - author = "Leo Breiman and Jerome H. Friedman and Richard A. Olshen and Charles J. Stone", - year = 1984, - publisher = "Routledge", - doi = "10.1201/9781315139470" - ), - chambless_2006 = bibentry("article", - title = "Estimation of time-dependent area under the {ROC} curve for long-term risk prediction", - author = "Lloyd E. Chambless and Guoqing Diao", - year = 2006, - journal = "Statistics in Medicine", - publisher = "Wiley", - volume = 25, - number = 20, - pages = "3474--3486", - doi = "10.1002/sim.2299" - ), - cox_1972 = bibentry("article", - title = "Regression Models and Life-Tables", - author = "D. R. Cox", - year = 1972, - month = "jan", - journal = "Journal of the Royal Statistical Society: Series B (Methodological)", - publisher = "Wiley", - volume = 34, - number = 2, - pages = "187--202", - doi = "10.1111/j.2517-6161.1972.tb00899.x" - ), - gonen_2005 = bibentry("article", - title = "Concordance probability and discriminatory power in proportional hazards regression", - author = "Mithat Gonen and Glenn Heller", - year = 2005, - month = "dec", - journal = "Biometrika", - publisher = "Oxford University Press ({OUP})", - volume = 92, - number = 4, - pages = "965--970", - doi = "10.1093/biomet/92.4.965" - ), - graf_1999 = bibentry("article", - title = "Assessment and comparison of prognostic classification schemes for survival data", - author = "Erika Graf and Claudia Schmoor and Willi Sauerbrei and Martin Schumacher", - year = 1999, - month = "sep", - journal = "Statistics in Medicine", - publisher = "Wiley", - volume = 18, - number = "17-18", - pages = "2529--2545", - doi = "10.1002/(sici)1097-0258(19990915/30)18:17/18<2529::aid-sim274>3.0.co;2-5" - ), - harrell_1982 = bibentry("article", - title = "Evaluating the yield of medical tests", - author = "Harrell, Frank E and Califf, Robert M and Pryor, David B and Lee, Kerry L and Rosati, Robert A", - year = 1982, - journal = "Jama", - publisher = "American Medical Association", - volume = 247, - number = 18, - pages = "2543--2546" - ), - hung_2010 = bibentry("article", - title = "Estimation methods for time-dependent AUC models with survival data", - author = "Hung Hung and Chin-Tsang Chiang", - year = 2010, - journal = "The Canadian Journal of Statistics / La Revue Canadienne de Statistique", - publisher = "Statistical Society of Canada, Wiley", - volume = 38, - number = 1, - pages = "8--26", - url = "https://www.jstor.org/stable/27805213" - ), - ishwaran_2008 = bibentry("article", - title = "Random survival forests", - author = "Ishwaran, Hemant and Kogalur, Udaya B and Blackstone, Eugene H and Lauer, Michael S and others", - year = 2008, - journal = "The Annals of applied statistics", - publisher = "Institute of Mathematical Statistics", - volume = 2, - number = 3, - pages = "841--860" - ), - kalbfleisch_2002 = bibentry("book", - title = "The Statistical Analysis of Failure Time Data", - author = "John D. Kalbfleisch and Ross L. Prentice", - year = 2002, - month = "aug", - publisher = "John Wiley & Sons, Inc.", - doi = "10.1002/9781118032985" - ), - kaplan_1958 = bibentry("article", - title = "Nonparametric Estimation from Incomplete Observations", - author = "E. L. Kaplan and Paul Meier", - year = 1958, - month = "jun", - journal = "Journal of the American Statistical Association", - publisher = "Informa {UK} Limited", - volume = 53, - number = 282, - pages = "457--481", - doi = "10.1080/01621459.1958.10501452" - ), - nagelkerke_1991 = bibentry("article", - title = "A note on a general definition of the coefficient of determination", - author = "Nagelkerke, Nico JD and others", - year = 1991, - journal = "Biometrika", - publisher = "Oxford University Press", - volume = 78, - number = 3, - pages = "691--692" - ), - oquigley_2005 = bibentry("article", - title = "Explained randomness in proportional hazards models", - author = "John O'Quigley and Ronghui Xu and Janez Stare", - year = 2005, - journal = "Statistics in Medicine", - publisher = "Wiley", - volume = 24, - number = 3, - pages = "479--489", - doi = "10.1002/sim.1946" - ), - song_2008 = bibentry("article", - title = "A semiparametric approach for the covariate specific ROC curve with survival outcome", - author = "Song, Xiao and Zhou, Xiao-Hua", - year = 2008, - journal = "Statistica Sinica", - volume = 18, - number = 3, - pages = "947--65", - url = "https://www.jstor.org/stable/24308524" - ), - uno_2007 = bibentry("article", - title = "Evaluating Prediction Rules fort-Year Survivors With Censored Regression Models", - author = "Hajime Uno and Tianxi Cai and Lu Tian and L. J Wei", - year = 2007, - month = "jun", - journal = "Journal of the American Statistical Association", - publisher = "Informa {UK} Limited", - volume = 102, - number = 478, - pages = "527--537", - doi = "10.1198/016214507000000149" - ), - uno_2011 = bibentry("article", - title = "On the C-statistics for evaluating overall adequacy of risk prediction procedures with censored survival data", - author = "Hajime Uno and Tianxi Cai and Michael J. Pencina and Ralph B. D'Agostino and L. J. Wei", - year = 2011, - journal = "Statistics in Medicine", - publisher = "Wiley", - pages = "n/a--n/a", - doi = "10.1002/sim.4154" - ), - xu_1999 = bibentry("article", - title = "A R2 type measure of dependence for proportional hazards models", - author = "Ronghui Xu and John O'Quigley", - year = 1999, - month = "jan", - journal = "Journal of Nonparametric Statistics", - publisher = "Informa {UK} Limited", - volume = 12, - number = 1, - pages = "83--107", - doi = "10.1080/10485259908832799" - ), - silverman_1986 = bibentry("book", - address = "London", - author = "Silverman, B. W.", - biburl = "https://www.bibsonomy.org/bibtex/25c3b630fb0a76da55942a77551fde8a2/pierpaolo.pk81", - description = "WSD", - publisher = "Chapman & Hall", - timestamp = "2007-02-27T16:22:14.000+0100", - title = "Density Estimation for Statistics and Data Analysis", - year = 1986 - ), - schemper_2000 = bibentry("article", - author = "Schemper, Michael and Henderson, Robin", - doi = "10.1002/sim.1486", - journal = "Biometrics", - pages = "249--255", - pmid = "12854094", - title = "Predictive Accuracy and Explained Variation in Cox Regression", - volume = "56", - year = "2000" - ), - schmid_2011 = bibentry("article", - author = "Schmid, Matthias and Hielscher, Thomas and Augustin, Thomas and Gefeller, Olaf", - doi = "10.1111/j.1541-0420.2010.01459.x", - journal = "Biometrics", - number = "2", - pages = "524--535", - pmid = "20618308", - title = "A Robust Alternative to the Schemper-Henderson Estimator of Prediction Error", - volume = "67", - year = "2011" - ), - vanhouwelingen_2000 = bibentry("article", - author = "Van Houwelingen, Hans C.", - doi = "10.1002/1097-0258(20001230)19:24<3401::AID-SIM554>3.0.CO;2-2", - journal = "Statistics in Medicine", - number = "24", - pages = "3401--3415", - pmid = "11122504", - title = "Validation, calibration, revision and combination of prognostic survival models", - volume = "19", - year = "2000" - ), - peto_1972 = bibentry("article", - author = "Peto, Richard and Peto, Julian", - journal = "Journal of the Royal Statistical Society: Series A (General)", - number = "2", - pages = "185--198", - publisher = "Wiley Online Library", - title = "Asymptotically efficient rank invariant test procedures", - volume = "135", - year = "1972" - ), - schemper_2009 = bibentry("article", - author = "Schemper, Michael and Wakounig, Samo and Heinze, Georg", - doi = "10.1002/sim.3623", - journal = "Statistics in Medicine", - month = "aug", - number = "19", - pages = "2473--2489", - publisher = "John Wiley & Sons, Ltd", - title = "The estimation of average hazard ratios by weighted Cox regression", - volume = "28", - year = "2009" - ), - vock_2016 = bibentry("article", - author = "Vock, David M and Wolfson, Julian and Bandyopadhyay, Sunayan and Adomavicius, Gediminas and Johnson, Paul E and Vazquez-Benitez, Gabriela and O'Connor, Patrick J", - doi = "https://doi.org/10.1016/j.jbi.2016.03.009", - journal = "Journal of Biomedical Informatics", - pages = "119--131", - title = "Adapting machine learning techniques to censored time-to-event health record data: A general-purpose approach using inverse probability of censoring weighting", - url = "https://www.sciencedirect.com/science/article/pii/S1532046416000496", - volume = "61", - year = "2016" - ), - klein_2003 = bibentry("book", - author = "Klein, John P and Moeschberger, Melvin L", - edition = "2", - isbn = "0387216456", - publisher = "Springer Science & Business Media", - title = "Survival analysis: techniques for censored and truncated data", - year = "2003" - ), - haider_2020 = bibentry("article", - author = "Haider, Humza and Hoehn, Bret and Davis, Sarah and Greiner, Russell", - journal = "Journal of Machine Learning Research", - volume = "21", - number = "85", - pages = "1--63", - title = "Effective Ways to Build and Evaluate Individual Survival Distributions", - url = "https://jmlr.org/papers/v21/18-772.html", - year = "2020" - ), - breslow_1972 = bibentry("article", - author = "Norman Breslow", - title = "Discussion of 'Regression Models and Life-Tables' by D.R. Cox", - journal = "Journal of the Royal Statistical Society: Series B", - year = "1972", - volume = "34", - number = "2", - pages = "216-217" - ), - lin_2007 = bibentry("article", - author = "Lin, D. Y.", - title = "On the Breslow estimator", - journal = "Lifetime Data Analysis", - year = "2007", - volume = "13", - number = "4", - pages = "471-480", - publisher = "Springer", - doi = "10.1007/s10985-007-9048-y" - ), - avati_2020 = bibentry("article", - author = "Avati, Anand and Duan, Tony and Zhou, Sharon and Jung, Kenneth and Shah, Nigam H and Ng, Andrew Y", - title = "Countdown Regression: Sharp and Calibrated Survival Predictions", - journal = "Proceedings of The 35th Uncertainty in Artificial Intelligence Conference", - year = "2020", - volume = "115", - number = "4", - series = "Proceedings of Machine Learning Research", - pages = "145--155", - publisher = "PMLR", - url = "https://proceedings.mlr.press/v115/avati20a.html" - ), - rindt_2022 = bibentry("article", - author = "Rindt, David and Hu, Robert and Steinsaltz, David and Sejdinovic, Dino", - title = "Survival regression with proper scoring rules and monotonic neural networks", - journal = "Proceedings of The 25th International Conference on Artificial Intelligence and Statistics", - year = "2022", - volume = "151", - number = "4", - series = "Proceedings of Machine Learning Research", - pages = "1190--1205", - publisher = "PMLR", - url = "https://proceedings.mlr.press/v151/rindt22a.html" - ), - grambsch_1994 = bibentry("article", - author = "Grambsch, Patricia and Therneau, Terry", - title = "Proportional hazards tests and diagnostics based on weighted residuals", - journal = "Biometrika", - year = "1994", - volume = "81", - number = "3", - pages = "515--526", - doi = "10.1093/biomet/81.3.515", - url = "https://doi.org/10.1093/biomet/81.3.515" - ), - tutz_2016 = bibentry("book", - author = "Tutz, Gerhard and Schmid, Matthias", - title = "Modeling Discrete Time-to-Event Data", - year = "2016", - publisher = "Springer International Publishing", - series = "Springer Series in Statistics", - isbn = "978-3-319-28156-8 978-3-319-28158-2", - url = "http://link.springer.com/10.1007/978-3-319-28158-2" - ), - sonabend_2022 = bibentry("article", - author = "Sonabend, Raphael and Bender, Andreas and Vollmer, Sebastian", - doi = "10.1093/BIOINFORMATICS/BTAC451", - editor = "Lu, Zhiyong", - isbn = "451/6640155", - issn = "1367-4803", - journal = "Bioinformatics", - month = "jul", - title = "Avoiding C-hacking when evaluating survival distribution predictions with discrimination measures", - url = "https://academic.oup.com/bioinformatics/advance-article/doi/10.1093/bioinformatics/btac451/6640155", - year = "2022" - ), - zhao_2016 = bibentry("article", - author = "Zhao, Lihui and Claggett, Brian and Tian, Lu and Uno, Hajime and Pfeffer, Marc A. and Solomon, Scott D. and Trippa, Lorenzo and Wei, L. J.", - doi = "10.1111/BIOM.12384", - issn = "1541-0420", - journal = "Biometrics", - month = "mar", - number = "1", - pages = "215--221", - publisher = "John Wiley & Sons, Ltd", - title = "On the restricted mean survival time curve in survival analysis", - url = "https://onlinelibrary.wiley.com/doi/full/10.1111/biom.12384", - volume = "72", - year = "2016" - ), - norman_2024 = bibentry("article", - author = "Norman, Patrick A and Li, Wanlu and Jiang, Wenyu and Chen, Bingshu E", - title = "deepAFT: A nonlinear accelerated failure time model with artificial neural network", - journal = "Statistics in Medicine", - year = "2024", - publisher = "Wiley Online Library", - doi = "10.1002/sim.10152" - ), - harden_2019 = bibentry("article", - author = "Harden, Jeffrey J. and Kropko, Jonathan", - doi = "10.1017/PSRM.2018.19", - journal = "Political Science Research and Methods", - month = "oct", - number = "4", - pages = "921--928", - publisher = "Cambridge University Press", - title = "Simulating Duration Data for the Cox Model", - volume = "7", - year = "2019" - ), - brilleman_2021 = bibentry("article", - author = "Brilleman, Samuel L. and Wolfe, Rory and Moreno-Betancur, Margarita and Crowther, Michael J.", - doi = "10.18637/JSS.V097.I03", - journal = "Journal of Statistical Software", - month = "jan", - number = "3", - pages = "1--27", - publisher = "American Statistical Association", - title = "Simulating Survival Data Using the simsurv R Package", - volume = "97", - year = "2021" - ), - sonabend_2024 = bibentry("misc", - archivePrefix = "arXiv", - arxivId = "2212.05260", - author = "Sonabend, Raphael and Zobolas, John and Kopper, Philipp and Burk, Lukas and Bender, Andreas", - month = "dec", - title = "Examining properness in the external validation of survival models with squared and logarithmic losses", - url = "https://arxiv.org/abs/2212.05260v3", - year = "2024" - ), - kvamme_2023 = bibentry("article", - author = "Kvamme, Havard and Borgan, Ornulf", - issn = "1533-7928", - journal = "Journal of Machine Learning Research", - number = "2", - pages = "1--26", - title = "The Brier Score under Administrative Censoring: Problems and a Solution", - url = "http://jmlr.org/papers/v24/19-1030.html", - volume = "24", - year = "2023" - ), - austin_2020 = bibentry("article", - author = "Austin, Peter C. and Harrell, Frank E. and van Klaveren, David", - doi = "10.1002/SIM.8570", - issn = "10970258", - journal = "Statistics in Medicine", - month = "sep", - number = "21", - pages = "2714", - pmid = "32548928", - publisher = "John Wiley and Sons Ltd", - title = "Graphical calibration curves and the integrated calibration index (ICI) for survival models", - url = "https://pmc.ncbi.nlm.nih.gov/articles/PMC7497089/", - volume = "39", - year = "2020" - ), - aalen_1978 = bibentry("article", - author = "Aalen, Odd O and Johansen, Soren", - journal = "Scandinavian journal of statistics", - pages = "141--150", - publisher = "JSTOR", - title = "An empirical transition matrix for non-homogeneous Markov chains based on censored observations", - year = "1978" - ), - blanche_2013 = bibentry("article", - author = "Blanche, Paul and Dartigues, Jean Francois and Jacqmin-Gadda, Helene", - journal = "Statistics in Medicine", - pages = "5381--5397", - publisher = "John Wiley & Sons, Ltd", - title = "Estimating and comparing time-dependent areas under receiver operating characteristic curves for censored event times with competing risks", - year = "2013", - doi = "10.1002/SIM.5958", - issn = "1097-0258", - month = "December", - number = "30", - pmid = "24027076", - volume = "32", - url = "https://onlinelibrary.wiley.com/doi/10.1002/sim.5958" - ), - bender_2018 = bibentry("article", - author = "Bender, Andreas and Groll, Andreas and Scheipl, Fabian", - title = "A generalized additive model approach to time-to-event analysis", - journal = "Statistical Modelling", - volume = "18", - number = "3-4", - pages = "299--321", - url = "https://doi.org/10.1177/1471082X17748083", - year = "2018" - ), - heyard_2020 = bibentry("article", - author = "Heyard, Rachel and Timsit, Jean-Francois and Held, Leonhard", - title = "Validation of discrete time-to-event prediction models in the presence of competing risks", - journal = "Biometrical Journal", - volume = "62", - number = "3", - pages = "643--657", - year = "2020", - url = "https://doi.org/10.1002/BIMJ.201800293" - ), - schoop_2011 = bibentry("article", - author = "Schoop, Roland and Beyersmann, Jan and Schumacher, Martin and Binder, Harald", - title = "Quantifying the predictive accuracy of time-to-event models in the presence of competing risks", - journal = "Biometrical Journal", - volume = "53", - number = "1", - pages = "88--112", - year = "2011", - url = "https://doi.org/10.1002/BIMJ.201000073" - ) -) diff --git a/R/breslow.R b/R/breslow.R deleted file mode 100644 index 1ed825658..000000000 --- a/R/breslow.R +++ /dev/null @@ -1,164 +0,0 @@ -#' @title Survival probabilities using Breslow's estimator -#' -#' @description -#' Helper function to compose a survival distribution (or cumulative hazard) -#' from the relative risk predictions (linear predictors, `lp`) of a -#' **proportional hazards** model (e.g. a Cox-type model). -#' -#' @param times (`numeric()`)\cr Vector of times (train set). -#' @param status (`numeric()`)\cr Vector of status indicators (train set). -#' For each observation in the train set, this should be 0 (alive/censored) or -#' 1 (dead). -#' @param lp_train (`numeric()`)\cr Vector of linear predictors (train set). -#' These are the relative score predictions (\eqn{lp = \hat{\beta}X_{train}}) -#' from a proportional hazards model on the train set. -#' @param lp_test (`numeric()`)\cr Vector of linear predictors (test set). -#' These are the relative score predictions (\eqn{lp = \hat{\beta}X_{test}}) -#' from a proportional hazards model on the test set. -#' @param eval_times (`numeric()`)\cr Vector of times to compute survival -#' probabilities. If `NULL` (default), the unique and sorted `times` from the -#' train set will be used, otherwise the unique and sorted `eval_times`. -#' @param type (`character()`)\cr Type of prediction estimates. -#' Default is `surv` which returns the survival probabilities \eqn{S_i(t)} for -#' each test observation \eqn{i}. If `cumhaz`, the function returns the estimated -#' cumulative hazards \eqn{H_i(t)}. -#' -#' @details -#' We estimate the survival probability of individual \eqn{i} (from the test set), -#' at time point \eqn{t} as follows: -#' \deqn{S_i(t) = e^{-H_i(t)} = e^{-\hat{H}_0(t) \times e^{lp_i}}} -#' -#' where: -#' - \eqn{H_i(t)} is the cumulative hazard function for individual \eqn{i} -#' - \eqn{\hat{H}_0(t)} is Breslow's estimator for the **cumulative baseline -#' hazard**. Estimation requires the training set's `times` and `status` as well -#' the risk predictions (`lp_train`). -#' - \eqn{lp_i} is the risk prediction (linear predictor) of individual \eqn{i} -#' on the test set. -#' -#' Breslow's approach uses a non-parametric maximum likelihood estimation of the -#' cumulative baseline hazard function: -#' -#' \deqn{\hat{H}_0(t) = \sum_{i=1}^n{\frac{I(T_i \le t)\delta_i} -#' {\sum\nolimits_{j \in R_i}e^{lp_j}}}} -#' -#' where: -#' - \eqn{t} is the vector of time points (unique and sorted, from the train set) -#' - \eqn{n} is number of events (train set) -#' - \eqn{T} is the vector of event times (train set) -#' - \eqn{\delta} is the status indicator (1 = event or 0 = censored) -#' - \eqn{R_i} is the risk set (number of individuals at risk just before -#' event \eqn{i}) -#' - \eqn{lp_j} is the risk prediction (linear predictor) of individual \eqn{j} -#' (who is part of the risk set \eqn{R_i}) on the train set. -#' -#' We employ **constant interpolation** to estimate the cumulative baseline hazards, -#' extending from the observed unique event times to the specified evaluation -#' times (`eval_times`). -#' Any values falling outside the range of the estimated times are assigned as -#' follows: -#' \deqn{\hat{H}_0(eval\_times < min(t)) = 0} and -#' \deqn{\hat{H}_0(eval\_times > max(t)) = \hat{H}_0(max(t))} -#' -#' Note that in the rare event of `lp` predictions being `Inf` or `-Inf`, the -#' resulting cumulative hazard values become `NaN`, which we substitute with -#' `Inf` (and corresponding survival probabilities take the value of \eqn{0}). -#' -#' For similar implementations, see `gbm::basehaz.gbm()`, `C060::basesurv()` and -#' `xgboost.surv::sgb_bhaz()`. -#' -#' @return a `matrix` (obs x times). Number of columns is equal to `eval_times` -#' and number of rows is equal to the number of test observations (i.e. the -#' length of the `lp_test` vector). Depending on the `type` argument, the matrix -#' can have either survival probabilities (0-1) or cumulative hazard estimates -#' (0-`Inf`). -#' -#' @references -#' `r format_bib("breslow_1972", "lin_2007")` -#' -#' @examples -#' task = tsk("rats") -#' part = partition(task, ratio = 0.8) -#' -#' learner = lrn("surv.coxph") -#' learner$train(task, part$train) -#' p_train = learner$predict(task, part$train) -#' p_test = learner$predict(task, part$test) -#' -#' surv = breslow(times = task$times(part$train), status = task$status(part$train), -#' lp_train = p_train$lp, lp_test = p_test$lp) -#' head(surv) -#' @export -breslow = function(times, status, lp_train, lp_test, eval_times = NULL, type = "surv") { - assert_numeric(times, null.ok = FALSE) - assert_numeric(status, null.ok = FALSE) - assert_numeric(lp_train, null.ok = FALSE) - assert_true(length(times) == length(status)) - assert_true(length(times) == length(lp_train)) - assert_numeric(lp_test, null.ok = FALSE) - assert_numeric(eval_times, null.ok = TRUE) - assert_subset(type, choices = c("surv", "cumhaz"), empty.ok = FALSE) - - # cumulative baseline hazard - cbhaz = .cbhaz_breslow(times = times, status = status, lp = lp_train, - eval_times = eval_times) - - cumhaz = exp(lp_test) %*% t(cbhaz) - - # (Inf * 0) or (0 * Inf) cases - # Inf predicted risk or Inf cumulative baseline hazard - cumhaz[is.nan(cumhaz)] = Inf - - if (type == "surv") { - return(exp(-cumhaz)) - } else { - return(cumhaz) - } -} - -# Breslow's Cumulative Baseline Hazard helper function -# -# Computes the cumulative baseline hazard using Breslow's (1972) estimator. -# Assumes risk predictions are derived from a **proportional hazards** -# regression model. -# -# @param times (`numeric()`)\cr Vector of times (train set). -# @param status (`numeric()`)\cr Vector of status indicators (train set). -# For each observation in the train set, this should be 0 (alive/censored) or -# 1 (dead). -# @param lp (`numeric()`)\cr Vector of linear predictors (train set). -# These are the relative score predictions from a proportional hazards model -# on the train set. -# @param eval_times (`numeric()`)\cr Vector of times to compute the cumulative -# baseline hazard estimations. If `NULL` (default), the unique and sorted -# `times` from the train set will be used, otherwise the unique and sorted -# `eval_times`. -# -# @returns -# A vector of cumulative baseline hazards, one per (increasing) time -# point. The times are added as names in the output vector. -.cbhaz_breslow = function(times, status, lp, eval_times = NULL) { - # unique, sorted event times - event_times = sort(unique(times[status == 1])) - - # baseline (non-cumulative) hazards are first evaluated on the specific `event_times` - bhaz = map_dbl(event_times, function(et) { - sum(times[status == 1] == et) / sum(exp(lp[times >= et])) - }) - - # `eval_times` will be the sorted unique times (not just events) - eval_times = sort(unique(eval_times %??% times)) - if (length(event_times) == 0L) { - # 0 events (training data has only censored observations!) - res = numeric(length(eval_times)) - } else { - # constant interpolation of cumulative hazards across `eval_times` - # rule = 1:2 means return NAs for `xout < x` and max(y) for `xout > x` - # NAs are overwritten with zeros (`yleft = 0`) - res = stats::approx(x = event_times, y = cumsum(bhaz), yleft = 0, - method = "constant", xout = eval_times, rule = 1:2)$y - } - - names(res) = eval_times - res -} diff --git a/R/data.R b/R/data.R deleted file mode 100644 index 729294719..000000000 --- a/R/data.R +++ /dev/null @@ -1,91 +0,0 @@ -#' @title ACTG 320 Clinical Trial Dataset -#' @template dataset -#' @templateVar id actg -#' @format -#' \describe{ -#' \item{id}{Identification Code} -#' \item{time}{Time to AIDS diagnosis or death (days).} -#' \item{censor}{Event indicator. 1 = AIDS defining diagnosis, 0 = Otherwise.} -#' \item{time_d}{Time to death (days)} -#' \item{censor_d}{Event indicator for death (only). 1 = Death, 0 = Otherwise.} -#' \item{tx}{Treatment indicator. 1 = Treatment includes IDV, 0 = Control group.} -#' \item{txgrp}{Treatment group indicator. 1 = ZDV + 3TC. 2 = ZDV + 3TC + IDV. 3 = d4T + 3TC. -#' 4 = d4T + 3TC + IDV.} -#' \item{strat2}{CD4 stratum at screening. 0 = CD4 <= 50. 1 = CD4 > 50.} -#' \item{sexF}{0 = Male. 1 = Female.} -#' \item{raceth}{Race/Ethnicity. 1 = White Non-Hispanic. 2 = Black Non-Hispanic. 3 = Hispanic. -#' 4 = Asian, Pacific Islander. 5 = American Indian, Alaskan Native. 6 = Other/unknown.} -#' \item{ivdrug}{IV drug use history. 1 = Never. 2 = Currently. 3 = Previously.} -#' \item{hemophil}{Hemophiliac. 1 = Yes. 0 = No.} -#' \item{karnof}{Karnofsky Performance Scale. 100 = Normal; no complaint no evidence of disease. -#' 90 = Normal activity possible; minor signs/symptoms of disease. 80 = Normal activity with -#' effort; some signs/symptoms of disease. 70 = Cares for self; normal activity/active work not -#' possible.} -#' \item{cd4}{Baseline CD4 count (Cells/Milliliter).} -#' \item{priorzdv}{Months of prior ZDV use (months).} -#' \item{age}{Age at Enrollment (years).} -#' } -"actg" - -#' @title German Breast Cancer Study (GBCS) Dataset -#' @template dataset -#' @templateVar id gbcs -#' @format -#' \describe{ -#' \item{id}{Identification Code} -#' \item{diagdate}{Date of diagnosis.} -#' \item{recdate}{Date of recurrence free survival.} -#' \item{deathdate}{Date of death.} -#' \item{age}{Age at diagnosis (years).} -#' \item{menopause}{Menopausal status. 1 = Yes, 0 = No.} -#' \item{hormone}{Hormone therapy. 1 = Yes. 0 = No.} -#' \item{size}{Tumor size (mm).} -#' \item{grade}{Tumor grade (1-3).} -#' \item{nodes}{Number of lymph nodes.} -#' \item{prog_recp}{Number of progesterone receptors.} -#' \item{estrg_recp}{Number of estrogen receptors.} -#' \item{rectime}{Time to recurrence (days).} -#' \item{censrec}{Recurrence status. 1 = Recurrence. 0 = Censored.} -#' \item{survtime}{Time to death (days).} -#' \item{censdead}{Censoring status. 1 = Death. 0 = Censored.} -#' } -"gbcs" - -#' @title GRACE 1000 Dataset -#' @template dataset -#' @templateVar id grace -#' @format -#' \describe{ -#' \item{id}{Identification Code} -#' \item{days}{Follow up time.} -#' \item{death}{Censoring indicator. 1 = Death. 0 = Censored.} -#' \item{revasc}{Revascularization Performed. 1 = Yes. 0 = No.} -#' \item{revascdays}{Days to revascularization after admission.} -#' \item{los}{Length of hospital stay (days).} -#' \item{age}{Age at admission (years).} -#' \item{sysbp}{Systolic blood pressure on admission (mm Hg).} -#' \item{stchange}{ST-segment deviation on index ECG. 1 = Yes. 0 = No.} -#' } -"grace" - -#' @title Worcester Heart Attack Study (WHAS) Dataset -#' @template dataset -#' @templateVar id whas -#' @format -#' \describe{ -#' \item{id}{Identification Code} -#' \item{age}{Age (per chart) (years).} -#' \item{sex}{Sex. 0 = Male. 1 = Female.} -#' \item{cpk}{Peak cardiac enzyme (iu).} -#' \item{sho}{Cardiogenic shock complications. 1 = Yes. 0 = No.} -#' \item{chf}{Left heart failure complications. 1 = Yes. 0 = No.} -#' \item{miord}{MI Order. 1 = Recurrent. 0 = First.} -#' \item{mitype}{MI Type. 1 = Q-wave. 2 = Not Q-wave. 3 = Indeterminate.} -#' \item{year}{Cohort year.} -#' \item{yrgrp}{Grouped cohort year.} -#' \item{lenstay}{Days in hospital.} -#' \item{dstat}{Discharge status from hospital. 1 = Dead. 0 = Alive.} -#' \item{lenfol}{Total length of follow-up from hospital admission (days).} -#' \item{fstat}{Status as of last follow-up. 1 = Dead. 0 = Alive.} -#' } -"whas" diff --git a/R/default_fallback.R b/R/default_fallback.R deleted file mode 100644 index c806f6945..000000000 --- a/R/default_fallback.R +++ /dev/null @@ -1,41 +0,0 @@ -#' @export -default_fallback.LearnerSurv = function(learner, ...) { - fallback = lrn("surv.kaplan") - - # set predict type - if (learner$predict_type %nin% fallback$predict_types) { - stopf("Fallback learner '%s' does not support predict type '%s'.", fallback$id, learner$predict_type) - } - - fallback$predict_type = learner$predict_type # should be crank always - - return(fallback) -} - -#' @export -default_fallback.LearnerDens = function(learner, ...) { - fallback = lrn("dens.hist") - - # set predict type - if (learner$predict_type %nin% fallback$predict_types) { - stopf("Fallback learner '%s' does not support predict type '%s'.", fallback$id, learner$predict_type) - } - - fallback$predict_type = learner$predict_type - - return(fallback) -} - -#' @export -default_fallback.LearnerCompRisks = function(learner, ...) { - fallback = lrn("cmprsk.aalen") - - # set predict type - if (learner$predict_type %nin% fallback$predict_types) { - stopf("Fallback learner '%s' does not support predict type '%s'.", fallback$id, learner$predict_type) - } - - fallback$predict_type = learner$predict_type - - return(fallback) -} diff --git a/R/helper_measures.R b/R/helper_measures.R deleted file mode 100644 index 103cd8e5b..000000000 --- a/R/helper_measures.R +++ /dev/null @@ -1,314 +0,0 @@ -# helper functions specific for survival measures - -# SURVIVAL ---- -# S(t)/f(t) ESTIMATION/INTERPOLATION FUNCTIONS - -#' @description -#' Linearly interpolate (and extrapolate) a survival curve at arbitrary time points. -#' @param surv_data `survfit` object or a `list` with 2 elemnts: -#' `surv` (survival probabilities) and corresponding `time` (time points) -#' @param eval_times vector of times (unordered, possibly duplicated) -#' @param method type of interpolation to use - `linear` (default) or `constant` -#' @return interpolated S(t) values -#' @noRd -.interp_surv = function(surv_data, eval_times, method = "linear") { - assert_choice(method, c("linear", "constant")) - - # constant interpolation is easy - if (method == "constant") { - surv = surv_data$surv - times = surv_data$time - - return(stats::approx(x = times, y = surv, xout = eval_times, yleft = 1, - method = "constant", rule = 2)$y) - } - - # remove constant-interpolated values from S(t) - unique_surv_idx = !duplicated(surv_data$surv) - surv = surv_data$surv[unique_surv_idx] # decreasing - times = surv_data$time[unique_surv_idx] # ordered - - # Edge case: constant survival - if (all(surv == surv[1])) { - return(rep(surv[1], length(eval_times))) - } - - # linear interpolation (at least two S(t) values here) - interp_surv = stats::approx(x = times, y = surv, xout = eval_times, - yleft = 1, method = "linear", rule = 2)$y - - # Extrapolate manually if needed - min_time = min(times) - max_time = max(times) - - # Precompute slopes for extrapolation - slope_left = (surv[1L] - 1) / min_time - slope_right = (surv[length(surv)] - surv[length(surv) - 1L]) / (max_time - times[length(times) - 1L]) - - idx_left = eval_times < min_time - idx_right = eval_times > max_time - - # Linear extrapolation considering that S(t = 0) = 1 - if (any(idx_left) && surv[1L] < 1) { - interp_surv[idx_left] = 1 + slope_left * eval_times[idx_left] - } - - # Linear extrapolation using the last time interval - if (any(idx_right) && surv[length(surv)] > 0) { - extrap_value = surv[length(surv)] + slope_right * (eval_times[idx_right] - max_time) - interp_surv[idx_right] = pmax(0, extrap_value) # force S >= 0 - } - - interp_surv -} - -#' @description PDF estimation from a survival curve -#' @param surv_data `survfit` object or a `list` with 2 elemnts: -#' `surv` (survival probabilities) and corresponding `time` (time points) -#' @param eval_times numeric vector (unordered, duplicated allowed) -#' @return numeric vector of density values f(t) -#' @noRd -.interp_pdf = function(surv_data, eval_times) { - # keep all unique sorted times (predicted and requested) for pdf - utimes = sort(unique(c(surv_data$time, eval_times))) - - # Create a mapping of `eval_times` to `utimes` - indx = match(eval_times, utimes) - - # Linearly interpolate survival function (to avoid pdf = 0 problems) - surv = .interp_surv(surv_data, utimes, method = "linear") - - # CDF = 1 - S - cdf = 1 - surv - - # Numerical derivative: f = dF/dt = -dS/dt - dt = diff(utimes) - dF = diff(cdf) - - # Density (finite difference) - dens = dF / dt - - # For timepoints exactly at utimes, align left - dens_full = c(dens[1], dens) # replicate first slope for first point - - # return density at `eval_times`, clip any negatives to 0 - pmax(dens_full[indx], 0) -} - -# Get predicted survival matrix from `PredictionSurv$data$distr` slot (if it exists) -.get_surv_matrix = function(prediction) { - if (inherits(prediction$data$distr, "array")) { - surv = prediction$data$distr - if (length(dim(surv)) == 3L) { - # survival 3d array, extract median - surv = .ext_surv_mat(arr = surv, which.curve = 0.5) - } - } else { - stop("Distribution prediction does not have a survival matrix or array in the `$data$distr` slot") - } - - surv -} - -# Compute per-observation prediction errors for uncensored survival times. -# -# This function returns either squared or absolute differences between predicted -# event times and observed event times, for all uncensored observations. -# Useful for downstream aggregation (e.g., RMSE, MAE), or inspection of -# prediction residuals. -.obs_surv_errors = function(truth, response, method = "squared") { - method = assert_choice(method, c("squared", "abs")) - assert_surv(truth) - - is_event = truth[, 2L] == 1 - if (!any(is_event)) return(NA) # if no events, can't calculate score! - event_times = truth[is_event, 1L] - pred_times = response[is_event] - - errors = switch(method, - squared = (event_times - pred_times)^2, - abs = abs(event_times - pred_times) - ) - - errors -} - -# Wrapper function for Rcpp implementation of Gonen & Heller's concordance index. -# Takes a numeric vector of crank values (e.g., predicted scores) and a weight value -# for ties -.gonen = function(crank, tiex) { - assert_numeric(crank, any.missing = FALSE) - assert_number(tiex) - - c_gonen(sort(crank), tiex) -} - -# Interfaces the Rcpp implementation to compute a weighted concordance index -# for right-censored survival data. -# Supports multiple weighting methods and handles tied predictions via `tiex`. -# Optionally uses Kaplan-Meier estimates from training data for weighting. -.cindex = function(truth, crank, t_max = NULL, - weight_meth = c("I", "G", "G2", "SG", "S"), - tiex = 0.5, train = NULL, eps = 1e-3) { - if (length(unique(crank)) == 1L) { - return(0.5) - } - - assert_surv(truth) - assert_numeric(crank) - if (anyMissing(truth)) { - return(NA_real_) - } - - ord = order(truth[, "time"]) - time = as.double(truth[, "time"])[ord] - status = as.integer(truth[, "status"])[ord] - - weight_meth = match.arg(weight_meth) - - if (weight_meth %in% c("I", "S")) { - cens = matrix(ncol = 2L) - } else { - cens = survival::survfit(Surv(train[, "time"], 1 - train[, "status"]) ~ 1) - cens = matrix(c(cens$time, cens$surv), ncol = 2L) - } - - if (weight_meth == "SG" || weight_meth == "S") { - surv = survival::survfit(train ~ 1) - surv = matrix(c(surv$time, surv$surv), ncol = 2L) - } else { - surv = matrix(ncol = 2L) - } - - if (is.null(t_max)) { - t_max = max(time) + 1 - } - - cens[cens[, 2L] == 0, 2L] = eps - surv[surv[, 2L] == 0, 2L] = eps - - c_concordance(time, status, crank[ord], t_max, weight_meth, cens, surv, tiex) -} - -#' @description -#' Compute the Explained Residual Variation (ERV) of a survival prediction -#' -#' Calculates an R²-like statistic comparing the predictive performance of a learner -#' to a Kaplan–Meier baseline. The measure must support the `ERV` parameter flag. -#' -#' @param measure A `Measure` object (e.g., from `mlr3proba`) that supports the `ERV` parameter. -#' @param prediction A `PredictionSurv` object containing the learner's predictions on a test set. -#' @param task The `TaskSurv` object on which the learner and baseline are evaluated. -#' @param train_set Integer vector of row indices used for training the learner and baseline. -#' -#' @return A numeric value representing the explained residual variation: -#' - `> 0` means the learner outperforms the Kaplan–Meier baseline. -#' - `= 0` means the learner performs the same as the baseline. -#' - `< 0` means the learner performs worse than the baseline. -#' @noRd -.scoring_rule_erv = function(measure, prediction, task, train_set) { - if (is.null(task) || is.null(train_set)) { - stop("'task' and 'train_set' are required if 'ERV' is 'TRUE'") - } - - measure$param_set$set_values(ERV = FALSE) - # compute score for the learner - learner_score = measure$score(prediction, task = task, train_set = train_set) - - # compute score for the baseline (Kaplan-Meier) - # train KM - km = lrn("surv.kaplan")$train(task = task, row_ids = train_set) - # predict KM on the test set - km_pred = km$predict(task, row_ids = prediction$row_ids) - base_score = measure$score(km_pred, task = task, train_set = train_set) - - measure$param_set$set_values(ERV = TRUE) - - # return R^2-like score - # 0 => same as base score, >0 => better than baseline - # <0 => worse than baseline - 1 - (learner_score / base_score) -} - -# Computes the integrated form of a time-dependent score (e.g., Brier score) -# via trapezoidal integration over the available time points. -.integrated_score = function(score, integrated) { - # score is a matrix of BS(i,t) scores - # rows => observations, cols => time points - if (ncol(score) == 1L) { - # Can't integrate over a single time point - integrated = FALSE - } - - if (!integrated) { - # Return the mean score at each time point - return(.col_sums(score)) - } - - times = as.numeric(colnames(score)) - n = length(times) - time_diffs = diff(times) - - # Mean score at each time point (across observations) - scores = .col_sums(score) - - # Apply trapezoidal rule and normalize by the time range - sum(time_diffs * (scores[-n] + scores[-1]) / 2) / (max(times) - min(times)) -} - -# Computes column-wise means of a matrix while ignoring NA, NaN, and infinite values. -.col_sums = function(mat) { - apply(mat, 2L, function(x) { - x = x[is.finite(x)] - mean(x, na.rm = TRUE) - }) -} - -# COMPETING RISKS ---- -#' @description -#' Constant interpolation of CIF matrix to requested evaluation times -#' If all `eval_times` are already present in the predicted time points, no interpolation is done. -#' -#' @param cif_mat A numeric matrix of predicted CIF values (observations × time points). -#' Column names must be the predicted time points. -#' @param eval_times A numeric vector of requested evaluation time points. -#' -#' @return A matrix of interpolated CIF values with rows = observations and -#' columns = `eval_times`. -#' -#' @note Uses the internal `distr6::C_Vec_WeightedDiscreteCdf()` for constant interpolation. -#' @noRd -.interp_cif = function(cif_mat, eval_times) { - # predicted time points - pred_times = as.numeric(colnames(cif_mat)) - if (all(eval_times %in% pred_times)) { - # no interpolation needed - cif_mat[, as.character(eval_times), drop = FALSE] - } else { - extend_times = getFromNamespace("C_Vec_WeightedDiscreteCdf", ns = "distr6") - t(extend_times(eval_times, pred_times, cdf = t(cif_mat), lower = TRUE, FALSE)) - } -} - -# Wrapper around `riskRegression::Score()` -.riskRegr_score = function(mat_list, metric, data, formula, times, cause) { - assert_choice(metric, c("auc", "brier")) - - invoke( - riskRegression::Score, - mat_list, # list with one risk prediction matrix (n_obs x times) - data = data, # (time, event) values for `formula` => n_rows == n_obs - # `Hist(time, event) ~ 1 => cens.model = 'km') or `Hist(time, event) ~ vars` for 'cox' - formula = formula, - summary = base::switch(metric == "brier", "ibs"), # `NULL` otherwise - se.fit = 0L, - metrics = metric, - cens.method = "ipcw", - cens.model = "km", # "cox" if covariates in formula - use.event.times = FALSE, - null.model = FALSE, - contrasts = FALSE, - times = times, - cause = cause - ) -} diff --git a/R/helpers.R b/R/helpers.R deleted file mode 100644 index 6d2f01efe..000000000 --- a/R/helpers.R +++ /dev/null @@ -1,113 +0,0 @@ -# General helper functions - -# used in roxygen templates - adapted from mlr3measures -format_range = function(range) { - l = min(range) - u = max(range) - - str = sprintf( - "%s%s, %s%s", - if (is.finite(l)) "[" else "(", - if (is.finite(l)) c(l, l) else c("-\\infty", "-Inf"), - if (is.finite(u)) c(u, u) else c("\\infty", "Inf"), - if (is.finite(u)) "]" else ")") - paste0("\\eqn{", str[1L], "}{", str[2L], "}") -} - -# used in roxygen templates -format_types = function(types) { - if (length(types) == 0L) "-" else toString(types) -} - -## from `mlr3extralearners` -ordered_features = function(task, learner) { - # the data_prototype is not present when calling the workhorse function, - # as it can blow up memory usage - cols = names(learner$state$data_prototype) %??% learner$state$feature_names - task$data(cols = intersect(cols, task$feature_names)) -} - -## create GraphLearner -create_grlrn = function(gr, graph_learner = FALSE) { - if (graph_learner) { - gr = as_learner(gr) - } - - gr -} - -#' Discretize a survival task using pammtools::as_ped -#' -#' @param task [TaskSurv] survival task -#' @param cut [numeric] vector of cut points or integer indicating number of intervals -#' @param max_time [numeric] maximum time horizon to extend the data (optional) -#' @param reduction_id [character] either "disc" or "pem" -#' -#' @return list with: -#' - `task_{disc|pem}`: the new `TaskClassif` (DiscreteTime) or `TaskRegr` (PEM) -#' - `cut`: cut points used for time discretization -#' @noRd -.discretize_surv_task = function(task, cut = NULL, max_time = NULL, reduction_id = "disc") { - assert_choice(reduction_id, c("disc", "pem")) - assert_true(task$cens_type == "right") - data = task$data() - - col_status = paste0(reduction_id, "_status") - if (col_status %in% names(data)) { - stopf("'%s\' cannot be a column in the input data.", col_status) - } - - time_var = task$target_names[1] - event_var = task$target_names[2] - - # Handle integer cut as number of intervals - if (test_int(cut, lower = 1)) { - cut = seq(0, data[get(event_var) == 1, max(get(time_var))], length.out = cut + 1) - } - - if (!is.null(max_time)) { - assert(max_time > data[get(event_var) == 1, min(get(time_var))], - .var.name = "max_time must be greater than the minimum event time.") - } - - form = formulate(sprintf("Surv(%s, %s)", time_var, event_var), ".") - - long_data = as.data.table( - pammtools::as_ped(data = data, formula = form, cut = cut, max_time = max_time) - ) - setnames(long_data, old = "ped_status", new = col_status) - - # Format outcome for discrete time - if (reduction_id == "disc") { - long_data[[col_status]] = factor(long_data[[col_status]], levels = c("0", "1")) - } - - # Remove internal columns - cols_to_remove = c("tstart", "interval") - if (reduction_id == "disc") { - cols_to_remove = c(cols_to_remove, "offset") - } - long_data[, (cols_to_remove) := NULL] - - # Map row ids - reps = table(long_data$id) - ids = rep(task$row_ids, times = reps) - id = NULL # silence data.table note - long_data[, id := ids] - - # Build task - task_id = paste0(task$id, "_", reduction_id) - if (reduction_id == "disc") { - new_task = TaskClassif$new(id = task_id, backend = long_data, target = col_status, positive = "1") - } else { # pem - new_task = TaskRegr$new(id = task_id, backend = long_data, target = col_status) - new_task$set_col_roles("offset", roles = "offset") - } - new_task$set_col_roles("id", roles = "original_ids") - - list( - task = new_task, - cut = attributes(long_data)$trafo_args$cut - ) -} - diff --git a/R/histogram.R b/R/histogram.R deleted file mode 100644 index 758cd5438..000000000 --- a/R/histogram.R +++ /dev/null @@ -1,65 +0,0 @@ -# Description: Finding the pdf and cdf using histogram using the hist function in R - -# Arguments -# 1. data to estimate the density -# 2. numbin: the size of each bins. Can be a single numberr, vector, a function (see hist) - - -.histogram = function(dat, breaks = "Sturges") { - fit = graphics::hist(x = dat, breaks = breaks, include.lowest = TRUE, plot = FALSE, right = FALSE) - - pdf = function(x) {} # nolint - body(pdf) = substitute({ - pdf = numeric(length(x)) - ind = x >= min(Intervals) & x <= max(Intervals) - pdf[ind] = f[findInterval(x[ind], Intervals, left.open = F, rightmost.closed = T)] - return(pdf) - }, list(f = fit$density, Intervals = fit$breaks)) - - cdf = function(x) {} # nolint - body(cdf) = substitute({ - sapply(x, function(x) .histogram_cdf(val = x, Intervals = Intervals, pdf = pdf, counts = counts)) - }, list(counts = fit$counts, pdf = fit$density, Intervals = fit$breaks)) - - list( - distr = distr6::Distribution$new( - name = "Histogram Estimator", - short_name = "Histogram", - pdf = pdf, cdf = cdf, - type = set6::Reals$new(), - support = set6::Interval$new(min(fit$breaks), max(fit$breaks))), - hist = fit) -} - - - -# Description: Compute the cdf of a histogram using the density and the -# relative intervals. The lower limit of the cdf must -# always be the lowest limit of the histogram. To find the -# cdf of a histogram between the values must compute cdf twice -# and substract. - -# Arguments: -# 1. val: component of Interval which the upper limit belong to -# 2. Intervals: The intervals/break of the histogram. A vector -# 3. Pdf: pdf for each interval. a vector - -.histogram_cdf = function(val, Intervals, pdf, counts) { - if (val < min(Intervals)) { - return(0) - } else if (val >= max(Intervals)) { - return(1) - } else { - ind = findInterval(val, Intervals, left.open = F, rightmost.closed = T) - # finding the index of the breaks for val - part_cdf = cumsum(counts) / sum(counts) - # find the area of the bin up to LHS val - - # if ind == 1, it means that its the first Interval, - if (ind == 1) { - return((val - Intervals[ind]) * pdf[ind]) - } else { - return(part_cdf[ind - 1] + (val - Intervals[ind]) * pdf[ind]) - } - } -} diff --git a/R/mlr3proba-package.R b/R/mlr3proba-package.R deleted file mode 100644 index a6589da00..000000000 --- a/R/mlr3proba-package.R +++ /dev/null @@ -1,5 +0,0 @@ -## usethis namespace: start -#' @useDynLib mlr3proba, .registration = TRUE -## #' @useDynLib mlr3proba, .registration = TRUE -## usethis namespace: end -NULL diff --git a/R/pecs.R b/R/pecs.R deleted file mode 100644 index ebd1c8ea6..000000000 --- a/R/pecs.R +++ /dev/null @@ -1,200 +0,0 @@ -#' @title Prediction Error Curves for PredictionSurv and LearnerSurv -#' @description Methods to plot prediction error curves (pecs) for either a [PredictionSurv] object -#' or a list of trained [LearnerSurv]s. -#' @param x ([PredictionSurv] or `list` of [LearnerSurv]s) -#' @param measure (`character(1)`) \cr -#' Either `"graf"` for [MeasureSurvGraf], or `"logloss"` for [MeasureSurvIntLogloss] -#' @param times (`numeric()`) \cr -#' If provided then either a vector of time-points to evaluate `measure` or a range of -#' time-points. -#' @param n (`integer()`) \cr -#' If `times` is missing or given as a range, then `n` provide number of time-points to evaluate -#' `measure` over. -#' @param eps (`numeric()`) \cr -#' Small error value to prevent errors resulting from a log(0) or 1/0 calculation. -#' Default value is `1e-3`. -#' @param task ([TaskSurv]) -#' @param row_ids (`integer()`) \cr -#' Passed to `Learner$predict`. -#' @param newdata (`data.frame()`) \cr -#' If not missing `Learner$predict_newdata` is called instead of `Learner$predict`. -#' @param train_task ([TaskSurv]) \cr -#' If not NULL then passed to measures for computing estimate of censoring distribution on -#' training data. -#' @param train_set (`numeric()`) \cr -#' If not NULL then passed to measures for computing estimate of censoring distribution on -#' training data. -#' @param ... Additional arguments. -#' -#' @details If `times` and `n` are missing then `measure` is evaluated over all observed time-points -#' from the [PredictionSurv] or [TaskSurv] object. If a range is provided for `times` without `n`, -#' then all time-points between the range are returned. -#' -#' @examplesIf mlr3misc::require_namespaces(c("ggplot2"), quietly = TRUE) -#' # Prediction Error Curves for prediction object -#' task = tsk("lung") -#' learner = lrn("surv.coxph") -#' p = learner$train(task)$predict(task) -#' pecs(p) -#' pecs(p, measure = "logloss", times = seq(0, 1000, 50)) + -#' ggplot2::geom_point() + -#' ggplot2::labs(title = "Prediction Error Curve for Cox PH", y = "ISLL") -#' -#' # Access underlying data -#' x = pecs(p) -#' x$data -#' -#' # Prediction Error Curves for fitted learners -#' learners = lrns(c("surv.kaplan", "surv.coxph")) -#' lapply(learners, function(x) x$train(task)) -#' pecs(learners, task = task, measure = "logloss", times = c(0, 1000), n = 100) + -#' ggplot2::labs(y = "ISLL") -#' pecs(learners, task = task, measure = "graf", times = c(0, 1000), n = 100) + -#' ggplot2::labs(y = "ISBS") -#' @export -pecs = function(x, measure = c("graf", "logloss"), times, n, eps = NULL, ...) { - require_namespaces("ggplot2") - - if (!missing(times)) assert_numeric(times, min.len = 1L) - if (!missing(n)) assert_integerish(n, len = 1L) - - UseMethod("pecs", x) -} - -#' @rdname pecs -#' @export -pecs.list = function(x, measure = c("graf", "logloss"), times, n, eps = 1e-3, task = NULL, - row_ids = NULL, newdata = NULL, train_task = NULL, train_set = NULL, ...) { - - measure = match.arg(measure) - assert_numeric(eps, lower = 0) - assert_learners(x) - - if (any(map_lgl(x, function(y) is.null(y$model)))) { - stopf("`x` must be a list of trained survival learners") - } - assert_class(task, "TaskSurv") - - if (is.null(newdata)) { - p = lapply(x, function(y) y$predict(task = task, row_ids = row_ids)) - } else { - p = lapply(x, function(y) y$predict_newdata(newdata = newdata, task = task)) - } - - true_times = sort(unique(task$truth()[, "time"])) - - times = .pec_times(true_times = true_times, times = times, n = n) - if (length(times) <= 1L) { - stopf( - "Not enough `times` in the true observed times range: %s", - paste0("[", toString(round(range(true_times), 3)), "]") - ) - } - - n = as.integer(!is.null(train_task)) + as.integer(!is.null(train_set)) - if (n == 1L) { - stop("Either 'train_task' and 'train_set' should be passed to measure or neither.") - } else if (n) { - train = train_task$truth(train_set) - } else { - train = NULL - } - - if (measure == "logloss") { - scores = lapply(p, function(y) { - .integrated_score(score = .weighted_survival_score( - loss = "logloss", - truth = task$truth(), - distribution = y$data$distr, - times = times, train = train, eps = eps), - integrated = FALSE) - }) - } else { - scores = lapply(p, function(y) { - .integrated_score(score = .weighted_survival_score( - loss = "graf", - truth = task$truth(), - distribution = y$data$distr, - times = times, train = train, eps = eps), - integrated = FALSE) - }) - } - - times = as.numeric(names(scores[[1L]])) - scores = round(rbindlist(list(scores)), 4) - setnames(scores, map_chr(x, function(y) gsub("surv.", "", y$id, fixed = TRUE))) - scores$time = times - scores = melt(scores, "time", value.name = measure, variable.name = "learner") - - ggplot2::ggplot(data = scores, aes(x = .data[["time"]], color = .data[["learner"]], - y = .data[[measure]])) + - ggplot2::geom_line() -} - -#' @rdname pecs -#' @export -pecs.PredictionSurv = function(x, measure = c("graf", "logloss"), times, n, eps = 1e-3, - train_task = NULL, train_set = NULL, ...) { - - measure = match.arg(measure) - assert_numeric(eps, lower = 0) - - true_times = sort(unique(x$truth[, 1L])) - times = .pec_times(true_times = true_times, times = times, n = n) - - n = as.integer(!is.null(train_task)) + as.integer(!is.null(train_set)) - if (n == 1L) { - stop("Either 'train_task' and 'train_set' should be passed to measure or neither.") - } else if (n) { - train = train_task$truth(train_set) - } else { - train = NULL - } - - if (measure == "logloss") { - scores = data.frame(logloss = .integrated_score( - score = .weighted_survival_score( - loss = "logloss", - truth = x$truth, - distribution = x$data$distr, - times = times, train = train, eps = eps), - integrated = FALSE)) - } else { - scores = data.frame(graf = .integrated_score( - score = .weighted_survival_score( - loss = "graf", - truth = x$truth, - distribution = x$data$distr, - times = times, train = train, eps = eps), - integrated = FALSE)) - } - - scores$time = round(as.numeric(rownames(scores)), 3) - rownames(scores) = NULL - - ggplot2::ggplot(data = scores, aes(x = .data[["time"]], y = .data[[measure]])) + - ggplot2::geom_line() -} - -.pec_times = function(true_times, times, n) { - if (missing(times)) { - if (missing(n)) { - return(true_times) - } else { - return(true_times[seq(1, length(true_times), length.out = n)]) - } - } else { - times[times > max(true_times)] = max(true_times) - times[times < min(true_times)] = min(true_times) - times = sort(unique(times)) - if (length(times) == 2L) { - if (missing(n)) { - return(true_times[true_times >= times[1L] & true_times <= times[2L]]) - } else { - return(seq(times[1L], times[2L], length.out = n)) - } - } else { - return(times) - } - } -} diff --git a/R/pipelines.R b/R/pipelines.R deleted file mode 100644 index d6f51168e..000000000 --- a/R/pipelines.R +++ /dev/null @@ -1,640 +0,0 @@ -#' @template pipeline -#' @templateVar title Survival Prediction Averaging -#' @templateVar pipeop [PipeOpSurvAvg] -#' @templateVar id survaverager -#' -#' @param learners `(list())` \cr -#' List of [LearnerSurv]s to average. -#' @param param_vals `(list())` \cr -#' Parameters, including weights, to pass to [PipeOpSurvAvg]. -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' -#' task = tsk("rats") -#' pipe = ppl( -#' "survaverager", -#' learners = lrns(c("surv.kaplan", "surv.coxph")), -#' param_vals = list(weights = c(0.1, 0.9)), -#' graph_learner = FALSE -#' ) -#' pipe$train(task) -#' pipe$predict(task) -#' } -pipeline_survaverager = function(learners, param_vals = list(), graph_learner = FALSE) { - learners = gunion(map(learners, as_graph)) - po_survavg = po("survavg", param_vals = param_vals) - - gr = learners %>>% po_survavg - create_grlrn(gr, graph_learner) -} - -#' @template pipeline -#' @templateVar title Survival Prediction Averaging -#' @templateVar pipeop [PipeOpSubsample][mlr3pipelines::PipeOpSubsample] and [PipeOpSurvAvg] -#' @templateVar id survbagging -#' @template param_pipeline_learner -#' -#' @param iterations (`integer(1)`)\cr -#' Number of bagging iterations. Defaults to 10. -#' @param frac (`numeric(1)`)\cr -#' Percentage of rows to keep during subsampling. See -#' [PipeOpSubsample][mlr3pipelines::PipeOpSubsample] for more information. Defaults to 0.7. -#' @param avg (`logical(1)`)\cr -#' If `TRUE` (default) predictions are aggregated with [PipeOpSurvAvg], otherwise returned -#' as multiple predictions. Can only be `FALSE` if `graph_learner = FALSE`. -#' @param weights (`numeric()`)\cr -#' Weights for model avering, ignored if `avg = FALSE`. Default is uniform weighting, -#' see [PipeOpSurvAvg]. -#' -#' @details Bagging (Bootstrap AGGregatING) is the process of bootstrapping data and aggregating -#' the final predictions. Bootstrapping splits the data into `B` smaller datasets of a given size -#' and is performed with [PipeOpSubsample][mlr3pipelines::PipeOpSubsample]. Aggregation is -#' the sample mean of deterministic predictions and a -#' [MixtureDistribution][distr6::MixtureDistribution] of distribution predictions. This can be -#' further enhanced by using a weighted average by supplying `weights`. -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' -#' task = tsk("rats") -#' pipe = ppl( -#' "survbagging", -#' learner = lrn("surv.coxph"), -#' iterations = 5, -#' graph_learner = FALSE -#' ) -#' pipe$train(task) -#' pipe$predict(task) -#' } -pipeline_survbagging = function(learner, iterations = 10, frac = 0.7, avg = TRUE, weights = 1, - graph_learner = FALSE) { - - assert_count(iterations) - assert_number(frac, lower = 0, upper = 1) - - graph = as_graph(learner) - subs = po("subsample", param_vals = list(frac = frac)) %>>% graph - subs_repls = pipeline_greplicate(subs, iterations) - - if (!avg) { - return(subs_repls) - } else { - po_survavg = po("survavg", param_vals = list(weights = weights)) - gr = subs_repls %>>% po_survavg - create_grlrn(gr, graph_learner) - } -} - -#' @template pipeline -#' @templateVar title Estimate Survival crank Predict Type -#' @templateVar pipeop [PipeOpCrankCompositor] -#' @templateVar id crankcompositor -#' @template param_pipeline_learner -#' -#' @param method (`character(1)`)\cr -#' Determines what method should be used to produce a continuous ranking from the distribution. -#' Currently only `mort` is supported, which is the sum of the cumulative hazard, also called *expected/ensemble mortality*, see Ishwaran et al. (2008). -#' For more details, see [get_mortality()]. -#' @param overwrite (`logical(1)`)\cr -#' If `FALSE` (default) and the prediction already has a `crank` prediction, then the compositor returns the input prediction unchanged. -#' If `TRUE`, then the `crank` will be overwritten. -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' -#' task = tsk("lung") -#' part = partition(task) -#' -#' # change the crank prediction type of a Cox's model predictions -#' grlrn = ppl( -#' "crankcompositor", -#' learner = lrn("surv.coxph"), -#' method = "mort", -#' overwrite = TRUE, -#' graph_learner = TRUE -#' ) -#' grlrn$train(task, part$train) -#' grlrn$predict(task, part$test) -#' } -pipeline_crankcompositor = function(learner, method = c("mort"), - overwrite = FALSE, graph_learner = FALSE) { - assert_learner(learner, task_type = "surv") - assert_choice(method, choices = c("mort")) - assert_logical(overwrite) - assert_logical(graph_learner) - - pred = as_graph(learner) - - pv = list(method = method, overwrite = overwrite) - compositor = po("crankcompose", param_vals = pv) - - gr = pred %>>% compositor - create_grlrn(gr, graph_learner) -} - -#' @template pipeline -#' @templateVar title Estimate Survival Time/Response Predict Type -#' @templateVar pipeop [PipeOpResponseCompositor] -#' @templateVar id responsecompositor -#' @template param_pipeline_learner -#' -#' @param method (`character(1)`)\cr -#' Determines what method should be used to produce a survival time (response) from the survival distribution. -#' Available methods are `"rmst"` and `"median"`, corresponding to the *restricted mean survival time* and the *median survival time* respectively. -#' @param tau (`numeric(1)`)\cr -#' Determines the time point up to which we calculate the restricted mean survival time (works only for the `"rmst"` method). -#' If `NULL` (default), all the available time points in the predicted survival distribution will be used. -#' @param add_crank (`logical(1)`)\cr -#' If `TRUE` then `crank` predict type will be set as `-response` (as higher survival times correspond to lower risk). -#' Works only if `overwrite` is `TRUE`. -#' @param overwrite (`logical(1)`)\cr -#' If `FALSE` (default) and the prediction already has a `response` prediction, then the compositor returns the input prediction unchanged. -#' If `TRUE`, then the `response` (and the `crank`, if `add_crank` is `TRUE`) will be overwritten. -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' -#' task = tsk("lung") -#' part = partition(task) -#' -#' # add survival time prediction type to the predictions of a Cox model -#' grlrn = ppl( -#' "responsecompositor", -#' learner = lrn("surv.coxph"), -#' method = "rmst", -#' overwrite = TRUE, -#' graph_learner = TRUE -#' ) -#' grlrn$train(task, part$train) -#' grlrn$predict(task, part$test) -#' } -pipeline_responsecompositor = function(learner, method = "rmst", tau = NULL, - add_crank = FALSE, overwrite = FALSE, - graph_learner = FALSE) { - assert_learner(learner, task_type = "surv") - assert_choice(method, choices = c("rmst", "median")) - assert_number(tau, null.ok = TRUE, lower = 0) - assert_logical(add_crank) - assert_logical(overwrite) - assert_logical(graph_learner) - - pred = as_graph(learner) - - pv = list(method = method, tau = tau, add_crank = add_crank, - overwrite = overwrite) - compositor = po("responsecompose", param_vals = pv) - - gr = pred %>>% compositor - create_grlrn(gr, graph_learner) -} - -#' @template pipeline -#' @templateVar title Estimate Survival distr Predict Type -#' @templateVar pipeop [PipeOpDistrCompositor] or [PipeOpBreslow] -#' @templateVar id distrcompositor -#' @template param_pipeline_learner -#' @description -#' `r lifecycle::badge("experimental")` -#' -#' @param estimator (`character(1)`)\cr -#' One of `kaplan` (default), `nelson` or `breslow`, corresponding to the Kaplan-Meier, -#' Nelson-Aalen and [Breslow][breslow] estimators respectively. -#' Used to estimate the baseline survival distribution. -#' @param form (`character(1)`)\cr -#' One of `aft` (default), `ph`, or `po`, corresponding to accelerated failure time, -#' proportional hazards, and proportional odds respectively. -#' Used to determine the form of the composed survival distribution. -#' Ignored if estimator is `breslow`. -#' @param overwrite (`logical(1)`)\cr -#' If `FALSE` (default) then if the `learner` already has a `distr`, the compositor does nothing. -#' If `TRUE` then the `distr` is overwritten by the compositor if -#' already present, which may be required for changing the prediction `distr` from one model form -#' to another. -#' @param scale_lp (`logical(1)`)\cr -#' If `TRUE` and `form` is `"aft"`, the linear predictor scores are scaled before -#' the composition. Experimental option, see more details on [PipeOpDistrCompositor]. -#' Default is `FALSE`. -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3pipelines) -#' -#' # let's change the distribution prediction of Cox (Breslow-based) to an AFT form: -#' task = tsk("rats") -#' grlrn = ppl( -#' "distrcompositor", -#' learner = lrn("surv.coxph"), -#' estimator = "kaplan", -#' form = "aft", -#' overwrite = TRUE, -#' graph_learner = TRUE -#' ) -#' grlrn$train(task) -#' grlrn$predict(task) -#' } -pipeline_distrcompositor = function(learner, estimator = "kaplan", form = "aft", - overwrite = FALSE, scale_lp = FALSE, graph_learner = FALSE) { - # some checks - assert_choice(estimator, choices = c("kaplan", "nelson", "breslow"), null.ok = FALSE) - assert_choice(form, choices = c("aft", "ph", "po"), null.ok = FALSE) - assert_learner(learner, task_type = "surv") - assert_logical(scale_lp, len = 1) - - # make the pipeline Graph object - if (estimator == "breslow") { - gr = as_graph(po("breslowcompose", learner = learner, breslow.overwrite = overwrite)) - } else { - pred = as_graph(learner) - learner_key = paste0("surv.", estimator) - learner_id = paste0("distrcompositor.", estimator) - base = po("learner", lrn(learner_key, id = learner_id)) - - compositor = po("distrcompose", param_vals = list( - form = form, overwrite = overwrite, scale_lp = scale_lp - )) - - gr = gunion(list(base, pred)) %>>% compositor - } - - create_grlrn(gr, graph_learner) -} - -#' @template pipeline -#' @templateVar title Estimate Regression distr Predict Type -#' @templateVar pipeop [PipeOpProbregr] -#' @templateVar id probregr -#' @template param_pipeline_learner_regr -#' @description -#' `r lifecycle::badge("experimental")` -#' -#' @param learner_se `[mlr3::Learner]|[mlr3pipelines::PipeOp]` \cr -#' Optional [LearnerRegr][mlr3::LearnerRegr] with predict_type `se` to estimate the standard -#' error. If left `NULL` then `learner` must have `se` in predict_types. -#' @param dist (`character(1)`)\cr -#' Location-scale distribution to use for composition. -#' Current possibilities are' `"Cauchy", "Gumbel", "Laplace", "Logistic", "Normal", "Uniform"`. Default is `"Uniform"`. -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines", "rpart"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3pipelines) -#' -#' task = tsk("boston_housing") -#' -#' # method 1 - same learner for response and se -#' pipe = ppl( -#' "probregr", -#' learner = lrn("regr.featureless", predict_type = "se"), -#' dist = "Uniform" -#' ) -#' pipe$train(task) -#' pipe$predict(task) -#' -#' # method 2 - different learners for response and se -#' pipe = ppl( -#' "probregr", -#' learner = lrn("regr.rpart"), -#' learner_se = lrn("regr.featureless", predict_type = "se"), -#' dist = "Normal" -#' ) -#' pipe$train(task) -#' pipe$predict(task) -#' } -pipeline_probregr = function(learner, learner_se = NULL, dist = "Uniform", - graph_learner = FALSE) { - - gr = Graph$new()$ - add_pipeop(po("compose_probregr", param_vals = list(dist = dist))) - - if (is.null(learner_se)) { - learner$predict_type = "se" - gr$add_pipeop(po("learner", learner, id = "response_learner"))$ - add_edge("response_learner", "compose_probregr", dst_channel = "input_response")$ - add_edge("response_learner", "compose_probregr", dst_channel = "input_se") - } else { - learner_se$predict_type = "se" - gr$add_pipeop(po("learner", learner, id = "response_learner"))$ - add_pipeop(po("learner", learner_se, id = "se_learner"))$ - add_edge("response_learner", "compose_probregr", dst_channel = "input_response")$ - add_edge("se_learner", "compose_probregr", dst_channel = "input_se") - } - - create_grlrn(gr, graph_learner) -} - -#' @template pipeline -#' @templateVar pipeop [PipeOpTaskSurvClassifDiscTime] and [PipeOpPredClassifSurvDiscTime] -#' @templateVar id survtoclassif_disctime -#' @templateVar title Survival to Classification Reduction using Discrete Time -#' -#' @param learner [LearnerClassif][mlr3::LearnerClassif]\cr -#' Classification learner to fit the transformed [TaskClassif][mlr3::TaskClassif]. -#' `learner` must have `predict_type` of type `"prob"`. -#' @param cut (`numeric()`)\cr -#' Split points, used to partition the data into intervals. -#' If unspecified, all unique event times will be used. -#' If `cut` is a single integer, it will be interpreted as the number of equidistant -#' intervals from 0 until the maximum event time. -#' @param max_time (`numeric(1)`)\cr -#' If cut is unspecified, this will be the last possible event time. -#' All event times after max_time will be administratively censored at max_time. -#' @details -#' The pipeline consists of the following steps: -#' -#' 1. [PipeOpTaskSurvClassifDiscTime] Converts [TaskSurv] to a [TaskClassif][mlr3::TaskClassif]. -#' 2. A [LearnerClassif][mlr3::LearnerClassif] is fit and predicted on the new `TaskClassif`. -#' 3. [PipeOpPredClassifSurvDiscTime] transforms the resulting [PredictionClassif][mlr3::PredictionClassif] to [PredictionSurv]. -#' 4. Optionally: [PipeOpModelMatrix][mlr3pipelines::PipeOpModelMatrix] is used to transform the formula of the task -#' before fitting the learner. -#' -#' @references -#' `r format_bib("tutz_2016")` -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3learners) -#' library(mlr3pipelines) -#' -#' task = tsk("lung") -#' part = partition(task) -#' -#' grlrn = ppl( -#' "survtoclassif_disctime", -#' learner = lrn("classif.log_reg"), -#' cut = 4, # 4 equidistant time intervals -#' graph_learner = TRUE -#' ) -#' grlrn$train(task, row_ids = part$train) -#' grlrn$predict(task, row_ids = part$test) -#' } -#' @export -pipeline_survtoclassif_disctime = function(learner, cut = NULL, max_time = NULL, - graph_learner = FALSE) { - assert_learner(learner, task_type = "classif") - assert_true("prob" %in% learner$predict_types) - - gr = Graph$new()$ - add_pipeop(po("trafotask_survclassif_disctime", cut = cut, max_time = max_time))$ - add_pipeop(po("learner", learner, predict_type = "prob"))$ - add_pipeop(po("nop"))$ - add_pipeop(po("trafopred_classifsurv_disctime"))$ - add_edge(src_id = "trafotask_survclassif_disctime", dst_id = learner$id, src_channel = "output", dst_channel = "input")$ - add_edge(src_id = "trafotask_survclassif_disctime", dst_id = "nop", src_channel = "transformed_data", dst_channel = "input")$ - add_edge(src_id = learner$id, dst_id = "trafopred_classifsurv_disctime", src_channel = "output", dst_channel = "input")$ - add_edge(src_id = "nop", dst_id = "trafopred_classifsurv_disctime", src_channel = "output", dst_channel = "transformed_data") - - create_grlrn(gr, graph_learner) -} - -#' @template pipeline -#' @templateVar pipeop [PipeOpTaskSurvClassifIPCW] and [PipeOpPredClassifSurvIPCW] -#' @templateVar id survtoclassif_IPCW -#' @templateVar title Survival to Classification Reduction using IPCW -#' @section Dictionary: -#' Additional alias id for pipeline construction: -#' ``` -#' ppl("survtoclassif_vock") -#' ``` -#' -#' @param learner [LearnerClassif][mlr3::LearnerClassif]\cr -#' Classification learner to fit the transformed [TaskClassif][mlr3::TaskClassif]. -#' @param tau (`numeric()`)\cr -#' Predefined time point for IPCW. Observations with time larger than \eqn{\tau} are censored. -#' Must be less or equal to the maximum event time. -#' @param eps (`numeric()`)\cr -#' Small value to replace \eqn{G(t) = 0} censoring probabilities to prevent infinite -#' weights (a warning is triggered if this happens). -#' @param graph_learner (`logical(1)`)\cr -#' If `TRUE` returns wraps the [Graph][mlr3pipelines::Graph] as a -#' [GraphLearner][mlr3pipelines::GraphLearner] otherwise (default) returns as a `Graph`. -#' -#' @details -#' The pipeline consists of the following steps: -#' -#' 1. [PipeOpTaskSurvClassifIPCW] Converts [TaskSurv] to a [TaskClassif][mlr3::TaskClassif]. -#' 2. A [LearnerClassif][mlr3::LearnerClassif] is fit and predicted on the new `TaskClassif`. -#' 3. [PipeOpPredClassifSurvIPCW] transforms the resulting [PredictionClassif][mlr3::PredictionClassif] -#' to [PredictionSurv]. -#' -#' @references -#' `r format_bib("vock_2016")` -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3learners) -#' library(mlr3pipelines) -#' -#' task = tsk("lung") -#' part = partition(task) -#' -#' grlrn = ppl( -#' "survtoclassif_IPCW", -#' learner = lrn("classif.rpart"), -#' tau = 500, # Observations after 500 days are censored -#' graph_learner = TRUE -#' ) -#' grlrn$train(task, row_ids = part$train) -#' pred = grlrn$predict(task, row_ids = part$test) -#' pred # crank and distr at the cutoff time point included -#' -#' # score predictions -#' pred$score() # C-index -#' pred$score(msr("surv.brier", times = 500, integrated = FALSE)) # Brier score at tau -#' } -#' @export -pipeline_survtoclassif_IPCW = function(learner, tau = NULL, eps = 1e-3, graph_learner = FALSE) { - assert_learner(learner, task_type = "classif") - assert_true("prob" %in% learner$predict_types) - - gr = Graph$new()$ - add_pipeop(po("trafotask_survclassif_IPCW", tau = tau, eps = eps))$ - add_pipeop(po("learner", learner, predict_type = "prob"))$ - add_pipeop(po("trafopred_classifsurv_IPCW"))$ - add_pipeop(po("nop"))$ - add_edge(src_id = "trafotask_survclassif_IPCW", dst_id = learner$id, src_channel = "output", dst_channel = "input")$ - add_edge(src_id = learner$id, dst_id = "trafopred_classifsurv_IPCW", src_channel = "output", dst_channel = "input")$ - add_edge(src_id = "trafotask_survclassif_IPCW", dst_id = "nop", src_channel = "data", dst_channel = "input")$ - add_edge(src_id = "nop", dst_id = "trafopred_classifsurv_IPCW", src_channel = "output", dst_channel = "data") - - create_grlrn(gr, graph_learner) -} - -#' @name mlr_graphs_survtoregr_pem -#' @title Survival to Poisson Regression Reduction Pipeline -#' @description Wrapper around multiple [PipeOp][mlr3pipelines::PipeOp]s to help in creation -#' of complex survival reduction methods. -#' -#' @param learner [LearnerRegr][mlr3::LearnerRegr]\cr -#' Regression learner to fit the transformed [TaskRegr][mlr3::TaskRegr]. -#' `learner` must be able to handle `offset` and support optimization of a poisson likelihood. -#' @param cut `numeric()`\cr -#' Split points, used to partition the data into intervals. -#' If unspecified, all unique event times will be used. -#' If `cut` is a single integer, it will be interpreted as the number of equidistant -#' intervals from 0 until the maximum event time. -#' @param max_time `numeric(1)`\cr -#' If cut is unspecified, this will be the last possible event time. -#' All event times after max_time will be administratively censored at max_time. -#' @param graph_learner `logical(1)`\cr -#' If `TRUE` returns wraps the [Graph][mlr3pipelines::Graph] as a -#' [GraphLearner][mlr3pipelines::GraphLearner] otherwise (default) returns as a `Graph`. -#' @details -#' A brief mathematical summary of PEMs (see referenced article for more detail): -#' \enumerate{ -#' \item{\strong{PED Transformation: } -#' Survival data is converted into piece-wise exponential data (PED) format. -#' Key elements are: Continuous time is divided into \eqn{j = 1, \ldots, J} intervals for each subject, \eqn{i = 1, \ldots, n}. -#' A status variable in each entry indicates whether an event or censoring occurred during that interval. For any subject, data entries are -#' created only up until the interval including the event time. An offset column is introduced and represents the logarithm of the time a subject spent in any given interval. -#' For more details, see [pammtools::as_ped()]. -#' } -#' \item{\strong{Hazard Estimation with PEM: } -#' The PED transformation combined with the working assumption \deqn{\delta_{ij} \stackrel{\text{iid}}{\sim} Poisson \left( \mu_{ij} = \lambda_{ij} t_{ij} \right),} -#' where \eqn{\delta_{ij}} denotes the event or censoring indicator, allows framing the problem of piecewise constant hazard estimation as a poisson regression with offset. -#' Specifically, we want to estimate \deqn{\lambda(t \mid \mathbf{x}_i) := exp(g(x_{i},t_{j})), \quad \forall t \in [t_{j-1}, t_{j}), \quad i = 1, \dots, n.} -#' \eqn{g(x_{i},t_{j})} is a general function of features \eqn{x} and \eqn{t}, i.e. a learner, and may include non-linearity and complex feature interactions. -#' Two important prerequisites of the learner are its capacity to model a poisson likelihood and accommodate the offset. -#' } -#' \item{\strong{From Piecewise Hazards to Survival Probabilities: } -#' Lastly, the computed hazards are back transformed to survival probabilities via the following identity -#' \deqn{S(t | \mathbf{x}) = \exp \left( - \int_{0}^{t} \lambda(s | \mathbf{x}) \, ds \right) = \exp \left( - \sum_{j = 1}^{J} \lambda(j | \mathbf{x}) d_j\, \right),} -#' where \eqn{d_j} specifies the duration of interval \eqn{j}. -#' } -#' } -#' The previous considerations are reflected in the pipeline which consists of the following steps: -#' \enumerate{ -#' \item [PipeOpTaskSurvRegrPEM] Converts [TaskSurv] to a [TaskRegr][mlr3::TaskRegr]. -#' \item A [LearnerRegr][mlr3::LearnerRegr] is fit and predicted on the new `TaskRegr`. -#' \item [PipeOpPredRegrSurvPEM] transforms the resulting [PredictionRegr][mlr3::PredictionRegr] -#' to [PredictionSurv]. -#' } -#' -#' @return [mlr3pipelines::Graph] or [mlr3pipelines::GraphLearner] -#' @family pipelines -#' -#' @references -#' `r format_bib("bender_2018")` -#' -#' @examplesIf mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners"), quietly = TRUE) -#' \dontrun{ -#' library(mlr3) -#' library(mlr3learners) -#' library(mlr3pipelines) -#' -#' task = tsk("lung") -#' part = partition(task) -#' -#' # typically model formula and features types are extracted from the task -#' learner = lrn("regr.gam", family = "poisson") -#' grlrn = ppl( -#' "survtoregr_pem", -#' learner = learner, -#' graph_learner = TRUE -#' ) -#' grlrn$train(task, row_ids = part$train) -#' grlrn$predict(task, row_ids = part$test) -#' -#' # In some instances special formulas can be specified in the learner -#' learner = lrn("regr.gam", family = "poisson", formula = pem_status ~ s(tend) + s(age) + meal.cal) -#' grlrn = ppl( -#' "survtoregr_pem", -#' learner = learner, -#' graph_learner = TRUE -#' ) -#' grlrn$train(task, row_ids = part$train) -#' grlrn$predict(task, row_ids = part$test) -#' -#' # if necessary encode data before passing to learner with e.g. po("encode"), -#' # po("modelmatrix"), etc. -#' # With po("modelmatrix") feature types and formula can be adjusted at the same time -#' cut = round(seq(0, max(task$data()$time), length.out = 20)) -#' learner = as_learner( -#' po("modelmatrix", formula = ~ as.factor(tend) + .) %>>% -#' lrn("regr.glmnet", family = "poisson", lambda = 0) -#' ) -#' grlrn = ppl( -#' "survtoregr_pem", -#' learner = learner, -#' cut = cut, -#' graph_learner = TRUE -#' ) -#' grlrn$train(task, row_ids = part$train) -#' grlrn$predict(task, row_ids = part$test) -#' -#' # xgboost regression learner -#' learner = as_learner( -#' po("modelmatrix", formula = ~ .) %>>% -#' lrn("regr.xgboost", objective = "count:poisson", nrounds = 100, eta = 0.1) -#' ) -#' -#' grlrn = ppl( -#' "survtoregr_pem", -#' learner = learner, -#' graph_learner = TRUE -#' ) -#' grlrn$train(task, row_ids = part$train) -#' grlrn$predict(task, row_ids = part$test) -#' } -#' @export -pipeline_survtoregr_pem = function(learner, cut = NULL, max_time = NULL, - graph_learner = FALSE) { - assert_learner(learner, task_type = "regr", properties = "offset") - - # check for poisson family in learner - learner_args = learner$param_set$get_values() - char_args = learner_args[vapply(learner_args, is.character, logical(1))] - - if (!any(grepl("poisson", unlist(char_args), ignore.case = TRUE))) { - msg = paste( - "Learner must explicitly support Poisson regression.", - "PEM requires this; please define the objective/family accordingly.", - sep = "\n" - ) - warning(msg) - } - if ("use_pred_offset" %in% learner$param_set$ids()) { - if (learner$param_set$values$use_pred_offset == TRUE) { - learner$param_set$set_values(use_pred_offset = FALSE) - msg = paste( - "Note: 'use_pred_offset' in learner was set to TRUE and has now been changed to FALSE.", - "At prediction time, the PEM Pipeline intentionally omits the offset.", - "Set use_pred_offset to FALSE to avoid this message.", - sep = "\n" - ) - message(msg) - } - } - - gr = Graph$new() - gr$add_pipeop(po("trafotask_survregr_pem", cut = cut, max_time = max_time)) - gr$add_pipeop(po("learner", learner)) - gr$add_pipeop(po("nop")) - gr$add_pipeop(po("trafopred_regrsurv_pem")) - - gr$add_edge(src_id = "trafotask_survregr_pem", dst_id = learner$id, src_channel = "output", dst_channel = "input") - gr$add_edge(src_id = "trafotask_survregr_pem", dst_id = "nop", src_channel = "transformed_data", dst_channel = "input") - gr$add_edge(src_id = learner$id, dst_id = "trafopred_regrsurv_pem", src_channel = "output", dst_channel = "input") - gr$add_edge(src_id = "nop", dst_id = "trafopred_regrsurv_pem", src_channel = "output", dst_channel = "transformed_data") - - create_grlrn(gr, graph_learner) -} - -register_graph("survaverager", pipeline_survaverager) -register_graph("survbagging", pipeline_survbagging) -register_graph("crankcompositor", pipeline_crankcompositor) -register_graph("distrcompositor", pipeline_distrcompositor) -register_graph("responsecompositor", pipeline_responsecompositor) -register_graph("probregr", pipeline_probregr) -register_graph("survtoclassif_disctime", pipeline_survtoclassif_disctime) -register_graph("survtoclassif_IPCW", pipeline_survtoclassif_IPCW) -register_graph("survtoclassif_vock", pipeline_survtoclassif_IPCW) # alias -register_graph("survtoregr_pem", pipeline_survtoregr_pem) diff --git a/R/plot_probregr.R b/R/plot_probregr.R deleted file mode 100644 index 5ec64228b..000000000 --- a/R/plot_probregr.R +++ /dev/null @@ -1,84 +0,0 @@ -#' @title Visualise probabilistic regression distribution predictions -#' @description Plots probability density functions from `n` predicted probability -#' distributions. -#' -#' @param p ([PredictionRegr][mlr3::PredictionRegr]) \cr With at least column `distr`. -#' @param n (`integer(1)`) \cr Number of predictions to plot. -#' @param type (`character(1)`) \cr One of `"point"` (default), `"line"`, `"both"`, `"none"`. -#' @param which_plot (`character(1)`) \cr One of `"random"` (default) or `"top"`. See details. -#' @param rm_zero (`logical(1)`) \cr If `TRUE` (default) does not plot points where `f(x) = 0`. -#' @param ... Unused -#' -#' @details -#' `type`: -#' -#' * `"point"` (default) - Truth plotted as point (truth, predicted_pdf(truth)) -#' * `"line"` - Truth plotted as vertical line intercepting x-axis at the truth. -#' * `"both"` - Plots both the above options. -#' * `"none"` - Truth not plotted (default if `p$truth` is missing). -#' -#' `which_plot`: -#' -#' * "random"` (default) - Random selection of `n` distributions are plotted. -#' * "top"` - Top `n` distributions are plotted. -#' -#' It is unlikely the plot will be interpretable when `n >> 5`. -#' -#' -#' @examples -#' \dontrun{ -#' library(mlr3verse) -#' task = tsk("boston_housing") -#' pipe = as_learner(ppl("probregr", lrn("regr.ranger"), dist = "Normal")) -#' p = pipe$train(task)$predict(task) -#' plot_probregr(p, 10, "point", "top") -#' } -#' @export -plot_probregr = function(p, n, type = c("point", "line", "both", "none"), - which_plot = c("random", "top"), rm_zero = TRUE, ...) { - - which_plot = match.arg(which_plot) - type = match.arg(type) - - if (allMissing(p$truth)) type = "none" - - assert(n <= length(p$row_ids)) - - if (which_plot == "top") { - which = seq(n) - } else if (which_plot == "random") { - which = sort(sample(length(p$row_ids), n)) - } - - d = p$distr[which] - truth = p$truth[which] - - xmin = floor(min(truth) - 3 * max(d$stdev())) - xmax = ceiling(max(truth) + 3 * max(d$stdev())) - x = seq(xmin, xmax, length.out = 100) - - data_pred = suppressWarnings(cbind(x, melt(d$pdf(x)))) - if (rm_zero) data_pred[round(data_pred$value, 6) == 0, ] = NA - variable = factor(d$strprint(), levels = d$strprint()) - data_truth = data.frame(x = truth, variable = variable) - data_points = data.frame(x = truth, y = diag(as.matrix(d$pdf(truth))), variable = variable) - - out = ggplot(data_pred, aes(x = x, y = value, color = variable)) + - geom_line(lwd = 1.2, na.rm = TRUE) + - theme_minimal() + - theme(legend.position = "n") + - labs(x = "x", y = "f(x)") - - if (type %in% c("line", "both")) { - out = out + - geom_vline(aes(xintercept = x, color = variable), data_truth, lwd = 1, lty = 3) - } - - if (type %in% c("point", "both")) { - out = out + - geom_point(aes(x = x, y = y, fill = variable), - color = "black", data_points, size = 3, pch = 23) - } - - out -} diff --git a/R/surv_return.R b/R/surv_return.R deleted file mode 100644 index 88e7dabc5..000000000 --- a/R/surv_return.R +++ /dev/null @@ -1,182 +0,0 @@ -#' @title Get Survival Predict Types -#' -#' @description Internal helper function to easily return the correct survival predict types. -#' -#' @param times (`numeric()`) \cr Vector of survival times. -#' @param surv (`matrix()|array()`)\cr Matrix or array of predicted survival probabilities, rows (1st dimension) are observations, columns (2nd dimension) are times and in the case of an array there should be one more dimension. -#' Number of columns should be equal to length of `times`. -#' In case a `numeric()` vector is provided, it is converted to a single row (one observation) matrix. -#' @param crank (`numeric()`)\cr Relative risk/continuous ranking. -#' Higher value is associated with higher risk. -#' If `NULL` then either set as `-response` if available or `lp` if available (this assumes that the `lp` prediction comes from a PH type model - in case of an AFT model the user should provide `-lp`). -#' In case neither `response` or `lp` are provided, then `crank` is calculated as the sum of the cumulative hazard function (**expected mortality**) derived from the predicted survival function (`surv`), see [get_mortality]. -#' In case `surv` is a 3d array, we use the `which.curve` parameter to decide which survival matrix (index in the 3rd dimension) will be chosen for the calculation of `crank`. -#' @param lp (`numeric()`)\cr Predicted linear predictor, used to impute `crank` if `NULL`. -#' @param response (`numeric()`)\cr Predicted survival time, passed through function without -#' modification. -#' @param which.curve Which curve (3rd dimension) should the `crank` be calculated for, in case `surv` is an `array`? -#' If between (0,1) it is taken as the quantile of the curves otherwise if greater than 1 it is taken as the curve index. -#' It can also be 'mean' and the survival probabilities are averaged across the 3rd dimension. -#' Default value (`NULL`) is the **0.5 quantile** which is the median across the 3rd dimension of the survival array. -#' -#' @references -#' `r format_bib("sonabend_2022")` -#' -#' @examples -#' n = 10 # number of observations -#' k = 50 # time points -#' -#' # Create the matrix with random values between 0 and 1 -#' mat = matrix(runif(n * k, min = 0, max = 1), nrow = n, ncol = k) -#' -#' # transform it to a survival matrix -#' surv_mat = t(apply(mat, 1L, function(row) sort(row, decreasing = TRUE))) -#' -#' # crank is expected mortality, distr is the survival matrix -#' .surv_return(times = 1:k, surv = surv_mat) -#' -#' # if crank is set, it's not overwritten -#' .surv_return(times = 1:k, surv = surv_mat, crank = rnorm(n)) -#' -#' # lp = crank -#' .surv_return(lp = rnorm(n)) -#' -#' # if response is set and no crank, crank = -response -#' .surv_return(response = sample(1:100, n)) -#' -#' # if both are set, they are not overwritten -#' .surv_return(crank = rnorm(n), response = sample(1:100, n)) -#' -#' @export -.surv_return = function(times = NULL, surv = NULL, crank = NULL, lp = NULL, - response = NULL, which.curve = NULL) { - - if (!is.null(surv)) { - if (class(surv)[1L] == "numeric") { - # in case of a vector (one observation) convert to matrix - surv = matrix(surv, nrow = 1L, dimnames = list(NULL, names(surv))) - } - if (class(surv)[1L] == "array" && length(dim(surv)) != 3L) { - stop("3D survival arrays supported only") - } - times = times %??% colnames(surv) - if (length(times) != ncol(surv)) { - stop("'times' must have the same length as the 2nd dimension (columns of 'surv')") - } - colnames(surv) = times - } - - if (is.null(crank)) { - if (!is.null(response)) { - # low survival time = high risk - # high crank = high risk - crank = -response - } else if (!is.null(lp)) { - # assumes PH-type lp where high value = high risk - crank = lp - } else if (!is.null(surv)) { - if (inherits(surv, "matrix")) { - crank = get_mortality(surv) - } else { # array - surv_mat = .ext_surv_mat(surv, which.curve) - crank = get_mortality(surv_mat) - } - } - } - - # TODO: pass the 'which.curve' parameter in PredictionSurv - list( - distr = surv, # matrix or array - crank = crank, - lp = lp, - response = response - ) -} - -# helper function to extract a survival matrix from a 3D survival array -.ext_surv_mat = function(arr, which.curve) { - # if NULL return the 'median' curve (default) - if (is.null(which.curve)) { - return(array(apply(arr, 1:2, stats::quantile, 0.5), c(nrow(arr), ncol(arr)), - dimnames(arr)[1:2])) - } - - # which.curve must be length 1 and either 'mean' or >0 - ok = (length(which.curve) == 1L) && - ((is.character(which.curve) && which.curve == "mean") || - (is.numeric(which.curve) && which.curve > 0)) - if (!ok) { - stop("'which.curve' has to be a numeric between (0,1) or the index of the - 3rd dimension or 'mean'") - } - - if (is.numeric(which.curve) && which.curve > dim(arr)[3L]) { - stopf( - "Length is %s on third dimension but curve '%s' requested, change 'which.curve' parameter.", - dim(arr)[3L], - which.curve - ) - } - - # mean - if (which.curve == "mean") { - apply(arr, 1:2, mean) - # curve chosen based on quantile - } else if (which.curve < 1) { - array(apply(arr, 1:2, stats::quantile, which.curve), c(nrow(arr), ncol(arr)), - dimnames(arr)[1:2]) - # curve chosen based on index - } else { - array(arr[, , which.curve], c(nrow(arr), ncol(arr)), dimnames(arr)[1:2]) - } -} - -#' @title Calculate the expected mortality risks from a survival matrix -#' -#' @description Many methods can be used to reduce a discrete survival -#' distribution prediction (i.e. matrix) to a relative risk / ranking -#' prediction, see Sonabend et al. (2022). -#' -#' This function calculates a relative risk score as the sum of the -#' predicted cumulative hazard function, also called **ensemble/expected mortality**. -#' This risk score can be loosely interpreted as the expected number of deaths for -#' patients with similar characteristics, see Ishwaran et al. (2008) and has no -#' model or survival distribution assumptions. -#' -#' @param x (`matrix()`) \cr A survival matrix where rows are the -#' (predicted) observations and columns the time-points. -#' For more details, see [assert_surv_matrix]. -#' -#' @return a `numeric` vector of the mortality risk scores, one per row of the -#' input survival matrix. -#' -#' @references -#' `r format_bib("sonabend_2022", "ishwaran_2008")` -#' -#' @examples -#' n = 10 # number of observations -#' k = 50 # time points -#' -#' # Create the matrix with random values between 0 and 1 -#' mat = matrix(runif(n * k, min = 0, max = 1), nrow = n, ncol = k) -#' -#' # transform it to a survival matrix -#' surv_mat = t(apply(mat, 1L, function(row) sort(row, decreasing = TRUE))) -#' colnames(surv_mat) = 1:k # time points -#' -#' # get mortality scores (the larger, the more risk) -#' mort = get_mortality(surv_mat) -#' mort -#' -#' @export -get_mortality = function(x) { - assert_surv_matrix(x) - - # H(t) = -log(S(t)) - cumhaz = -log(x) - - # Ignore S(t) = 0 => -log(S(t)) = Inf - cumhaz[is.infinite(cumhaz)] = 0 - - rowSums(cumhaz) -} diff --git a/R/weighted_survival_score.R b/R/weighted_survival_score.R deleted file mode 100644 index 8f071e7bd..000000000 --- a/R/weighted_survival_score.R +++ /dev/null @@ -1,117 +0,0 @@ -## Wrapper function for evaluating (possibly integrated) time-dependent survival scores. -## Interfaces with Rcpp scoring functions (e.g., Schmid, Graf, Integrated LogLoss Score). -## -## Selects appropriate evaluation times based on: -## - Explicit `times` argument, -## - Censoring proportion cutoff `p_max`, or -## - Time horizon `t_max`. -## -## Applies IPCW using training or test censoring distribution. -## -## Returns: matrix of scores with columns => evaluation times. -## Notes: -## - Only one of `times`, `t_max`, `p_max` should be non-NULL. -## - `times`: sorted, unique, positive. -## - `t_max` > 0; `p_max` in [0,1] -.weighted_survival_score = function(loss = "graf", truth, distribution, times = NULL, - t_max = NULL, p_max = NULL, train = NULL, eps = 1e-3) { - # input checks - assert_choice(loss, choices = c("graf", "schmid", "logloss"), null.ok = FALSE) - assert_surv(truth) - assert_numeric(times, lower = 0, sorted = TRUE, unique = TRUE, null.ok = TRUE, - any.missing = FALSE, min.len = 1) - assert_number(t_max, lower = 0, null.ok = TRUE) - assert_number(p_max, lower = 0, upper = 1, null.ok = TRUE) - assert_surv(train, null.ok = TRUE) - assert_number(eps, lower = 0) - - # test set's (times, status) - test_times = truth[, 1L] - test_status = truth[, 2L] - - # Determine time horizon if applicable - tmax_apply = !(is.null(t_max) && is.null(p_max)) - - # **IMPORTANT**: times to calculate the score at => evaluation times - # We start with the unique, sorted, test set time points - eval_times = unique(sort(test_times)) - - if (tmax_apply) { - # one of `t_max`, `p_max` is given - # calculate `t_max` (time horizon) if `p_max` is given - if (!is.null(p_max)) { - surv = survival::survfit(truth ~ 1) - censored_proportion = 1 - (surv$n.risk / surv$n) - indx = which(censored_proportion > p_max) - - t_max = if (length(indx) == 0L) { - tail(surv$time, n = 1L) # no indexes found, use last time point - } else { - surv$time[indx[1L]] # first time exceeding `p_max` censoring - } - } - - # check that `t_max` is within evaluation time range - if (t_max < min(eval_times)) { - stop("`t_max` is smaller than the minimum test time. Please increase value!") - } - - # filter `eval_times` in the test set up to `t_max` - eval_times = eval_times[eval_times <= t_max] - } else { - # `times` can be provided or it is NULL - # If some requested times are outside the evaluation range, warn the user - if (!is.null(times)) { - outside_range = any(times < min(eval_times) | times > max(eval_times)) - if (outside_range) { - warning("Some requested times are outside the evaluation range (sorted unique test times).") - } - } - - # Use requested times if given, else default to `eval_times` - eval_times = times %??% eval_times - } - - # Get the CDF matrix [times x observations] - if (inherits(distribution, "Distribution")) { - cdf = as.matrix(distribution$cdf(eval_times)) - } - else if (inherits(distribution, "array")) { - if (length(dim(distribution)) == 3L) { - # survival 3d array, extract median - surv_mat = .ext_surv_mat(arr = distribution, which.curve = 0.5) - } else { # survival 2d array - surv_mat = distribution - } - - # `pred_times`: time points for which we have S(t) - pred_times = as.numeric(colnames(surv_mat)) - extend_times = getFromNamespace("C_Vec_WeightedDiscreteCdf", ns = "distr6") - # `eval_times`: time points for which we want S(t) - cdf = extend_times(eval_times, pred_times, cdf = t(1 - surv_mat), TRUE, FALSE) - rownames(cdf) = eval_times - } - - # check: CDF matrix is [times x test obs] - assert_matrix(cdf, nrows = length(eval_times), ncols = length(test_times), any.missing = FALSE) - - # Compute score matrix [obs x times], by using: - # - S^2 or (1-S)^2 for Graf score (ISBS) - # - S or (1-S) for Schmid score (ISS) - # - log(S) or log(1-S) for integrated LogLoss score (ISLL) - score = switch(loss, - logloss = c_score_logloss(test_times, eval_times, cdf, eps = eps), - schmid = c_score_graf_schmid(test_times, eval_times, cdf, power = 1), - graf = c_score_graf_schmid(test_times, eval_times, cdf, power = 2) - ) - - # Compute G(t): KM estimate of the censoring distribution from train or test set - cens_source = if (is.null(train)) truth else train - cens_fit = survival::survfit(Surv(cens_source[, "time"], 1 - cens_source[, "status"]) ~ 1) - cens = matrix(c(cens_fit$time, cens_fit$surv), ncol = 2L) - - ipcw_score = c_apply_ipcw_weights(score, eval_times, truth, cens, eps) - colnames(ipcw_score) = eval_times - - ipcw_score -} diff --git a/R/zzz.R b/R/zzz.R deleted file mode 100644 index 703ad031e..000000000 --- a/R/zzz.R +++ /dev/null @@ -1,89 +0,0 @@ -#' @importFrom Rcpp sourceCpp -#' @useDynLib mlr3proba -NULL - -# nolint start -#' @import checkmate -#' @import data.table -#' @import distr6 -#' @import ggplot2 -#' @import mlr3 -#' @import mlr3misc -#' @import paradox -#' @importFrom R6 R6Class -#' @importFrom utils data head tail -#' @importFrom stats model.matrix model.frame sd predict density median quantile setNames -#' @importFrom survival Surv -#' @importFrom utils getFromNamespace -#' @importFrom mlr3pipelines po as_graph %>>% pipeline_greplicate gunion Graph ppl -"_PACKAGE" -# nolint end - -# to silence RCMD check -utils::globalVariables(c( - "ShortName", "ClassName", "missing", "task", "value", "variable", "y" -)) - -.onLoad = function(libname, pkgname) { - register_mlr3() - if (requireNamespace("mlr3pipelines", quietly = TRUE)) { - register_mlr3pipelines() - } - - setHook(packageEvent("mlr3", "onLoad"), function(...) register_mlr3(), action = "append") - setHook(packageEvent("mlr3pipelines", "onLoad"), function(...) register_mlr3pipelines(), - action = "append") -} - -.onUnload = function(libpath) { - event = packageEvent("mlr3", "onLoad") - hooks = getHook(event) - pkgname = map_chr(hooks[-1L], function(x) environment(x)$pkgname) - setHook(event, hooks[pkgname != "mlr3proba"], action = "replace") - - event = packageEvent("mlr3pipelines", "onLoad") - hooks = getHook(event) - pkgname = map_chr(hooks[-1L], function(x) environment(x)$pkgname) - setHook(event, hooks[pkgname != "mlr3proba"], action = "replace") - - # unregister - unregister_reflections() - walk(names(mlr3proba_learners), function(nm) mlr_learners$remove(nm)) - walk(names(mlr3proba_tasks), function(nm) mlr_tasks$remove(nm)) - walk(names(mlr3proba_measures), function(nm) mlr_measures$remove(nm)) - walk(names(mlr3proba_task_gens), function(nm) mlr_task_generators$remove(nm)) - walk(names(mlr3proba_pipeops), function(nm) mlr3pipelines::mlr_pipeops$remove(nm)) - # manually remove breslow pipeop - mlr3pipelines::mlr_pipeops$remove("breslowcompose") - walk(names(mlr3proba_graphs), function(nm) mlr3pipelines::mlr_graphs$remove(nm)) - - library.dynam.unload("mlr3proba", libpath) -} - -unregister_reflections = function() { - x = utils::getFromNamespace("mlr_reflections", ns = "mlr3") - - # task - package = NULL # silence data.table notes - x$task_types = x$task_types[package != "mlr3proba"] - x$task_col_roles$surv = NULL - x$task_col_roles$dens = NULL - x$task_col_roles$classif = setdiff(x$task_col_roles$classif, "original_ids") - x$task_col_roles$regr = setdiff(x$task_col_roles$regr, 'original_ids') - x$task_properties$surv = NULL - x$task_properties$dens = NULL - - # learner - x$learner_properties$surv = NULL - x$learner_properties$dens = NULL - x$learner_predict_types$surv = NULL - x$learner_predict_types$dens = NULL - - # measure - x$measure_properties$surv = NULL - x$measure_properties$dens = NULL - x$default_measures$surv = NULL - x$default_measures$dens = NULL -} - -leanify_package() diff --git a/README.Rmd b/README.Rmd deleted file mode 100644 index 0657c8dcb..000000000 --- a/README.Rmd +++ /dev/null @@ -1,124 +0,0 @@ ---- -output: github_document ---- - -```{r, include = FALSE} -knitr::opts_chunk$set( - cache = FALSE, - collapse = TRUE, - comment = "#>" -) -``` - -# mlr3proba - -Probabilistic Supervised Learning for **[mlr3](https://github.com/mlr-org/mlr3/)** ([website](https://mlr3proba.mlr-org.com/)). - - -[![R-CMD-check](https://github.com/mlr-org/mlr3proba/actions/workflows/r-cmd-check.yml/badge.svg)](https://github.com/mlr-org/mlr3proba/actions/workflows/r-cmd-check.yml) -[![runiverse](https://mlr-org.r-universe.dev/badges/mlr3proba)](https://mlr-org.r-universe.dev/mlr3proba) -[![GitHub Discussions](https://img.shields.io/github/discussions/mlr-org/mlr3proba?logo=github&label=Discussions%20Q%26A&color=FFE600)](https://github.com/mlr-org/mlr3proba/discussions) -[![Article](https://img.shields.io/badge/Article-10.1093%2Fbioinformatics%2Fbtab039-brightgreen)](https://doi.org/10.1093/bioinformatics/btab039) -[![StackOverflow](https://img.shields.io/badge/stackoverflow-mlr3-orange.svg?color=pink)](https://stackoverflow.com/questions/tagged/mlr3) -[![Mattermost](https://img.shields.io/badge/chat-mattermost-orange.svg?color=pink)](https://lmmisld-lmu-stats-slds.srv.mwn.de/mlr_invite/) - - -## What is mlr3proba? - -`mlr3proba` is a machine learning toolkit for **probabilistic supervised learning** within the **[mlr3](https://github.com/mlr-org/mlr3)** ecosystem. - -It currently supports: - -1. **Predictive survival analysis**: with support for right-censoring single-event and competing risks. -2. **Unconditional distribution estimation**: including density and unconditional survival estimation. -3. **Probabilistic supervised regression**: Supervised regression with a predictive distribution as the return type. - -The survival analysis part is considered in a mature state, the rest are in early stages of development. - -## Feature Overview - -Key features of `mlr3proba` focus on survival analysis and are: - -- Task frameworks for survival analysis (`TaskSurv`, `TaskCompetingRisks`) -- A comprehensive **selection of survival learners** (mostly via - [mlr3extralearners](https://github.com/mlr-org/mlr3extralearners/)) -- A unified `$train()`/`$predict()` model interface to any probabilistic predictive model (frequentist, Bayesian, Deep Learning, or other) -- Use of the **[distr6](https://github.com/alan-turing-institute/distr6)** interface for the survival probability distribution prediction -- A comprehensive selection of **measures** for evaluating the performance of survival learners, with respect to prognostic index (continuous rank) prediction, and probabilistic (distribution) prediction -- Basic **ML pipeline building** integrated with **[mlr3pipelines](https://github.com/mlr-org/mlr3pipelines)** (e.g. transform prediction types) -- **Reduction strategies** to transform survival to classification/regression problems - -## Installation - -`mlr3proba` is not currently on CRAN. -Please follow one of the two following methods to install it: - -### R-universe - -Install the latest released version: -```r -install.packages("mlr3proba", repos = "https://mlr-org.r-universe.dev") -``` - -### GitHub - -Install the latest development version: -```r -remotes::install_github("mlr-org/mlr3proba") -``` - -## Learners - -- [Core learners](https://mlr3proba.mlr-org.com/reference/index.html#survival-learners) are implemented in `mlr3proba` and include the Kaplan-Meier Estimator, the Cox Proportional Hazards model, the Survival Tree learner and the Aalen-Johansen estimator for competing risks. -- In [mlr3extralearners](https://github.com/mlr-org/mlr3extralearners) we have interfaced several more advanced ML learners. -Use the [interactive search table](https://mlr-org.com/learners.html) to search for the available survival learners and see the [learner status page](https://mlr3extralearners.mlr-org.com/articles/learner_status.html) for their live status. - -## Measures - -For density estimation and probabilistic regression only the **log-loss** is currently implemented. -For competing risk, see list [here](https://mlr3proba.mlr-org.com/reference/index.html#competing-risk-measures). -For survival analysis, see list [here](https://mlr3proba.mlr-org.com/reference/index.html#survival-measures). - -Some commonly used measures for right-censored single-event tasks are the following: - -| ID | Measure | Package | Category | Prediction Type -| :--| :------ | :------ | :------ | :------- | -| [surv.dcalib](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.dcalib.html) | D-Calibration | `mlr3proba` | Calibration | `distr` -| [surv.calib_index](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.calib_index.html) | One-point Calibration | `mlr3proba` | Calibration | `distr` -| [surv.cindex](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.cindex.html) | Concordance Index | `mlr3proba` | Discrimination | `crank` -| [surv.uno_auc](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.uno_auc.html) | Uno's AUC | `survAUC` | Discrimination | `lp` -| [surv.graf](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.graf.html) | Integrated Brier Score | `mlr3proba` | Scoring Rule | `distr` -| [surv.rcll](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.rcll.html) | Right-Censored Log loss | `mlr3proba` | Scoring Rule | `distr` -| [surv.intlogloss](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.intlogloss.html) | Integrated Log-Likelihood | `mlr3proba` | Scoring Rule | `distr` - -## Bugs, Questions, Feedback - -**mlr3proba** is a free and open source software project that encourages participation and feedback. -If you have any issues, questions, suggestions or feedback, please do not hesitate to open an -"issue" about it on the [GitHub page](https://github.com/mlr-org/mlr3proba/issues)\! - -In case of problems / bugs, it is often helpful if you provide a "minimum working example" using [reprex](https://reprex.tidyverse.org/) that showcases the behavior. - -## Similar Projects - -Predecessors to this package are previous instances of survival modelling in **[mlr](https://github.com/mlr-org/mlr)**. -The **[skpro](https://github.com/alan-turing-institute/skpro)** package in the python/scikit-learn ecosystem follows a similar interface for probabilistic supervised learning and is an architectural predecessor. -Several packages exist which allow probabilistic predictive modelling with a Bayesian model specific general interface, such as **[rjags](https://CRAN.R-project.org/package=rjags)** and **[stan](https://github.com/stan-dev/rstan)**. -For implementation of a few survival models and measures, a central package is **[survival](https://github.com/therneau/survival)**. -There does not appear to be a package that provides an architectural framework for distribution/density estimation, see **[this list](https://vita.had.co.nz/papers/density-estimation.pdf)** for a review of density estimation packages in `R`. - -## Acknowledgements - -Several people contributed to the building of `mlr3proba`. -Firstly, thanks to Michel Lang for writing `mlr3survival`. -Several learners and measures implemented in `mlr3proba`, as well as the prediction, task, and measure surv objects, were written initially in `mlr3survival` before being absorbed into `mlr3proba`. -Secondly thanks to Franz Kiraly for major contributions towards the design of the proba-specific parts of the package, including compositors and predict types. -Also for mathematical contributions towards the scoring rules implemented in the package. -Finally thanks to Bernd Bischl and the rest of the mlr core team for building `mlr3` and for many conversations about the design of `mlr3proba`. - -## Citing mlr3proba - -If you use mlr3proba, please cite our [Bioinformatics article](https://doi.org/10.1093/bioinformatics/btab039): -```{r echo = FALSE, comment = ""} -toBibtex(citation("mlr3proba")) -``` diff --git a/README.md b/README.md deleted file mode 100644 index b9c9763b7..000000000 --- a/README.md +++ /dev/null @@ -1,172 +0,0 @@ - -# mlr3proba - -Probabilistic Supervised Learning for -**[mlr3](https://github.com/mlr-org/mlr3/)** -([website](https://mlr3proba.mlr-org.com/)). - - - -[![R-CMD-check](https://github.com/mlr-org/mlr3proba/actions/workflows/r-cmd-check.yml/badge.svg)](https://github.com/mlr-org/mlr3proba/actions/workflows/r-cmd-check.yml) -[![runiverse](https://mlr-org.r-universe.dev/badges/mlr3proba)](https://mlr-org.r-universe.dev/mlr3proba) -[![GitHub -Discussions](https://img.shields.io/github/discussions/mlr-org/mlr3proba?logo=github&label=Discussions%20Q%26A&color=FFE600)](https://github.com/mlr-org/mlr3proba/discussions) -[![Article](https://img.shields.io/badge/Article-10.1093%2Fbioinformatics%2Fbtab039-brightgreen)](https://doi.org/10.1093/bioinformatics/btab039) -[![StackOverflow](https://img.shields.io/badge/stackoverflow-mlr3-orange.svg?color=pink)](https://stackoverflow.com/questions/tagged/mlr3) -[![Mattermost](https://img.shields.io/badge/chat-mattermost-orange.svg?color=pink)](https://lmmisld-lmu-stats-slds.srv.mwn.de/mlr_invite/) - - -## What is mlr3proba? - -`mlr3proba` is a machine learning toolkit for **probabilistic supervised -learning** within the **[mlr3](https://github.com/mlr-org/mlr3)** -ecosystem. - -It currently supports: - -1. **Predictive survival analysis**: with support for right-censoring - single-event and competing risks. -2. **Unconditional distribution estimation**: including density and - unconditional survival estimation. -3. **Probabilistic supervised regression**: Supervised regression with - a predictive distribution as the return type. - -The survival analysis part is considered in a mature state, the rest are -in early stages of development. - -## Feature Overview - -Key features of `mlr3proba` focus on survival analysis and are: - -- Task frameworks for survival analysis (`TaskSurv`, - `TaskCompetingRisks`) -- A comprehensive **selection of survival learners** (mostly via - [mlr3extralearners](https://github.com/mlr-org/mlr3extralearners/)) -- A unified `$train()`/`$predict()` model interface to any probabilistic - predictive model (frequentist, Bayesian, Deep Learning, or other) -- Use of the - **[distr6](https://github.com/alan-turing-institute/distr6)** - interface for the survival probability distribution prediction -- A comprehensive selection of **measures** for evaluating the - performance of survival learners, with respect to prognostic index - (continuous rank) prediction, and probabilistic (distribution) - prediction -- Basic **ML pipeline building** integrated with - **[mlr3pipelines](https://github.com/mlr-org/mlr3pipelines)** - (e.g. transform prediction types) -- **Reduction strategies** to transform survival to - classification/regression problems - -## Installation - -`mlr3proba` is not currently on CRAN. Please follow one of the two -following methods to install it: - -### R-universe - -Install the latest released version: - -``` r -install.packages("mlr3proba", repos = "https://mlr-org.r-universe.dev") -``` - -### GitHub - -Install the latest development version: - -``` r -remotes::install_github("mlr-org/mlr3proba") -``` - -## Learners - -- [Core - learners](https://mlr3proba.mlr-org.com/reference/index.html#survival-learners) - are implemented in `mlr3proba` and include the Kaplan-Meier Estimator, - the Cox Proportional Hazards model, the Survival Tree learner and the - Aalen-Johansen estimator for competing risks. -- In [mlr3extralearners](https://github.com/mlr-org/mlr3extralearners) - we have interfaced several more advanced ML learners. Use the - [interactive search table](https://mlr-org.com/learners.html) to - search for the available survival learners and see the [learner status - page](https://mlr3extralearners.mlr-org.com/articles/learner_status.html) - for their live status. - -## Measures - -For density estimation and probabilistic regression only the -**log-loss** is currently implemented. For competing risk, see list -[here](https://mlr3proba.mlr-org.com/reference/index.html#competing-risk-measures). -For survival analysis, see list -[here](https://mlr3proba.mlr-org.com/reference/index.html#survival-measures). - -Some commonly used measures for right-censored single-event tasks are -the following: - -| ID | Measure | Package | Category | Prediction Type | -|:---|:---|:---|:---|:---| -| [surv.dcalib](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.dcalib.html) | D-Calibration | `mlr3proba` | Calibration | `distr` | -| [surv.calib_index](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.calib_index.html) | One-point Calibration | `mlr3proba` | Calibration | `distr` | -| [surv.cindex](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.cindex.html) | Concordance Index | `mlr3proba` | Discrimination | `crank` | -| [surv.uno_auc](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.uno_auc.html) | Uno’s AUC | `survAUC` | Discrimination | `lp` | -| [surv.graf](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.graf.html) | Integrated Brier Score | `mlr3proba` | Scoring Rule | `distr` | -| [surv.rcll](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.rcll.html) | Right-Censored Log loss | `mlr3proba` | Scoring Rule | `distr` | -| [surv.intlogloss](https://mlr3proba.mlr-org.com/reference/mlr_measures_surv.intlogloss.html) | Integrated Log-Likelihood | `mlr3proba` | Scoring Rule | `distr` | - -## Bugs, Questions, Feedback - -**mlr3proba** is a free and open source software project that encourages -participation and feedback. If you have any issues, questions, -suggestions or feedback, please do not hesitate to open an “issue” about -it on the [GitHub page](https://github.com/mlr-org/mlr3proba/issues)! - -In case of problems / bugs, it is often helpful if you provide a -“minimum working example” using [reprex](https://reprex.tidyverse.org/) -that showcases the behavior. - -## Similar Projects - -Predecessors to this package are previous instances of survival -modelling in **[mlr](https://github.com/mlr-org/mlr)**. The -**[skpro](https://github.com/alan-turing-institute/skpro)** package in -the python/scikit-learn ecosystem follows a similar interface for -probabilistic supervised learning and is an architectural predecessor. -Several packages exist which allow probabilistic predictive modelling -with a Bayesian model specific general interface, such as -**[rjags](https://CRAN.R-project.org/package=rjags)** and -**[stan](https://github.com/stan-dev/rstan)**. For implementation of a -few survival models and measures, a central package is -**[survival](https://github.com/therneau/survival)**. There does not -appear to be a package that provides an architectural framework for -distribution/density estimation, see **[this -list](https://vita.had.co.nz/papers/density-estimation.pdf)** for a -review of density estimation packages in `R`. - -## Acknowledgements - -Several people contributed to the building of `mlr3proba`. Firstly, -thanks to Michel Lang for writing `mlr3survival`. Several learners and -measures implemented in `mlr3proba`, as well as the prediction, task, -and measure surv objects, were written initially in `mlr3survival` -before being absorbed into `mlr3proba`. Secondly thanks to Franz Kiraly -for major contributions towards the design of the proba-specific parts -of the package, including compositors and predict types. Also for -mathematical contributions towards the scoring rules implemented in the -package. Finally thanks to Bernd Bischl and the rest of the mlr core -team for building `mlr3` and for many conversations about the design of -`mlr3proba`. - -## Citing mlr3proba - -If you use mlr3proba, please cite our [Bioinformatics -article](https://doi.org/10.1093/bioinformatics/btab039): - - @Article{, - title = {mlr3proba: An R Package for Machine Learning in Survival Analysis}, - author = {Raphael Sonabend and Franz J Király and Andreas Bender and Bernd Bischl and Michel Lang}, - journal = {Bioinformatics}, - month = {02}, - year = {2021}, - doi = {10.1093/bioinformatics/btab039}, - issn = {1367-4803}, - } diff --git a/pkgdown/favicon/apple-touch-icon-120x120.png b/apple-touch-icon-120x120.png similarity index 100% rename from pkgdown/favicon/apple-touch-icon-120x120.png rename to apple-touch-icon-120x120.png diff --git a/pkgdown/favicon/apple-touch-icon-152x152.png b/apple-touch-icon-152x152.png similarity index 100% rename from pkgdown/favicon/apple-touch-icon-152x152.png rename to apple-touch-icon-152x152.png diff --git a/pkgdown/favicon/apple-touch-icon-180x180.png b/apple-touch-icon-180x180.png similarity index 100% rename from pkgdown/favicon/apple-touch-icon-180x180.png rename to apple-touch-icon-180x180.png diff --git a/pkgdown/favicon/apple-touch-icon-60x60.png b/apple-touch-icon-60x60.png similarity index 100% rename from pkgdown/favicon/apple-touch-icon-60x60.png rename to apple-touch-icon-60x60.png diff --git a/pkgdown/favicon/apple-touch-icon-76x76.png b/apple-touch-icon-76x76.png similarity index 100% rename from pkgdown/favicon/apple-touch-icon-76x76.png rename to apple-touch-icon-76x76.png diff --git a/pkgdown/favicon/apple-touch-icon.png b/apple-touch-icon.png similarity index 100% rename from pkgdown/favicon/apple-touch-icon.png rename to apple-touch-icon.png diff --git a/authors.html b/authors.html new file mode 100644 index 000000000..6875cafe6 --- /dev/null +++ b/authors.html @@ -0,0 +1,146 @@ + +Authors and Citation • mlr3proba + Skip to contents + + +
+
+
+ +
+

Authors

+ +
  • +

    Raphael Sonabend. Author. +

    +
  • +
  • +

    Franz Kiraly. Author. +

    +
  • +
  • +

    Michel Lang. Author. +

    +
  • +
  • +

    Nurul Ain Toha. Contributor. +

    +
  • +
  • +

    Andreas Bender. Contributor. +

    +
  • +
  • +

    John Zobolas. Maintainer, author. +

    +
  • +
  • +

    Lukas Burk. Contributor. +

    +
  • +
  • +

    Philip Studener. Author. +

    +
  • +
  • +

    Maximilian Mücke. Contributor. +

    +
  • +
  • +

    Lee Xingzhuo Li. Contributor. +

    +
  • +
  • +

    Markus Goeswein. Contributor. +

    +
  • +
+ +
+

Citation

+

Source: inst/CITATION

+ +

Sonabend R, Király FJ, Bender A, Bischl B, Lang M (2021). +“mlr3proba: An R Package for Machine Learning in Survival Analysis.” +Bioinformatics. +ISSN 1367-4803, doi:10.1093/bioinformatics/btab039. +

+
@Article{,
+  title = {mlr3proba: An R Package for Machine Learning in Survival Analysis},
+  author = {Raphael Sonabend and Franz J Király and Andreas Bender and Bernd Bischl and Michel Lang},
+  journal = {Bioinformatics},
+  month = {02},
+  year = {2021},
+  doi = {10.1093/bioinformatics/btab039},
+  issn = {1367-4803},
+}
+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/data/actg.rda b/data/actg.rda deleted file mode 100644 index 77ab298ca..000000000 Binary files a/data/actg.rda and /dev/null differ diff --git a/data/gbcs.rda b/data/gbcs.rda deleted file mode 100644 index 062603622..000000000 Binary files a/data/gbcs.rda and /dev/null differ diff --git a/data/grace.rda b/data/grace.rda deleted file mode 100644 index 8f6e654ec..000000000 Binary files a/data/grace.rda and /dev/null differ diff --git a/data/whas.rda b/data/whas.rda deleted file mode 100644 index f3cb89981..000000000 Binary files a/data/whas.rda and /dev/null differ diff --git a/deps/JetBrains_Mono-0.4.10/font.css b/deps/JetBrains_Mono-0.4.10/font.css new file mode 100644 index 000000000..1b0f48f99 --- /dev/null +++ b/deps/JetBrains_Mono-0.4.10/font.css @@ -0,0 +1,54 @@ +/* cyrillic-ext */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2) format('woff2'); + unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; +} +/* cyrillic */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2) format('woff2'); + unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +/* greek */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2) format('woff2'); + unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; +} +/* vietnamese */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2) format('woff2'); + unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; +} +/* latin-ext */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2) format('woff2'); + unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} diff --git a/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2 b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2 new file mode 100644 index 000000000..3d61ccaac Binary files /dev/null and b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2 b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2 new file mode 100644 index 000000000..9d97c9b79 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2 b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2 new file mode 100644 index 000000000..2e5dab088 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2 b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2 new file mode 100644 index 000000000..da7ab5f37 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2 b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2 new file mode 100644 index 000000000..585887339 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2 b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2 new file mode 100644 index 000000000..f60f0bd19 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.10/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.4/font.css b/deps/JetBrains_Mono-0.4.4/font.css new file mode 100644 index 000000000..395dd077b --- /dev/null +++ b/deps/JetBrains_Mono-0.4.4/font.css @@ -0,0 +1,7 @@ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff) format('woff'); +} diff --git a/deps/JetBrains_Mono-0.4.4/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff b/deps/JetBrains_Mono-0.4.4/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff new file mode 100644 index 000000000..b64759e3e Binary files /dev/null and b/deps/JetBrains_Mono-0.4.4/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff differ diff --git a/deps/JetBrains_Mono-0.4.5/font.css b/deps/JetBrains_Mono-0.4.5/font.css new file mode 100644 index 000000000..395dd077b --- /dev/null +++ b/deps/JetBrains_Mono-0.4.5/font.css @@ -0,0 +1,7 @@ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff) format('woff'); +} diff --git a/deps/JetBrains_Mono-0.4.5/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff b/deps/JetBrains_Mono-0.4.5/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff new file mode 100644 index 000000000..adc86cbfa Binary files /dev/null and b/deps/JetBrains_Mono-0.4.5/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff differ diff --git a/deps/JetBrains_Mono-0.4.7/font.css b/deps/JetBrains_Mono-0.4.7/font.css new file mode 100644 index 000000000..395dd077b --- /dev/null +++ b/deps/JetBrains_Mono-0.4.7/font.css @@ -0,0 +1,7 @@ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff) format('woff'); +} diff --git a/deps/JetBrains_Mono-0.4.7/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff b/deps/JetBrains_Mono-0.4.7/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff new file mode 100644 index 000000000..adc86cbfa Binary files /dev/null and b/deps/JetBrains_Mono-0.4.7/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff differ diff --git a/deps/JetBrains_Mono-0.4.8/font.css b/deps/JetBrains_Mono-0.4.8/font.css new file mode 100644 index 000000000..395dd077b --- /dev/null +++ b/deps/JetBrains_Mono-0.4.8/font.css @@ -0,0 +1,7 @@ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff) format('woff'); +} diff --git a/deps/JetBrains_Mono-0.4.8/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff b/deps/JetBrains_Mono-0.4.8/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff new file mode 100644 index 000000000..adc86cbfa Binary files /dev/null and b/deps/JetBrains_Mono-0.4.8/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxjPg.woff differ diff --git a/deps/JetBrains_Mono-0.4.9/font.css b/deps/JetBrains_Mono-0.4.9/font.css new file mode 100644 index 000000000..1b0f48f99 --- /dev/null +++ b/deps/JetBrains_Mono-0.4.9/font.css @@ -0,0 +1,54 @@ +/* cyrillic-ext */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2) format('woff2'); + unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; +} +/* cyrillic */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2) format('woff2'); + unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +/* greek */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2) format('woff2'); + unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; +} +/* vietnamese */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2) format('woff2'); + unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; +} +/* latin-ext */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2) format('woff2'); + unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} diff --git a/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2 b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2 new file mode 100644 index 000000000..3d61ccaac Binary files /dev/null and b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2 b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2 new file mode 100644 index 000000000..9d97c9b79 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2 b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2 new file mode 100644 index 000000000..2e5dab088 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2 b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2 new file mode 100644 index 000000000..da7ab5f37 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2 b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2 new file mode 100644 index 000000000..585887339 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2 differ diff --git a/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2 b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2 new file mode 100644 index 000000000..f60f0bd19 Binary files /dev/null and b/deps/JetBrains_Mono-0.4.9/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2 differ diff --git a/deps/MathJax-3.2.2/tex-chtml.min.js b/deps/MathJax-3.2.2/tex-chtml.min.js new file mode 100644 index 000000000..043aa25b7 --- /dev/null +++ b/deps/MathJax-3.2.2/tex-chtml.min.js @@ -0,0 +1,3 @@ +!function(){"use strict";var __webpack_modules__={351:function(t,e,r){var n,o,a=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||function(){return(s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p=(Object.defineProperty(e,"__esModule",{value:!0}),e.AssistiveMmlHandler=e.AssistiveMmlMathDocumentMixin=e.AssistiveMmlMathItemMixin=e.LimitedMmlVisitor=void 0,r(4474)),i=r(9259),h=r(7233),d=(o=i.SerializedMmlVisitor,a(f,o),f.prototype.getAttributes=function(t){return o.prototype.getAttributes.call(this,t).replace(/ ?id=".*?"/,"")},f);function f(){return null!==o&&o.apply(this,arguments)||this}function m(t){return a(e,r=t),e.prototype.assistiveMml=function(t,e){void 0===e&&(e=!1),this.state()>=p.STATE.ASSISTIVEMML||(this.isEscaped||!t.options.enableAssistiveMml&&!e||(e=t.adaptor,t=t.toMML(this.root).replace(/\n */g,"").replace(//g,""),t=e.firstChild(e.body(e.parse(t,"text/html"))),t=e.node("mjx-assistive-mml",{unselectable:"on",display:this.display?"block":"inline"},[t]),e.setAttribute(e.firstChild(this.typesetRoot),"aria-hidden","true"),e.setStyle(this.typesetRoot,"position","relative"),e.append(this.typesetRoot,t)),this.state(p.STATE.ASSISTIVEMML))},e;function e(){return null!==r&&r.apply(this,arguments)||this}var r}function y(t){var e,i;return a(r,i=t),r.prototype.toMML=function(t){return this.visitor.visitTree(t)},r.prototype.assistiveMml=function(){var t,e;if(!this.processed.isSet("assistive-mml")){try{for(var r=u(this.math),n=r.next();!n.done;n=r.next())n.value.assistiveMml(this)}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.processed.set("assistive-mml")}return this},r.prototype.state=function(t,e){return i.prototype.state.call(this,t,e=void 0===e?!1:e),ts[0]&&e[1]=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLAdaptor=void 0,o=r(5009).AbstractDOMAdaptor,i(a,o),a.prototype.parse=function(t,e){return this.parser.parseFromString(t,e=void 0===e?"text/html":e)},a.prototype.create=function(t,e){return e?this.document.createElementNS(e,t):this.document.createElement(t)},a.prototype.text=function(t){return this.document.createTextNode(t)},a.prototype.head=function(t){return t.head||t},a.prototype.body=function(t){return t.body||t},a.prototype.root=function(t){return t.documentElement||t},a.prototype.doctype=function(t){return t.doctype?""):""},a.prototype.tags=function(t,e,r){r=(r=void 0===r?null:r)?t.getElementsByTagNameNS(r,e):t.getElementsByTagName(e);return Array.from(r)},a.prototype.getElements=function(t,e){var r,n,o=[];try{for(var i=l(t),a=i.next();!a.done;a=i.next()){var s=a.value;"string"==typeof s?o=o.concat(Array.from(this.document.querySelectorAll(s))):Array.isArray(s)||s instanceof this.window.NodeList||s instanceof this.window.HTMLCollection?o=o.concat(Array.from(s)):o.push(s)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o},a.prototype.contains=function(t,e){return t.contains(e)},a.prototype.parent=function(t){return t.parentNode},a.prototype.append=function(t,e){return t.appendChild(e)},a.prototype.insert=function(t,e){return this.parent(e).insertBefore(t,e)},a.prototype.remove=function(t){return this.parent(t).removeChild(t)},a.prototype.replace=function(t,e){return this.parent(e).replaceChild(t,e)},a.prototype.clone=function(t){return t.cloneNode(!0)},a.prototype.split=function(t,e){return t.splitText(e)},a.prototype.next=function(t){return t.nextSibling},a.prototype.previous=function(t){return t.previousSibling},a.prototype.firstChild=function(t){return t.firstChild},a.prototype.lastChild=function(t){return t.lastChild},a.prototype.childNodes=function(t){return Array.from(t.childNodes)},a.prototype.childNode=function(t,e){return t.childNodes[e]},a.prototype.kind=function(t){var e=t.nodeType;return 1===e||3===e||8===e?t.nodeName.toLowerCase():""},a.prototype.value=function(t){return t.nodeValue||""},a.prototype.textContent=function(t){return t.textContent},a.prototype.innerHTML=function(t){return t.innerHTML},a.prototype.outerHTML=function(t){return t.outerHTML},a.prototype.serializeXML=function(t){return(new this.window.XMLSerializer).serializeToString(t)},a.prototype.setAttribute=function(t,e,r,n){return(n=void 0===n?null:n)?(e=n.replace(/.*\//,"")+":"+e.replace(/^.*:/,""),t.setAttributeNS(n,e,r)):t.setAttribute(e,r)},a.prototype.getAttribute=function(t,e){return t.getAttribute(e)},a.prototype.removeAttribute=function(t,e){return t.removeAttribute(e)},a.prototype.hasAttribute=function(t,e){return t.hasAttribute(e)},a.prototype.allAttributes=function(t){return Array.from(t.attributes).map(function(t){return{name:t.name,value:t.value}})},a.prototype.addClass=function(t,e){t.classList?t.classList.add(e):t.className=(t.className+" "+e).trim()},a.prototype.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.split(/ /).filter(function(t){return t!==e}).join(" ")},a.prototype.hasClass=function(t,e){return t.classList?t.classList.contains(e):0<=t.className.split(/ /).indexOf(e)},a.prototype.setStyle=function(t,e,r){t.style[e]=r},a.prototype.getStyle=function(t,e){return t.style[e]},a.prototype.allStyles=function(t){return t.style.cssText},a.prototype.insertRules=function(t,e){var r,n;try{for(var o=l(e.reverse()),i=o.next();!i.done;i=o.next()){var a=i.value;try{t.sheet.insertRule(a,0)}catch(t){console.warn("MathJax: can't insert css rule '".concat(a,"': ").concat(t.message))}}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},a.prototype.fontSize=function(t){t=this.window.getComputedStyle(t);return parseFloat(t.fontSize)},a.prototype.fontFamily=function(t){return this.window.getComputedStyle(t).fontFamily||""},a.prototype.nodeSize=function(t,e,r){return void 0===e&&(e=1),(r=void 0===r?!1:r)&&t.getBBox?[(r=t.getBBox()).width/e,r.height/e]:[t.offsetWidth/e,t.offsetHeight/e]},a.prototype.nodeBBox=function(t){t=t.getBoundingClientRect();return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},a);function a(t){var e=o.call(this,t.document)||this;return e.window=t,e.parser=new t.DOMParser,e}e.HTMLAdaptor=r},6191:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.browserAdaptor=void 0;var n=r(444);e.browserAdaptor=function(){return new n.HTMLAdaptor(window)}},9515:function(t,e,r){var c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.MathJax=e.combineWithMathJax=e.combineDefaults=e.combineConfig=e.isObject=void 0,r(3282));function u(t){return"object"==typeof t&&null!==t}function s(t,e){var r,n;try{for(var o=c(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;"__esModule"!==a&&(!u(t[a])||!u(e[a])||e[a]instanceof Promise?null!==e[a]&&void 0!==e[a]&&(t[a]=e[a]):s(t[a],e[a]))}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return t}e.isObject=u,e.combineConfig=s,e.combineDefaults=function t(e,r,n){var o,i;e[r]||(e[r]={}),e=e[r];try{for(var a=c(Object.keys(n)),s=a.next();!s.done;s=a.next()){var l=s.value;u(e[l])&&u(n[l])?t(e,l,n[l]):null==e[l]&&null!=n[l]&&(e[l]=n[l])}}catch(t){o={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return e},e.combineWithMathJax=function(t){return s(e.MathJax,t)},void 0===r.g.MathJax&&(r.g.MathJax={}),r.g.MathJax.version||(r.g.MathJax={version:n.VERSION,_:{},config:r.g.MathJax}),e.MathJax=r.g.MathJax},235:function(t,l,e){var r,n,c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=(Object.defineProperty(l,"__esModule",{value:!0}),l.CONFIG=l.MathJax=l.Loader=l.PathFilters=l.PackageError=l.Package=void 0,e(9515)),u=e(265),i=e(265);Object.defineProperty(l,"Package",{enumerable:!0,get:function(){return i.Package}}),Object.defineProperty(l,"PackageError",{enumerable:!0,get:function(){return i.PackageError}});var a,s,p,e=e(7525);if(l.PathFilters={source:function(t){return l.CONFIG.source.hasOwnProperty(t.name)&&(t.name=l.CONFIG.source[t.name]),!0},normalize:function(t){var e=t.name;return e.match(/^(?:[a-z]+:\/)?\/|[a-z]:\\|\[/i)||(t.name="[mathjax]/"+e.replace(/^\.\//,"")),t.addExtension&&!e.match(/\.[^\/]+$/)&&(t.name+=".js"),!0},prefix:function(t){for(var e;(e=t.name.match(/^\[([^\]]*)\]/))&&l.CONFIG.paths.hasOwnProperty(e[1]);)t.name=l.CONFIG.paths[e[1]]+t.name.substr(e[0].length);return!0}},s=a=l.Loader||(l.Loader={}),p=o.MathJax.version,s.versions=new Map,s.ready=function(){for(var t,e,r=[],n=0;n=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},h=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractDOMAdaptor=void 0,n.prototype.node=function(t,e,r,n){void 0===e&&(e={}),void 0===r&&(r=[]);var o,i,a=this.create(t,n);this.setAttributes(a,e);try{for(var s=m(r),l=s.next();!l.done;l=s.next()){var c=l.value;this.append(a,c)}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},n.prototype.setAttributes=function(t,e){var r,n,o,i,a,s;if(e.style&&"string"!=typeof e.style)try{for(var l=m(Object.keys(e.style)),c=l.next();!c.done;c=l.next()){var u=c.value;this.setStyle(t,u.replace(/-([a-z])/g,function(t,e){return e.toUpperCase()}),e.style[u])}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}if(e.properties)try{for(var p=m(Object.keys(e.properties)),h=p.next();!h.done;h=p.next())t[u=h.value]=e.properties[u]}catch(t){o={error:t}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}try{for(var d=m(Object.keys(e)),f=d.next();!f.done;f=d.next())"style"===(u=f.value)&&"string"!=typeof e.style||"properties"===u||this.setAttribute(t,u,e[u])}catch(t){a={error:t}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}},n.prototype.replace=function(t,e){return this.insert(t,e),this.remove(e),e},n.prototype.childNode=function(t,e){return this.childNodes(t)[e]},n.prototype.allClasses=function(t){t=this.getAttribute(t,"class");return t?t.replace(/ +/g," ").replace(/^ /,"").replace(/ $/,"").split(/ /):[]},n);function n(t){this.document=t=void 0===t?null:t}e.AbstractDOMAdaptor=r},3494:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractFindMath=void 0;var n=r(7233);function o(t){var e=this.constructor;this.options=(0,n.userOptions)((0,n.defaultOptions)({},e.OPTIONS),t)}o.OPTIONS={},e.AbstractFindMath=o},3670:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractHandler=void 0,o=r(5722).AbstractMathDocument,i(l,o),l);function s(t,e){void 0===e&&(e=5),this.documentClass=a,this.adaptor=t,this.priority=e}function l(){return null!==o&&o.apply(this,arguments)||this}Object.defineProperty(s.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),s.prototype.handlesDocument=function(t){return!1},s.prototype.create=function(t,e){return new this.documentClass(t,this.adaptor,e)},s.NAME="generic",e.AbstractHandler=s},805:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.HandlerList=void 0,o=r(8666).PrioritizedList,i(s,o),s.prototype.register=function(t){return this.add(t,t.priority)},s.prototype.unregister=function(t){this.remove(t)},s.prototype.handlesDocument=function(t){var e,r;try{for(var n=a(this),o=n.next();!o.done;o=n.next()){var i=o.value.item;if(i.handlesDocument(t))return i}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}throw new Error("Can't find handler for document")},s.prototype.document=function(t,e){return void 0===e&&(e=null),this.handlesDocument(t).create(t,e)},s);function s(){return null!==o&&o.apply(this,arguments)||this}e.HandlerList=r},9206:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractInputJax=void 0;var n=r(7233),o=r(7525);function i(t){void 0===t&&(t={}),this.adaptor=null,this.mmlFactory=null;var e=this.constructor;this.options=(0,n.userOptions)((0,n.defaultOptions)({},e.OPTIONS),t),this.preFilters=new o.FunctionList,this.postFilters=new o.FunctionList}Object.defineProperty(i.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),i.prototype.setAdaptor=function(t){this.adaptor=t},i.prototype.setMmlFactory=function(t){this.mmlFactory=t},i.prototype.initialize=function(){},i.prototype.reset=function(){for(var t=[],e=0;e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=e&&a.item.renderDoc(t))return}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},g.prototype.renderMath=function(t,e,r){var n,o;void 0===r&&(r=h.STATE.UNPROCESSED);try{for(var i=f(this.items),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.priority>=r&&s.item.renderMath(t,e))return}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},g.prototype.renderConvert=function(t,e,r){var n,o;void 0===r&&(r=h.STATE.LAST);try{for(var i=f(this.items),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.priority>r)return;if(s.item.convert&&s.item.renderMath(t,e))return}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},g.prototype.findID=function(t){var e,r;try{for(var n=f(this.items),o=n.next();!o.done;o=n.next()){var i=o.value;if(i.item.id===t)return i.item}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return null},g);function g(){return null!==o&&o.apply(this,arguments)||this}r.RenderList=y,r.resetOptions={all:!1,processed:!1,inputJax:null,outputJax:null},r.resetAllOptions={all:!0,processed:!0,inputJax:[],outputJax:[]};S=s.AbstractInputJax,i(N,S),N.prototype.compile=function(t){return null};var b,v,_,S,O=N,M=(_=l.AbstractOutputJax,i(T,_),T.prototype.typeset=function(t,e){return null},T.prototype.escaped=function(t,e){return null},T),x=(v=c.AbstractMathList,i(C,v),C),e=(b=h.AbstractMathItem,i(A,b),A),s=(Object.defineProperty(E.prototype,"kind",{get:function(){return this.constructor.KIND},enumerable:!1,configurable:!0}),E.prototype.addRenderAction=function(t){for(var e=[],r=1;r=e&&this.state(e-1),t.renderActions.renderMath(this,t,e)},e.prototype.convert=function(t,e){void 0===e&&(e=i.STATE.LAST),t.renderActions.renderConvert(this,t,e)},e.prototype.compile=function(t){this.state()=i.STATE.INSERTED&&this.removeFromDocument(e),t=i.STATE.TYPESET&&(this.outputData={}),t=i.STATE.COMPILED&&(this.inputData={}),this._state=t),this._state},e.prototype.reset=function(t){this.state(i.STATE.UNPROCESSED,t=void 0===t?!1:t)},i.AbstractMathItem=e,i.STATE={UNPROCESSED:0,FINDMATH:10,COMPILED:20,CONVERT:100,METRICS:110,RERENDER:125,TYPESET:150,INSERTED:200,LAST:1e4},i.newState=function(t,e){if(t in i.STATE)throw Error("State "+t+" already exists");i.STATE[t]=e}},9e3:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),r=(Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMathList=void 0,o=r(103).LinkedList,i(a,o),a.prototype.isBefore=function(t,e){return t.start.i=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},e=(Object.defineProperty(r,"__esModule",{value:!0}),r.Attributes=r.INHERIT=void 0,r.INHERIT="_inherit_",n.prototype.set=function(t,e){this.attributes[t]=e},n.prototype.setList=function(t){Object.assign(this.attributes,t)},n.prototype.get=function(t){var e=this.attributes[t];return e=e===r.INHERIT?this.global[t]:e},n.prototype.getExplicit=function(t){if(this.attributes.hasOwnProperty(t))return this.attributes[t]},n.prototype.getList=function(){for(var t,e,r=[],n=0;n=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.MathMLVisitor=void 0,o=r(6325).MmlVisitor,i(a,o),a.prototype.visitTree=function(t,e){e=(this.document=e).createElement("top");return this.visitNode(t,e),this.document=null,e.firstChild},a.prototype.visitTextNode=function(t,e){e.appendChild(this.document.createTextNode(t.getText()))},a.prototype.visitXMLNode=function(t,e){e.appendChild(t.getXML().cloneNode(!0))},a.prototype.visitInferredMrowNode=function(t,e){var r,n;try{for(var o=c(t.childNodes),i=o.next();!i.done;i=o.next()){var a=i.value;this.visitNode(a,e)}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},a.prototype.visitDefault=function(t,e){var r,n,o=this.document.createElement(t.kind);this.addAttributes(t,o);try{for(var i=c(t.childNodes),a=i.next();!a.done;a=i.next()){var s=a.value;this.visitNode(s,o)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.appendChild(o)},a.prototype.addAttributes=function(t,e){var r,n,o=t.attributes,i=o.getExplicitNames();try{for(var a=c(i),s=a.next();!s.done;s=a.next()){var l=s.value;e.setAttribute(l,o.getExplicit(l).toString())}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},a);function a(){var t=null!==o&&o.apply(this,arguments)||this;return t.document=null,t}e.MathMLVisitor=r},3909:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.MmlFactory=void 0,r(7860)),r=r(6336),a=(o=a.AbstractNodeFactory,i(s,o),Object.defineProperty(s.prototype,"MML",{get:function(){return this.node},enumerable:!1,configurable:!0}),s.defaultNodes=r.MML,s);function s(){return null!==o&&o.apply(this,arguments)||this}e.MmlFactory=a},9007:function(t,s,e){var n,l,r=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),d=this&&this.__assign||function(){return(d=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},m=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0this.childNodes.length&&(t=1),this.attributes.set("selection",t)},s.defaults=a(a({},r.AbstractMmlNode.defaults),{actiontype:"toggle",selection:1}),s);function s(){return null!==o&&o.apply(this,arguments)||this}e.MmlMaction=i},142:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p=(Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMfenced=void 0,r(9007)),r=(c=p.AbstractMmlNode,o(a,c),Object.defineProperty(a.prototype,"kind",{get:function(){return"mfenced"},enumerable:!1,configurable:!0}),a.prototype.setTeXclass=function(t){this.getPrevClass(t),this.open&&(t=this.open.setTeXclass(t)),this.childNodes[0]&&(t=this.childNodes[0].setTeXclass(t));for(var e=1,r=this.childNodes.length;e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMfrac=void 0,r(9007)),i=(o=r.AbstractMmlBaseNode,i(l,o),Object.defineProperty(l.prototype,"kind",{get:function(){return"mfrac"},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),l.prototype.setTeXclass=function(t){var e,r;this.getPrevClass(t);try{for(var n=s(this.childNodes),o=n.next();!o.done;o=n.next())o.value.setTeXclass(null)}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this},l.prototype.setChildInheritedAttributes=function(t,e,r,n){(!e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=(Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMo=void 0,r(9007)),d=r(4082),l=r(505),r=(o=s.AbstractMmlTokenNode,i(c,o),Object.defineProperty(c.prototype,"texClass",{get:function(){var t,e,r,n,o;return null===this._texClass?(t=this.getText(),o=(r=p(this.handleExplicitForm(this.getForms()),3))[0],e=r[1],r=r[2],(o=(n=this.constructor.OPTABLE)[o][t]||n[e][t]||n[r][t])?o[2]:s.TEXCLASS.REL):this._texClass},set:function(t){this._texClass=t},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"kind",{get:function(){return"mo"},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isEmbellished",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"hasNewLine",{get:function(){return"newline"===this.attributes.get("linebreak")},enumerable:!1,configurable:!0}),c.prototype.coreParent=function(){for(var t=this,e=this,r=this.factory.getNodeClass("math");e&&e.isEmbellished&&e.coreMO()===this&&!(e instanceof r);)e=(t=e).parent;return t},c.prototype.coreText=function(t){if(!t)return"";if(t.isEmbellished)return t.coreMO().getText();for(;((t.isKind("mrow")||t.isKind("TeXAtom")&&t.texClass!==s.TEXCLASS.VCENTER||t.isKind("mstyle")||t.isKind("mphantom"))&&1===t.childNodes.length||t.isKind("munderover"))&&t.childNodes[0];)t=t.childNodes[0];return t.isToken?t.getText():""},c.prototype.hasSpacingAttributes=function(){return this.attributes.isSet("lspace")||this.attributes.isSet("rspace")},Object.defineProperty(c.prototype,"isAccent",{get:function(){var t,e=!1,r=this.coreParent().parent;return e=r&&(t=r.isKind("mover")?r.childNodes[r.over].coreMO()?"accent":"":r.isKind("munder")?r.childNodes[r.under].coreMO()?"accentunder":"":r.isKind("munderover")?this===r.childNodes[r.over].coreMO()?"accent":this===r.childNodes[r.under].coreMO()?"accentunder":"":"")?void 0!==r.attributes.getExplicit(t)?e:this.attributes.get("accent"):e},enumerable:!1,configurable:!0}),c.prototype.setTeXclass=function(t){var e=this.attributes.getList("form","fence"),r=e.form,e=e.fence;return void 0===this.getProperty("texClass")&&(this.attributes.isSet("lspace")||this.attributes.isSet("rspace"))?null:(e&&this.texClass===s.TEXCLASS.REL&&("prefix"===r&&(this.texClass=s.TEXCLASS.OPEN),"postfix"===r&&(this.texClass=s.TEXCLASS.CLOSE)),this.adjustTeXclass(t))},c.prototype.adjustTeXclass=function(t){var e=this.texClass,r=this.prevClass;if(e===s.TEXCLASS.NONE)return t;if(t?(!t.getProperty("autoOP")||e!==s.TEXCLASS.BIN&&e!==s.TEXCLASS.REL||(r=t.texClass=s.TEXCLASS.ORD),r=this.prevClass=t.texClass||s.TEXCLASS.ORD,this.prevLevel=this.attributes.getInherited("scriptlevel")):r=this.prevClass=s.TEXCLASS.NONE,e!==s.TEXCLASS.BIN||r!==s.TEXCLASS.NONE&&r!==s.TEXCLASS.BIN&&r!==s.TEXCLASS.OP&&r!==s.TEXCLASS.REL&&r!==s.TEXCLASS.OPEN&&r!==s.TEXCLASS.PUNCT)if(r!==s.TEXCLASS.BIN||e!==s.TEXCLASS.REL&&e!==s.TEXCLASS.CLOSE&&e!==s.TEXCLASS.PUNCT){if(e===s.TEXCLASS.BIN){for(var n=this,o=this.parent;o&&o.parent&&o.isEmbellished&&(1===o.childNodes.length||!o.isKind("mrow")&&o.core()===n);)o=(n=o).parent;o.childNodes[o.childNodes.length-1]===n&&(this.texClass=s.TEXCLASS.ORD)}}else t.texClass=this.prevClass=s.TEXCLASS.ORD;else this.texClass=s.TEXCLASS.ORD;return this},c.prototype.setInheritedAttributes=function(t,e,r,n){o.prototype.setInheritedAttributes.call(this,t=void 0===t?{}:t,e=void 0===e?!1:e,r=void 0===r?0:r,n=void 0===n?!1:n);t=this.getText();this.checkOperatorTable(t),this.checkPseudoScripts(t),this.checkPrimes(t),this.checkMathAccent(t)},c.prototype.checkOperatorTable=function(t){var e,r,n=p(this.handleExplicitForm(this.getForms()),3),o=n[0],i=n[1],n=n[2],a=(this.attributes.setInherited("form",o),this.constructor.OPTABLE),s=a[o][t]||a[i][t]||a[n][t];if(s){void 0===this.getProperty("texClass")&&(this.texClass=s[2]);try{for(var l=h(Object.keys(s[3]||{})),c=l.next();!c.done;c=l.next()){var u=c.value;this.attributes.setInherited(u,s[3][u])}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}this.lspace=(s[0]+1)/18,this.rspace=(s[1]+1)/18}else{o=(0,d.getRange)(t);o&&(void 0===this.getProperty("texClass")&&(this.texClass=o[2]),i=this.constructor.MMLSPACING[o[2]],this.lspace=(i[0]+1)/18,this.rspace=(i[1]+1)/18)}},c.prototype.getForms=function(){for(var t=this,e=this.parent,r=this.Parent;r&&r.isEmbellished;)t=e,e=r.parent,r=r.Parent;if(e&&e.isKind("mrow")&&1!==e.nonSpaceLength()){if(e.firstNonSpace()===t)return["prefix","infix","postfix"];if(e.lastNonSpace()===t)return["postfix","infix","prefix"]}return["infix","prefix","postfix"]},c.prototype.handleExplicitForm=function(t){var e;return t=this.attributes.isSet("form")?[e=this.attributes.get("form")].concat(t.filter(function(t){return t!==e})):t},c.prototype.checkPseudoScripts=function(t){var e=this.constructor.pseudoScripts;t.match(e)&&(e=!(t=this.coreParent().Parent)||!(t.isKind("msubsup")&&!t.isKind("msub")),this.setProperty("pseudoscript",e),e&&(this.attributes.setInherited("lspace",0),this.attributes.setInherited("rspace",0)))},c.prototype.checkPrimes=function(t){var e,r=this.constructor.primes;t.match(r)&&(e=this.constructor.remapPrimes,r=(0,l.unicodeString)((0,l.unicodeChars)(t).map(function(t){return e[t]})),this.setProperty("primes",r))},c.prototype.checkMathAccent=function(t){var e=this.Parent;void 0===this.getProperty("mathaccent")&&e&&e.isKind("munderover")&&((e=e.childNodes[0]).isEmbellished&&e.coreMO()===this||(e=this.constructor.mathaccents,t.match(e)&&this.setProperty("mathaccent",!0)))},c.defaults=a(a({},s.AbstractMmlTokenNode.defaults),{form:"infix",fence:!1,separator:!1,lspace:"thickmathspace",rspace:"thickmathspace",stretchy:!1,symmetric:!1,maxsize:"infinity",minsize:"0em",largeop:!1,movablelimits:!1,accent:!1,linebreak:"auto",lineleading:"1ex",linebreakstyle:"before",indentalign:"auto",indentshift:"0",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),c.MMLSPACING=d.MMLSPACING,c.OPTABLE=d.OPTABLE,c.pseudoScripts=new RegExp(["^[\"'*`","ª","°","²-´","¹","º","‘-‟","′-‷⁗","⁰ⁱ","⁴-ⁿ","₀-₎","]+$"].join("")),c.primes=new RegExp(["^[\"'`","‘-‟","]+$"].join("")),c.remapPrimes={34:8243,39:8242,96:8245,8216:8245,8217:8242,8218:8242,8219:8245,8220:8246,8221:8243,8222:8243,8223:8246},c.mathaccents=new RegExp(["^[","´́ˊ","`̀ˋ","¨̈","~̃˜","¯̄ˉ","˘̆","ˇ̌","^̂ˆ","→⃗","˙̇","˚̊","⃛","⃜","]$"].join("")),c);function c(){var t=null!==o&&o.apply(this,arguments)||this;return t._texClass=null,t.lspace=5/18,t.rspace=5/18,t}e.MmlMo=r},7238:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=(Object.defineProperty(e,"__esModule",{value:!0}),e.MmlInferredMrow=e.MmlMrow=void 0,r(9007)),r=(o=u.AbstractMmlNode,i(s,o),Object.defineProperty(s.prototype,"kind",{get:function(){return"mrow"},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isSpacelike",{get:function(){var t,e;try{for(var r=c(this.childNodes),n=r.next();!n.done;n=r.next())if(!n.value.isSpacelike)return!1}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return!0},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isEmbellished",{get:function(){var t,e,r=!1,n=0;try{for(var o=c(this.childNodes),i=o.next();!i.done;i=o.next()){var a=i.value;if(a)if(a.isEmbellished){if(r)return!1;r=!0,this._core=n}else if(!a.isSpacelike)return!1;n++}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return r},enumerable:!1,configurable:!0}),s.prototype.core=function(){return this.isEmbellished&&null!=this._core?this.childNodes[this._core]:this},s.prototype.coreMO=function(){return this.isEmbellished&&null!=this._core?this.childNodes[this._core].coreMO():this},s.prototype.nonSpaceLength=function(){var t,e,r=0;try{for(var n=c(this.childNodes),o=n.next();!o.done;o=n.next()){var i=o.value;i&&!i.isSpacelike&&r++}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r},s.prototype.firstNonSpace=function(){var t,e;try{for(var r=c(this.childNodes),n=r.next();!n.done;n=r.next()){var o=n.value;if(o&&!o.isSpacelike)return o}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return null},s.prototype.lastNonSpace=function(){for(var t=this.childNodes.length;0<=--t;){var e=this.childNodes[t];if(e&&!e.isSpacelike)return e}return null},s.prototype.setTeXclass=function(t){var e,r,n,o;if(null!=this.getProperty("open")||null!=this.getProperty("close")){this.getPrevClass(t),t=null;try{for(var i=c(this.childNodes),a=i.next();!a.done;a=i.next())t=a.value.setTeXclass(t)}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}null==this.texClass&&(this.texClass=u.TEXCLASS.INNER)}else{try{for(var s=c(this.childNodes),l=s.next();!l.done;l=s.next())t=l.value.setTeXclass(t)}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}this.childNodes[0]&&this.updateTeXclass(this.childNodes[0])}return t},s.defaults=a({},u.AbstractMmlNode.defaults),s);function s(){var t=null!==o&&o.apply(this,arguments)||this;return t._core=null,t}e.MmlMrow=r;i(p,l=r),Object.defineProperty(p.prototype,"kind",{get:function(){return"inferredMrow"},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isInferred",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"notParent",{get:function(){return!0},enumerable:!1,configurable:!0}),p.prototype.toString=function(){return"["+this.childNodes.join(",")+"]"},p.defaults=r.defaults;var l,i=p;function p(){return null!==l&&l.apply(this,arguments)||this}e.MmlInferredMrow=i},7265:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=(Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMtable=void 0,r(9007)),y=r(505),r=(c=u.AbstractMmlNode,o(a,c),Object.defineProperty(a.prototype,"kind",{get:function(){return"mtable"},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),a.prototype.setInheritedAttributes=function(t,e,r,n){var o,i;try{for(var a=m(u.indentAttributes),s=a.next();!s.done;s=a.next()){var l=s.value;t[l]&&this.attributes.setInherited(l,t[l][1]),void 0!==this.attributes.getExplicit(l)&&delete this.attributes.getAllAttributes()[l]}}catch(t){o={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}c.prototype.setInheritedAttributes.call(this,t,e,r,n)},a.prototype.setChildInheritedAttributes=function(t,e,r,n){var o,i,a,s;try{for(var l=m(this.childNodes),c=l.next();!c.done;c=l.next())(f=c.value).isKind("mtr")||this.replaceChild(this.factory.create("mtr"),f).appendChild(f)}catch(t){o={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}r=this.getProperty("scriptlevel")||r,e=!(!this.attributes.getExplicit("displaystyle")&&!this.attributes.getDefault("displaystyle")),t=this.addInheritedAttributes(t,{columnalign:this.attributes.get("columnalign"),rowalign:"center"});var u=this.attributes.getExplicit("data-cramped"),p=(0,y.split)(this.attributes.get("rowalign"));try{for(var h=m(this.childNodes),d=h.next();!d.done;d=h.next()){var f=d.value;t.rowalign[1]=p.shift()||t.rowalign[1],f.setInheritedAttributes(t,e,r,!!u)}}catch(t){a={error:t}}finally{try{d&&!d.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}},a.prototype.verifyChildren=function(t){for(var e=null,r=this.factory,n=0;n=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=(Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMlabeledtr=e.MmlMtr=void 0,r(9007)),l=r(91),m=r(505),r=(a=s.AbstractMmlNode,o(c,a),Object.defineProperty(c.prototype,"kind",{get:function(){return"mtr"},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),c.prototype.setChildInheritedAttributes=function(t,e,r,n){var o,i,a,s;try{for(var l=f(this.childNodes),c=l.next();!c.done;c=l.next())(d=c.value).isKind("mtd")||this.replaceChild(this.factory.create("mtd"),d).appendChild(d)}catch(t){o={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}var u=(0,m.split)(this.attributes.get("columnalign"));1===this.arity&&u.unshift(this.parent.attributes.get("side")),t=this.addInheritedAttributes(t,{rowalign:this.attributes.get("rowalign"),columnalign:"center"});try{for(var p=f(this.childNodes),h=p.next();!h.done;h=p.next()){var d=h.value;t.columnalign[1]=u.shift()||t.columnalign[1],d.setInheritedAttributes(t,e,r,n)}}catch(t){a={error:t}}finally{try{h&&!h.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}},c.prototype.verifyChildren=function(t){var e,r;if(!this.parent||this.parent.isKind("mtable")){try{for(var n=f(this.childNodes),o=n.next();!o.done;o=n.next()){var i=o.value;i.isKind("mtd")||(this.replaceChild(this.factory.create("mtd"),i).appendChild(i),t.fixMtables||i.mError("Children of "+this.kind+" must be mtd",t))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}a.prototype.verifyChildren.call(this,t)}else this.mError(this.kind+" can only be a child of an mtable",t,!0)},c.prototype.setTeXclass=function(t){var e,r;this.getPrevClass(t);try{for(var n=f(this.childNodes),o=n.next();!o.done;o=n.next())o.value.setTeXclass(null)}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this},c.defaults=i(i({},s.AbstractMmlNode.defaults),{rowalign:l.INHERIT,columnalign:l.INHERIT,groupalign:l.INHERIT}),c);function c(){return null!==a&&a.apply(this,arguments)||this}e.MmlMtr=r;o(p,u=r),Object.defineProperty(p.prototype,"kind",{get:function(){return"mlabeledtr"},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0});var u,s=p;function p(){return null!==u&&u.apply(this,arguments)||this}e.MmlMlabeledtr=s},5184:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=(Object.defineProperty(s,"__esModule",{value:!0}),s.OPTABLE=s.MMLSPACING=s.getRange=s.RANGES=s.MO=s.OPDEF=void 0,e(9007));function r(t,e,r,n){return[t,e,r=void 0===r?o.TEXCLASS.BIN:r,n=void 0===n?null:n]}s.OPDEF=r,s.MO={ORD:r(0,0,o.TEXCLASS.ORD),ORD11:r(1,1,o.TEXCLASS.ORD),ORD21:r(2,1,o.TEXCLASS.ORD),ORD02:r(0,2,o.TEXCLASS.ORD),ORD55:r(5,5,o.TEXCLASS.ORD),NONE:r(0,0,o.TEXCLASS.NONE),OP:r(1,2,o.TEXCLASS.OP,{largeop:!0,movablelimits:!0,symmetric:!0}),OPFIXED:r(1,2,o.TEXCLASS.OP,{largeop:!0,movablelimits:!0}),INTEGRAL:r(0,1,o.TEXCLASS.OP,{largeop:!0,symmetric:!0}),INTEGRAL2:r(1,2,o.TEXCLASS.OP,{largeop:!0,symmetric:!0}),BIN3:r(3,3,o.TEXCLASS.BIN),BIN4:r(4,4,o.TEXCLASS.BIN),BIN01:r(0,1,o.TEXCLASS.BIN),BIN5:r(5,5,o.TEXCLASS.BIN),TALLBIN:r(4,4,o.TEXCLASS.BIN,{stretchy:!0}),BINOP:r(4,4,o.TEXCLASS.BIN,{largeop:!0,movablelimits:!0}),REL:r(5,5,o.TEXCLASS.REL),REL1:r(1,1,o.TEXCLASS.REL,{stretchy:!0}),REL4:r(4,4,o.TEXCLASS.REL),RELSTRETCH:r(5,5,o.TEXCLASS.REL,{stretchy:!0}),RELACCENT:r(5,5,o.TEXCLASS.REL,{accent:!0}),WIDEREL:r(5,5,o.TEXCLASS.REL,{accent:!0,stretchy:!0}),OPEN:r(0,0,o.TEXCLASS.OPEN,{fence:!0,stretchy:!0,symmetric:!0}),CLOSE:r(0,0,o.TEXCLASS.CLOSE,{fence:!0,stretchy:!0,symmetric:!0}),INNER:r(0,0,o.TEXCLASS.INNER),PUNCT:r(0,3,o.TEXCLASS.PUNCT),ACCENT:r(0,0,o.TEXCLASS.ORD,{accent:!0}),WIDEACCENT:r(0,0,o.TEXCLASS.ORD,{accent:!0,stretchy:!0})},s.RANGES=[[32,127,o.TEXCLASS.REL,"mo"],[160,191,o.TEXCLASS.ORD,"mo"],[192,591,o.TEXCLASS.ORD,"mi"],[688,879,o.TEXCLASS.ORD,"mo"],[880,6688,o.TEXCLASS.ORD,"mi"],[6832,6911,o.TEXCLASS.ORD,"mo"],[6912,7615,o.TEXCLASS.ORD,"mi"],[7616,7679,o.TEXCLASS.ORD,"mo"],[7680,8191,o.TEXCLASS.ORD,"mi"],[8192,8303,o.TEXCLASS.ORD,"mo"],[8304,8351,o.TEXCLASS.ORD,"mo"],[8448,8527,o.TEXCLASS.ORD,"mi"],[8528,8591,o.TEXCLASS.ORD,"mn"],[8592,8703,o.TEXCLASS.REL,"mo"],[8704,8959,o.TEXCLASS.BIN,"mo"],[8960,9215,o.TEXCLASS.ORD,"mo"],[9312,9471,o.TEXCLASS.ORD,"mn"],[9472,10223,o.TEXCLASS.ORD,"mo"],[10224,10239,o.TEXCLASS.REL,"mo"],[10240,10495,o.TEXCLASS.ORD,"mtext"],[10496,10623,o.TEXCLASS.REL,"mo"],[10624,10751,o.TEXCLASS.ORD,"mo"],[10752,11007,o.TEXCLASS.BIN,"mo"],[11008,11055,o.TEXCLASS.ORD,"mo"],[11056,11087,o.TEXCLASS.REL,"mo"],[11088,11263,o.TEXCLASS.ORD,"mo"],[11264,11744,o.TEXCLASS.ORD,"mi"],[11776,11903,o.TEXCLASS.ORD,"mo"],[11904,12255,o.TEXCLASS.ORD,"mi","normal"],[12272,12351,o.TEXCLASS.ORD,"mo"],[12352,42143,o.TEXCLASS.ORD,"mi","normal"],[42192,43055,o.TEXCLASS.ORD,"mi"],[43056,43071,o.TEXCLASS.ORD,"mn"],[43072,55295,o.TEXCLASS.ORD,"mi"],[63744,64255,o.TEXCLASS.ORD,"mi","normal"],[64256,65023,o.TEXCLASS.ORD,"mi"],[65024,65135,o.TEXCLASS.ORD,"mo"],[65136,65791,o.TEXCLASS.ORD,"mi"],[65792,65935,o.TEXCLASS.ORD,"mn"],[65936,74751,o.TEXCLASS.ORD,"mi","normal"],[74752,74879,o.TEXCLASS.ORD,"mn"],[74880,113823,o.TEXCLASS.ORD,"mi","normal"],[113824,119391,o.TEXCLASS.ORD,"mo"],[119648,119679,o.TEXCLASS.ORD,"mn"],[119808,120781,o.TEXCLASS.ORD,"mi"],[120782,120831,o.TEXCLASS.ORD,"mn"],[122624,129023,o.TEXCLASS.ORD,"mo"],[129024,129279,o.TEXCLASS.REL,"mo"],[129280,129535,o.TEXCLASS.ORD,"mo"],[131072,195103,o.TEXCLASS.ORD,"mi","normnal"]],s.getRange=function(t){var e,r,n=t.codePointAt(0);try{for(var o=l(s.RANGES),i=o.next();!i.done;i=o.next()){var a=i.value;if(n<=a[1]){if(n>=a[0])return a;break}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return null},s.MMLSPACING=[[0,0],[1,2],[3,3],[4,4],[0,0],[0,0],[0,3]],s.OPTABLE={prefix:{"(":s.MO.OPEN,"+":s.MO.BIN01,"-":s.MO.BIN01,"[":s.MO.OPEN,"{":s.MO.OPEN,"|":s.MO.OPEN,"||":[0,0,o.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"¬":s.MO.ORD21,"±":s.MO.BIN01,"‖":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"‘":[0,0,o.TEXCLASS.OPEN,{fence:!0}],"“":[0,0,o.TEXCLASS.OPEN,{fence:!0}],"ⅅ":s.MO.ORD21,"ⅆ":r(2,0,o.TEXCLASS.ORD),"∀":s.MO.ORD21,"∂":s.MO.ORD21,"∃":s.MO.ORD21,"∄":s.MO.ORD21,"∇":s.MO.ORD21,"∏":s.MO.OP,"∐":s.MO.OP,"∑":s.MO.OP,"−":s.MO.BIN01,"∓":s.MO.BIN01,"√":[1,1,o.TEXCLASS.ORD,{stretchy:!0}],"∛":s.MO.ORD11,"∜":s.MO.ORD11,"∠":s.MO.ORD,"∡":s.MO.ORD,"∢":s.MO.ORD,"∫":s.MO.INTEGRAL,"∬":s.MO.INTEGRAL,"∭":s.MO.INTEGRAL,"∮":s.MO.INTEGRAL,"∯":s.MO.INTEGRAL,"∰":s.MO.INTEGRAL,"∱":s.MO.INTEGRAL,"∲":s.MO.INTEGRAL,"∳":s.MO.INTEGRAL,"⋀":s.MO.OP,"⋁":s.MO.OP,"⋂":s.MO.OP,"⋃":s.MO.OP,"⌈":s.MO.OPEN,"⌊":s.MO.OPEN,"〈":s.MO.OPEN,"❲":s.MO.OPEN,"⟦":s.MO.OPEN,"⟨":s.MO.OPEN,"⟪":s.MO.OPEN,"⟬":s.MO.OPEN,"⟮":s.MO.OPEN,"⦀":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"⦃":s.MO.OPEN,"⦅":s.MO.OPEN,"⦇":s.MO.OPEN,"⦉":s.MO.OPEN,"⦋":s.MO.OPEN,"⦍":s.MO.OPEN,"⦏":s.MO.OPEN,"⦑":s.MO.OPEN,"⦓":s.MO.OPEN,"⦕":s.MO.OPEN,"⦗":s.MO.OPEN,"⧼":s.MO.OPEN,"⨀":s.MO.OP,"⨁":s.MO.OP,"⨂":s.MO.OP,"⨃":s.MO.OP,"⨄":s.MO.OP,"⨅":s.MO.OP,"⨆":s.MO.OP,"⨇":s.MO.OP,"⨈":s.MO.OP,"⨉":s.MO.OP,"⨊":s.MO.OP,"⨋":s.MO.INTEGRAL2,"⨌":s.MO.INTEGRAL,"⨍":s.MO.INTEGRAL2,"⨎":s.MO.INTEGRAL2,"⨏":s.MO.INTEGRAL2,"⨐":s.MO.OP,"⨑":s.MO.OP,"⨒":s.MO.OP,"⨓":s.MO.OP,"⨔":s.MO.OP,"⨕":s.MO.INTEGRAL2,"⨖":s.MO.INTEGRAL2,"⨗":s.MO.INTEGRAL2,"⨘":s.MO.INTEGRAL2,"⨙":s.MO.INTEGRAL2,"⨚":s.MO.INTEGRAL2,"⨛":s.MO.INTEGRAL2,"⨜":s.MO.INTEGRAL2,"⫼":s.MO.OP,"⫿":s.MO.OP},postfix:{"!!":r(1,0),"!":[1,0,o.TEXCLASS.CLOSE,null],'"':s.MO.ACCENT,"&":s.MO.ORD,")":s.MO.CLOSE,"++":r(0,0),"--":r(0,0),"..":r(0,0),"...":s.MO.ORD,"'":s.MO.ACCENT,"]":s.MO.CLOSE,"^":s.MO.WIDEACCENT,_:s.MO.WIDEACCENT,"`":s.MO.ACCENT,"|":s.MO.CLOSE,"}":s.MO.CLOSE,"~":s.MO.WIDEACCENT,"||":[0,0,o.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"¨":s.MO.ACCENT,"ª":s.MO.ACCENT,"¯":s.MO.WIDEACCENT,"°":s.MO.ORD,"²":s.MO.ACCENT,"³":s.MO.ACCENT,"´":s.MO.ACCENT,"¸":s.MO.ACCENT,"¹":s.MO.ACCENT,"º":s.MO.ACCENT,"ˆ":s.MO.WIDEACCENT,"ˇ":s.MO.WIDEACCENT,"ˉ":s.MO.WIDEACCENT,"ˊ":s.MO.ACCENT,"ˋ":s.MO.ACCENT,"ˍ":s.MO.WIDEACCENT,"˘":s.MO.ACCENT,"˙":s.MO.ACCENT,"˚":s.MO.ACCENT,"˜":s.MO.WIDEACCENT,"˝":s.MO.ACCENT,"˷":s.MO.WIDEACCENT,"̂":s.MO.WIDEACCENT,"̑":s.MO.ACCENT,"϶":s.MO.REL,"‖":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"’":[0,0,o.TEXCLASS.CLOSE,{fence:!0}],"‚":s.MO.ACCENT,"‛":s.MO.ACCENT,"”":[0,0,o.TEXCLASS.CLOSE,{fence:!0}],"„":s.MO.ACCENT,"‟":s.MO.ACCENT,"′":s.MO.ORD,"″":s.MO.ACCENT,"‴":s.MO.ACCENT,"‵":s.MO.ACCENT,"‶":s.MO.ACCENT,"‷":s.MO.ACCENT,"‾":s.MO.WIDEACCENT,"⁗":s.MO.ACCENT,"⃛":s.MO.ACCENT,"⃜":s.MO.ACCENT,"⌉":s.MO.CLOSE,"⌋":s.MO.CLOSE,"〉":s.MO.CLOSE,"⎴":s.MO.WIDEACCENT,"⎵":s.MO.WIDEACCENT,"⏜":s.MO.WIDEACCENT,"⏝":s.MO.WIDEACCENT,"⏞":s.MO.WIDEACCENT,"⏟":s.MO.WIDEACCENT,"⏠":s.MO.WIDEACCENT,"⏡":s.MO.WIDEACCENT,"■":s.MO.BIN3,"□":s.MO.BIN3,"▪":s.MO.BIN3,"▫":s.MO.BIN3,"▭":s.MO.BIN3,"▮":s.MO.BIN3,"▯":s.MO.BIN3,"▰":s.MO.BIN3,"▱":s.MO.BIN3,"▲":s.MO.BIN4,"▴":s.MO.BIN4,"▶":s.MO.BIN4,"▷":s.MO.BIN4,"▸":s.MO.BIN4,"▼":s.MO.BIN4,"▾":s.MO.BIN4,"◀":s.MO.BIN4,"◁":s.MO.BIN4,"◂":s.MO.BIN4,"◄":s.MO.BIN4,"◅":s.MO.BIN4,"◆":s.MO.BIN4,"◇":s.MO.BIN4,"◈":s.MO.BIN4,"◉":s.MO.BIN4,"◌":s.MO.BIN4,"◍":s.MO.BIN4,"◎":s.MO.BIN4,"●":s.MO.BIN4,"◖":s.MO.BIN4,"◗":s.MO.BIN4,"◦":s.MO.BIN4,"♭":s.MO.ORD02,"♮":s.MO.ORD02,"♯":s.MO.ORD02,"❳":s.MO.CLOSE,"⟧":s.MO.CLOSE,"⟩":s.MO.CLOSE,"⟫":s.MO.CLOSE,"⟭":s.MO.CLOSE,"⟯":s.MO.CLOSE,"⦀":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"⦄":s.MO.CLOSE,"⦆":s.MO.CLOSE,"⦈":s.MO.CLOSE,"⦊":s.MO.CLOSE,"⦌":s.MO.CLOSE,"⦎":s.MO.CLOSE,"⦐":s.MO.CLOSE,"⦒":s.MO.CLOSE,"⦔":s.MO.CLOSE,"⦖":s.MO.CLOSE,"⦘":s.MO.CLOSE,"⧽":s.MO.CLOSE},infix:{"!=":s.MO.BIN4,"#":s.MO.ORD,$:s.MO.ORD,"%":[3,3,o.TEXCLASS.ORD,null],"&&":s.MO.BIN4,"":s.MO.ORD,"*":s.MO.BIN3,"**":r(1,1),"*=":s.MO.BIN4,"+":s.MO.BIN4,"+=":s.MO.BIN4,",":[0,3,o.TEXCLASS.PUNCT,{linebreakstyle:"after",separator:!0}],"-":s.MO.BIN4,"-=":s.MO.BIN4,"->":s.MO.BIN5,".":[0,3,o.TEXCLASS.PUNCT,{separator:!0}],"/":s.MO.ORD11,"//":r(1,1),"/=":s.MO.BIN4,":":[1,2,o.TEXCLASS.REL,null],":=":s.MO.BIN4,";":[0,3,o.TEXCLASS.PUNCT,{linebreakstyle:"after",separator:!0}],"<":s.MO.REL,"<=":s.MO.BIN5,"<>":r(1,1),"=":s.MO.REL,"==":s.MO.BIN4,">":s.MO.REL,">=":s.MO.BIN5,"?":[1,1,o.TEXCLASS.CLOSE,null],"@":s.MO.ORD11,"\\":s.MO.ORD,"^":s.MO.ORD11,_:s.MO.ORD11,"|":[2,2,o.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"||":[2,2,o.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[2,2,o.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"±":s.MO.BIN4,"·":s.MO.BIN4,"×":s.MO.BIN4,"÷":s.MO.BIN4,"ʹ":s.MO.ORD,"̀":s.MO.ACCENT,"́":s.MO.ACCENT,"̃":s.MO.WIDEACCENT,"̄":s.MO.ACCENT,"̆":s.MO.ACCENT,"̇":s.MO.ACCENT,"̈":s.MO.ACCENT,"̌":s.MO.ACCENT,"̲":s.MO.WIDEACCENT,"̸":s.MO.REL4,"―":[0,0,o.TEXCLASS.ORD,{stretchy:!0}],"‗":[0,0,o.TEXCLASS.ORD,{stretchy:!0}],"†":s.MO.BIN3,"‡":s.MO.BIN3,"•":s.MO.BIN4,"…":s.MO.INNER,"⁃":s.MO.BIN4,"⁄":s.MO.TALLBIN,"⁡":s.MO.NONE,"⁢":s.MO.NONE,"⁣":[0,0,o.TEXCLASS.NONE,{linebreakstyle:"after",separator:!0}],"⁤":s.MO.NONE,"⃗":s.MO.ACCENT,"ℑ":s.MO.ORD,"ℓ":s.MO.ORD,"℘":s.MO.ORD,"ℜ":s.MO.ORD,"←":s.MO.WIDEREL,"↑":s.MO.RELSTRETCH,"→":s.MO.WIDEREL,"↓":s.MO.RELSTRETCH,"↔":s.MO.WIDEREL,"↕":s.MO.RELSTRETCH,"↖":s.MO.RELSTRETCH,"↗":s.MO.RELSTRETCH,"↘":s.MO.RELSTRETCH,"↙":s.MO.RELSTRETCH,"↚":s.MO.RELACCENT,"↛":s.MO.RELACCENT,"↜":s.MO.WIDEREL,"↝":s.MO.WIDEREL,"↞":s.MO.WIDEREL,"↟":s.MO.WIDEREL,"↠":s.MO.WIDEREL,"↡":s.MO.RELSTRETCH,"↢":s.MO.WIDEREL,"↣":s.MO.WIDEREL,"↤":s.MO.WIDEREL,"↥":s.MO.RELSTRETCH,"↦":s.MO.WIDEREL,"↧":s.MO.RELSTRETCH,"↨":s.MO.RELSTRETCH,"↩":s.MO.WIDEREL,"↪":s.MO.WIDEREL,"↫":s.MO.WIDEREL,"↬":s.MO.WIDEREL,"↭":s.MO.WIDEREL,"↮":s.MO.RELACCENT,"↯":s.MO.RELSTRETCH,"↰":s.MO.RELSTRETCH,"↱":s.MO.RELSTRETCH,"↲":s.MO.RELSTRETCH,"↳":s.MO.RELSTRETCH,"↴":s.MO.RELSTRETCH,"↵":s.MO.RELSTRETCH,"↶":s.MO.RELACCENT,"↷":s.MO.RELACCENT,"↸":s.MO.REL,"↹":s.MO.WIDEREL,"↺":s.MO.REL,"↻":s.MO.REL,"↼":s.MO.WIDEREL,"↽":s.MO.WIDEREL,"↾":s.MO.RELSTRETCH,"↿":s.MO.RELSTRETCH,"⇀":s.MO.WIDEREL,"⇁":s.MO.WIDEREL,"⇂":s.MO.RELSTRETCH,"⇃":s.MO.RELSTRETCH,"⇄":s.MO.WIDEREL,"⇅":s.MO.RELSTRETCH,"⇆":s.MO.WIDEREL,"⇇":s.MO.WIDEREL,"⇈":s.MO.RELSTRETCH,"⇉":s.MO.WIDEREL,"⇊":s.MO.RELSTRETCH,"⇋":s.MO.WIDEREL,"⇌":s.MO.WIDEREL,"⇍":s.MO.RELACCENT,"⇎":s.MO.RELACCENT,"⇏":s.MO.RELACCENT,"⇐":s.MO.WIDEREL,"⇑":s.MO.RELSTRETCH,"⇒":s.MO.WIDEREL,"⇓":s.MO.RELSTRETCH,"⇔":s.MO.WIDEREL,"⇕":s.MO.RELSTRETCH,"⇖":s.MO.RELSTRETCH,"⇗":s.MO.RELSTRETCH,"⇘":s.MO.RELSTRETCH,"⇙":s.MO.RELSTRETCH,"⇚":s.MO.WIDEREL,"⇛":s.MO.WIDEREL,"⇜":s.MO.WIDEREL,"⇝":s.MO.WIDEREL,"⇞":s.MO.REL,"⇟":s.MO.REL,"⇠":s.MO.WIDEREL,"⇡":s.MO.RELSTRETCH,"⇢":s.MO.WIDEREL,"⇣":s.MO.RELSTRETCH,"⇤":s.MO.WIDEREL,"⇥":s.MO.WIDEREL,"⇦":s.MO.WIDEREL,"⇧":s.MO.RELSTRETCH,"⇨":s.MO.WIDEREL,"⇩":s.MO.RELSTRETCH,"⇪":s.MO.RELSTRETCH,"⇫":s.MO.RELSTRETCH,"⇬":s.MO.RELSTRETCH,"⇭":s.MO.RELSTRETCH,"⇮":s.MO.RELSTRETCH,"⇯":s.MO.RELSTRETCH,"⇰":s.MO.WIDEREL,"⇱":s.MO.REL,"⇲":s.MO.REL,"⇳":s.MO.RELSTRETCH,"⇴":s.MO.RELACCENT,"⇵":s.MO.RELSTRETCH,"⇶":s.MO.WIDEREL,"⇷":s.MO.RELACCENT,"⇸":s.MO.RELACCENT,"⇹":s.MO.RELACCENT,"⇺":s.MO.RELACCENT,"⇻":s.MO.RELACCENT,"⇼":s.MO.RELACCENT,"⇽":s.MO.WIDEREL,"⇾":s.MO.WIDEREL,"⇿":s.MO.WIDEREL,"∁":r(1,2,o.TEXCLASS.ORD),"∅":s.MO.ORD,"∆":s.MO.BIN3,"∈":s.MO.REL,"∉":s.MO.REL,"∊":s.MO.REL,"∋":s.MO.REL,"∌":s.MO.REL,"∍":s.MO.REL,"∎":s.MO.BIN3,"−":s.MO.BIN4,"∓":s.MO.BIN4,"∔":s.MO.BIN4,"∕":s.MO.TALLBIN,"∖":s.MO.BIN4,"∗":s.MO.BIN4,"∘":s.MO.BIN4,"∙":s.MO.BIN4,"∝":s.MO.REL,"∞":s.MO.ORD,"∟":s.MO.REL,"∣":s.MO.REL,"∤":s.MO.REL,"∥":s.MO.REL,"∦":s.MO.REL,"∧":s.MO.BIN4,"∨":s.MO.BIN4,"∩":s.MO.BIN4,"∪":s.MO.BIN4,"∴":s.MO.REL,"∵":s.MO.REL,"∶":s.MO.REL,"∷":s.MO.REL,"∸":s.MO.BIN4,"∹":s.MO.REL,"∺":s.MO.BIN4,"∻":s.MO.REL,"∼":s.MO.REL,"∽":s.MO.REL,"∽̱":s.MO.BIN3,"∾":s.MO.REL,"∿":s.MO.BIN3,"≀":s.MO.BIN4,"≁":s.MO.REL,"≂":s.MO.REL,"≂̸":s.MO.REL,"≃":s.MO.REL,"≄":s.MO.REL,"≅":s.MO.REL,"≆":s.MO.REL,"≇":s.MO.REL,"≈":s.MO.REL,"≉":s.MO.REL,"≊":s.MO.REL,"≋":s.MO.REL,"≌":s.MO.REL,"≍":s.MO.REL,"≎":s.MO.REL,"≎̸":s.MO.REL,"≏":s.MO.REL,"≏̸":s.MO.REL,"≐":s.MO.REL,"≑":s.MO.REL,"≒":s.MO.REL,"≓":s.MO.REL,"≔":s.MO.REL,"≕":s.MO.REL,"≖":s.MO.REL,"≗":s.MO.REL,"≘":s.MO.REL,"≙":s.MO.REL,"≚":s.MO.REL,"≛":s.MO.REL,"≜":s.MO.REL,"≝":s.MO.REL,"≞":s.MO.REL,"≟":s.MO.REL,"≠":s.MO.REL,"≡":s.MO.REL,"≢":s.MO.REL,"≣":s.MO.REL,"≤":s.MO.REL,"≥":s.MO.REL,"≦":s.MO.REL,"≦̸":s.MO.REL,"≧":s.MO.REL,"≨":s.MO.REL,"≩":s.MO.REL,"≪":s.MO.REL,"≪̸":s.MO.REL,"≫":s.MO.REL,"≫̸":s.MO.REL,"≬":s.MO.REL,"≭":s.MO.REL,"≮":s.MO.REL,"≯":s.MO.REL,"≰":s.MO.REL,"≱":s.MO.REL,"≲":s.MO.REL,"≳":s.MO.REL,"≴":s.MO.REL,"≵":s.MO.REL,"≶":s.MO.REL,"≷":s.MO.REL,"≸":s.MO.REL,"≹":s.MO.REL,"≺":s.MO.REL,"≻":s.MO.REL,"≼":s.MO.REL,"≽":s.MO.REL,"≾":s.MO.REL,"≿":s.MO.REL,"≿̸":s.MO.REL,"⊀":s.MO.REL,"⊁":s.MO.REL,"⊂":s.MO.REL,"⊂⃒":s.MO.REL,"⊃":s.MO.REL,"⊃⃒":s.MO.REL,"⊄":s.MO.REL,"⊅":s.MO.REL,"⊆":s.MO.REL,"⊇":s.MO.REL,"⊈":s.MO.REL,"⊉":s.MO.REL,"⊊":s.MO.REL,"⊋":s.MO.REL,"⊌":s.MO.BIN4,"⊍":s.MO.BIN4,"⊎":s.MO.BIN4,"⊏":s.MO.REL,"⊏̸":s.MO.REL,"⊐":s.MO.REL,"⊐̸":s.MO.REL,"⊑":s.MO.REL,"⊒":s.MO.REL,"⊓":s.MO.BIN4,"⊔":s.MO.BIN4,"⊕":s.MO.BIN4,"⊖":s.MO.BIN4,"⊗":s.MO.BIN4,"⊘":s.MO.BIN4,"⊙":s.MO.BIN4,"⊚":s.MO.BIN4,"⊛":s.MO.BIN4,"⊜":s.MO.BIN4,"⊝":s.MO.BIN4,"⊞":s.MO.BIN4,"⊟":s.MO.BIN4,"⊠":s.MO.BIN4,"⊡":s.MO.BIN4,"⊢":s.MO.REL,"⊣":s.MO.REL,"⊤":s.MO.ORD55,"⊥":s.MO.REL,"⊦":s.MO.REL,"⊧":s.MO.REL,"⊨":s.MO.REL,"⊩":s.MO.REL,"⊪":s.MO.REL,"⊫":s.MO.REL,"⊬":s.MO.REL,"⊭":s.MO.REL,"⊮":s.MO.REL,"⊯":s.MO.REL,"⊰":s.MO.REL,"⊱":s.MO.REL,"⊲":s.MO.REL,"⊳":s.MO.REL,"⊴":s.MO.REL,"⊵":s.MO.REL,"⊶":s.MO.REL,"⊷":s.MO.REL,"⊸":s.MO.REL,"⊹":s.MO.REL,"⊺":s.MO.BIN4,"⊻":s.MO.BIN4,"⊼":s.MO.BIN4,"⊽":s.MO.BIN4,"⊾":s.MO.BIN3,"⊿":s.MO.BIN3,"⋄":s.MO.BIN4,"⋅":s.MO.BIN4,"⋆":s.MO.BIN4,"⋇":s.MO.BIN4,"⋈":s.MO.REL,"⋉":s.MO.BIN4,"⋊":s.MO.BIN4,"⋋":s.MO.BIN4,"⋌":s.MO.BIN4,"⋍":s.MO.REL,"⋎":s.MO.BIN4,"⋏":s.MO.BIN4,"⋐":s.MO.REL,"⋑":s.MO.REL,"⋒":s.MO.BIN4,"⋓":s.MO.BIN4,"⋔":s.MO.REL,"⋕":s.MO.REL,"⋖":s.MO.REL,"⋗":s.MO.REL,"⋘":s.MO.REL,"⋙":s.MO.REL,"⋚":s.MO.REL,"⋛":s.MO.REL,"⋜":s.MO.REL,"⋝":s.MO.REL,"⋞":s.MO.REL,"⋟":s.MO.REL,"⋠":s.MO.REL,"⋡":s.MO.REL,"⋢":s.MO.REL,"⋣":s.MO.REL,"⋤":s.MO.REL,"⋥":s.MO.REL,"⋦":s.MO.REL,"⋧":s.MO.REL,"⋨":s.MO.REL,"⋩":s.MO.REL,"⋪":s.MO.REL,"⋫":s.MO.REL,"⋬":s.MO.REL,"⋭":s.MO.REL,"⋮":s.MO.ORD55,"⋯":s.MO.INNER,"⋰":s.MO.REL,"⋱":[5,5,o.TEXCLASS.INNER,null],"⋲":s.MO.REL,"⋳":s.MO.REL,"⋴":s.MO.REL,"⋵":s.MO.REL,"⋶":s.MO.REL,"⋷":s.MO.REL,"⋸":s.MO.REL,"⋹":s.MO.REL,"⋺":s.MO.REL,"⋻":s.MO.REL,"⋼":s.MO.REL,"⋽":s.MO.REL,"⋾":s.MO.REL,"⋿":s.MO.REL,"⌅":s.MO.BIN3,"⌆":s.MO.BIN3,"⌢":s.MO.REL4,"⌣":s.MO.REL4,"〈":s.MO.OPEN,"〉":s.MO.CLOSE,"⎪":s.MO.ORD,"⎯":[0,0,o.TEXCLASS.ORD,{stretchy:!0}],"⎰":s.MO.OPEN,"⎱":s.MO.CLOSE,"─":s.MO.ORD,"△":s.MO.BIN4,"▵":s.MO.BIN4,"▹":s.MO.BIN4,"▽":s.MO.BIN4,"▿":s.MO.BIN4,"◃":s.MO.BIN4,"◯":s.MO.BIN3,"♠":s.MO.ORD,"♡":s.MO.ORD,"♢":s.MO.ORD,"♣":s.MO.ORD,"❘":s.MO.REL,"⟰":s.MO.RELSTRETCH,"⟱":s.MO.RELSTRETCH,"⟵":s.MO.WIDEREL,"⟶":s.MO.WIDEREL,"⟷":s.MO.WIDEREL,"⟸":s.MO.WIDEREL,"⟹":s.MO.WIDEREL,"⟺":s.MO.WIDEREL,"⟻":s.MO.WIDEREL,"⟼":s.MO.WIDEREL,"⟽":s.MO.WIDEREL,"⟾":s.MO.WIDEREL,"⟿":s.MO.WIDEREL,"⤀":s.MO.RELACCENT,"⤁":s.MO.RELACCENT,"⤂":s.MO.RELACCENT,"⤃":s.MO.RELACCENT,"⤄":s.MO.RELACCENT,"⤅":s.MO.RELACCENT,"⤆":s.MO.RELACCENT,"⤇":s.MO.RELACCENT,"⤈":s.MO.REL,"⤉":s.MO.REL,"⤊":s.MO.RELSTRETCH,"⤋":s.MO.RELSTRETCH,"⤌":s.MO.WIDEREL,"⤍":s.MO.WIDEREL,"⤎":s.MO.WIDEREL,"⤏":s.MO.WIDEREL,"⤐":s.MO.WIDEREL,"⤑":s.MO.RELACCENT,"⤒":s.MO.RELSTRETCH,"⤓":s.MO.RELSTRETCH,"⤔":s.MO.RELACCENT,"⤕":s.MO.RELACCENT,"⤖":s.MO.RELACCENT,"⤗":s.MO.RELACCENT,"⤘":s.MO.RELACCENT,"⤙":s.MO.RELACCENT,"⤚":s.MO.RELACCENT,"⤛":s.MO.RELACCENT,"⤜":s.MO.RELACCENT,"⤝":s.MO.RELACCENT,"⤞":s.MO.RELACCENT,"⤟":s.MO.RELACCENT,"⤠":s.MO.RELACCENT,"⤡":s.MO.RELSTRETCH,"⤢":s.MO.RELSTRETCH,"⤣":s.MO.REL,"⤤":s.MO.REL,"⤥":s.MO.REL,"⤦":s.MO.REL,"⤧":s.MO.REL,"⤨":s.MO.REL,"⤩":s.MO.REL,"⤪":s.MO.REL,"⤫":s.MO.REL,"⤬":s.MO.REL,"⤭":s.MO.REL,"⤮":s.MO.REL,"⤯":s.MO.REL,"⤰":s.MO.REL,"⤱":s.MO.REL,"⤲":s.MO.REL,"⤳":s.MO.RELACCENT,"⤴":s.MO.REL,"⤵":s.MO.REL,"⤶":s.MO.REL,"⤷":s.MO.REL,"⤸":s.MO.REL,"⤹":s.MO.REL,"⤺":s.MO.RELACCENT,"⤻":s.MO.RELACCENT,"⤼":s.MO.RELACCENT,"⤽":s.MO.RELACCENT,"⤾":s.MO.REL,"⤿":s.MO.REL,"⥀":s.MO.REL,"⥁":s.MO.REL,"⥂":s.MO.RELACCENT,"⥃":s.MO.RELACCENT,"⥄":s.MO.RELACCENT,"⥅":s.MO.RELACCENT,"⥆":s.MO.RELACCENT,"⥇":s.MO.RELACCENT,"⥈":s.MO.RELACCENT,"⥉":s.MO.REL,"⥊":s.MO.RELACCENT,"⥋":s.MO.RELACCENT,"⥌":s.MO.REL,"⥍":s.MO.REL,"⥎":s.MO.WIDEREL,"⥏":s.MO.RELSTRETCH,"⥐":s.MO.WIDEREL,"⥑":s.MO.RELSTRETCH,"⥒":s.MO.WIDEREL,"⥓":s.MO.WIDEREL,"⥔":s.MO.RELSTRETCH,"⥕":s.MO.RELSTRETCH,"⥖":s.MO.RELSTRETCH,"⥗":s.MO.RELSTRETCH,"⥘":s.MO.RELSTRETCH,"⥙":s.MO.RELSTRETCH,"⥚":s.MO.WIDEREL,"⥛":s.MO.WIDEREL,"⥜":s.MO.RELSTRETCH,"⥝":s.MO.RELSTRETCH,"⥞":s.MO.WIDEREL,"⥟":s.MO.WIDEREL,"⥠":s.MO.RELSTRETCH,"⥡":s.MO.RELSTRETCH,"⥢":s.MO.RELACCENT,"⥣":s.MO.REL,"⥤":s.MO.RELACCENT,"⥥":s.MO.REL,"⥦":s.MO.RELACCENT,"⥧":s.MO.RELACCENT,"⥨":s.MO.RELACCENT,"⥩":s.MO.RELACCENT,"⥪":s.MO.RELACCENT,"⥫":s.MO.RELACCENT,"⥬":s.MO.RELACCENT,"⥭":s.MO.RELACCENT,"⥮":s.MO.RELSTRETCH,"⥯":s.MO.RELSTRETCH,"⥰":s.MO.RELACCENT,"⥱":s.MO.RELACCENT,"⥲":s.MO.RELACCENT,"⥳":s.MO.RELACCENT,"⥴":s.MO.RELACCENT,"⥵":s.MO.RELACCENT,"⥶":s.MO.RELACCENT,"⥷":s.MO.RELACCENT,"⥸":s.MO.RELACCENT,"⥹":s.MO.RELACCENT,"⥺":s.MO.RELACCENT,"⥻":s.MO.RELACCENT,"⥼":s.MO.RELACCENT,"⥽":s.MO.RELACCENT,"⥾":s.MO.REL,"⥿":s.MO.REL,"⦁":s.MO.BIN3,"⦂":s.MO.BIN3,"⦙":s.MO.BIN3,"⦚":s.MO.BIN3,"⦛":s.MO.BIN3,"⦜":s.MO.BIN3,"⦝":s.MO.BIN3,"⦞":s.MO.BIN3,"⦟":s.MO.BIN3,"⦠":s.MO.BIN3,"⦡":s.MO.BIN3,"⦢":s.MO.BIN3,"⦣":s.MO.BIN3,"⦤":s.MO.BIN3,"⦥":s.MO.BIN3,"⦦":s.MO.BIN3,"⦧":s.MO.BIN3,"⦨":s.MO.BIN3,"⦩":s.MO.BIN3,"⦪":s.MO.BIN3,"⦫":s.MO.BIN3,"⦬":s.MO.BIN3,"⦭":s.MO.BIN3,"⦮":s.MO.BIN3,"⦯":s.MO.BIN3,"⦰":s.MO.BIN3,"⦱":s.MO.BIN3,"⦲":s.MO.BIN3,"⦳":s.MO.BIN3,"⦴":s.MO.BIN3,"⦵":s.MO.BIN3,"⦶":s.MO.BIN4,"⦷":s.MO.BIN4,"⦸":s.MO.BIN4,"⦹":s.MO.BIN4,"⦺":s.MO.BIN4,"⦻":s.MO.BIN4,"⦼":s.MO.BIN4,"⦽":s.MO.BIN4,"⦾":s.MO.BIN4,"⦿":s.MO.BIN4,"⧀":s.MO.REL,"⧁":s.MO.REL,"⧂":s.MO.BIN3,"⧃":s.MO.BIN3,"⧄":s.MO.BIN4,"⧅":s.MO.BIN4,"⧆":s.MO.BIN4,"⧇":s.MO.BIN4,"⧈":s.M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BIN4,"⩳":s.MO.REL,"⩴":s.MO.REL,"⩵":s.MO.REL,"⩶":s.MO.REL,"⩷":s.MO.REL,"⩸":s.MO.REL,"⩹":s.MO.REL,"⩺":s.MO.REL,"⩻":s.MO.REL,"⩼":s.MO.REL,"⩽":s.MO.REL,"⩽̸":s.MO.REL,"⩾":s.MO.REL,"⩾̸":s.MO.REL,"⩿":s.MO.REL,"⪀":s.MO.REL,"⪁":s.MO.REL,"⪂":s.MO.REL,"⪃":s.MO.REL,"⪄":s.MO.REL,"⪅":s.MO.REL,"⪆":s.MO.REL,"⪇":s.MO.REL,"⪈":s.MO.REL,"⪉":s.MO.REL,"⪊":s.MO.REL,"⪋":s.MO.REL,"⪌":s.MO.REL,"⪍":s.MO.REL,"⪎":s.MO.REL,"⪏":s.MO.REL,"⪐":s.MO.REL,"⪑":s.MO.REL,"⪒":s.MO.REL,"⪓":s.MO.REL,"⪔":s.MO.REL,"⪕":s.MO.REL,"⪖":s.MO.REL,"⪗":s.MO.REL,"⪘":s.MO.REL,"⪙":s.MO.REL,"⪚":s.MO.REL,"⪛":s.MO.REL,"⪜":s.MO.REL,"⪝":s.MO.REL,"⪞":s.MO.REL,"⪟":s.MO.REL,"⪠":s.MO.REL,"⪡":s.MO.REL,"⪡̸":s.MO.REL,"⪢":s.MO.REL,"⪢̸":s.MO.REL,"⪣":s.MO.REL,"⪤":s.MO.REL,"⪥":s.MO.REL,"⪦":s.MO.REL,"⪧":s.MO.REL,"⪨":s.MO.REL,"⪩":s.MO.REL,"⪪":s.MO.REL,"⪫":s.MO.REL,"⪬":s.MO.REL,"⪭":s.MO.REL,"⪮":s.MO.REL,"⪯":s.MO.REL,"⪯̸":s.MO.REL,"⪰":s.MO.REL,"⪰̸":s.MO.REL,"⪱":s.MO.REL,"⪲":s.MO.REL,"⪳":s.MO.REL,"⪴":s.MO.REL,"⪵":s.MO.REL,"⪶":s.MO.REL,"⪷":s.MO.REL,"⪸":s.MO.REL,"⪹":s.MO.REL,"⪺":s.MO.REL,"⪻":s.MO.REL,"⪼":s.MO.REL,"⪽":s.MO.REL,"⪾":s.MO.REL,"⪿":s.MO.REL,"⫀":s.MO.REL,"⫁":s.MO.REL,"⫂":s.MO.REL,"⫃":s.MO.REL,"⫄":s.MO.REL,"⫅":s.MO.REL,"⫆":s.MO.REL,"⫇":s.MO.REL,"⫈":s.MO.REL,"⫉":s.MO.REL,"⫊":s.MO.REL,"⫋":s.MO.REL,"⫌":s.MO.REL,"⫍":s.MO.REL,"⫎":s.MO.REL,"⫏":s.MO.REL,"⫐":s.MO.REL,"⫑":s.MO.REL,"⫒":s.MO.REL,"⫓":s.MO.REL,"⫔":s.MO.REL,"⫕":s.MO.REL,"⫖":s.MO.REL,"⫗":s.MO.REL,"⫘":s.MO.REL,"⫙":s.MO.REL,"⫚":s.MO.REL,"⫛":s.MO.REL,"⫝":s.MO.REL,"⫝̸":s.MO.REL,"⫞":s.MO.REL,"⫟":s.MO.REL,"⫠":s.MO.REL,"⫡":s.MO.REL,"⫢":s.MO.REL,"⫣":s.MO.REL,"⫤":s.MO.REL,"⫥":s.MO.REL,"⫦":s.MO.REL,"⫧":s.MO.REL,"⫨":s.MO.REL,"⫩":s.MO.REL,"⫪":s.MO.REL,"⫫":s.MO.REL,"⫬":s.MO.REL,"⫭":s.MO.REL,"⫮":s.MO.REL,"⫯":s.MO.REL,"⫰":s.MO.REL,"⫱":s.MO.REL,"⫲":s.MO.REL,"⫳":s.MO.REL,"⫴":s.MO.BIN4,"⫵":s.MO.BIN4,"⫶":s.MO.BIN4,"⫷":s.MO.REL,"⫸":s.MO.REL,"⫹":s.MO.REL,"⫺":s.MO.REL,"⫻":s.MO.BIN4,"⫽":s.MO.BIN4,"⫾":s.MO.BIN3,"⭅":s.MO.RELSTRETCH,"⭆":s.MO.RELSTRETCH,"〈":s.MO.OPEN,"〉":s.MO.CLOSE,"︷":s.MO.WIDEACCENT,"︸":s.MO.WIDEACCENT}},s.OPTABLE.infix["^"]=s.MO.WIDEREL,s.OPTABLE.infix._=s.MO.WIDEREL,s.OPTABLE.infix["⫝̸"]=s.MO.REL},9259:function(t,n,e){var o,r,i=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),u=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0"+(r.match(/\S/)?"\n"+r+e:"")+""},p.prototype.visitAnnotationNode=function(t,e){return e+""+this.childNodeMml(t,"","")+""},p.prototype.visitDefault=function(t,e){var r=t.kind,n=a(t.isToken||0===t.childNodes.length?["",""]:["\n",e],2),o=n[0],n=n[1],i=this.childNodeMml(t,e+" ",o);return e+"<"+r+this.getAttributes(t)+">"+(i.match(/\S/)?o+i+n:"")+""},p.prototype.childNodeMml=function(t,e,r){var n,o,i="";try{for(var a=u(t.childNodes),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this.visitNode(l,e)+r}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},p.prototype.getAttributes=function(t){var e,r,n=[],o=this.constructor.defaultAttributes[t.kind]||{},i=Object.assign({},o,this.getDataAttributes(t),t.attributes.getAllAttributes()),o=this.constructor.variants;i.hasOwnProperty("mathvariant")&&o.hasOwnProperty(i.mathvariant)&&(i.mathvariant=o[i.mathvariant]);try{for(var a=u(Object.keys(i)),s=a.next();!s.done;s=a.next()){var l=s.value,c=String(i[l]);void 0!==c&&n.push(l+'="'+this.quoteHTML(c)+'"')}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return n.length?" "+n.join(" "):""},p.prototype.getDataAttributes=function(t){var e,r={},n=t.attributes.getExplicit("mathvariant"),o=this.constructor.variants,o=(n&&o.hasOwnProperty(n)&&this.setDataAttribute(r,"variant",n),t.getProperty("variantForm")&&this.setDataAttribute(r,"alternate","1"),t.getProperty("pseudoscript")&&this.setDataAttribute(r,"pseudoscript","true"),!1===t.getProperty("autoOP")&&this.setDataAttribute(r,"auto-op","false"),t.getProperty("scriptalign")),n=(o&&this.setDataAttribute(r,"script-align",o),t.getProperty("texClass"));return void 0!==n&&(o=!0,(o=n===l.TEXCLASS.OP&&t.isKind("mi")?!(1<(e=t.getText()).length&&e.match(c.MmlMi.operatorName)):o)&&this.setDataAttribute(r,"texclass",n<0?"NONE":l.TEXCLASSNAMES[n])),t.getProperty("scriptlevel")&&!1===t.getProperty("useHeight")&&this.setDataAttribute(r,"smallmatrix","true"),r},p.prototype.setDataAttribute=function(t,e,r){t[n.DATAMJX+e]=r},p.prototype.quoteHTML=function(t){return t.replace(/&/g,"&").replace(//g,">").replace(/\"/g,""").replace(/[\uD800-\uDBFF]./g,n.toEntity).replace(/[\u0080-\uD7FF\uE000-\uFFFF]/g,n.toEntity)},p.variants={"-tex-calligraphic":"script","-tex-bold-calligraphic":"bold-script","-tex-oldstyle":"normal","-tex-bold-oldstyle":"bold","-tex-mathit":"italic"},p.defaultAttributes={math:{xmlns:"http://www.w3.org/1998/Math/MathML"}},p);function p(){return null!==r&&r.apply(this,arguments)||this}n.SerializedMmlVisitor=e},2975:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractOutputJax=void 0;var n=r(7233),o=r(7525);function i(t){void 0===t&&(t={}),this.adaptor=null;var e=this.constructor;this.options=(0,n.userOptions)((0,n.defaultOptions)({},e.OPTIONS),t),this.postFilters=new o.FunctionList}Object.defineProperty(i.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),i.prototype.setAdaptor=function(t){this.adaptor=t},i.prototype.initialize=function(){},i.prototype.reset=function(){for(var t=[],e=0;e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=(Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractEmptyNode=e.AbstractNode=void 0,Object.defineProperty(i.prototype,"kind",{get:function(){return"unknown"},enumerable:!1,configurable:!0}),i.prototype.setProperty=function(t,e){this.properties[t]=e},i.prototype.getProperty=function(t){return this.properties[t]},i.prototype.getPropertyNames=function(){return Object.keys(this.properties)},i.prototype.getAllProperties=function(){return this.properties},i.prototype.removeProperty=function(){for(var t,e,r=[],n=0;n=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=(Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLDocument=void 0,r(5722)),T=r(7233),l=r(3363),c=r(3335),u=r(5138),p=r(4474),r=(i=s.AbstractMathDocument,o(h,i),h.prototype.findPosition=function(t,e,r,n){var o,i,a=this.adaptor;try{for(var s=C(n[t]),l=s.next();!l.done;l=s.next()){var c=l.value,u=A(c,2),p=u[0],h=u[1];if(e<=h&&"#text"===a.kind(p))return{node:p,n:Math.max(e,0),delim:r};e-=h}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return{node:null,n:0,delim:r}},h.prototype.mathItem=function(t,e,r){var n=t.math,o=this.findPosition(t.n,t.start.n,t.open,r),r=this.findPosition(t.n,t.end.n,t.close,r);return new this.options.MathItem(n,e,t.display,o,r)},h.prototype.findMath=function(t){var e,r,n,o,i,a,s,l,c;if(!this.processed.isSet("findMath")){this.adaptor.document=this.document,t=(0,T.userOptions)({elements:this.options.elements||[this.adaptor.body(this.document)]},t);try{for(var u=C(this.adaptor.getElements(t.elements,this.document)),p=u.next();!p.done;p=u.next()){var h=p.value,d=A([null,null],2),f=d[0],m=d[1];try{n=void 0;for(var y=C(this.inputJax),g=y.next();!g.done;g=y.next()){var b=g.value,v=new this.options.MathList;if(b.processStrings){null===f&&(f=(i=A(this.domStrings.find(h),2))[0],m=i[1]);try{a=void 0;for(var _=C(b.findMath(f)),S=_.next();!S.done;S=_.next()){var O=S.value;v.push(this.mathItem(O,b,m))}}catch(t){a={error:t}}finally{try{S&&!S.done&&(s=_.return)&&s.call(_)}finally{if(a)throw a.error}}}else try{l=void 0;for(var M=C(b.findMath(h)),x=M.next();!x.done;x=M.next()){var O=x.value,E=new this.options.MathItem(O.math,b,O.display,O.start,O.end);v.push(E)}}catch(t){l={error:t}}finally{try{x&&!x.done&&(c=M.return)&&c.call(M)}finally{if(l)throw l.error}}this.math.merge(v)}}catch(t){n={error:t}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{p&&!p.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}this.processed.set("findMath")}return this},h.prototype.updateDocument=function(){return this.processed.isSet("updateDocument")||(this.addPageElements(),this.addStyleSheet(),i.prototype.updateDocument.call(this),this.processed.set("updateDocument")),this},h.prototype.addPageElements=function(){var t=this.adaptor.body(this.document),e=this.documentPageElements();e&&this.adaptor.append(t,e)},h.prototype.addStyleSheet=function(){var t,e,r=this.documentStyleSheet(),n=this.adaptor;r&&!n.parent(r)&&(t=n.head(this.document),(e=this.findSheet(t,n.getAttribute(r,"id")))?n.replace(r,e):n.append(t,r))},h.prototype.findSheet=function(t,e){var r,n;if(e)try{for(var o=C(this.adaptor.tags(t,"style")),i=o.next();!i.done;i=o.next()){var a=i.value;if(this.adaptor.getAttribute(a,"id")===e)return a}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null},h.prototype.removeFromDocument=function(t){var e,r;if(void 0===t&&(t=!1),this.processed.isSet("updateDocument"))try{for(var n=C(this.math),o=n.next();!o.done;o=n.next()){var i=o.value;i.state()>=p.STATE.INSERTED&&i.state(p.STATE.TYPESET,t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this.processed.clear("updateDocument"),this},h.prototype.documentStyleSheet=function(){return this.outputJax.styleSheet(this)},h.prototype.documentPageElements=function(){return this.outputJax.pageElements(this)},h.prototype.addStyles=function(t){this.styles.push(t)},h.prototype.getStyles=function(){return this.styles},h.KIND="HTML",h.OPTIONS=a(a({},s.AbstractMathDocument.OPTIONS),{renderActions:(0,T.expandable)(a(a({},s.AbstractMathDocument.OPTIONS.renderActions),{styles:[p.STATE.INSERTED+1,"","updateStyleSheet",!1]})),MathList:c.HTMLMathList,MathItem:l.HTMLMathItem,DomStrings:null}),h);function h(t,e,r){var n=this,r=A((0,T.separateOptions)(r,u.HTMLDomStrings.OPTIONS),2),o=r[0],r=r[1];return(n=i.call(this,t,e,o)||this).domStrings=n.options.DomStrings||new u.HTMLDomStrings(r),n.domStrings.adaptor=e,n.styles=[],n}e.HTMLDocument=r},5138:function(t,e,r){var a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=a.STATE.TYPESET&&(e=this.adaptor,r=this.start.node,n=e.text(""),t&&(t=this.start.delim+this.math+this.end.delim,n=this.inputJax.processStrings?e.text(t):(t=e.parse(t,"text/html"),e.firstChild(e.body(t)))),e.parent(r)&&e.replace(n,r),this.start.node=this.end.node=n,this.start.n=this.end.n=0)},s);function s(t,e,r,n,o){return i.call(this,t,e,r=void 0===r?!0:r,n=void 0===n?{node:null,n:0,delim:""}:n,o=void 0===o?{node:null,n:0,delim:""}:o)||this}e.HTMLMathItem=r},3335:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),r=(Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLMathList=void 0,o=r(9e3).AbstractMathList,i(a,o),a);function a(){return null!==o&&o.apply(this,arguments)||this}e.HTMLMathList=r},8462:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},y=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o,b=r(9007),v=n(r(1256)),n=o=o||{};function i(t,e,r){var n,o,i=[];try{for(var a=g(t.getList("m"+e+r)),s=a.next();!s.done;s=a.next()){var l,c,u=s.value,p=u.childNodes;p[u[e]]&&p[u[r]]||(l=u.parent,c=p[u[e]]?t.nodeFactory.create("node","m"+e,[p[u.base],p[u[e]]]):t.nodeFactory.create("node","m"+r,[p[u.base],p[u[r]]]),v.default.copyAttributes(u,c),l?l.replaceChild(c,u):t.root=c,i.push(u))}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}t.removeFromList("m"+e+r,i)}function a(t,e,r){var n,o,i=[];try{for(var a=g(t.getList(e)),s=a.next();!s.done;s=a.next()){var l,c,u,p=s.value;p.attributes.get("displaystyle")||(c=(l=p.childNodes[p.base]).coreMO(),l.getProperty("movablelimits")&&!c.attributes.getExplicit("movablelimits")&&(u=t.nodeFactory.create("node",r,p.childNodes),v.default.copyAttributes(p,u),p.parent?p.parent.replaceChild(u,p):t.root=u,i.push(p)))}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}t.removeFromList(e,i)}n.cleanStretchy=function(t){var e,r,n=t.data;try{for(var o=g(n.getList("fixStretchy")),i=o.next();!i.done;i=o.next()){var a,s,l,c=i.value;v.default.getProperty(c,"fixStretchy")&&((a=v.default.getForm(c))&&a[3]&&a[3].stretchy&&v.default.setAttribute(c,"stretchy",!1),s=c.parent,v.default.getTexClass(c)||a&&a[2]||(l=n.nodeFactory.create("node","TeXAtom",[c]),s.replaceChild(l,c),l.inheritAttributesFrom(c)),v.default.removeProperties(c,"fixStretchy"))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},n.cleanAttributes=function(t){t.data.root.walkTree(function(t,e){var r,n,o=t.attributes;if(o){var i=new Set((o.get("mjx-keep-attrs")||"").split(/ /));delete o.getAllAttributes()["mjx-keep-attrs"];try{for(var a=g(o.getExplicitNames()),s=a.next();!s.done;s=a.next()){var l=s.value;i.has(l)||o.attributes[l]!==t.attributes.getInherited(l)||delete o.attributes[l]}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}},{})},n.combineRelations=function(t){var e,r,n,o,i=[];try{for(var a=g(t.data.getList("mo")),s=a.next();!s.done;s=a.next()){var l=s.value;if(!l.getProperty("relationsCombined")&&l.parent&&(!l.parent||v.default.isType(l.parent,"mrow"))&&v.default.getTexClass(l)===b.TEXCLASS.REL){for(var c=l.parent,u=void 0,p=c.childNodes,h=p.indexOf(l)+1,d=v.default.getProperty(l,"variantForm");h=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},a=(Object.defineProperty(e,"__esModule",{value:!0}),i(r(5453))),s=r(8929),l=i(r(1256)),u=r(7233);function p(t,e){void 0===e&&(e=[]),this.options={},this.packageData=new Map,this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.handlers=t.handlers,this.nodeFactory=new s.NodeFactory,(this.nodeFactory.configuration=this).nodeFactory.setCreators(t.nodes),this.itemFactory=new a.default(t.items),this.itemFactory.configuration=this,u.defaultOptions.apply(void 0,o([this.options],n(e),!1)),(0,u.defaultOptions)(this.options,t.options)}p.prototype.pushParser=function(t){this.parsers.unshift(t)},p.prototype.popParser=function(){this.parsers.shift()},Object.defineProperty(p.prototype,"parser",{get:function(){return this.parsers[0]},enumerable:!1,configurable:!0}),p.prototype.clear=function(){this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.tags.resetTag()},p.prototype.addNode=function(t,e){var r;(this.nodeLists[t]||(this.nodeLists[t]=[])).push(e),e.kind!==t&&(r=((r=l.default.getProperty(e,"in-lists")||"")?r.split(/,/):[]).concat(t).join(","),l.default.setProperty(e,"in-lists",r))},p.prototype.getList=function(t){var e,r,n=this.nodeLists[t]||[],o=[];try{for(var i=c(n),a=i.next();!a.done;a=i.next()){var s=a.value;this.inTree(s)&&o.push(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return this.nodeLists[t]=o},p.prototype.removeFromList=function(t,e){var r,n,o=this.nodeLists[t]||[];try{for(var i=c(e),a=i.next();!a.done;a=i.next()){var s=a.value,l=o.indexOf(s);0<=l&&o.splice(l,1)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},p.prototype.inTree=function(t){for(;t&&t!==this.root;)t=t.parent;return!!t},e.default=p},1130:function(t,e,r){var c=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o,a,i,s,l,p=r(9007),h=n(r(1256)),d=n(r(8417)),f=n(r(3971)),m=r(5368);function y(t,e){var r,t=t.match((e=void 0===e?!1:e)?l:s);return t?(e=[t[1].replace(/,/,"."),t[4],t[0].length],e=c(e,3),t=e[0],r=e[1],e=e[2],"mu"!==r?[t,r,e]:[g(i[r](parseFloat(t||"1"))).slice(0,-2),"em",e]):[null,null,0]}function g(t){return Math.abs(t)<6e-4?"0em":t.toFixed(3).replace(/\.?0+$/,"")+"em"}function b(t,e,r){var n="{\\big"+r+" "+(e="{"!==e&&"}"!==e?e:"\\"+e)+"}";return new d.default("\\mathchoice"+("{\\bigg"+r+" "+e+"}")+n+n+n,{},t).mml()}function v(t,e,r){e=e.replace(/^\s+/,m.entities.nbsp).replace(/\s+$/,m.entities.nbsp);e=t.create("text",e);return t.create("node","mtext",[],r,e)}function _(t,e,r){if(r.match(/^[a-z]/i)&&e.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)&&(e+=" "),e.length+r.length>t.configuration.options.maxBuffer)throw new f.default("MaxBufferSize","MathJax internal buffer size exceeded; is there a recursive macro call?");return e+r}function S(t,e){for(;0e.length)throw new f.default("IllegalMacroParam","Illegal macro parameter reference");o=_(t,_(t,o,n),e[parseInt(a,10)-1]),n=""}else n+=a}return _(t,o,n)},a.addArgs=_,a.checkMaxMacros=function(t,e){if(void 0===e&&(e=!0),!(++t.macroCount<=t.configuration.options.maxMacros))throw e?new f.default("MaxMacroSub1","MathJax maximum macro substitution count exceeded; is here a recursive macro call?"):new f.default("MaxMacroSub2","MathJax maximum substitution count exceeded; is there a recursive latex environment?")},a.checkEqnEnv=function(t){if(t.stack.global.eqnenv)throw new f.default("ErroneousNestingEq","Erroneous nesting of equation structures");t.stack.global.eqnenv=!0},a.copyNode=function(t,e){var t=t.copy(),s=e.configuration;return t.walkTree(function(t){s.addNode(t.kind,t);var e,r,n=(t.getProperty("in-lists")||"").split(/,/);try{for(var o=u(n),i=o.next();!i.done;i=o.next()){var a=i.value;a&&s.addNode(a,t)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}}),t},a.MmlFilterAttribute=function(t,e,r){return r},a.getFontDef=function(t){t=t.stack.env.font;return t?{mathvariant:t}:{}},a.keyvalOptions=function(i,t,e){void 0===t&&(t=null),void 0===e&&(e=!1);var r,n,o=function(){for(var t,e,r,n={},o=i;o;)e=(t=c(O(o,["=",","]),3))[0],r=t[1],o=t[2],"="===r?(r=(t=c(O(o,[","]),3))[0],t[1],o=t[2],r="false"===r||"true"===r?JSON.parse(r):r,n[e]=r):e&&(n[e]=!0);return n}();if(t)try{for(var a=u(Object.keys(o)),s=a.next();!s.done;s=a.next()){var l=s.value;if(!t.hasOwnProperty(l)){if(e)throw new f.default("InvalidOption","Invalid option: %1",l);delete o[l]}}}catch(i){r={error:i}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o},e.default=o},9497:function(t,e,r){var u=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},c=(Object.defineProperty(e,"__esModule",{value:!0}),e.BaseItem=e.MmlStack=void 0,l(r(3971))),l=(Object.defineProperty(u.prototype,"nodes",{get:function(){return this._nodes},enumerable:!1,configurable:!0}),u.prototype.Push=function(){for(var t,e=[],r=0;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},c=(Object.defineProperty(e,"__esModule",{value:!0}),e.TagsFactory=e.AllTags=e.NoTags=e.AbstractTags=e.TagInfo=e.Label=void 0,l(r(8417))),l=(e.Label=n,e.TagInfo=o,u.prototype.start=function(t,e,r){this.currentTag&&this.stack.push(this.currentTag),this.currentTag=new o(t,e,r)},Object.defineProperty(u.prototype,"env",{get:function(){return this.currentTag.env},enumerable:!1,configurable:!0}),u.prototype.end=function(){this.history.push(this.currentTag),this.currentTag=this.stack.pop()},u.prototype.tag=function(t,e){this.currentTag.tag=t,this.currentTag.tagFormat=e?t:this.formatTag(t),this.currentTag.noTag=!1},u.prototype.notag=function(){this.tag("",!0),this.currentTag.noTag=!0},Object.defineProperty(u.prototype,"noTag",{get:function(){return this.currentTag.noTag},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"label",{get:function(){return this.currentTag.labelId},set:function(t){this.currentTag.labelId=t},enumerable:!1,configurable:!0}),u.prototype.formatUrl=function(t,e){return e+"#"+encodeURIComponent(t)},u.prototype.formatTag=function(t){return"("+t+")"},u.prototype.formatId=function(t){return"mjx-eqn:"+t.replace(/\s/g,"_")},u.prototype.formatNumber=function(t){return t.toString()},u.prototype.autoTag=function(){null==this.currentTag.tag&&(this.counter++,this.tag(this.formatNumber(this.counter),!1))},u.prototype.clearTag=function(){this.label="",this.tag(null,!0),this.currentTag.tagId=""},u.prototype.getTag=function(t){if(t=void 0===t?!1:t)return this.autoTag(),this.makeTag();t=this.currentTag;return t.taggable&&!t.noTag&&(t.defaultTags&&this.autoTag(),t.tag)?this.makeTag():null},u.prototype.resetTag=function(){this.history=[],this.redo=!1,this.refUpdate=!1,this.clearTag()},u.prototype.reset=function(t){void 0===t&&(t=0),this.resetTag(),this.counter=this.allCounter=t,this.allLabels={},this.allIds={}},u.prototype.startEquation=function(t){this.history=[],this.stack=[],this.clearTag(),this.currentTag=new o("",void 0,void 0),this.labels={},this.ids={},this.counter=this.allCounter,this.redo=!1;t=t.inputData.recompile;t&&(this.refUpdate=!0,this.counter=t.counter)},u.prototype.finishEquation=function(t){this.redo&&(t.inputData.recompile={state:t.state(),counter:this.allCounter}),this.refUpdate||(this.allCounter=this.counter),Object.assign(this.allIds,this.ids),Object.assign(this.allLabels,this.labels)},u.prototype.finalize=function(t,e){if(!e.display||this.currentTag.env||null==this.currentTag.tag)return t;e=this.makeTag();return this.enTag(t,e)},u.prototype.makeId=function(){this.currentTag.tagId=this.formatId(this.configuration.options.useLabelIds&&this.label||this.currentTag.tag)},u.prototype.makeTag=function(){this.makeId(),this.label&&(this.labels[this.label]=new n(this.currentTag.tag,this.currentTag.tagId));var t=new c.default("\\text{"+this.currentTag.tagFormat+"}",{},this.configuration).mml();return this.configuration.nodeFactory.create("node","mtd",[t],{id:this.currentTag.tagId})},u);function u(){this.counter=0,this.allCounter=0,this.configuration=null,this.ids={},this.allIds={},this.labels={},this.allLabels={},this.redo=!1,this.refUpdate=!1,this.currentTag=new o,this.history=[],this.stack=[],this.enTag=function(t,e){var r=this.configuration.nodeFactory,t=r.create("node","mtd",[t]),e=r.create("node","mlabeledtr",[e,t]);return r.create("node","mtable",[e],{side:this.configuration.options.tagSide,minlabelspacing:this.configuration.options.tagIndent,displaystyle:!0})}}e.AbstractTags=l;a(h,p=l),h.prototype.autoTag=function(){},h.prototype.getTag=function(){return this.currentTag.tag?p.prototype.getTag.call(this):null};var p,r=h;function h(){return null!==p&&p.apply(this,arguments)||this}e.NoTags=r;a(g,d=l),g.prototype.finalize=function(t,e){if(!e.display||this.history.find(function(t){return t.taggable}))return t;e=this.getTag(!0);return this.enTag(t,e)};var d,f,m,y,a=g;function g(){return null!==d&&d.apply(this,arguments)||this}e.AllTags=a,f=e.TagsFactory||(e.TagsFactory={}),m=new Map([["none",r],["all",a]]),y="none",f.OPTIONS={tags:y,tagSide:"right",tagIndent:"0.8em",useLabelIds:!0,ignoreDuplicateLabels:!1},f.add=function(t,e){m.set(t,e)},f.addTags=function(t){var e,r;try{for(var n=s(Object.keys(t)),o=n.next();!o.done;o=n.next()){var i=o.value;f.add(i,t[i])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},f.create=function(t){t=m.get(t)||m.get(y);if(t)return new t;throw Error("Unknown tags class")},f.setDefault=function(t){y=t},f.getDefault=function(){return f.create(y)}},8317:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.TexConstant=void 0,(e=e.TexConstant||(e.TexConstant={})).Variant={NORMAL:"normal",BOLD:"bold",ITALIC:"italic",BOLDITALIC:"bold-italic",DOUBLESTRUCK:"double-struck",FRAKTUR:"fraktur",BOLDFRAKTUR:"bold-fraktur",SCRIPT:"script",BOLDSCRIPT:"bold-script",SANSSERIF:"sans-serif",BOLDSANSSERIF:"bold-sans-serif",SANSSERIFITALIC:"sans-serif-italic",SANSSERIFBOLDITALIC:"sans-serif-bold-italic",MONOSPACE:"monospace",INITIAL:"inital",TAILED:"tailed",LOOPED:"looped",STRETCHED:"stretched",CALLIGRAPHIC:"-tex-calligraphic",BOLDCALLIGRAPHIC:"-tex-bold-calligraphic",OLDSTYLE:"-tex-oldstyle",BOLDOLDSTYLE:"-tex-bold-oldstyle",MATHITALIC:"-tex-mathit"},e.Form={PREFIX:"prefix",INFIX:"infix",POSTFIX:"postfix"},e.LineBreak={AUTO:"auto",NEWLINE:"newline",NOBREAK:"nobreak",GOODBREAK:"goodbreak",BADBREAK:"badbreak"},e.LineBreakStyle={BEFORE:"before",AFTER:"after",DUPLICATE:"duplicate",INFIXLINBREAKSTYLE:"infixlinebreakstyle"},e.IndentAlign={LEFT:"left",CENTER:"center",RIGHT:"right",AUTO:"auto",ID:"id",INDENTALIGN:"indentalign"},e.IndentShift={INDENTSHIFT:"indentshift"},e.LineThickness={THIN:"thin",MEDIUM:"medium",THICK:"thick"},e.Notation={LONGDIV:"longdiv",ACTUARIAL:"actuarial",PHASORANGLE:"phasorangle",RADICAL:"radical",BOX:"box",ROUNDEDBOX:"roundedbox",CIRCLE:"circle",LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",UPDIAGONALSTRIKE:"updiagonalstrike",DOWNDIAGONALSTRIKE:"downdiagonalstrike",VERTICALSTRIKE:"verticalstrike",HORIZONTALSTRIKE:"horizontalstrike",NORTHEASTARROW:"northeastarrow",MADRUWB:"madruwb",UPDIAGONALARROW:"updiagonalarrow"},e.Align={TOP:"top",BOTTOM:"bottom",CENTER:"center",BASELINE:"baseline",AXIS:"axis",LEFT:"left",RIGHT:"right"},e.Lines={NONE:"none",SOLID:"solid",DASHED:"dashed"},e.Side={LEFT:"left",RIGHT:"right",LEFTOVERLAP:"leftoverlap",RIGHTOVERLAP:"rightoverlap"},e.Width={AUTO:"auto",FIT:"fit"},e.Actiontype={TOGGLE:"toggle",STATUSLINE:"statusline",TOOLTIP:"tooltip",INPUT:"input"},e.Overflow={LINBREAK:"linebreak",SCROLL:"scroll",ELIDE:"elide",TRUNCATE:"truncate",SCALE:"scale"},e.Unit={EM:"em",EX:"ex",PX:"px",IN:"in",CM:"cm",MM:"mm",PT:"pt",PC:"pc"}},3971:function(t,e){function a(t,e){for(var r=[],n=2;n=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0t)throw new p.default("XalignOverflow","Extra %1 in row of %2","&",this.name)},m.prototype.EndRow=function(){for(var t,e=this.row,r=this.getProperty("xalignat");e.lengththis.maxrow&&(this.maxrow=this.row.length),f.prototype.EndRow.call(this);var n,o=this.table[this.table.length-1];this.getProperty("zeroWidthLabel")&&o.isKind("mlabeledtr")&&(o=u.default.getChildren(o)[0],n=this.factory.configuration.options.tagSide,n=a({width:0},"right"===n?{lspace:"-1width"}:{}),n=this.create("node","mpadded",u.default.getChildren(o),n),o.setChildren([n]))},m.prototype.EndTable=function(){f.prototype.EndTable.call(this),this.center&&this.maxrow<=2&&(delete this.arraydef.width,delete this.global.indentalign)};var f,r=m;function m(t,e,r,n,o){t=f.call(this,t)||this;return t.name=e,t.numbered=r,t.padded=n,t.center=o,t.factory.configuration.tags.start(e,r,r),t}e.FlalignItem=r},7379:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){t[n=void 0===n?r:n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},e=(Object.defineProperty(e,"__esModule",{value:!0}),r(4387)),i=i(r(9140)),s=r(8317),l=a(r(5450)),a=a(r(1130)),c=r(9007),r=r(6010);new i.CharacterMap("AMSmath-mathchar0mo",l.default.mathchar0mo,{iiiint:["⨌",{texClass:c.TEXCLASS.OP}]}),new i.RegExpMap("AMSmath-operatorLetter",e.AmsMethods.operatorLetter,/[-*]/i),new i.CommandMap("AMSmath-macros",{mathring:["Accent","02DA"],nobreakspace:"Tilde",negmedspace:["Spacer",r.MATHSPACE.negativemediummathspace],negthickspace:["Spacer",r.MATHSPACE.negativethickmathspace],idotsint:["MultiIntegral","\\int\\cdots\\int"],dddot:["Accent","20DB"],ddddot:["Accent","20DC"],sideset:"SideSet",boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],tag:"HandleTag",notag:"HandleNoTag",eqref:["HandleRef",!0],substack:["Macro","\\begin{subarray}{c}#1\\end{subarray}",1],injlim:["NamedOp","inj lim"],projlim:["NamedOp","proj lim"],varliminf:["Macro","\\mathop{\\underline{\\mmlToken{mi}{lim}}}"],varlimsup:["Macro","\\mathop{\\overline{\\mmlToken{mi}{lim}}}"],varinjlim:["Macro","\\mathop{\\underrightarrow{\\mmlToken{mi}{lim}}}"],varprojlim:["Macro","\\mathop{\\underleftarrow{\\mmlToken{mi}{lim}}}"],DeclareMathOperator:"HandleDeclareOp",operatorname:"HandleOperatorName",genfrac:"Genfrac",frac:["Genfrac","","","",""],tfrac:["Genfrac","","","","1"],dfrac:["Genfrac","","","","0"],binom:["Genfrac","(",")","0",""],tbinom:["Genfrac","(",")","0","1"],dbinom:["Genfrac","(",")","0","0"],cfrac:"CFrac",shoveleft:["HandleShove",s.TexConstant.Align.LEFT],shoveright:["HandleShove",s.TexConstant.Align.RIGHT],xrightarrow:["xArrow",8594,5,10],xleftarrow:["xArrow",8592,10,5]},e.AmsMethods),new i.EnvironmentMap("AMSmath-environment",l.default.environment,{"equation*":["Equation",null,!1],"eqnarray*":["EqnArray",null,!1,!0,"rcl",a.default.cols(0,r.MATHSPACE.thickmathspace),".5em"],align:["EqnArray",null,!0,!0,"rl",a.default.cols(0,2)],"align*":["EqnArray",null,!1,!0,"rl",a.default.cols(0,2)],multline:["Multline",null,!0],"multline*":["Multline",null,!1],split:["EqnArray",null,!1,!1,"rl",a.default.cols(0)],gather:["EqnArray",null,!0,!0,"c"],"gather*":["EqnArray",null,!1,!0,"c"],alignat:["AlignAt",null,!0,!0],"alignat*":["AlignAt",null,!1,!0],alignedat:["AlignAt",null,!1,!1],aligned:["AmsEqnArray",null,null,null,"rl",a.default.cols(0,2),".5em","D"],gathered:["AmsEqnArray",null,null,null,"c",null,".5em","D"],xalignat:["XalignAt",null,!0,!0],"xalignat*":["XalignAt",null,!1,!0],xxalignat:["XalignAt",null,!1,!1],flalign:["FlalignArray",null,!0,!1,!0,"rlc","auto auto fit"],"flalign*":["FlalignArray",null,!1,!1,!0,"rlc","auto auto fit"],subarray:["Array",null,null,null,null,a.default.cols(0),"0.1em","S",1],smallmatrix:["Array",null,null,null,"c",a.default.cols(1/3),".2em","S",1],matrix:["Array",null,null,null,"c"],pmatrix:["Array",null,"(",")","c"],bmatrix:["Array",null,"[","]","c"],Bmatrix:["Array",null,"\\{","\\}","c"],vmatrix:["Array",null,"\\vert","\\vert","c"],Vmatrix:["Array",null,"\\Vert","\\Vert","c"],cases:["Array",null,"\\{",".","ll",null,".2em","T"]},e.AmsMethods),new i.DelimiterMap("AMSmath-delimiter",l.default.delimiter,{"\\lvert":["|",{texClass:c.TEXCLASS.OPEN}],"\\rvert":["|",{texClass:c.TEXCLASS.CLOSE}],"\\lVert":["‖",{texClass:c.TEXCLASS.OPEN}],"\\rVert":["‖",{texClass:c.TEXCLASS.CLOSE}]}),new i.CharacterMap("AMSsymbols-mathchar0mi",l.default.mathchar0mi,{digamma:"ϝ",varkappa:"ϰ",varGamma:["Γ",{mathvariant:s.TexConstant.Variant.ITALIC}],varDelta:["Δ",{mathvariant:s.TexConstant.Variant.ITALIC}],varTheta:["Θ",{mathvariant:s.TexConstant.Variant.ITALIC}],varLambda:["Λ",{mathvariant:s.TexConstant.Variant.ITALIC}],varXi:["Ξ",{mathvariant:s.TexConstant.Variant.ITALIC}],varPi:["Π",{mathvariant:s.TexConstant.Variant.ITALIC}],varSigma:["Σ",{mathvariant:s.TexConstant.Variant.ITALIC}],varUpsilon:["Υ",{mathvariant:s.TexConstant.Variant.ITALIC}],varPhi:["Φ",{mathvariant:s.TexConstant.Variant.ITALIC}],varPsi:["Ψ",{mathvariant:s.TexConstant.Variant.ITALIC}],varOmega:["Ω",{mathvariant:s.TexConstant.Variant.ITALIC}],beth:"ℶ",gimel:"ℷ",daleth:"ℸ",backprime:["‵",{variantForm:!0}],hslash:"ℏ",varnothing:["∅",{variantForm:!0}],blacktriangle:"▴",triangledown:["▽",{variantForm:!0}],blacktriangledown:"▾",square:"◻",Box:"◻",blacksquare:"◼",lozenge:"◊",Diamond:"◊",blacklozenge:"⧫",circledS:["Ⓢ",{mathvariant:s.TexConstant.Variant.NORMAL}],bigstar:"★",sphericalangle:"∢",measuredangle:"∡",nexists:"∄",complement:"∁",mho:"℧",eth:["ð",{mathvariant:s.TexConstant.Variant.NORMAL}],Finv:"Ⅎ",diagup:"╱",Game:"⅁",diagdown:"╲",Bbbk:["k",{mathvariant:s.TexConstant.Variant.DOUBLESTRUCK}],yen:"¥",circledR:"®",checkmark:"✓",maltese:"✠"}),new i.CharacterMap("AMSsymbols-mathchar0mo",l.default.mathchar0mo,{dotplus:"∔",ltimes:"⋉",smallsetminus:["∖",{variantForm:!0}],rtimes:"⋊",Cap:"⋒",doublecap:"⋒",leftthreetimes:"⋋",Cup:"⋓",doublecup:"⋓",rightthreetimes:"⋌",barwedge:"⊼",curlywedge:"⋏",veebar:"⊻",curlyvee:"⋎",doublebarwedge:"⩞",boxminus:"⊟",circleddash:"⊝",boxtimes:"⊠",circledast:"⊛",boxdot:"⊡",circledcirc:"⊚",boxplus:"⊞",centerdot:["⋅",{variantForm:!0}],divideontimes:"⋇",intercal:"⊺",leqq:"≦",geqq:"≧",leqslant:"⩽",geqslant:"⩾",eqslantless:"⪕",eqslantgtr:"⪖",lesssim:"≲",gtrsim:"≳",lessapprox:"⪅",gtrapprox:"⪆",approxeq:"≊",lessdot:"⋖",gtrdot:"⋗",lll:"⋘",llless:"⋘",ggg:"⋙",gggtr:"⋙",lessgtr:"≶",gtrless:"≷",lesseqgtr:"⋚",gtreqless:"⋛",lesseqqgtr:"⪋",gtreqqless:"⪌",doteqdot:"≑",Doteq:"≑",eqcirc:"≖",risingdotseq:"≓",circeq:"≗",fallingdotseq:"≒",triangleq:"≜",backsim:"∽",thicksim:["∼",{variantForm:!0}],backsimeq:"⋍",thickapprox:["≈",{variantForm:!0}],subseteqq:"⫅",supseteqq:"⫆",Subset:"⋐",Supset:"⋑",sqsubset:"⊏",sqsupset:"⊐",preccurlyeq:"≼",succcurlyeq:"≽",curlyeqprec:"⋞",curlyeqsucc:"⋟",precsim:"≾",succsim:"≿",precapprox:"⪷",succapprox:"⪸",vartriangleleft:"⊲",lhd:"⊲",vartriangleright:"⊳",rhd:"⊳",trianglelefteq:"⊴",unlhd:"⊴",trianglerighteq:"⊵",unrhd:"⊵",vDash:["⊨",{variantForm:!0}],Vdash:"⊩",Vvdash:"⊪",smallsmile:["⌣",{variantForm:!0}],shortmid:["∣",{variantForm:!0}],smallfrown:["⌢",{variantForm:!0}],shortparallel:["∥",{variantForm:!0}],bumpeq:"≏",between:"≬",Bumpeq:"≎",pitchfork:"⋔",varpropto:["∝",{variantForm:!0}],backepsilon:"∍",blacktriangleleft:"◂",blacktriangleright:"▸",therefore:"∴",because:"∵",eqsim:"≂",vartriangle:["△",{variantForm:!0}],Join:"⋈",nless:"≮",ngtr:"≯",nleq:"≰",ngeq:"≱",nleqslant:["⪇",{variantForm:!0}],ngeqslant:["⪈",{variantForm:!0}],nleqq:["≰",{variantForm:!0}],ngeqq:["≱",{variantForm:!0}],lneq:"⪇",gneq:"⪈",lneqq:"≨",gneqq:"≩",lvertneqq:["≨",{variantForm:!0}],gvertneqq:["≩",{variantForm:!0}],lnsim:"⋦",gnsim:"⋧",lnapprox:"⪉",gnapprox:"⪊",nprec:"⊀",nsucc:"⊁",npreceq:["⋠",{variantForm:!0}],nsucceq:["⋡",{variantForm:!0}],precneqq:"⪵",succneqq:"⪶",precnsim:"⋨",succnsim:"⋩",precnapprox:"⪹",succnapprox:"⪺",nsim:"≁",ncong:"≇",nshortmid:["∤",{variantForm:!0}],nshortparallel:["∦",{variantForm:!0}],nmid:"∤",nparallel:"∦",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",ntriangleleft:"⋪",ntriangleright:"⋫",ntrianglelefteq:"⋬",ntrianglerighteq:"⋭",nsubseteq:"⊈",nsupseteq:"⊉",nsubseteqq:["⊈",{variantForm:!0}],nsupseteqq:["⊉",{variantForm:!0}],subsetneq:"⊊",supsetneq:"⊋",varsubsetneq:["⊊",{variantForm:!0}],varsupsetneq:["⊋",{variantForm:!0}],subsetneqq:"⫋",supsetneqq:"⫌",varsubsetneqq:["⫋",{variantForm:!0}],varsupsetneqq:["⫌",{variantForm:!0}],leftleftarrows:"⇇",rightrightarrows:"⇉",leftrightarrows:"⇆",rightleftarrows:"⇄",Lleftarrow:"⇚",Rrightarrow:"⇛",twoheadleftarrow:"↞",twoheadrightarrow:"↠",leftarrowtail:"↢",rightarrowtail:"↣",looparrowleft:"↫",looparrowright:"↬",leftrightharpoons:"⇋",rightleftharpoons:["⇌",{variantForm:!0}],curvearrowleft:"↶",curvearrowright:"↷",circlearrowleft:"↺",circlearrowright:"↻",Lsh:"↰",Rsh:"↱",upuparrows:"⇈",downdownarrows:"⇊",upharpoonleft:"↿",upharpoonright:"↾",downharpoonleft:"⇃",restriction:"↾",multimap:"⊸",downharpoonright:"⇂",leftrightsquigarrow:"↭",rightsquigarrow:"⇝",leadsto:"⇝",dashrightarrow:"⇢",dashleftarrow:"⇠",nleftarrow:"↚",nrightarrow:"↛",nLeftarrow:"⇍",nRightarrow:"⇏",nleftrightarrow:"↮",nLeftrightarrow:"⇎"}),new i.DelimiterMap("AMSsymbols-delimiter",l.default.delimiter,{"\\ulcorner":"⌜","\\urcorner":"⌝","\\llcorner":"⌞","\\lrcorner":"⌟"}),new i.CommandMap("AMSsymbols-macros",{implies:["Macro","\\;\\Longrightarrow\\;"],impliedby:["Macro","\\;\\Longleftarrow\\;"]},e.AmsMethods)},4387:function(t,u,e){var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.AutoloadConfiguration=void 0,r(9899)),o=r(9140),C=r(8803),T=r(7741),y=r(265),i=r(7233);function N(t,e,r,n){var o,i,a,s;if(y.Package.packages.has(t.options.require.prefix+r)){var l=t.options.autoload[r],l=E(2===l.length&&Array.isArray(l[0])?l:[l,[]],2),c=l[0],l=l[1];try{for(var u=A(c),p=u.next();!p.done;p=u.next()){var h=p.value;w.remove(h)}}catch(t){o={error:t}}finally{try{p&&!p.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}try{for(var d=A(l),f=d.next();!f.done;f=d.next()){var m=f.value;L.remove(m)}}catch(t){a={error:t}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}t.string=(n?e+" ":"\\begin{"+e.slice(1)+"}")+t.string.slice(t.i),t.i=0}(0,T.RequireLoad)(t,r)}var w=new o.CommandMap("autoload-macros",{},{}),L=new o.CommandMap("autoload-environments",{},{});e.AutoloadConfiguration=n.Configuration.create("autoload",{handler:{macro:["autoload-macros"],environment:["autoload-environments"]},options:{autoload:(0,i.expandable)({action:["toggle","mathtip","texttip"],amscd:[[],["CD"]],bbox:["bbox"],boldsymbol:["boldsymbol"],braket:["bra","ket","braket","set","Bra","Ket","Braket","Set","ketbra","Ketbra"],bussproofs:[[],["prooftree"]],cancel:["cancel","bcancel","xcancel","cancelto"],color:["color","definecolor","textcolor","colorbox","fcolorbox"],enclose:["enclose"],extpfeil:["xtwoheadrightarrow","xtwoheadleftarrow","xmapsto","xlongequal","xtofrom","Newextarrow"],html:["href","class","style","cssId"],mhchem:["ce","pu"],newcommand:["newcommand","renewcommand","newenvironment","renewenvironment","def","let"],unicode:["unicode"],verb:["verb"]})},config:function(t,e){var r,n,o,i,a,s,l=e.parseOptions,c=l.handlers.get("macro"),u=l.handlers.get("environment"),p=l.options.autoload;l.packageData.set("autoload",{Autoload:N});try{for(var h=A(Object.keys(p)),d=h.next();!d.done;d=h.next()){var f=d.value,m=p[f],y=E(2===m.length&&Array.isArray(m[0])?m:[m,[]],2),g=y[0],b=y[1];try{o=void 0;for(var v=A(g),_=v.next();!_.done;_=v.next()){var S=_.value;c.lookup(S)&&"color"!==S||w.add(S,new C.Macro(S,N,[f,!0]))}}catch(t){o={error:t}}finally{try{_&&!_.done&&(i=v.return)&&i.call(v)}finally{if(o)throw o.error}}try{a=void 0;for(var O=A(b),M=O.next();!M.done;M=O.next()){var x=M.value;u.lookup(x)||L.add(x,new C.Macro(x,N,[f,!1]))}}catch(t){a={error:t}}finally{try{M&&!M.done&&(s=O.return)&&s.call(O)}finally{if(a)throw a.error}}}}catch(t){r={error:t}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}l.packageData.get("require")||T.RequireConfiguration.config(t,e)},init:function(t){t.options.require||(0,i.defaultOptions)(t.options,T.RequireConfiguration.options)},priority:10})},2942:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){t[n=void 0===n?r:n]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return a(e,t),e},c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},u=(Object.defineProperty(e,"__esModule",{value:!0}),e.BaseConfiguration=e.BaseTags=e.Other=void 0,r(9899)),p=r(2947),h=l(r(3971)),d=l(r(1256)),l=r(9140),s=s(r(1181)),f=r(6521),m=(r(1267),r(4082));function y(t,e){var r=t.stack.env.font?{mathvariant:t.stack.env.font}:{},n=p.MapHandler.getMap("remap").lookup(e),o=(0,m.getRange)(e),i=o?o[3]:"mo",r=t.create("token",i,r,n?n.char:e);o[4]&&r.attributes.set("mathvariant",o[4]),"mo"===i&&(d.default.setProperty(r,"fixStretchy",!0),t.configuration.addNode("fixStretchy",r)),t.Push(r)}new l.CharacterMap("remap",null,{"-":"−","*":"∗","`":"‘"}),e.Other=y;g=f.AbstractTags,o(b,g);var g,r=b;function b(){return null!==g&&g.apply(this,arguments)||this}e.BaseTags=r,e.BaseConfiguration=u.Configuration.create("base",{handler:{character:["command","special","letter","digit"],delimiter:["delimiter"],macro:["delimiter","macros","mathchar0mi","mathchar0mo","mathchar7"],environment:["environment"]},fallback:{character:y,macro:function(t,e){throw new h.default("UndefinedControlSequence","Undefined control sequence %1","\\"+e)},environment:function(t,e){throw new h.default("UnknownEnv","Unknown environment '%1'",e)}},items:((l={})[s.StartItem.prototype.kind]=s.StartItem,l[s.StopItem.prototype.kind]=s.StopItem,l[s.OpenItem.prototype.kind]=s.OpenItem,l[s.CloseItem.prototype.kind]=s.CloseItem,l[s.PrimeItem.prototype.kind]=s.PrimeItem,l[s.SubsupItem.prototype.kind]=s.SubsupItem,l[s.OverItem.prototype.kind]=s.OverItem,l[s.LeftItem.prototype.kind]=s.LeftItem,l[s.Middle.prototype.kind]=s.Middle,l[s.RightItem.prototype.kind]=s.RightItem,l[s.BeginItem.prototype.kind]=s.BeginItem,l[s.EndItem.prototype.kind]=s.EndItem,l[s.StyleItem.prototype.kind]=s.StyleItem,l[s.PositionItem.prototype.kind]=s.PositionItem,l[s.CellItem.prototype.kind]=s.CellItem,l[s.MmlItem.prototype.kind]=s.MmlItem,l[s.FnItem.prototype.kind]=s.FnItem,l[s.NotItem.prototype.kind]=s.NotItem,l[s.NonscriptItem.prototype.kind]=s.NonscriptItem,l[s.DotsItem.prototype.kind]=s.DotsItem,l[s.ArrayItem.prototype.kind]=s.ArrayItem,l[s.EqnArrayItem.prototype.kind]=s.EqnArrayItem,l[s.EquationItem.prototype.kind]=s.EquationItem,l),options:{maxMacros:1e3,baseURL:"undefined"==typeof document||0===document.getElementsByTagName("base").length?"":String(document.location).replace(/#.*$/,"")},tags:{base:r},postprocessors:[[function(t){var e,r,n=t.data;try{for(var o=c(n.getList("nonscript")),i=o.next();!i.done;i=o.next()){var a,s,l=i.value;0this.maxrow&&(this.maxrow=this.row.length);var t="mtr",e=this.factory.configuration.tags.getTag(),e=(e&&(this.row=[e].concat(this.row),t="mlabeledtr"),this.factory.configuration.tags.clearTag(),this.create("node",t,this.row));this.table.push(e),this.row=[]},R.prototype.EndTable=function(){it.prototype.EndTable.call(this),this.factory.configuration.tags.end(),this.extendArray("columnalign",this.maxrow),this.extendArray("columnwidth",this.maxrow),this.extendArray("columnspacing",this.maxrow-1)},R.prototype.extendArray=function(t,e){if(this.arraydef[t]){var r=this.arraydef[t].split(/ /),n=D([],o(r),!1);if(1",succ:"≻",prec:"≺",approx:"≈",succeq:"⪰",preceq:"⪯",supset:"⊃",subset:"⊂",supseteq:"⊇",subseteq:"⊆",in:"∈",ni:"∋",notin:"∉",owns:"∋",gg:"≫",ll:"≪",sim:"∼",simeq:"≃",perp:"⊥",equiv:"≡",asymp:"≍",smile:"⌣",frown:"⌢",ne:"≠",neq:"≠",cong:"≅",doteq:"≐",bowtie:"⋈",models:"⊨",notChar:"⧸",Leftrightarrow:"⇔",Leftarrow:"⇐",Rightarrow:"⇒",leftrightarrow:"↔",leftarrow:"←",gets:"←",rightarrow:"→",to:["→",{accent:!1}],mapsto:"↦",leftharpoonup:"↼",leftharpoondown:"↽",rightharpoonup:"⇀",rightharpoondown:"⇁",nearrow:"↗",searrow:"↘",nwarrow:"↖",swarrow:"↙",rightleftharpoons:"⇌",hookrightarrow:"↪",hookleftarrow:"↩",longleftarrow:"⟵",Longleftarrow:"⟸",longrightarrow:"⟶",Longrightarrow:"⟹",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",ldots:"…",cdots:"⋯",vdots:"⋮",ddots:"⋱",dotsc:"…",dotsb:"⋯",dotsm:"⋯",dotsi:"⋯",dotso:"…",ldotp:[".",{texClass:c.TEXCLASS.PUNCT}],cdotp:["⋅",{texClass:c.TEXCLASS.PUNCT}],colon:[":",{texClass:c.TEXCLASS.PUNCT}]}),new e.CharacterMap("mathchar7",l.default.mathchar7,{Gamma:"Γ",Delta:"Δ",Theta:"Θ",Lambda:"Λ",Xi:"Ξ",Pi:"Π",Sigma:"Σ",Upsilon:"Υ",Phi:"Φ",Psi:"Ψ",Omega:"Ω",_:"_","#":"#",$:"$","%":"%","&":"&",And:"&"}),new e.DelimiterMap("delimiter",l.default.delimiter,{"(":"(",")":")","[":"[","]":"]","<":"⟨",">":"⟩","\\lt":"⟨","\\gt":"⟩","/":"/","|":["|",{texClass:c.TEXCLASS.ORD}],".":"","\\\\":"\\","\\lmoustache":"⎰","\\rmoustache":"⎱","\\lgroup":"⟮","\\rgroup":"⟯","\\arrowvert":"⏐","\\Arrowvert":"‖","\\bracevert":"⎪","\\Vert":["‖",{texClass:c.TEXCLASS.ORD}],"\\|":["‖",{texClass:c.TEXCLASS.ORD}],"\\vert":["|",{texClass:c.TEXCLASS.ORD}],"\\uparrow":"↑","\\downarrow":"↓","\\updownarrow":"↕","\\Uparrow":"⇑","\\Downarrow":"⇓","\\Updownarrow":"⇕","\\backslash":"\\","\\rangle":"⟩","\\langle":"⟨","\\rbrace":"}","\\lbrace":"{","\\}":"}","\\{":"{","\\rceil":"⌉","\\lceil":"⌈","\\rfloor":"⌋","\\lfloor":"⌊","\\lbrack":"[","\\rbrack":"]"}),new e.CommandMap("macros",{displaystyle:["SetStyle","D",!0,0],textstyle:["SetStyle","T",!1,0],scriptstyle:["SetStyle","S",!1,1],scriptscriptstyle:["SetStyle","SS",!1,2],rm:["SetFont",i.TexConstant.Variant.NORMAL],mit:["SetFont",i.TexConstant.Variant.ITALIC],oldstyle:["SetFont",i.TexConstant.Variant.OLDSTYLE],cal:["SetFont",i.TexConstant.Variant.CALLIGRAPHIC],it:["SetFont",i.TexConstant.Variant.MATHITALIC],bf:["SetFont",i.TexConstant.Variant.BOLD],bbFont:["SetFont",i.TexConstant.Variant.DOUBLESTRUCK],scr:["SetFont",i.TexConstant.Variant.SCRIPT],frak:["SetFont",i.TexConstant.Variant.FRAKTUR],sf:["SetFont",i.TexConstant.Variant.SANSSERIF],tt:["SetFont",i.TexConstant.Variant.MONOSPACE],mathrm:["MathFont",i.TexConstant.Variant.NORMAL],mathup:["MathFont",i.TexConstant.Variant.NORMAL],mathnormal:["MathFont",""],mathbf:["MathFont",i.TexConstant.Variant.BOLD],mathbfup:["MathFont",i.TexConstant.Variant.BOLD],mathit:["MathFont",i.TexConstant.Variant.MATHITALIC],mathbfit:["MathFont",i.TexConstant.Variant.BOLDITALIC],mathbb:["MathFont",i.TexConstant.Variant.DOUBLESTRUCK],Bbb:["MathFont",i.TexConstant.Variant.DOUBLESTRUCK],mathfrak:["MathFont",i.TexConstant.Variant.FRAKTUR],mathbffrak:["MathFont",i.TexConstant.Variant.BOLDFRAKTUR],mathscr:["MathFont",i.TexConstant.Variant.SCRIPT],mathbfscr:["MathFont",i.TexConstant.Variant.BOLDSCRIPT],mathsf:["MathFont",i.TexConstant.Variant.SANSSERIF],mathsfup:["MathFont",i.TexConstant.Variant.SANSSERIF],mathbfsf:["MathFont",i.TexConstant.Variant.BOLDSANSSERIF],mathbfsfup:["MathFont",i.TexConstant.Variant.BOLDSANSSERIF],mathsfit:["MathFont",i.TexConstant.Variant.SANSSERIFITALIC],mathbfsfit:["MathFont",i.TexConstant.Variant.SANSSERIFBOLDITALIC],mathtt:["MathFont",i.TexConstant.Variant.MONOSPACE],mathcal:["MathFont",i.TexConstant.Variant.CALLIGRAPHIC],mathbfcal:["MathFont",i.TexConstant.Variant.BOLDCALLIGRAPHIC],symrm:["MathFont",i.TexConstant.Variant.NORMAL],symup:["MathFont",i.TexConstant.Variant.NORMAL],symnormal:["MathFont",""],symbf:["MathFont",i.TexConstant.Variant.BOLD],symbfup:["MathFont",i.TexConstant.Variant.BOLD],symit:["MathFont",i.TexConstant.Variant.ITALIC],symbfit:["MathFont",i.TexConstant.Variant.BOLDITALIC],symbb:["MathFont",i.TexConstant.Variant.DOUBLESTRUCK],symfrak:["MathFont",i.TexConstant.Variant.FRAKTUR],symbffrak:["MathFont",i.TexConstant.Variant.BOLDFRAKTUR],symscr:["MathFont",i.TexConstant.Variant.SCRIPT],symbfscr:["MathFont",i.TexConstant.Variant.BOLDSCRIPT],symsf:["MathFont",i.TexConstant.Variant.SANSSERIF],symsfup:["MathFont",i.TexConstant.Variant.SANSSERIF],symbfsf:["MathFont",i.TexConstant.Variant.BOLDSANSSERIF],symbfsfup:["MathFont",i.TexConstant.Variant.BOLDSANSSERIF],symsfit:["MathFont",i.TexConstant.Variant.SANSSERIFITALIC],symbfsfit:["MathFont",i.TexConstant.Variant.SANSSERIFBOLDITALIC],symtt:["MathFont",i.TexConstant.Variant.MONOSPACE],symcal:["MathFont",i.TexConstant.Variant.CALLIGRAPHIC],symbfcal:["MathFont",i.TexConstant.Variant.BOLDCALLIGRAPHIC],textrm:["HBox",null,i.TexConstant.Variant.NORMAL],textup:["HBox",null,i.TexConstant.Variant.NORMAL],textnormal:["HBox"],textit:["HBox",null,i.TexConstant.Variant.ITALIC],textbf:["HBox",null,i.TexConstant.Variant.BOLD],textsf:["HBox",null,i.TexConstant.Variant.SANSSERIF],texttt:["HBox",null,i.TexConstant.Variant.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],arcsin:"NamedFn",arccos:"NamedFn",arctan:"NamedFn",arg:"NamedFn",cos:"NamedFn",cosh:"NamedFn",cot:"NamedFn",coth:"NamedFn",csc:"NamedFn",deg:"NamedFn",det:"NamedOp",dim:"NamedFn",exp:"NamedFn",gcd:"NamedOp",hom:"NamedFn",inf:"NamedOp",ker:"NamedFn",lg:"NamedFn",lim:"NamedOp",liminf:["NamedOp","lim inf"],limsup:["NamedOp","lim sup"],ln:"NamedFn",log:"NamedFn",max:"NamedOp",min:"NamedOp",Pr:"NamedOp",sec:"NamedFn",sin:"NamedFn",sinh:"NamedFn",sup:"NamedOp",tan:"NamedFn",tanh:"NamedFn",limits:["Limits",1],nolimits:["Limits",0],overline:["UnderOver","2015"],underline:["UnderOver","2015"],overbrace:["UnderOver","23DE",1],underbrace:["UnderOver","23DF",1],overparen:["UnderOver","23DC"],underparen:["UnderOver","23DD"],overrightarrow:["UnderOver","2192"],underrightarrow:["UnderOver","2192"],overleftarrow:["UnderOver","2190"],underleftarrow:["UnderOver","2190"],overleftrightarrow:["UnderOver","2194"],underleftrightarrow:["UnderOver","2194"],overset:"Overset",underset:"Underset",overunderset:"Overunderset",stackrel:["Macro","\\mathrel{\\mathop{#2}\\limits^{#1}}",2],stackbin:["Macro","\\mathbin{\\mathop{#2}\\limits^{#1}}",2],over:"Over",overwithdelims:"Over",atop:"Over",atopwithdelims:"Over",above:"Over",abovewithdelims:"Over",brace:["Over","{","}"],brack:["Over","[","]"],choose:["Over","(",")"],frac:"Frac",sqrt:"Sqrt",root:"Root",uproot:["MoveRoot","upRoot"],leftroot:["MoveRoot","leftRoot"],left:"LeftRight",right:"LeftRight",middle:"LeftRight",llap:"Lap",rlap:"Lap",raise:"RaiseLower",lower:"RaiseLower",moveleft:"MoveLeftRight",moveright:"MoveLeftRight",",":["Spacer",r.MATHSPACE.thinmathspace],":":["Spacer",r.MATHSPACE.mediummathspace],">":["Spacer",r.MATHSPACE.mediummathspace],";":["Spacer",r.MATHSPACE.thickmathspace],"!":["Spacer",r.MATHSPACE.negativethinmathspace],enspace:["Spacer",.5],quad:["Spacer",1],qquad:["Spacer",2],thinspace:["Spacer",r.MATHSPACE.thinmathspace],negthinspace:["Spacer",r.MATHSPACE.negativethinmathspace],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",rule:"rule",Rule:["Rule"],Space:["Rule","blank"],nonscript:"Nonscript",big:["MakeBig",c.TEXCLASS.ORD,.85],Big:["MakeBig",c.TEXCLASS.ORD,1.15],bigg:["MakeBig",c.TEXCLASS.ORD,1.45],Bigg:["MakeBig",c.TEXCLASS.ORD,1.75],bigl:["MakeBig",c.TEXCLASS.OPEN,.85],Bigl:["MakeBig",c.TEXCLASS.OPEN,1.15],biggl:["MakeBig",c.TEXCLASS.OPEN,1.45],Biggl:["MakeBig",c.TEXCLASS.OPEN,1.75],bigr:["MakeBig",c.TEXCLASS.CLOSE,.85],Bigr:["MakeBig",c.TEXCLASS.CLOSE,1.15],biggr:["MakeBig",c.TEXCLASS.CLOSE,1.45],Biggr:["MakeBig",c.TEXCLASS.CLOSE,1.75],bigm:["MakeBig",c.TEXCLASS.REL,.85],Bigm:["MakeBig",c.TEXCLASS.REL,1.15],biggm:["MakeBig",c.TEXCLASS.REL,1.45],Biggm:["MakeBig",c.TEXCLASS.REL,1.75],mathord:["TeXAtom",c.TEXCLASS.ORD],mathop:["TeXAtom",c.TEXCLASS.OP],mathopen:["TeXAtom",c.TEXCLASS.OPEN],mathclose:["TeXAtom",c.TEXCLASS.CLOSE],mathbin:["TeXAtom",c.TEXCLASS.BIN],mathrel:["TeXAtom",c.TEXCLASS.REL],mathpunct:["TeXAtom",c.TEXCLASS.PUNCT],mathinner:["TeXAtom",c.TEXCLASS.INNER],vcenter:["TeXAtom",c.TEXCLASS.VCENTER],buildrel:"BuildRel",hbox:["HBox",0],text:"HBox",mbox:["HBox",0],fbox:"FBox",boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],framebox:"FrameBox",strut:"Strut",mathstrut:["Macro","\\vphantom{(}"],phantom:"Phantom",vphantom:["Phantom",1,0],hphantom:["Phantom",0,1],smash:"Smash",acute:["Accent","00B4"],grave:["Accent","0060"],ddot:["Accent","00A8"],tilde:["Accent","007E"],bar:["Accent","00AF"],breve:["Accent","02D8"],check:["Accent","02C7"],hat:["Accent","005E"],vec:["Accent","2192"],dot:["Accent","02D9"],widetilde:["Accent","007E",1],widehat:["Accent","005E",1],matrix:"Matrix",array:"Matrix",pmatrix:["Matrix","(",")"],cases:["Matrix","{","","left left",null,".1em",null,!0],eqalign:["Matrix",null,null,"right left",(0,r.em)(r.MATHSPACE.thickmathspace),".5em","D"],displaylines:["Matrix",null,null,"center",null,".5em","D"],cr:"Cr","\\":"CrLaTeX",newline:["CrLaTeX",!0],hline:["HLine","solid"],hdashline:["HLine","dashed"],eqalignno:["Matrix",null,null,"right left",(0,r.em)(r.MATHSPACE.thickmathspace),".5em","D",null,"right"],leqalignno:["Matrix",null,null,"right left",(0,r.em)(r.MATHSPACE.thickmathspace),".5em","D",null,"left"],hfill:"HFill",hfil:"HFill",hfilll:"HFill",bmod:["Macro",'\\mmlToken{mo}[lspace="thickmathspace" rspace="thickmathspace"]{mod}'],pmod:["Macro","\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}",1],mod:["Macro","\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1",1],pod:["Macro","\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)",1],iff:["Macro","\\;\\Longleftrightarrow\\;"],skew:["Macro","{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}",3],pmb:["Macro","\\rlap{#1}\\kern1px{#1}",1],TeX:["Macro","T\\kern-.14em\\lower.5ex{E}\\kern-.115em X"],LaTeX:["Macro","L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX"]," ":["Macro","\\text{ }"],not:"Not",dots:"Dots",space:"Tilde"," ":"Tilde",begin:"BeginEnd",end:"BeginEnd",label:"HandleLabel",ref:"HandleRef",nonumber:"HandleNoTag",mathchoice:"MathChoice",mmlToken:"MmlToken"},s.default),new e.EnvironmentMap("environment",l.default.environment,{array:["AlignedArray"],equation:["Equation",null,!0],eqnarray:["EqnArray",null,!0,!0,"rcl",a.default.cols(0,r.MATHSPACE.thickmathspace),".5em"]},s.default),new e.CharacterMap("not_remap",null,{"←":"↚","→":"↛","↔":"↮","⇐":"⇍","⇒":"⇏","⇔":"⇎","∈":"∉","∋":"∌","∣":"∤","∥":"∦","∼":"≁","~":"≁","≃":"≄","≅":"≇","≈":"≉","≍":"≭","=":"≠","≡":"≢","<":"≮",">":"≯","≤":"≰","≥":"≱","≲":"≴","≳":"≵","≶":"≸","≷":"≹","≺":"⊀","≻":"⊁","⊂":"⊄","⊃":"⊅","⊆":"⊈","⊇":"⊉","⊢":"⊬","⊨":"⊭","⊩":"⊮","⊫":"⊯","≼":"⋠","≽":"⋡","⊑":"⋢","⊒":"⋣","⊲":"⋪","⊳":"⋫","⊴":"⋬","⊵":"⋭","∃":"∄"})},7693:function(t,e,r){var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},o=(Object.defineProperty(e,"__esModule",{value:!0}),e.ConfigMacrosConfiguration=void 0,r(9899)),i=r(7233),a=r(9140),s=n(r(5450)),S=r(8803),O=n(r(1110)),n=r(6793),M="configmacros-map",x="configmacros-env-map";e.ConfigMacrosConfiguration=o.Configuration.create("configmacros",{init:function(t){new a.CommandMap(M,{},{}),new a.EnvironmentMap(x,s.default.environment,{},{}),t.append(o.Configuration.local({handler:{macro:[M],environment:[x]},priority:3}))},config:function(t,e){var r,n,o=e,i=o.parseOptions.handlers.retrieve(M),a=o.parseOptions.options.macros;try{for(var s=_(Object.keys(a)),l=s.next();!l.done;l=s.next()){var c=l.value,u="string"==typeof a[c]?[a[c]]:a[c],p=Array.isArray(u[2])?new S.Macro(c,O.default.MacroWithTemplate,u.slice(0,2).concat(u[2])):new S.Macro(c,O.default.Macro,u);i.add(c,p)}}catch(o){r={error:o}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}var h,d,f=e,m=f.parseOptions.handlers.retrieve(x),y=f.parseOptions.options.environments;try{for(var g=_(Object.keys(y)),b=g.next();!b.done;b=g.next()){var v=b.value;m.add(v,new S.Macro(v,O.default.BeginEnv,[!0].concat(y[v])))}}catch(f){h={error:f}}finally{try{b&&!b.done&&(d=g.return)&&d.call(g)}finally{if(h)throw h.error}}},items:((r={})[n.BeginEnvItem.prototype.kind]=n.BeginEnvItem,r),options:{macros:(0,i.expandable)({}),environments:(0,i.expandable)({})}})},1496:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){t[n=void 0===n?r:n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},s=(Object.defineProperty(e,"__esModule",{value:!0}),e.NewcommandConfiguration=void 0,r(9899)),l=r(6793),c=a(r(5579)),u=(r(5117),a(r(5450))),p=i(r(9140));e.NewcommandConfiguration=s.Configuration.create("newcommand",{handler:{macro:["Newcommand-macros"]},items:((a={})[l.BeginEnvItem.prototype.kind]=l.BeginEnvItem,a),options:{maxMacros:1e3},init:function(t){new p.DelimiterMap(c.default.NEW_DELIMITER,u.default.delimiter,{}),new p.CommandMap(c.default.NEW_COMMAND,{},{}),new p.EnvironmentMap(c.default.NEW_ENVIRONMENT,u.default.environment,{},{}),t.append(s.Configuration.local({handler:{character:[],delimiter:[c.default.NEW_DELIMITER],macro:[c.default.NEW_DELIMITER,c.default.NEW_COMMAND],environment:[c.default.NEW_ENVIRONMENT]},priority:-1}))}})},6793:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},s=(Object.defineProperty(e,"__esModule",{value:!0}),e.BeginEnvItem=void 0,a(r(3971))),a=(o=r(8292).BaseItem,i(l,o),Object.defineProperty(l.prototype,"kind",{get:function(){return"beginEnv"},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),l.prototype.checkItem=function(t){if(t.isKind("end")){if(t.getName()!==this.getName())throw new s.default("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),t.getName());return[[this.factory.create("mml",this.toMml())],!0]}if(t.isKind("stop"))throw new s.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return o.prototype.checkItem.call(this,t)},l);function l(){return null!==o&&o.apply(this,arguments)||this}e.BeginEnvItem=a},5117:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},e=(Object.defineProperty(e,"__esModule",{value:!0}),n(r(1110)));new(r(9140).CommandMap)("Newcommand-macros",{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",renewenvironment:"NewEnvironment",def:"MacroDef",let:"Let"},e.default)},1110:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){t[n=void 0===n?r:n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},c=(Object.defineProperty(e,"__esModule",{value:!0}),a(r(3971))),s=i(r(9140)),i=a(r(7693)),u=a(r(1130)),p=a(r(5579)),l={NewCommand:function(t,e){var r=p.default.GetCsNameArgument(t,e),n=p.default.GetArgCount(t,e),o=t.GetBrackets(e),e=t.GetArgument(e);p.default.addMacro(t,r,l.Macro,[e,n,o])},NewEnvironment:function(t,e){var r=u.default.trimSpaces(t.GetArgument(e)),n=p.default.GetArgCount(t,e),o=t.GetBrackets(e),i=t.GetArgument(e),e=t.GetArgument(e);p.default.addEnvironment(t,r,l.BeginEnv,[!0,i,e,n,o])},MacroDef:function(t,e){var r=p.default.GetCSname(t,e),n=p.default.GetTemplate(t,e,"\\"+r),e=t.GetArgument(e);n instanceof Array?p.default.addMacro(t,r,l.MacroWithTemplate,[e].concat(n)):p.default.addMacro(t,r,l.Macro,[e,n])},Let:function(t,e){var r=p.default.GetCSname(t,e),n=t.GetNext(),o=("="===n&&(t.i++,n=t.GetNext()),t.configuration.handlers);if("\\"!==n){t.i++;var i=o.get("delimiter").lookup(n);i?p.default.addDelimiter(t,"\\"+r,i.char,i.attributes):p.default.addMacro(t,r,l.Macro,[n])}else if(e=p.default.GetCSname(t,e),i=o.get("delimiter").lookup("\\"+e))p.default.addDelimiter(t,"\\"+r,i.char,i.attributes);else{var a=o.get("macro").applicable(e);if(a){if(a instanceof s.MacroMap)return n=a.lookup(e),void p.default.addMacro(t,r,n.func,n.args,n.symbol);i=a.lookup(e),o=p.default.disassembleSymbol(r,i);p.default.addMacro(t,r,function(t,e){for(var r=[],n=2;n=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.NoUndefinedConfiguration=void 0,r(9899));e.NoUndefinedConfiguration=r.Configuration.create("noundefined",{fallback:{macro:function(t,e){var r,n,e=t.create("text","\\"+e),o=t.options.noundefined||{},i={};try{for(var a=c(["color","background","size"]),s=a.next();!s.done;s=a.next()){var l=s.value;o[l]&&(i["math"+l]=o[l])}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}t.Push(t.create("node","mtext",[],i,e))}},options:{noundefined:{color:"red",background:"",size:""}},priority:3})},7741:function(t,e,r){var h=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTML=void 0,r(3055)),h=r(4139),d=r(9261),f=r(6797),m=r(2760),y=c(r(6010)),g=r(505),c=(s=p.CommonOutputJax,o(b,s),b.prototype.escaped=function(t,e){return this.setDocument(e),this.html("span",{},[this.text(t.math)])},b.prototype.styleSheet=function(t){if(this.chtmlStyles)return this.options.adaptiveCSS&&(e=new h.CssStyles,this.addWrapperStyles(e),this.updateFontStyles(e),this.adaptor.insertRules(this.chtmlStyles,e.getStyleRules())),this.chtmlStyles;var e=this.chtmlStyles=s.prototype.styleSheet.call(this,t);return this.adaptor.setAttribute(e,"id",b.STYLESHEETID),this.wrapperUsage.update(),e},b.prototype.updateFontStyles=function(t){t.addStyles(this.font.updateStyles({}))},b.prototype.addWrapperStyles=function(t){var e,r;if(this.options.adaptiveCSS)try{for(var n=u(this.wrapperUsage.update()),o=n.next();!o.done;o=n.next()){var i=o.value,a=this.factory.getNodeClass(i);a&&this.addClassStyles(a,t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}else s.prototype.addWrapperStyles.call(this,t)},b.prototype.addClassStyles=function(t,e){var r,n=t;n.autoStyle&&"unknown"!==n.kind&&e.addStyles(((r={})["mjx-"+n.kind]={display:"inline-block","text-align":"left"},r)),this.wrapperUsage.add(n.kind),s.prototype.addClassStyles.call(this,t,e)},b.prototype.processMath=function(t,e){this.factory.wrap(t).toCHTML(e)},b.prototype.clearCache=function(){this.cssStyles.clear(),this.font.clearCache(),this.wrapperUsage.clear(),this.chtmlStyles=null},b.prototype.reset=function(){this.clearCache()},b.prototype.unknownText=function(t,e,r){void 0===r&&(r=null);var n={},o=100/this.math.metrics.scale;return 100!=o&&(n["font-size"]=this.fixed(o,1)+"%",n.padding=y.em(75/o)+" 0 "+y.em(20/o)+" 0"),"-explicitFont"!==e&&(1!==(o=(0,g.unicodeChars)(t)).length||o[0]<119808||120831 *":{display:"table-cell"},"mjx-mtext":{display:"inline-block"},"mjx-mstyle":{display:"inline-block"},"mjx-merror":{display:"inline-block",color:"red","background-color":"yellow"},"mjx-mphantom":{visibility:"hidden"},"_::-webkit-full-page-media, _:future, :root mjx-container":{"will-change":"opacity"}},b.STYLESHEETID="MJX-CHTML-styles",b);function b(t){t=s.call(this,t=void 0===t?null:t,d.CHTMLWrapperFactory,m.TeXFont)||this;return t.chtmlStyles=null,t.font.adaptiveCSS(t.options.adaptiveCSS),t.wrapperUsage=new f.Usage,t}e.CHTML=c},8042:function(t,e,r){var n,c,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),u=this&&this.__assign||function(){return(u=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},d=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0 mjx-mid"]={"margin-top":this.em(-r/2),"margin-bottom":this.em(-r/2)}),o&&(a["border-top-width"]=this.em0(o-.03)),i&&(a["border-bottom-width"]=this.em0(i-.03),t["mjx-stretchy-v"+e+" > mjx-end"]={"margin-top":this.em(-i)}),Object.keys(a).length&&(t["mjx-stretchy-v"+e+" > mjx-ext"]=a)},h.prototype.addDelimiterVPart=function(t,e,r,n,o){if(!n)return 0;var i=this.getDelimiterData(n),a=(o[2]-i[2])/2,n={content:this.charContent(n)};return"ext"!==r?n.padding=this.padding(i,a):(n.width=this.em0(o[2]),a&&(n["padding-left"]=this.em0(a))),t["mjx-stretchy-v"+e+" mjx-"+r+" mjx-c::before"]=n,i[0]+i[1]},h.prototype.addDelimiterHStyles=function(t,e,r){var n=d(r.stretch,4),o=n[0],i=n[1],a=n[2],n=n[3],r=r.HDW;this.addDelimiterHPart(t,e,"beg",o,r),this.addDelimiterHPart(t,e,"ext",i,r),this.addDelimiterHPart(t,e,"end",a,r),n&&(this.addDelimiterHPart(t,e,"mid",n,r),t["mjx-stretchy-h"+e+" > mjx-ext"]={width:"50%"})},h.prototype.addDelimiterHPart=function(t,e,r,n,o){var i;n&&((i={content:(i=this.getDelimiterData(n)[3])&&i.c?'"'+i.c+'"':this.charContent(n)}).padding=this.padding(o,0,-o[2]),t["mjx-stretchy-h"+e+" mjx-"+r+" mjx-c::before"]=i)},h.prototype.addCharStyles=function(t,e,r,n){var o=n[3],e=void 0!==o.f?o.f:e;t["mjx-c"+this.charSelector(r)+(e?".TEX-"+e:"")+"::before"]={padding:this.padding(n,0,o.ic||0),content:null!=o.c?'"'+o.c+'"':this.charContent(r)}},h.prototype.getDelimiterData=function(t){return this.getChar("-smallop",t)},h.prototype.em=function(t){return(0,p.em)(t)},h.prototype.em0=function(t){return(0,p.em)(Math.max(0,t))},h.prototype.padding=function(t,e,r){var t=d(t,3),n=t[0],o=t[1];return[n,t[2]+(r=void 0===r?0:r),o,e=void 0===e?0:e].map(this.em0).join(" ")},h.prototype.charContent=function(t){return'"'+(32<=t&&t<=126&&34!==t&&39!==t&&92!==t?String.fromCharCode(t):"\\"+t.toString(16).toUpperCase())+'"'},h.prototype.charSelector=function(t){return".mjx-c"+t.toString(16).toUpperCase()},h.OPTIONS=u(u({},l.FontData.OPTIONS),{fontURL:"js/output/chtml/fonts/tex-woff-v2"}),h.JAX="CHTML",h.defaultVariantClasses={},h.defaultVariantLetters={},h.defaultStyles={"mjx-c::before":{display:"block",width:0}},h.defaultFonts={"@font-face /* 0 */":{"font-family":"MJXZERO",src:'url("%%URL%%/MathJax_Zero.woff") format("woff")'}},h);function h(){var t=null!==c&&c.apply(this,arguments)||this;return t.charUsage=new s.Usage,t.delimUsage=new s.Usage,t}e.CHTMLFontData=a,e.AddCSS=function(t,e){var r,n;try{for(var o=v(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value,s=parseInt(a);Object.assign(l.FontData.charOptions(t,s),e[s])}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return t}},8270:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){t[n=void 0===n?r:n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLTextNode=void 0,r(9007)),s=r(5355),r=(o=(0,r(1160).CommonTextNodeMixin)(s.CHTMLWrapper),i(l,o),l.prototype.toCHTML=function(t){this.markUsed();var e,r,n=this.adaptor,o=this.parent.variant,i=this.node.getText();if(0!==i.length)if("-explicitFont"===o)n.append(t,this.jax.unknownText(i,o,this.getBBox().w));else{i=this.remappedText(i,o);try{for(var a=h(i),s=a.next();!s.done;s=a.next()){var l=s.value,c=this.getVariantChar(o,l)[3],u=c.f?" TEX-"+c.f:"",p=c.unknown?this.jax.unknownText(String.fromCodePoint(l),o):this.html("mjx-c",{class:this.char(l)+u});n.append(t,p),c.unknown||this.font.charUsage.add([o,l])}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}}},l.kind=a.TextNode.prototype.kind,l.autoStyle=!1,l.styles={"mjx-c":{display:"inline-block"},"mjx-utext":{display:"inline-block",padding:".75em 0 .2em 0"}},l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLTextNode=r},8102:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmaction=void 0,r(5355)),s=r(1956),l=r(1956),r=r(9145),s=(o=(0,s.CommonMactionMixin)(a.CHTMLWrapper),i(c,o),c.prototype.toCHTML=function(t){t=this.standardCHTMLnode(t);this.selected.toCHTML(t),this.action(this,this.data)},c.prototype.setEventHandler=function(t,e){this.chtml.addEventListener(t,e)},c.kind=r.MmlMaction.prototype.kind,c.styles={"mjx-maction":{position:"relative"},"mjx-maction > mjx-tool":{display:"none",position:"absolute",bottom:0,right:0,width:0,height:0,"z-index":500},"mjx-tool > mjx-tip":{display:"inline-block",padding:".2em",border:"1px solid #888","font-size":"70%","background-color":"#F8F8F8",color:"black","box-shadow":"2px 2px 5px #AAAAAA"},"mjx-maction[toggle]":{cursor:"pointer"},"mjx-status":{display:"block",position:"fixed",left:"1em",bottom:"1em","min-width":"25%",padding:".2em .4em",border:"1px solid #888","font-size":"90%","background-color":"#F8F8F8",color:"black"}},c.actions=new Map([["toggle",[function(t,e){t.adaptor.setAttribute(t.chtml,"toggle",t.node.attributes.get("selection"));var r=t.factory.jax.math,n=t.factory.jax.document,o=t.node;t.setEventHandler("click",function(t){r.end.node||(r.start.node=r.end.node=r.typesetRoot,r.start.n=r.end.n=0),o.nextToggleSelection(),r.rerender(n),t.stopPropagation()})},{}]],["tooltip",[function(r,n){var t,o,i,e=r.childNodes[1];e&&(e.node.isKind("mtext")?(t=e.node.getText(),r.adaptor.setAttribute(r.chtml,"title",t)):(o=r.adaptor,i=o.append(r.chtml,r.html("mjx-tool",{style:{bottom:r.em(-r.dy),right:r.em(-r.dx)}},[r.html("mjx-tip")])),e.toCHTML(o.firstChild(i)),r.setEventHandler("mouseover",function(t){n.stopTimers(r,n);var e=setTimeout(function(){return o.setStyle(i,"display","block")},n.postDelay);n.hoverTimer.set(r,e),t.stopPropagation()}),r.setEventHandler("mouseout",function(t){n.stopTimers(r,n);var e=setTimeout(function(){return o.setStyle(i,"display","")},n.clearDelay);n.clearTimer.set(r,e),t.stopPropagation()})))},l.TooltipData]],["statusline",[function(r,n){var o,i,t=r.childNodes[1];t&&t.node.isKind("mtext")&&(o=r.adaptor,i=t.node.getText(),o.setAttribute(r.chtml,"statusline",i),r.setEventHandler("mouseover",function(t){var e;null===n.status&&(e=o.body(o.document),n.status=o.append(e,r.html("mjx-status",{},[r.text(i)]))),t.stopPropagation()}),r.setEventHandler("mouseout",function(t){n.status&&(o.remove(n.status),n.status=null),t.stopPropagation()}))},{status:null}]]]),c);function c(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmaction=s},804:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},h=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0 mjx-dstrike":{display:"inline-block",left:0,top:0,position:"absolute","border-top":b.SOLID,"transform-origin":"top left"},"mjx-menclose > mjx-ustrike":{display:"inline-block",left:0,bottom:0,position:"absolute","border-top":b.SOLID,"transform-origin":"bottom left"},"mjx-menclose > mjx-hstrike":{"border-top":b.SOLID,position:"absolute",left:0,right:0,bottom:"50%",transform:"translateY("+(0,r.em)(b.THICKNESS/2)+")"},"mjx-menclose > mjx-vstrike":{"border-left":b.SOLID,position:"absolute",top:0,bottom:0,right:"50%",transform:"translateX("+(0,r.em)(b.THICKNESS/2)+")"},"mjx-menclose > mjx-rbox":{position:"absolute",top:0,bottom:0,right:0,left:0,border:b.SOLID,"border-radius":(0,r.em)(b.THICKNESS+b.PADDING)},"mjx-menclose > mjx-cbox":{position:"absolute",top:0,bottom:0,right:0,left:0,border:b.SOLID,"border-radius":"50%"},"mjx-menclose > mjx-arrow":{position:"absolute",left:0,bottom:"50%",height:0,width:0},"mjx-menclose > mjx-arrow > *":{display:"block",position:"absolute","transform-origin":"bottom","border-left":(0,r.em)(b.THICKNESS*b.ARROWX)+" solid","border-right":0,"box-sizing":"border-box"},"mjx-menclose > mjx-arrow > mjx-aline":{left:0,top:(0,r.em)(-b.THICKNESS/2),right:(0,r.em)(b.THICKNESS*(b.ARROWX-1)),height:0,"border-top":(0,r.em)(b.THICKNESS)+" solid","border-left":0},"mjx-menclose > mjx-arrow[double] > mjx-aline":{left:(0,r.em)(b.THICKNESS*(b.ARROWX-1)),height:0},"mjx-menclose > mjx-arrow > mjx-rthead":{transform:"skewX("+p+"rad)",right:0,bottom:"-1px","border-bottom":"1px solid transparent","border-top":(0,r.em)(b.THICKNESS*b.ARROWY)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-rbhead":{transform:"skewX(-"+p+"rad)","transform-origin":"top",right:0,top:"-1px","border-top":"1px solid transparent","border-bottom":(0,r.em)(b.THICKNESS*b.ARROWY)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-lthead":{transform:"skewX(-"+p+"rad)",left:0,bottom:"-1px","border-left":0,"border-right":(0,r.em)(b.THICKNESS*b.ARROWX)+" solid","border-bottom":"1px solid transparent","border-top":(0,r.em)(b.THICKNESS*b.ARROWY)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-lbhead":{transform:"skewX("+p+"rad)","transform-origin":"top",left:0,top:"-1px","border-left":0,"border-right":(0,r.em)(b.THICKNESS*b.ARROWX)+" solid","border-top":"1px solid transparent","border-bottom":(0,r.em)(b.THICKNESS*b.ARROWY)+" solid transparent"},"mjx-menclose > dbox":{position:"absolute",top:0,bottom:0,left:(0,r.em)(-1.5*b.PADDING),width:(0,r.em)(3*b.PADDING),border:(0,r.em)(b.THICKNESS)+" solid","border-radius":"50%","clip-path":"inset(0 0 0 "+(0,r.em)(1.5*b.PADDING)+")","box-sizing":"border-box"}},f.notations=new Map([b.Border("top"),b.Border("right"),b.Border("bottom"),b.Border("left"),b.Border2("actuarial","top","right"),b.Border2("madruwb","bottom","right"),b.DiagonalStrike("up",1),b.DiagonalStrike("down",-1),["horizontalstrike",{renderer:b.RenderElement("hstrike","Y"),bbox:function(t){return[0,t.padding,0,t.padding]}}],["verticalstrike",{renderer:b.RenderElement("vstrike","X"),bbox:function(t){return[t.padding,0,t.padding,0]}}],["box",{renderer:function(t,e){t.adaptor.setStyle(e,"border",t.em(t.thickness)+" solid")},bbox:b.fullBBox,border:b.fullBorder,remove:"left right top bottom"}],["roundedbox",{renderer:b.RenderElement("rbox"),bbox:b.fullBBox}],["circle",{renderer:b.RenderElement("cbox"),bbox:b.fullBBox}],["phasorangle",{renderer:function(t,e){var r=t.getBBox(),n=r.h,r=r.d,n=h(t.getArgMod(1.75*t.padding,n+r),2),r=n[0],n=n[1],o=t.thickness*Math.sin(r)*.9,e=(t.adaptor.setStyle(e,"border-bottom",t.em(t.thickness)+" solid"),t.adjustBorder(t.html("mjx-ustrike",{style:{width:t.em(n),transform:"translateX("+t.em(o)+") rotate("+t.fixed(-r)+"rad)"}})));t.adaptor.append(t.chtml,e)},bbox:function(t){var e=t.padding/2,t=t.thickness;return[2*e,e,e+t,3*e+t]},border:function(t){return[0,0,t.thickness,0]},remove:"bottom"}],b.Arrow("up"),b.Arrow("down"),b.Arrow("left"),b.Arrow("right"),b.Arrow("updown"),b.Arrow("leftright"),b.DiagonalArrow("updiagonal"),b.DiagonalArrow("northeast"),b.DiagonalArrow("southeast"),b.DiagonalArrow("northwest"),b.DiagonalArrow("southwest"),b.DiagonalArrow("northeastsouthwest"),b.DiagonalArrow("northwestsoutheast"),["longdiv",{renderer:function(t,e){var r=t.adaptor,e=(r.setStyle(e,"border-top",t.em(t.thickness)+" solid"),r.append(t.chtml,t.html("dbox"))),n=t.thickness,o=t.padding;n!==b.THICKNESS&&r.setStyle(e,"border-width",t.em(n)),o!==b.PADDING&&(r.setStyle(e,"left",t.em(-1.5*o)),r.setStyle(e,"width",t.em(3*o)),r.setStyle(e,"clip-path","inset(0 0 0 "+t.em(1.5*o)+")"))},bbox:function(t){var e=t.padding,t=t.thickness;return[e+t,e,e,2*e+t/2]}}],["radical",{renderer:function(e,t){e.msqrt.toCHTML(t);t=e.sqrtTRBL();e.adaptor.setStyle(e.msqrt.chtml,"margin",t.map(function(t){return e.em(-t)}).join(" "))},init:function(t){t.msqrt=t.createMsqrt(t.childNodes[0])},bbox:function(t){return t.sqrtTRBL()},renderChild:!0}]]),f);function f(){return null!==u&&u.apply(this,arguments)||this}e.CHTMLmenclose=c},2275:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmfenced=void 0,r(5355)),s=r(7555),r=r(5410),s=(o=(0,s.CommonMfencedMixin)(a.CHTMLWrapper),i(l,o),l.prototype.toCHTML=function(t){t=this.standardCHTMLnode(t);this.mrow.toCHTML(t)},l.kind=r.MmlMfenced.prototype.kind,l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmfenced=s},9063:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),d=this&&this.__assign||function(){return(d=Object.assign||function(t){for(var e,r=1,n=arguments.length;r *":{"font-size":"2000%"},"mjx-dbox":{display:"block","font-size":"5%"},"mjx-num":{display:"block","text-align":"center"},"mjx-den":{display:"block","text-align":"center"},"mjx-mfrac[bevelled] > mjx-num":{display:"inline-block"},"mjx-mfrac[bevelled] > mjx-den":{display:"inline-block"},'mjx-den[align="right"], mjx-num[align="right"]':{"text-align":"right"},'mjx-den[align="left"], mjx-num[align="left"]':{"text-align":"left"},"mjx-nstrut":{display:"inline-block",height:".054em",width:0,"vertical-align":"-.054em"},'mjx-nstrut[type="d"]':{height:".217em","vertical-align":"-.217em"},"mjx-dstrut":{display:"inline-block",height:".505em",width:0},'mjx-dstrut[type="d"]':{height:".726em"},"mjx-line":{display:"block","box-sizing":"border-box","min-height":"1px",height:".06em","border-top":".06em solid",margin:".06em -.1em",overflow:"hidden"},'mjx-line[type="d"]':{margin:".18em -.1em"}},l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmfrac=s},6911:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmglyph=void 0,r(5355)),s=r(5636),r=r(3985),s=(o=(0,s.CommonMglyphMixin)(a.CHTMLWrapper),i(l,o),l.prototype.toCHTML=function(t){var e,r,n,t=this.standardCHTMLnode(t);this.charWrapper?this.charWrapper.toCHTML(t):(n=(e=this.node.attributes.getList("src","alt")).src,e=e.alt,r={width:this.em(this.width),height:this.em(this.height)},this.valign&&(r.verticalAlign=this.em(this.valign)),n=this.html("img",{src:n,style:r,alt:e,title:e}),this.adaptor.append(t,n))},l.kind=r.MmlMglyph.prototype.kind,l.styles={"mjx-mglyph > img":{display:"inline-block",border:0,padding:0}},l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmglyph=s},1653:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmi=void 0,r(5355)),s=r(5723),r=r(450),s=(o=(0,s.CommonMiMixin)(a.CHTMLWrapper),i(l,o),l.kind=r.MmlMi.prototype.kind,l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmi=s},6781:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0 mjx-row > mjx-cell":{"text-align":"right"},'[script-align="left"] > mjx-row > mjx-cell':{"text-align":"left"},'[script-align="center"] > mjx-row > mjx-cell':{"text-align":"center"},'[script-align="right"] > mjx-row > mjx-cell':{"text-align":"right"}},p);function p(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmmultiscripts=r},6460:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmn=void 0,r(5355)),s=r(5023),r=r(3050),s=(o=(0,s.CommonMnMixin)(a.CHTMLWrapper),i(l,o),l.kind=r.MmlMn.prototype.kind,l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmn=s},6287:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmo=void 0,r(5355)),l=r(7096),r=r(2756),a=(o=(0,l.CommonMoMixin)(a.CHTMLWrapper),i(s,o),s.prototype.toCHTML=function(t){var e,r,n=this.node.attributes,o=n.get("symmetric")&&2!==this.stretch.dir,i=0!==this.stretch.dir,a=(i&&null===this.size&&this.getStretchedVariant([]),this.standardCHTMLnode(t));if(i&&this.size<0)this.stretchHTML(a);else{!o&&!n.get("largeop")||"0"!==(i=this.em(this.getCenterOffset()))&&this.adaptor.setStyle(a,"verticalAlign",i),this.node.getProperty("mathaccent")&&(this.adaptor.setStyle(a,"width","0"),this.adaptor.setStyle(a,"margin-left",this.em(this.getAccentOffset())));try{for(var s=c(this.childNodes),l=s.next();!l.done;l=s.next())l.value.toCHTML(a)}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}}},s.prototype.stretchHTML=function(t){var e=this.getText().codePointAt(0),r=(this.font.delimUsage.add(e),this.childNodes[0].markUsed(),this.stretch),n=r.stretch,o=[],n=(n[0]&&o.push(this.html("mjx-beg",{},[this.html("mjx-c")])),o.push(this.html("mjx-ext",{},[this.html("mjx-c")])),4===n.length&&o.push(this.html("mjx-mid",{},[this.html("mjx-c")]),this.html("mjx-ext",{},[this.html("mjx-c")])),n[2]&&o.push(this.html("mjx-end",{},[this.html("mjx-c")])),{}),i=this.bbox,a=i.h,s=i.d,i=i.w,a=(1===r.dir?(o.push(this.html("mjx-mark")),n.height=this.em(a+s),n.verticalAlign=this.em(-s)):n.width=this.em(i),l.DirectionVH[r.dir]),s={class:this.char(r.c||e),style:n},i=this.html("mjx-stretchy-"+a,s,o);this.adaptor.append(t,i)},s.kind=r.MmlMo.prototype.kind,s.styles={"mjx-stretchy-h":{display:"inline-table",width:"100%"},"mjx-stretchy-h > *":{display:"table-cell",width:0},"mjx-stretchy-h > * > mjx-c":{display:"inline-block",transform:"scalex(1.0000001)"},"mjx-stretchy-h > * > mjx-c::before":{display:"inline-block",width:"initial"},"mjx-stretchy-h > mjx-ext":{"/* IE */ overflow":"hidden","/* others */ overflow":"clip visible",width:"100%"},"mjx-stretchy-h > mjx-ext > mjx-c::before":{transform:"scalex(500)"},"mjx-stretchy-h > mjx-ext > mjx-c":{width:0},"mjx-stretchy-h > mjx-beg > mjx-c":{"margin-right":"-.1em"},"mjx-stretchy-h > mjx-end > mjx-c":{"margin-left":"-.1em"},"mjx-stretchy-v":{display:"inline-block"},"mjx-stretchy-v > *":{display:"block"},"mjx-stretchy-v > mjx-beg":{height:0},"mjx-stretchy-v > mjx-end > mjx-c":{display:"block"},"mjx-stretchy-v > * > mjx-c":{transform:"scaley(1.0000001)","transform-origin":"left center",overflow:"hidden"},"mjx-stretchy-v > mjx-ext":{display:"block",height:"100%","box-sizing":"border-box",border:"0px solid transparent","/* IE */ overflow":"hidden","/* others */ overflow":"visible clip"},"mjx-stretchy-v > mjx-ext > mjx-c::before":{width:"initial","box-sizing":"border-box"},"mjx-stretchy-v > mjx-ext > mjx-c":{transform:"scaleY(500) translateY(.075em)",overflow:"visible"},"mjx-mark":{display:"inline-block",height:"0px"}},s);function s(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmo=a},5964:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),m=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmpadded=void 0,r(5355)),s=r(6898),r=r(7238),s=(o=(0,s.CommonMpaddedMixin)(a.CHTMLWrapper),i(l,o),l.prototype.toCHTML=function(t){var e,r,n=this.standardCHTMLnode(t),o=[],i={},a=m(this.getDimens(),9),s=a[2],l=a[3],c=a[4],u=a[5],p=a[6],h=a[7],a=a[8];u&&(i.width=this.em(s+u)),(l||c)&&(i.margin=this.em(l)+" 0 "+this.em(c)),(p+a||h)&&(i.position="relative",s=this.html("mjx-rbox",{style:{left:this.em(p+a),top:this.em(-h),"max-width":i.width}}),p+a&&this.childNodes[0].getBBox().pwidth&&(this.adaptor.setAttribute(s,"width","full"),this.adaptor.setStyle(s,"left",this.em(p))),o.push(s)),n=this.adaptor.append(n,this.html("mjx-block",{style:i},o));try{for(var d=y(this.childNodes),f=d.next();!f.done;f=d.next())f.value.toCHTML(o[0]||n)}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}},l.kind=r.MmlMpadded.prototype.kind,l.styles={"mjx-mpadded":{display:"inline-block"},"mjx-rbox":{display:"inline-block",position:"relative"}},l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmpadded=s},8776:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLinferredMrow=e.CHTMLmrow=void 0,r(5355)),s=r(8411),c=r(8411),r=r(9878),s=(o=(0,s.CommonMrowMixin)(a.CHTMLWrapper),i(u,o),u.prototype.toCHTML=function(t){var e,r,n=this.node.isInferred?this.chtml=t:this.standardCHTMLnode(t),o=!1;try{for(var i=l(this.childNodes),a=i.next();!a.done;a=i.next()){var s=a.value;s.toCHTML(n),s.bbox.w<0&&(o=!0)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}o&&(r=this.getBBox().w)&&(this.adaptor.setStyle(n,"width",this.em(Math.max(0,r))),r<0&&this.adaptor.setStyle(n,"marginRight",this.em(r)))},u.kind=r.MmlMrow.prototype.kind,u);function u(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmrow=s;p=(0,c.CommonInferredMrowMixin)(s),i(h,p),h.kind=r.MmlInferredMrow.prototype.kind;var p,a=h;function h(){return null!==p&&p.apply(this,arguments)||this}e.CHTMLinferredMrow=a},4597:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLms=void 0,r(5355)),s=r(4126),r=r(7265),s=(o=(0,s.CommonMsMixin)(a.CHTMLWrapper),i(l,o),l.kind=r.MmlMs.prototype.kind,l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLms=s},2970:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmspace=void 0,r(5355)),s=r(258),r=r(6030),s=(o=(0,s.CommonMspaceMixin)(a.CHTMLWrapper),i(l,o),l.prototype.toCHTML=function(t){var t=this.standardCHTMLnode(t),e=this.getBBox(),r=e.w,n=e.h,e=e.d;r<0&&(this.adaptor.setStyle(t,"marginRight",this.em(r)),r=0),r&&this.adaptor.setStyle(t,"width",this.em(r)),(n=Math.max(0,n+e))&&this.adaptor.setStyle(t,"height",this.em(Math.max(0,n))),e&&this.adaptor.setStyle(t,"verticalAlign",this.em(-e))},l.kind=r.MmlMspace.prototype.kind,l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmspace=s},5610:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),c=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0 mjx-box":{"border-top":".07em solid"},"mjx-sqrt.mjx-tall > mjx-box":{"padding-left":".3em","margin-left":"-.3em"}},l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmsqrt=s},4300:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0 mjx-spacer":{display:"block"}};var f,c=m;function m(){return null!==f&&f.apply(this,arguments)||this}e.CHTMLmsubsup=c},8002:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),g=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0 mjx-itable":{"vertical-align":"middle","text-align":"left","box-sizing":"border-box"},"mjx-labels > mjx-itable":{position:"absolute",top:0},'mjx-mtable[justify="left"]':{"text-align":"left"},'mjx-mtable[justify="right"]':{"text-align":"right"},'mjx-mtable[justify="left"][side="left"]':{"padding-right":"0 ! important"},'mjx-mtable[justify="left"][side="right"]':{"padding-left":"0 ! important"},'mjx-mtable[justify="right"][side="left"]':{"padding-right":"0 ! important"},'mjx-mtable[justify="right"][side="right"]':{"padding-left":"0 ! important"},"mjx-mtable[align]":{"vertical-align":"baseline"},'mjx-mtable[align="top"] > mjx-table':{"vertical-align":"top"},'mjx-mtable[align="bottom"] > mjx-table':{"vertical-align":"bottom"},'mjx-mtable[side="right"] mjx-labels':{"min-width":"100%"}},p);function p(t,e,r){t=o.call(this,t,e,r=void 0===r?null:r)||this;return t.itable=t.html("mjx-itable"),t.labels=t.html("mjx-itable"),t}e.CHTMLmtable=r},7056:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmtd=void 0,r(5355)),s=r(5164),r=r(4359),s=(o=(0,s.CommonMtdMixin)(a.CHTMLWrapper),i(l,o),l.prototype.toCHTML=function(t){o.prototype.toCHTML.call(this,t);var t=this.node.attributes.get("rowalign"),e=this.node.attributes.get("columnalign");t!==this.parent.node.attributes.get("rowalign")&&this.adaptor.setAttribute(this.chtml,"rowalign",t),"center"===e||"mlabeledtr"===this.parent.kind&&this===this.parent.childNodes[0]&&e===this.parent.parent.node.attributes.get("side")||this.adaptor.setStyle(this.chtml,"textAlign",e),this.parent.parent.node.getProperty("useHeight")&&this.adaptor.append(this.chtml,this.html("mjx-tstrut"))},l.kind=r.MmlMtd.prototype.kind,l.styles={"mjx-mtd":{display:"table-cell","text-align":"center",padding:".215em .4em"},"mjx-mtd:first-child":{"padding-left":0},"mjx-mtd:last-child":{"padding-right":0},"mjx-mtable > * > mjx-itable > *:first-child > mjx-mtd":{"padding-top":0},"mjx-mtable > * > mjx-itable > *:last-child > mjx-mtd":{"padding-bottom":0},"mjx-tstrut":{display:"inline-block",height:"1em","vertical-align":"-.25em"},'mjx-labels[align="left"] > mjx-mtr > mjx-mtd':{"text-align":"left"},'mjx-labels[align="right"] > mjx-mtr > mjx-mtd':{"text-align":"right"},"mjx-mtd[extra]":{padding:0},'mjx-mtd[rowalign="top"]':{"vertical-align":"top"},'mjx-mtd[rowalign="center"]':{"vertical-align":"middle"},'mjx-mtd[rowalign="bottom"]':{"vertical-align":"bottom"},'mjx-mtd[rowalign="baseline"]':{"vertical-align":"baseline"},'mjx-mtd[rowalign="axis"]':{"vertical-align":".25em"}},l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmtd=s},1259:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmtext=void 0,r(5355)),s=r(6319),r=r(4770),s=(o=(0,s.CommonMtextMixin)(a.CHTMLWrapper),i(l,o),l.kind=r.MmlMtext.prototype.kind,l);function l(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmtext=s},3571:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmlabeledtr=e.CHTMLmtr=void 0,r(5355)),s=r(5766),l=r(5766),r=r(5022),c=(o=(0,s.CommonMtrMixin)(a.CHTMLWrapper),i(u,o),u.prototype.toCHTML=function(t){o.prototype.toCHTML.call(this,t);t=this.node.attributes.get("rowalign");"baseline"!==t&&this.adaptor.setAttribute(this.chtml,"rowalign",t)},u.kind=r.MmlMtr.prototype.kind,u.styles={"mjx-mtr":{display:"table-row"},'mjx-mtr[rowalign="top"] > mjx-mtd':{"vertical-align":"top"},'mjx-mtr[rowalign="center"] > mjx-mtd':{"vertical-align":"middle"},'mjx-mtr[rowalign="bottom"] > mjx-mtd':{"vertical-align":"bottom"},'mjx-mtr[rowalign="baseline"] > mjx-mtd':{"vertical-align":"baseline"},'mjx-mtr[rowalign="axis"] > mjx-mtd':{"vertical-align":".25em"}},u);function u(){return null!==o&&o.apply(this,arguments)||this}e.CHTMLmtr=c;p=(0,l.CommonMlabeledtrMixin)(c),i(h,p),h.prototype.toCHTML=function(t){p.prototype.toCHTML.call(this,t);var e,t=this.adaptor.firstChild(this.chtml);t&&(this.adaptor.remove(t),e=this.node.attributes.get("rowalign"),e=this.html("mjx-mtr","baseline"!==e&&"axis"!==e?{rowalign:e}:{},[t]),this.adaptor.append(this.parent.labels,e))},h.prototype.markUsed=function(){p.prototype.markUsed.call(this),this.jax.wrapperUsage.add(c.kind)},h.kind=r.MmlMlabeledtr.prototype.kind,h.styles={"mjx-mlabeledtr":{display:"table-row"},'mjx-mlabeledtr[rowalign="top"] > mjx-mtd':{"vertical-align":"top"},'mjx-mlabeledtr[rowalign="center"] > mjx-mtd':{"vertical-align":"middle"},'mjx-mlabeledtr[rowalign="bottom"] > mjx-mtd':{"vertical-align":"bottom"},'mjx-mlabeledtr[rowalign="baseline"] > mjx-mtd':{"vertical-align":"baseline"},'mjx-mlabeledtr[rowalign="axis"] > mjx-mtd':{"vertical-align":".25em"}};var p,s=h;function h(){return null!==p&&p.apply(this,arguments)||this}e.CHTMLmlabeledtr=s},6590:function(t,e,r){var n,a,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmunderover=e.CHTMLmover=e.CHTMLmunder=void 0,r(4300)),s=r(1971),l=r(1971),c=r(1971),r=r(5184),s=(a=(0,s.CommonMunderMixin)(i.CHTMLmsub),o(u,a),u.prototype.toCHTML=function(t){if(this.hasMovableLimits())return a.prototype.toCHTML.call(this,t),void this.adaptor.setAttribute(this.chtml,"limits","false");this.chtml=this.standardCHTMLnode(t);var t=this.adaptor.append(this.adaptor.append(this.chtml,this.html("mjx-row")),this.html("mjx-base")),e=this.adaptor.append(this.adaptor.append(this.chtml,this.html("mjx-row")),this.html("mjx-under")),r=(this.baseChild.toCHTML(t),this.scriptChild.toCHTML(e),this.baseChild.getOuterBBox()),n=this.scriptChild.getOuterBBox(),o=this.getUnderKV(r,n)[0],i=this.isLineBelow?0:this.getDelta(!0);this.adaptor.setStyle(e,"paddingTop",this.em(o)),this.setDeltaW([t,e],this.getDeltaW([r,n],[0,-i])),this.adjustUnderDepth(e,n)},u.kind=r.MmlMunder.prototype.kind,u.styles={"mjx-over":{"text-align":"left"},'mjx-munder:not([limits="false"])':{display:"inline-table"},"mjx-munder > mjx-row":{"text-align":"left"},"mjx-under":{"padding-bottom":".1em"}},u);function u(){return null!==a&&a.apply(this,arguments)||this}e.CHTMLmunder=s;p=(0,l.CommonMoverMixin)(i.CHTMLmsup),o(h,p),h.prototype.toCHTML=function(t){if(this.hasMovableLimits())return p.prototype.toCHTML.call(this,t),void this.adaptor.setAttribute(this.chtml,"limits","false");this.chtml=this.standardCHTMLnode(t);var t=this.adaptor.append(this.chtml,this.html("mjx-over")),e=this.adaptor.append(this.chtml,this.html("mjx-base")),r=(this.scriptChild.toCHTML(t),this.baseChild.toCHTML(e),this.scriptChild.getOuterBBox()),n=this.baseChild.getOuterBBox(),o=(this.adjustBaseHeight(e,n),this.getOverKU(n,r)[0]),i=this.isLineAbove?0:this.getDelta();this.adaptor.setStyle(t,"paddingBottom",this.em(o)),this.setDeltaW([e,t],this.getDeltaW([n,r],[0,i])),this.adjustOverDepth(t,r)},h.kind=r.MmlMover.prototype.kind,h.styles={'mjx-mover:not([limits="false"])':{"padding-top":".1em"},'mjx-mover:not([limits="false"]) > *':{display:"block","text-align":"left"}};var p,s=h;function h(){return null!==p&&p.apply(this,arguments)||this}e.CHTMLmover=s;d=(0,c.CommonMunderoverMixin)(i.CHTMLmsubsup),o(f,d),f.prototype.toCHTML=function(t){if(this.hasMovableLimits())return d.prototype.toCHTML.call(this,t),void this.adaptor.setAttribute(this.chtml,"limits","false");this.chtml=this.standardCHTMLnode(t);var t=this.adaptor.append(this.chtml,this.html("mjx-over")),e=this.adaptor.append(this.adaptor.append(this.chtml,this.html("mjx-box")),this.html("mjx-munder")),r=this.adaptor.append(this.adaptor.append(e,this.html("mjx-row")),this.html("mjx-base")),e=this.adaptor.append(this.adaptor.append(e,this.html("mjx-row")),this.html("mjx-under")),n=(this.overChild.toCHTML(t),this.baseChild.toCHTML(r),this.underChild.toCHTML(e),this.overChild.getOuterBBox()),o=this.baseChild.getOuterBBox(),i=this.underChild.getOuterBBox(),a=(this.adjustBaseHeight(r,o),this.getOverKU(o,n)[0]),s=this.getUnderKV(o,i)[0],l=this.getDelta();this.adaptor.setStyle(t,"paddingBottom",this.em(a)),this.adaptor.setStyle(e,"paddingTop",this.em(s)),this.setDeltaW([r,e,t],this.getDeltaW([o,i,n],[0,this.isLineBelow?0:-l,this.isLineAbove?0:l])),this.adjustOverDepth(t,n),this.adjustUnderDepth(e,i)},f.prototype.markUsed=function(){d.prototype.markUsed.call(this),this.jax.wrapperUsage.add(i.CHTMLmsubsup.kind)},f.kind=r.MmlMunderover.prototype.kind,f.styles={'mjx-munderover:not([limits="false"])':{"padding-top":".1em"},'mjx-munderover:not([limits="false"]) > *':{display:"block"}};var d,l=f;function f(){return null!==d&&d.apply(this,arguments)||this}e.CHTMLmunderover=l},8650:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=(Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLscriptbase=void 0,r(5355)),r=(o=(0,r(167).CommonScriptbaseMixin)(s.CHTMLWrapper),i(l,o),l.prototype.toCHTML=function(t){this.chtml=this.standardCHTMLnode(t);var t=a(this.getOffset(),2),e=t[0],t=t[1],e=e-(this.baseRemoveIc?this.baseIc:0),t={"vertical-align":this.em(t)};e&&(t["margin-left"]=this.em(e)),this.baseChild.toCHTML(this.chtml),this.scriptChild.toCHTML(this.adaptor.append(this.chtml,this.html("mjx-script",{style:t})))},l.prototype.setDeltaW=function(t,e){for(var r=0;r\\338"},8816:{c:"\\2264\\338"},8817:{c:"\\2265\\338"},8832:{c:"\\227A\\338"},8833:{c:"\\227B\\338"},8836:{c:"\\2282\\338"},8837:{c:"\\2283\\338"},8840:{c:"\\2286\\338"},8841:{c:"\\2287\\338"},8876:{c:"\\22A2\\338"},8877:{c:"\\22A8\\338"},8930:{c:"\\2291\\338"},8931:{c:"\\2292\\338"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},9653:{c:"\\25B3"},9663:{c:"\\25BD"},10072:{c:"\\2223"},10744:{c:"/",f:"BI"},10799:{c:"\\D7"},12296:{c:"\\27E8"},12297:{c:"\\27E9"}})},4515:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.doubleStruck=void 0;var n=r(6001);Object.defineProperty(e,"doubleStruck",{enumerable:!0,get:function(){return n.doubleStruck}})},6555:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.frakturBold=void 0;var n=r(8042),r=r(3696);e.frakturBold=(0,n.AddCSS)(r.frakturBold,{8260:{c:"/"}})},2183:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.fraktur=void 0;var n=r(8042),r=r(9587);e.fraktur=(0,n.AddCSS)(r.fraktur,{8260:{c:"/"}})},3490:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.italic=void 0;var n=r(8042),r=r(8348);e.italic=(0,n.AddCSS)(r.italic,{47:{f:"I"},989:{c:"\\E008",f:"A"},8213:{c:"\\2014"},8215:{c:"_"},8260:{c:"/",f:"I"},8710:{c:"\\394",f:"I"},10744:{c:"/",f:"I"}})},9056:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.largeop=void 0;var n=r(8042),r=r(1376);e.largeop=(0,n.AddCSS)(r.largeop,{8214:{f:"S1"},8260:{c:"/"},8593:{f:"S1"},8595:{f:"S1"},8657:{f:"S1"},8659:{f:"S1"},8739:{f:"S1"},8741:{f:"S1"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},9168:{f:"S1"},10072:{c:"\\2223",f:"S1"},10764:{c:"\\222C\\222C"},12296:{c:"\\27E8"},12297:{c:"\\27E9"}})},3019:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.monospace=void 0;var n=r(8042),r=r(1439);e.monospace=(0,n.AddCSS)(r.monospace,{697:{c:"\\2032"},913:{c:"A"},914:{c:"B"},917:{c:"E"},918:{c:"Z"},919:{c:"H"},921:{c:"I"},922:{c:"K"},924:{c:"M"},925:{c:"N"},927:{c:"O"},929:{c:"P"},932:{c:"T"},935:{c:"X"},8215:{c:"_"},8243:{c:"\\2032\\2032"},8244:{c:"\\2032\\2032\\2032"},8260:{c:"/"},8279:{c:"\\2032\\2032\\2032\\2032"},8710:{c:"\\394"}})},2713:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.normal=void 0;var n=r(8042),r=r(331);e.normal=(0,n.AddCSS)(r.normal,{163:{f:"MI"},165:{f:"A"},174:{f:"A"},183:{c:"\\22C5"},240:{f:"A"},697:{c:"\\2032"},913:{c:"A"},914:{c:"B"},917:{c:"E"},918:{c:"Z"},919:{c:"H"},921:{c:"I"},922:{c:"K"},924:{c:"M"},925:{c:"N"},927:{c:"O"},929:{c:"P"},932:{c:"T"},935:{c:"X"},8192:{c:""},8193:{c:""},8194:{c:""},8195:{c:""},8196:{c:""},8197:{c:""},8198:{c:""},8201:{c:""},8202:{c:""},8203:{c:""},8204:{c:""},8213:{c:"\\2014"},8214:{c:"\\2225"},8215:{c:"_"},8226:{c:"\\2219"},8243:{c:"\\2032\\2032"},8244:{c:"\\2032\\2032\\2032"},8245:{f:"A"},8246:{c:"\\2035\\2035",f:"A"},8247:{c:"\\2035\\2035\\2035",f:"A"},8254:{c:"\\2C9"},8260:{c:"/"},8279:{c:"\\2032\\2032\\2032\\2032"},8288:{c:""},8289:{c:""},8290:{c:""},8291:{c:""},8292:{c:""},8407:{c:"\\2192",f:"V"},8450:{c:"C",f:"A"},8459:{c:"H",f:"SC"},8460:{c:"H",f:"FR"},8461:{c:"H",f:"A"},8462:{c:"h",f:"I"},8463:{f:"A"},8464:{c:"I",f:"SC"},8465:{c:"I",f:"FR"},8466:{c:"L",f:"SC"},8469:{c:"N",f:"A"},8473:{c:"P",f:"A"},8474:{c:"Q",f:"A"},8475:{c:"R",f:"SC"},8476:{c:"R",f:"FR"},8477:{c:"R",f:"A"},8484:{c:"Z",f:"A"},8486:{c:"\\3A9"},8487:{f:"A"},8488:{c:"Z",f:"FR"},8492:{c:"B",f:"SC"},8493:{c:"C",f:"FR"},8496:{c:"E",f:"SC"},8497:{c:"F",f:"SC"},8498:{f:"A"},8499:{c:"M",f:"SC"},8502:{f:"A"},8503:{f:"A"},8504:{f:"A"},8513:{f:"A"},8602:{f:"A"},8603:{f:"A"},8606:{f:"A"},8608:{f:"A"},8610:{f:"A"},8611:{f:"A"},8619:{f:"A"},8620:{f:"A"},8621:{f:"A"},8622:{f:"A"},8624:{f:"A"},8625:{f:"A"},8630:{f:"A"},8631:{f:"A"},8634:{f:"A"},8635:{f:"A"},8638:{f:"A"},8639:{f:"A"},8642:{f:"A"},8643:{f:"A"},8644:{f:"A"},8646:{f:"A"},8647:{f:"A"},8648:{f:"A"},8649:{f:"A"},8650:{f:"A"},8651:{f:"A"},8653:{f:"A"},8654:{f:"A"},8655:{f:"A"},8666:{f:"A"},8667:{f:"A"},8669:{f:"A"},8672:{f:"A"},8674:{f:"A"},8705:{f:"A"},8708:{c:"\\2203\\338"},8710:{c:"\\394"},8716:{c:"\\220B\\338"},8717:{f:"A"},8719:{f:"S1"},8720:{f:"S1"},8721:{f:"S1"},8724:{f:"A"},8737:{f:"A"},8738:{f:"A"},8740:{f:"A"},8742:{f:"A"},8748:{f:"S1"},8749:{f:"S1"},8750:{f:"S1"},8756:{f:"A"},8757:{f:"A"},8765:{f:"A"},8769:{f:"A"},8770:{f:"A"},8772:{c:"\\2243\\338"},8775:{c:"\\2246",f:"A"},8777:{c:"\\2248\\338"},8778:{f:"A"},8782:{f:"A"},8783:{f:"A"},8785:{f:"A"},8786:{f:"A"},8787:{f:"A"},8790:{f:"A"},8791:{f:"A"},8796:{f:"A"},8802:{c:"\\2261\\338"},8806:{f:"A"},8807:{f:"A"},8808:{f:"A"},8809:{f:"A"},8812:{f:"A"},8813:{c:"\\224D\\338"},8814:{f:"A"},8815:{f:"A"},8816:{f:"A"},8817:{f:"A"},8818:{f:"A"},8819:{f:"A"},8820:{c:"\\2272\\338"},8821:{c:"\\2273\\338"},8822:{f:"A"},8823:{f:"A"},8824:{c:"\\2276\\338"},8825:{c:"\\2277\\338"},8828:{f:"A"},8829:{f:"A"},8830:{f:"A"},8831:{f:"A"},8832:{f:"A"},8833:{f:"A"},8836:{c:"\\2282\\338"},8837:{c:"\\2283\\338"},8840:{f:"A"},8841:{f:"A"},8842:{f:"A"},8843:{f:"A"},8847:{f:"A"},8848:{f:"A"},8858:{f:"A"},8859:{f:"A"},8861:{f:"A"},8862:{f:"A"},8863:{f:"A"},8864:{f:"A"},8865:{f:"A"},8873:{f:"A"},8874:{f:"A"},8876:{f:"A"},8877:{f:"A"},8878:{f:"A"},8879:{f:"A"},8882:{f:"A"},8883:{f:"A"},8884:{f:"A"},8885:{f:"A"},8888:{f:"A"},8890:{f:"A"},8891:{f:"A"},8892:{f:"A"},8896:{f:"S1"},8897:{f:"S1"},8898:{f:"S1"},8899:{f:"S1"},8903:{f:"A"},8905:{f:"A"},8906:{f:"A"},8907:{f:"A"},8908:{f:"A"},8909:{f:"A"},8910:{f:"A"},8911:{f:"A"},8912:{f:"A"},8913:{f:"A"},8914:{f:"A"},8915:{f:"A"},8916:{f:"A"},8918:{f:"A"},8919:{f:"A"},8920:{f:"A"},8921:{f:"A"},8922:{f:"A"},8923:{f:"A"},8926:{f:"A"},8927:{f:"A"},8928:{f:"A"},8929:{f:"A"},8930:{c:"\\2291\\338"},8931:{c:"\\2292\\338"},8934:{f:"A"},8935:{f:"A"},8936:{f:"A"},8937:{f:"A"},8938:{f:"A"},8939:{f:"A"},8940:{f:"A"},8941:{f:"A"},8965:{c:"\\22BC",f:"A"},8966:{c:"\\2A5E",f:"A"},8988:{c:"\\250C",f:"A"},8989:{c:"\\2510",f:"A"},8990:{c:"\\2514",f:"A"},8991:{c:"\\2518",f:"A"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},9168:{f:"S1"},9416:{f:"A"},9484:{f:"A"},9488:{f:"A"},9492:{f:"A"},9496:{f:"A"},9585:{f:"A"},9586:{f:"A"},9632:{f:"A"},9633:{f:"A"},9642:{c:"\\25A0",f:"A"},9650:{f:"A"},9652:{c:"\\25B2",f:"A"},9653:{c:"\\25B3"},9654:{f:"A"},9656:{c:"\\25B6",f:"A"},9660:{f:"A"},9662:{c:"\\25BC",f:"A"},9663:{c:"\\25BD"},9664:{f:"A"},9666:{c:"\\25C0",f:"A"},9674:{f:"A"},9723:{c:"\\25A1",f:"A"},9724:{c:"\\25A0",f:"A"},9733:{f:"A"},10003:{f:"A"},10016:{f:"A"},10072:{c:"\\2223"},10731:{f:"A"},10744:{c:"/",f:"I"},10752:{f:"S1"},10753:{f:"S1"},10754:{f:"S1"},10756:{f:"S1"},10758:{f:"S1"},10764:{c:"\\222C\\222C",f:"S1"},10799:{c:"\\D7"},10846:{f:"A"},10877:{f:"A"},10878:{f:"A"},10885:{f:"A"},10886:{f:"A"},10887:{f:"A"},10888:{f:"A"},10889:{f:"A"},10890:{f:"A"},10891:{f:"A"},10892:{f:"A"},10901:{f:"A"},10902:{f:"A"},10933:{f:"A"},10934:{f:"A"},10935:{f:"A"},10936:{f:"A"},10937:{f:"A"},10938:{f:"A"},10949:{f:"A"},10950:{f:"A"},10955:{f:"A"},10956:{f:"A"},12296:{c:"\\27E8"},12297:{c:"\\27E9"},57350:{f:"A"},57351:{f:"A"},57352:{f:"A"},57353:{f:"A"},57356:{f:"A"},57357:{f:"A"},57358:{f:"A"},57359:{f:"A"},57360:{f:"A"},57361:{f:"A"},57366:{f:"A"},57367:{f:"A"},57368:{f:"A"},57369:{f:"A"},57370:{f:"A"},57371:{f:"A"},119808:{c:"A",f:"B"},119809:{c:"B",f:"B"},119810:{c:"C",f:"B"},119811:{c:"D",f:"B"},119812:{c:"E",f:"B"},119813:{c:"F",f:"B"},119814:{c:"G",f:"B"},119815:{c:"H",f:"B"},119816:{c:"I",f:"B"},119817:{c:"J",f:"B"},119818:{c:"K",f:"B"},119819:{c:"L",f:"B"},119820:{c:"M",f:"B"},119821:{c:"N",f:"B"},119822:{c:"O",f:"B"},119823:{c:"P",f:"B"},119824:{c:"Q",f:"B"},119825:{c:"R",f:"B"},119826:{c:"S",f:"B"},119827:{c:"T",f:"B"},119828:{c:"U",f:"B"},119829:{c:"V",f:"B"},119830:{c:"W",f:"B"},119831:{c:"X",f:"B"},119832:{c:"Y",f:"B"},119833:{c:"Z",f:"B"},119834:{c:"a",f:"B"},119835:{c:"b",f:"B"},119836:{c:"c",f:"B"},119837:{c:"d",f:"B"},119838:{c:"e",f:"B"},119839:{c:"f",f:"B"},119840:{c:"g",f:"B"},119841:{c:"h",f:"B"},119842:{c:"i",f:"B"},119843:{c:"j",f:"B"},119844:{c:"k",f:"B"},119845:{c:"l",f:"B"},119846:{c:"m",f:"B"},119847:{c:"n",f:"B"},119848:{c:"o",f:"B"},119849:{c:"p",f:"B"},119850:{c:"q",f:"B"},119851:{c:"r",f:"B"},119852:{c:"s",f:"B"},119853:{c:"t",f:"B"},119854:{c:"u",f:"B"},119855:{c:"v",f:"B"},119856:{c:"w",f:"B"},119857:{c:"x",f:"B"},119858:{c:"y",f:"B"},119859:{c:"z",f:"B"},119860:{c:"A",f:"I"},119861:{c:"B",f:"I"},119862:{c:"C",f:"I"},119863:{c:"D",f:"I"},119864:{c:"E",f:"I"},119865:{c:"F",f:"I"},119866:{c:"G",f:"I"},119867:{c:"H",f:"I"},119868:{c:"I",f:"I"},119869:{c:"J",f:"I"},119870:{c:"K",f:"I"},119871:{c:"L",f:"I"},119872:{c:"M",f:"I"},119873:{c:"N",f:"I"},119874:{c:"O",f:"I"},119875:{c:"P",f:"I"},119876:{c:"Q",f:"I"},119877:{c:"R",f:"I"},119878:{c:"S",f:"I"},119879:{c:"T",f:"I"},119880:{c:"U",f:"I"},119881:{c:"V",f:"I"},119882:{c:"W",f:"I"},119883:{c:"X",f:"I"},119884:{c:"Y",f:"I"},119885:{c:"Z",f:"I"},119886:{c:"a",f:"I"},119887:{c:"b",f:"I"},119888:{c:"c",f:"I"},119889:{c:"d",f:"I"},119890:{c:"e",f:"I"},119891:{c:"f",f:"I"},119892:{c:"g",f:"I"},119894:{c:"i",f:"I"},119895:{c:"j",f:"I"},119896:{c:"k",f:"I"},119897:{c:"l",f:"I"},119898:{c:"m",f:"I"},119899:{c:"n",f:"I"},119900:{c:"o",f:"I"},119901:{c:"p",f:"I"},119902:{c:"q",f:"I"},119903:{c:"r",f:"I"},119904:{c:"s",f:"I"},119905:{c:"t",f:"I"},119906:{c:"u",f:"I"},119907:{c:"v",f:"I"},119908:{c:"w",f:"I"},119909:{c:"x",f:"I"},119910:{c:"y",f:"I"},119911:{c:"z",f:"I"},119912:{c:"A",f:"BI"},119913:{c:"B",f:"BI"},119914:{c:"C",f:"BI"},119915:{c:"D",f:"BI"},119916:{c:"E",f:"BI"},119917:{c:"F",f:"BI"},119918:{c:"G",f:"BI"},119919:{c:"H",f:"BI"},119920:{c:"I",f:"BI"},119921:{c:"J",f:"BI"},119922:{c:"K",f:"BI"},119923:{c:"L",f:"BI"},119924:{c:"M",f:"BI"},119925:{c:"N",f:"BI"},119926:{c:"O",f:"BI"},119927:{c:"P",f:"BI"},119928:{c:"Q",f:"BI"},119929:{c:"R",f:"BI"},119930:{c:"S",f:"BI"},119931:{c:"T",f:"BI"},119932:{c:"U",f:"BI"},119933:{c:"V",f:"BI"},119934:{c:"W",f:"BI"},119935:{c:"X",f:"BI"},119936:{c:"Y",f:"BI"},119937:{c:"Z",f:"BI"},119938:{c:"a",f:"BI"},119939:{c:"b",f:"BI"},119940:{c:"c",f:"BI"},119941:{c:"d",f:"BI"},119942:{c:"e",f:"BI"},119943:{c:"f",f:"BI"},119944:{c:"g",f:"BI"},119945:{c:"h",f:"BI"},119946:{c:"i",f:"BI"},119947:{c:"j",f:"BI"},119948:{c:"k",f:"BI"},119949:{c:"l",f:"BI"},119950:{c:"m",f:"BI"},119951:{c:"n",f:"BI"},119952:{c:"o",f:"BI"},119953:{c:"p",f:"BI"},119954:{c:"q",f:"BI"},119955:{c:"r",f:"BI"},119956:{c:"s",f:"BI"},119957:{c:"t",f:"BI"},119958:{c:"u",f:"BI"},119959:{c:"v",f:"BI"},119960:{c:"w",f:"BI"},119961:{c:"x",f:"BI"},119962:{c:"y",f:"BI"},119963:{c:"z",f:"BI"},119964:{c:"A",f:"SC"},119966:{c:"C",f:"SC"},119967:{c:"D",f:"SC"},119970:{c:"G",f:"SC"},119973:{c:"J",f:"SC"},119974:{c:"K",f:"SC"},119977:{c:"N",f:"SC"},119978:{c:"O",f:"SC"},119979:{c:"P",f:"SC"},119980:{c:"Q",f:"SC"},119982:{c:"S",f:"SC"},119983:{c:"T",f:"SC"},119984:{c:"U",f:"SC"},119985:{c:"V",f:"SC"},119986:{c:"W",f:"SC"},119987:{c:"X",f:"SC"},119988:{c:"Y",f:"SC"},119989:{c:"Z",f:"SC"},120068:{c:"A",f:"FR"},120069:{c:"B",f:"FR"},120071:{c:"D",f:"FR"},120072:{c:"E",f:"FR"},120073:{c:"F",f:"FR"},120074:{c:"G",f:"FR"},120077:{c:"J",f:"FR"},120078:{c:"K",f:"FR"},120079:{c:"L",f:"FR"},120080:{c:"M",f:"FR"},120081:{c:"N",f:"FR"},120082:{c:"O",f:"FR"},120083:{c:"P",f:"FR"},120084:{c:"Q",f:"FR"},120086:{c:"S",f:"FR"},120087:{c:"T",f:"FR"},120088:{c:"U",f:"FR"},120089:{c:"V",f:"FR"},120090:{c:"W",f:"FR"},120091:{c:"X",f:"FR"},120092:{c:"Y",f:"FR"},120094:{c:"a",f:"FR"},120095:{c:"b",f:"FR"},120096:{c:"c",f:"FR"},120097:{c:"d",f:"FR"},120098:{c:"e",f:"FR"},120099:{c:"f",f:"FR"},120100:{c:"g",f:"FR"},120101:{c:"h",f:"FR"},120102:{c:"i",f:"FR"},120103:{c:"j",f:"FR"},120104:{c:"k",f:"FR"},120105:{c:"l",f:"FR"},120106:{c:"m",f:"FR"},120107:{c:"n",f:"FR"},120108:{c:"o",f:"FR"},120109:{c:"p",f:"FR"},120110:{c:"q",f:"FR"},120111:{c:"r",f:"FR"},120112:{c:"s",f:"FR"},120113:{c:"t",f:"FR"},120114:{c:"u",f:"FR"},120115:{c:"v",f:"FR"},120116:{c:"w",f:"FR"},120117:{c:"x",f:"FR"},120118:{c:"y",f:"FR"},120119:{c:"z",f:"FR"},120120:{c:"A",f:"A"},120121:{c:"B",f:"A"},120123:{c:"D",f:"A"},120124:{c:"E",f:"A"},120125:{c:"F",f:"A"},120126:{c:"G",f:"A"},120128:{c:"I",f:"A"},120129:{c:"J",f:"A"},120130:{c:"K",f:"A"},120131:{c:"L",f:"A"},120132:{c:"M",f:"A"},120134:{c:"O",f:"A"},120138:{c:"S",f:"A"},120139:{c:"T",f:"A"},120140:{c:"U",f:"A"},120141:{c:"V",f:"A"},120142:{c:"W",f:"A"},120143:{c:"X",f:"A"},120144:{c:"Y",f:"A"},120172:{c:"A",f:"FRB"},120173:{c:"B",f:"FRB"},120174:{c:"C",f:"FRB"},120175:{c:"D",f:"FRB"},120176:{c:"E",f:"FRB"},120177:{c:"F",f:"FRB"},120178:{c:"G",f:"FRB"},120179:{c:"H",f:"FRB"},120180:{c:"I",f:"FRB"},120181:{c:"J",f:"FRB"},120182:{c:"K",f:"FRB"},120183:{c:"L",f:"FRB"},120184:{c:"M",f:"FRB"},120185:{c:"N",f:"FRB"},120186:{c:"O",f:"FRB"},120187:{c:"P",f:"FRB"},120188:{c:"Q",f:"FRB"},120189:{c:"R",f:"FRB"},120190:{c:"S",f:"FRB"},120191:{c:"T",f:"FRB"},120192:{c:"U",f:"FRB"},120193:{c:"V",f:"FRB"},120194:{c:"W",f:"FRB"},120195:{c:"X",f:"FRB"},120196:{c:"Y",f:"FRB"},120197:{c:"Z",f:"FRB"},120198:{c:"a",f:"FRB"},120199:{c:"b",f:"FRB"},120200:{c:"c",f:"FRB"},120201:{c:"d",f:"FRB"},120202:{c:"e",f:"FRB"},120203:{c:"f",f:"FRB"},120204:{c:"g",f:"FRB"},120205:{c:"h",f:"FRB"},120206:{c:"i",f:"FRB"},120207:{c:"j",f:"FRB"},120208:{c:"k",f:"FRB"},120209:{c:"l",f:"FRB"},120210:{c:"m",f:"FRB"},120211:{c:"n",f:"FRB"},120212:{c:"o",f:"FRB"},120213:{c:"p",f:"FRB"},120214:{c:"q",f:"FRB"},120215:{c:"r",f:"FRB"},120216:{c:"s",f:"FRB"},120217:{c:"t",f:"FRB"},120218:{c:"u",f:"FRB"},120219:{c:"v",f:"FRB"},120220:{c:"w",f:"FRB"},120221:{c:"x",f:"FRB"},120222:{c:"y",f:"FRB"},120223:{c:"z",f:"FRB"},120224:{c:"A",f:"SS"},120225:{c:"B",f:"SS"},120226:{c:"C",f:"SS"},120227:{c:"D",f:"SS"},120228:{c:"E",f:"SS"},120229:{c:"F",f:"SS"},120230:{c:"G",f:"SS"},120231:{c:"H",f:"SS"},120232:{c:"I",f:"SS"},120233:{c:"J",f:"SS"},120234:{c:"K",f:"SS"},120235:{c:"L",f:"SS"},120236:{c:"M",f:"SS"},120237:{c:"N",f:"SS"},120238:{c:"O",f:"SS"},120239:{c:"P",f:"SS"},120240:{c:"Q",f:"SS"},120241:{c:"R",f:"SS"},120242:{c:"S",f:"SS"},120243:{c:"T",f:"SS"},120244:{c:"U",f:"SS"},120245:{c:"V",f:"SS"},120246:{c:"W",f:"SS"},120247:{c:"X",f:"SS"},120248:{c:"Y",f:"SS"},120249:{c:"Z",f:"SS"},120250:{c:"a",f:"SS"},120251:{c:"b",f:"SS"},120252:{c:"c",f:"SS"},120253:{c:"d",f:"SS"},120254:{c:"e",f:"SS"},120255:{c:"f",f:"SS"},120256:{c:"g",f:"SS"},120257:{c:"h",f:"SS"},120258:{c:"i",f:"SS"},120259:{c:"j",f:"SS"},120260:{c:"k",f:"SS"},120261:{c:"l",f:"SS"},120262:{c:"m",f:"SS"},120263:{c:"n",f:"SS"},120264:{c:"o",f:"SS"},120265:{c:"p",f:"SS"},120266:{c:"q",f:"SS"},120267:{c:"r",f:"SS"},120268:{c:"s",f:"SS"},120269:{c:"t",f:"SS"},120270:{c:"u",f:"SS"},120271:{c:"v",f:"SS"},120272:{c:"w",f:"SS"},120273:{c:"x",f:"SS"},120274:{c:"y",f:"SS"},120275:{c:"z",f:"SS"},120276:{c:"A",f:"SSB"},120277:{c:"B",f:"SSB"},120278:{c:"C",f:"SSB"},120279:{c:"D",f:"SSB"},120280:{c:"E",f:"SSB"},120281:{c:"F",f:"SSB"},120282:{c:"G",f:"SSB"},120283:{c:"H",f:"SSB"},120284:{c:"I",f:"SSB"},120285:{c:"J",f:"SSB"},120286:{c:"K",f:"SSB"},120287:{c:"L",f:"SSB"},120288:{c:"M",f:"SSB"},120289:{c:"N",f:"SSB"},120290:{c:"O",f:"SSB"},120291:{c:"P",f:"SSB"},120292:{c:"Q",f:"SSB"},120293:{c:"R",f:"SSB"},120294:{c:"S",f:"SSB"},120295:{c:"T",f:"SSB"},120296:{c:"U",f:"SSB"},120297:{c:"V",f:"SSB"},120298:{c:"W",f:"SSB"},120299:{c:"X",f:"SSB"},120300:{c:"Y",f:"SSB"},120301:{c:"Z",f:"SSB"},120302:{c:"a",f:"SSB"},120303:{c:"b",f:"SSB"},120304:{c:"c",f:"SSB"},120305:{c:"d",f:"SSB"},120306:{c:"e",f:"SSB"},120307:{c:"f",f:"SSB"},120308:{c:"g",f:"SSB"},120309:{c:"h",f:"SSB"},120310:{c:"i",f:"SSB"},120311:{c:"j",f:"SSB"},120312:{c:"k",f:"SSB"},120313:{c:"l",f:"SSB"},120314:{c:"m",f:"SSB"},120315:{c:"n",f:"SSB"},120316:{c:"o",f:"SSB"},120317:{c:"p",f:"SSB"},120318:{c:"q",f:"SSB"},120319:{c:"r",f:"SSB"},120320:{c:"s",f:"SSB"},120321:{c:"t",f:"SSB"},120322:{c:"u",f:"SSB"},120323:{c:"v",f:"SSB"},120324:{c:"w",f:"SSB"},120325:{c:"x",f:"SSB"},120326:{c:"y",f:"SSB"},120327:{c:"z",f:"SSB"},120328:{c:"A",f:"SSI"},120329:{c:"B",f:"SSI"},120330:{c:"C",f:"SSI"},120331:{c:"D",f:"SSI"},120332:{c:"E",f:"SSI"},120333:{c:"F",f:"SSI"},120334:{c:"G",f:"SSI"},120335:{c:"H",f:"SSI"},120336:{c:"I",f:"SSI"},120337:{c:"J",f:"SSI"},120338:{c:"K",f:"SSI"},120339:{c:"L",f:"SSI"},120340:{c:"M",f:"SSI"},120341:{c:"N",f:"SSI"},120342:{c:"O",f:"SSI"},120343:{c:"P",f:"SSI"},120344:{c:"Q",f:"SSI"},120345:{c:"R",f:"SSI"},120346:{c:"S",f:"SSI"},120347:{c:"T",f:"SSI"},120348:{c:"U",f:"SSI"},120349:{c:"V",f:"SSI"},120350:{c:"W",f:"SSI"},120351:{c:"X",f:"SSI"},120352:{c:"Y",f:"SSI"},120353:{c:"Z",f:"SSI"},120354:{c:"a",f:"SSI"},120355:{c:"b",f:"SSI"},120356:{c:"c",f:"SSI"},120357:{c:"d",f:"SSI"},120358:{c:"e",f:"SSI"},120359:{c:"f",f:"SSI"},120360:{c:"g",f:"SSI"},120361:{c:"h",f:"SSI"},120362:{c:"i",f:"SSI"},120363:{c:"j",f:"SSI"},120364:{c:"k",f:"SSI"},120365:{c:"l",f:"SSI"},120366:{c:"m",f:"SSI"},120367:{c:"n",f:"SSI"},120368:{c:"o",f:"SSI"},120369:{c:"p",f:"SSI"},120370:{c:"q",f:"SSI"},120371:{c:"r",f:"SSI"},120372:{c:"s",f:"SSI"},120373:{c:"t",f:"SSI"},120374:{c:"u",f:"SSI"},120375:{c:"v",f:"SSI"},120376:{c:"w",f:"SSI"},120377:{c:"x",f:"SSI"},120378:{c:"y",f:"SSI"},120379:{c:"z",f:"SSI"},120432:{c:"A",f:"T"},120433:{c:"B",f:"T"},120434:{c:"C",f:"T"},120435:{c:"D",f:"T"},120436:{c:"E",f:"T"},120437:{c:"F",f:"T"},120438:{c:"G",f:"T"},120439:{c:"H",f:"T"},120440:{c:"I",f:"T"},120441:{c:"J",f:"T"},120442:{c:"K",f:"T"},120443:{c:"L",f:"T"},120444:{c:"M",f:"T"},120445:{c:"N",f:"T"},120446:{c:"O",f:"T"},120447:{c:"P",f:"T"},120448:{c:"Q",f:"T"},120449:{c:"R",f:"T"},120450:{c:"S",f:"T"},120451:{c:"T",f:"T"},120452:{c:"U",f:"T"},120453:{c:"V",f:"T"},120454:{c:"W",f:"T"},120455:{c:"X",f:"T"},120456:{c:"Y",f:"T"},120457:{c:"Z",f:"T"},120458:{c:"a",f:"T"},120459:{c:"b",f:"T"},120460:{c:"c",f:"T"},120461:{c:"d",f:"T"},120462:{c:"e",f:"T"},120463:{c:"f",f:"T"},120464:{c:"g",f:"T"},120465:{c:"h",f:"T"},120466:{c:"i",f:"T"},120467:{c:"j",f:"T"},120468:{c:"k",f:"T"},120469:{c:"l",f:"T"},120470:{c:"m",f:"T"},120471:{c:"n",f:"T"},120472:{c:"o",f:"T"},120473:{c:"p",f:"T"},120474:{c:"q",f:"T"},120475:{c:"r",f:"T"},120476:{c:"s",f:"T"},120477:{c:"t",f:"T"},120478:{c:"u",f:"T"},120479:{c:"v",f:"T"},120480:{c:"w",f:"T"},120481:{c:"x",f:"T"},120482:{c:"y",f:"T"},120483:{c:"z",f:"T"},120488:{c:"A",f:"B"},120489:{c:"B",f:"B"},120490:{c:"\\393",f:"B"},120491:{c:"\\394",f:"B"},120492:{c:"E",f:"B"},120493:{c:"Z",f:"B"},120494:{c:"H",f:"B"},120495:{c:"\\398",f:"B"},120496:{c:"I",f:"B"},120497:{c:"K",f:"B"},120498:{c:"\\39B",f:"B"},120499:{c:"M",f:"B"},120500:{c:"N",f:"B"},120501:{c:"\\39E",f:"B"},120502:{c:"O",f:"B"},120503:{c:"\\3A0",f:"B"},120504:{c:"P",f:"B"},120506:{c:"\\3A3",f:"B"},120507:{c:"T",f:"B"},120508:{c:"\\3A5",f:"B"},120509:{c:"\\3A6",f:"B"},120510:{c:"X",f:"B"},120511:{c:"\\3A8",f:"B"},120512:{c:"\\3A9",f:"B"},120513:{c:"\\2207",f:"B"},120546:{c:"A",f:"I"},120547:{c:"B",f:"I"},120548:{c:"\\393",f:"I"},120549:{c:"\\394",f:"I"},120550:{c:"E",f:"I"},120551:{c:"Z",f:"I"},120552:{c:"H",f:"I"},120553:{c:"\\398",f:"I"},120554:{c:"I",f:"I"},120555:{c:"K",f:"I"},120556:{c:"\\39B",f:"I"},120557:{c:"M",f:"I"},120558:{c:"N",f:"I"},120559:{c:"\\39E",f:"I"},120560:{c:"O",f:"I"},120561:{c:"\\3A0",f:"I"},120562:{c:"P",f:"I"},120564:{c:"\\3A3",f:"I"},120565:{c:"T",f:"I"},120566:{c:"\\3A5",f:"I"},120567:{c:"\\3A6",f:"I"},120568:{c:"X",f:"I"},120569:{c:"\\3A8",f:"I"},120570:{c:"\\3A9",f:"I"},120572:{c:"\\3B1",f:"I"},120573:{c:"\\3B2",f:"I"},120574:{c:"\\3B3",f:"I"},120575:{c:"\\3B4",f:"I"},120576:{c:"\\3B5",f:"I"},120577:{c:"\\3B6",f:"I"},120578:{c:"\\3B7",f:"I"},120579:{c:"\\3B8",f:"I"},120580:{c:"\\3B9",f:"I"},120581:{c:"\\3BA",f:"I"},120582:{c:"\\3BB",f:"I"},120583:{c:"\\3BC",f:"I"},120584:{c:"\\3BD",f:"I"},120585:{c:"\\3BE",f:"I"},120586:{c:"\\3BF",f:"I"},120587:{c:"\\3C0",f:"I"},120588:{c:"\\3C1",f:"I"},120589:{c:"\\3C2",f:"I"},120590:{c:"\\3C3",f:"I"},120591:{c:"\\3C4",f:"I"},120592:{c:"\\3C5",f:"I"},120593:{c:"\\3C6",f:"I"},120594:{c:"\\3C7",f:"I"},120595:{c:"\\3C8",f:"I"},120596:{c:"\\3C9",f:"I"},120597:{c:"\\2202"},120598:{c:"\\3F5",f:"I"},120599:{c:"\\3D1",f:"I"},120600:{c:"\\E009",f:"A"},120601:{c:"\\3D5",f:"I"},120602:{c:"\\3F1",f:"I"},120603:{c:"\\3D6",f:"I"},120604:{c:"A",f:"BI"},120605:{c:"B",f:"BI"},120606:{c:"\\393",f:"BI"},120607:{c:"\\394",f:"BI"},120608:{c:"E",f:"BI"},120609:{c:"Z",f:"BI"},120610:{c:"H",f:"BI"},120611:{c:"\\398",f:"BI"},120612:{c:"I",f:"BI"},120613:{c:"K",f:"BI"},120614:{c:"\\39B",f:"BI"},120615:{c:"M",f:"BI"},120616:{c:"N",f:"BI"},120617:{c:"\\39E",f:"BI"},120618:{c:"O",f:"BI"},120619:{c:"\\3A0",f:"BI"},120620:{c:"P",f:"BI"},120622:{c:"\\3A3",f:"BI"},120623:{c:"T",f:"BI"},120624:{c:"\\3A5",f:"BI"},120625:{c:"\\3A6",f:"BI"},120626:{c:"X",f:"BI"},120627:{c:"\\3A8",f:"BI"},120628:{c:"\\3A9",f:"BI"},120630:{c:"\\3B1",f:"BI"},120631:{c:"\\3B2",f:"BI"},120632:{c:"\\3B3",f:"BI"},120633:{c:"\\3B4",f:"BI"},120634:{c:"\\3B5",f:"BI"},120635:{c:"\\3B6",f:"BI"},120636:{c:"\\3B7",f:"BI"},120637:{c:"\\3B8",f:"BI"},120638:{c:"\\3B9",f:"BI"},120639:{c:"\\3BA",f:"BI"},120640:{c:"\\3BB",f:"BI"},120641:{c:"\\3BC",f:"BI"},120642:{c:"\\3BD",f:"BI"},120643:{c:"\\3BE",f:"BI"},120644:{c:"\\3BF",f:"BI"},120645:{c:"\\3C0",f:"BI"},120646:{c:"\\3C1",f:"BI"},120647:{c:"\\3C2",f:"BI"},120648:{c:"\\3C3",f:"BI"},120649:{c:"\\3C4",f:"BI"},120650:{c:"\\3C5",f:"BI"},120651:{c:"\\3C6",f:"BI"},120652:{c:"\\3C7",f:"BI"},120653:{c:"\\3C8",f:"BI"},120654:{c:"\\3C9",f:"BI"},120655:{c:"\\2202",f:"B"},120656:{c:"\\3F5",f:"BI"},120657:{c:"\\3D1",f:"BI"},120658:{c:"\\E009",f:"A"},120659:{c:"\\3D5",f:"BI"},120660:{c:"\\3F1",f:"BI"},120661:{c:"\\3D6",f:"BI"},120662:{c:"A",f:"SSB"},120663:{c:"B",f:"SSB"},120664:{c:"\\393",f:"SSB"},120665:{c:"\\394",f:"SSB"},120666:{c:"E",f:"SSB"},120667:{c:"Z",f:"SSB"},120668:{c:"H",f:"SSB"},120669:{c:"\\398",f:"SSB"},120670:{c:"I",f:"SSB"},120671:{c:"K",f:"SSB"},120672:{c:"\\39B",f:"SSB"},120673:{c:"M",f:"SSB"},120674:{c:"N",f:"SSB"},120675:{c:"\\39E",f:"SSB"},120676:{c:"O",f:"SSB"},120677:{c:"\\3A0",f:"SSB"},120678:{c:"P",f:"SSB"},120680:{c:"\\3A3",f:"SSB"},120681:{c:"T",f:"SSB"},120682:{c:"\\3A5",f:"SSB"},120683:{c:"\\3A6",f:"SSB"},120684:{c:"X",f:"SSB"},120685:{c:"\\3A8",f:"SSB"},120686:{c:"\\3A9",f:"SSB"},120782:{c:"0",f:"B"},120783:{c:"1",f:"B"},120784:{c:"2",f:"B"},120785:{c:"3",f:"B"},120786:{c:"4",f:"B"},120787:{c:"5",f:"B"},120788:{c:"6",f:"B"},120789:{c:"7",f:"B"},120790:{c:"8",f:"B"},120791:{c:"9",f:"B"},120802:{c:"0",f:"SS"},120803:{c:"1",f:"SS"},120804:{c:"2",f:"SS"},120805:{c:"3",f:"SS"},120806:{c:"4",f:"SS"},120807:{c:"5",f:"SS"},120808:{c:"6",f:"SS"},120809:{c:"7",f:"SS"},120810:{c:"8",f:"SS"},120811:{c:"9",f:"SS"},120812:{c:"0",f:"SSB"},120813:{c:"1",f:"SSB"},120814:{c:"2",f:"SSB"},120815:{c:"3",f:"SSB"},120816:{c:"4",f:"SSB"},120817:{c:"5",f:"SSB"},120818:{c:"6",f:"SSB"},120819:{c:"7",f:"SSB"},120820:{c:"8",f:"SSB"},120821:{c:"9",f:"SSB"},120822:{c:"0",f:"T"},120823:{c:"1",f:"T"},120824:{c:"2",f:"T"},120825:{c:"3",f:"T"},120826:{c:"4",f:"T"},120827:{c:"5",f:"T"},120828:{c:"6",f:"T"},120829:{c:"7",f:"T"},120830:{c:"8",f:"T"},120831:{c:"9",f:"T"}})},7517:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifBoldItalic=void 0;var n=r(8042),r=r(4886);e.sansSerifBoldItalic=(0,n.AddCSS)(r.sansSerifBoldItalic,{305:{f:"SSB"},567:{f:"SSB"}})},4182:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifBold=void 0;var n=r(8042),r=r(4471);e.sansSerifBold=(0,n.AddCSS)(r.sansSerifBold,{8213:{c:"\\2014"},8215:{c:"_"},8260:{c:"/"},8710:{c:"\\394"}})},2679:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifItalic=void 0;var n=r(8042),r=r(5181);e.sansSerifItalic=(0,n.AddCSS)(r.sansSerifItalic,{913:{c:"A"},914:{c:"B"},917:{c:"E"},918:{c:"Z"},919:{c:"H"},921:{c:"I"},922:{c:"K"},924:{c:"M"},925:{c:"N"},927:{c:"O"},929:{c:"P"},932:{c:"T"},935:{c:"X"},8213:{c:"\\2014"},8215:{c:"_"},8260:{c:"/"},8710:{c:"\\394"}})},5469:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerif=void 0;var n=r(8042),r=r(3526);e.sansSerif=(0,n.AddCSS)(r.sansSerif,{913:{c:"A"},914:{c:"B"},917:{c:"E"},918:{c:"Z"},919:{c:"H"},921:{c:"I"},922:{c:"K"},924:{c:"M"},925:{c:"N"},927:{c:"O"},929:{c:"P"},932:{c:"T"},935:{c:"X"},8213:{c:"\\2014"},8215:{c:"_"},8260:{c:"/"},8710:{c:"\\394"}})},7563:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.scriptBold=void 0;var n=r(5649);Object.defineProperty(e,"scriptBold",{enumerable:!0,get:function(){return n.scriptBold}})},9409:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.script=void 0;var n=r(7153);Object.defineProperty(e,"script",{enumerable:!0,get:function(){return n.script}})},775:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.smallop=void 0;var n=r(8042),r=r(5745);e.smallop=(0,n.AddCSS)(r.smallop,{8260:{c:"/"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},10072:{c:"\\2223"},10764:{c:"\\222C\\222C"},12296:{c:"\\27E8"},12297:{c:"\\27E9"}})},9551:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texCalligraphicBold=void 0;var n=r(8042),r=r(1411);e.texCalligraphicBold=(0,n.AddCSS)(r.texCalligraphicBold,{305:{f:"B"},567:{f:"B"}})},7907:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texCalligraphic=void 0;var n=r(6384);Object.defineProperty(e,"texCalligraphic",{enumerable:!0,get:function(){return n.texCalligraphic}})},9659:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texMathit=void 0;var n=r(6041);Object.defineProperty(e,"texMathit",{enumerable:!0,get:function(){return n.texMathit}})},98:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texOldstyleBold=void 0;var n=r(8199);Object.defineProperty(e,"texOldstyleBold",{enumerable:!0,get:function(){return n.texOldstyleBold}})},6275:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texOldstyle=void 0;var n=r(9848);Object.defineProperty(e,"texOldstyle",{enumerable:!0,get:function(){return n.texOldstyle}})},6530:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texSize3=void 0;var n=r(8042),r=r(7906);e.texSize3=(0,n.AddCSS)(r.texSize3,{8260:{c:"/"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},12296:{c:"\\27E8"},12297:{c:"\\27E9"}})},4409:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texSize4=void 0;var n=r(8042),r=r(2644);e.texSize4=(0,n.AddCSS)(r.texSize4,{8260:{c:"/"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},12296:{c:"\\27E8"},12297:{c:"\\27E9"},57685:{c:"\\E153\\E152"},57686:{c:"\\E151\\E150"}})},5292:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texVariant=void 0;var n=r(8042),r=r(4926);e.texVariant=(0,n.AddCSS)(r.texVariant,{1008:{c:"\\E009"},8463:{f:""},8740:{c:"\\E006"},8742:{c:"\\E007"},8808:{c:"\\E00C"},8809:{c:"\\E00D"},8816:{c:"\\E011"},8817:{c:"\\E00E"},8840:{c:"\\E016"},8841:{c:"\\E018"},8842:{c:"\\E01A"},8843:{c:"\\E01B"},10887:{c:"\\E010"},10888:{c:"\\E00F"},10955:{c:"\\E017"},10956:{c:"\\E019"}})},5884:function(t,e,r){var h=this&&this.__assign||function(){return(h=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},f=(Object.defineProperty(e,"__esModule",{value:!0}),e.FontData=e.NOSTRETCH=e.H=e.V=void 0,r(7233)),r=(e.V=1,e.H=2,e.NOSTRETCH={dir:0},n.charOptions=function(t,e){t=t[e];return 3===t.length&&(t[3]={}),t[3]},Object.defineProperty(n.prototype,"styles",{get:function(){return this._styles},set:function(t){this._styles=t},enumerable:!1,configurable:!0}),n.prototype.createVariant=function(t,e,r){void 0===r&&(r=null);e={linked:[],chars:(e=void 0===e?null:e)?Object.create(this.variant[e].chars):{}};r&&this.variant[r]&&(Object.assign(e.chars,this.variant[r].chars),this.variant[r].linked.push(e.chars),e.chars=Object.create(e.chars)),this.remapSmpChars(e.chars,t),this.variant[t]=e},n.prototype.remapSmpChars=function(t,e){var r,n,o,i,a=this.constructor;if(a.VariantSmp[e]){var s=a.SmpRemap,l=[null,null,a.SmpRemapGreekU,a.SmpRemapGreekL];try{for(var c=S(a.SmpRanges),u=c.next();!u.done;u=c.next()){var p=_(u.value,3),h=p[0],d=p[1],f=p[2],m=a.VariantSmp[e][h];if(m){for(var y,g=d;g<=f;g++)930!==g&&(y=m+g-d,t[g]=this.smpChar(s[y]||y));if(l[h])try{o=void 0;for(var b=S(Object.keys(l[h]).map(function(t){return parseInt(t)})),v=b.next();!v.done;v=b.next())t[g=v.value]=this.smpChar(m+l[h][g])}catch(t){o={error:t}}finally{try{v&&!v.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}}}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}"bold"===e&&(t[988]=this.smpChar(120778),t[989]=this.smpChar(120779))},n.prototype.smpChar=function(t){return[,,,{smp:t}]},n.prototype.createVariants=function(t){var e,r;try{for(var n=S(t),o=n.next();!o.done;o=n.next()){var i=o.value;this.createVariant(i[0],i[1],i[2])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},n.prototype.defineChars=function(t,e){var r,n,o=this.variant[t];Object.assign(o.chars,e);try{for(var i=S(o.linked),a=i.next();!a.done;a=i.next()){var s=a.value;Object.assign(s,e)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},n.prototype.defineDelimiters=function(t){Object.assign(this.delimiters,t)},n.prototype.defineRemap=function(t,e){this.remapChars.hasOwnProperty(t)||(this.remapChars[t]={}),Object.assign(this.remapChars[t],e)},n.prototype.getDelimiter=function(t){return this.delimiters[t]},n.prototype.getSizeVariant=function(t,e){return this.delimiters[t].variants&&(e=this.delimiters[t].variants[e]),this.sizeVariants[e]},n.prototype.getStretchVariant=function(t,e){return this.stretchVariants[this.delimiters[t].stretchv?this.delimiters[t].stretchv[e]:0]},n.prototype.getChar=function(t,e){return this.variant[t].chars[e]},n.prototype.getVariant=function(t){return this.variant[t]},n.prototype.getCssFont=function(t){return this.cssFontMap[t]||["serif",!1,!1]},n.prototype.getFamily=function(t){return this.cssFamilyPrefix?this.cssFamilyPrefix+", "+t:t},n.prototype.getRemappedChar=function(t,e){return(this.remapChars[t]||{})[e]},n.OPTIONS={unknownFamily:"serif"},n.JAX="common",n.NAME="",n.defaultVariants=[["normal"],["bold","normal"],["italic","normal"],["bold-italic","italic","bold"],["double-struck","bold"],["fraktur","normal"],["bold-fraktur","bold","fraktur"],["script","italic"],["bold-script","bold-italic","script"],["sans-serif","normal"],["bold-sans-serif","bold","sans-serif"],["sans-serif-italic","italic","sans-serif"],["sans-serif-bold-italic","bold-italic","bold-sans-serif"],["monospace","normal"]],n.defaultCssFonts={normal:["unknown",!1,!1],bold:["unknown",!1,!0],italic:["unknown",!0,!1],"bold-italic":["unknown",!0,!0],"double-struck":["unknown",!1,!0],fraktur:["unknown",!1,!1],"bold-fraktur":["unknown",!1,!0],script:["cursive",!1,!1],"bold-script":["cursive",!1,!0],"sans-serif":["sans-serif",!1,!1],"bold-sans-serif":["sans-serif",!1,!0],"sans-serif-italic":["sans-serif",!0,!1],"sans-serif-bold-italic":["sans-serif",!0,!0],monospace:["monospace",!1,!1]},n.defaultCssFamilyPrefix="",n.VariantSmp={bold:[119808,119834,120488,120514,120782],italic:[119860,119886,120546,120572],"bold-italic":[119912,119938,120604,120630],script:[119964,119990],"bold-script":[120016,120042],fraktur:[120068,120094],"double-struck":[120120,120146,,,120792],"bold-fraktur":[120172,120198],"sans-serif":[120224,120250,,,120802],"bold-sans-serif":[120276,120302,120662,120688,120812],"sans-serif-italic":[120328,120354],"sans-serif-bold-italic":[120380,120406,120720,120746],monospace:[120432,120458,,,120822]},n.SmpRanges=[[0,65,90],[1,97,122],[2,913,937],[3,945,969],[4,48,57]],n.SmpRemap={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},n.SmpRemapGreekU={8711:25,1012:17},n.SmpRemapGreekL={977:27,981:29,982:31,1008:28,1009:30,1013:26,8706:25},n.defaultAccentMap={768:"ˋ",769:"ˊ",770:"ˆ",771:"˜",772:"ˉ",774:"˘",775:"˙",776:"¨",778:"˚",780:"ˇ",8594:"⃗",8242:"'",8243:"''",8244:"'''",8245:"`",8246:"``",8247:"```",8279:"''''",8400:"↼",8401:"⇀",8406:"←",8417:"↔",8432:"*",8411:"...",8412:"....",8428:"⇁",8429:"↽",8430:"←",8431:"→"},n.defaultMoMap={45:"−"},n.defaultMnMap={45:"−"},n.defaultParams={x_height:.442,quad:1,num1:.676,num2:.394,num3:.444,denom1:.686,denom2:.345,sup1:.413,sup2:.363,sup3:.289,sub1:.15,sub2:.247,sup_drop:.386,sub_drop:.05,delim1:2.39,delim2:1,axis_height:.25,rule_thickness:.06,big_op_spacing1:.111,big_op_spacing2:.167,big_op_spacing3:.2,big_op_spacing4:.6,big_op_spacing5:.1,surd_height:.075,scriptspace:.05,nulldelimiterspace:.12,delimiterfactor:901,delimitershortfall:.3,min_rule_thickness:1.25,separation_factor:1.75,extra_ic:.033},n.defaultDelimiters={},n.defaultChars={},n.defaultSizeVariants=[],n.defaultStretchVariants=[],n);function n(t){void 0===t&&(t=null),this.variant={},this.delimiters={},this.cssFontMap={},this.remapChars={},this.skewIcFactor=.75;var e,r,n,o,i=this.constructor;this.options=(0,f.userOptions)((0,f.defaultOptions)({},i.OPTIONS),t),this.params=h({},i.defaultParams),this.sizeVariants=d([],_(i.defaultSizeVariants),!1),this.stretchVariants=d([],_(i.defaultStretchVariants),!1),this.cssFontMap=h({},i.defaultCssFonts);try{for(var a=S(Object.keys(this.cssFontMap)),s=a.next();!s.done;s=a.next()){var l=s.value;"unknown"===this.cssFontMap[l][0]&&(this.cssFontMap[l][0]=this.options.unknownFamily)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}this.cssFamilyPrefix=i.defaultCssFamilyPrefix,this.createVariants(i.defaultVariants),this.defineDelimiters(i.defaultDelimiters);try{for(var c=S(Object.keys(i.defaultChars)),u=c.next();!u.done;u=c.next()){var p=u.value;this.defineChars(p,i.defaultChars[p])}}catch(t){n={error:t}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}this.defineRemap("accent",i.defaultAccentMap),this.defineRemap("mo",i.defaultMoMap),this.defineRemap("mn",i.defaultMnMap)}e.FontData=r},5552:function(t,c){var u=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0Math.PI/2-r?t.thickness*a*Math.sin(o+r-Math.PI/2):0);return[i,e,i,e]},remove:e[3]}]}},c.CommonArrow=function(l){return function(t){var e=u(c.arrowDef[t],4),i=e[0],a=e[1],s=e[2],e=e[3];return[t+"arrow",{renderer:function(t,e){var r=t.getBBox(),n=r.w,o=r.h,r=r.d,o=u(s?[o+r,"X"]:[n,"Y"],2),r=o[0],n=o[1],o=t.getOffset(n),r=t.arrow(r,i,a,n,o);l(t,r)},bbox:c.arrowBBox[t],remove:e}]}}},3055:function(t,e,r){var n,i,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},l=(Object.defineProperty(e,"__esModule",{value:!0}),e.CommonOutputJax=void 0,r(2975)),w=r(4474),c=r(7233),u=r(6010),p=r(8054),h=r(4139),r=(i=l.AbstractOutputJax,o(d,i),d.prototype.typeset=function(t,e){this.setDocument(e);var r=this.createNode();return this.toDOM(t,r,e),r},d.prototype.createNode=function(){var t=this.constructor.NAME;return this.html("mjx-container",{class:"MathJax",jax:t})},d.prototype.setScale=function(t){var e=this.math.metrics.scale*this.options.scale;1!=e&&this.adaptor.setStyle(t,"fontSize",(0,u.percent)(e))},d.prototype.toDOM=function(t,e,r){this.setDocument(r=void 0===r?null:r),this.math=t,this.pxPerEm=t.metrics.ex/this.font.params.x_height,t.root.setTeXclass(null),this.setScale(e),this.nodeMap=new Map,this.container=e,this.processMath(t.root,e),this.nodeMap=null,this.executeFilters(this.postFilters,t,r,e)},d.prototype.getBBox=function(t,e){this.setDocument(e),(this.math=t).root.setTeXclass(null),this.nodeMap=new Map;e=this.factory.wrap(t.root).getOuterBBox();return this.nodeMap=null,e},d.prototype.getMetrics=function(t){this.setDocument(t);var e,r,n=this.adaptor,o=this.getMetricMaps(t);try{for(var i=N(t.math),a=i.next();!a.done;a=i.next()){var s,l,c,u,p,h,d,f=a.value,m=n.parent(f.start.node);f.state()=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},h=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},y=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0t.h&&(t.h=s),l>t.d&&(t.d=l),t.ic=f.ic||0,t.sk=f.sk||0,t.dx=f.dx||0}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}1=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=(Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMencloseMixin=void 0,s(r(5552))),h=r(505);e.CommonMencloseMixin=function(t){return o(e,n=t),e.prototype.getParameters=function(){var t,e=this.node.attributes,r=e.get("data-padding"),r=(void 0!==r&&(this.padding=this.length2em(r,u.PADDING)),e.get("data-thickness")),r=(void 0!==r&&(this.thickness=this.length2em(r,u.THICKNESS)),e.get("data-arrowhead"));void 0!==r&&(r=(e=l((0,h.split)(r),3))[0],t=e[1],e=e[2],this.arrowhead={x:r?parseFloat(r):u.ARROWX,y:t?parseFloat(t):u.ARROWY,dx:e?parseFloat(e):u.ARROWDX})},e.prototype.getNotations=function(){var t,e,r=this.constructor.notations;try{for(var n=p((0,h.split)(this.node.attributes.get("notation"))),o=n.next();!o.done;o=n.next()){var i=o.value,a=r.get(i);a&&((this.notations[i]=a).renderChild&&(this.renderChild=a.renderer))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.removeRedundantNotations=function(){var t,e,r,n;try{for(var o=p(Object.keys(this.notations)),i=o.next();!i.done;i=o.next()){var a=i.value;if(this.notations[a]){var s=this.notations[a].remove||"";try{r=void 0;for(var l=p(s.split(/ /)),c=l.next();!c.done;c=l.next()){var u=c.value;delete this.notations[u]}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}},e.prototype.initializeNotations=function(){var t,e;try{for(var r=p(Object.keys(this.notations)),n=r.next();!n.done;n=r.next()){var o=n.value,i=this.notations[o].init;i&&i(this)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=l(this.TRBL,4),n=r[0],o=r[1],i=r[2],r=r[3],a=this.childNodes[0].getBBox();t.combine(a,r,0),t.h+=n,t.d+=i,t.w+=o,this.setChildPWidths(e)},e.prototype.getBBoxExtenders=function(){var t,e,r=[0,0,0,0];try{for(var n=p(Object.keys(this.notations)),o=n.next();!o.done;o=n.next()){var i=o.value;this.maximizeEntries(r,this.notations[i].bbox(this))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r},e.prototype.getPadding=function(){var t,e,r=this,n=[0,0,0,0];try{for(var o=p(Object.keys(this.notations)),i=o.next();!i.done;i=o.next()){var a=i.value,s=this.notations[a].border;s&&this.maximizeEntries(n,s(this))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return[0,1,2,3].map(function(t){return r.TRBL[t]-n[t]})},e.prototype.maximizeEntries=function(t,e){for(var r=0;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMfencedMixin=void 0,e.CommonMfencedMixin=function(t){return r(e,n=t),e.prototype.createMrow=function(){var t=this.node.factory.create("inferredMrow");t.inheritAttributesFrom(this.node),this.mrow=this.wrap(t),this.mrow.parent=this},e.prototype.addMrowChildren=function(){var t,e,r=this.node,n=this.mrow,o=(this.addMo(r.open),this.childNodes.length&&n.childNodes.push(this.childNodes[0]),0);try{for(var i=l(this.childNodes.slice(1)),a=i.next();!a.done;a=i.next()){var s=a.value;this.addMo(r.separators[o++]),n.childNodes.push(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.addMo(r.close),n.stretchChildren()},e.prototype.addMo=function(t){t&&(t=this.wrap(t),this.mrow.childNodes.push(t),t.parent=this.mrow)},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1),t.updateFrom(this.mrow.getOuterBBox()),this.setChildPWidths(e)},e;function e(){for(var t=[],e=0;e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=(Object.defineProperty(s,"__esModule",{value:!0}),s.CommonMmultiscriptsMixin=s.ScriptNames=s.NextScript=void 0,e(6469));s.NextScript={base:"subList",subList:"supList",supList:"subList",psubList:"psupList",psupList:"psubList"},s.ScriptNames=["sup","sup","psup","psub"],s.CommonMmultiscriptsMixin=function(t){return r(e,i=t),e.prototype.combinePrePost=function(t,e){t=new a.BBox(t);return t.combine(e,0,0),t},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r,n=this.font.params.scriptspace,o=this.scriptData,i=this.combinePrePost(o.sub,o.psub),a=this.combinePrePost(o.sup,o.psup),i=p(this.getUVQ(i,a),2),a=i[0],i=i[1];t.empty(),o.numPrescripts&&(t.combine(o.psup,n,a),t.combine(o.psub,n,i)),t.append(o.base),o.numScripts&&(r=t.w,t.combine(o.sup,r,a),t.combine(o.sub,r,i),t.w+=n),t.clean(),this.setChildPWidths(e)},e.prototype.getScriptData=function(){var t=this.scriptData={base:null,sub:a.BBox.empty(),sup:a.BBox.empty(),psub:a.BBox.empty(),psup:a.BBox.empty(),numPrescripts:0,numScripts:0},e=this.getScriptBBoxLists();this.combineBBoxLists(t.sub,t.sup,e.subList,e.supList),this.combineBBoxLists(t.psub,t.psup,e.psubList,e.psupList),t.base=e.base[0],t.numPrescripts=e.psubList.length,t.numScripts=e.subList.length},e.prototype.getScriptBBoxLists=function(){var e,t,r={base:[],subList:[],supList:[],psubList:[],psupList:[]},n="base";try{for(var o=l(this.childNodes),i=o.next();!i.done;i=o.next())var a=i.value,n=a.node.isKind("mprescripts")?"psubList":(r[n].push(a.getOuterBBox()),s.NextScript[n])}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return this.firstPrescript=r.subList.length+r.supList.length+2,this.padLists(r.subList,r.supList),this.padLists(r.psubList,r.psupList),r},e.prototype.padLists=function(t,e){t.length>e.length&&e.push(a.BBox.empty())},e.prototype.combineBBoxLists=function(t,e,r,n){for(var o=0;ot.h&&(t.h=s),i>t.d&&(t.d=i),u>e.h&&(e.h=u),l>e.d&&(e.d=l)}},e.prototype.getScaledWHD=function(t){var e=t.w,r=t.h,n=t.d,t=t.rscale;return[e*t,r*t,n*t]},e.prototype.getUVQ=function(t,e){var r,n,o;return this.UVQ||(r=(o=p([0,0,0],3))[0],n=o[1],o=o[2],0===t.h&&0===t.d?r=this.getU():0===e.h&&0===e.d?r=-this.getV():(r=(t=p(i.prototype.getUVQ.call(this,t,e),3))[0],n=t[1],o=t[2]),this.UVQ=[r,n,o]),this.UVQ},e;function e(){for(var t=[],e=0;e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMoMixin=e.DirectionVH=void 0,r(6469)),l=r(505),c=r(5884);e.DirectionVH=((r={})[1]="v",r[2]="h",r),e.CommonMoMixin=function(t){return o(e,n=t),e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1),this.protoBBox(t),this.node.attributes.get("symmetric")&&2!==this.stretch.dir&&(e=this.getCenterOffset(t),t.h+=e,t.d-=e),this.node.getProperty("mathaccent")&&(0===this.stretch.dir||0<=this.size)&&(t.w=0)},e.prototype.protoBBox=function(t){var e=0!==this.stretch.dir;e&&null===this.size&&this.getStretchedVariant([0]),e&&this.size<0||(n.prototype.computeBBox.call(this,t),this.copySkewIC(t))},e.prototype.getAccentOffset=function(){var t=a.BBox.empty();return this.protoBBox(t),-t.w/2},e.prototype.getCenterOffset=function(t){return(t=void 0===t?null:t)||(t=a.BBox.empty(),n.prototype.computeBBox.call(this,t)),(t.h+t.d)/2+this.font.params.axis_height-t.h},e.prototype.getVariant=function(){this.node.attributes.get("largeop")?this.variant=this.node.attributes.get("displaystyle")?"-largeop":"-smallop":this.node.attributes.getExplicit("mathvariant")||!1!==this.node.getProperty("pseudoscript")?n.prototype.getVariant.call(this):this.variant="-tex-variant"},e.prototype.canStretch=function(t){if(0!==this.stretch.dir)return this.stretch.dir===t;if(!this.node.attributes.get("stretchy"))return!1;var e=this.getText();if(1!==Array.from(e).length)return!1;e=this.font.getDelimiter(e.codePointAt(0));return this.stretch=e&&e.dir===t?e:c.NOSTRETCH,0!==this.stretch.dir},e.prototype.getStretchedVariant=function(t,e){var r,n;if(void 0===e&&(e=!1),0!==this.stretch.dir){var o=this.getWH(t),i=this.getSize("minsize",0),a=this.getSize("maxsize",1/0),s=this.node.getProperty("mathaccent"),o=Math.max(i,Math.min(a,o)),a=this.font.params.delimiterfactor/1e3,l=this.font.params.delimitershortfall,c=i||e?o:s?Math.min(o/a,o+l):Math.max(o*a,o-l),u=this.stretch,p=u.c||this.getText().codePointAt(0),h=0;if(u.sizes)try{for(var d=y(u.sizes),f=d.next();!f.done;f=d.next()){if(f.value>=c)return s&&h&&h--,this.variant=this.font.getSizeVariant(p,h),this.size=h,void(u.schar&&u.schar[h]&&(this.stretch=m(m({},this.stretch),{c:u.schar[h]})));h++}}catch(t){r={error:t}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}u.stretch?(this.size=-1,this.invalidateBBox(),this.getStretchBBox(t,this.checkExtendedHeight(o,u),u)):(this.variant=this.font.getSizeVariant(p,h-1),this.size=h-1)}},e.prototype.getSize=function(t,e){var r=this.node.attributes;return e=r.isSet(t)?this.length2em(r.get(t),1,1):e},e.prototype.getWH=function(t){if(0===t.length)return 0;if(1===t.length)return t[0];var t=s(t,2),e=t[0],t=t[1],r=this.font.params.axis_height;return this.node.attributes.get("symmetric")?2*Math.max(e-r,t+r):e+t},e.prototype.getStretchBBox=function(t,e,r){r.hasOwnProperty("min")&&r.min>e&&(e=r.min);var n=s(r.HDW,3),o=n[0],i=n[1],n=n[2];1===this.stretch.dir?(o=(t=s(this.getBaseline(t,e,r),2))[0],i=t[1]):n=e,this.bbox.h=o,this.bbox.d=i,this.bbox.w=n},e.prototype.getBaseline=function(t,e,r){var n=2===t.length&&t[0]+t[1]===e,o=this.node.attributes.get("symmetric"),t=s(n?t:[e,0],2),e=t[0],t=t[1],i=s([e+t,0],2),a=i[0],i=i[1];return i=o?(o=this.font.params.axis_height,(a=n?2*Math.max(e-o,t+o):a)/2-o):n?t:(o=(e=s(r.HDW||[.75,.25],2))[0],(n=e[1])*(a/(o+n))),[a-i,i]},e.prototype.checkExtendedHeight=function(t,e){var r;return e.fullExt&&(r=(e=s(e.fullExt,2))[0],t=(e=e[1])+Math.ceil(Math.max(0,t-e)/r)*r),t},e.prototype.remapChars=function(t){var e=this.node.getProperty("primes");return e?(0,l.unicodeChars)(e):(1===t.length&&(e=this.node.coreParent().parent,e=this.isAccent&&!e.isKind("mrow")?"accent":"mo",(e=this.font.getRemappedChar(e,t[0]))&&(t=this.unicodeChars(e,this.variant))),t)},e;function e(){for(var t=[],e=0;e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=(Object.defineProperty(e,"__esModule",{value:!0}),e.CommonInferredMrowMixin=e.CommonMrowMixin=void 0,r(6469));e.CommonMrowMixin=function(t){return o(e,s=t),Object.defineProperty(e.prototype,"fixesPWidth",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.stretchChildren=function(){var t,e,r,n,o,i,a=[];try{for(var s=x(this.childNodes),l=s.next();!l.done;l=s.next())(S=l.value).canStretch(1)&&a.push(S)}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}var c=a.length,u=this.childNodes.length;if(c&&1p&&(p=g),(b*=v)>h&&(h=b))}}catch(t){r={error:t}}finally{try{m&&!m.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}try{for(var S,O=x(a),M=O.next();!M.done;M=O.next())(S=M.value).coreMO().getStretchedVariant([p,h])}catch(t){o={error:t}}finally{try{M&&!M.done&&(i=O.return)&&i.call(O)}finally{if(o)throw o.error}}}},e;function e(){for(var e,t,r=[],n=0;nthis.surdH?(t.h+t.d-(this.surdH-2*e-r/2))/2:e+r/4]},e.prototype.getRootDimens=function(t,e){return[0,0,0,0]},e;function e(){for(var t=[],e=0;e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=(Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMtableMixin=void 0,r(6469)),l=r(505),u=r(7875);e.CommonMtableMixin=function(t){return i(e,o=t),Object.defineProperty(e.prototype,"tableRows",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),e.prototype.findContainer=function(){for(var t=this,e=t.parent;e&&(e.node.notParent||e.node.isKind("mrow"));)e=(t=e).parent;this.container=e,this.containerI=t.node.childPosition()},e.prototype.getPercentageWidth=function(){var t;this.hasLabels?this.bbox.pwidth=s.BBox.fullWidth:(t=this.node.attributes.get("width"),(0,l.isPercent)(t)&&(this.bbox.pwidth=t))},e.prototype.stretchRows=function(){for(var t=this.node.attributes.get("equalrows"),e=t?this.getEqualRowHeight():0,r=t?this.getTableData():{H:[0],D:[0]},n=r.H,o=r.D,i=this.tableRows,a=0;ao[r]&&(o[r]=c),u>i[r]&&(i[r]=u),sa[e]&&(a[e]=l),s},e.prototype.extendHD=function(t,e,r,n){n=(n-(e[t]+r[t]))/2;n<1e-5||(e[t]+=n,r[t]+=n)},e.prototype.recordPWidthCell=function(t,e){t.childNodes[0]&&t.childNodes[0].getBBox().pwidth&&this.pwidthCells.push([t,e])},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var e=this.getTableData(),r=e.H,e=e.D,r=(n=this.node.attributes.get("equalrows")?(n=this.getEqualRowHeight(),(0,u.sum)([].concat(this.rLines,this.rSpace))+n*this.numRows):(0,u.sum)(r.concat(e,this.rLines,this.rSpace)),n+=2*(this.fLine+this.fSpace[1]),this.getComputedWidths()),e=(0,u.sum)(r.concat(this.cLines,this.cSpace))+2*(this.fLine+this.fSpace[0]),r=this.node.attributes.get("width"),n=("auto"!==r&&(e=Math.max(this.length2em(r,0)+2*this.fLine,e)),p(this.getBBoxHD(n),2)),o=n[0],n=n[1],o=(t.h=o,t.d=n,t.w=e,p(this.getBBoxLR(),2)),n=o[0],e=o[1];t.L=n,t.R=e,(0,l.isPercent)(r)||this.setColumnPWidths()},e.prototype.setChildPWidths=function(t,e,r){var n=this.node.attributes.get("width");if(!(0,l.isPercent)(n))return!1;this.hasLabels||(this.bbox.pwidth="",this.container.bbox.pwidth="");var o=this.bbox,i=o.w,a=o.L,o=o.R,s=this.node.attributes.get("data-width-includes-label"),n=Math.max(i,this.length2em(n,Math.max(e,a+i+o)))-(s?a+o:0),e=this.node.attributes.get("equalcolumns")?Array(this.numCols).fill(this.percent(1/Math.max(1,this.numCols))):this.getColumnAttributes("columnwidth",0),s=(this.cWidths=this.getColumnWidthsFixed(e,n),this.getComputedWidths());return this.pWidth=(0,u.sum)(s.concat(this.cLines,this.cSpace))+2*(this.fLine+this.fSpace[0]),this.isTop&&(this.bbox.w=this.pWidth),this.setColumnPWidths(),this.pWidth!==i&&this.parent.invalidateBBox(),this.pWidth!==i},e.prototype.setColumnPWidths=function(){var t,e,r=this.cWidths;try{for(var n=_(this.pwidthCells),o=n.next();!o.done;o=n.next()){var i=p(o.value,2),a=i[0],s=i[1];a.setChildPWidths(!1,r[s])&&(a.invalidateBBox(),a.getBBox())}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.getBBoxHD=function(t){var e,r=p(this.getAlignmentRow(),2),n=r[0],r=r[1];if(null===r)return{top:[0,t],center:[e=t/2,e],bottom:[t,0],baseline:[e,e],axis:[e+(o=this.font.params.axis_height),e-o]}[n]||[e,e];var o=this.getVerticalPosition(r,n);return[o,t-o]},e.prototype.getBBoxLR=function(){var t,e,r,n;return this.hasLabels?(t=(n=this.node.attributes).get("side"),e=(r=p(this.getPadAlignShift(t),2))[0],r=r[1],(n=this.hasLabels&&!!n.get("data-width-includes-label"))&&this.frame&&this.fSpace[0]&&(e-=this.fSpace[0]),"center"!==r||n?"left"===t?[e,0]:[0,e]:[e,e]):[0,0]},e.prototype.getPadAlignShift=function(t){var e=this.getTableData().L+this.length2em(this.node.attributes.get("minlabelspacing")),r=p(null==this.styles?["",""]:[this.styles.get("padding-left"),this.styles.get("padding-right")],2),n=r[0],r=r[1],n=((n||r)&&(e=Math.max(e,this.length2em(n||"0"),this.length2em(r||"0"))),p(this.getAlignShift(),2)),r=n[0],n=n[1];return[e,r,n=r===t?"left"===t?Math.max(e,n)-e:Math.min(-e,n)+e:n]},e.prototype.getAlignShift=function(){return this.isTop?o.prototype.getAlignShift.call(this):[this.container.getChildAlign(this.containerI),0]},e.prototype.getWidth=function(){return this.pWidth||this.getBBox().w},e.prototype.getEqualRowHeight=function(){var t=this.getTableData(),e=t.H,r=t.D,t=Array.from(e.keys()).map(function(t){return e[t]+r[t]});return Math.max.apply(Math,t)},e.prototype.getComputedWidths=function(){var e=this,r=this.getTableData().W,t=Array.from(r.keys()).map(function(t){return("number"==typeof e.cWidths[t]?e.cWidths:r)[t]});return t=this.node.attributes.get("equalcolumns")?Array(t.length).fill((0,u.max)(t)):t},e.prototype.getColumnWidths=function(){var t=this.node.attributes.get("width");if(this.node.attributes.get("equalcolumns"))return this.getEqualColumns(t);var e=this.getColumnAttributes("columnwidth",0);return"auto"===t?this.getColumnWidthsAuto(e):(0,l.isPercent)(t)?this.getColumnWidthsPercent(e):this.getColumnWidthsFixed(e,this.length2em(t))},e.prototype.getEqualColumns=function(t){var e,r=Math.max(1,this.numCols);return t="auto"===t?(e=this.getTableData().W,(0,u.max)(e)):(0,l.isPercent)(t)?this.percent(1/r):(e=(0,u.sum)([].concat(this.cLines,this.cSpace))+2*this.fSpace[0],Math.max(0,this.length2em(t)-e)/r),Array(this.numCols).fill(t)},e.prototype.getColumnWidthsAuto=function(t){var e=this;return t.map(function(t){return"auto"===t||"fit"===t?null:(0,l.isPercent)(t)?t:e.length2em(t)})},e.prototype.getColumnWidthsPercent=function(r){var n=this,o=0<=r.indexOf("fit"),i=(o?this.getTableData():{W:null}).W;return Array.from(r.keys()).map(function(t){var e=r[t];return"fit"===e?null:"auto"===e?o?i[t]:null:(0,l.isPercent)(e)?e:n.length2em(e)})},e.prototype.getColumnWidthsFixed=function(r,t){var n=this,e=Array.from(r.keys()),o=e.filter(function(t){return"fit"===r[t]}),i=e.filter(function(t){return"auto"===r[t]}),i=o.length||i.length,a=(i?this.getTableData():{W:null}).W,s=t-(0,u.sum)([].concat(this.cLines,this.cSpace))-2*this.fSpace[0],l=s,c=(e.forEach(function(t){var e=r[t];l-="fit"===e||"auto"===e?a[t]:n.length2em(e,s)}),i&&0this.numRows?null:t-1]},e.prototype.getColumnAttributes=function(t,e){var r=this.numCols-(e=void 0===e?1:e),n=this.getAttributeArray(t);if(0===n.length)return null;for(;n.lengthr&&n.splice(r),n},e.prototype.getRowAttributes=function(t,e){var r=this.numRows-(e=void 0===e?1:e),n=this.getAttributeArray(t);if(0===n.length)return null;for(;n.lengthr&&n.splice(r),n},e.prototype.getAttributeArray=function(t){var e=this.node.attributes.get(t);return e?(0,l.split)(e):[this.node.attributes.getDefault(t)]},e.prototype.addEm=function(t,e){var r=this;return void 0===e&&(e=1),t?t.map(function(t){return r.em(t/e)}):null},e.prototype.convertLengths=function(t){var e=this;return t?t.map(function(t){return e.length2em(t)}):null},e;function e(){for(var t=[],e=0;e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMlabeledtrMixin=e.CommonMtrMixin=void 0,e.CommonMtrMixin=function(t){return o(e,r=t),Object.defineProperty(e.prototype,"fixesPWidth",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numCells",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"labeled",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tableCells",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),e.prototype.getChild=function(t){return this.childNodes[t]},e.prototype.getChildBBoxes=function(){return this.childNodes.map(function(t){return t.getBBox()})},e.prototype.stretchChildren=function(t){void 0===t&&(t=null);var e,r,n,o,i=[],a=this.labeled?this.childNodes.slice(1):this.childNodes;try{for(var s=M(a),l=s.next();!l.done;l=s.next())(_=l.value.childNodes[0]).canStretch(1)&&i.push(_)}catch(t){u={error:t}}finally{try{l&&!l.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}}var c=i.length,u=this.childNodes.length;if(c&&1=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CommonScriptbaseMixin=void 0,r(9007));e.CommonScriptbaseMixin=function(t){var o;return i(e,o=t),Object.defineProperty(e.prototype,"baseChild",{get:function(){return this.childNodes[this.node.base]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scriptChild",{get:function(){return this.childNodes[1]},enumerable:!1,configurable:!0}),e.prototype.getBaseCore=function(){for(var t=this.getSemanticBase()||this.childNodes[0];t&&(1===t.childNodes.length&&(t.node.isKind("mrow")||t.node.isKind("TeXAtom")&&t.node.texClass!==a.TEXCLASS.VCENTER||t.node.isKind("mstyle")||t.node.isKind("mpadded")||t.node.isKind("mphantom")||t.node.isKind("semantics"))||t.node.isKind("munderover")&&t.isMathAccent);)this.setBaseAccentsFor(t),t=t.childNodes[0];return t||(this.baseHasAccentOver=this.baseHasAccentUnder=!1),t||this.childNodes[0]},e.prototype.setBaseAccentsFor=function(t){t.node.isKind("munderover")&&(null===this.baseHasAccentOver&&(this.baseHasAccentOver=!!t.node.attributes.get("accent")),null===this.baseHasAccentUnder&&(this.baseHasAccentUnder=!!t.node.attributes.get("accentunder")))},e.prototype.getSemanticBase=function(){var t=this.node.attributes.getExplicit("data-semantic-fencepointer");return this.getBaseFence(this.baseChild,t)},e.prototype.getBaseFence=function(t,e){var r,n;if(!t||!t.node.attributes||!e)return null;if(t.node.attributes.getExplicit("data-semantic-id")===e)return t;try{for(var o=O(t.childNodes),i=o.next();!i.done;i=o.next()){var a=i.value,s=this.getBaseFence(a,e);if(s)return s}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null},e.prototype.getBaseScale=function(){for(var t=this.baseCore,e=1;t&&t!==this;)e*=t.getOuterBBox().rscale,t=t.parent;return e},e.prototype.getBaseIc=function(){return this.baseCore.getOuterBBox().ic*this.baseScale},e.prototype.getAdjustedIc=function(){var t=this.baseCore.getOuterBBox();return(t.ic?1.05*t.ic+.05:0)*this.baseScale},e.prototype.isCharBase=function(){var t=this.baseCore;return(t.node.isKind("mo")&&null===t.size||t.node.isKind("mi")||t.node.isKind("mn"))&&1===t.bbox.rscale&&1===Array.from(t.getText()).length},e.prototype.checkLineAccents=function(){this.node.isKind("munderover")&&(this.node.isKind("mover")?this.isLineAbove=this.isLineAccent(this.scriptChild):this.node.isKind("munder")?this.isLineBelow=this.isLineAccent(this.scriptChild):(this.isLineAbove=this.isLineAccent(this.overChild),this.isLineBelow=this.isLineAccent(this.underChild)))},e.prototype.isLineAccent=function(t){t=t.coreMO().node;return t.isToken&&"―"===t.getText()},e.prototype.getBaseWidth=function(){var t=this.baseChild.getOuterBBox();return t.w*t.rscale-(this.baseRemoveIc?this.baseIc:0)+this.font.params.extra_ic},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=this.getBaseWidth(),n=y(this.getOffset(),2),o=n[0],n=n[1];t.append(this.baseChild.getOuterBBox()),t.combine(this.scriptChild.getOuterBBox(),r+o,n),t.w+=this.font.params.scriptspace,t.clean(),this.setChildPWidths(e)},e.prototype.getOffset=function(){return[0,0]},e.prototype.baseCharZero=function(t){var e=!!this.baseCore.node.attributes.get("largeop"),r=this.baseScale;return this.baseIsChar&&!e&&1===r?0:t},e.prototype.getV=function(){var t=this.baseCore.getOuterBBox(),e=this.scriptChild.getOuterBBox(),r=this.font.params,n=this.length2em(this.node.attributes.get("subscriptshift"),r.sub1);return Math.max(this.baseCharZero(t.d*this.baseScale+r.sub_drop*e.rscale),n,e.h*e.rscale-.8*r.x_height)},e.prototype.getU=function(){var t=this.baseCore.getOuterBBox(),e=this.scriptChild.getOuterBBox(),r=this.font.params,n=this.node.attributes.getList("displaystyle","superscriptshift"),o=this.node.getProperty("texprimestyle")?r.sup3:n.displaystyle?r.sup1:r.sup2,n=this.length2em(n.superscriptshift,o);return Math.max(this.baseCharZero(t.h*this.baseScale-r.sup_drop*e.rscale),n,e.d*e.rscale+.25*r.x_height)},e.prototype.hasMovableLimits=function(){var t=this.node.attributes.get("displaystyle"),e=this.baseChild.coreMO().node;return!t&&!!e.attributes.get("movablelimits")},e.prototype.getOverKU=function(t,e){var r=this.node.attributes.get("accent"),n=this.font.params,e=e.d*e.rscale,o=n.rule_thickness*n.separation_factor,i=this.baseHasAccentOver?o:0,o=this.isLineAbove?3*n.rule_thickness:o,r=(r?o:Math.max(n.big_op_spacing1,n.big_op_spacing3-Math.max(0,e)))-i;return[r,t.h*t.rscale+r+e]},e.prototype.getUnderKV=function(t,e){var r=this.node.attributes.get("accentunder"),n=this.font.params,e=e.h*e.rscale,o=n.rule_thickness*n.separation_factor,i=this.baseHasAccentUnder?o:0,o=this.isLineBelow?3*n.rule_thickness:o,r=(r?o:Math.max(n.big_op_spacing2,n.big_op_spacing4-e))-i;return[r,-(t.d*t.rscale+r+e)]},e.prototype.getDeltaW=function(e,t){void 0===t&&(t=[0,0,0]);var r,n,o,i,a=this.node.attributes.get("align"),s=e.map(function(t){return t.w*t.rscale}),l=(s[0]-=this.baseRemoveIc&&!this.baseCore.node.attributes.get("largeop")?this.baseIc:0,Math.max.apply(Math,g([],y(s),!1))),c=[],u=0;try{for(var p=O(s.keys()),h=p.next();!h.done;h=p.next()){var d=h.value;c[d]=("center"===a?(l-s[d])/2:"right"===a?l-s[d]:0)+t[d],c[d]=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=(Object.defineProperty(e,"__esModule",{value:!0}),e.Menu=void 0,r(5713)),c=r(4474),a=r(9515),s=r(7233),l=r(5865),p=r(473),h=r(4414),d=r(4922),f=r(6914),m=r(3463),y=r(7309),g=o(r(5445)),b=a.MathJax,v="undefined"!=typeof window&&window.navigator&&"Mac"===window.navigator.platform.substr(0,3);function _(t,e){void 0===e&&(e={});var r=this;this.settings=null,this.defaultSettings=null,this.menu=null,this.MmlVisitor=new p.MmlVisitor,this.jax={CHTML:null,SVG:null},this.rerenderStart=c.STATE.LAST,this.about=new d.Info('MathJax v'+i.mathjax.version,function(){var t=[];return t.push("Input Jax: "+r.document.inputJax.map(function(t){return t.name}).join(", ")),t.push("Output Jax: "+r.document.outputJax.name),t.push("Document Type: "+r.document.kind),t.join("
")},'www.mathjax.org'),this.help=new d.Info("MathJax Help",function(){return["

MathJax is a JavaScript library that allows page"," authors to include mathematics within their web pages."," As a reader, you don't need to do anything to make that happen.

","

Browsers: MathJax works with all modern browsers including"," Edge, Firefox, Chrome, Safari, Opera, and most mobile browsers.

","

Math Menu: MathJax adds a contextual menu to equations."," Right-click or CTRL-click on any mathematics to access the menu.

",'
',"

Show Math As: These options allow you to view the formula's"," source markup (as MathML or in its original format).

","

Copy to Clipboard: These options copy the formula's source markup,"," as MathML or in its original format, to the clipboard"," (in browsers that support that).

","

Math Settings: These give you control over features of MathJax,"," such the size of the mathematics, and the mechanism used"," to display equations.

","

Accessibility: MathJax can work with screen"," readers to make mathematics accessible to the visually impaired."," Turn on the explorer to enable generation of speech strings"," and the ability to investigate expressions interactively.

","

Language: This menu lets you select the language used by MathJax"," for its menus and warning messages. (Not yet implemented in version 3.)

","
","

Math Zoom: If you are having difficulty reading an"," equation, MathJax can enlarge it to help you see it better, or"," you can scall all the math on the page to make it larger."," Turn these features on in the Math Settings menu.

","

Preferences: MathJax uses your browser's localStorage database"," to save the preferences set via this menu locally in your browser. These"," are not used to track you, and are not transferred or used remotely by"," MathJax in any way.

"].join("\n")},'www.mathjax.org'),this.mathmlCode=new h.SelectableInfo("MathJax MathML Expression",function(){if(!r.menu.mathItem)return"";var t=r.toMML(r.menu.mathItem);return"
"+r.formatSource(t)+"
"},""),this.originalText=new h.SelectableInfo("MathJax Original Source",function(){if(!r.menu.mathItem)return"";var t=r.menu.mathItem.math;return'
'+r.formatSource(t)+"
"},""),this.annotationText=new h.SelectableInfo("MathJax Annotation Text",function(){if(!r.menu.mathItem)return"";var t=r.menu.annotation;return'
'+r.formatSource(t)+"
"},""),this.zoomBox=new d.Info("MathJax Zoomed Expression",function(){if(!r.menu.mathItem)return"";var t=r.menu.mathItem.typesetRoot.cloneNode(!0);return t.style.margin="0",'
'+t.outerHTML+"
"},""),this.document=t,this.options=(0,s.userOptions)((0,s.defaultOptions)({},this.constructor.OPTIONS),e),this.initSettings(),this.mergeUserSettings(),this.initMenu(),this.applySettings()}Object.defineProperty(_.prototype,"isLoading",{get:function(){return 0<_.loading},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"loadingPromise",{get:function(){return this.isLoading?_._loadingPromise=_._loadingPromise?_._loadingPromise:new Promise(function(t,e){_._loadingOK=t,_._loadingFailed=e}):Promise.resolve()},enumerable:!1,configurable:!0}),_.prototype.initSettings=function(){this.settings=this.options.settings,this.jax=this.options.jax;var t=this.document.outputJax;this.jax[t.name]=t,this.settings.renderer=t.name,b._.a11y&&b._.a11y.explorer&&Object.assign(this.settings,this.document.options.a11y),this.settings.scale=t.options.scale,this.defaultSettings=Object.assign({},this.settings)},_.prototype.initMenu=function(){var r=this,t=new f.Parser([["contextMenu",l.MJContextMenu.fromJson.bind(l.MJContextMenu)]]),t=(this.menu=t.parse({type:"contextMenu",id:"MathJax_Menu",pool:[this.variable("texHints"),this.variable("semantics"),this.variable("zoom"),this.variable("zscale"),this.variable("renderer",function(t){return r.setRenderer(t)}),this.variable("alt"),this.variable("cmd"),this.variable("ctrl"),this.variable("shift"),this.variable("scale",function(t){return r.setScale(t)}),this.variable("explorer",function(t){return r.setExplorer(t)}),this.a11yVar("highlight"),this.a11yVar("backgroundColor"),this.a11yVar("backgroundOpacity"),this.a11yVar("foregroundColor"),this.a11yVar("foregroundOpacity"),this.a11yVar("speech"),this.a11yVar("subtitles"),this.a11yVar("braille"),this.a11yVar("viewBraille"),this.a11yVar("locale",function(t){return g.default.setupEngine({locale:t})}),this.a11yVar("speechRules",function(t){var t=n(t.split("-"),2),e=t[0],t=t[1];r.document.options.sre.domain=e,r.document.options.sre.style=t}),this.a11yVar("magnification"),this.a11yVar("magnify"),this.a11yVar("treeColoring"),this.a11yVar("infoType"),this.a11yVar("infoRole"),this.a11yVar("infoPrefix"),this.variable("autocollapse"),this.variable("collapsible",function(t){return r.setCollapsible(t)}),this.variable("inTabOrder",function(t){return r.setTabOrder(t)}),this.variable("assistiveMml",function(t){return r.setAssistiveMml(t)})],items:[this.submenu("Show","Show Math As",[this.command("MathMLcode","MathML Code",function(){return r.mathmlCode.post()}),this.command("Original","Original Form",function(){return r.originalText.post()}),this.submenu("Annotation","Annotation")]),this.submenu("Copy","Copy to Clipboard",[this.command("MathMLcode","MathML Code",function(){return r.copyMathML()}),this.command("Original","Original Form",function(){return r.copyOriginal()}),this.submenu("Annotation","Annotation")]),this.rule(),this.submenu("Settings","Math Settings",[this.submenu("Renderer","Math Renderer",this.radioGroup("renderer",[["CHTML"],["SVG"]])),this.rule(),this.submenu("ZoomTrigger","Zoom Trigger",[this.command("ZoomNow","Zoom Once Now",function(){return r.zoom(null,"",r.menu.mathItem)}),this.rule(),this.radioGroup("zoom",[["Click"],["DoubleClick","Double-Click"],["NoZoom","No Zoom"]]),this.rule(),this.label("TriggerRequires","Trigger Requires:"),this.checkbox(v?"Option":"Alt",v?"Option":"Alt","alt"),this.checkbox("Command","Command","cmd",{hidden:!v}),this.checkbox("Control","Control","ctrl",{hiddne:v}),this.checkbox("Shift","Shift","shift")]),this.submenu("ZoomFactor","Zoom Factor",this.radioGroup("zscale",[["150%"],["175%"],["200%"],["250%"],["300%"],["400%"]])),this.rule(),this.command("Scale","Scale All Math...",function(){return r.scaleAllMath()}),this.rule(),this.checkbox("texHints","Add TeX hints to MathML","texHints"),this.checkbox("semantics","Add original as annotation","semantics"),this.rule(),this.command("Reset","Reset to defaults",function(){return r.resetDefaults()})]),this.submenu("Accessibility","Accessibility",[this.checkbox("Activate","Activate","explorer"),this.submenu("Speech","Speech",[this.checkbox("Speech","Speech Output","speech"),this.checkbox("Subtitles","Speech Subtitles","subtitles"),this.checkbox("Braille","Braille Output","braille"),this.checkbox("View Braille","Braille Subtitles","viewBraille"),this.rule(),this.submenu("A11yLanguage","Language"),this.rule(),this.submenu("Mathspeak","Mathspeak Rules",this.radioGroup("speechRules",[["mathspeak-default","Verbose"],["mathspeak-brief","Brief"],["mathspeak-sbrief","Superbrief"]])),this.submenu("Clearspeak","Clearspeak Rules",this.radioGroup("speechRules",[["clearspeak-default","Auto"]])),this.submenu("ChromeVox","ChromeVox Rules",this.radioGroup("speechRules",[["chromevox-default","Standard"],["chromevox-alternative","Alternative"]]))]),this.submenu("Highlight","Highlight",[this.submenu("Background","Background",this.radioGroup("backgroundColor",[["Blue"],["Red"],["Green"],["Yellow"],["Cyan"],["Magenta"],["White"],["Black"]])),{type:"slider",variable:"backgroundOpacity",content:" "},this.submenu("Foreground","Foreground",this.radioGroup("foregroundColor",[["Black"],["White"],["Magenta"],["Cyan"],["Yellow"],["Green"],["Red"],["Blue"]])),{type:"slider",variable:"foregroundOpacity",content:" "},this.rule(),this.radioGroup("highlight",[["None"],["Hover"],["Flame"]]),this.rule(),this.checkbox("TreeColoring","Tree Coloring","treeColoring")]),this.submenu("Magnification","Magnification",[this.radioGroup("magnification",[["None"],["Keyboard"],["Mouse"]]),this.rule(),this.radioGroup("magnify",[["200%"],["300%"],["400%"],["500%"]])]),this.submenu("Semantic Info","Semantic Info",[this.checkbox("Type","Type","infoType"),this.checkbox("Role","Role","infoRole"),this.checkbox("Prefix","Prefix","infoPrefix")],!0),this.rule(),this.checkbox("Collapsible","Collapsible Math","collapsible"),this.checkbox("AutoCollapse","Auto Collapse","autocollapse",{disabled:!0}),this.rule(),this.checkbox("InTabOrder","Include in Tab Order","inTabOrder"),this.checkbox("AssistiveMml","Include Hidden MathML","assistiveMml")]),this.submenu("Language","Language"),this.rule(),this.command("About","About MathJax",function(){return r.about.post()}),this.command("Help","MathJax Help",function(){return r.help.post()})]}),this.menu);this.about.attachMenu(t),this.help.attachMenu(t),this.originalText.attachMenu(t),this.annotationText.attachMenu(t),this.mathmlCode.attachMenu(t),this.zoomBox.attachMenu(t),this.checkLoadableItems(),this.enableExplorerItems(this.settings.explorer),t.showAnnotation=this.annotationText,t.copyAnnotation=this.copyAnnotation.bind(this),t.annotationTypes=this.options.annotationTypes,y.CssStyles.addInfoStyles(this.document.document),y.CssStyles.addMenuStyles(this.document.document)},_.prototype.checkLoadableItems=function(){var t,e;if(b&&b._&&b.loader&&b.startup)!this.settings.collapsible||b._.a11y&&b._.a11y.complexity||this.loadA11y("complexity"),!this.settings.explorer||b._.a11y&&b._.a11y.explorer||this.loadA11y("explorer"),!this.settings.assistiveMml||b._.a11y&&b._.a11y["assistive-mml"]||this.loadA11y("assistive-mml");else{var r=this.menu;try{for(var n=u(Object.keys(this.jax)),o=n.next();!o.done;o=n.next()){var i=o.value;this.jax[i]||r.findID("Settings","Renderer",i).disable()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}r.findID("Accessibility","Activate").disable(),r.findID("Accessibility","AutoCollapse").disable(),r.findID("Accessibility","Collapsible").disable()}},_.prototype.enableExplorerItems=function(t){var e,r,n=this.menu.findID("Accessibility","Activate").menu;try{for(var o=u(n.items.slice(1)),i=o.next();!i.done;i=o.next()){var a=i.value;if(a instanceof m.Rule)break;t?a.enable():a.disable()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},_.prototype.mergeUserSettings=function(){try{var t=localStorage.getItem(_.MENU_STORAGE);if(!t)return;Object.assign(this.settings,JSON.parse(t)),this.setA11y(this.settings)}catch(t){console.log("MathJax localStorage error: "+t.message)}},_.prototype.saveUserSettings=function(){var e,t,r={};try{for(var n=u(Object.keys(this.settings)),o=n.next();!o.done;o=n.next()){var i=o.value;this.settings[i]!==this.defaultSettings[i]&&(r[i]=this.settings[i])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}try{Object.keys(r).length?localStorage.setItem(_.MENU_STORAGE,JSON.stringify(r)):localStorage.removeItem(_.MENU_STORAGE)}catch(t){console.log("MathJax localStorage error: "+t.message)}},_.prototype.setA11y=function(t){b._.a11y&&b._.a11y.explorer&&b._.a11y.explorer_ts.setA11yOptions(this.document,t)},_.prototype.getA11y=function(t){if(b._.a11y&&b._.a11y.explorer)return(void 0!==this.document.options.a11y[t]?this.document.options.a11y:this.document.options.sre)[t]},_.prototype.applySettings=function(){this.setTabOrder(this.settings.inTabOrder),this.document.options.enableAssistiveMml=this.settings.assistiveMml,this.document.outputJax.options.scale=parseFloat(this.settings.scale),this.settings.renderer!==this.defaultSettings.renderer&&this.setRenderer(this.settings.renderer)},_.prototype.setScale=function(t){this.document.outputJax.options.scale=parseFloat(t),this.document.rerender()},_.prototype.setRenderer=function(e){var r,n=this;this.jax[e]?this.setOutputJax(e):(r=e.toLowerCase(),this.loadComponent("output/"+r,function(){var t=b.startup;r in t.constructors&&(t.useOutput(r,!0),t.output=t.getOutputJax(),n.jax[e]=t.output,n.setOutputJax(e))}))},_.prototype.setOutputJax=function(t){this.jax[t].setAdaptor(this.document.adaptor),this.document.outputJax=this.jax[t],this.rerender()},_.prototype.setTabOrder=function(t){this.menu.store.inTaborder(t)},_.prototype.setAssistiveMml=function(t){!(this.document.options.enableAssistiveMml=t)||b._.a11y&&b._.a11y["assistive-mml"]?this.rerender():this.loadA11y("assistive-mml")},_.prototype.setExplorer=function(t){this.enableExplorerItems(t),!(this.document.options.enableExplorer=t)||b._.a11y&&b._.a11y.explorer?this.rerender(this.settings.collapsible?c.STATE.RERENDER:c.STATE.COMPILED):this.loadA11y("explorer")},_.prototype.setCollapsible=function(t){!(this.document.options.enableComplexity=t)||b._.a11y&&b._.a11y.complexity?this.rerender(c.STATE.COMPILED):this.loadA11y("complexity")},_.prototype.scaleAllMath=function(){var t=(100*parseFloat(this.settings.scale)).toFixed(1).replace(/.0$/,""),t=prompt("Scale all mathematics (compared to surrounding text) by",t+"%");t&&(t.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)?(t=parseFloat(t)/100)?this.menu.pool.lookup("scale").setValue(String(t)):alert("The scale should not be zero"):alert("The scale should be a percentage (e.g., 120%)"))},_.prototype.resetDefaults=function(){_.loading++;var e,t,r=this.menu.pool,n=this.defaultSettings;try{for(var o=u(Object.keys(this.settings)),i=o.next();!i.done;i=o.next()){var a,s=i.value,l=r.lookup(s);l?(l.setValue(n[s]),(a=l.items[0])&&a.executeCallbacks_()):this.settings[s]=n[s]}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}_.loading--,this.rerender(c.STATE.COMPILED)},_.prototype.checkComponent=function(t){t=_.loadingPromises.get(t);t&&i.mathjax.retryAfter(t)},_.prototype.loadComponent=function(t,e){var r;_.loadingPromises.has(t)||(r=b.loader)&&(_.loading++,r=r.load(t).then(function(){_.loading--,_.loadingPromises.delete(t),e(),0===_.loading&&_._loadingPromise&&(_._loadingPromise=null,_._loadingOK())}).catch(function(t){_._loadingPromise?(_._loadingPromise=null,_._loadingFailed(t)):console.log(t)}),_.loadingPromises.set(t,r))},_.prototype.loadA11y=function(r){var n=this,o=!c.STATE.ENRICHED;this.loadComponent("a11y/"+r,function(){var t=b.startup,e=(i.mathjax.handlers.unregister(t.handler),t.handler=t.getHandler(),i.mathjax.handlers.register(t.handler),n.document);n.document=t.document=t.getDocument(),(n.document.menu=n).document.outputJax.reset(),n.transferMathList(e),n.document.processed=e.processed,_._loadingPromise||(n.document.outputJax.reset(),n.rerender("complexity"===r||o?c.STATE.COMPILED:c.STATE.TYPESET))})},_.prototype.transferMathList=function(t){var e,r,n=this.document.options.MathItem;try{for(var o=u(t.math),i=o.next();!i.done;i=o.next()){var a=i.value,s=new n;Object.assign(s,a),this.document.math.push(s)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},_.prototype.formatSource=function(t){return t.trim().replace(/&/g,"&").replace(//g,">")},_.prototype.toMML=function(t){return this.MmlVisitor.visitTree(t.root,t,{texHints:this.settings.texHints,semantics:this.settings.semantics&&"MathML"!==t.inputJax.name})},_.prototype.zoom=function(t,e,r){t&&!this.isZoomEvent(t,e)||(this.menu.mathItem=r,t&&this.menu.post(t),this.zoomBox.post())},_.prototype.isZoomEvent=function(t,e){return this.settings.zoom===e&&(!this.settings.alt||t.altKey)&&(!this.settings.ctrl||t.ctrlKey)&&(!this.settings.cmd||t.metaKey)&&(!this.settings.shift||t.shiftKey)},_.prototype.rerender=function(t){void 0===t&&(t=c.STATE.TYPESET),this.rerenderStart=Math.min(t,this.rerenderStart),_.loading||(this.rerenderStart<=c.STATE.COMPILED&&this.document.reset({inputJax:[]}),this.document.rerender(this.rerenderStart),this.rerenderStart=c.STATE.LAST)},_.prototype.copyMathML=function(){this.copyToClipboard(this.toMML(this.menu.mathItem))},_.prototype.copyOriginal=function(){this.copyToClipboard(this.menu.mathItem.math.trim())},_.prototype.copyAnnotation=function(){this.copyToClipboard(this.menu.annotation.trim())},_.prototype.copyToClipboard=function(t){var e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.cssText="height: 1px; width: 1px; padding: 1px; position: absolute; left: -10px",document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch(t){alert("Can't copy to clipboard: "+t.message)}document.body.removeChild(e)},_.prototype.addMenu=function(e){var r=this,t=e.typesetRoot;t.addEventListener("contextmenu",function(){return r.menu.mathItem=e},!0),t.addEventListener("keydown",function(){return r.menu.mathItem=e},!0),t.addEventListener("click",function(t){return r.zoom(t,"Click",e)},!0),t.addEventListener("dblclick",function(t){return r.zoom(t,"DoubleClick",e)},!0),this.menu.store.insert(t)},_.prototype.clear=function(){this.menu.store.clear()},_.prototype.variable=function(e,r){var n=this;return{name:e,getter:function(){return n.settings[e]},setter:function(t){n.settings[e]=t,r&&r(t),n.saveUserSettings()}}},_.prototype.a11yVar=function(r,n){var o=this;return{name:r,getter:function(){return o.getA11y(r)},setter:function(t){o.settings[r]=t;var e={};e[r]=t,o.setA11y(e),n&&n(t),o.saveUserSettings()}}},_.prototype.submenu=function(t,e,r,n){void 0===r&&(r=[]),void 0===n&&(n=!1);var o,i,a=[];try{for(var s=u(r),l=s.next();!l.done;l=s.next()){var c=l.value;Array.isArray(c)?a=a.concat(c):a.push(c)}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return{type:"submenu",id:t,content:e,menu:{items:a},disabled:0===a.length||n}},_.prototype.command=function(t,e,r,n){return void 0===n&&(n={}),Object.assign({type:"command",id:t,content:e,action:r},n)},_.prototype.checkbox=function(t,e,r,n){return void 0===n&&(n={}),Object.assign({type:"checkbox",id:t,content:e,variable:r},n)},_.prototype.radioGroup=function(e,t){var r=this;return t.map(function(t){return r.radio(t[0],t[1]||t[0],e)})},_.prototype.radio=function(t,e,r,n){return void 0===n&&(n={}),Object.assign({type:"radio",id:t,content:e,variable:r},n)},_.prototype.label=function(t,e){return{type:"label",id:t,content:e}},_.prototype.rule=function(){return{type:"rule"}},_.MENU_STORAGE="MathJax-Menu-Settings",_.OPTIONS={settings:{texHints:!0,semantics:!1,zoom:"NoZoom",zscale:"200%",renderer:"CHTML",alt:!1,cmd:!1,ctrl:!1,shift:!1,scale:1,autocollapse:!1,collapsible:!1,inTabOrder:!0,assistiveMml:!0,explorer:!1},jax:{CHTML:null,SVG:null},annotationTypes:(0,s.expandable)({TeX:["TeX","LaTeX","application/x-tex"],StarMath:["StarMath 5.0"],Maple:["Maple"],ContentMathML:["MathML-Content","application/mathml-content+xml"],OpenMath:["OpenMath"]})},_.loading=0,_.loadingPromises=new Map,_._loadingPromise=null,_._loadingOK=null,_._loadingFailed=null,e.Menu=_},4001:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=(Object.defineProperty(e,"__esModule",{value:!0}),e.MenuHandler=e.MenuMathDocumentMixin=e.MenuMathItemMixin=void 0,r(5713)),p=r(4474),h=r(7233),d=r(8310);function f(t){return i(e,r=t),e.prototype.addMenu=function(t,e){void 0===e&&(e=!1),this.state()>=p.STATE.CONTEXT_MENU||(this.isEscaped||!t.options.enableMenu&&!e||t.menu.addMenu(this),this.state(p.STATE.CONTEXT_MENU))},e.prototype.checkLoading=function(t){t.checkLoading()},e;function e(){return null!==r&&r.apply(this,arguments)||this}var r}function o(t){var e,o;return i(r,o=t),r.prototype.addMenu=function(){var t,e;if(!this.processed.isSet("context-menu")){try{for(var r=c(this.math),n=r.next();!n.done;n=r.next())n.value.addMenu(this)}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.processed.set("context-menu")}return this},r.prototype.checkLoading=function(){this.menu.isLoading&&u.mathjax.retryAfter(this.menu.loadingPromise.catch(function(t){return console.log(t)}));var t=this.menu.settings;return t.collapsible&&(this.options.enableComplexity=!0,this.menu.checkComponent("a11y/complexity")),t.explorer&&(this.options.enableEnrichment=!0,this.options.enableExplorer=!0,this.menu.checkComponent("a11y/explorer")),this},r.prototype.state=function(t,e){return o.prototype.state.call(this,t,e=void 0===e?!1:e),t\n"+this.childNodeMml(t,e+" ","\n")+e+""},l.prototype.visitMathNode=function(t,e){if(!this.options.semantics||"TeX"!==this.mathItem.inputJax.name)return o.prototype.visitDefault.call(this,t,e);var r=t.childNodes.length&&1\n"+e+" \n"+(r?e+" \n":"")+this.childNodeMml(t,e+(r?" ":" "),"\n")+(r?e+" \n":"")+e+' '+this.mathItem.math+"\n"+e+" \n"+e+""},l);function l(){var t=null!==o&&o.apply(this,arguments)||this;return t.options={texHints:!0,semantics:!1},t.mathItem=null,t}e.MmlVisitor=r},4414:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.SelectableInfo=void 0,r(4922)),s=r(2165),r=(o=a.Info,i(l,o),l.prototype.addEvents=function(t){var e=this;t.addEventListener("keypress",function(t){"a"===t.key&&(t.ctrlKey||t.metaKey)&&(e.selectAll(),e.stop(t))})},l.prototype.selectAll=function(){document.getSelection().selectAllChildren(this.html.querySelector("pre"))},l.prototype.copyToClipboard=function(){this.selectAll();try{document.execCommand("copy")}catch(t){alert("Can't copy to clipboard: "+t.message)}document.getSelection().removeAllRanges()},l.prototype.generateHtml=function(){var e=this,t=(o.prototype.generateHtml.call(this),this.html.querySelector("span."+s.HtmlClasses.INFOSIGNATURE).appendChild(document.createElement("input")));t.type="button",t.value="Copy to Clipboard",t.addEventListener("click",function(t){return e.copyToClipboard()})},l);function l(){return null!==o&&o.apply(this,arguments)||this}e.SelectableInfo=r},9923:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.asyncLoad=void 0;var o=r(5713);e.asyncLoad=function(n){return o.mathjax.asyncLoad?new Promise(function(e,r){var t=o.mathjax.asyncLoad(n);t instanceof Promise?t.then(function(t){return e(t)}).catch(function(t){return r(t)}):e(t)}):Promise.reject("Can't load '".concat(n,"': No asyncLoad method specified"))}},6469:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.BBox=void 0;var n=r(6010);function o(t){void 0===t&&(t={w:0,h:-n.BIGDIMEN,d:-n.BIGDIMEN}),this.w=t.w||0,this.h="h"in t?t.h:-n.BIGDIMEN,this.d="d"in t?t.d:-n.BIGDIMEN,this.L=this.R=this.ic=this.sk=this.dx=0,this.scale=this.rscale=1,this.pwidth=""}o.zero=function(){return new o({h:0,d:0,w:0})},o.empty=function(){return new o},o.prototype.empty=function(){return this.w=0,this.h=this.d=-n.BIGDIMEN,this},o.prototype.clean=function(){this.w===-n.BIGDIMEN&&(this.w=0),this.h===-n.BIGDIMEN&&(this.h=0),this.d===-n.BIGDIMEN&&(this.d=0)},o.prototype.rescale=function(t){this.w*=t,this.h*=t,this.d*=t},o.prototype.combine=function(t,e,r){var n=t.rscale,e=(e=void 0===e?0:e)+n*(t.w+t.L+t.R),o=(r=void 0===r?0:r)+n*t.h,n=n*t.d-r;e>this.w&&(this.w=e),o>this.h&&(this.h=o),n>this.d&&(this.d=n)},o.prototype.append=function(t){var e=t.rscale;this.w+=e*(t.w+t.L+t.R),e*t.h>this.h&&(this.h=e*t.h),e*t.d>this.d&&(this.d=e*t.d)},o.prototype.updateFrom=function(t){this.h=t.h,this.d=t.d,this.w=t.w,t.pwidth&&(this.pwidth=t.pwidth)},o.fullWidth="100%",o.StyleAdjust=[["borderTopWidth","h"],["borderRightWidth","w"],["borderBottomWidth","d"],["borderLeftWidth","w",0],["paddingTop","h"],["paddingRight","w"],["paddingBottom","d"],["paddingLeft","w",0]],e.BBox=o},6751:function(t,e){var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0",gtdot:"⋗",harrw:"↭",hbar:"ℏ",hellip:"…",hookleftarrow:"↩",hookrightarrow:"↪",imath:"ı",infin:"∞",intcal:"⊺",iota:"ι",jmath:"ȷ",kappa:"κ",kappav:"ϰ",lEg:"⪋",lambda:"λ",lap:"⪅",larrlp:"↫",larrtl:"↢",lbrace:"{",lbrack:"[",le:"≤",leftleftarrows:"⇇",leftthreetimes:"⋋",lessdot:"⋖",lmoust:"⎰",lnE:"≨",lnap:"⪉",lne:"⪇",lnsim:"⋦",longmapsto:"⟼",looparrowright:"↬",lowast:"∗",loz:"◊",lt:"<",ltimes:"⋉",ltri:"◃",macr:"¯",malt:"✠",mho:"℧",mu:"μ",multimap:"⊸",nLeftarrow:"⇍",nLeftrightarrow:"⇎",nRightarrow:"⇏",nVDash:"⊯",nVdash:"⊮",natur:"♮",nearr:"↗",nharr:"↮",nlarr:"↚",not:"¬",nrarr:"↛",nu:"ν",nvDash:"⊭",nvdash:"⊬",nwarr:"↖",omega:"ω",omicron:"ο",or:"∨",osol:"⊘",period:".",phi:"φ",phiv:"ϕ",pi:"π",piv:"ϖ",prap:"⪷",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",prime:"′",psi:"ψ",quot:'"',rarrtl:"↣",rbrace:"}",rbrack:"]",rho:"ρ",rhov:"ϱ",rightrightarrows:"⇉",rightthreetimes:"⋌",ring:"˚",rmoust:"⎱",rtimes:"⋊",rtri:"▹",scap:"⪸",scnE:"⪶",scnap:"⪺",scnsim:"⋩",sdot:"⋅",searr:"↘",sect:"§",sharp:"♯",sigma:"σ",sigmav:"ς",simne:"≆",smile:"⌣",spades:"♠",sub:"⊂",subE:"⫅",subnE:"⫋",subne:"⊊",supE:"⫆",supnE:"⫌",supne:"⊋",swarr:"↙",tau:"τ",theta:"θ",thetav:"ϑ",tilde:"˜",times:"×",triangle:"▵",triangleq:"≜",upsi:"υ",upuparrows:"⇈",veebar:"⊻",vellip:"⋮",weierp:"℘",xi:"ξ",yen:"¥",zeta:"ζ",zigrarr:"⇝",nbsp:" ",rsquo:"’",lsquo:"‘"},{});function a(t,e){return"#"===e.charAt(0)?s(e.slice(1)):r.entities[e]||(r.options.loadMissingEntities&&(e=e.match(/^[a-zA-Z](fr|scr|opf)$/)?RegExp.$1:e.charAt(0).toLowerCase(),i[e]||(i[e]=!0,(0,n.retryAfter)((0,o.asyncLoad)("./util/entities/"+e+".js")))),t)}function s(t){t="x"===t.charAt(0)?parseInt(t.slice(1),16):parseInt(t);return String.fromCodePoint(t)}r.add=function(t,e){Object.assign(r.entities,t),i[e]=!0},r.remove=function(t){delete r.entities[t]},r.translate=function(t){return t.replace(/&([a-z][a-z0-9]*|#(?:[0-9]+|x[0-9a-f]+));/gi,a)},r.numeric=s},7525:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0s[0]&&e[1]=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},e=(Object.defineProperty(u,"__esModule",{value:!0}),u.LinkedList=u.ListItem=u.END=void 0,u.END=Symbol(),u.ListItem=l,c.prototype.isBefore=function(t,e){return t=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0e.length}}}},n.prototype.add=function(t,e){void 0===e&&(e=n.DEFAULTPRIORITY);for(var r=this.items.length;0<=--r&&e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.CssStyles=void 0,Object.defineProperty(n.prototype,"cssText",{get:function(){return this.getStyleString()},enumerable:!1,configurable:!0}),n.prototype.addStyles=function(t){var e,r;if(t)try{for(var n=c(Object.keys(t)),o=n.next();!o.done;o=n.next()){var i=o.value;this.styles[i]||(this.styles[i]={}),Object.assign(this.styles[i],t[i])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},n.prototype.removeStyles=function(){for(var t,e,r=[],n=0;n=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},g=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=(Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractItem=void 0,r(9329)),l=r(2556),c=r(2165),r=(o=s.AbstractEntry,i(u,o),Object.defineProperty(u.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,this.generateHtml(),this.menu&&this.menu.generateHtml()},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),u.prototype.press=function(){this.disabled||(this.executeAction(),this.executeCallbacks_())},u.prototype.executeAction=function(){},u.prototype.registerCallback=function(t){-1===this.callbacks.indexOf(t)&&this.callbacks.push(t)},u.prototype.unregisterCallback=function(t){t=this.callbacks.indexOf(t);-1!==t&&this.callbacks.splice(t,1)},u.prototype.mousedown=function(t){this.press(),this.stop(t)},u.prototype.mouseover=function(t){this.focus(),this.stop(t)},u.prototype.mouseout=function(t){this.deactivate(),this.stop(t)},u.prototype.generateHtml=function(){o.prototype.generateHtml.call(this);var t=this.html;t.setAttribute("aria-disabled","false"),t.textContent=this.content},u.prototype.activate=function(){this.disabled||this.html.classList.add(c.HtmlClasses.MENUACTIVE)},u.prototype.deactivate=function(){this.html.classList.remove(c.HtmlClasses.MENUACTIVE)},u.prototype.focus=function(){this.menu.focused=this,o.prototype.focus.call(this),this.activate()},u.prototype.unfocus=function(){this.deactivate(),o.prototype.unfocus.call(this)},u.prototype.escape=function(t){l.MenuUtil.close(this)},u.prototype.up=function(t){this.menu.up(t)},u.prototype.down=function(t){this.menu.down(t)},u.prototype.left=function(t){this.menu.left(t)},u.prototype.right=function(t){this.menu.right(t)},u.prototype.space=function(t){this.press()},u.prototype.disable=function(){this.disabled=!0;var t=this.html;t.classList.add(c.HtmlClasses.MENUDISABLED),t.setAttribute("aria-disabled","true")},u.prototype.enable=function(){this.disabled=!1;var t=this.html;t.classList.remove(c.HtmlClasses.MENUDISABLED),t.removeAttribute("aria-disabled")},u.prototype.executeCallbacks_=function(){var t,e;try{for(var r=a(this.callbacks),n=r.next();!n.done;n=r.next()){var o=n.value;try{o(this)}catch(t){l.MenuUtil.error(t,"Callback for menu entry "+this.id+" failed.")}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},u);function u(t,e,r,n){t=o.call(this,t,e)||this;return t._content=r,t.disabled=!1,t.callbacks=[],t._id=n||r,t}e.AbstractItem=r},1484:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=(Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMenu=void 0,r(8372)),l=r(1340),c=r(2165),u=r(6186),r=(o=a.AbstractPostable,i(p,o),Object.defineProperty(p.prototype,"baseMenu",{get:function(){return this._baseMenu},set:function(t){this._baseMenu=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"items",{get:function(){return this._items},set:function(t){this._items=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"pool",{get:function(){return this.variablePool},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"focused",{get:function(){return this._focused},set:function(t){var e;this._focused!==t&&(this._focused||this.unfocus(),e=this._focused,this._focused=t,e&&e.unfocus())},enumerable:!1,configurable:!0}),p.prototype.up=function(t){var e,r=this.items.filter(function(t){return t instanceof l.AbstractItem&&!t.isHidden()});0!==r.length&&(this.focused?-1!==(e=r.indexOf(this.focused))&&r[e=e?--e:r.length-1].focus():r[r.length-1].focus())},p.prototype.down=function(t){var e,r=this.items.filter(function(t){return t instanceof l.AbstractItem&&!t.isHidden()});0!==r.length&&(this.focused?-1!==(e=r.indexOf(this.focused))&&r[e=++e===r.length?0:e].focus():r[0].focus())},p.prototype.generateHtml=function(){o.prototype.generateHtml.call(this),this.generateMenu()},p.prototype.generateMenu=function(){var t,e,r=this.html;r.classList.add(c.HtmlClasses.MENU);try{for(var n=s(this.items),o=n.next();!o.done;o=n.next()){var i,a=o.value;a.isHidden()?(i=a.html).parentNode&&i.parentNode.removeChild(i):r.appendChild(a.html)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},p.prototype.post=function(t,e){this.variablePool.update(),o.prototype.post.call(this,t,e)},p.prototype.unpostSubmenus=function(){var t,e,r=this.items.filter(function(t){return t instanceof u.Submenu});try{for(var n=s(r),o=n.next();!o.done;o=n.next()){var i=o.value;i.submenu.unpost(),i!==this.focused&&i.unfocus()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},p.prototype.unpost=function(){o.prototype.unpost.call(this),this.unpostSubmenus(),this.focused=null},p.prototype.find=function(t){var e,r;try{for(var n=s(this.items),o=n.next();!o.done;o=n.next()){var i=o.value;if("rule"!==i.type){if(i.id===t)return i;if("submenu"===i.type){var a=i.submenu.find(t);if(a)return a}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return null},p);function p(){var t=null!==o&&o.apply(this,arguments)||this;return t.className=c.HtmlClasses.CONTEXTMENU,t.role="menu",t._items=[],t._baseMenu=null,t}e.AbstractMenu=r},2868:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractNavigatable=void 0;var n=r(3205),o=r(8853);function i(){this.bubble=!1}i.prototype.bubbleKey=function(){this.bubble=!0},i.prototype.keydown=function(t){switch(t.keyCode){case n.KEY.ESCAPE:this.escape(t);break;case n.KEY.RIGHT:this.right(t);break;case n.KEY.LEFT:this.left(t);break;case n.KEY.UP:this.up(t);break;case n.KEY.DOWN:this.down(t);break;case n.KEY.RETURN:case n.KEY.SPACE:this.space(t);break;default:return}this.bubble?this.bubble=!1:this.stop(t)},i.prototype.escape=function(t){},i.prototype.space=function(t){},i.prototype.left=function(t){},i.prototype.right=function(t){},i.prototype.up=function(t){},i.prototype.down=function(t){},i.prototype.stop=function(t){t&&(t.stopPropagation(),t.preventDefault(),t.cancelBubble=!0)},i.prototype.mousedown=function(t){return this.stop(t)},i.prototype.mouseup=function(t){return this.stop(t)},i.prototype.mouseover=function(t){return this.stop(t)},i.prototype.mouseout=function(t){return this.stop(t)},i.prototype.click=function(t){return this.stop(t)},i.prototype.addEvents=function(t){t.addEventListener(o.MOUSE.DOWN,this.mousedown.bind(this)),t.addEventListener(o.MOUSE.UP,this.mouseup.bind(this)),t.addEventListener(o.MOUSE.OVER,this.mouseover.bind(this)),t.addEventListener(o.MOUSE.OUT,this.mouseout.bind(this)),t.addEventListener(o.MOUSE.CLICK,this.click.bind(this)),t.addEventListener("keydown",this.keydown.bind(this)),t.addEventListener("dragstart",this.stop.bind(this)),t.addEventListener(o.MOUSE.SELECTSTART,this.stop.bind(this)),t.addEventListener("contextmenu",this.stop.bind(this)),t.addEventListener(o.MOUSE.DBLCLICK,this.stop.bind(this))},e.AbstractNavigatable=i},8372:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),r=(Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractPostable=void 0,o=r(9328).MenuElement,i(a,o),a.prototype.isPosted=function(){return this.posted},a.prototype.post=function(t,e){this.posted||(void 0!==t&&void 0!==e&&this.html.setAttribute("style","left: "+t+"px; top: "+e+"px;"),this.display(),this.posted=!0)},a.prototype.unpost=function(){var t;this.posted&&((t=this.html).parentNode&&t.parentNode.removeChild(t),this.posted=!1)},a);function a(){var t=null!==o&&o.apply(this,arguments)||this;return t.posted=!1,t}e.AbstractPostable=r},6765:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),r=(Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractVariableItem=void 0,o=r(1340).AbstractItem,i(a,o),a.prototype.generateHtml=function(){o.prototype.generateHtml.call(this);var t=this.html;this.span||this.generateSpan(),t.appendChild(this.span),this.update()},a.prototype.register=function(){this.variable.register(this)},a.prototype.unregister=function(){this.variable.unregister(this)},a.prototype.update=function(){this.updateAria(),this.span&&this.updateSpan()},a);function a(){return null!==o&&o.apply(this,arguments)||this}e.AbstractVariableItem=r},5179:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=(Object.defineProperty(e,"__esModule",{value:!0}),e.CloseButton=void 0,r(8372)),s=r(2165),r=(o=a.AbstractPostable,i(l,o),l.prototype.generateHtml=function(){var t=document.createElement("span"),e=(t.classList.add(this.className),t.setAttribute("role",this.role),t.setAttribute("tabindex","0"),document.createElement("span"));e.textContent="×",t.appendChild(e),this.html=t},l.prototype.display=function(){},l.prototype.unpost=function(){o.prototype.unpost.call(this),this.element.unpost()},l.prototype.keydown=function(t){this.bubbleKey(),o.prototype.keydown.call(this,t)},l.prototype.space=function(t){this.unpost(),this.stop(t)},l.prototype.mousedown=function(t){this.unpost(),this.stop(t)},l);function l(t){var e=o.call(this)||this;return e.element=t,e.className=s.HtmlClasses.MENUCLOSE,e.role="button",e}e.CloseButton=r},5073:function(t,e,r){var n,a,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=(Object.defineProperty(e,"__esModule",{value:!0}),e.ContextMenu=void 0,r(1484)),s=r(2165),l=r(1932),c=r(2358),r=(a=i.AbstractMenu,o(u,a),u.fromJson=function(e,t){var r=t.pool,n=t.items,t=t.id,t=void 0===t?"":t,o=new this(e),i=(o.id=t,e.get("variable")),t=(r.forEach(function(t){return i(e,t,o.pool)}),e.get("items")(e,n,o));return o.items=t,o},u.prototype.generateHtml=function(){this.isPosted()&&this.unpost(),a.prototype.generateHtml.call(this),this._frame=document.createElement("div"),this._frame.classList.add(s.HtmlClasses.MENUFRAME);var t="left: 0px; top: 0px; z-index: 200; width: 100%; height: 100%; border: 0px; padding: 0px; margin: 0px;",e=(this._frame.setAttribute("style","position: absolute; "+t),document.createElement("div"));e.setAttribute("style","position: fixed; "+t),this._frame.appendChild(e),e.addEventListener("mousedown",function(t){this.unpost(),this.unpostWidgets(),this.stop(t)}.bind(this))},u.prototype.display=function(){document.body.appendChild(this.frame),this.frame.appendChild(this.html),this.focus()},u.prototype.escape=function(t){this.unpost(),this.unpostWidgets()},u.prototype.unpost=function(){var t;a.prototype.unpost.call(this),0document.body.offsetWidth-5&&(o=document.body.offsetWidth-t.offsetWidth-5),this.post(o,i)},u.prototype.registerWidget=function(t){this.widgets.push(t)},u.prototype.unregisterWidget=function(t){t=this.widgets.indexOf(t);-1=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.MenuStore=void 0,r(2556)),o=r(2165),i=r(3205),r=(Object.defineProperty(a.prototype,"active",{get:function(){return this._active},set:function(t){do{if(-1!==this.store.indexOf(t)){this._active=t;break}}while(t=t.parentNode)},enumerable:!1,configurable:!0}),a.prototype.next=function(){var t=this.store.length;if(0===t)return this.active=null;var e=-1!==(e=this.store.indexOf(this.active))&&e=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__spread||function(){for(var t=[],e=0;edocument.body.offsetWidth-5&&(o=Math.max(5,o-n-e.offsetWidth+6)),a.prototype.post.call(this,o,i)}},i.prototype.display=function(){this.baseMenu.frame.appendChild(this.html)},i.prototype.setBaseMenu=function(){for(var t=this;(t=t.anchor.menu)instanceof i;);this.baseMenu=t},i.prototype.left=function(t){this.focused=null,this.anchor.focus()},i.prototype.toJson=function(){return{type:""}},i);function i(t){var e=a.call(this)||this;return e._anchor=t,e.variablePool=e.anchor.menu.pool,e.setBaseMenu(),e}e.SubMenu=r},3737:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Variable=void 0;var n=r(2556);function o(t,e,r){this._name=t,this.getter=e,this.setter=r,this.items=[]}o.fromJson=function(t,e,r){e=new this(e.name,e.getter,e.setter);r.insert(e)},Object.defineProperty(o.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),o.prototype.getValue=function(t){try{return this.getter(t)}catch(t){return n.MenuUtil.error(t,"Command of variable "+this.name+" failed."),null}},o.prototype.setValue=function(t,e){try{this.setter(t,e)}catch(t){n.MenuUtil.error(t,"Command of variable "+this.name+" failed.")}this.update()},o.prototype.register=function(t){-1===this.items.indexOf(t)&&this.items.push(t)},o.prototype.unregister=function(t){t=this.items.indexOf(t);-1!==t&&this.items.splice(t,1)},o.prototype.update=function(){this.items.forEach(function(t){return t.update()})},o.prototype.registerCallback=function(e){this.items.forEach(function(t){return t.registerCallback(e)})},o.prototype.unregisterCallback=function(e){this.items.forEach(function(t){return t.unregisterCallback(e)})},o.prototype.toJson=function(){return{type:"variable",name:this.name,getter:this.getter.toString(),setter:this.setter.toString()}},e.Variable=o},2358:function(t,e){function r(){this.pool={}}Object.defineProperty(e,"__esModule",{value:!0}),e.VariablePool=void 0,r.prototype.insert=function(t){this.pool[t.name]=t},r.prototype.lookup=function(t){return this.pool[t]},r.prototype.remove=function(t){delete this.pool[t]},r.prototype.update=function(){for(var t in this.pool)this.pool[t].update()},e.VariablePool=r},3921:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractAudioRenderer=void 0;const n=r(5897);e.AbstractAudioRenderer=class{constructor(){this.separator_=" "}setSeparator(t){this.separator_=t}getSeparator(){return"braille"===n.default.getInstance().modality?"":this.separator_}error(t){return null}merge(r){let n="";var o=r.length-1;for(let t,e=0;t=r[e];e++)if(n+=t.speech,edelete e[t]),r.open.forEach(t=>e[t]=r[t]);var t=Object.keys(e);e.open=t},e.sortClose=function(r,n){if(r.length<=1)return r;const o=[];for(let t,e=0;t=n[e],r.length;e++)t.close&&t.close.length&&t.close.forEach(function(t){var e=r.indexOf(t);-1!==e&&(o.unshift(t),r.splice(e,1))});return o};let y={},g=[];function b(t,e){const r=t[t.length-1];if(r){if(O(e)&&O(r)){if(void 0===r.join)return r.span=r.span.concat(e.span);const t=r.span.pop(),n=e.span.shift();return r.span.push(t+r.join+n),r.span=r.span.concat(e.span),r.join=e.join}S(e)&&S(r)?r.pause=m(r.pause,e.pause):t.push(e)}else t.push(e)}function v(t,e){t.rate&&(e.rate=t.rate),t.pitch&&(e.pitch=t.pitch),t.volume&&(e.volume=t.volume)}function _(t){return"object"==typeof t&&t.open}function S(t){return"object"==typeof t&&1===Object.keys(t).length&&Object.keys(t)[0]===d.personalityProps.PAUSE}function O(t){var e=Object.keys(t);return"object"==typeof t&&(1===e.length&&"span"===e[0]||2===e.length&&("span"===e[0]&&"join"===e[1]||"span"===e[1]&&"join"===e[0]))}function M(t,r){if(!r)return t;const n={};for(const s of d.personalityPropList){const d=t[s],a=r[s];var e;!d&&!a||d&&a&&d===a||(e=d||0,_(n)||(n.open=[],n.close=[]),d||n.close.push(s),a||n.open.push(s),a&&d&&(n.close.push(s),n.open.push(s)),r[s]=e,n[s]=e,y[s]?y[s].push(e):y[s]=[e])}if(_(n)){let t=n.close.slice();for(;0"string"==typeof t?new c.Span(t,{}):t),r=m.get(n.default.getInstance().markup);return r?r.merge(e):t.join()},e.finalize=function(t){const e=m.get(n.default.getInstance().markup);return e?e.finalize(t):t},e.error=function(t){const e=m.get(n.default.getInstance().markup);return e?e.error(t):""},e.registerRenderer=function(t,e){m.set(t,e)},e.isXml=function(){return m.get(n.default.getInstance().markup)instanceof d.XmlRenderer}},8639:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.LayoutRenderer=void 0;const n=r(2057),a=r(5740),o=r(4440),i=r(3706),s=r(2456);class l extends s.XmlRenderer{finalize(t){{c="";const e=a.parseInput(`${t}`);return n.Debugger.getInstance().output(a.formatXml(e.toString())),c=d(e)}}pause(t){return""}prosodyElement(t,e){return t===o.personalityProps.LAYOUT?`<${e}>`:""}closeTag(t){return``}markup(t){const e=[];let r=[];for(const n of t)if(n.layout){e.push(this.processContent(r)),r=[];const t=n.layout;t.match(/^begin/)?e.push("<"+t.replace(/^begin/,"")+">"):t.match(/^end/)?e.push(""):console.warn("Something went wrong with layout markup: "+t)}else r.push(n);return e.push(this.processContent(r)),e.join("")}processContent(t){const r=[],n=i.personalityMarkup(t);for(let t,e=0;t=n[e];e++)t.span?r.push(this.merge(t.span)):i.isPauseElement(t);return r.join("")}}e.LayoutRenderer=l;let c="";const u={TABLE:function(t){let e=g(t);e.forEach(t=>{t.cells=t.cells.slice(1).slice(0,-1),t.width=t.width.slice(1).slice(0,-1)});var[t,r]=b(e);return _(e=v(e,r),t)},CASES:function(t){let e=g(t);e.forEach(t=>{t.cells=t.cells.slice(0,-1),t.width=t.width.slice(0,-1)});var[t,r]=b(e);return _(e=v(e,r),t)},CAYLEY:function(t){let e=g(t);e.forEach(t=>{t.cells=t.cells.slice(1).slice(0,-1),t.width=t.width.slice(1).slice(0,-1),t.sep=t.sep+t.sep});const[r,n]=b(e),o={lfence:"",rfence:"",cells:n.map(t=>"⠐"+new Array(t).join("⠒")),width:n,height:1,sep:e[0].sep};return e.splice(1,0,o),_(e=v(e,n),r)},MATRIX:function(t){var t=g(t),[e,r]=b(t);return _(v(t,r),e)},CELL:d,FENCE:d,ROW:d,FRACTION:function(t){var[t,e,,r,n]=Array.from(t.childNodes),e=p(e),r=p(r),o=m(e),i=m(r),o=Math.max(o,i),i=t+new Array(o+1).join("⠒")+n;return M(e,o=i.length)+` +${i} +`+M(r,o)},NUMERATOR:x,DENOMINATOR:x};function p(t){const e=a.tagName(t),r=u[e];return r?r(t):t.textContent}function h(t,e){if(!t||!e)return t+e;var r=f(t),n=f(e),o=r-n;t=o<0?y(t,n,m(t)):t,e=0Math.max(e.length,t),0)}function y(t,e,r){i=e-f(e=t),t=e+(0Math.max(f(e),t),0),width:i.map(m)}}(t));return r}function b(t){const e=t.reduce((t,e)=>Math.max(e.height,t),0),r=[];for(let e=0;et.width[e]).reduce((t,e)=>Math.max(t,e),0));return[e,r]}function v(e,r){const t=[];for(const n of e)if(0!==n.height){const e=[];for(let t=0;tt.lfence+t.cells.join(t.sep)+t.rfence).join("\n");const n=[];for(const r of e){const e=S(r.sep,r.height);let t=r.cells.shift();for(;r.cells.length;)t=h(t,e),t=h(t,r.cells.shift());t=h(S(r.lfence,r.height),t),t=h(t,S(r.rfence,r.height)),n.push(t),n.push(r.lfence+new Array(m(t)-3).join(r.sep)+r.rfence)}return n.slice(0,-1).join("\n")}function S(t,e){let r="";for(;e;)r+=t+"\n",e--;return r.slice(0,-1)}function O(t){return t.nodeType===a.NodeType.ELEMENT_NODE&&"FENCE"===a.tagName(t)?p(t):""}function M(t,e){const r=(e-m(t))/2,[n,o]=Math.floor(r)===r?[r,r]:[Math.floor(r),Math.ceil(r)],i=t.split(/\r\n|\r|\n/),a=[],[s,l]=[new Array(n+1).join("⠀"),new Array(o+1).join("⠀")];for(const t of i)a.push(s+t+l);return a.join("\n")}function x(t){var e=t.firstChild,t=d(t);if(e&&e.nodeType===a.NodeType.ELEMENT_NODE){if("ENGLISH"===a.tagName(e))return"⠰"+t;if("NUMBER"===a.tagName(e))return"⠼"+t}return t}},182:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MarkupRenderer=void 0;const n=r(4440),o=r(3921);class i extends o.AbstractAudioRenderer{constructor(){super(...arguments),this.ignoreElements=[n.personalityProps.LAYOUT],this.scaleFunction=null}setScaleFunction(e,r,n,o,i=0){this.scaleFunction=t=>{t=(t-e)/(r-e);return+(Math.round(n*(1-t)+o*t+"e+"+i)+"e-"+i)}}applyScaleFunction(t){return this.scaleFunction?this.scaleFunction(t):t}ignoreElement(t){return-1!==this.ignoreElements.indexOf(t)}}e.MarkupRenderer=i},8990:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.PunctuationRenderer=void 0;const a=r(4440),n=r(3921),s=r(3706);class o extends n.AbstractAudioRenderer{markup(t){var r=s.personalityMarkup(t);let n="",o=null,i=!1;for(let t,e=0;t=r[e];e++)s.isMarkupElement(t)||(s.isPauseElement(t)?i&&(o=s.mergePause(o,t,Math.max)):(o&&(n+=this.pause(o[a.personalityProps.PAUSE]),o=null),n+=(i?this.getSeparator():"")+this.merge(t.span),i=!0));return n}pause(t){t="number"==typeof t?t<=250?"short":t<=500?"medium":"long":t;return o.PAUSE_PUNCTUATION.get(t)||""}}(e.PunctuationRenderer=o).PAUSE_PUNCTUATION=new Map([["short",","],["medium",";"],["long","."]])},6660:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SableRenderer=void 0;const n=r(4440),o=r(2456);class i extends o.XmlRenderer{finalize(t){return''+this.getSeparator()+t+this.getSeparator()+""}pause(t){return''}prosodyElement(t,e){switch(e=this.applyScaleFunction(e),t){case n.personalityProps.PITCH:return'';case n.personalityProps.RATE:return'';case n.personalityProps.VOLUME:return'';default:return"<"+t.toUpperCase()+' VALUE="'+e+'">'}}closeTag(t){return""}}e.SableRenderer=i},9536:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Span=void 0,e.Span=class{constructor(t,e){this.speech=t,this.attributes=e}}},7504:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SsmlRenderer=void 0;const n=r(5897),o=r(4440),i=r(2456);class a extends i.XmlRenderer{finalize(t){return''+this.getSeparator()+t+this.getSeparator()+""}pause(t){return''}prosodyElement(t,e){e=(e=Math.floor(this.applyScaleFunction(e)))<0?e.toString():"+"+e.toString();return"":'%">')}closeTag(t){return""}}e.SsmlRenderer=a},3757:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SsmlStepRenderer=void 0;class i extends r(7504).SsmlRenderer{markup(t){return i.MARKS={},super.markup(t)}merge(e){const r=[];for(let t=0;t'),i.MARKS[o]=!0),1===n.speech.length&&n.speech.match(/[a-zA-Z]/)?r.push(''+n.speech+""):r.push(n.speech)}return r.join(this.getSeparator())}}(e.SsmlStepRenderer=i).CHARACTER_ATTR="character",i.MARKS={}},4032:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.StringRenderer=void 0;const n=r(3921),i=r(3706);class o extends n.AbstractAudioRenderer{markup(t){let r="";const n=(0,i.personalityMarkup)(t).filter(t=>t.span);if(!n.length)return r;var o=n.length-1;for(let t,e=0;t=n[e];e++)if(t.span&&(r+=this.merge(t.span)),!(e>=o)){const n=t.join;r+=void 0===n?this.getSeparator():n}return r}}e.StringRenderer=o},2456:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.XmlRenderer=void 0;const i=r(5897),a=r(3706),n=r(182);class o extends n.MarkupRenderer{markup(t){this.setScaleFunction(-2,2,-100,100,2);const r=a.personalityMarkup(t),n=[],o=[];for(let e,t=0;e=r[t];t++)if(e.span)n.push(this.merge(e.span));else if(a.isPauseElement(e))n.push(this.pause(e));else{if(e.close.length)for(let t=0;t{n.push(this.prosodyElement(t,e[t])),o.push(t)})}return n.join(" ")}}e.XmlRenderer=o},707:function(t,e){function r(t,e){return t?e?t.filter(t=>e.indexOf(t)<0):t:[]}Object.defineProperty(e,"__esModule",{value:!0}),e.union=e.setdifference=e.interleaveLists=e.removeEmpty=void 0,e.removeEmpty=function(t){return t.filter(t=>t)},e.interleaveLists=function(t,e){const r=[];for(;t.length||e.length;)t.length&&r.push(t.shift()),e.length&&r.push(e.shift());return r},e.setdifference=r,e.union=function(t,e){return t&&e?t.concat(r(e,t)):t||e||[]}},2139:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.loadScript=e.loadMapsForIE_=e.installWGXpath_=e.loadWGXpath_=e.mapsForIE=e.detectEdge=e.detectIE=void 0;const n=r(2315),o=r(5274);function i(t){l(n.default.WGXpath),a(t)}function a(t,e){let r=e||1;"undefined"==typeof wgxpath&&r<10?setTimeout(function(){a(t,r++)},200):10<=r||(n.default.wgxpath=wgxpath,t?n.default.wgxpath.install({document:document}):n.default.wgxpath.install(),o.xpath.evaluate=document.evaluate,o.xpath.result=XPathResult,o.xpath.createNSResolver=document.createNSResolver)}function s(){l(n.default.mathmapsIePath)}function l(t){const e=n.default.document.createElement("script");e.type="text/javascript",e.src=t,(n.default.document.head||n.default.document.body).appendChild(e)}e.detectIE=function(){return"undefined"!=typeof window&&"ActiveXObject"in window&&"clipboardData"in window&&(s(),i(),!0)},e.detectEdge=function(){var t;return"undefined"!=typeof window&&"MSGestureEvent"in window&&null===(null==(t=window.chrome)?void 0:t.loadTimes)&&(i(!(document.evaluate=null)),!0)},e.mapsForIE=null,e.loadWGXpath_=i,e.installWGXpath_=a,e.loadMapsForIE_=s,e.loadScript=l},2057:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Debugger=void 0;const n=r(2315);class o{constructor(){this.isActive_=!1,this.outputFunction_=console.info,this.stream_=null}static getInstance(){return o.instance=o.instance||new o,o.instance}init(t){t&&this.startDebugFile_(t),this.isActive_=!0}output(...t){this.isActive_&&this.output_(t)}generateOutput(t){this.isActive_&&this.output_(t.apply(t,[]))}exit(t=()=>{}){this.isActive_&&this.stream_&&this.stream_.end("","",t)}startDebugFile_(t){this.stream_=n.default.fs.createWriteStream(t),this.outputFunction_=function(...t){this.stream_.write(t.join(" ")),this.stream_.write("\n")}.bind(this),this.stream_.on("error",function(t){console.info("Invalid log file. Debug information sent to console."),this.outputFunction_=console.info}.bind(this)),this.stream_.on("finish",function(){console.info("Finalizing debug file.")})}output_(t){this.outputFunction_.apply(console.info===this.outputFunction_?console:this.outputFunction_,["Speech Rule Engine Debugger:"].concat(t))}}e.Debugger=o},5740:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeXml=e.cloneNode=e.tagName=e.querySelectorAll=e.querySelectorAllByAttrValue=e.querySelectorAllByAttr=e.formatXml=e.createTextNode=e.createElementNS=e.createElement=e.replaceNode=e.NodeType=e.parseInput=e.XML_ENTITIES=e.trimInput_=e.toArray=void 0;const o=r(5897),i=r(4440),a=r(2315),s=r(5274);function n(r){const n=[];for(let t=0,e=r.length;t[ \f\n\r\t\v\u200b]+<").trim()}e.toArray=n,e.trimInput_=l,e.XML_ENTITIES={"<":!0,">":!0,"&":!0,""":!0,"'":!0},e.parseInput=function(t){const e=new a.default.xmldom.DOMParser,r=l(t),n=!!r.match(/&(?!lt|gt|amp|quot|apos)\w+;/g);if(!r)throw new Error("Empty input!");try{const t=e.parseFromString(r,n?"text/html":"text/xml");return o.default.getInstance().mode===i.Mode.HTTP?(s.xpath.currentDocument=t,n?t.body.childNodes[0]:t.documentElement):t.documentElement}catch(t){throw new o.SREError("Illegal input: "+t.message)}},(r=e.NodeType||(e.NodeType={}))[r.ELEMENT_NODE=1]="ELEMENT_NODE",r[r.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",r[r.TEXT_NODE=3]="TEXT_NODE",r[r.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",r[r.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",r[r.ENTITY_NODE=6]="ENTITY_NODE",r[r.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",r[r.COMMENT_NODE=8]="COMMENT_NODE",r[r.DOCUMENT_NODE=9]="DOCUMENT_NODE",r[r.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",r[r.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",r[r.NOTATION_NODE=12]="NOTATION_NODE",e.replaceNode=function(t,e){t.parentNode&&(t.parentNode.insertBefore(e,t),t.parentNode.removeChild(t))},e.createElement=function(t){return a.default.document.createElement(t)},e.createElementNS=function(t,e){return a.default.document.createElementNS(t,e)},e.createTextNode=function(t){return a.default.document.createTextNode(t)},e.formatXml=function(t){let r="",e=/(>)(<)(\/*)/g,n=0,o=(t=t.replace(e,"$1\r\n$2$3")).split("\r\n");for(e=/(\.)*(<)(\/*)/g,o=o.map(t=>t.replace(e,"$1\r\n$2$3").split("\r\n")).reduce((t,e)=>t.concat(e),[]);o.length;){let e=o.shift();if(e){let t=0;if(e.match(/^<\w[^>/]*>[^>]+$/)){i=e;const r=(a=o[0])?(i=i.match(/^<([^> ]+).*>/),a=a.match(/^<\/([^>]+)>(.*)/),i&&a&&i[1]===a[1]?[!0,a[2]]:[!1,""]):[!1,""];r[0]?r[1]?(e+=o.shift().slice(0,-r[1].length),r[1].trim()&&o.unshift(r[1])):e+=o.shift():t=1}else if(e.match(/^<\/\w/))0!==n&&--n;else if(e.match(/^<\w[^>]*[^/]>.*$/))t=1;else if(e.match(/^<\w[^>]*\/>.+$/)){const r=e.indexOf(">")+1;e.slice(r).trim()&&o.unshift(),e=e.slice(0,r)}else t=0;r+=new Array(n+1).join(" ")+e+"\r\n",n+=t}}var i,a;return r},e.querySelectorAllByAttr=function(t,e){return t.querySelectorAll?n(t.querySelectorAll(`[${e}]`)):s.evalXPath(`.//*[@${e}]`,t)},e.querySelectorAllByAttrValue=function(t,e,r){return t.querySelectorAll?n(t.querySelectorAll(`[${e}="${r}"]`)):s.evalXPath(`.//*[@${e}="${r}"]`,t)},e.querySelectorAll=function(t,e){return t.querySelectorAll?n(t.querySelectorAll(e)):s.evalXPath(".//"+e,t)},e.tagName=function(t){return t.tagName.toUpperCase()},e.cloneNode=function(t){return t.cloneNode(!0)},e.serializeXml=function(t){return(new a.default.xmldom.XMLSerializer).serializeToString(t)}},5897:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.EnginePromise=e.SREError=void 0;const i=r(1676),s=r(4440),l=r(2057),n=r(1377);class o extends Error{constructor(t=""){super(),this.message=t,this.name="SRE Error"}}e.SREError=o;class a{constructor(){this.customLoader=null,this.parsers={},this.comparator=null,this.mode=s.Mode.SYNC,this.init=!0,this.delay=!1,this.comparators={},this.domain="mathspeak",this.style=i.DynamicCstr.DEFAULT_VALUES[i.Axis.STYLE],this._defaultLocale=i.DynamicCstr.DEFAULT_VALUES[i.Axis.LOCALE],this.locale=this.defaultLocale,this.subiso="",this.modality=i.DynamicCstr.DEFAULT_VALUES[i.Axis.MODALITY],this.speech=s.Speech.NONE,this.markup=s.Markup.NONE,this.walker="Table",this.structure=!1,this.ruleSets=[],this.strict=!1,this.isIE=!1,this.isEdge=!1,this.rate="100",this.pprint=!1,this.config=!1,this.rules="",this.prune="",this.evaluator=a.defaultEvaluator,this.defaultParser=new i.DynamicCstrParser(i.DynamicCstr.DEFAULT_ORDER),this.parser=this.defaultParser,this.dynamicCstr=i.DynamicCstr.defaultCstr()}set defaultLocale(t){this._defaultLocale=n.Variables.ensureLocale(t,this._defaultLocale)}get defaultLocale(){return this._defaultLocale}static getInstance(){return a.instance=a.instance||new a,a.instance}static defaultEvaluator(t,e){return t}static evaluateNode(t){return a.nodeEvaluator(t)}getRate(){var t=parseInt(this.rate,10);return isNaN(t)?100:t}setDynamicCstr(e){if(this.defaultLocale&&(i.DynamicCstr.DEFAULT_VALUES[i.Axis.LOCALE]=this.defaultLocale),e){const r=Object.keys(e);for(let t=0;t{void 0!==r[t]&&(e[t]=r[t])};return t("mode"),e.configurate(r),s.default.BINARY_FEATURES.forEach(t=>{void 0!==r[t]&&(e[t]=!!r[t])}),s.default.STRING_FEATURES.forEach(t),r.json&&(c.default.jsonPath=l.makePath(r.json)),r.xpath&&(c.default.WGXpath=r.xpath),e.setCustomLoader(r.custom),(t=e).isIE=a.detectIE(),t.isEdge=a.detectEdge(),o.setLocale(),e.setDynamicCstr(),e.init?(s.EnginePromise.promises.init=new Promise((t,e)=>{setTimeout(()=>{t("init")},10)}),e.init=!1,s.EnginePromise.get()):e.delay?(e.delay=!1,s.EnginePromise.get()):i.loadLocale()})}},8496:function(t,e){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.Event=e.EventType=e.Move=e.KeyCode=void 0,(r=e.KeyCode||(e.KeyCode={}))[r.ENTER=13]="ENTER",r[r.ESC=27]="ESC",r[r.SPACE=32]="SPACE",r[r.PAGE_UP=33]="PAGE_UP",r[r.PAGE_DOWN=34]="PAGE_DOWN",r[r.END=35]="END",r[r.HOME=36]="HOME",r[r.LEFT=37]="LEFT",r[r.UP=38]="UP",r[r.RIGHT=39]="RIGHT",r[r.DOWN=40]="DOWN",r[r.TAB=9]="TAB",r[r.LESS=188]="LESS",r[r.GREATER=190]="GREATER",r[r.DASH=189]="DASH",r[r.ZERO=48]="ZERO",r[r.ONE=49]="ONE",r[r.TWO=50]="TWO",r[r.THREE=51]="THREE",r[r.FOUR=52]="FOUR",r[r.FIVE=53]="FIVE",r[r.SIX=54]="SIX",r[r.SEVEN=55]="SEVEN",r[r.EIGHT=56]="EIGHT",r[r.NINE=57]="NINE",r[r.A=65]="A",r[r.B=66]="B",r[r.C=67]="C",r[r.D=68]="D",r[r.E=69]="E",r[r.F=70]="F",r[r.G=71]="G",r[r.H=72]="H",r[r.I=73]="I",r[r.J=74]="J",r[r.K=75]="K",r[r.L=76]="L",r[r.M=77]="M",r[r.N=78]="N",r[r.O=79]="O",r[r.P=80]="P",r[r.Q=81]="Q",r[r.R=82]="R",r[r.S=83]="S",r[r.T=84]="T",r[r.U=85]="U",r[r.V=86]="V",r[r.W=87]="W",r[r.X=88]="X",r[r.Y=89]="Y",r[r.Z=90]="Z",e.Move=new Map([[13,"ENTER"],[27,"ESC"],[32,"SPACE"],[33,"PAGE_UP"],[34,"PAGE_DOWN"],[35,"END"],[36,"HOME"],[37,"LEFT"],[38,"UP"],[39,"RIGHT"],[40,"DOWN"],[9,"TAB"],[188,"LESS"],[190,"GREATER"],[189,"DASH"],[48,"ZERO"],[49,"ONE"],[50,"TWO"],[51,"THREE"],[52,"FOUR"],[53,"FIVE"],[54,"SIX"],[55,"SEVEN"],[56,"EIGHT"],[57,"NINE"],[65,"A"],[66,"B"],[67,"C"],[68,"D"],[69,"E"],[70,"F"],[71,"G"],[72,"H"],[73,"I"],[74,"J"],[75,"K"],[76,"L"],[77,"M"],[78,"N"],[79,"O"],[80,"P"],[81,"Q"],[82,"R"],[83,"S"],[84,"T"],[85,"U"],[86,"V"],[87,"W"],[88,"X"],[89,"Y"],[90,"Z"]]),(r=e.EventType||(e.EventType={})).CLICK="click",r.DBLCLICK="dblclick",r.MOUSEDOWN="mousedown",r.MOUSEUP="mouseup",r.MOUSEOVER="mouseover",r.MOUSEOUT="mouseout",r.MOUSEMOVE="mousemove",r.SELECTSTART="selectstart",r.KEYPRESS="keypress",r.KEYDOWN="keydown",r.KEYUP="keyup",r.TOUCHSTART="touchstart",r.TOUCHMOVE="touchmove",r.TOUCHEND="touchend",r.TOUCHCANCEL="touchcancel",e.Event=class{constructor(t,e,r){this.src=t,this.type=e,this.callback=r}add(){this.src.addEventListener(this.type,this.callback)}remove(){this.src.removeEventListener(this.type,this.callback)}}},7248:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.localePath=e.makePath=void 0;const n=r(2315);function o(t){return t.match("/$")?t:t+"/"}e.makePath=o,e.localePath=function(t,e="json"){return o(n.default.jsonPath)+t+(e.match(/^\./)?e:"."+e)}},3769:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.KeyProcessor=e.Processor=void 0;const n=r(8496);class o{constructor(t,e){this.name=t,this.process=e.processor,this.postprocess=e.postprocessor||((t,e)=>t),this.processor=this.postprocess?function(t){return this.postprocess(this.process(t),t)}:this.process,this.print=e.print||o.stringify_,this.pprint=e.pprint||this.print}static stringify_(t){return t&&t.toString()}}(e.Processor=o).LocalState={walker:null,speechGenerator:null,highlighter:null};o;e.KeyProcessor=class i extends o{constructor(t,e){super(t,e),this.key=e.key||i.getKey_}static getKey_(t){return"string"==typeof t?n.KeyCode[t.toUpperCase()]:t}}},6499:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.keypress=e.output=e.print=e.process=e.set=void 0;const s=r(8290),n=r(5714),o=r(3090),i=r(4356),l=r(1414),a=r(9552),c=r(9543),u=r(3362),p=r(1204),h=r(5740),d=r(5897),f=r(4440),m=r(3769),y=r(5274),g=new Map;function b(t){g.set(t.name,t)}function v(t){var e=g.get(t);if(e)return e;throw new d.SREError("Unknown processor "+t)}function _(t,e){const r=v(t);try{return r.processor(e)}catch(t){throw new d.SREError("Processing error for expression "+e)}}function S(t,e){const r=v(t);return d.default.getInstance().pprint?r.pprint(e):r.print(e)}e.set=b,e.process=_,e.print=S,e.output=function(t,e){const r=v(t);try{const t=r.processor(e);return d.default.getInstance().pprint?r.pprint(t):r.print(t)}catch(t){throw new d.SREError("Processing error for expression "+e)}},e.keypress=function(t,e){const r=v(t),n=r instanceof m.KeyProcessor?r.key(e):e,o=r.processor(n);return d.default.getInstance().pprint?r.pprint(o):r.print(o)},b(new m.Processor("semantic",{processor:function(t){t=h.parseInput(t);return l.xmlTree(t)},postprocessor:function(t,e){var r=d.default.getInstance().speech;if(r===f.Speech.NONE)return t;var n=h.cloneNode(t);let o=c.computeMarkup(n);if(r===f.Speech.SHALLOW)return t.setAttribute("speech",s.finalize(o)),t;var i=y.evalXPath(".//*[@id]",t),a=y.evalXPath(".//*[@id]",n);for(let t,e,r=0;t=i[r],e=a[r];r++)o=c.computeMarkup(e),t.setAttribute("speech",s.finalize(o));return t},pprint:function(t){return h.formatXml(t.toString())}})),b(new m.Processor("speech",{processor:function(t){t=h.parseInput(t),t=l.xmlTree(t),t=c.computeSpeech(t);return s.finalize(s.markup(t))},pprint:function(t){t=t.toString();return s.isXml()?h.formatXml(t):t}})),b(new m.Processor("json",{processor:function(t){t=h.parseInput(t);return l.getTree(t).toJson()},postprocessor:function(t,e){var r=d.default.getInstance().speech;if(r===f.Speech.NONE)return t;const n=h.parseInput(e),o=l.xmlTree(n),i=c.computeMarkup(o);if(r===f.Speech.SHALLOW)return t.stree.speech=s.finalize(i),t;const a=t=>{var e=y.evalXPath(`.//*[@id=${t.id}]`,o)[0],e=c.computeMarkup(e);t.speech=s.finalize(e),t.children&&t.children.forEach(a)};return a(t.stree),t},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),b(new m.Processor("description",{processor:function(t){t=h.parseInput(t),t=l.xmlTree(t);return c.computeSpeech(t)},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),b(new m.Processor("enriched",{processor:function(t){return n.semanticMathmlSync(t)},postprocessor:function(t,e){var r=p.getSemanticRoot(t);let n;switch(d.default.getInstance().speech){case f.Speech.NONE:break;case f.Speech.SHALLOW:(n=a.generator("Adhoc")).getSpeech(r,t);break;case f.Speech.DEEP:(n=a.generator("Tree")).getSpeech(t,t)}return t},pprint:function(t){return h.formatXml(t.toString())}})),b(new m.Processor("walker",{processor:function(t){const e=a.generator("Node");(m.Processor.LocalState.speechGenerator=e).setOptions({modality:d.default.getInstance().modality,locale:d.default.getInstance().locale,domain:d.default.getInstance().domain,style:d.default.getInstance().style}),m.Processor.LocalState.highlighter=o.highlighter({color:"black"},{color:"white"},{renderer:"NativeMML"});var t=_("enriched",t),r=S("enriched",t);return m.Processor.LocalState.walker=u.walker(d.default.getInstance().walker,t,e,m.Processor.LocalState.highlighter,r),m.Processor.LocalState.walker},print:function(t){return m.Processor.LocalState.walker.speech()}})),b(new m.KeyProcessor("move",{processor:function(t){return m.Processor.LocalState.walker?!1===m.Processor.LocalState.walker.move(t)?s.error(t):m.Processor.LocalState.walker.speech():null}})),b(new m.Processor("number",{processor:function(t){t=parseInt(t,10);return isNaN(t)?"":i.LOCALE.NUMBERS.numberToWords(t)}})),b(new m.Processor("ordinal",{processor:function(t){t=parseInt(t,10);return isNaN(t)?"":i.LOCALE.NUMBERS.wordOrdinal(t)}})),b(new m.Processor("numericOrdinal",{processor:function(t){t=parseInt(t,10);return isNaN(t)?"":i.LOCALE.NUMBERS.numericOrdinal(t)}})),b(new m.Processor("vulgar",{processor:function(t){var[t,e]=t.split("/").map(t=>parseInt(t,10));return isNaN(t)||isNaN(e)?"":_("speech",`${t}${e}`)}}))},2998:function(t,e,r){var a=this&&this.__awaiter||function(t,a,s,l){return new(s=s||Promise)(function(r,e){function n(t){try{i(l.next(t))}catch(t){e(t)}}function o(t){try{i(l.throw(t))}catch(t){e(t)}}function i(t){var e;t.done?r(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(n,o)}i((l=l.apply(t,a||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.localePath=e.exit=e.move=e.walk=e.processFile=e.file=e.vulgar=e.numericOrdinal=e.ordinal=e.number=e.toEnriched=e.toDescription=e.toJson=e.toSemantic=e.toSpeech=e.localeLoader=e.engineReady=e.engineSetup=e.setupEngine=e.version=void 0;const s=r(5897),n=r(6828),l=r(4440),o=r(7248),c=r(6499),u=r(2315),i=r(1377),p=r(6141);function h(t){return a(this,void 0,void 0,function*(){return(0,n.setup)(t)})}function d(t,e){return c.process(t,e)}function f(t,e,r){switch(s.default.getInstance().mode){case l.Mode.ASYNC:return function(e,r,n){return a(this,void 0,void 0,function*(){var t=yield u.default.fs.promises.readFile(r,{encoding:"utf8"}),t=c.output(e,t);if(n)try{u.default.fs.promises.writeFile(n,t)}catch(t){throw new s.SREError("Can not write to file: "+n)}return t})}(t,e,r);case l.Mode.SYNC:var n=t,o=r,i=function(t){let e;try{e=u.default.fs.readFileSync(t,{encoding:"utf8"})}catch(e){throw new s.SREError("Can not open file: "+t)}return e}(e),i=c.output(n,i);if(o)try{u.default.fs.writeFileSync(o,i)}catch(n){throw new s.SREError("Can not write to file: "+o)}return i;default:throw new s.SREError(`Can process files in ${s.default.getInstance().mode} mode`)}}e.version=i.Variables.VERSION,e.setupEngine=h,e.engineSetup=function(){const t=["mode"].concat(s.default.STRING_FEATURES,s.default.BINARY_FEATURES),e=s.default.getInstance(),r={};return t.forEach(function(t){r[t]=e[t]}),r.json=u.default.jsonPath,r.xpath=u.default.WGXpath,r.rules=e.ruleSets.slice(),r},e.engineReady=function(){return a(this,void 0,void 0,function*(){return h({}).then(()=>s.EnginePromise.getall())})},e.localeLoader=p.standardLoader,e.toSpeech=function(t){return d("speech",t)},e.toSemantic=function(t){return d("semantic",t)},e.toJson=function(t){return d("json",t)},e.toDescription=function(t){return d("description",t)},e.toEnriched=function(t){return d("enriched",t)},e.number=function(t){return d("number",t)},e.ordinal=function(t){return d("ordinal",t)},e.numericOrdinal=function(t){return d("numericOrdinal",t)},e.vulgar=function(t){return d("vulgar",t)},e.file={},e.file.toSpeech=function(t,e){return f("speech",t,e)},e.file.toSemantic=function(t,e){return f("semantic",t,e)},e.file.toJson=function(t,e){return f("json",t,e)},e.file.toDescription=function(t,e){return f("description",t,e)},e.file.toEnriched=function(t,e){return f("enriched",t,e)},e.processFile=f,e.walk=function(t){return c.output("walker",t)},e.move=function(t){return c.keypress("move",t)},e.exit=function(t){const e=t||0;s.EnginePromise.getall().then(()=>process.exit(e))},e.localePath=o.localePath,u.default.documentSupported?h({mode:l.Mode.HTTP}).then(()=>h({})):h({mode:l.Mode.SYNC}).then(()=>h({mode:l.Mode.ASYNC}))},2315:function(__unused_webpack_module,exports,__webpack_require__){var __dirname="/";Object.defineProperty(exports,"__esModule",{value:!0});const variables_1=__webpack_require__(1377);class SystemExternal{static extRequire(library){if("undefined"==typeof process)return null;{const nodeRequire=eval("require");return nodeRequire(library)}}}exports.default=SystemExternal,SystemExternal.windowSupported=!("undefined"==typeof window),SystemExternal.documentSupported=SystemExternal.windowSupported&&!(void 0===window.document),SystemExternal.xmldom=SystemExternal.documentSupported?window:SystemExternal.extRequire("xmldom-sre"),SystemExternal.document=SystemExternal.documentSupported?window.document:(new SystemExternal.xmldom.DOMImplementation).createDocument("","",0),SystemExternal.xpath=SystemExternal.documentSupported?document:function(){const t={document:{},XPathResult:{}};return SystemExternal.extRequire("wicked-good-xpath").install(t),t.document.XPathResult=t.XPathResult,t.document}(),SystemExternal.mathmapsIePath="https://cdn.jsdelivr.net/npm/sre-mathmaps-ie@"+variables_1.Variables.VERSION+"mathmaps_ie.js",SystemExternal.commander=SystemExternal.documentSupported?null:SystemExternal.extRequire("commander"),SystemExternal.fs=SystemExternal.documentSupported?null:SystemExternal.extRequire("fs"),SystemExternal.url=variables_1.Variables.url,SystemExternal.jsonPath=(SystemExternal.documentSupported?SystemExternal.url:process.env.SRE_JSON_PATH||__webpack_require__.g.SRE_JSON_PATH||__dirname+"/mathmaps")+"/",SystemExternal.WGXpath=variables_1.Variables.WGXpath,SystemExternal.wgxpath=null},1377:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Variables=void 0;class r{static ensureLocale(t,e){return r.LOCALES.get(t)?t:(console.error(`Locale ${t} does not exist! Using ${r.LOCALES.get(e)} instead.`),e)}}(e.Variables=r).VERSION="4.0.6",r.LOCALES=new Map([["ca","Catalan"],["da","Danish"],["de","German"],["en","English"],["es","Spanish"],["fr","French"],["hi","Hindi"],["it","Italian"],["nb","Bokmål"],["nn","Nynorsk"],["sv","Swedish"],["nemeth","Nemeth"]]),r.mathjaxVersion="3.2.1",r.url="https://cdn.jsdelivr.net/npm/speech-rule-engine@"+r.VERSION+"/lib/mathmaps",r.WGXpath="https://cdn.jsdelivr.net/npm/wicked-good-xpath@1.3.0/dist/wgxpath.install.js"},5274:function(t,o,e){Object.defineProperty(o,"__esModule",{value:!0}),o.updateEvaluator=o.evaluateString=o.evaluateBoolean=o.getLeafNodes=o.evalXPath=o.resolveNameSpace=o.xpath=void 0;const n=e(5897),i=e(4440),r=e(2315);function a(){return"undefined"!=typeof XPathResult}o.xpath={currentDocument:null,evaluate:(a()?document:r.default.xpath).evaluate,result:a()?XPathResult:r.default.xpath.XPathResult,createNSResolver:(a()?document:r.default.xpath).createNSResolver};const s={xhtml:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",mml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function l(t){return s[t]||null}o.resolveNameSpace=l;class c{constructor(){this.lookupNamespaceURI=l}}function u(t,e,r){return n.default.getInstance().mode!==i.Mode.HTTP||n.default.getInstance().isIE||n.default.getInstance().isEdge?o.xpath.evaluate(t,e,new c,r,null):o.xpath.currentDocument.evaluate(t,e,l,r,null)}function p(t,e){let r;try{r=u(t,e,o.xpath.result.ORDERED_NODE_ITERATOR_TYPE)}catch(t){return[]}const n=[];for(let t=r.iterateNext();t;t=r.iterateNext())n.push(t);return n}o.evalXPath=p,o.getLeafNodes=function(t){return p(".//*[count(*)=0]",t)},o.evaluateBoolean=function(t,e){let r;try{r=u(t,e,o.xpath.result.BOOLEAN_TYPE)}catch(t){return!1}return r.booleanValue},o.evaluateString=function(t,e){let r;try{r=u(t,e,o.xpath.result.STRING_TYPE)}catch(t){return""}return r.stringValue},o.updateEvaluator=function(e){if(n.default.getInstance().mode===i.Mode.HTTP){let t=e;for(;t&&!t.evaluate;)t=t.parentNode;t&&t.evaluate?o.xpath.currentDocument=t:e.ownerDocument&&(o.xpath.currentDocument=e.ownerDocument)}}},9268:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractEnrichCase=void 0,e.AbstractEnrichCase=class{constructor(t){this.semantic=t}}},6061:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseBinomial=void 0;const n=r(5740),o=r(9268),i=r(5452),a=r(2298);class s extends o.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){return!t.mathmlTree&&"line"===t.type&&"binomial"===t.role}getMathml(){if(!this.semantic.childNodes.length)return this.mml;const t=this.semantic.childNodes[0];if(this.mml=(0,i.walkTree)(t),this.mml.hasAttribute(a.Attribute.TYPE)){const t=n.createElement("mrow");t.setAttribute(a.Attribute.ADDED,"true"),n.replaceNode(this.mml,t),t.appendChild(this.mml),this.mml=t}return(0,a.setAttributes)(this.mml,this.semantic),this.mml}}e.CaseBinomial=s},5765:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseDoubleScript=void 0;const n=r(5740),o=r(9268),s=r(5452),l=r(2298);class i extends o.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;var e=n.tagName(t.mathmlTree),t=t.childNodes[0].role;return"MSUBSUP"===e&&"subsup"===t||"MUNDEROVER"===e&&"underover"===t}getMathml(){const t=this.semantic.childNodes[0],e=t.childNodes[0],r=this.semantic.childNodes[1],n=t.childNodes[1],o=s.walkTree(r),i=s.walkTree(e),a=s.walkTree(n);return(0,l.setAttributes)(this.mml,this.semantic),this.mml.setAttribute(l.Attribute.CHILDREN,(0,l.makeIdList)([e,n,r])),[i,a,o].forEach(t=>s.getInnerNode(t).setAttribute(l.Attribute.PARENT,this.mml.getAttribute(l.Attribute.ID))),this.mml.setAttribute(l.Attribute.TYPE,t.role),s.addCollapsedAttribute(this.mml,[this.semantic.id,[t.id,e.id,n.id],r.id]),this.mml}}e.CaseDoubleScript=i},7251:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseEmbellished=void 0;const a=r(5740),n=r(5952),o=r(9268),s=r(5765),l=r(7014),c=r(6887),u=r(5452),p=r(2298);class h extends o.AbstractEnrichCase{constructor(t){super(t),this.fenced=null,this.fencedMml=null,this.fencedMmlNodes=[],this.ofence=null,this.ofenceMml=null,this.ofenceMap={},this.cfence=null,this.cfenceMml=null,this.cfenceMap={},this.parentCleanup=[]}static test(t){return!(!t.mathmlTree||!t.fencePointer||t.mathmlTree.getAttribute("data-semantic-type"))}static makeEmptyNode_(t){const e=a.createElement("mrow"),r=new n.SemanticNode(t);return r.type="empty",r.mathmlTree=e,r}static fencedMap_(t,e){e[t.id]=t.mathmlTree,t.embellished&&h.fencedMap_(t.childNodes[0],e)}getMathml(){return this.getFenced_(),this.fencedMml=u.walkTree(this.fenced),this.getFencesMml_(),"empty"!==this.fenced.type||this.fencedMml.parentNode||(this.fencedMml.setAttribute(p.Attribute.ADDED,"true"),this.cfenceMml.parentNode.insertBefore(this.fencedMml,this.cfenceMml)),this.getFencedMml_(),this.rewrite_()}fencedElement(t){return"fenced"===t.type||"matrix"===t.type||"vector"===t.type}getFenced_(){let t=this.semantic;for(;!this.fencedElement(t);)t=t.childNodes[0];this.fenced=t.childNodes[0],this.ofence=t.contentNodes[0],this.cfence=t.contentNodes[1],h.fencedMap_(this.ofence,this.ofenceMap),h.fencedMap_(this.cfence,this.cfenceMap)}getFencedMml_(){let t=this.ofenceMml.nextSibling;for(t=t===this.fencedMml?t:this.fencedMml;t&&t!==this.cfenceMml;)this.fencedMmlNodes.push(t),t=t.nextSibling}getFencesMml_(){let t=this.semantic;const e=Object.keys(this.ofenceMap),r=Object.keys(this.cfenceMap);for(;!(this.ofenceMml&&this.cfenceMml||t===this.fenced);)-1===e.indexOf(t.fencePointer)||this.ofenceMml||(this.ofenceMml=t.mathmlTree),-1===r.indexOf(t.fencePointer)||this.cfenceMml||(this.cfenceMml=t.mathmlTree),t=t.childNodes[0];this.ofenceMml||(this.ofenceMml=this.ofence.mathmlTree),this.cfenceMml||(this.cfenceMml=this.cfence.mathmlTree),this.ofenceMml&&(this.ofenceMml=u.ascendNewNode(this.ofenceMml)),this.cfenceMml&&(this.cfenceMml=u.ascendNewNode(this.cfenceMml))}rewrite_(){let r=this.semantic,n=null;var t=this.introduceNewLayer_();for((0,p.setAttributes)(t,this.fenced.parent);!this.fencedElement(r);){var e=r.mathmlTree,o=this.specialCase_(r,e);if(o)r=o;else{(0,p.setAttributes)(e,r);const n=[];for(let t,e=1;t=r.childNodes[e];e++)n.push(u.walkTree(t));r=r.childNodes[0]}var o=a.createElement("dummy"),i=e.childNodes[0];a.replaceNode(e,o),a.replaceNode(t,e),a.replaceNode(e.childNodes[0],t),a.replaceNode(o,i),n=n||e}return u.walkTree(this.ofence),u.walkTree(this.cfence),this.cleanupParents_(),n||t}specialCase_(t,e){var r=a.tagName(e);let n,o=null;if("MSUBSUP"===r?(o=t.childNodes[0],n=s.CaseDoubleScript):"MMULTISCRIPTS"===r&&("superscript"===t.type||"subscript"===t.type?n=l.CaseMultiscripts:"tensor"===t.type&&(n=c.CaseTensor),o=n&&t.childNodes[0]&&"subsup"===t.childNodes[0].role?t.childNodes[0]:t),!o)return null;var r=o.childNodes[0],i=h.makeEmptyNode_(r.id);return o.childNodes[0]=i,e=new n(t).getMathml(),o.childNodes[0]=r,this.parentCleanup.push(e),o.childNodes[0]}introduceNewLayer_(){const t=this.fullFence(this.ofenceMml),e=this.fullFence(this.cfenceMml);let r=a.createElement("mrow");if(a.replaceNode(this.fencedMml,r),this.fencedMmlNodes.forEach(t=>r.appendChild(t)),r.insertBefore(t,this.fencedMml),r.appendChild(e),!r.parentNode){const t=a.createElement("mrow");for(;0{for(let e,t=0;e=r[t];t++){const r=n[o];if(r&&e===parseInt(a.getInnerNode(r).getAttribute(s.Attribute.ID)))a.getInnerNode(r).setAttribute(s.Attribute.PARENT,this.semantic.id.toString()),o++;else{const n=this.semantic.querySelectorAll(t=>t.id===e);this.mml.insertBefore(l.createNone_(n[0]),r||null)}}};r(t),n[o]&&"MPRESCRIPTS"!==i.tagName(n[o])?this.mml.insertBefore(n[o],i.createElement("mprescripts")):o++,r(e)}}e.CaseMultiindex=l},7014:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseMultiscripts=void 0;const n=r(5740),i=r(5656),a=r(6839),s=r(5452),l=r(2298);class o extends a.CaseMultiindex{static test(t){return!!t.mathmlTree&&("MMULTISCRIPTS"===n.tagName(t.mathmlTree)&&("superscript"===t.type||"subscript"===t.type))}constructor(t){super(t)}getMathml(){let t,e,r;if((0,l.setAttributes)(this.mml,this.semantic),this.semantic.childNodes[0]&&"subsup"===this.semantic.childNodes[0].role){const n=this.semantic.childNodes[0],o=(t=n.childNodes[0],e=a.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1]),r=a.CaseMultiindex.multiscriptIndex(n.childNodes[1]),[this.semantic.id,[n.id,t.id,r],e]);s.addCollapsedAttribute(this.mml,o),this.mml.setAttribute(l.Attribute.TYPE,n.role),this.completeMultiscript(i.SemanticSkeleton.interleaveIds(r,e),[])}else{t=this.semantic.childNodes[0],e=a.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1]);const r=[this.semantic.id,t.id,e];s.addCollapsedAttribute(this.mml,r)}const n=i.SemanticSkeleton.collapsedLeafs(r||[],e),o=s.walkTree(t);return s.getInnerNode(o).setAttribute(l.Attribute.PARENT,this.semantic.id.toString()),n.unshift(t.id),this.mml.setAttribute(l.Attribute.CHILDREN,n.join(",")),this.mml}}e.CaseMultiscripts=o},3416:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseProof=void 0;const n=r(9268),o=r(5452),i=r(2298);class a extends n.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){return!!t.mathmlTree&&("inference"===t.type||"premises"===t.type)}getMathml(){return this.semantic.childNodes.length&&(this.semantic.contentNodes.forEach(function(t){o.walkTree(t),(0,i.setAttributes)(t.mathmlTree,t)}),this.semantic.childNodes.forEach(function(t){o.walkTree(t)}),(0,i.setAttributes)(this.mml,this.semantic),this.mml.getAttribute("data-semantic-id")===this.mml.getAttribute("data-semantic-parent")&&this.mml.removeAttribute("data-semantic-parent")),this.mml}}e.CaseProof=a},5699:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseTable=void 0;const o=r(5740),n=r(9268),i=r(5452),a=r(2298);class s extends n.AbstractEnrichCase{constructor(t){super(t),this.inner=[],this.mml=t.mathmlTree}static test(t){return"matrix"===t.type||"vector"===t.type||"cases"===t.type}getMathml(){const t=i.cloneContentNode(this.semantic.contentNodes[0]),e=this.semantic.contentNodes[1]?i.cloneContentNode(this.semantic.contentNodes[1]):null;if(this.inner=this.semantic.childNodes.map(i.walkTree),this.mml)if("MFENCED"===o.tagName(this.mml)){var r=this.mml.childNodes;this.mml.insertBefore(t,r[0]||null),e&&this.mml.appendChild(e),this.mml=i.rewriteMfenced(this.mml)}else{const n=[t,this.mml];e&&n.push(e),this.mml=i.introduceNewLayer(n,this.semantic)}else this.mml=i.introduceNewLayer([t].concat(this.inner,[e]),this.semantic);return(0,a.setAttributes)(this.mml,this.semantic),this.mml}}e.CaseTable=s},6887:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseTensor=void 0;const a=r(5656),s=r(6839),l=r(5452),c=r(2298);class n extends s.CaseMultiindex{static test(t){return!!t.mathmlTree&&"tensor"===t.type}constructor(t){super(t)}getMathml(){l.walkTree(this.semantic.childNodes[0]);var t=s.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1]),e=s.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[2]),r=s.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[3]),n=s.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[4]),o=((0,c.setAttributes)(this.mml,this.semantic),[this.semantic.id,this.semantic.childNodes[0].id,t,e,r,n]);l.addCollapsedAttribute(this.mml,o);const i=a.SemanticSkeleton.collapsedLeafs(t,e,r,n);return i.unshift(this.semantic.childNodes[0].id),this.mml.setAttribute(c.Attribute.CHILDREN,i.join(",")),this.completeMultiscript(a.SemanticSkeleton.interleaveIds(r,n),a.SemanticSkeleton.interleaveIds(t,e)),this.mml}}e.CaseTensor=n},9236:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseText=void 0;const n=r(9268),o=r(5452),i=r(2298);class a extends n.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){return"punctuated"===t.type&&("text"===t.role||t.contentNodes.every(t=>"dummy"===t.role))}getMathml(){var t=[],e=o.collapsePunctuated(this.semantic,t);return this.mml=o.introduceNewLayer(t,this.semantic),(0,i.setAttributes)(this.mml,this.semantic),this.mml.removeAttribute(i.Attribute.CONTENT),o.addCollapsedAttribute(this.mml,e),this.mml}}e.CaseText=a},5714:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.prepareMmlString=e.testTranslation__=e.semanticMathml=e.semanticMathmlSync=e.semanticMathmlNode=void 0;const n=r(2057),o=r(5740),i=r(5897),a=r(1414),s=r(5452),l=r(2298);function c(t){var t=o.cloneNode(t),e=a.getTree(t);return s.enrich(t,e)}function u(t){return c(o.parseInput(t))}function p(t){return(t=t.match(/^"+t).match(/\/math>$/)||(t+=""),t}r(1513),e.semanticMathmlNode=c,e.semanticMathmlSync=u,e.semanticMathml=function(e,r){i.EnginePromise.getall().then(()=>{var t=o.parseInput(e);r(c(t))})},e.testTranslation__=function(t){n.Debugger.getInstance().init();t=u(p(t)).toString();return(0,l.removeAttributePrefix)(t),n.Debugger.getInstance().exit(),t},e.prepareMmlString=p},2298:function(t,o){var i,e;function a(t){return t.map(function(t){return t.id}).join(",")}function s(t,e){const r=[];"mglyph"===e.role&&r.push("image"),e.attributes.href&&r.push("link"),r.length&&t.setAttribute(i.POSTFIX,r.join(" "))}Object.defineProperty(o,"__esModule",{value:!0}),o.addPrefix=o.removeAttributePrefix=o.setPostfix=o.setAttributes=o.makeIdList=o.EnrichAttributes=o.Attribute=o.Prefix=void 0,o.Prefix="data-semantic-",(e=i=o.Attribute||(o.Attribute={})).ADDED="data-semantic-added",e.ALTERNATIVE="data-semantic-alternative",e.CHILDREN="data-semantic-children",e.COLLAPSED="data-semantic-collapsed",e.CONTENT="data-semantic-content",e.EMBELLISHED="data-semantic-embellished",e.FENCEPOINTER="data-semantic-fencepointer",e.FONT="data-semantic-font",e.ID="data-semantic-id",e.ANNOTATION="data-semantic-annotation",e.OPERATOR="data-semantic-operator",e.OWNS="data-semantic-owns",e.PARENT="data-semantic-parent",e.POSTFIX="data-semantic-postfix",e.PREFIX="data-semantic-prefix",e.ROLE="data-semantic-role",e.SPEECH="data-semantic-speech",e.STRUCTURE="data-semantic-structure",e.TYPE="data-semantic-type",o.EnrichAttributes=[i.ADDED,i.ALTERNATIVE,i.CHILDREN,i.COLLAPSED,i.CONTENT,i.EMBELLISHED,i.FENCEPOINTER,i.FONT,i.ID,i.ANNOTATION,i.OPERATOR,i.OWNS,i.PARENT,i.POSTFIX,i.PREFIX,i.ROLE,i.SPEECH,i.STRUCTURE,i.TYPE],o.makeIdList=a,o.setAttributes=function(r,t){r.setAttribute(i.TYPE,t.type);var n=t.allAttributes();for(let t,e=0;t=n[e];e++)r.setAttribute(o.Prefix+t[0].toLowerCase(),t[1]);t.childNodes.length&&r.setAttribute(i.CHILDREN,a(t.childNodes)),t.contentNodes.length&&r.setAttribute(i.CONTENT,a(t.contentNodes)),t.parent&&r.setAttribute(i.PARENT,t.parent.id.toString()),s(r,t)},o.setPostfix=s,o.removeAttributePrefix=function(t){return t.toString().replace(new RegExp(o.Prefix,"g"),"")},o.addPrefix=function(t){return o.Prefix+t}},3532:function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.factory=n.getCase=void 0,n.getCase=function(r){for(let t,e=0;t=n.factory[e];e++)if(t.test(r))return t.constr(r);return null},n.factory=[]},1513:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(6061),o=r(5765),i=r(7251),a=r(6265),s=r(6514),l=r(7014),c=r(3416),u=r(5699),p=r(6887),h=r(9236);r(3532).factory.push({test:a.CaseLimit.test,constr:t=>new a.CaseLimit(t)},{test:i.CaseEmbellished.test,constr:t=>new i.CaseEmbellished(t)},{test:o.CaseDoubleScript.test,constr:t=>new o.CaseDoubleScript(t)},{test:p.CaseTensor.test,constr:t=>new p.CaseTensor(t)},{test:l.CaseMultiscripts.test,constr:t=>new l.CaseMultiscripts(t)},{test:s.CaseLine.test,constr:t=>new s.CaseLine(t)},{test:n.CaseBinomial.test,constr:t=>new n.CaseBinomial(t)},{test:c.CaseProof.test,constr:t=>new c.CaseProof(t)},{test:u.CaseTable.test,constr:t=>new u.CaseTable(t)},{test:h.CaseText.test,constr:t=>new h.CaseText(t)})},5452:function(j,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.printNodeList__=r.collapsePunctuated=r.formattedOutput_=r.formattedOutput=r.getInnerNode=r.setOperatorAttribute_=r.createInvisibleOperator_=r.rewriteMfenced=r.cloneContentNode=r.addCollapsedAttribute=r.parentNode_=r.isIgnorable_=r.unitChild_=r.descendNode_=r.ascendNewNode=r.validLca_=r.pathToRoot_=r.attachedElement_=r.prunePath_=r.mathmlLca_=r.lcaType=r.functionApplication_=r.isDescendant_=r.insertNewChild_=r.mergeChildren_=r.collectChildNodes_=r.collateChildNodes_=r.childrenSubset_=r.moveSemanticAttributes_=r.introduceLayerAboveLca=r.introduceNewLayer=r.walkTree=r.enrich=r.SETTINGS=void 0;const i=t(2057),l=t(5740),B=t(5897),D=t(3588),F=t(7516),a=t(5656),s=t(4795),c=t(2298),H=t(3532);function u(t){const e=(0,H.getCase)(t);let r;if(e)return A(r=e.getMathml());if(1===t.mathml.length)return i.Debugger.getInstance().output("Walktree Case 0"),r=t.mathml[0],c.setAttributes(r,t),t.childNodes.length&&(i.Debugger.getInstance().output("Walktree Case 0.1"),t.childNodes.forEach(function(t){"empty"===t.type&&r.appendChild(u(t))})),A(r);var n=t.contentNodes.map(w),o=(I(t,n),t.childNodes.map(u)),n=a.SemanticSkeleton.combineContentChildren(t,n,o);if(null===(r=t.mathmlTree))i.Debugger.getInstance().output("Walktree Case 1"),r=p(n,t);else{const t=M(n);i.Debugger.getInstance().output("Walktree Case 2"),r=t?(i.Debugger.getInstance().output("Walktree Case 2.1"),t.parentNode):(i.Debugger.getInstance().output("Walktree Case 2.2"),P(r))}return y(r=L(r),n,t),c.setAttributes(r,t),A(r)}function p(t,e){const r=S(t);let n=r.node;var o=r.type;if(o!==_.VALID||!s.hasEmptyTag(n))if(i.Debugger.getInstance().output("Walktree Case 1.1"),n=l.createElement("mrow"),o===_.PRUNED)i.Debugger.getInstance().output("Walktree Case 1.1.0"),n=h(n,r.node,t);else if(t[0]){i.Debugger.getInstance().output("Walktree Case 1.1.1");const e=M(t),r=d(e.parentNode,t);l.replaceNode(e,n),r.forEach(function(t){n.appendChild(t)})}return e.mathmlTree||(e.mathmlTree=n),n}function h(e,t,r){let n=C(t);if(s.hasMathTag(n)){i.Debugger.getInstance().output("Walktree Case 1.1.0.0"),o(n,e),l.toArray(n.childNodes).forEach(function(t){e.appendChild(t)});const t=e;e=n,n=t}t=r.indexOf(t);return r[t]=n,l.replaceNode(n,e),e.appendChild(n),r.forEach(function(t){e.appendChild(t)}),e}function o(t,e){for(const r of c.EnrichAttributes)t.hasAttribute(r)&&(e.setAttribute(r,t.getAttribute(r)),t.removeAttribute(r))}function d(t,e){const r=l.toArray(t.childNodes);let n=1/0,o=-1/0;return e.forEach(function(t){t=r.indexOf(t);-1!==t&&(n=Math.min(n,t),o=Math.max(o,t))}),r.slice(n,o+1)}function f(t,e,r){const n=[];let o=l.toArray(t.childNodes),i=!1;for(;o.length;){const t=o.shift();if(t.hasAttribute(c.Attribute.TYPE))n.push(t);else{const e=m(t);0!==e.length&&(1!==e.length?(i?t.setAttribute("AuxiliaryImplicit",!0):i=!0,o=e.concat(o)):n.push(t))}}const a=[],s=r.childNodes.map(function(t){return t.mathmlTree});for(;s.length;){const t=s.pop();if(t){if(-1!==n.indexOf(t))break;-1!==e.indexOf(t)&&a.unshift(t)}}return n.concat(a)}function m(t){const e=[];let r=l.toArray(t.childNodes);for(;r.length;){const t=r.shift();t.nodeType===l.NodeType.ELEMENT_NODE&&(t.hasAttribute(c.Attribute.TYPE)?e.push(t):r=l.toArray(t.childNodes).concat(r))}return e}function y(e,r,n){var o="implicit"===n.role&&F.flags.combine_juxtaposition?f(e,r,n):l.toArray(e.childNodes);if(o.length){let t=0;for(;r.length;){const n=r[0];o[t]===n||v(o[t],n)?(r.shift(),t++):o[t]&&-1===r.indexOf(o[t])?t++:(b(n,e)||g(e,o[t],n),r.shift())}}else r.forEach(function(t){e.appendChild(t)})}function g(r,n,o){if(n){let t=n,e=N(t);for(;e&&e.firstChild===t&&!t.hasAttribute("AuxiliaryImplicit")&&e!==r;)e=N(t=e);e&&(e.insertBefore(o,t),t.removeAttribute("AuxiliaryImplicit"))}else r.insertBefore(o,null)}function b(t,e){if(!t)return!1;do{if((t=t.parentNode)===e)return!0}while(t);return!1}function v(r,n){var t=D.functionApplication();if(r&&n&&r.textContent&&n.textContent&&r.textContent===t&&n.textContent===t&&"true"===n.getAttribute(c.Attribute.ADDED)){for(let t,e=0;t=r.attributes[e];e++)n.hasAttribute(t.nodeName)||n.setAttribute(t.nodeName,t.nodeValue);return l.replaceNode(r,n),!0}return!1}var _;function S(t){var e=M(t);if(!e)return{type:_.INVALID,node:null};var r=M(t.slice().reverse());if(e===r)return{type:_.VALID,node:e};const n=x(e),o=O(n,t),i=x(r,function(t){return-1!==o.indexOf(t)}),a=i[0],s=o.indexOf(a);return-1===s?{type:_.INVALID,node:null}:{type:o.length!==n.length?_.PRUNED:E(o[s+1],i[1])?_.VALID:_.INVALID,node:a}}function O(t,e){let r=0;for(;t[r]&&-1===e.indexOf(t[r]);)r++;return t.slice(0,r+1)}function M(t){let e=0,r=null;for(;!r&&e!1),n=[t];for(;!r(t)&&!s.hasMathTag(t)&&t.parentNode;)t=N(t),n.unshift(t);return n}function E(t,e){return!(!t||!e||t.previousSibling||e.nextSibling)}function A(t){for(;!s.hasMathTag(t)&&e(t);)t=N(t);return t}function C(t){const e=l.toArray(t.childNodes);if(!e)return t;const r=e.filter(function(t){return t.nodeType===l.NodeType.ELEMENT_NODE&&!s.hasIgnoreTag(t)});return 1===r.length&&s.hasEmptyTag(r[0])&&!r[0].hasAttribute(c.Attribute.TYPE)?C(r[0]):t}function e(e){var t=N(e);return!(!t||!s.hasEmptyTag(t))&&l.toArray(t.childNodes).every(function(t){return t===e||T(t)})}function T(t){if(t.nodeType!==l.NodeType.ELEMENT_NODE)return!0;if(!t||s.hasIgnoreTag(t))return!0;var e=l.toArray(t.childNodes);return!(!s.hasEmptyTag(t)&&e.length||s.hasDisplayTag(t)||t.hasAttribute(c.Attribute.TYPE)||s.isOrphanedGlyph(t))&&l.toArray(t.childNodes).every(T)}function N(t){return t.parentNode}function w(t){if(t.mathml.length)return u(t);var e=r.SETTINGS.implicit?n(t):l.createElement("mrow");return t.mathml=[e],e}function L(r){if("MFENCED"!==l.tagName(r))return r;const n=l.createElement("mrow");for(let t,e=0;t=r.attributes[e];e++)-1===["open","close","separators"].indexOf(t.name)&&n.setAttribute(t.name,t.value);return l.toArray(r.childNodes).forEach(function(t){n.appendChild(t)}),l.replaceNode(r,n),n}function n(t){const e=l.createElement("mo"),r=l.createTextNode(t.textContent);return e.appendChild(r),c.setAttributes(e,t),e.setAttribute(c.Attribute.ADDED,"true"),e}function I(t,e){const r=t.type+(t.textContent?","+t.textContent:"");e.forEach(function(t){P(t).setAttribute(c.Attribute.OPERATOR,r)})}function P(t){const r=l.toArray(t.childNodes);if(!r)return t;const n=r.filter(function(t){return!T(t)}),o=[];for(let t,e=0;t=n[e];e++)if(s.hasEmptyTag(t)){const r=P(t);r&&r!==t&&o.push(r)}else o.push(t);return 1===o.length?o[0]:t}function R(t,e,r,n){n=n||!1;k(t,"Original MathML",n),k(r,"Semantic Tree",n),k(e,"Semantically enriched MathML",n)}function k(t,e,r){t=l.formatXml(t.toString());r?console.info(e+":\n```html\n"+c.removeAttributePrefix(t)+"\n```\n"):console.info(t)}r.SETTINGS={collapsed:!0,implicit:!0},r.enrich=function(t,e){const r=l.cloneNode(t);return u(e.root),B.default.getInstance().structure&&t.setAttribute(c.Attribute.STRUCTURE,a.SemanticSkeleton.fromStructure(t,e).toString()),i.Debugger.getInstance().generateOutput(function(){return R(r,t,e,!0),[]}),t},r.walkTree=u,r.introduceNewLayer=p,r.introduceLayerAboveLca=h,r.moveSemanticAttributes_=o,r.childrenSubset_=d,r.collateChildNodes_=f,r.collectChildNodes_=m,r.mergeChildren_=y,r.insertNewChild_=g,r.isDescendant_=b,r.functionApplication_=v,(t=_=r.lcaType||(r.lcaType={})).VALID="valid",t.INVALID="invalid",t.PRUNED="pruned",r.mathmlLca_=S,r.prunePath_=O,r.attachedElement_=M,r.pathToRoot_=x,r.validLca_=E,r.ascendNewNode=A,r.descendNode_=C,r.unitChild_=e,r.isIgnorable_=T,r.parentNode_=N,r.addCollapsedAttribute=function(t,e){const r=new a.SemanticSkeleton(e);t.setAttribute(c.Attribute.COLLAPSED,r.toString())},r.cloneContentNode=w,r.rewriteMfenced=L,r.createInvisibleOperator_=n,r.setOperatorAttribute_=I,r.getInnerNode=P,r.formattedOutput=R,r.formattedOutput_=k,r.collapsePunctuated=function(r,t){const n=!!t,o=t||[],i=r.parent,a=r.contentNodes.map(function(t){return t.id}),s=(a.unshift("c"),[r.id,a]);for(let t,e=0;t=r.childNodes[e];e++){const r=u(t),a=(o.push(r),P(r));i&&!n&&a.setAttribute(c.Attribute.PARENT,i.id.toString()),s.push(t.id)}return s},r.printNodeList__=function(t,e){console.info(t),l.toArray(e).forEach(function(t){console.info(t.toString())}),console.info("<<<<<<<<<<<<<<<<<")}},5105:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractHighlighter=void 0;const n=r(5274),o=r(2298);class i{constructor(){this.color=null,this.mactionName="",this.currentHighlights=[]}highlight(t){this.currentHighlights.push(t.map(t=>{var e=this.highlightNode(t);return this.setHighlighted(t),e}))}highlightAll(t){var r=this.getMactionNodes(t);for(let t,e=0;t=r[e];e++)this.highlight([t])}unhighlight(){const t=this.currentHighlights.pop();t&&t.forEach(t=>{this.isHighlighted(t.node)&&(this.unhighlightNode(t),this.unsetHighlighted(t.node))})}unhighlightAll(){for(;0this.colorize(t))}uncolorizeAll(t){n.evalXPath(`.//*[@${o.Attribute.ID}]`,t).forEach(t=>this.uncolorize(t))}colorize(t){var e=(0,o.addPrefix)("foreground");t.hasAttribute(e)&&(t.setAttribute(e+"-old",t.style.color),t.style.color=t.getAttribute(e))}uncolorize(t){var e=(0,o.addPrefix)("foreground")+"-old";t.hasAttribute(e)&&(t.style.color=t.getAttribute(e))}}(e.AbstractHighlighter=i).ATTR="sre-highlight"},6937:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ChtmlHighlighter=void 0;class n extends r(933).CssHighlighter{constructor(){super()}isMactionNode(t){return t.tagName.toUpperCase()===this.mactionName.toUpperCase()}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}}e.ChtmlHighlighter=n},8396:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ContrastPicker=e.ColorPicker=void 0;const n={red:{red:255,green:0,blue:0},green:{red:0,green:255,blue:0},blue:{red:0,green:0,blue:255},yellow:{red:255,green:255,blue:0},cyan:{red:0,green:255,blue:255},magenta:{red:255,green:0,blue:255},white:{red:255,green:255,blue:255},black:{red:0,green:0,blue:0}};function r(t,e){var t=t||{color:e};let r=Object.prototype.hasOwnProperty.call(t,"color")?n[t.color]:t;return(r=r||n[e]).alpha=Object.prototype.hasOwnProperty.call(t,"alpha")?t.alpha:1,e=r,t=t=>(t=Math.max(t,0),t=Math.min(255,t),Math.round(t)),e.red=t(e.red),e.green=t(e.green),e.blue=t(e.blue),e.alpha=Math.max(e.alpha,0),e.alpha=Math.min(1,e.alpha),e}class o{constructor(t,e){this.foreground=r(e,o.DEFAULT_FOREGROUND_),this.background=r(t,o.DEFAULT_BACKGROUND_)}static toHex(t){t=t.toString(16);return 1===t.length?"0"+t:t}rgba(){function t(t){return"rgba("+t.red+","+t.green+","+t.blue+","+t.alpha+")"}return{background:t(this.background),foreground:t(this.foreground)}}rgb(){function t(t){return"rgb("+t.red+","+t.green+","+t.blue+")"}return{background:t(this.background),alphaback:this.background.alpha.toString(),foreground:t(this.foreground),alphafore:this.foreground.alpha.toString()}}hex(){function t(t){return"#"+o.toHex(t.red)+o.toHex(t.green)+o.toHex(t.blue)}return{background:t(this.background),alphaback:this.background.alpha.toString(),foreground:t(this.foreground),alphafore:this.foreground.alpha.toString()}}}(e.ColorPicker=o).DEFAULT_BACKGROUND_="blue",o.DEFAULT_FOREGROUND_="black",e.ContrastPicker=class{constructor(){this.hue=10,this.sat=100,this.light=50,this.incr=50}generate(){return t=function(t,e,r){e=1 "+this.getRule().action:this.constraint}}},4508:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Trie=void 0;const a=r(4391),i=r(9701);class s{constructor(){this.root=(0,i.getNode)(a.TrieNodeKind.ROOT,"",null)}static collectRules_(t){const e=[];let r=[t];for(;r.length;){const t=r.shift();if(t.getKind()===a.TrieNodeKind.QUERY||t.getKind()===a.TrieNodeKind.BOOLEAN){const r=t.getRule();r&&e.unshift(r)}r=r.concat(t.getChildren())}return e}static printWithDepth_(t,r,n){n+=new Array(r+2).join(r.toString())+": "+t.toString()+"\n";var o=t.getChildren();for(let t,e=0;t=o[e];e++)n=s.printWithDepth_(t,r+1,n);return n}static order_(t){const e=t.getChildren();if(!e.length)return 0;t=Math.max.apply(null,e.map(s.order_));return Math.max(e.length,t)}addRule(t){let r=this.root;var n=t.context,o=t.dynamicCstr.getValues();for(let t=0,e=o.length;t{t.getKind()===a.TrieNodeKind.DYNAMIC&&-1===e.indexOf(t.getConstraint())||n.push(t)});r=n.slice()}for(;r.length;){const t=r.shift();if(t.getRule){const e=t.getRule();e&&n.push(e)}const a=t.findChildren(e);r=r.concat(a)}return n}hasSubtrie(r){let n=this.root;for(let t=0,e=r.length;t!0),this.kind=i.TrieNodeKind.ROOT}}e.RootTrieNode=a;class s extends n.AbstractTrieNode{constructor(e){super(e,t=>t===e),this.kind=i.TrieNodeKind.DYNAMIC}}e.DynamicTrieNode=s;const _={"=":(t,e)=>t===e,"!=":(t,e)=>t!==e,"<":(t,e)=>t":(t,e)=>et<=e,">=":(t,e)=>e<=t};function l(t){if(t.match(/^self::\*$/))return t=>!0;if(t.match(/^self::\w+$/)){const e=t.slice(6).toUpperCase();return t=>t.tagName&&y.tagName(t)===e}if(t.match(/^self::\w+:\w+$/)){const r=t.split(":"),n=g.resolveNameSpace(r[2]);if(!n)return null;const y=r[3].toUpperCase();return t=>t.localName&&t.localName.toUpperCase()===y&&t.namespaceURI===n}if(t.match(/^@\w+$/)){const o=t.slice(1);return t=>t.hasAttribute&&t.hasAttribute(o)}if(t.match(/^@\w+="[\w\d ]+"$/)){const i=t.split("="),a=i[0].slice(1),y=i[1].slice(1,-1);return t=>t.hasAttribute&&t.hasAttribute(a)&&t.getAttribute(a)===y}if(t.match(/^@\w+!="[\w\d ]+"$/)){const s=t.split("!="),l=s[0].slice(1),y=s[1].slice(1,-1);return t=>!t.hasAttribute||!t.hasAttribute(l)||t.getAttribute(l)!==y}if(t.match(/^contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)$/)){const c=t.split('"')[1];return t=>!!b.Grammar.getInstance().getParameter(c)}if(t.match(/^not\(\s*contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)\s*\)$/)){const u=t.split('"')[1];return t=>!b.Grammar.getInstance().getParameter(u)}if(t.match(/^name\(\.\.\/\.\.\)="\w+"$/)){const p=t.split('"')[1].toUpperCase();return t=>{var e;return(null==(e=null==(e=t.parentNode)?void 0:e.parentNode)?void 0:e.tagName)&&y.tagName(t.parentNode.parentNode)===p}}if(t.match(/^count\(preceding-sibling::\*\)=\d+$/)){const h=t.split("="),d=parseInt(h[1],10);return t=>{var e;return(null==(e=t.parentNode)?void 0:e.childNodes[d])===t}}if(t.match(/^.+\[@category!?=".+"\]$/)){let[,r,n,o]=t.match(/^(.+)\[@category(!?=)"(.+)"\]$/);const b=o.match(/^unit:(.+)$/);let i="";return b&&(o=b[1],i=":unit"),t=>{var e=g.evalXPath(r,t)[0];if(e){const t=v.lookupCategory(e.textContent+i);return"="===n?t===o:t!==o}return!1}}if(t.match(/^string-length\(.+\)\W+\d+/)){const[,f,m,y]=t.match(/^string-length\((.+)\)(\W+)(\d+)/),b=_[m]||_["="],v=parseInt(y,10);return t=>{t=g.evalXPath(f,t)[0];return!!t&&b(Array.from(t.textContent).length,v)}}return null}e.constraintTest_=l;class c extends o.StaticTrieNode{constructor(t,e){super(t,l(t)),this.context=e,this.kind=i.TrieNodeKind.QUERY}applyTest(t){return this.test?this.test(t):this.context.applyQuery(t,this.constraint)===t}}e.QueryTrieNode=c;class u extends o.StaticTrieNode{constructor(t,e){super(t,l(t)),this.context=e,this.kind=i.TrieNodeKind.BOOLEAN}applyTest(t){return this.test?this.test(t):this.context.applyConstraint(t,this.constraint)}}e.BooleanTrieNode=u},7491:function(t,i,e){Object.defineProperty(i,"__esModule",{value:!0}),i.completeLocale=i.getLocale=i.setLocale=i.locales=void 0;const a=e(5897),r=e(1377),s=e(2105),n=e(4249),o=e(8657),l=e(173),c=e(9393),u=e(7978),p=e(5540),h=e(5218),d=e(3887),f=e(8384),m=e(7206),y=e(7734),g=e(7264),b=e(4356);function v(){var t=r.Variables.ensureLocale(a.default.getInstance().locale,a.default.getInstance().defaultLocale);return a.default.getInstance().locale=t,i.locales[t]()}i.locales={ca:n.ca,da:o.da,de:l.de,en:c.en,es:u.es,fr:p.fr,hi:h.hi,it:d.it,nb:f.nb,nn:y.nn,sv:g.sv,nemeth:m.nemeth},i.setLocale=function(){var t,e,r=v();if(t=r,e=a.default.getInstance().subiso,-1===t.SUBISO.all.indexOf(e)&&(a.default.getInstance().subiso=t.SUBISO.default),t.SUBISO.current=a.default.getInstance().subiso,r){for(const i of Object.getOwnPropertyNames(r))b.LOCALE[i]=r[i];for(var[n,o]of Object.entries(r.CORRECTIONS))s.Grammar.getInstance().setCorrection(n,o)}},i.getLocale=v,i.completeLocale=function(t){const e=i.locales[t.locale];if(e){var r=t.kind.toUpperCase(),n=t.messages;if(n){const o=e();for(const[t,i]of Object.entries(n))o[r][t]=i}}else console.error("Locale "+t.locale+" does not exist!")}},4356:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.createLocale=e.LOCALE=void 0;const n=r(7549);function o(){return{FUNCTIONS:(0,n.FUNCTIONS)(),MESSAGES:(0,n.MESSAGES)(),ALPHABETS:(0,n.ALPHABETS)(),NUMBERS:(0,n.NUMBERS)(),COMBINERS:{},CORRECTIONS:{},SUBISO:(0,n.SUBISO)()}}e.LOCALE=o(),e.createLocale=o},2536:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.localeFontCombiner=e.extractString=e.localEnclose=e.localRole=e.localFont=e.combinePostfixIndex=e.nestingToString=void 0;const n=r(4356),o=r(4977);function i(t,e){return void 0===t?e:"string"==typeof t?t:t[0]}e.nestingToString=function(t){switch(t){case 1:return n.LOCALE.MESSAGES.MS.ONCE||"";case 2:return n.LOCALE.MESSAGES.MS.TWICE;default:return t.toString()}},e.combinePostfixIndex=function(t,e){return t===n.LOCALE.MESSAGES.MS.ROOTINDEX||t===n.LOCALE.MESSAGES.MS.INDEX?t:t+" "+e},e.localFont=function(t){return i(n.LOCALE.MESSAGES.font[t],t)},e.localRole=function(t){return i(n.LOCALE.MESSAGES.role[t],t)},e.localEnclose=function(t){return i(n.LOCALE.MESSAGES.enclose[t],t)},e.extractString=i,e.localeFontCombiner=function(t){return"string"==typeof t?{font:t,combiner:n.LOCALE.ALPHABETS.combiner}:{font:t[0],combiner:n.LOCALE.COMBINERS[t[1]]||o.Combiners[t[1]]||n.LOCALE.ALPHABETS.combiner}}},4249:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ca=void 0;function n(t,e,r){return t="sans serif "+(r?r+" "+t:t),e?t+" "+e:t}const o=r(4356),i=r(2536),a=r(614),s=r(4977);let l=null;e.ca=function(){return l=l||function(){const t=(0,o.createLocale)();return t.NUMBERS=a.default,t.COMBINERS.sansserif=n,t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.combineRootIndex=i.combinePostfixIndex,t.FUNCTIONS.combineNestedRadical=(t,e,r)=>t+r,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t+" "),t.FUNCTIONS.plural=t=>/.*os$/.test(t)?t+"sos":/.*s$/.test(t)?t+"os":/.*ga$/.test(t)?t.slice(0,-2)+"gues":/.*\xe7a$/.test(t)?t.slice(0,-2)+"ces":/.*ca$/.test(t)?t.slice(0,-2)+"ques":/.*ja$/.test(t)?t.slice(0,-2)+"ges":/.*qua$/.test(t)?t.slice(0,-3)+"qües":/.*a$/.test(t)?t.slice(0,-1)+"es":/.*(e|i)$/.test(t)?t+"ns":/.*\xed$/.test(t)?t.slice(0,-1)+"ins":t+"s",t.FUNCTIONS.si=(t,e)=>(t=e.match(/^metre/)?t.replace(/a$/,"à").replace(/o$/,"ò").replace(/i$/,"í"):t)+e,t.ALPHABETS.combiner=s.Combiners.prefixCombiner,t}()}},8657:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.da=void 0;const n=r(4356),o=r(2536),i=r(3866),a=r(4977);let s=null;e.da=function(){return s=s||function(){const e=(0,n.createLocale)();return e.NUMBERS=i.default,e.FUNCTIONS.radicalNestDepth=o.nestingToString,e.FUNCTIONS.fontRegexp=t=>t===e.ALPHABETS.capPrefix.default?RegExp("^"+t+" "):RegExp(" "+t+"$"),e.ALPHABETS.combiner=a.Combiners.postfixCombiner,e.ALPHABETS.digitTrans.default=i.default.numberToWords,e}()}},173:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.de=void 0;function n(t,e,r){return"s"===r&&(e=e.split(" ").map(function(t){return t.replace(/s$/,"")}).join(" "),r=""),t=r?r+" "+t:t,e?e+" "+t:t}function o(t,e,r){return t=r&&"s"!==r?r+" "+t:t,e?t+" "+e:t}const i=r(2105),a=r(2536),s=r(4356),l=r(1435);let c=null;e.de=function(){return c=c||function(){const e=(0,s.createLocale)();return e.NUMBERS=l.default,e.COMBINERS.germanPostfix=o,e.ALPHABETS.combiner=n,e.FUNCTIONS.radicalNestDepth=t=>1{return t.replace("Wurzel",e?e+"wurzel":"")},e.FUNCTIONS.combineNestedRadical=(t,e,r)=>{e=(e?e+" ":"")+(t=r.match(/exponent$/)?t+"r":t);return r.match(/ /)?r.replace(/ /," "+e+" "):e+" "+r},e.FUNCTIONS.fontRegexp=function(t){return t=t.split(" ").map(function(t){return t.replace(/s$/,"(|s)")}).join(" "),new RegExp("((^"+t+" )|( "+t+"$))")},e.CORRECTIONS.correctOne=t=>t.replace(/^eins$/,"ein"),e.CORRECTIONS.localFontNumber=t=>(0,a.localFont)(t).split(" ").map(function(t){return t.replace(/s$/,"")}).join(" "),e.CORRECTIONS.lowercase=t=>t.toLowerCase(),e.CORRECTIONS.article=t=>{var e=i.Grammar.getInstance().getParameter("case"),r=i.Grammar.getInstance().getParameter("plural");return"dative"===e?{der:"dem",die:r?"den":"der",das:"dem"}[t]:t},e.CORRECTIONS.masculine=t=>"dative"===i.Grammar.getInstance().getParameter("case")?t+"n":t,e}()}},9393:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.en=void 0;const n=r(2105),o=r(4356),i=r(2536),a=r(310),s=r(4977);let l=null;e.en=function(){return l=l||function(){const t=(0,o.createLocale)();return t.NUMBERS=a.default,t.FUNCTIONS.radicalNestDepth=i.nestingToString,t.FUNCTIONS.plural=t=>/.*s$/.test(t)?t:t+"s",t.ALPHABETS.combiner=s.Combiners.prefixCombiner,t.ALPHABETS.digitTrans.default=a.default.numberToWords,t.CORRECTIONS.article=t=>n.Grammar.getInstance().getParameter("noArticle")?"":t,t}()}},7978:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.es=void 0;function n(t,e,r){return t="sans serif "+(r?r+" "+t:t),e?t+" "+e:t}const o=r(4356),i=r(2536),a=r(4634),s=r(4977);let l=null;e.es=function(){return l=l||function(){const t=(0,o.createLocale)();return t.NUMBERS=a.default,t.COMBINERS.sansserif=n,t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.combineRootIndex=i.combinePostfixIndex,t.FUNCTIONS.combineNestedRadical=(t,e,r)=>t+r,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t+" "),t.FUNCTIONS.plural=t=>/.*(a|e|i|o|u)$/.test(t)?t+"s":/.*z$/.test(t)?t.slice(0,-1)+"ces":/.*c$/.test(t)?t.slice(0,-1)+"ques":/.*g$/.test(t)?t+"ues":/.*\u00f3n$/.test(t)?t.slice(0,-2)+"ones":t+"es",t.FUNCTIONS.si=(t,e)=>(t=e.match(/^metro/)?t.replace(/a$/,"á").replace(/o$/,"ó").replace(/i$/,"í"):t)+e,t.ALPHABETS.combiner=s.Combiners.prefixCombiner,t}()}},5540:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.fr=void 0;const n=r(2105),o=r(4356),i=r(2536),a=r(2350),s=r(4977);let l=null;e.fr=function(){return l=l||function(){const t=(0,o.createLocale)();return t.NUMBERS=a.default,t.FUNCTIONS.radicalNestDepth=i.nestingToString,t.FUNCTIONS.combineRootIndex=i.combinePostfixIndex,t.FUNCTIONS.combineNestedFraction=(t,e,r)=>r.replace(/ $/g,"")+e+t,t.FUNCTIONS.combineNestedRadical=(t,e,r)=>r+" "+t,t.FUNCTIONS.fontRegexp=t=>RegExp(" (en |)"+t+"$"),t.FUNCTIONS.plural=t=>/.*s$/.test(t)?t:t+"s",t.CORRECTIONS.article=t=>n.Grammar.getInstance().getParameter("noArticle")?"":t,t.ALPHABETS.combiner=s.Combiners.romanceCombiner,t.SUBISO={default:"fr",current:"fr",all:["fr","be","ch"]},t}()}},5218:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.hi=void 0;const n=r(4356),o=r(4438),i=r(4977),a=r(2536);let s=null;e.hi=function(){return s=s||function(){const t=(0,n.createLocale)();return t.NUMBERS=o.default,t.ALPHABETS.combiner=i.Combiners.prefixCombiner,t.FUNCTIONS.radicalNestDepth=a.nestingToString,t}()}},3887:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.it=void 0;function n(t,e,r){return t.match(/^[a-zA-Z]$/)&&(e=e.replace("cerchiato","cerchiata")),t=r?t+" "+r:t,e?t+" "+e:t}const o=r(2536),i=r(4356),a=r(8825),s=r(4977);let l=null;e.it=function(){return l=l||function(){const t=(0,i.createLocale)();return t.NUMBERS=a.default,t.COMBINERS.italianPostfix=n,t.FUNCTIONS.radicalNestDepth=o.nestingToString,t.FUNCTIONS.combineRootIndex=o.combinePostfixIndex,t.FUNCTIONS.combineNestedFraction=(t,e,r)=>r.replace(/ $/g,"")+e+t,t.FUNCTIONS.combineNestedRadical=(t,e,r)=>r+" "+t,t.FUNCTIONS.fontRegexp=t=>RegExp(" (en |)"+t+"$"),t.ALPHABETS.combiner=s.Combiners.romanceCombiner,t}()}},8384:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.nb=void 0;const n=r(4356),o=r(2536),i=r(8274),a=r(4977);let s=null;e.nb=function(){return s=s||function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.ALPHABETS.combiner=a.Combiners.prefixCombiner,t.ALPHABETS.digitTrans.default=i.default.numberToWords,t.FUNCTIONS.radicalNestDepth=o.nestingToString,t}()}},7206:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.nemeth=void 0;function n(t){return t.match(RegExp("^"+h.ALPHABETS.languagePrefix.english))?t.slice(1):t}function o(t,e,r){return t=n(t),e?t+e:t}function i(t,e,r){return e+n(t)}function a(t,e,r){return e+(r||"")+n(t)+"⠻"}function s(t,e,r){return e+(r||"")+n(t)+"⠻⠻"}function l(t,e,r){return e+n(t)+"⠾"}const c=r(4356),u=r(3720),p=r(4977);let h=null;e.nemeth=function(){return h=h||function(){const t=(0,c.createLocale)();return t.NUMBERS=u.default,t.COMBINERS={postfixCombiner:o,germanCombiner:i,embellishCombiner:a,doubleEmbellishCombiner:s,parensCombiner:l},t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t),t.FUNCTIONS.si=p.identityTransformer,t.ALPHABETS.combiner=(t,e,r)=>e?e+r+t:n(t),t.ALPHABETS.digitTrans={default:u.default.numberToWords},t}()}},7734:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.nn=void 0;const n=r(4356),o=r(2536),i=r(8274),a=r(4977);let s=null;e.nn=function(){return s=s||function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.ALPHABETS.combiner=a.Combiners.prefixCombiner,t.ALPHABETS.digitTrans.default=i.default.numberToWords,t.FUNCTIONS.radicalNestDepth=o.nestingToString,t.SUBISO={default:"",current:"",all:["","alt"]},t}()}},7264:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sv=void 0;const n=r(4356),o=r(2536),i=r(3898),a=r(4977);let s=null;e.sv=function(){return s=s||function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.FUNCTIONS.radicalNestDepth=o.nestingToString,t.FUNCTIONS.fontRegexp=function(t){return new RegExp("((^"+t+" )|( "+t+"$))")},t.ALPHABETS.combiner=a.Combiners.prefixCombiner,t.ALPHABETS.digitTrans.default=i.default.numberToWords,t.CORRECTIONS.correctOne=t=>t.replace(/^ett$/,"en"),t}()}},7549:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SUBISO=e.FUNCTIONS=e.ALPHABETS=e.NUMBERS=e.MESSAGES=void 0;const n=r(4977);e.MESSAGES=function(){return{MS:{},MSroots:{},font:{},embellish:{},role:{},enclose:{},navigate:{},regexp:{},unitTimes:""}},e.NUMBERS=function(){return{zero:"zero",ones:[],tens:[],large:[],special:{},wordOrdinal:n.identityTransformer,numericOrdinal:n.identityTransformer,numberToWords:n.identityTransformer,numberToOrdinal:n.pluralCase,vulgarSep:" ",numSep:" "}},e.ALPHABETS=function(){return{latinSmall:[],latinCap:[],greekSmall:[],greekCap:[],capPrefix:{default:""},smallPrefix:{default:""},digitPrefix:{default:""},languagePrefix:{},digitTrans:{default:n.identityTransformer,mathspeak:n.identityTransformer,clearspeak:n.identityTransformer},letterTrans:{default:n.identityTransformer},combiner:(t,e,r)=>t}},e.FUNCTIONS=function(){return{fracNestDepth:t=>n.vulgarFractionSmall(t,10,100),radicalNestDepth:t=>"",combineRootIndex:function(t,e){return t},combineNestedFraction:n.Combiners.identityCombiner,combineNestedRadical:n.Combiners.identityCombiner,fontRegexp:function(t){return new RegExp("^"+t.split(/ |-/).join("( |-)")+"( |-)")},si:n.siCombiner,plural:n.identityTransformer}},e.SUBISO=function(){return{default:"",current:"",all:[]}}},614:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(2105);function o(t){const n=t%1e3,e=Math.floor(n/100),r=e?1===e?"cent":s.ones[e]+"-cents":"",o=function(){var t=n%100%100;if(t<20)return s.ones[t];var e=Math.floor(t/10),r=s.tens[e],t=s.ones[t%10];return r&&t?r+(2===e?"-i-":"-")+t:r||t}();return r&&o?r+s.numSep+o:r||o}function i(t){if(0===t)return s.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,r="";for(;0=Math.pow(10,36))return t.toString();let r=0,n="";for(;0=Math.pow(10,36))return t.toString();let e=0,r="";for(;0=Math.pow(10,36))return t.toString();let e=0,r="";for(;0=Math.pow(10,36))return t.toString();let e=0,r="";for(;0=Math.pow(10,36))return t.toString();c.special["tens-"+o.default.getInstance().subiso]&&(c.tens=c.special["tens-"+o.default.getInstance().subiso]);let e=0,r="";for(;0=Math.pow(10,32))return r.toString();let t=0,e="";const n=function(){let t=r%1e3%1e3,e="";return e+=a.ones[Math.floor(t/100)]?a.ones[Math.floor(t/100)]+a.numSep+a.special.hundred:"",e=(t%=100)?(e+=e?a.numSep:"")+a.ones[t]:e}();if(!(r=Math.floor(r/1e3)))return n;for(;0=Math.pow(10,36))return t.toString();if(1===t&&n.Grammar.getInstance().getParameter("fraction"))return"un";let e=0,r="";for(;0=Math.pow(10,36))return t.toString();let r=0,n="";for(;0=Math.pow(10,36))return t.toString();let r=0,n="";for(;0=Math.pow(10,36))return t.toString();let r=0,n="";for(;0{t=this.parseCstr(t.toString().replace(o,""));this.addRule(new l.SpeechRule(r,t,e,n))})}else console.error("Action Error: No precondition for action "+r)}getFullPreconditions(t){var e=this.preconditions.get(t);return e||!this.inherits?e:this.inherits.getFullPreconditions(t)}definePrecondition(t,e,r,...n){const o=this.parsePrecondition(r,n),i=this.parseCstr(e);o&&i?(o.rank=this.rank++,this.preconditions.set(t,new s(i,o))):console.error(`Precondition Error: ${r}, (${e})`)}inheritRules(){if(this.inherits&&this.inherits.getSpeechRules().length){const r=new RegExp("^\\w+\\.\\w+\\."+(this.domain?"\\w+\\.":""));this.inherits.getSpeechRules().forEach(t=>{var e=this.parseCstr(t.dynamicCstr.toString().replace(r,""));this.addRule(new l.SpeechRule(t.name,e,t.precondition,t.action))})}}ignoreRules(e,...r){let n=this.findAllRules(t=>t.name===e);if(r.length){let t=[];for(const e of r){const r=this.parseCstr(e);for(const e of n)r.equal(e.dynamicCstr)?this.deleteRule(e):t.push(e);n=t,t=[]}}else n.forEach(this.deleteRule.bind(this))}parsePrecondition_(t){const e=this.context.customGenerators.lookup(t);return e?e():[t]}}e.BaseRuleStore=a;class s{constructor(t,e){this.base=t,this._conditions=[],this.constraints=[],this.allCstr={},this.constraints.push(t),this.addCondition(t,e)}get conditions(){return this._conditions}addConstraint(e){if(!this.constraints.filter(t=>t.equal(e)).length){this.constraints.push(e);const n=[];for(var[t,r]of this.conditions)this.base.equal(t)&&n.push([e,r]);this._conditions=this._conditions.concat(n)}}addBaseCondition(t){this.addCondition(this.base,t)}addFullCondition(e){this.constraints.forEach(t=>this.addCondition(t,e))}addCondition(t,e){var r=t.toString()+" "+e.toString();this.allCstr.condStr||(this.allCstr[r]=!0,this._conditions.push([t,e]))}}e.Condition=s},2469:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.BrailleStore=void 0;const n=r(7630),o=r(9935);class i extends o.MathStore{constructor(){super(...arguments),this.modality="braille",this.customTranscriptions={"⋊":"⠈⠡⠳"}}evaluateString(t){const e=[],r=Array.from(t);for(let t=0;te.push(this.getProperty(t).slice())),e}toString(){const e=[];return this.order.forEach(t=>e.push(t+": "+this.getProperty(t).toString())),e.join("\n")}}class s extends(e.DynamicProperties=a){constructor(t,e){const r={};for(const[e,n]of Object.entries(t))r[e]=[n];super(r,e),this.components=t}static createCstr(...n){const o=s.DEFAULT_ORDER,i={};for(let t=0,e=n.length,r=o.length;t{t=e.indexOf(t);return-1!==t&&e.splice(t,1)})}getComponents(){return this.components}getValue(t){return this.components[t]}getValues(){return this.order.map(t=>this.getValue(t))}allProperties(){const n=super.allProperties();for(let t,e,r=0;t=n[r],e=this.order[r];r++){const n=this.getValue(e);-1===t.indexOf(n)&&t.unshift(n)}return n}toString(){return this.getValues().join(".")}equal(r){const n=r.getAxes();if(this.order.length!==n.length)return!1;for(let t,e=0;t=n[e];e++){const n=this.getValue(t);if(!n||r.getValue(t)!==n)return!1}return!0}}(e.DynamicCstr=s).DEFAULT_ORDER=[r.LOCALE,r.MODALITY,r.DOMAIN,r.STYLE,r.TOPIC],s.BASE_LOCALE="base",s.DEFAULT_VALUE="default",s.DEFAULT_VALUES={[r.LOCALE]:"en",[r.DOMAIN]:s.DEFAULT_VALUE,[r.STYLE]:s.DEFAULT_VALUE,[r.TOPIC]:s.DEFAULT_VALUE,[r.MODALITY]:"speech"},e.DynamicCstrParser=class{constructor(t){this.order=t}parse(t){const r=t.split("."),n={};if(r.length>this.order.length)throw new Error("Invalid dynamic constraint: "+n);let o=0;for(let t,e=0;t=this.order[e],r.length;e++,o++){const o=r.shift();n[t]=o}return new s(n,this.order.slice(0,o))}},e.DefaultComparator=class{constructor(t,e=new a(t.getProperties(),t.getOrder())){this.reference=t,this.fallback=e,this.order=this.reference.getOrder()}getReference(){return this.reference}setReference(t,e){this.reference=t,this.fallback=e||new a(t.getProperties(),t.getOrder()),this.order=this.reference.getOrder()}match(r){const t=r.getAxes();return t.length===this.reference.getAxes().length&&t.every(t=>{var e=r.getValue(t);return e===this.reference.getValue(t)||-1!==this.fallback.getProperty(t).indexOf(e)})}compare(r,n){let o=!1;for(let t,e=0;t=this.order[e];e++){var i=r.getValue(t),a=n.getValue(t);if(!o){const r=this.reference.getValue(t);if(r===i&&r!==a)return-1;if(r===a&&r!==i)return 1;if(r===i&&r===a)continue;r!==i&&r!==a&&(o=!0)}const s=this.fallback.getProperty(t),l=s.indexOf(i),c=s.indexOf(a);if(l!p.equal(t.cstr))).push(r),this.rules.set(e,s),h.setReference(d)}lookupRule(t,e){let r=this.getRules(e.getValue(n.Axis.LOCALE));return 1===(r=r.filter(function(t){return o.testDynamicConstraints_(e,t)})).length?r[0]:r.length?r.sort((t,e)=>f.default.getInstance().comparator.compare(t.cstr,e.cstr))[0]:null}}e.MathSimpleStore=o},9935:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MathStore=void 0;const a=r(707),s=r(4356),n=r(7630),o=r(4504),l=r(4650);class i extends o.BaseRuleStore{constructor(){super(),this.annotators=[],this.parseMethods.Alias=this.defineAlias,this.parseMethods.SpecializedRule=this.defineSpecializedRule,this.parseMethods.Specialized=this.defineSpecialized}initialize(){this.initialized||(this.annotations(),this.initialized=!0)}annotations(){for(let t,e=0;t=this.annotators[e];e++)(0,n.activate)(this.domain,t)}defineAlias(t,e,...r){var n=this.parsePrecondition(e,r);if(n){const o=this.preconditions.get(t);o?o.addFullCondition(n):console.error("Alias Error: No precondition by the name of "+t)}else console.error(`Precondition Error: ${e} `+r)}defineRulesAlias(e,r,...n){const t=this.findAllRules(function(t){return t.name===e});if(0===t.length)throw new l.OutputError("Rule with name "+e+" does not exist.");const o=[];t.forEach(t=>{(t=>{var r=t.dynamicCstr.toString(),n=t.action.toString();for(let t,e=0;t=o[e];e++)if(t.action===n&&t.cstr===r)return!1;return o.push({cstr:r,action:n}),!0})(t)&&this.addAlias_(t,r,n)})}defineSpecializedRule(e,t,r,n){const o=this.parseCstr(t),i=this.findRule(t=>t.name===e&&o.equal(t.dynamicCstr)),a=this.parseCstr(r);if(!i&&n)throw new l.OutputError("Rule named "+e+" with style "+t+" does not exist.");r=n?l.Action.fromString(n):i.action,t=new l.SpeechRule(i.name,a,i.precondition,r);this.addRule(t)}defineSpecialized(t,e,r){var n=this.parseCstr(r);if(n){const o=this.preconditions.get(t);o?o.addConstraint(n):console.error("Alias Error: No precondition by the name of "+t)}else console.error("Dynamic Constraint Error: "+r)}evaluateString(r){const n=[];if(r.match(/^\s+$/))return n;let o=this.matchNumber_(r);if(o&&o.length===r.length)return n.push(this.evaluateCharacter(o.number)),n;var i=a.removeEmpty(r.replace(/\s/g," ").split(" "));for(let e,t=0;e=i[t];t++)if(1===e.length)n.push(this.evaluateCharacter(e));else if(e.match(new RegExp("^["+s.LOCALE.MESSAGES.regexp.TEXT+"]+$")))n.push(this.evaluateCharacter(e));else{let t=e;for(;t;){o=this.matchNumber_(t);const r=t.match(new RegExp("^["+s.LOCALE.MESSAGES.regexp.TEXT+"]+"));if(o)n.push(this.evaluateCharacter(o.number)),t=t.substring(o.length);else if(r)n.push(this.evaluateCharacter(r[0])),t=t.substring(r[0].length);else{const r=Array.from(t),o=r[0];n.push(this.evaluateCharacter(o)),t=r.slice(1).join("")}}}return n}parse(t){super.parse(t),this.annotators=t.annotators||[]}addAlias_(t,e,r){const n=this.parsePrecondition(e,r),o=new l.SpeechRule(t.name,t.dynamicCstr,n,t.action);o.name=t.name,this.addRule(o)}matchNumber_(t){const e=t.match(new RegExp("^"+s.LOCALE.MESSAGES.regexp.NUMBER)),r=t.match(new RegExp("^"+i.regexp.NUMBER));if(!e&&!r)return null;var n=r&&r[0]===t;return e&&e[0]===t||!n?e?{number:e[0],length:e[0].length}:null:{number:r[0].replace(new RegExp(i.regexp.DIGIT_GROUP,"g"),"X").replace(new RegExp(i.regexp.DECIMAL_MARK,"g"),s.LOCALE.MESSAGES.regexp.DECIMAL_MARK).replace(/X/g,s.LOCALE.MESSAGES.regexp.DIGIT_GROUP.replace(/\\/g,"")),length:r[0].length}}}(e.MathStore=i).regexp={NUMBER:"((\\d{1,3})(?=(,| ))((,| )\\d{3})*(\\.\\d+)?)|^\\d*\\.\\d+|^\\d+",DECIMAL_MARK:"\\.",DIGIT_GROUP:","}},4650:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.OutputError=e.Precondition=e.Action=e.Component=e.ActionType=e.SpeechRule=void 0;const n=r(5897),s=r(2105);var o;e.SpeechRule=class{constructor(t,e,r,n){this.name=t,this.dynamicCstr=e,this.precondition=r,this.action=n,this.context=null}toString(){return this.name+" | "+this.dynamicCstr.toString()+" | "+this.precondition.toString()+" ==> "+this.action.toString()}},(r=o=e.ActionType||(e.ActionType={})).NODE="NODE",r.MULTI="MULTI",r.TEXT="TEXT",r.PERSONALITY="PERSONALITY";class l{constructor({type:t,content:e,attributes:r,grammar:n}){this.type=t,this.content=e,this.attributes=r,this.grammar=n}static grammarFromString(t){return s.Grammar.parseInput(t)}static fromString(t){const e={type:function(t){switch(t){case"[n]":return o.NODE;case"[m]":return o.MULTI;case"[t]":return o.TEXT;case"[p]":return o.PERSONALITY;default:throw"Parse error: "+t}}(t.substring(0,3))};let r=t.slice(3).trim();if(!r)throw new c("Missing content.");switch(e.type){case o.TEXT:if('"'===r[0]){const t=u(r,"\\(")[0].trim();if('"'!==t.slice(-1))throw new c("Invalid string syntax.");e.content=t,-1===(r=r.slice(t.length).trim()).indexOf("(")&&(r="");break}case o.NODE:case o.MULTI:{const t=r.indexOf(" (");if(-1===t){e.content=r.trim(),r="";break}e.content=r.substring(0,t).trim(),r=r.slice(t).trim()}}if(r){const t=l.attributesFromString(r);t.grammar&&(e.grammar=t.grammar,delete t.grammar),Object.keys(t).length&&(e.attributes=t)}return new l(e)}static attributesFromString(r){if("("!==r[0]||")"!==r.slice(-1))throw new c("Invalid attribute expression: "+r);const n={},o=u(r.slice(1,-1),",");for(let t=0,e=o.length;tc.Debugger.getInstance().output(t,e.context.applyConstraint(r,t)))}static debugNamedSpeechRule(r,n){var o=g.getInstance().trie.collectRules().filter(t=>t.name==r);for(let t,e=0;t=o[e];e++)c.Debugger.getInstance().output("Rule",r,"DynamicCstr:",t.dynamicCstr.toString(),"number",e),g.debugSpeechRule(t,n)}evaluateNode(t){(0,h.updateEvaluator)(t);var e=(new Date).getTime();let r=[];try{r=this.evaluateNode_(t)}catch(t){console.error("Something went wrong computing speech."),c.Debugger.getInstance().output(t)}var n=(new Date).getTime();return c.Debugger.getInstance().output("Time:",n-e),r}toString(){return this.trie.collectRules().map(t=>t.toString()).join("\n")}runInSetting(t,e){const r=u.default.getInstance(),n={};for(const e in t)n[e]=r[e],r[e]=t[e];r.setDynamicCstr();e=e();for(const t in n)r[t]=n[t];return r.setDynamicCstr(),e}addStore(t){const e=v(t);"abstract"!==e.kind&&e.getSpeechRules().forEach(t=>this.trie.addRule(t)),this.addEvaluator(e)}processGrammar(t,e,r){const n={};for(const i in r){var o=r[i];n[i]="string"==typeof o?t.constructString(e,o):o}f.Grammar.getInstance().pushState(n)}addEvaluator(t){const e=t.evaluateDefault.bind(t),r=this.evaluators_[t.locale];if(r)r[t.modality]=e;else{const n={};n[t.modality]=e,this.evaluators_[t.locale]=n}}getEvaluator(t,e){t=this.evaluators_[t]||this.evaluators_[l.DynamicCstr.DEFAULT_VALUES[l.Axis.LOCALE]];return t[e]||t[l.DynamicCstr.DEFAULT_VALUES[l.Axis.MODALITY]]}enumerate(t){return this.trie.enumerate(t)}evaluateNode_(t){return t?(this.updateConstraint_(),this.evaluateTree_(t)):[]}evaluateTree_(o){const i=u.default.getInstance();let a;c.Debugger.getInstance().output(i.mode!==p.Mode.HTTP?o.toString():o),f.Grammar.getInstance().setAttribute(o);const s=this.lookupRule(o,i.dynamicCstr);if(!s)return i.strict?[]:(a=this.getEvaluator(i.locale,i.modality)(o),o.attributes&&this.addPersonality_(a,{},!1,o),a);c.Debugger.getInstance().generateOutput(()=>["Apply Rule:",s.name,s.dynamicCstr.toString(),(i.mode,p.Mode.HTTP,o.toString())]);const l=s.context,e=s.action.components;a=[];for(let n,t=0;n=e[t];t++){let t=[];const s=n.content||"",p=n.attributes||{};let e=!1,r=(n.grammar&&this.processGrammar(l,o,n.grammar),null);if(p.engine){r=u.default.getInstance().dynamicCstr.getComponents();const o=f.Grammar.parseInput(p.engine);u.default.getInstance().setDynamicCstr(o)}switch(n.type){case m.ActionType.NODE:{const i=l.applyQuery(o,s);i&&(t=this.evaluateTree_(i))}break;case m.ActionType.MULTI:{e=!0;const i=l.applySelector(o,s);0e.map(t=>t.name+"("+t.dynamicCstr.toString()+")")).bind(this)),e[0]}}e.SpeechRuleEngine=g;const b=new Map;function v(t){var e=`${t.locale}.${t.modality}.`+t.domain;if("actions"===t.kind){const r=b.get(e);return r.parse(t),r}i.init(),t&&!t.functions&&(t.functions=o.getStore(t.locale,t.modality,t.domain));const r=new("braille"===t.modality?a.BrailleStore:s.MathStore);return b.set(e,r),t.inherits&&(r.inherits=b.get(`${t.inherits}.${t.modality}.`+t.domain)),r.parse(t),r.initialize(),r}e.storeFactory=v,u.default.nodeEvaluator=g.getInstance().evaluateNode.bind(g.getInstance())},5662:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CustomGenerators=e.ContextFunctions=e.CustomStrings=e.CustomQueries=void 0;class r{constructor(t,e){this.prefix=t,this.store=e}add(t,e){this.checkCustomFunctionSyntax_(t)&&(this.store[t]=e)}addStore(r){var n=Object.keys(r.store);for(let t,e=0;t=n[e];e++)this.add(t,r.store[t])}lookup(t){return this.store[t]}checkCustomFunctionSyntax_(t){var e=new RegExp("^"+this.prefix);return!!t.match(e)||(console.error("FunctionError: Invalid function name. Expected prefix "+this.prefix),!1)}}e.CustomQueries=class extends r{constructor(){super("CQF",{})}},e.CustomStrings=class extends r{constructor(){super("CSF",{})}},e.ContextFunctions=class extends r{constructor(){super("CTF",{})}},e.CustomGenerators=class extends r{constructor(){super("CGF",{})}}},365:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.contentIterator=e.pauseSeparator=e.nodeCounter=void 0;const i=r(7052),a=r(5274),s=r(5897);e.nodeCounter=function(t,e){const r=t.length;let n=0,o=e?e:"";return function(){return n","≁","≂","≄","≆","≇","≉","≏","≐","≠","≢","≤","≥","≦","≧","≨","≩","≪","≫","≬","≭","≮","≯","≰","≱","≲","≳","≴","≵","≶","≷","≸","≹","≺","≻","≼","≽","≾","≿","⊀","⊁","⋖","⋗","⋘","⋙","⋚","⋛","⋜","⋝","⋞","⋟","⋠","⋡","⋦","⋧","⋨","⋩","⩹","⩺","⩻","⩼","⩽","⩾","⩿","⪀","⪁","⪂","⪃","⪄","⪅","⪆","⪇","⪈","⪉","⪊","⪋","⪌","⪍","⪎","⪏","⪐","⪑","⪒","⪓","⪔","⪕","⪖","⪗","⪘","⪙","⪚","⪛","⪜","⪝","⪞","⪟","⪠","⪡","⪢","⪣","⪤","⪥","⪦","⪧","⪨","⪩","⪪","⪫","⪬","⪭","⪮","⪯","⪰","⪱","⪲","⪳","⪴","⪵","⪶","⪷","⪸","⪹","⪺","⪻","⪼","⫷","⫸","⫹","⫺","⧀","⧁","﹤","﹥","<",">"],type:"relation",role:"inequality"},{set:["⋢","⋣","⋤","⋥","⊂","⊃","⊄","⊅","⊆","⊇","⊈","⊉","⊊","⊋","⊏","⊐","⊑","⊒","⪽","⪾","⪿","⫀","⫁","⫂","⫃","⫄","⫅","⫆","⫇","⫈","⫉","⫊","⫋","⫌","⫍","⫎","⫏","⫐","⫑","⫒","⫓","⫔","⫕","⫖","⫗","⫘","⋐","⋑","⋪","⋫","⋬","⋭","⊲","⊳","⊴","⊵"],type:"relation",role:"set"},{set:["⊢","⊣","⊦","⊧","⊨","⊩","⊪","⊫","⊬","⊭","⊮","⊯","⫞","⫟","⫠","⫡","⫢","⫣","⫤","⫥","⫦","⫧","⫨","⫩","⫪","⫫","⫬","⫭"],type:"relation",role:"unknown"},{set:["←","↑","→","↓","↔","↕","↖","↗","↘","↙","↚","↛","↜","↝","↞","↟","↠","↡","↢","↣","↤","↥","↦","↧","↨","↩","↪","↫","↬","↭","↮","↯","↰","↱","↲","↳","↴","↵","↶","↷","↸","↹","↺","↻","⇄","⇅","⇆","⇇","⇈","⇉","⇊","⇍","⇎","⇏","⇐","⇑","⇒","⇓","⇔","⇕","⇖","⇗","⇘","⇙","⇚","⇛","⇜","⇝","⇞","⇟","⇠","⇡","⇢","⇣","⇤","⇥","⇦","⇧","⇨","⇩","⇪","⇫","⇬","⇭","⇮","⇯","⇰","⇱","⇲","⇳","⇴","⇵","⇶","⇷","⇸","⇹","⇺","⇻","⇼","⇽","⇾","⇿","⌁","⌃","⌄","⌤","⎋","➔","➘","➙","➚","➛","➜","➝","➞","➟","➠","➡","➢","➣","➤","➥","➦","➧","➨","➩","➪","➫","➬","➭","➮","➯","➱","➲","➳","➴","➵","➶","➷","➸","➹","➺","➻","➼","➽","➾","⟰","⟱","⟲","⟳","⟴","⟵","⟶","⟷","⟸","⟹","⟺","⟻","⟼","⟽","⟾","⟿","⤀","⤁","⤂","⤃","⤄","⤅","⤆","⤇","⤈","⤉","⤊","⤋","⤌","⤍","⤎","⤏","⤐","⤑","⤒","⤓","⤔","⤕","⤖","⤗","⤘","⤙","⤚","⤛","⤜","⤝","⤞","⤟","⤠","⤡","⤢","⤣","⤤","⤥","⤦","⤧","⤨","⤩","⤪","⤭","⤮","⤯","⤰","⤱","⤲","⤳","⤴","⤵","⤶","⤷","⤸","⤹","⤺","⤻","⤼","⤽","⤾","⤿","⥀","⥁","⥂","⥃","⥄","⥅","⥆","⥇","⥈","⥉","⥰","⥱","⥲","⥳","⥴","⥵","⥶","⥷","⥸","⥹","⥺","⥻","⦳","⦴","⦽","⧪","⧬","⧭","⨗","⬀","⬁","⬂","⬃","⬄","⬅","⬆","⬇","⬈","⬉","⬊","⬋","⬌","⬍","⬎","⬏","⬐","⬑","⬰","⬱","⬲","⬳","⬴","⬵","⬶","⬷","⬸","⬹","⬺","⬻","⬼","⬽","⬾","⬿","⭀","⭁","⭂","⭃","⭄","⭅","⭆","⭇","⭈","⭉","⭊","⭋","⭌","←","↑","→","↓","↼","↽","↾","↿","⇀","⇁","⇂","⇃","⇋","⇌","⥊","⥋","⥌","⥍","⥎","⥏","⥐","⥑","⥒","⥓","⥔","⥕","⥖","⥗","⥘","⥙","⥚","⥛","⥜","⥝","⥞","⥟","⥠","⥡","⥢","⥣","⥤","⥥","⥦","⥧","⥨","⥩","⥪","⥫","⥬","⥭","⥮","⥯","⥼","⥽","⥾","⥿"],type:"relation",role:"arrow"},{set:["∈","∊","⋲","⋳","⋴","⋵","⋶","⋷","⋸","⋹","⋿"],type:"operator",role:"element"},{set:["∉"],type:"operator",role:"nonelement"},{set:["∋","∍","⋺","⋻","⋼","⋽","⋾"],type:"operator",role:"reelement"},{set:["∌"],type:"operator",role:"renonelement"},{set:["⅀","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨃","⨄","⨅","⨆","⨇","⨈","⨉","⨊","⨋","⫼","⫿"],type:"largeop",role:"sum"},{set:["∫","∬","∭","∮","∯","∰","∱","∲","∳","⨌","⨍","⨎","⨏","⨐","⨑","⨒","⨓","⨔","⨕","⨖","⨗","⨘","⨙","⨚","⨛","⨜"],type:"largeop",role:"integral"},{set:["∟","∠","∡","∢","⊾","⊿","△","▷","▽","◁"],type:"operator",role:"geometry"},{set:["inf","lim","liminf","limsup","max","min","sup","injlim","projlim","inj lim","proj lim"],type:"function",role:"limit function"},{set:bt,type:"function",role:"prefix function"},{set:["mod","rem"],type:"operator",role:"prefix function"}],R=function(){const r={};for(let e,t=0;e=vt[t];t++)e.set.forEach(function(t){r[t]={role:e.role||"unknown",type:e.type||"unknown",font:e.font||"unknown"}});return r}(),_t=(t.equal=function(t,e){return t.type===e.type&&t.role===e.role&&t.font===e.font},t.lookupType=function(t){return(null==(t=R[t])?void 0:t.type)||"unknown"},t.lookupRole=function(t){return(null==(t=R[t])?void 0:t.role)||"unknown"},t.lookupMeaning=function(t){return R[t]||{role:"unknown",type:"unknown",font:"unknown"}},t.invisibleTimes=function(){return mt},t.invisiblePlus=function(){return dt},t.invisibleComma=function(){return e},t.functionApplication=function(){return yt},t.isMatchingFence=function(t,e){return-1!==s.indexOf(t)||-1!==l.indexOf(t)?t===e:o[t]===e||i[t]===e},t.isEmbellishedType=function(t){return"operator"===t||"relation"===t||"fence"===t||"punctuation"===t},new Map);function k(t,e,r=""){for(const n of e)_t.set(t+" "+n,r||t)}k("d",["d","ⅆ","d","𝐝","𝑑","𝒹","𝓭","𝔡","𝕕","𝖉","𝖽","𝗱","𝘥","𝚍"]),k("bar",r),k("tilde",n),t.lookupSecondary=function(t,e){return _t.get(t+" "+e)}},8158:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticMeaningCollator=e.SemanticNodeCollator=e.SemanticDefault=void 0;const n=r(3588),o=r(3882);class i{constructor(){this.map={}}static key(t,e){return e?t+":"+e:t}add(t,e){this.map[i.key(t,e.font)]=e}addNode(t){this.add(t.textContent,t.meaning())}retrieve(t,e){return this.map[i.key(t,e)]}retrieveNode(t){return this.retrieve(t.textContent,t.font)}size(){return Object.keys(this.map).length}}e.SemanticDefault=i;class a{constructor(){this.map={}}add(t,e){const r=this.map[t];r?r.push(e):this.map[t]=[e]}retrieve(t,e){return this.map[i.key(t,e)]}retrieveNode(t){return this.retrieve(t.textContent,t.font)}copy(){const t=this.copyCollator();for(const e in this.map)t.map[e]=this.map[e];return t}minimize(){for(const t in this.map)1===this.map[t].length&&delete this.map[t]}minimalCollator(){const t=this.copy();for(const e in t.map)1===t.map[e].length&&delete t.map[e];return t}isMultiValued(){for(const t in this.map)if(1!1){this.name=t,this.apply=e,this.applicable=r}}e.SemanticAbstractHeuristic=r,e.SemanticTreeHeuristic=class extends r{},e.SemanticMultiHeuristic=class extends r{}},7516:function(t,o){Object.defineProperty(o,"__esModule",{value:!0}),o.lookup=o.run=o.add=o.blacklist=o.flags=o.updateFactory=o.factory=void 0,o.factory=null,o.updateFactory=function(t){o.factory=t};const r=new Map;function i(t){return r.get(t)}o.flags={combine_juxtaposition:!0,convert_juxtaposition:!0,multioperator:!0},o.blacklist={},o.add=function(t){var e=t.name;r.set(e,t),o.flags[e]||(o.flags[e]=!1)},o.run=function(t,e,r){const n=i(t);return n&&!o.blacklist[t]&&(o.flags[t]||n.applicable(e))?n.apply(e):r?r(e):e},o.lookup=i},94:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const c=r(2057),n=r(5897),i=r(3588),u=r(7516),o=r(9911),p=r(5609),l=r(3308),a=r(4795);function s(t,e,r){let n=null;if(!t.length)return n;const o=r[r.length-1],i=o&&o.length,a=e&&e.length,s=l.default.getInstance();if(i&&a){if("infixop"===e[0].type&&"implicit"===e[0].role)return n=t.pop(),o.push(s.postfixNode_(o.pop(),t)),n;n=t.shift();const r=s.prefixNode_(e.shift(),t);return e.unshift(r),n}return i?o.push(s.postfixNode_(o.pop(),t)):a&&e.unshift(s.prefixNode_(e.shift(),t)),n}u.add(new o.SemanticTreeHeuristic("combine_juxtaposition",function(r){for(let t,e=r.childNodes.length-1;t=r.childNodes[e];e--)p.isImplicitOp(t)&&!t.nobreaking&&(r.childNodes.splice(e,1,...t.childNodes),r.contentNodes.splice(e,0,...t.contentNodes),t.childNodes.concat(t.contentNodes).forEach(function(t){t.parent=r}),r.addMathmlNodes(t.mathml));return r})),u.add(new o.SemanticTreeHeuristic("propagateSimpleFunction",t=>("infixop"!==t.type&&"fraction"!==t.type||!t.childNodes.every(p.isSimpleFunction)||(t.role="composed function"),t),t=>"clearspeak"===n.default.getInstance().domain)),u.add(new o.SemanticTreeHeuristic("simpleNamedFunction",t=>("unit"!==t.role&&-1!==["f","g","h","F","G","H"].indexOf(t.textContent)&&(t.role="simple function"),t),t=>"clearspeak"===n.default.getInstance().domain)),u.add(new o.SemanticTreeHeuristic("propagateComposedFunction",t=>("fenced"===t.type&&"composed function"===t.childNodes[0].role&&(t.role="composed function"),t),t=>"clearspeak"===n.default.getInstance().domain)),u.add(new o.SemanticTreeHeuristic("multioperator",t=>{var e;"unknown"!==t.role||t.textContent.length<=1||(e=[...t.textContent].map(i.lookupMeaning).reduce(function(t,e){return t&&e.role&&"unknown"!==e.role&&e.role!==t?"unknown"===t?e.role:null:t},"unknown"))&&(t.role=e)})),u.add(new o.SemanticMultiHeuristic("convert_juxtaposition",n=>{let o=a.partitionNodes(n,function(t){return t.textContent===i.invisibleTimes()&&"operator"===t.type});n=(o=o.rel.length?function(t){const e=[],r=[];let n=t.comp.shift(),o=null,i=[];for(;t.comp.length;)if(i=[],n.length)o&&e.push(o),r.push(n),o=t.rel.shift(),n=t.comp.shift();else{for(o&&i.push(o);!n.length&&t.comp.length;)n=t.comp.shift(),i.push(t.rel.shift());o=s(i,n,r)}return i.length||n.length?(e.push(o),r.push(n)):(i.push(o),s(i,n,r)),{rel:e,comp:r}}(o):o).comp[0];for(let t,e,r=1;t=o.comp[r],e=o.rel[r-1];r++)n.push(e),n=n.concat(t);return(o=a.partitionNodes(n,function(t){return t.textContent===i.invisibleTimes()&&("operator"===t.type||"infixop"===t.type)})).rel.length?function t(e,r,n){if(!r.length)return e;const o=e.pop(),i=r.shift(),a=n.shift();if(p.isImplicitOp(i)){c.Debugger.getInstance().output("Juxta Heuristic Case 2");const u=(o?[o,i]:[i]).concat(a);return t(e.concat(u),r,n)}if(!o)return c.Debugger.getInstance().output("Juxta Heuristic Case 3"),t([i].concat(a),r,n);const s=a.shift();if(!s){c.Debugger.getInstance().output("Juxta Heuristic Case 9");const a=u.factory.makeBranchNode("infixop",[o,r.shift()],[i],i.textContent);return a.role="implicit",u.run("combine_juxtaposition",a),r.unshift(a),t(e,r,n)}if(p.isOperator(o)||p.isOperator(s))return c.Debugger.getInstance().output("Juxta Heuristic Case 4"),t(e.concat([o,i,s]).concat(a),r,n);let l=null;return p.isImplicitOp(o)&&p.isImplicitOp(s)?(c.Debugger.getInstance().output("Juxta Heuristic Case 5"),o.contentNodes.push(i),o.contentNodes=o.contentNodes.concat(s.contentNodes),o.childNodes.push(s),o.childNodes=o.childNodes.concat(s.childNodes),s.childNodes.forEach(t=>t.parent=o),(i.parent=o).addMathmlNodes(i.mathml),o.addMathmlNodes(s.mathml),l=o):p.isImplicitOp(o)?(c.Debugger.getInstance().output("Juxta Heuristic Case 6"),o.contentNodes.push(i),o.childNodes.push(s),s.parent=o,(i.parent=o).addMathmlNodes(i.mathml),o.addMathmlNodes(s.mathml),l=o):p.isImplicitOp(s)?(c.Debugger.getInstance().output("Juxta Heuristic Case 7"),s.contentNodes.unshift(i),s.childNodes.unshift(o),o.parent=s,(i.parent=s).addMathmlNodes(i.mathml),s.addMathmlNodes(o.mathml),l=s):(c.Debugger.getInstance().output("Juxta Heuristic Case 8"),(l=u.factory.makeBranchNode("infixop",[o,s],[i],i.textContent)).role="implicit"),e.push(l),t(e.concat(a),r,n)}(o.comp.shift(),o.rel,o.comp):n})),u.add(new o.SemanticTreeHeuristic("simple2prefix",t=>(1"braille"===n.default.getInstance().modality&&"identifier"===t.type)),u.add(new o.SemanticTreeHeuristic("detect_cycle",t=>{t.type="matrix",t.role="cycle";const e=t.childNodes[0];return e.type="row",e.role="cycle",e.textContent="",e.contentNodes=[],t},t=>"fenced"===t.type&&"infixop"===t.childNodes[0].type&&"implicit"===t.childNodes[0].role&&t.childNodes[0].childNodes.every(function(t){return"number"===t.type})&&t.childNodes[0].contentNodes.every(function(t){return"space"===t.role})))},7228:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticMathml=void 0;const c=r(5740),n=r(5250),o=r(5609),u=r(3308),p=r(4795);class i extends n.SemanticAbstractParser{constructor(){super("MathML"),this.parseMap_={SEMANTICS:this.semantics_.bind(this),MATH:this.rows_.bind(this),MROW:this.rows_.bind(this),MPADDED:this.rows_.bind(this),MSTYLE:this.rows_.bind(this),MFRAC:this.fraction_.bind(this),MSUB:this.limits_.bind(this),MSUP:this.limits_.bind(this),MSUBSUP:this.limits_.bind(this),MOVER:this.limits_.bind(this),MUNDER:this.limits_.bind(this),MUNDEROVER:this.limits_.bind(this),MROOT:this.root_.bind(this),MSQRT:this.sqrt_.bind(this),MTABLE:this.table_.bind(this),MLABELEDTR:this.tableLabeledRow_.bind(this),MTR:this.tableRow_.bind(this),MTD:this.tableCell_.bind(this),MS:this.text_.bind(this),MTEXT:this.text_.bind(this),MSPACE:this.space_.bind(this),"ANNOTATION-XML":this.text_.bind(this),MI:this.identifier_.bind(this),MN:this.number_.bind(this),MO:this.operator_.bind(this),MFENCED:this.fenced_.bind(this),MENCLOSE:this.enclosed_.bind(this),MMULTISCRIPTS:this.multiscripts_.bind(this),ANNOTATION:this.empty_.bind(this),NONE:this.empty_.bind(this),MACTION:this.action_.bind(this)};const e={type:"identifier",role:"numbersetletter",font:"double-struck"};["C","H","N","P","Q","R","Z","ℂ","ℍ","ℕ","ℙ","ℚ","ℝ","ℤ"].forEach((t=>this.getFactory().defaultMap.add(t,e)).bind(this))}static getAttribute_(t,e,r){if(!t.hasAttribute(e))return r;const n=t.getAttribute(e);return n.match(/^\s*$/)?null:n}parse(t){u.default.getInstance().setNodeFactory(this.getFactory());const e=c.toArray(t.childNodes),r=c.tagName(t),n=this.parseMap_[r],o=(n||this.dummy_.bind(this))(t,e);return p.addAttributes(o,t),-1===["MATH","MROW","MPADDED","MSTYLE","SEMANTICS"].indexOf(r)&&(o.mathml.unshift(t),o.mathmlTree=t),o}semantics_(t,e){return e.length?this.parse(e[0]):this.getFactory().makeEmptyNode()}rows_(t,e){const r=t.getAttribute("semantics");if(r&&r.match("bspr_"))return u.default.proof(t,r,this.parseList.bind(this));let n;return 1===(e=p.purgeNodes(e)).length?"empty"!==(n=this.parse(e[0])).type||n.mathmlTree||(n.mathmlTree=t):n=u.default.getInstance().row(this.parseList(e)),n.mathml.unshift(t),n}fraction_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();var r=this.parse(e[0]),e=e[1]?this.parse(e[1]):this.getFactory().makeEmptyNode();return u.default.getInstance().fractionLikeNode(r,e,t.getAttribute("linethickness"),"true"===t.getAttribute("bevelled"))}limits_(t,e){return u.default.getInstance().limitNode(c.tagName(t),this.parseList(e))}root_(t,e){return e[1]?this.getFactory().makeBranchNode("root",[this.parse(e[1]),this.parse(e[0])],[]):this.sqrt_(t,e)}sqrt_(t,e){e=this.parseList(p.purgeNodes(e));return this.getFactory().makeBranchNode("sqrt",[u.default.getInstance().row(e)],[])}table_(t,e){const r=t.getAttribute("semantics");if(r&&r.match("bspr_"))return u.default.proof(t,r,this.parseList.bind(this));const n=this.getFactory().makeBranchNode("table",this.parseList(e),[]);return n.mathmlTree=t,u.default.tableToMultiline(n),n}tableRow_(t,e){const r=this.getFactory().makeBranchNode("row",this.parseList(e),[]);return r.role="table",r}tableLabeledRow_(t,e){if(!e.length)return this.tableRow_(t,e);const r=this.parse(e[0]),n=(r.role="label",this.getFactory().makeBranchNode("row",this.parseList(e.slice(1)),[r]));return n.role="table",n}tableCell_(t,e){e=this.parseList(p.purgeNodes(e)),e=e.length?1===e.length&&o.isType(e[0],"empty")?e:[u.default.getInstance().row(e)]:[];const r=this.getFactory().makeBranchNode("cell",e,[]);return r.role="table",r}space_(t,e){const r=t.getAttribute("width"),n=r&&r.match(/[a-z]*$/);if(!n)return this.empty_(t,e);var o=n[0],i=parseFloat(r.slice(0,n.index)),o={cm:.4,pc:.5,em:.5,ex:1,in:.15,pt:5,mm:5}[o];if(!o||isNaN(i)||it.parent=e),"CONTENT"===n.tagName(r)?e.contentNodes=t:e.childNodes=t}}querySelectorAll(r){let n=[];for(let t,e=0;t=this.childNodes[e];e++)n=n.concat(t.querySelectorAll(r));for(let t,e=0;t=this.contentNodes[e];e++)n=n.concat(t.querySelectorAll(r));return r(this)&&n.unshift(this),n}xml(o,i){function t(t,e){const r=e.map(function(t){return t.xml(o,i)}),n=o.createElementNS("",t);for(let t,e=0;t=r[e];e++)n.appendChild(t);return n}const e=o.createElementNS("",this.type);return i||this.xmlAttributes(e),e.textContent=this.textContent,0");return n.serializeXml(this.xml(e,t))}allAttributes(){const t=[];return t.push(["role",this.role]),"unknown"!==this.font&&t.push(["font",this.font]),Object.keys(this.annotation).length&&t.push(["annotation",this.xmlAnnotation()]),this.embellished&&t.push(["embellished",this.embellished]),this.fencePointer&&t.push(["fencepointer",this.fencePointer]),t.push(["id",this.id.toString()]),t}xmlAnnotation(){const e=[];for(const r in this.annotation)this.annotation[r].forEach(function(t){e.push(r+":"+t)});return e.join(";")}toJson(){const r={};r.type=this.type;var n=this.allAttributes();for(let t,e=0;t=n[e];e++)r[t[0]]=t[1].toString();return this.textContent&&(r.$t=this.textContent),this.childNodes.length&&(r.children=this.childNodes.map(function(t){return t.toJson()})),this.contentNodes.length&&(r.content=this.contentNodes.map(function(t){return t.toJson()})),r}updateContent(t,e){var e=e?t.replace(/^[ \f\n\r\t\v\u200b]*/,"").replace(/[ \f\n\r\t\v\u200b]*$/,""):t.trim();this.textContent!==(t=t&&!e?t:e)&&(e=(0,o.lookupMeaning)(t),this.textContent=t,this.role=e.role,this.type=e.type,this.font=e.font)}addMathmlNodes(r){for(let t,e=0;t=r[e];e++)-1===this.mathml.indexOf(t)&&this.mathml.push(t)}appendChild(t){this.childNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this}replaceChild(e,r){var t,n=this.childNodes.indexOf(e);-1!==n&&(e.parent=null,(r.parent=this).childNodes[n]=r,n=e.mathml.filter(function(t){return-1===r.mathml.indexOf(t)}),t=r.mathml.filter(function(t){return-1===e.mathml.indexOf(t)}),this.removeMathmlNodes(n),this.addMathmlNodes(t))}appendContentNode(t){t&&(this.contentNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this)}removeContentNode(t){t&&-1!==(t=this.contentNodes.indexOf(t))&&this.contentNodes.slice(t,1)}equals(n){if(!n)return!1;if(this.type!==n.type||this.role!==n.role||this.textContent!==n.textContent||this.childNodes.length!==n.childNodes.length||this.contentNodes.length!==n.contentNodes.length)return!1;for(let t,e,r=0;t=this.childNodes[r],e=n.childNodes[r];r++)if(!t.equals(e))return!1;for(let t,e,r=0;t=this.contentNodes[r],e=n.contentNodes[r];r++)if(!t.equals(e))return!1;return!0}displayTree(){console.info(this.displayTree_(0))}addAnnotation(t,e){e&&this.addAnnotation_(t,e)}getAnnotation(t){return this.annotation[t]||[]}hasAnnotation(t,e){const r=this.annotation[t];return!!r&&-1!==r.indexOf(e)}parseAnnotation(t){const r=t.split(";");for(let t=0,e=r.length;ti(t,"infixop")))return!1}return!0},n.isPrefixFunctionBoundary=function(t){return c(t)&&!s(t,"division")||i(t,"appl")||l(t)},n.isBigOpBoundary=function(t){return c(t)||l(t)},n.isIntegralDxBoundary=function(t,e){return!!e&&i(e,"identifier")&&r.lookupSecondary("d",t.textContent)},n.isIntegralDxBoundarySingle=function(t){var e;return!!i(t,"identifier")&&((e=t.textContent[0])&&t.textContent[1]&&r.lookupSecondary("d",e))},n.isGeneralFunctionBoundary=l,n.isEmbellished=function(t){return t.embellished||(r.isEmbellishedType(t.type)?t.type:null)},n.isOperator=c,n.isRelation=u,n.isPunctuation=p,n.isFence=h,n.isElligibleEmbellishedFence=function(t){return!(!t||!h(t))&&(!t.embellished||function t(e){return!e.embellished||!(i(e,"tensor")&&(!i(e.childNodes[1],"empty")||!i(e.childNodes[2],"empty"))&&(!i(e.childNodes[3],"empty")||!i(e.childNodes[4],"empty")))&&(!s(e,"close")||!i(e,"tensor"))&&(!s(e,"open")||!i(e,"subscript")&&!i(e,"superscript"))&&t(e.childNodes[0])}(t))},n.isTableOrMultiline=d,n.tableIsMatrixOrVector=function(t){return!!t&&f(t)&&d(t.childNodes[0])},n.isFencedElement=f,n.tableIsCases=function(t,e){return 0=r)){const o=n.childNodes[0].role;"unknown"!==o&&t.childNodes.every(function(t){t=t.childNodes[0];return!t||t.role===o&&(c.isType(t,"relation")||c.isType(t,"relseq"))})&&(t.role=o)}}static classifyTable(t){var e=y.computeColumns_(t);y.classifyByColumns_(t,e,"equality")||y.classifyByColumns_(t,e,"inequality",["equality"])||y.classifyByColumns_(t,e,"arrow")||y.detectCaleyTable(t)}static detectCaleyTable(t){if(!t.mathmlTree)return!1;const e=t.mathmlTree,r=e.getAttribute("columnlines"),n=e.getAttribute("rowlines");return!(!r||!n||!y.cayleySpacing(r)||!y.cayleySpacing(n)||(t.role="cayley",0))}static cayleySpacing(t){const e=t.split(" ");return("solid"===e[0]||"dashed"===e[0])&&e.slice(1).every(t=>"none"===t)}static proof(t,e,r){e=y.separateSemantics(e);return y.getInstance().proof(t,e,r)}static findSemantics(t,e,r){r=null==r?null:r,t=y.getSemantics(t);return!(!t||!t[e]||null!=r&&t[e]!==r)}static getSemantics(t){t=t.getAttribute("semantics");return t?y.separateSemantics(t):null}static removePrefix(t){const[,...e]=t.split("_");return e.join("_")}static separateSemantics(t){const r={};return t.split(";").forEach(function(t){var[t,e]=t.split(":");r[y.removePrefix(t)]=e}),r}static matchSpaces_(r,n){for(let t,e=0;t=n[e];e++){const n=r[e].mathmlTree,i=r[e+1].mathmlTree;var o;n&&i&&((o=n.nextSibling)&&o!==i&&(o=y.getSpacer_(o))&&(t.mathml.push(o),t.mathmlTree=o,t.role="space"))}}static getSpacer_(t){if("MSPACE"===m.tagName(t))return t;for(;u.hasEmptyTag(t)&&1===t.childNodes.length;)if(t=t.childNodes[0],"MSPACE"===m.tagName(t))return t;return null}static fenceToPunct_(t){var e=y.FENCE_TO_PUNCT_[t.role];if(e){for(;t.embellished;)t.embellished="punctuation",c.isRole(t,"subsup")||c.isRole(t,"underover")||(t.role=e),t=t.childNodes[0];t.type="punctuation",t.role=e}}static classifyFunction_(e,r){if("appl"===e.type||"bigop"===e.type||"integral"===e.type)return"";if(r[0]&&r[0].textContent===s.functionApplication()){y.getInstance().funcAppls[e.id]=r.shift();let t="simple function";return o.run("simple2prefix",e),"prefix function"!==e.role&&"limit function"!==e.role||(t=e.role),y.propagateFunctionRole_(e,t),"prefix"}return y.CLASSIFY_FUNCTION_[e.role]||(c.isSimpleFunctionHead(e)?"simple":"")}static propagateFunctionRole_(t,e){t&&"infixop"!==t.type&&(c.isRole(t,"subsup")||c.isRole(t,"underover")||(t.role=e),y.propagateFunctionRole_(t.childNodes[0],e))}static getFunctionOp_(r,n){if(n(r))return r;for(let t,e=0;t=r.childNodes[e];e++){const r=y.getFunctionOp_(t,n);if(r)return r}return null}static tableToMatrixOrVector_(t){const r=t.childNodes[0];c.isType(r,"multiline")?y.tableToVector_(t):y.tableToMatrix_(t),t.contentNodes.forEach(r.appendContentNode.bind(r));for(let t,e=0;t=r.childNodes[e];e++)y.assignRoleToRow_(t,y.getComponentRoles_(r));return r.parent=null,r}static tableToVector_(t){const e=t.childNodes[0];e.type="vector",1!==e.childNodes.length?y.binomialForm_(e):y.tableToSquare_(t)}static binomialForm_(t){c.isBinomial(t)&&(t.role="binomial",t.childNodes[0].role="binomial",t.childNodes[1].role="binomial")}static tableToMatrix_(t){const e=t.childNodes[0];e.type="matrix",e.childNodes&&0t.match(/[^\s]/)),r=e.map(s.lookupMeaning);if(r.every(function(t){return"number"===t.type&&"integer"===t.role||"punctuation"===t.type&&"comma"===t.role}))return t.role="integer",void("0"===e[0]&&t.addAnnotation("general","basenumber"));r.every(function(t){return"number"===t.type&&"integer"===t.role||"punctuation"===t.type})?t.role="float":t.role="othernumber"}}static exprFont_(t){var e;"unknown"===t.font&&(e=[...t.textContent].map(s.lookupMeaning).reduce(function(t,e){return t&&e.font&&"unknown"!==e.font&&e.font!==t?"unknown"===t?e.font:null:t},"unknown"))&&(t.font=e)}static purgeFences_(e){const r=e.rel,n=e.comp,o=[],i=[];for(;0y.isPureRelation_(t,r))||2===e.length&&(y.testColumns_(e,1,t=>y.isEndRelation_(t,r)||y.isPureRelation_(t,r))||y.testColumns_(e,0,t=>y.isEndRelation_(t,r,!0)||y.isPureRelation_(t,r))))&&(t.role=r,!0)}static isEndRelation_(t,e,r){r=r?t.childNodes.length-1:0;return c.isType(t,"relseq")&&c.isRole(t,e)&&c.isType(t.childNodes[r],"empty")}static isPureRelation_(t,e){return c.isType(t,"relation")&&c.isRole(t,e)}static computeColumns_(e){const n=[];for(let r,t=0;r=e.childNodes[t];t++)for(let t,e=0;t=r.childNodes[e];e++)n[e]?n[e].push(t):n[e]=[t];return n}static testColumns_(t,e,r){const n=t[e];return!!n&&n.some(function(t){return t.childNodes.length&&r(t.childNodes[0])})&&n.every(function(t){return!t.childNodes.length||r(t.childNodes[0])})}setNodeFactory(t){y.getInstance().factory_=t,o.updateFactory(y.getInstance().factory_)}getNodeFactory(){return y.getInstance().factory_}identifierNode(t,e,r){if("MathML-Unit"===r)t.type="identifier",t.role="unit";else if(!e&&1===t.textContent.length&&("integer"===t.role||"latinletter"===t.role||"greekletter"===t.role)&&"normal"===t.font)return t.font="italic",o.run("simpleNamedFunction",t);return"unknown"===t.type&&(t.type="identifier"),y.exprFont_(t),o.run("simpleNamedFunction",t)}implicitNode(t){if(t=y.getInstance().getMixedNumbers_(t),1===(t=y.getInstance().combineUnits_(t)).length)return t[0];t=y.getInstance().implicitNode_(t);return o.run("combine_juxtaposition",t)}text(t,e){return y.exprFont_(t),t.type="text","MS"===e?t.role="string":"MSPACE"!==e&&!t.textContent.match(/^\s*$/)||(t.role="space"),t}row(t){return 0===(t=t.filter(function(t){return!c.isType(t,"empty")})).length?y.getInstance().factory_.makeEmptyNode():(t=y.getInstance().getFencesInRow_(t),t=y.getInstance().tablesInRow(t),t=y.getInstance().getPunctuationInRow_(t),t=y.getInstance().getTextInRow_(t),t=y.getInstance().getFunctionsInRow_(t),y.getInstance().relationsInRow_(t))}limitNode(t,e){if(!e.length)return y.getInstance().factory_.makeEmptyNode();let r,n=e[0],o="unknown";if(!e[1])return n;if(c.isLimitBase(n)){var i=(r=y.MML_TO_LIMIT_[t]).length;if(o=r.type,e=e.slice(0,r.length+1),1===i&&c.isAccent(e[1])||2===i&&c.isAccent(e[1])&&c.isAccent(e[2]))return r=y.MML_TO_BOUNDS_[t],y.getInstance().accentNode_(n,e,r.type,r.length,r.accent);if(2===i){if(c.isAccent(e[1]))return n=y.getInstance().accentNode_(n,[n,e[1]],{MSUBSUP:"subscript",MUNDEROVER:"underscore"}[t],1,!0),e[2]?y.getInstance().makeLimitNode_(n,[n,e[2]],null,"limupper"):n;if(e[2]&&c.isAccent(e[2]))return n=y.getInstance().accentNode_(n,[n,e[2]],{MSUBSUP:"superscript",MUNDEROVER:"overscore"}[t],1,!0),y.getInstance().makeLimitNode_(n,[n,e[1]],null,"limlower");e[i]||(o="limlower")}return y.getInstance().makeLimitNode_(n,e,null,o)}return r=y.MML_TO_BOUNDS_[t],y.getInstance().accentNode_(n,e,r.type,r.length,r.accent)}tablesInRow(t){let r=u.partitionNodes(t,c.tableIsMatrixOrVector),n=[];for(let t,e=0;t=r.rel[e];e++)(n=n.concat(r.comp.shift())).push(y.tableToMatrixOrVector_(t));n=n.concat(r.comp.shift()),r=u.partitionNodes(n,c.isTableOrMultiline),n=[];for(let t,e=0;t=r.rel[e];e++){const o=r.comp.shift();c.tableIsCases(t,o)&&y.tableToCases_(t,o.pop()),(n=n.concat(o)).push(t)}return n.concat(r.comp.shift())}mfenced(e,r,t,n){if(t&&0{r.push(y.getInstance().factory_.makeContentNode(e())),r.push(t)}),n=r}return e&&r?y.getInstance().horizontalFencedNode_(y.getInstance().factory_.makeContentNode(e),y.getInstance().factory_.makeContentNode(r),n):(e&&n.unshift(y.getInstance().factory_.makeContentNode(e)),r&&n.push(y.getInstance().factory_.makeContentNode(r)),y.getInstance().row(n))}fractionLikeNode(t,e,r,n){let o;if(n||!u.isZeroLength(r))return o=y.getInstance().fractionNode_(t,e),n&&o.addAnnotation("general","bevelled"),o;{const r=y.getInstance().factory_.makeBranchNode("line",[t],[]),n=y.getInstance().factory_.makeBranchNode("line",[e],[]);return o=y.getInstance().factory_.makeBranchNode("multiline",[r,n],[]),y.binomialForm_(o),y.classifyMultiline(o),o}}tensor(t,e,r,n,o){const i=y.getInstance().factory_.makeBranchNode("tensor",[t,y.getInstance().scriptNode_(e,"leftsub"),y.getInstance().scriptNode_(r,"leftsuper"),y.getInstance().scriptNode_(n,"rightsub"),y.getInstance().scriptNode_(o,"rightsuper")],[]);return i.role=t.role,i.embellished=c.isEmbellished(t),i}pseudoTensor(t,e,r){var n=t=>!c.isType(t,"empty"),o=e.filter(n).length,n=r.filter(n).length;if(!o&&!n)return t;const i=o?n?"MSUBSUP":"MSUB":"MSUP",a=[t];return o&&a.push(y.getInstance().scriptNode_(e,"rightsub",!0)),n&&a.push(y.getInstance().scriptNode_(r,"rightsuper",!0)),y.getInstance().limitNode(i,a)}font(t){return y.MATHJAX_FONTS[t]||t}proof(t,e,r){if(e.inference||e.axiom||console.log("Noise"),e.axiom){const e=y.getInstance().cleanInference(t.childNodes),n=e.length?y.getInstance().factory_.makeBranchNode("inference",r(e),[]):y.getInstance().factory_.makeEmptyNode();return n.role="axiom",n.mathmlTree=t,n}const n=y.getInstance().inference(t,e,r);return e.proof&&(n.role="proof",n.childNodes[0].role="final"),n}inference(t,e,r){if(e.inferenceRule){const e=y.getInstance().getFormulas(t,[],r);return y.getInstance().factory_.makeBranchNode("inference",[e.conclusion,e.premises],[])}const n=e.labelledRule,o=m.toArray(t.childNodes),i=[],a=("left"!==n&&"both"!==n||i.push(y.getInstance().getLabel(t,o,r,"left")),"right"!==n&&"both"!==n||i.push(y.getInstance().getLabel(t,o,r,"right")),y.getInstance().getFormulas(t,o,r)),s=y.getInstance().factory_.makeBranchNode("inference",[a.conclusion,a.premises],i);return s.mathmlTree=t,s}getLabel(t,e,r,n){const o=y.getInstance().findNestedRow(e,"prooflabel",n),i=y.getInstance().factory_.makeBranchNode("rulelabel",r(m.toArray(o.childNodes)),[]);return i.role=n,i.mathmlTree=o,i}getFormulas(t,e,r){const n=e.length?y.getInstance().findNestedRow(e,"inferenceRule"):t,o="up"===y.getSemantics(n).inferenceRule,i=o?n.childNodes[1]:n.childNodes[0],a=o?n.childNodes[0]:n.childNodes[1],s=i.childNodes[0].childNodes[0],l=m.toArray(s.childNodes[0].childNodes),c=[];let u=1;for(const t of l)u%2&&c.push(t.childNodes[0]),u++;const p=r(c),h=r(m.toArray(a.childNodes[0].childNodes))[0],d=y.getInstance().factory_.makeBranchNode("premises",p,[]),f=(d.mathmlTree=s,y.getInstance().factory_.makeBranchNode("conclusion",[h],[]));return f.mathmlTree=a.childNodes[0].childNodes[0],{conclusion:f,premises:d}}findNestedRow(t,e,r){return y.getInstance().findNestedRow_(t,e,0,r)}cleanInference(t){return m.toArray(t).filter(function(t){return"MSPACE"!==m.tagName(t)})}operatorNode(t){return"unknown"===t.type&&(t.type="operator"),o.run("multioperator",t)}implicitNode_(t){const e=y.getInstance().factory_.makeMultipleContentNodes(t.length-1,s.invisibleTimes()),r=(y.matchSpaces_(t,e),y.getInstance().infixNode_(t,e[0]));return r.role="implicit",e.forEach(function(t){t.parent=r}),r.contentNodes=e,r}infixNode_(t,e){const r=y.getInstance().factory_.makeBranchNode("infixop",t,[e],u.getEmbellishedInner(e).textContent);return r.role=e.role,o.run("propagateSimpleFunction",r)}explicitMixed_(r){var n=u.partitionNodes(r,function(t){return t.textContent===s.invisiblePlus()});if(!n.rel.length)return r;let o=[];for(let t,e=0;t=n.rel[e];e++){const s=n.comp[e],i=n.comp[e+1],a=s.length-1;if(s[a]&&i[0]&&c.isType(s[a],"number")&&!c.isRole(s[a],"mixed")&&c.isType(i[0],"fraction")){const r=y.getInstance().factory_.makeBranchNode("number",[s[a],i[0]],[]);r.role="mixed",(o=o.concat(s.slice(0,a))).push(r),i.shift()}else(o=o.concat(s)).push(t)}return o.concat(n.comp[n.comp.length-1])}concatNode_(t,e,r){if(0===e.length)return t;const n=e.map(function(t){return u.getEmbellishedInner(t).textContent}).join(" "),o=y.getInstance().factory_.makeBranchNode(r,[t],e,n);return 1c.isRole(t,"subtraction"));let n=y.getInstance().concatNode_(t,r.comp.pop(),"prefixop");for(1===n.contentNodes.length&&"addition"===n.contentNodes[0].role&&"+"===n.contentNodes[0].textContent&&(n.role="positive");0c.isType(t,"text"));if(0===r.rel.length)return t;const n=[];let o=r.comp[0];0c.isRole(t,"open");if(0===t.length){const t=n.shift();for(;0{t=t.type;return"punctuation"===t||"text"===t||"operator"===t||"relation"===t},t=u.partitionNodes(r,function(t){if(!c.isPunctuation(t))return!1;if(c.isPunctuation(t)&&!c.isRole(t,"ellipsis"))return!0;t=r.indexOf(t);if(0===t)return!r[1]||!n(r[1]);var e=r[t-1];if(t===r.length-1)return!n(e);t=r[t+1];return!n(e)||!n(t)});if(0===t.rel.length)return r;const e=[];let o=t.comp.shift(),i=(0c.isRole(t,"dummy"))?r.role="text":t.every(t=>c.isRole(t,"space"))?r.role="space":r.role="sequence",r}dummyNode_(t){const e=y.getInstance().factory_.makeMultipleContentNodes(t.length-1,s.invisibleComma());return e.forEach(function(t){t.role="dummy"}),y.getInstance().punctuatedNode_(t,e)}accentRole_(t,e){if(!c.isAccent(t))return!1;var r=t.textContent,r=s.lookupSecondary("bar",r)||s.lookupSecondary("tilde",r)||t.role;return t.role="underscore"===e?"underaccent":"overaccent",t.addAnnotation("accent",r),!0}accentNode_(t,e,r,n,o){var i=(e=e.slice(0,n+1))[1],a=e[2];let s;if(!o&&a&&((s=y.getInstance().factory_.makeBranchNode("subscript",[t,i],[])).role="subsup",e=[s,a],r="superscript"),o){const n=y.getInstance().accentRole_(i,r);a&&(r=y.getInstance().accentRole_(a,"overscore")&&!n?(e=[s=y.getInstance().factory_.makeBranchNode("overscore",[t,a],[]),i],"underscore"):(e=[s=y.getInstance().factory_.makeBranchNode("underscore",[t,i],[]),a],"overscore"),s.role="underover")}return y.getInstance().makeLimitNode_(t,e,s,r)}makeLimitNode_(t,e,r,n){if("limupper"===n&&"limlower"===t.type)return t.childNodes.push(e[1]),(e[1].parent=t).type="limboth",t;if("limlower"===n&&"limupper"===t.type)return t.childNodes.splice(1,-1,e[1]),(e[1].parent=t).type="limboth",t;const o=y.getInstance().factory_.makeBranchNode(n,e,[]),i=c.isEmbellished(t);return r&&(r.embellished=i),o.embellished=i,o.role=t.role,o}getFunctionsInRow_(t,e){const r=e||[];if(0===t.length)return r;var e=t.shift(),n=y.classifyFunction_(e,t);if(!n)return r.push(e),y.getInstance().getFunctionsInRow_(t,r);t=y.getInstance().getFunctionsInRow_(t,[]),e=y.getInstance().getFunctionArgs_(e,t,n);return r.concat(e)}getFunctionArgs_(t,e,r){let n,o,i;switch(r){case"integral":{const r=y.getInstance().getIntegralArgs_(e);if(!r.intvar&&!r.integrand.length)return r.rest.unshift(t),r.rest;const n=y.getInstance().row(r.integrand);return i=y.getInstance().integralNode_(t,n,r.intvar),r.rest.unshift(i),r.rest}case"prefix":if(e[0]&&"fenced"===e[0].type){const r=e.shift();return c.isNeutralFence(r)||(r.role="leftright"),i=y.getInstance().functionNode_(t,r),e.unshift(i),e}if((n=u.sliceNodes(e,c.isPrefixFunctionBoundary)).head.length)o=y.getInstance().row(n.head),n.div&&n.tail.unshift(n.div);else{if(!n.div||!c.isType(n.div,"appl"))return e.unshift(t),e;o=n.div}return i=y.getInstance().functionNode_(t,o),n.tail.unshift(i),n.tail;case"bigop":return(n=u.sliceNodes(e,c.isBigOpBoundary)).head.length?(o=y.getInstance().row(n.head),i=y.getInstance().bigOpNode_(t,o),n.div&&n.tail.unshift(n.div),n.tail.unshift(i),n.tail):(e.unshift(t),e);default:{if(0===e.length)return[t];const r=e[0];return"fenced"===r.type&&!c.isNeutralFence(r)&&c.isSimpleFunctionScope(r)?(r.role="leftright",y.propagateFunctionRole_(t,"simple function"),i=y.getInstance().functionNode_(t,e.shift()),e.unshift(i)):e.unshift(t),e}}}getIntegralArgs_(t,e=[]){if(0===t.length)return{integrand:e,intvar:null,rest:t};const r=t[0];if(c.isGeneralFunctionBoundary(r))return{integrand:e,intvar:null,rest:t};if(c.isIntegralDxBoundarySingle(r))return r.role="integral",{integrand:e,intvar:r,rest:t.slice(1)};if(t[1]&&c.isIntegralDxBoundary(r,t[1])){const n=y.getInstance().prefixNode_(t[1],[r]);return n.role="integral",{integrand:e,intvar:n,rest:t.slice(2)}}return e.push(t.shift()),y.getInstance().getIntegralArgs_(t,e)}functionNode_(t,e){const r=y.getInstance().factory_.makeContentNode(s.functionApplication()),n=y.getInstance().funcAppls[t.id];n&&(r.mathmlTree=n.mathmlTree,r.mathml=n.mathml,r.annotation=n.annotation,r.attributes=n.attributes,delete y.getInstance().funcAppls[t.id]),r.type="punctuation",r.role="application";var o=y.getFunctionOp_(t,function(t){return c.isType(t,"function")||c.isType(t,"identifier")&&c.isRole(t,"simple function")});return y.getInstance().functionalNode_("appl",[t,e],o,[r])}bigOpNode_(t,e){var r=y.getFunctionOp_(t,t=>c.isType(t,"largeop"));return y.getInstance().functionalNode_("bigop",[t,e],r,[])}integralNode_(t,e,r){e=e||y.getInstance().factory_.makeEmptyNode(),r=r||y.getInstance().factory_.makeEmptyNode();var n=y.getFunctionOp_(t,t=>c.isType(t,"largeop"));return y.getInstance().functionalNode_("integral",[t,e,r],n,[])}functionalNode_(t,e,r,n){var o=e[0];let i;r&&(i=r.parent,n.push(r));const a=y.getInstance().factory_.makeBranchNode(t,e,n);return a.role=o.role,i&&(r.parent=i),a}fractionNode_(t,e){const r=y.getInstance().factory_.makeBranchNode("fraction",[t,e],[]);return r.role=r.childNodes.every(function(t){return c.isType(t,"number")&&c.isRole(t,"integer")})?"vulgar":r.childNodes.every(c.isPureUnit)?"unit":"division",o.run("propagateSimpleFunction",r)}scriptNode_(t,e,r){let n;switch(t.length){case 0:n=y.getInstance().factory_.makeEmptyNode();break;case 1:if(n=t[0],r)return n;break;default:n=y.getInstance().dummyNode_(t)}return n.role=e,n}findNestedRow_(r,n,o,i){if(3{return t.concat((t=e,l.simpleCollapseStructure(t)?[t]:l.contentCollapseStructure(t[1])?t.slice(2):t.slice(1)))},[])}static fromStructure(t,e){return new l(l.tree_(t,e.root))}static combineContentChildren(t,e,r){switch(t.type){case"relseq":case"infixop":case"multirel":return n.interleaveLists(r,e);case"prefixop":return e.concat(r);case"postfixop":return r.concat(e);case"fenced":return r.unshift(e[0]),r.push(e[1]),r;case"appl":return[r[0],e[0],r[1]];case"root":return[r[1],r[0]];case"row":case"line":return e.length&&r.unshift(e[0]),r;default:return r}}static makeSexp_(t){return l.simpleCollapseStructure(t)?t.toString():l.contentCollapseStructure(t)?"(c "+t.slice(1).map(l.makeSexp_).join(" ")+")":"("+t.map(l.makeSexp_).join(" ")+")"}static fromString_(t){let e=t.replace(/\(/g,"[");return e=(e=(e=e.replace(/\)/g,"]")).replace(/ /g,",")).replace(/c/g,'"c"'),JSON.parse(e)}static fromNode_(t){if(!t)return[];const e=t.contentNodes;let r;e.length&&(r=e.map(l.fromNode_)).unshift("c");const n=t.childNodes;if(!n.length)return e.length?[t.id,r]:t.id;const o=n.map(l.fromNode_);return e.length&&o.unshift(r),o.unshift(t.id),o}static tree_(r,t){if(!t)return[];if(!t.childNodes.length)return t.id;const e=t.id,n=[e],o=a.evalXPath(`.//self::*[@${s.Attribute.ID}=${e}]`,r)[0],i=l.combineContentChildren(t,t.contentNodes.map(function(t){return t}),t.childNodes.map(function(t){return t}));o&&l.addOwns_(o,i);for(let t,e=0;t=i[e];e++)n.push(l.tree_(r,t));return n}static addOwns_(t,e){const r=t.getAttribute(s.Attribute.COLLAPSED),n=r?l.realLeafs_(l.fromString(r).array):e.map(t=>t.id);t.setAttribute(s.Attribute.OWNS,n.join(" "))}static realLeafs_(e){if(l.simpleCollapseStructure(e))return[e];if(l.contentCollapseStructure(e))return[];let r=[];for(let t=1;tl.simpleCollapseStructure(t)?t:l.contentCollapseStructure(t)?t[1]:t[0]):[]}subtreeNodes(t){if(!this.isRoot(t))return[];const r=(t,e)=>{l.simpleCollapseStructure(t)?e.push(t):(t=l.contentCollapseStructure(t)?t.slice(1):t).forEach(t=>r(t,e))},e=this.levelsMap[t],n=[];return r(e.slice(1),n),n}}e.SemanticSkeleton=l},7075:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticTree=void 0;const n=r(5740),o=r(7630),i=r(9265),a=r(7228),s=r(5952),l=r(5609);r(94);class c{constructor(t){this.mathml=t,this.parser=new a.SemanticMathml,this.root=this.parser.parse(t),this.collator=this.parser.getFactory().leafMap.collateMeaning();var e=this.collator.newDefault();e&&(this.parser=new a.SemanticMathml,this.parser.getFactory().defaultMap=e,this.root=this.parser.parse(t)),u.visit(this.root,{}),(0,o.annotate)(this.root)}static empty(){const t=n.parseInput(""),e=new c(t);return e.mathml=t,e}static fromNode(t,e){const r=c.empty();return r.root=t,e&&(r.mathml=e),r}static fromRoot(t,e){let r=t;for(;r.parent;)r=r.parent;const n=c.fromNode(r);return e&&(n.mathml=e),n}static fromXml(t){const e=c.empty();return t.childNodes[0]&&(e.root=s.SemanticNode.fromXml(t.childNodes[0])),e}xml(t){const e=n.parseInput(""),r=this.root.xml(e.ownerDocument,t);return e.appendChild(r),e}toString(t){return n.serializeXml(this.xml(t))}formatXml(t){t=this.toString(t);return n.formatXml(t)}displayTree(){this.root.displayTree()}replaceNode(t,e){const r=t.parent;r?r.replaceChild(t,e):this.root=e}toJson(){const t={};return t.stree=this.root.toJson(),t}}e.SemanticTree=c;const u=new i.SemanticVisitor("general","unit",(t,e)=>{if("infixop"===t.type&&("multiplication"===t.role||"implicit"===t.role)){const e=t.childNodes;e.length&&(l.isPureUnit(e[0])||l.isUnitCounter(e[0]))&&t.childNodes.slice(1).every(l.isPureUnit)&&(t.role="unit")}return!1})},4795:function(t,o,e){Object.defineProperty(o,"__esModule",{value:!0}),o.partitionNodes=o.sliceNodes=o.getEmbellishedInner=o.addAttributes=o.isZeroLength=o.purgeNodes=o.isOrphanedGlyph=o.hasDisplayTag=o.hasEmptyTag=o.hasIgnoreTag=o.hasLeafTag=o.hasMathTag=o.directSpeechKeys=o.DISPLAYTAGS=o.EMPTYTAGS=o.IGNORETAGS=o.LEAFTAGS=void 0;const i=e(5740);function r(t){return!!t&&-1!==o.LEAFTAGS.indexOf(i.tagName(t))}function a(r,n,o){o&&r.reverse();const i=[];for(let t,e=0;t=r[e];e++){if(n(t))return o?{head:r.slice(e+1).reverse(),div:t,tail:i.reverse()}:{head:i,div:t,tail:r.slice(e+1)};i.push(t)}return o?{head:[],div:null,tail:i.reverse()}:{head:i,div:null,tail:[]}}o.LEAFTAGS=["MO","MI","MN","MTEXT","MS","MSPACE"],o.IGNORETAGS=["MERROR","MPHANTOM","MALIGNGROUP","MALIGNMARK","MPRESCRIPTS","ANNOTATION","ANNOTATION-XML"],o.EMPTYTAGS=["MATH","MROW","MPADDED","MACTION","NONE","MSTYLE","SEMANTICS"],o.DISPLAYTAGS=["MROOT","MSQRT"],o.directSpeechKeys=["aria-label","exact-speech","alt"],o.hasMathTag=function(t){return!!t&&"MATH"===i.tagName(t)},o.hasLeafTag=r,o.hasIgnoreTag=function(t){return!!t&&-1!==o.IGNORETAGS.indexOf(i.tagName(t))},o.hasEmptyTag=function(t){return!!t&&-1!==o.EMPTYTAGS.indexOf(i.tagName(t))},o.hasDisplayTag=function(t){return!!t&&-1!==o.DISPLAYTAGS.indexOf(i.tagName(t))},o.isOrphanedGlyph=function(t){return!!t&&"MGLYPH"===i.tagName(t)&&!r(t.parentNode)},o.purgeNodes=function(r){const n=[];for(let t,e=0;t=r[e];e++)if(t.nodeType===i.NodeType.ELEMENT_NODE){const r=i.tagName(t);-1!==o.IGNORETAGS.indexOf(r)||-1!==o.EMPTYTAGS.indexOf(r)&&0===t.childNodes.length||n.push(t)}return n},o.isZeroLength=function(t){if(!t)return!1;if(-1!==["negativeveryverythinmathspace","negativeverythinmathspace","negativethinmathspace","negativemediummathspace","negativethickmathspace","negativeverythickmathspace","negativeveryverythickmathspace"].indexOf(t))return!0;t=t.match(/[0-9.]+/);return!!t&&0===parseFloat(t[0])},o.addAttributes=function(e,t){if(t.hasAttributes()){var r=t.attributes;for(let t=r.length-1;0<=t;t--){const n=r[t].name;n.match(/^ext/)&&(e.attributes[n]=r[t].value,e.nobreaking=!0),-1!==o.directSpeechKeys.indexOf(n)&&(e.attributes["ext-speech"]=r[t].value,e.nobreaking=!0),n.match(/texclass$/)&&(e.attributes.texclass=r[t].value),"href"===n&&(e.attributes.href=r[t].value,e.nobreaking=!0)}}},o.getEmbellishedInner=function t(e){return e&&e.embellished&&0n[t.id]=!0),"implicit"!==e.role&&r.push(e.contentNodes.map(t=>t.id))),e.childNodes.length){if("implicit"===e.role){const o=[];let t=[];for(const r of e.childNodes){const e=[];l.visitStree_(r,e,n),e.length<=2&&o.push(e.shift()),t=t.concat(e)}return r.push(o),void t.forEach(t=>r.push(t))}e.childNodes.forEach(t=>l.visitStree_(t,r,n))}}else n[e.id]||r.push(e.id)}getSpeech(t,e){return a.getAttribute(t,this.modality)}generateSpeech(t,e){return this.getRebuilt()||this.setRebuilt(new i.RebuildStree(t)),this.colorLeaves_(t),a.getAttribute(t,this.modality)}colorLeaves_(e){const r=[];l.visitStree_(this.getRebuilt().streeRoot,r,{});for(const t of r){const r=this.contrast.generate();(Array.isArray(t)?t.map(t=>this.colorLeave_(e,t,r)).reduce((t,e)=>t||e,!1):this.colorLeave_(e,t.toString(),r))&&this.contrast.increment()}}colorLeave_(t,e,r){const n=a.getBySemanticId(t,e);return!!n&&(n.setAttribute(this.modality,r),!0)}}e.ColorGenerator=l},6604:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.DirectSpeechGenerator=void 0;const n=r(1204),o=r(6278);class i extends o.AbstractSpeechGenerator{getSpeech(t,e){return n.getAttribute(t,this.modality)}}e.DirectSpeechGenerator=i},3123:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.DummySpeechGenerator=void 0;class n extends r(6278).AbstractSpeechGenerator{getSpeech(t,e){return""}}e.DummySpeechGenerator=n},5858:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.NodeSpeechGenerator=void 0;const n=r(1204),o=r(4598);class i extends o.TreeSpeechGenerator{getSpeech(t,e){return super.getSpeech(t,e),n.getAttribute(t,this.modality)}}e.NodeSpeechGenerator=i},9552:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.generatorMapping_=e.generator=void 0;const n=r(1452),o=r(5152),i=r(6604),a=r(3123),s=r(5858),l=r(597),c=r(4598);e.generator=function(t){return(e.generatorMapping_[t]||e.generatorMapping_.Direct)()},e.generatorMapping_={Adhoc:()=>new n.AdhocSpeechGenerator,Color:()=>new o.ColorGenerator,Direct:()=>new i.DirectSpeechGenerator,Dummy:()=>new a.DummySpeechGenerator,Node:()=>new s.NodeSpeechGenerator,Summary:()=>new l.SummarySpeechGenerator,Tree:()=>new c.TreeSpeechGenerator}},9543:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.computeSummary_=e.retrieveSummary=e.connectAllMactions=e.connectMactions=e.nodeAtPosition_=e.computePrefix_=e.retrievePrefix=e.addPrefix=e.addModality=e.addSpeech=e.recomputeMarkup=e.computeMarkup=e.recomputeSpeech=e.computeSpeech=void 0;const n=r(8290),c=r(5740),o=r(5274),u=r(2298),i=r(2362),a=r(7075),p=r(1204);function s(t){return i.SpeechRuleEngine.getInstance().evaluateNode(t)}function l(t){return s(a.SemanticTree.fromNode(t).xml())}function h(t){t=l(t);return n.markup(t)}function d(t){t=f(t);return n.markup(t)}function f(t){const e=a.SemanticTree.fromRoot(t),r=o.evalXPath('.//*[@id="'+t.id+'"]',e.xml());let n=r[0];return(n=1{const r={};return Object.keys(t).forEach(t=>r[t]=!0),Object.keys(e).forEach(t=>r[t]=!0),Object.keys(r)};u.Domains_.small=e(t.smallPrefix,t.letterTrans),u.Domains_.capital=e(t.capPrefix,t.letterTrans),u.Domains_.digit=e(t.digitPrefix,t.digitTrans)}function c([t,e],r){const n=parseInt(t,16),o=parseInt(e,16),i=[];for(let e=n;e<=o;e++){let t=3<(a=(a=e).toString(16).toUpperCase()).length?a:("000"+a).slice(-4);!1!==r[t]&&(t=r[t]||t,i.push(t))}var a;return i}function d(t){t="normal"!==t&&"fullwidth"!==t&&(p.LOCALE.MESSAGES.font[t]||p.LOCALE.MESSAGES.embellish[t])||"";return(0,r.localeFontCombiner)(t)}function f(o,i,a,t,s,l){var c=d(t);for(let t,e,r,n=0;t=o[n],e=i[n],r=a[n];n++){const o=l?p.LOCALE.ALPHABETS.capPrefix:p.LOCALE.ALPHABETS.smallPrefix,i=l?u.Domains_.capital:u.Domains_.small;y(c.combiner,t,e,r,c.font,o,s,p.LOCALE.ALPHABETS.letterTrans,i)}}function m(n,o,t,i,a){var s=d(t);for(let t,e,r=0;t=n[r],e=o[r];r++){const n=p.LOCALE.ALPHABETS.digitPrefix,o=r+a;y(s.combiner,t,e,o,s.font,n,i,p.LOCALE.ALPHABETS.digitTrans,u.Domains_.digit)}}function y(r,n,o,i,a,s,l,c,u){for(let t,e=0;t=u[e];e++){const u=t in c?c[t]:c.default,p=t in s?s[t]:s.default;h.defineRule(n.toString(),t,"default",l,o,r(u(i),a,p))}}(s=e=u.Font||(u.Font={})).BOLD="bold",s.BOLDFRAKTUR="bold-fraktur",s.BOLDITALIC="bold-italic",s.BOLDSCRIPT="bold-script",s.DOUBLESTRUCK="double-struck",s.FULLWIDTH="fullwidth",s.FRAKTUR="fraktur",s.ITALIC="italic",s.MONOSPACE="monospace",s.NORMAL="normal",s.SCRIPT="script",s.SANSSERIF="sans-serif",s.SANSSERIFITALIC="sans-serif-italic",s.SANSSERIFBOLD="sans-serif-bold",s.SANSSERIFBOLDITALIC="sans-serif-bold-italic",(a=s=u.Embellish||(u.Embellish={})).SUPER="super",a.SUB="sub",a.CIRCLED="circled",a.PARENTHESIZED="parenthesized",a.PERIOD="period",a.NEGATIVECIRCLED="negative-circled",a.DOUBLECIRCLED="double-circled",a.CIRCLEDSANSSERIF="circled-sans-serif",a.NEGATIVECIRCLEDSANSSERIF="negative-circled-sans-serif",a.COMMA="comma",a.SQUARED="squared",a.NEGATIVESQUARED="negative-squared",(n=a=u.Base||(u.Base={})).LATINCAP="latinCap",n.LATINSMALL="latinSmall",n.GREEKCAP="greekCap",n.GREEKSMALL="greekSmall",n.DIGIT="digit",u.Domains_={small:["default"],capital:["default"],digit:["default"]},u.makeDomains_=l,u.generate=function(t){const r=o.default.getInstance().locale;o.default.getInstance().locale=t,i.setLocale(),h.addSymbolRules({locale:t}),l();var n=u.INTERVALS;for(let t,e=0;t=n[e];e++){const u=c(t.interval,t.subst),r=u.map(function(t){return String.fromCodePoint(parseInt(t,16))});"offset"in t?m(u,r,t.font,t.category,t.offset||0):f(u,r,p.LOCALE.ALPHABETS[t.base],t.font,t.category,!!t.capital)}o.default.getInstance().locale=r,i.setLocale()},u.makeInterval=c,u.getFont=d,u.alphabetRules=f,u.numberRules=m,u.makeLetter=y,u.INTERVALS=[{interval:["1D400","1D419"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.BOLD},{interval:["1D41A","1D433"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.BOLD},{interval:["1D56C","1D585"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.BOLDFRAKTUR},{interval:["1D586","1D59F"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.BOLDFRAKTUR},{interval:["1D468","1D481"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.BOLDITALIC},{interval:["1D482","1D49B"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.BOLDITALIC},{interval:["1D4D0","1D4E9"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.BOLDSCRIPT},{interval:["1D4EA","1D503"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.BOLDSCRIPT},{interval:["1D538","1D551"],base:a.LATINCAP,subst:{"1D53A":"2102","1D53F":"210D","1D545":"2115","1D547":"2119","1D548":"211A","1D549":"211D","1D551":"2124"},capital:!0,category:"Lu",font:e.DOUBLESTRUCK},{interval:["1D552","1D56B"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.DOUBLESTRUCK},{interval:["1D504","1D51D"],base:a.LATINCAP,subst:{"1D506":"212D","1D50B":"210C","1D50C":"2111","1D515":"211C","1D51D":"2128"},capital:!0,category:"Lu",font:e.FRAKTUR},{interval:["1D51E","1D537"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.FRAKTUR},{interval:["FF21","FF3A"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.FULLWIDTH},{interval:["FF41","FF5A"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.FULLWIDTH},{interval:["1D434","1D44D"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.ITALIC},{interval:["1D44E","1D467"],base:a.LATINSMALL,subst:{"1D455":"210E"},capital:!1,category:"Ll",font:e.ITALIC},{interval:["1D670","1D689"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.MONOSPACE},{interval:["1D68A","1D6A3"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.MONOSPACE},{interval:["0041","005A"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.NORMAL},{interval:["0061","007A"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.NORMAL},{interval:["1D49C","1D4B5"],base:a.LATINCAP,subst:{"1D49D":"212C","1D4A0":"2130","1D4A1":"2131","1D4A3":"210B","1D4A4":"2110","1D4A7":"2112","1D4A8":"2133","1D4AD":"211B"},capital:!0,category:"Lu",font:e.SCRIPT},{interval:["1D4B6","1D4CF"],base:a.LATINSMALL,subst:{"1D4BA":"212F","1D4BC":"210A","1D4C4":"2134"},capital:!1,category:"Ll",font:e.SCRIPT},{interval:["1D5A0","1D5B9"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.SANSSERIF},{interval:["1D5BA","1D5D3"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.SANSSERIF},{interval:["1D608","1D621"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.SANSSERIFITALIC},{interval:["1D622","1D63B"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.SANSSERIFITALIC},{interval:["1D5D4","1D5ED"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.SANSSERIFBOLD},{interval:["1D5EE","1D607"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.SANSSERIFBOLD},{interval:["1D63C","1D655"],base:a.LATINCAP,subst:{},capital:!0,category:"Lu",font:e.SANSSERIFBOLDITALIC},{interval:["1D656","1D66F"],base:a.LATINSMALL,subst:{},capital:!1,category:"Ll",font:e.SANSSERIFBOLDITALIC},{interval:["0391","03A9"],base:a.GREEKCAP,subst:{"03A2":"03F4"},capital:!0,category:"Lu",font:e.NORMAL},{interval:["03B0","03D0"],base:a.GREEKSMALL,subst:{"03B0":"2207","03CA":"2202","03CB":"03F5","03CC":"03D1","03CD":"03F0","03CE":"03D5","03CF":"03F1","03D0":"03D6"},capital:!1,category:"Ll",font:e.NORMAL},{interval:["1D6A8","1D6C0"],base:a.GREEKCAP,subst:{},capital:!0,category:"Lu",font:e.BOLD},{interval:["1D6C1","1D6E1"],base:a.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:e.BOLD},{interval:["1D6E2","1D6FA"],base:a.GREEKCAP,subst:{},capital:!0,category:"Lu",font:e.ITALIC},{interval:["1D6FB","1D71B"],base:a.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:e.ITALIC},{interval:["1D71C","1D734"],base:a.GREEKCAP,subst:{},capital:!0,category:"Lu",font:e.BOLDITALIC},{interval:["1D735","1D755"],base:a.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:e.BOLDITALIC},{interval:["1D756","1D76E"],base:a.GREEKCAP,subst:{},capital:!0,category:"Lu",font:e.SANSSERIFBOLD},{interval:["1D76F","1D78F"],base:a.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:e.SANSSERIFBOLD},{interval:["1D790","1D7A8"],base:a.GREEKCAP,subst:{},capital:!0,category:"Lu",font:e.SANSSERIFBOLDITALIC},{interval:["1D7A9","1D7C9"],base:a.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:e.SANSSERIFBOLDITALIC},{interval:["0030","0039"],base:a.DIGIT,subst:{},offset:0,category:"Nd",font:e.NORMAL},{interval:["2070","2079"],base:a.DIGIT,subst:{2071:"00B9",2072:"00B2",2073:"00B3"},offset:0,category:"No",font:s.SUPER},{interval:["2080","2089"],base:a.DIGIT,subst:{},offset:0,category:"No",font:s.SUB},{interval:["245F","2473"],base:a.DIGIT,subst:{"245F":"24EA"},offset:0,category:"No",font:s.CIRCLED},{interval:["3251","325F"],base:a.DIGIT,subst:{},offset:21,category:"No",font:s.CIRCLED},{interval:["32B1","32BF"],base:a.DIGIT,subst:{},offset:36,category:"No",font:s.CIRCLED},{interval:["2474","2487"],base:a.DIGIT,subst:{},offset:1,category:"No",font:s.PARENTHESIZED},{interval:["2487","249B"],base:a.DIGIT,subst:{2487:"1F100"},offset:0,category:"No",font:s.PERIOD},{interval:["2775","277F"],base:a.DIGIT,subst:{2775:"24FF"},offset:0,category:"No",font:s.NEGATIVECIRCLED},{interval:["24EB","24F4"],base:a.DIGIT,subst:{},offset:11,category:"No",font:s.NEGATIVECIRCLED},{interval:["24F5","24FE"],base:a.DIGIT,subst:{},offset:1,category:"No",font:s.DOUBLECIRCLED},{interval:["277F","2789"],base:a.DIGIT,subst:{"277F":"1F10B"},offset:0,category:"No",font:s.CIRCLEDSANSSERIF},{interval:["2789","2793"],base:a.DIGIT,subst:{2789:"1F10C"},offset:0,category:"No",font:s.NEGATIVECIRCLEDSANSSERIF},{interval:["FF10","FF19"],base:a.DIGIT,subst:{},offset:0,category:"Nd",font:e.FULLWIDTH},{interval:["1D7CE","1D7D7"],base:a.DIGIT,subst:{},offset:0,category:"Nd",font:e.BOLD},{interval:["1D7D8","1D7E1"],base:a.DIGIT,subst:{},offset:0,category:"Nd",font:e.DOUBLESTRUCK},{interval:["1D7E2","1D7EB"],base:a.DIGIT,subst:{},offset:0,category:"Nd",font:e.SANSSERIF},{interval:["1D7EC","1D7F5"],base:a.DIGIT,subst:{},offset:0,category:"Nd",font:e.SANSSERIFBOLD},{interval:["1D7F6","1D7FF"],base:a.DIGIT,subst:{},offset:0,category:"Nd",font:e.MONOSPACE},{interval:["1F101","1F10A"],base:a.DIGIT,subst:{},offset:0,category:"No",font:s.COMMA},{interval:["24B6","24CF"],base:a.LATINCAP,subst:{},capital:!0,category:"So",font:s.CIRCLED},{interval:["24D0","24E9"],base:a.LATINSMALL,subst:{},capital:!1,category:"So",font:s.CIRCLED},{interval:["1F110","1F129"],base:a.LATINCAP,subst:{},capital:!0,category:"So",font:s.PARENTHESIZED},{interval:["249C","24B5"],base:a.LATINSMALL,subst:{},capital:!1,category:"So",font:s.PARENTHESIZED},{interval:["1F130","1F149"],base:a.LATINCAP,subst:{},capital:!0,category:"So",font:s.SQUARED},{interval:["1F170","1F189"],base:a.LATINCAP,subst:{},capital:!0,category:"So",font:s.NEGATIVESQUARED},{interval:["1F150","1F169"],base:a.LATINCAP,subst:{},capital:!0,category:"So",font:s.NEGATIVECIRCLED}]},8504:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=e.Comparator=e.ClearspeakPreferences=void 0;const n=r(5897),a=r(4440),i=r(1676),s=r(1676),o=r(2780),l=r(2362);class c extends i.DynamicCstr{constructor(t,e){super(t),this.preference=e}static comparator(){return new p(n.default.getInstance().dynamicCstr,s.DynamicProperties.createProp([i.DynamicCstr.DEFAULT_VALUES[s.Axis.LOCALE]],[i.DynamicCstr.DEFAULT_VALUES[s.Axis.MODALITY]],[i.DynamicCstr.DEFAULT_VALUES[s.Axis.DOMAIN]],[i.DynamicCstr.DEFAULT_VALUES[s.Axis.STYLE]]))}static fromPreference(t){const r=t.split(":"),n={},o=u.getProperties(),i=Object.keys(o);for(let t,e=0;t=r[e];e++){const r=t.split("_");var a;-1!==i.indexOf(r[0])&&((a=r[1])&&a!==c.AUTO&&-1!==o[r[0]].indexOf(a)&&(n[r[0]]=r[1]))}return n}static toPreference(e){const r=Object.keys(e),n=[];for(let t=0;tA(t)||"identifier"===t.tagName)}function T(t){return"text"===t.type||"punctuated"===t.type&&"text"===t.role&&_(t.childNodes[0])&&N(t.childNodes.slice(1))||"identifier"===t.type&&"unit"===t.role||"infixop"===t.type&&("implicit"===t.role||"unit"===t.role)}function N(e){for(let t=0;tt(e,n++)).bind(this),300)}:b)(t))}function g(){switch(i.default.getInstance().mode){case a.Mode.ASYNC:return S;case a.Mode.HTTP:return M;default:a.Mode.SYNC;return O}}function b(r){const t=i.default.getInstance().customLoader?i.default.getInstance().customLoader:g(),e=new Promise(e=>{t(r).then(t=>{v(t),i.EnginePromise.loaded[r]=[!0,!0],e(r)},t=>{i.EnginePromise.loaded[r]=[!0,!1],console.error("Unable to load locale: "+r),i.default.getInstance().locale=i.default.getInstance().defaultLocale,e(r)})});i.EnginePromise.promises[r]=e}function v(t){_(JSON.parse(t))}function _(r,n){let o=!0;for(let t,e=0;t=Object.keys(r)[e];e++){var i=t.split("/");n&&n!==i[0]||("rules"===i[1]?p.SpeechRuleEngine.getInstance().addStore(r[t]):"messages"===i[1]?(0,h.completeLocale)(r[t]):(o&&(d.generate(i[0]),o=!1),r[t].forEach(f[i[1]])))}}function S(t){const e=s.localePath(t);return new Promise((r,n)=>{l.default.fs.readFile(e,"utf8",(t,e)=>{if(t)return n(t);r(e)})})}function O(t){const n=s.localePath(t);return new Promise((t,e)=>{let r="{}";try{r=l.default.fs.readFileSync(n,"utf8")}catch(t){return e(t)}t(r)})}function M(t){const n=s.localePath(t),o=new XMLHttpRequest;return new Promise((e,r)=>{o.onreadystatechange=function(){var t;4===o.readyState&&(0===(t=o.status)||200<=t&&t<400?e(o.responseText):r(t))},o.open("GET",n,!0),o.send()})}e.loadLocale=function(e=i.default.getInstance().locale){return n(this,void 0,void 0,function*(){return m||(y(c.DynamicCstr.BASE_LOCALE),m=!0),i.EnginePromise.promises[c.DynamicCstr.BASE_LOCALE].then(()=>n(this,void 0,void 0,function*(){var t=i.default.getInstance().defaultLocale;return t?(y(t),i.EnginePromise.promises[t].then(()=>n(this,void 0,void 0,function*(){return y(e),i.EnginePromise.promises[e]}))):(y(e),i.EnginePromise.promises[e])}))})},e.standardLoader=g,e.retrieveFiles=b,e.parseMaps=v,e.loadFile=S,e.loadFileSync=O,e.loadAjax=M},7088:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.leftSubscriptBrief=e.leftSuperscriptBrief=e.leftSubscriptVerbose=e.leftSuperscriptVerbose=e.baselineBrief=e.baselineVerbose=void 0;const n=r(1378);e.baselineVerbose=function(t){return n.baselineVerbose(t).replace(/-$/,"")},e.baselineBrief=function(t){return n.baselineBrief(t).replace(/-$/,"")},e.leftSuperscriptVerbose=function(t){return n.superscriptVerbose(t).replace(/^exposant/,"exposant gauche")},e.leftSubscriptVerbose=function(t){return n.subscriptVerbose(t).replace(/^indice/,"indice gauche")},e.leftSuperscriptBrief=function(t){return n.superscriptBrief(t).replace(/^sup/,"sup gauche")},e.leftSubscriptBrief=function(t){return n.subscriptBrief(t).replace(/^sub/,"sub gauche")}},9577:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MathspeakRules=void 0;const n=r(1676),o=r(365),i=r(7088),a=r(1378),s=r(8437),l=r(7283),c=r(7598);e.MathspeakRules=function(){l.addStore(n.DynamicCstr.BASE_LOCALE+".speech.mathspeak","",{CQFspaceoutNumber:a.spaceoutNumber,CQFspaceoutIdentifier:a.spaceoutIdentifier,CSFspaceoutText:a.spaceoutText,CSFopenFracVerbose:a.openingFractionVerbose,CSFcloseFracVerbose:a.closingFractionVerbose,CSFoverFracVerbose:a.overFractionVerbose,CSFopenFracBrief:a.openingFractionBrief,CSFcloseFracBrief:a.closingFractionBrief,CSFopenFracSbrief:a.openingFractionSbrief,CSFcloseFracSbrief:a.closingFractionSbrief,CSFoverFracSbrief:a.overFractionSbrief,CSFvulgarFraction:s.vulgarFraction,CQFvulgarFractionSmall:a.isSmallVulgarFraction,CSFopenRadicalVerbose:a.openingRadicalVerbose,CSFcloseRadicalVerbose:a.closingRadicalVerbose,CSFindexRadicalVerbose:a.indexRadicalVerbose,CSFopenRadicalBrief:a.openingRadicalBrief,CSFcloseRadicalBrief:a.closingRadicalBrief,CSFindexRadicalBrief:a.indexRadicalBrief,CSFopenRadicalSbrief:a.openingRadicalSbrief,CSFindexRadicalSbrief:a.indexRadicalSbrief,CQFisSmallRoot:a.smallRoot,CSFsuperscriptVerbose:a.superscriptVerbose,CSFsuperscriptBrief:a.superscriptBrief,CSFsubscriptVerbose:a.subscriptVerbose,CSFsubscriptBrief:a.subscriptBrief,CSFbaselineVerbose:a.baselineVerbose,CSFbaselineBrief:a.baselineBrief,CSFleftsuperscriptVerbose:a.superscriptVerbose,CSFleftsubscriptVerbose:a.subscriptVerbose,CSFrightsuperscriptVerbose:a.superscriptVerbose,CSFrightsubscriptVerbose:a.subscriptVerbose,CSFleftsuperscriptBrief:a.superscriptBrief,CSFleftsubscriptBrief:a.subscriptBrief,CSFrightsuperscriptBrief:a.superscriptBrief,CSFrightsubscriptBrief:a.subscriptBrief,CSFunderscript:a.nestedUnderscript,CSFoverscript:a.nestedOverscript,CSFendscripts:a.endscripts,CTFordinalCounter:s.ordinalCounter,CTFwordCounter:s.wordCounter,CTFcontentIterator:o.contentIterator,CQFdetIsSimple:a.determinantIsSimple,CSFRemoveParens:a.removeParens,CQFresetNesting:a.resetNestingDepth,CGFbaselineConstraint:a.generateBaselineConstraint,CGFtensorRules:a.generateTensorRules}),l.addStore("es.speech.mathspeak",n.DynamicCstr.BASE_LOCALE+".speech.mathspeak",{CTFunitMultipliers:c.unitMultipliers,CQFoneLeft:c.oneLeft}),l.addStore("fr.speech.mathspeak",n.DynamicCstr.BASE_LOCALE+".speech.mathspeak",{CSFbaselineVerbose:i.baselineVerbose,CSFbaselineBrief:i.baselineBrief,CSFleftsuperscriptVerbose:i.leftSuperscriptVerbose,CSFleftsubscriptVerbose:i.leftSubscriptVerbose,CSFleftsuperscriptBrief:i.leftSuperscriptBrief,CSFleftsubscriptBrief:i.leftSubscriptBrief})}},1378:function(t,s,e){Object.defineProperty(s,"__esModule",{value:!0}),s.smallRoot=s.generateTensorRules=s.removeParens=s.generateBaselineConstraint=s.determinantIsSimple=s.nestedOverscript=s.endscripts=s.overscoreNestingDepth=s.nestedUnderscript=s.underscoreNestingDepth=s.indexRadicalSbrief=s.openingRadicalSbrief=s.indexRadicalBrief=s.closingRadicalBrief=s.openingRadicalBrief=s.indexRadicalVerbose=s.closingRadicalVerbose=s.openingRadicalVerbose=s.getRootIndex=s.nestedRadical=s.radicalNestingDepth=s.baselineBrief=s.baselineVerbose=s.superscriptBrief=s.superscriptVerbose=s.subscriptBrief=s.subscriptVerbose=s.nestedSubSuper=s.isSmallVulgarFraction=s.overFractionSbrief=s.closingFractionSbrief=s.openingFractionSbrief=s.closingFractionBrief=s.openingFractionBrief=s.overFractionVerbose=s.closingFractionVerbose=s.openingFractionVerbose=s.nestedFraction=s.fractionNestingDepth=s.computeNestingDepth_=s.containsAttr=s.getNestingDepth=s.resetNestingDepth=s.nestingBarriers=s.spaceoutIdentifier=s.spaceoutNumber=s.spaceoutNodes=s.spaceoutText=void 0;const l=e(707),c=e(5740),n=e(5274),a=e(4356),u=e(3308);let p={};function r(t,r){const n=Array.from(t.textContent),o=[],i=u.default.getInstance(),a=t.ownerDocument;for(let t,e=0;t=n[e];e++){const n=i.getNodeFactory().makeLeafNode(t,"unknown"),s=i.identifierNode(n,"unknown","");r(s),o.push(s.xml(a))}return o}function o(t,e,r,n,o,i){n=n||s.nestingBarriers,o=o||{},i=i||function(t){return!1};var a=c.serializeXml(e);if(p[t]||(p[t]={}),p[t][a])return p[t][a];if(i(e)||r.indexOf(e.tagName)<0)return 0;e=d(e,r,l.setdifference(n,r),o,i,0);return p[t][a]=e}function h(t,r){if(!t.attributes)return!1;var n=c.toArray(t.attributes);for(let t,e=0;t=n[e];e++)if(r[t.nodeName]===t.nodeValue)return!0;return!1}function d(t,e,r,n,o,i){if(o(t)||-1t.map(t=>"ancestor::"+t),e=t=>"not("+t+")",r=e(t(["subscript","superscript","tensor"]).join(" or ")),n=t(["relseq","multrel"]),o=t(["fraction","punctuation","fenced","sqrt","root"]);let i=[];for(let e,t=0;e=o[t];t++)i=i.concat(n.map(function(t){return e+"/"+t}));return[["ancestor::*/following-sibling::*",r,e(i.join(" | "))].join(" and ")]},s.removeParens=function(t){if(!t.childNodes.length||!t.childNodes[0].childNodes.length||!t.childNodes[0].childNodes[0].childNodes.length)return"";const e=t.childNodes[0].childNodes[0].childNodes[0].textContent;return e.match(/^\(.+\)$/)?e.slice(1,-1):e};const S=new Map([[3,"CSFleftsuperscript"],[4,"CSFleftsubscript"],[2,"CSFbaseline"],[1,"CSFrightsubscript"],[0,"CSFrightsuperscript"]]),O=new Map([[4,2],[3,3],[2,1],[1,4],[0,5]]);s.generateTensorRules=function(i,a=!0){var e=["11111","11110","11101","11100","10111","10110","10101","10100","01111","01110","01101","01100"];for(let o,t=0;o=e[t];t++){let t="tensor"+o,[e,r,n]=function(t){const e=[];let r="",n="",o=parseInt(t,2);for(let t=0;t<5;t++){var i="children/*["+O.get(t)+"]";if(1&o){const e=S.get(t%5);r="[t] "+e+"Verbose; [n] "+i+";"+r,n="[t] "+e+"Brief; [n] "+i+";"+n}else e.unshift("name("+i+')="empty"');o>>=1}return[e,r,n]}(o);i.defineRule(t,"default",r,"self::tensor",...e),a&&(i.defineRule(t,"brief",n,"self::tensor",...e),i.defineRule(t,"sbrief",n,"self::tensor",...e));var s=S.get(2),s=(r+="; [t]"+s+"Verbose",n+="; [t]"+s+"Brief",t+="-baseline","((.//*[not(*)])[last()]/@id)!=(((.//ancestor::fraction|ancestor::root|ancestor::sqrt|ancestor::cell|ancestor::line|ancestor::stree)[1]//*[not(*)])[last()]/@id)");i.defineRule(t,"default",r,"self::tensor",s,...e),a&&(i.defineRule(t,"brief",n,"self::tensor",s,...e),i.defineRule(t,"sbrief",n,"self::tensor",s,...e))}},s.smallRoot=function(t){var e=Object.keys(a.LOCALE.MESSAGES.MSroots).length;if(!e)return[];if(e++,!t.childNodes||0===t.childNodes.length||!t.childNodes[0].childNodes)return[];var r=t.childNodes[0].childNodes[0].textContent;if(!/^\d+$/.test(r))return[];r=parseInt(r,10);return 1i.generateTensorRules(t,!1),CTFrelationIterator:a.relationIterator,CTFimplicitIterator:a.implicitIterator})}},7599:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.INIT_=void 0;const n=r(5425),o=r(9577),i=r(9284);e.INIT_=!1,e.init=function(){e.INIT_||((0,o.MathspeakRules)(),(0,n.ClearspeakRules)(),(0,i.PrefixRules)(),(0,i.OtherRules)(),(0,i.BrailleRules)(),e.INIT_=!0)}},7283:function(t,o,e){Object.defineProperty(o,"__esModule",{value:!0}),o.getStore=o.addStore=o.funcStore=void 0;const n=e(1676);o.funcStore=new Map,o.addStore=function(t,e,r){var n={};if(e){const t=o.funcStore.get(e)||{};Object.assign(n,t)}o.funcStore.set(t,Object.assign(n,r))},o.getStore=function(t,e,r){return o.funcStore.get([t,e,r].join("."))||o.funcStore.get([n.DynamicCstr.DEFAULT_VALUES[n.Axis.LOCALE],e,r].join("."))||o.funcStore.get([n.DynamicCstr.BASE_LOCALE,e,r].join("."))||{}}},7598:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.oneLeft=e.leftMostUnit=e.rightMostUnit=e.unitMultipliers=void 0;const o=r(7052),n=r(5274),i=r(4356),a=(e.unitMultipliers=function(t,e){const r=t;let n=0;return function(){var t=o.AuditoryDescription.create({text:s(r[n])&&l(r[n+1])?i.LOCALE.MESSAGES.unitTimes:""},{});return n++,[t]}},["superscript","subscript","overscore","underscore"]);function s(t){for(;t;){if("unit"===t.getAttribute("role"))return!0;var e=t.tagName,r=n.evalXPath("children/*",t);t=-1!==a.indexOf(e)?r[0]:r[r.length-1]}return!1}function l(t){for(;t;){if("unit"===t.getAttribute("role"))return!0;t=n.evalXPath("children/*",t)[0]}return!1}e.rightMostUnit=s,e.leftMostUnit=l,e.oneLeft=function(t){for(;t;){if("number"===t.tagName&&"1"===t.textContent)return[t];if("infixop"!==t.tagName||"multiplication"!==t.getAttribute("role")&&"implicit"!==t.getAttribute("role"))return[];t=n.evalXPath("children/*",t)[0]}return[]}},3284:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractWalker=void 0;const o=r(7052),i=r(8290),a=r(5740),n=r(4440),s=r(6828),l=r(8496),c=r(2298),u=r(4356),p=r(2105),h=r(5656),d=r(9552),f=r(9543),m=r(8504),y=r(7730),g=r(1214),b=r(179),v=r(1204),_=r(5274);class S{constructor(t,e,r,n){this.node=t,this.generator=e,this.highlighter=r,this.modifier=!1,this.keyMapping=new Map([[l.KeyCode.UP,this.up.bind(this)],[l.KeyCode.DOWN,this.down.bind(this)],[l.KeyCode.RIGHT,this.right.bind(this)],[l.KeyCode.LEFT,this.left.bind(this)],[l.KeyCode.TAB,this.repeat.bind(this)],[l.KeyCode.DASH,this.expand.bind(this)],[l.KeyCode.SPACE,this.depth.bind(this)],[l.KeyCode.HOME,this.home.bind(this)],[l.KeyCode.X,this.summary.bind(this)],[l.KeyCode.Z,this.detail.bind(this)],[l.KeyCode.V,this.virtualize.bind(this)],[l.KeyCode.P,this.previous.bind(this)],[l.KeyCode.U,this.undo.bind(this)],[l.KeyCode.LESS,this.previousRules.bind(this)],[l.KeyCode.GREATER,this.nextRules.bind(this)]]),this.cursors=[],this.xml_=null,this.rebuilt_=null,this.focus_=null,this.active_=!1,this.node.id?this.id=this.node.id:this.node.hasAttribute(S.SRE_ID_ATTR)?this.id=this.node.getAttribute(S.SRE_ID_ATTR):(this.node.setAttribute(S.SRE_ID_ATTR,S.ID_COUNTER.toString()),this.id=S.ID_COUNTER++),this.rootNode=v.getSemanticRoot(t),this.rootId=this.rootNode.getAttribute(c.Attribute.ID),this.xmlString_=n,this.moved=b.WalkerMoves.ENTER}getXml(){return this.xml_||(this.xml_=a.parseInput(this.xmlString_)),this.xml_}getRebuilt(){return this.rebuilt_||this.rebuildStree(),this.rebuilt_}isActive(){return this.active_}activate(){this.isActive()||(this.generator.start(),this.toggleActive_())}deactivate(){this.isActive()&&(b.WalkerState.setState(this.id,this.primaryId()),this.generator.end(),this.toggleActive_())}getFocus(t=!1){return this.focus_||(this.focus_=this.singletonFocus(this.rootId)),t&&this.updateFocus(),this.focus_}setFocus(t){this.focus_=t}getDepth(){return this.levels.depth()-1}isSpeech(){return this.generator.modality===c.Attribute.SPEECH}focusDomNodes(){return this.getFocus().getDomNodes()}focusSemanticNodes(){return this.getFocus().getSemanticNodes()}speech(){var r=this.focusDomNodes();if(!r.length)return"";const n=this.specialMove();if(null!==n)return n;switch(this.moved){case b.WalkerMoves.DEPTH:return this.depth_();case b.WalkerMoves.SUMMARY:return this.summary_();case b.WalkerMoves.DETAIL:return this.detail_();default:{const n=[],a=this.focusSemanticNodes();for(let t=0,e=r.length;tt.id.toString()),this.getRebuilt(),this.node))}rebuildStree(){this.rebuilt_=new g.RebuildStree(this.getXml()),this.rootId=this.rebuilt_.stree.root.id.toString(),this.generator.setRebuilt(this.rebuilt_),this.skeleton=h.SemanticSkeleton.fromTree(this.rebuilt_.stree),this.skeleton.populate(),this.focus_=this.singletonFocus(this.rootId),this.levels=this.initLevels(),f.connectMactions(this.node,this.getXml(),this.rebuilt_.xml)}previousLevel(){var t=this.getFocus().getDomPrimary();return t?v.getAttribute(t,c.Attribute.PARENT):this.getFocus().getSemanticPrimary().parent.id.toString()}nextLevel(){var t=this.getFocus().getDomPrimary();let e,r;if(t){e=v.splitAttribute(v.getAttribute(t,c.Attribute.CHILDREN)),r=v.splitAttribute(v.getAttribute(t,c.Attribute.CONTENT));const n=v.getAttribute(t,c.Attribute.TYPE),o=v.getAttribute(t,c.Attribute.ROLE);return this.combineContentChildren(n,o,r,e)}const n=t=>t.id.toString(),o=this.getRebuilt().nodeDict[this.primaryId()];return e=o.childNodes.map(n),r=o.contentNodes.map(n),0===e.length?[]:this.combineContentChildren(o.type,o.role,r,e)}singletonFocus(t){this.getRebuilt();var e=this.retrieveVisuals(t);return this.focusFromId(t,e)}retrieveVisuals(t){if(!this.skeleton)return[t];const e=parseInt(t,10),r=this.skeleton.subtreeNodes(e);if(!r.length)return[t];r.unshift(e);const n={},o=[];_.updateEvaluator(this.getXml());for(const t of r)n[t]||(o.push(t.toString()),n[t]=!0,this.subtreeIds(t,n));return o}subtreeIds(t,e){t=_.evalXPath(`//*[@data-semantic-id="${t}"]`,this.getXml());_.evalXPath("*//@data-semantic-id",t[0]).forEach(t=>e[parseInt(t.textContent,10)]=!0)}focusFromId(t,e){return y.Focus.factory(t,e,this.getRebuilt(),this.node)}summary(){return this.moved=this.isSpeech()?b.WalkerMoves.SUMMARY:b.WalkerMoves.REPEAT,this.getFocus().clone()}detail(){return this.moved=this.isSpeech()?b.WalkerMoves.DETAIL:b.WalkerMoves.REPEAT,this.getFocus().clone()}specialMove(){return null}virtualize(t){return this.cursors.push({focus:this.getFocus(),levels:this.levels,undo:t||!this.cursors.length}),this.levels=this.levels.clone(),this.getFocus().clone()}previous(){var t=this.cursors.pop();return t?(this.levels=t.levels,t.focus):this.getFocus()}undo(){let t;for(;(t=this.cursors.pop())&&!t.undo;);return t?(this.levels=t.levels,t.focus):this.getFocus()}update(t){this.generator.setOptions(t),(0,s.setup)(t).then(()=>d.generator("Tree").getSpeech(this.node,this.getXml()))}nextRules(){const t=this.generator.getOptions();return"speech"!==t.modality?this.getFocus():(n.DOMAIN_TO_STYLES[t.domain]=t.style,t.domain="mathspeak"===t.domain?"clearspeak":"mathspeak",t.style=n.DOMAIN_TO_STYLES[t.domain],this.update(t),this.moved=b.WalkerMoves.REPEAT,this.getFocus().clone())}nextStyle(t,e){if("mathspeak"===t){const t=["default","brief","sbrief"],n=t.indexOf(e);return-1===n?e:n>=t.length-1?t[0]:t[n+1]}if("clearspeak"!==t)return e;{const t=m.ClearspeakPreferences.getLocalePreferences().en;if(!t)return"default";const o=m.ClearspeakPreferences.relevantPreferences(this.getFocus().getSemanticPrimary()),i=m.ClearspeakPreferences.findPreference(e,o),a=t[o].map(function(t){return t.split("_")[1]}),s=a.indexOf(i);if(-1===s)return e;var r=s>=a.length-1?a[0]:a[s+1];return m.ClearspeakPreferences.addPreference(e,o,r)}}previousRules(){const t=this.generator.getOptions();return"speech"!==t.modality?this.getFocus():(t.style=this.nextStyle(t.domain,t.style),this.update(t),this.moved=b.WalkerMoves.REPEAT,this.getFocus().clone())}refocus(){let t,e=this.getFocus();for(;!e.getNodes().length;){t=this.levels.peek();var r=this.up();if(!r)break;this.setFocus(r),e=this.getFocus(!0)}this.levels.push(t),this.setFocus(e)}toggleActive_(){this.active_=!this.active_}mergePrefix_(t,e=[]){var r=this.isSpeech()?this.prefix_():"",r=(r&&t.unshift(r),this.isSpeech()?this.postfix_():"");return r&&t.push(r),i.finalize(i.merge(e.concat(t)))}prefix_(){var t=this.getFocus().getDomNodes(),e=this.getFocus().getSemanticNodes();return t[0]?v.getAttribute(t[0],c.Attribute.PREFIX):f.retrievePrefix(e[0])}postfix_(){var t=this.getFocus().getDomNodes();return t[0]?v.getAttribute(t[0],c.Attribute.POSTFIX):""}depth_(){var t=p.Grammar.getInstance().getParameter("depth"),e=(p.Grammar.getInstance().setParameter("depth",!0),this.getFocus().getDomPrimary()),e=this.expandable(e)?u.LOCALE.MESSAGES.navigate.EXPANDABLE:this.collapsible(e)?u.LOCALE.MESSAGES.navigate.COLLAPSIBLE:"",r=u.LOCALE.MESSAGES.navigate.LEVEL+" "+this.getDepth(),n=this.getFocus().getSemanticNodes(),n=f.retrievePrefix(n[0]),r=[new o.AuditoryDescription({text:r,personality:{}}),new o.AuditoryDescription({text:n,personality:{}}),new o.AuditoryDescription({text:e,personality:{}})];return p.Grammar.getInstance().setParameter("depth",t),i.finalize(i.markup(r))}actionable_(t){t=null==t?void 0:t.parentNode;return t&&this.highlighter.isMactionNode(t)?t:null}summary_(){var t=this.getFocus().getSemanticPrimary().id.toString(),t=this.getRebuilt().xml.getAttribute("id")===t?this.getRebuilt().xml:a.querySelectorAllByAttrValue(this.getRebuilt().xml,"id",t)[0],t=f.retrieveSummary(t);return this.mergePrefix_([t])}detail_(){const t=this.getFocus().getSemanticPrimary().id.toString(),e=this.getRebuilt().xml.getAttribute("id")===t?this.getRebuilt().xml:a.querySelectorAllByAttrValue(this.getRebuilt().xml,"id",t)[0],r=e.getAttribute("alternative");e.removeAttribute("alternative");var n=f.computeMarkup(e),n=this.mergePrefix_([n]);return e.setAttribute("alternative",r),n}}(e.AbstractWalker=S).ID_COUNTER=0,S.SRE_ID_ATTR="sre-explorer-id"},162:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.DummyWalker=void 0;class n extends r(3284).AbstractWalker{up(){return null}down(){return null}left(){return null}right(){return null}repeat(){return null}depth(){return null}home(){return null}getDepth(){return 0}initLevels(){return null}combineContentChildren(t,e,r,n){return[]}findFocusOnLevel(t){return null}}e.DummyWalker=n},7730:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Focus=void 0;const p=r(1204);class h{constructor(t,e){this.nodes=t,this.primary=e,this.domNodes=[],this.domPrimary_=null,this.allNodes=[]}static factory(t,e,r,n){const o=t=>p.getBySemanticId(n,t),i=r.nodeDict,a=o(t),s=e.map(o),l=e.map(function(t){return i[t]}),c=new h(l,i[t]);return c.domNodes=s,c.domPrimary_=a,c.allNodes=h.generateAllVisibleNodes_(e,s,i,n),c}static generateAllVisibleNodes_(r,n,o,i){var a=t=>p.getBySemanticId(i,t);let s=[];for(let t=0,e=r.length;t=e.length?null:e[t]}depth(){return this.level_.length}clone(){const t=new r;return t.level_=this.level_.slice(0),t}toString(){let r="";for(let t,e=0;t=this.level_[e];e++)r+="\n"+t.map(function(t){return t.toString()});return r}}},1214:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.RebuildStree=void 0;const n=r(5740),c=r(2298),o=r(3588),i=r(6537),a=r(3308),s=r(5656),l=r(7075),u=r(4795),p=r(1204);class h{constructor(t){this.mathml=t,this.factory=new i.SemanticNodeFactory,this.nodeDict={},this.mmlRoot=p.getSemanticRoot(t),this.streeRoot=this.assembleTree(this.mmlRoot),this.stree=l.SemanticTree.fromNode(this.streeRoot,this.mathml),this.xml=this.stree.xml(),a.default.getInstance().setNodeFactory(this.factory)}static addAttributes(t,e,r){r&&1===e.childNodes.length&&e.childNodes[0].nodeType!==n.NodeType.TEXT_NODE&&u.addAttributes(t,e.childNodes[0]),u.addAttributes(t,e)}static textContent(t,e,r){!r&&e.textContent?t.textContent=e.textContent:1<(r=p.splitAttribute(p.getAttribute(e,c.Attribute.OPERATOR))).length&&(t.textContent=r[1])}static isPunctuated(t){return!s.SemanticSkeleton.simpleCollapseStructure(t)&&t[1]&&s.SemanticSkeleton.contentCollapseStructure(t[1])}getTree(){return this.stree}assembleTree(t){const e=this.makeNode(t),r=p.splitAttribute(p.getAttribute(t,c.Attribute.CHILDREN)),n=p.splitAttribute(p.getAttribute(t,c.Attribute.CONTENT));if(h.addAttributes(e,t,!(r.length||n.length)),0===n.length&&0===r.length)return h.textContent(e,t),e;if(0this.setParent(t,e)),e.childNodes=r.map(t=>this.setParent(t,e));t=p.getAttribute(t,c.Attribute.COLLAPSED);return t?this.postProcess(e,t):e}makeNode(t){const e=p.getAttribute(t,c.Attribute.TYPE),r=p.getAttribute(t,c.Attribute.ROLE),n=p.getAttribute(t,c.Attribute.FONT),o=p.getAttribute(t,c.Attribute.ANNOTATION)||"",i=p.getAttribute(t,c.Attribute.ID),a=p.getAttribute(t,c.Attribute.EMBELLISHED),s=p.getAttribute(t,c.Attribute.FENCEPOINTER),l=this.createNode(parseInt(i,10));return l.type=e,l.role=r,l.font=n||"unknown",l.parseAnnotation(o),s&&(l.fencePointer=s),a&&(l.embellished=a),l}makePunctuation(t){const e=this.createNode(t);return e.updateContent((0,o.invisibleComma)()),e.role="dummy",e}makePunctuated(t,e,r){const n=this.createNode(e[0]),o=(n.type="punctuated",n.embellished=t.embellished,n.fencePointer=t.fencePointer,n.role=r,e.splice(1,1)[0].slice(1));n.contentNodes=o.map(this.makePunctuation.bind(this)),this.collapsedChildren_(e)}makeEmpty(t,e,r){const n=this.createNode(e);n.type="empty",n.embellished=t.embellished,n.fencePointer=t.fencePointer,n.role=r}makeIndex(t,e,r){if(h.isPunctuated(e))return this.makePunctuated(t,e,r),void e[0];s.SemanticSkeleton.simpleCollapseStructure(e)&&!this.nodeDict[e.toString()]&&this.makeEmpty(t,e,r)}postProcess(t,e){const r=s.SemanticSkeleton.fromString(e).array;if("subsup"===t.type){const e=this.createNode(r[1][0]);return e.type="subscript",e.role="subsup",t.type="superscript",e.embellished=t.embellished,e.fencePointer=t.fencePointer,this.makeIndex(t,r[1][2],"rightsub"),this.makeIndex(t,r[2],"rightsuper"),this.collapsedChildren_(r),t}if("subscript"===t.type)return this.makeIndex(t,r[2],"rightsub"),this.collapsedChildren_(r),t;if("superscript"===t.type)return this.makeIndex(t,r[2],"rightsuper"),this.collapsedChildren_(r),t;if("tensor"===t.type)return this.makeIndex(t,r[2],"leftsub"),this.makeIndex(t,r[3],"leftsuper"),this.makeIndex(t,r[4],"rightsub"),this.makeIndex(t,r[5],"rightsuper"),this.collapsedChildren_(r),t;if("punctuated"===t.type){if(h.isPunctuated(r)){const e=r.splice(1,1)[0].slice(1);t.contentNodes=e.map(this.makePunctuation.bind(this))}return t}if("underover"!==t.type)return t;{const e=this.createNode(r[1][0]);return"overaccent"===t.childNodes[1].role?(e.type="overscore",t.type="underscore"):(e.type="underscore",t.type="overscore"),e.role="underover",e.embellished=t.embellished,e.fencePointer=t.fencePointer,this.collapsedChildren_(r),t}}createNode(t){var e=this.factory.makeNode(t);return this.nodeDict[t.toString()]=e}collapsedChildren_(t){const i=r=>{const n=this.nodeDict[r[0]];n.childNodes=[];for(let t=1,e=r.length;tt.getSemanticPrimary().id===e)}}e.SemanticWalker=i},9806:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SyntaxWalker=void 0;const o=r(707),n=r(3284),i=r(9797);class a extends n.AbstractWalker{constructor(t,e,r,n){super(t,e,r,n),this.node=t,this.generator=e,this.highlighter=r,this.levels=null,this.restoreState()}initLevels(){const t=new i.Levels;return t.push([this.primaryId()]),t}up(){super.up();var t=this.previousLevel();return t?(this.levels.pop(),this.singletonFocus(t)):null}down(){super.down();var t=this.nextLevel();if(0===t.length)return null;var e=this.singletonFocus(t[0]);return e&&this.levels.push(t),e}combineContentChildren(t,e,r,n){switch(t){case"relseq":case"infixop":case"multirel":return(0,o.interleaveLists)(n,r);case"prefixop":return r.concat(n);case"postfixop":return n.concat(r);case"matrix":case"vector":case"fenced":return n.unshift(r[0]),n.push(r[1]),n;case"cases":return n.unshift(r[0]),n;case"punctuated":return"text"===e?(0,o.interleaveLists)(n,r):n;case"appl":return[n[0],r[0],n[1]];case"root":return[n[1],n[0]];default:return n}}left(){super.left();var t=this.levels.indexOf(this.primaryId());if(null===t)return null;t=this.levels.get(t-1);return t?this.singletonFocus(t):null}right(){super.right();var t=this.levels.indexOf(this.primaryId());if(null===t)return null;t=this.levels.get(t+1);return t?this.singletonFocus(t):null}findFocusOnLevel(t){return this.singletonFocus(t.toString())}focusDomNodes(){return[this.getFocus().getDomPrimary()]}focusSemanticNodes(){return[this.getFocus().getSemanticPrimary()]}}e.SyntaxWalker=a},1799:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.TableWalker=void 0;const i=r(5740),o=r(8496),n=r(9806),a=r(179);class s extends n.SyntaxWalker{constructor(t,e,r,n){super(t,e,r,n),this.node=t,this.generator=e,this.highlighter=r,this.firstJump=null,this.key_=null,this.row_=0,this.currentTable_=null,this.keyMapping.set(o.KeyCode.ZERO,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.ONE,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.TWO,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.THREE,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.FOUR,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.FIVE,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.SIX,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.SEVEN,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.EIGHT,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.NINE,this.jumpCell.bind(this))}move(t){this.key_=t;t=super.move(t);return this.modifier=!1,t}up(){return this.moved=a.WalkerMoves.UP,this.eligibleCell_()?this.verticalMove_(!1):super.up()}down(){return this.moved=a.WalkerMoves.DOWN,this.eligibleCell_()?this.verticalMove_(!0):super.down()}jumpCell(){if(!this.isInTable_()||null===this.key_)return this.getFocus();if(this.moved===a.WalkerMoves.ROW){this.moved=a.WalkerMoves.CELL;const t=this.key_-o.KeyCode.ZERO;return this.isLegalJump_(this.row_,t)?this.jumpCell_(this.row_,t):this.getFocus()}const t=this.key_-o.KeyCode.ZERO;return t>this.currentTable_.childNodes.length?this.getFocus():(this.row_=t,this.moved=a.WalkerMoves.ROW,this.getFocus().clone())}undo(){var t=super.undo();return t===this.firstJump&&(this.firstJump=null),t}eligibleCell_(){var t=this.getFocus().getSemanticPrimary();return this.modifier&&"cell"===t.type&&-1!==s.ELIGIBLE_CELL_ROLES.indexOf(t.role)}verticalMove_(t){var e=this.previousLevel();if(!e)return null;var r=this.getFocus(),n=this.levels.indexOf(this.primaryId()),o=this.levels.pop(),e=this.levels.indexOf(e),t=this.levels.get(t?e+1:e-1);if(!t)return this.levels.push(o),null;this.setFocus(this.singletonFocus(t));e=this.nextLevel();return e[n]?(this.levels.push(e),this.singletonFocus(e[n])):(this.setFocus(r),this.levels.push(o),null)}jumpCell_(t,e){this.firstJump?this.virtualize(!1):(this.firstJump=this.getFocus(),this.virtualize(!0));var r=this.currentTable_.id.toString();let n;for(;-1===(n=this.levels.pop()).indexOf(r););this.levels.push(n),this.setFocus(this.singletonFocus(r)),this.levels.push(this.nextLevel());const o=this.currentTable_.childNodes[t-1];return this.setFocus(this.singletonFocus(o.id.toString())),this.levels.push(this.nextLevel()),this.singletonFocus(o.childNodes[e-1].id.toString())}isLegalJump_(t,e){const r=i.querySelectorAllByAttrValue(this.getRebuilt().xml,"id",this.currentTable_.id.toString())[0];if(!r||r.hasAttribute("alternative"))return!1;const n=this.currentTable_.childNodes[t-1];if(!n)return!1;const o=i.querySelectorAllByAttrValue(r,"id",n.id.toString())[0];return!(!o||o.hasAttribute("alternative")||!n||!n.childNodes[e-1])}isInTable_(){let t=this.getFocus().getSemanticPrimary();for(;t;){if(-1!==s.ELIGIBLE_TABLE_TYPES.indexOf(t.type))return this.currentTable_=t,!0;t=t.parent}return!1}}(e.TableWalker=s).ELIGIBLE_CELL_ROLES=["determinant","rowvector","binomial","squarematrix","multiline","matrix","vector","cases","table"],s.ELIGIBLE_TABLE_TYPES=["multiline","matrix","vector","cases","table"]},179:function(t,e){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.WalkerState=e.WalkerMoves=void 0,(r=e.WalkerMoves||(e.WalkerMoves={})).UP="up",r.DOWN="down",r.LEFT="left",r.RIGHT="right",r.REPEAT="repeat",r.DEPTH="depth",r.ENTER="enter",r.EXPAND="expand",r.HOME="home",r.SUMMARY="summary",r.DETAIL="detail",r.ROW="row",r.CELL="cell";class n{static resetState(t){delete n.STATE[t]}static setState(t,e){n.STATE[t]=e}static getState(t){return n.STATE[t]}}(e.WalkerState=n).STATE={}},3362:function(t,i,e){Object.defineProperty(i,"__esModule",{value:!0}),i.walkerMapping_=i.walker=void 0;const o=e(162),a=e(6295),s=e(9806),l=e(1799);i.walker=function(t,e,r,n,o){return(i.walkerMapping_[t.toLowerCase()]||i.walkerMapping_.dummy)(e,r,n,o)},i.walkerMapping_={dummy:(t,e,r,n)=>new o.DummyWalker(t,e,r,n),semantic:(t,e,r,n)=>new a.SemanticWalker(t,e,r,n),syntax:(t,e,r,n)=>new s.SyntaxWalker(t,e,r,n),table:(t,e,r,n)=>new l.TableWalker(t,e,r,n)}},1204:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.getBySemanticId=e.getSemanticRoot=e.getAttribute=e.splitAttribute=void 0;const n=r(5740),o=r(2298);e.splitAttribute=function(t){return t?t.split(/,/):[]},e.getAttribute=function(t,e){return t.getAttribute(e)},e.getSemanticRoot=function(t){if(t.hasAttribute(o.Attribute.TYPE)&&!t.hasAttribute(o.Attribute.PARENT))return t;var r=n.querySelectorAllByAttr(t,o.Attribute.TYPE);for(let t,e=0;t=r[e];e++)if(!t.hasAttribute(o.Attribute.PARENT))return t;return t},e.getBySemanticId=function(t,e){return t.getAttribute(o.Attribute.ID)===e?t:n.querySelectorAllByAttrValue(t,o.Attribute.ID,e)[0]}}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;e=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(e.exports,e,e.exports,__webpack_require__),e.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var __webpack_exports__={};!function(){var t=__webpack_require__(9515),e=__webpack_require__(3282),r=__webpack_require__(235),j=__webpack_require__(265),n=__webpack_require__(2388);function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null}return e},i=t=>{const i=e(t);return i&&document.querySelector(i)?i:null},n=t=>{const i=e(t);return i?document.querySelector(i):null},s=e=>{e.dispatchEvent(new Event(t))},o=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),r=t=>o(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(t):null,a=(t,e,i)=>{Object.keys(i).forEach((n=>{const s=i[n],r=e[n],a=r&&o(r)?"element":null==(l=r)?`${l}`:{}.toString.call(l).match(/\s([a-z]+)/i)[1].toLowerCase();var l;if(!new RegExp(s).test(a))throw new TypeError(`${t.toUpperCase()}: Option "${n}" provided type "${a}" but expected type "${s}".`)}))},l=t=>!(!o(t)||0===t.getClientRects().length)&&"visible"===getComputedStyle(t).getPropertyValue("visibility"),c=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),h=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?h(t.parentNode):null},d=()=>{},u=t=>{t.offsetHeight},f=()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null},p=[],m=()=>"rtl"===document.documentElement.dir,g=t=>{var e;e=()=>{const e=f();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface)}},"loading"===document.readyState?(p.length||document.addEventListener("DOMContentLoaded",(()=>{p.forEach((t=>t()))})),p.push(e)):e()},_=t=>{"function"==typeof t&&t()},b=(e,i,n=!0)=>{if(!n)return void _(e);const o=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),s=Number.parseFloat(i);return n||s?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(i)+5;let r=!1;const a=({target:n})=>{n===i&&(r=!0,i.removeEventListener(t,a),_(e))};i.addEventListener(t,a),setTimeout((()=>{r||s(i)}),o)},v=(t,e,i,n)=>{let s=t.indexOf(e);if(-1===s)return t[!i&&n?t.length-1:0];const o=t.length;return s+=i?1:-1,n&&(s=(s+o)%o),t[Math.max(0,Math.min(s,o-1))]},y=/[^.]*(?=\..*)\.|.*/,w=/\..*/,E=/::\d+$/,A={};let T=1;const O={mouseenter:"mouseover",mouseleave:"mouseout"},C=/^(mouseenter|mouseleave)/i,k=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 L(t,e){return e&&`${e}::${T++}`||t.uidEvent||T++}function x(t){const e=L(t);return t.uidEvent=e,A[e]=A[e]||{},A[e]}function D(t,e,i=null){const n=Object.keys(t);for(let s=0,o=n.length;sfunction(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};n?n=t(n):i=t(i)}const[o,r,a]=S(e,i,n),l=x(t),c=l[a]||(l[a]={}),h=D(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=L(r,e.replace(y,"")),u=o?function(t,e,i){return function n(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(let a=o.length;a--;)if(o[a]===r)return s.delegateTarget=r,n.oneOff&&j.off(t,s.type,e,i),i.apply(r,[s]);return null}}(t,i,n):function(t,e){return function i(n){return n.delegateTarget=t,i.oneOff&&j.off(t,n.type,e),e.apply(t,[n])}}(t,i);u.delegationSelector=o?i:null,u.originalHandler=r,u.oneOff=s,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function I(t,e,i,n,s){const o=D(e[i],n,s);o&&(t.removeEventListener(i,o,Boolean(s)),delete e[i][o.uidEvent])}function P(t){return t=t.replace(w,""),O[t]||t}const j={on(t,e,i,n){N(t,e,i,n,!1)},one(t,e,i,n){N(t,e,i,n,!0)},off(t,e,i,n){if("string"!=typeof e||!t)return;const[s,o,r]=S(e,i,n),a=r!==e,l=x(t),c=e.startsWith(".");if(void 0!==o){if(!l||!l[r])return;return void I(t,l,r,o,s?i:null)}c&&Object.keys(l).forEach((i=>{!function(t,e,i,n){const s=e[i]||{};Object.keys(s).forEach((o=>{if(o.includes(n)){const n=s[o];I(t,e,i,n.originalHandler,n.delegationSelector)}}))}(t,l,i,e.slice(1))}));const h=l[r]||{};Object.keys(h).forEach((i=>{const n=i.replace(E,"");if(!a||e.includes(n)){const e=h[i];I(t,l,r,e.originalHandler,e.delegationSelector)}}))},trigger(t,e,i){if("string"!=typeof e||!t)return null;const n=f(),s=P(e),o=e!==s,r=k.has(s);let a,l=!0,c=!0,h=!1,d=null;return o&&n&&(a=n.Event(e,i),n(t).trigger(a),l=!a.isPropagationStopped(),c=!a.isImmediatePropagationStopped(),h=a.isDefaultPrevented()),r?(d=document.createEvent("HTMLEvents"),d.initEvent(s,l,!0)):d=new CustomEvent(e,{bubbles:l,cancelable:!0}),void 0!==i&&Object.keys(i).forEach((t=>{Object.defineProperty(d,t,{get:()=>i[t]})})),h&&d.preventDefault(),c&&t.dispatchEvent(d),d.defaultPrevented&&void 0!==a&&a.preventDefault(),d}},M=new Map,H={set(t,e,i){M.has(t)||M.set(t,new Map);const n=M.get(t);n.has(e)||0===n.size?n.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(t,e)=>M.has(t)&&M.get(t).get(e)||null,remove(t,e){if(!M.has(t))return;const i=M.get(t);i.delete(e),0===i.size&&M.delete(t)}};class B{constructor(t){(t=r(t))&&(this._element=t,H.set(this._element,this.constructor.DATA_KEY,this))}dispose(){H.remove(this._element,this.constructor.DATA_KEY),j.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach((t=>{this[t]=null}))}_queueCallback(t,e,i=!0){b(t,e,i)}static getInstance(t){return H.get(r(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.1.3"}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}`}}const R=(t,e="hide")=>{const i=`click.dismiss${t.EVENT_KEY}`,s=t.NAME;j.on(document,i,`[data-bs-dismiss="${s}"]`,(function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),c(this))return;const o=n(this)||this.closest(`.${s}`);t.getOrCreateInstance(o)[e]()}))};class W extends B{static get NAME(){return"alert"}close(){if(j.trigger(this._element,"close.bs.alert").defaultPrevented)return;this._element.classList.remove("show");const t=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,t)}_destroyElement(){this._element.remove(),j.trigger(this._element,"closed.bs.alert"),this.dispose()}static jQueryInterface(t){return this.each((function(){const e=W.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}R(W,"close"),g(W);const $='[data-bs-toggle="button"]';class z extends B{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each((function(){const e=z.getOrCreateInstance(this);"toggle"===t&&e[t]()}))}}function q(t){return"true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function F(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}j.on(document,"click.bs.button.data-api",$,(t=>{t.preventDefault();const e=t.target.closest($);z.getOrCreateInstance(e).toggle()})),g(z);const U={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${F(e)}`,i)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${F(e)}`)},getDataAttributes(t){if(!t)return{};const e={};return Object.keys(t.dataset).filter((t=>t.startsWith("bs"))).forEach((i=>{let n=i.replace(/^bs/,"");n=n.charAt(0).toLowerCase()+n.slice(1,n.length),e[n]=q(t.dataset[i])})),e},getDataAttribute:(t,e)=>q(t.getAttribute(`data-bs-${F(e)}`)),offset(t){const e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}},position:t=>({top:t.offsetTop,left:t.offsetLeft})},V={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const i=[];let n=t.parentNode;for(;n&&n.nodeType===Node.ELEMENT_NODE&&3!==n.nodeType;)n.matches(e)&&i.push(n),n=n.parentNode;return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return[i];i=i.previousElementSibling}return[]},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return[i];i=i.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(", ");return this.find(e,t).filter((t=>!c(t)&&l(t)))}},K="carousel",X={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},Y={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},Q="next",G="prev",Z="left",J="right",tt={ArrowLeft:J,ArrowRight:Z},et="slid.bs.carousel",it="active",nt=".active.carousel-item";class st extends B{constructor(t,e){super(t),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._indicatorsElement=V.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return X}static get NAME(){return K}next(){this._slide(Q)}nextWhenVisible(){!document.hidden&&l(this._element)&&this.next()}prev(){this._slide(G)}pause(t){t||(this._isPaused=!0),V.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(s(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(t){this._activeElement=V.findOne(nt,this._element);const e=this._getItemIndex(this._activeElement);if(t>this._items.length-1||t<0)return;if(this._isSliding)return void j.one(this._element,et,(()=>this.to(t)));if(e===t)return this.pause(),void this.cycle();const i=t>e?Q:G;this._slide(i,this._items[t])}_getConfig(t){return t={...X,...U.getDataAttributes(this._element),..."object"==typeof t?t:{}},a(K,t,Y),t}_handleSwipe(){const t=Math.abs(this.touchDeltaX);if(t<=40)return;const e=t/this.touchDeltaX;this.touchDeltaX=0,e&&this._slide(e>0?J:Z)}_addEventListeners(){this._config.keyboard&&j.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&(j.on(this._element,"mouseenter.bs.carousel",(t=>this.pause(t))),j.on(this._element,"mouseleave.bs.carousel",(t=>this.cycle(t)))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const t=t=>this._pointerEvent&&("pen"===t.pointerType||"touch"===t.pointerType),e=e=>{t(e)?this.touchStartX=e.clientX:this._pointerEvent||(this.touchStartX=e.touches[0].clientX)},i=t=>{this.touchDeltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this.touchStartX},n=e=>{t(e)&&(this.touchDeltaX=e.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((t=>this.cycle(t)),500+this._config.interval))};V.find(".carousel-item img",this._element).forEach((t=>{j.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()))})),this._pointerEvent?(j.on(this._element,"pointerdown.bs.carousel",(t=>e(t))),j.on(this._element,"pointerup.bs.carousel",(t=>n(t))),this._element.classList.add("pointer-event")):(j.on(this._element,"touchstart.bs.carousel",(t=>e(t))),j.on(this._element,"touchmove.bs.carousel",(t=>i(t))),j.on(this._element,"touchend.bs.carousel",(t=>n(t))))}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=tt[t.key];e&&(t.preventDefault(),this._slide(e))}_getItemIndex(t){return this._items=t&&t.parentNode?V.find(".carousel-item",t.parentNode):[],this._items.indexOf(t)}_getItemByOrder(t,e){const i=t===Q;return v(this._items,e,i,this._config.wrap)}_triggerSlideEvent(t,e){const i=this._getItemIndex(t),n=this._getItemIndex(V.findOne(nt,this._element));return j.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:e,from:n,to:i})}_setActiveIndicatorElement(t){if(this._indicatorsElement){const e=V.findOne(".active",this._indicatorsElement);e.classList.remove(it),e.removeAttribute("aria-current");const i=V.find("[data-bs-target]",this._indicatorsElement);for(let e=0;e{j.trigger(this._element,et,{relatedTarget:o,direction:d,from:s,to:r})};if(this._element.classList.contains("slide")){o.classList.add(h),u(o),n.classList.add(c),o.classList.add(c);const t=()=>{o.classList.remove(c,h),o.classList.add(it),n.classList.remove(it,h,c),this._isSliding=!1,setTimeout(f,0)};this._queueCallback(t,n,!0)}else n.classList.remove(it),o.classList.add(it),this._isSliding=!1,f();a&&this.cycle()}_directionToOrder(t){return[J,Z].includes(t)?m()?t===Z?G:Q:t===Z?Q:G:t}_orderToDirection(t){return[Q,G].includes(t)?m()?t===G?Z:J:t===G?J:Z:t}static carouselInterface(t,e){const i=st.getOrCreateInstance(t,e);let{_config:n}=i;"object"==typeof e&&(n={...n,...e});const s="string"==typeof e?e:n.slide;if("number"==typeof e)i.to(e);else if("string"==typeof s){if(void 0===i[s])throw new TypeError(`No method named "${s}"`);i[s]()}else n.interval&&n.ride&&(i.pause(),i.cycle())}static jQueryInterface(t){return this.each((function(){st.carouselInterface(this,t)}))}static dataApiClickHandler(t){const e=n(this);if(!e||!e.classList.contains("carousel"))return;const i={...U.getDataAttributes(e),...U.getDataAttributes(this)},s=this.getAttribute("data-bs-slide-to");s&&(i.interval=!1),st.carouselInterface(e,i),s&&st.getInstance(e).to(s),t.preventDefault()}}j.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",st.dataApiClickHandler),j.on(window,"load.bs.carousel.data-api",(()=>{const t=V.find('[data-bs-ride="carousel"]');for(let e=0,i=t.length;et===this._element));null!==s&&o.length&&(this._selector=s,this._triggerArray.push(e))}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return rt}static get NAME(){return ot}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t,e=[];if(this._config.parent){const t=V.find(ut,this._config.parent);e=V.find(".collapse.show, .collapse.collapsing",this._config.parent).filter((e=>!t.includes(e)))}const i=V.findOne(this._selector);if(e.length){const n=e.find((t=>i!==t));if(t=n?pt.getInstance(n):null,t&&t._isTransitioning)return}if(j.trigger(this._element,"show.bs.collapse").defaultPrevented)return;e.forEach((e=>{i!==e&&pt.getOrCreateInstance(e,{toggle:!1}).hide(),t||H.set(e,"bs.collapse",null)}));const n=this._getDimension();this._element.classList.remove(ct),this._element.classList.add(ht),this._element.style[n]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const s=`scroll${n[0].toUpperCase()+n.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct,lt),this._element.style[n]="",j.trigger(this._element,"shown.bs.collapse")}),this._element,!0),this._element.style[n]=`${this._element[s]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(j.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,u(this._element),this._element.classList.add(ht),this._element.classList.remove(ct,lt);const e=this._triggerArray.length;for(let t=0;t{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct),j.trigger(this._element,"hidden.bs.collapse")}),this._element,!0)}_isShown(t=this._element){return t.classList.contains(lt)}_getConfig(t){return(t={...rt,...U.getDataAttributes(this._element),...t}).toggle=Boolean(t.toggle),t.parent=r(t.parent),a(ot,t,at),t}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const t=V.find(ut,this._config.parent);V.find(ft,this._config.parent).filter((e=>!t.includes(e))).forEach((t=>{const e=n(t);e&&this._addAriaAndCollapsedClass([t],this._isShown(e))}))}_addAriaAndCollapsedClass(t,e){t.length&&t.forEach((t=>{e?t.classList.remove(dt):t.classList.add(dt),t.setAttribute("aria-expanded",e)}))}static jQueryInterface(t){return this.each((function(){const e={};"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1);const i=pt.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}))}}j.on(document,"click.bs.collapse.data-api",ft,(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();const e=i(this);V.find(e).forEach((t=>{pt.getOrCreateInstance(t,{toggle:!1}).toggle()}))})),g(pt);var mt="top",gt="bottom",_t="right",bt="left",vt="auto",yt=[mt,gt,_t,bt],wt="start",Et="end",At="clippingParents",Tt="viewport",Ot="popper",Ct="reference",kt=yt.reduce((function(t,e){return t.concat([e+"-"+wt,e+"-"+Et])}),[]),Lt=[].concat(yt,[vt]).reduce((function(t,e){return t.concat([e,e+"-"+wt,e+"-"+Et])}),[]),xt="beforeRead",Dt="read",St="afterRead",Nt="beforeMain",It="main",Pt="afterMain",jt="beforeWrite",Mt="write",Ht="afterWrite",Bt=[xt,Dt,St,Nt,It,Pt,jt,Mt,Ht];function Rt(t){return t?(t.nodeName||"").toLowerCase():null}function Wt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function $t(t){return t instanceof Wt(t).Element||t instanceof Element}function zt(t){return t instanceof Wt(t).HTMLElement||t instanceof HTMLElement}function qt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Wt(t).ShadowRoot||t instanceof ShadowRoot)}const Ft={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];zt(s)&&Rt(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});zt(n)&&Rt(n)&&(Object.assign(n.style,o),Object.keys(s).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]};function Ut(t){return t.split("-")[0]}function Vt(t,e){var i=t.getBoundingClientRect();return{width:i.width/1,height:i.height/1,top:i.top/1,right:i.right/1,bottom:i.bottom/1,left:i.left/1,x:i.left/1,y:i.top/1}}function Kt(t){var e=Vt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Xt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&qt(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Yt(t){return Wt(t).getComputedStyle(t)}function Qt(t){return["table","td","th"].indexOf(Rt(t))>=0}function Gt(t){return(($t(t)?t.ownerDocument:t.document)||window.document).documentElement}function Zt(t){return"html"===Rt(t)?t:t.assignedSlot||t.parentNode||(qt(t)?t.host:null)||Gt(t)}function Jt(t){return zt(t)&&"fixed"!==Yt(t).position?t.offsetParent:null}function te(t){for(var e=Wt(t),i=Jt(t);i&&Qt(i)&&"static"===Yt(i).position;)i=Jt(i);return i&&("html"===Rt(i)||"body"===Rt(i)&&"static"===Yt(i).position)?e:i||function(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&zt(t)&&"fixed"===Yt(t).position)return null;for(var i=Zt(t);zt(i)&&["html","body"].indexOf(Rt(i))<0;){var n=Yt(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function ee(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var ie=Math.max,ne=Math.min,se=Math.round;function oe(t,e,i){return ie(t,ne(e,i))}function re(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function ae(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}const le={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,o=i.elements.arrow,r=i.modifiersData.popperOffsets,a=Ut(i.placement),l=ee(a),c=[bt,_t].indexOf(a)>=0?"height":"width";if(o&&r){var h=function(t,e){return re("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:ae(t,yt))}(s.padding,i),d=Kt(o),u="y"===l?mt:bt,f="y"===l?gt:_t,p=i.rects.reference[c]+i.rects.reference[l]-r[l]-i.rects.popper[c],m=r[l]-i.rects.reference[l],g=te(o),_=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,b=p/2-m/2,v=h[u],y=_-d[c]-h[f],w=_/2-d[c]/2+b,E=oe(v,w,y),A=l;i.modifiersData[n]=((e={})[A]=E,e.centerOffset=E-w,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Xt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ce(t){return t.split("-")[1]}var he={top:"auto",right:"auto",bottom:"auto",left:"auto"};function de(t){var e,i=t.popper,n=t.popperRect,s=t.placement,o=t.variation,r=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,h=t.roundOffsets,d=!0===h?function(t){var e=t.x,i=t.y,n=window.devicePixelRatio||1;return{x:se(se(e*n)/n)||0,y:se(se(i*n)/n)||0}}(r):"function"==typeof h?h(r):r,u=d.x,f=void 0===u?0:u,p=d.y,m=void 0===p?0:p,g=r.hasOwnProperty("x"),_=r.hasOwnProperty("y"),b=bt,v=mt,y=window;if(c){var w=te(i),E="clientHeight",A="clientWidth";w===Wt(i)&&"static"!==Yt(w=Gt(i)).position&&"absolute"===a&&(E="scrollHeight",A="scrollWidth"),w=w,s!==mt&&(s!==bt&&s!==_t||o!==Et)||(v=gt,m-=w[E]-n.height,m*=l?1:-1),s!==bt&&(s!==mt&&s!==gt||o!==Et)||(b=_t,f-=w[A]-n.width,f*=l?1:-1)}var T,O=Object.assign({position:a},c&&he);return l?Object.assign({},O,((T={})[v]=_?"0":"",T[b]=g?"0":"",T.transform=(y.devicePixelRatio||1)<=1?"translate("+f+"px, "+m+"px)":"translate3d("+f+"px, "+m+"px, 0)",T)):Object.assign({},O,((e={})[v]=_?m+"px":"",e[b]=g?f+"px":"",e.transform="",e))}const ue={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,o=i.adaptive,r=void 0===o||o,a=i.roundOffsets,l=void 0===a||a,c={placement:Ut(e.placement),variation:ce(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,de(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:r,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,de(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}};var fe={passive:!0};const pe={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,o=void 0===s||s,r=n.resize,a=void 0===r||r,l=Wt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",i.update,fe)})),a&&l.addEventListener("resize",i.update,fe),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",i.update,fe)})),a&&l.removeEventListener("resize",i.update,fe)}},data:{}};var me={left:"right",right:"left",bottom:"top",top:"bottom"};function ge(t){return t.replace(/left|right|bottom|top/g,(function(t){return me[t]}))}var _e={start:"end",end:"start"};function be(t){return t.replace(/start|end/g,(function(t){return _e[t]}))}function ve(t){var e=Wt(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ye(t){return Vt(Gt(t)).left+ve(t).scrollLeft}function we(t){var e=Yt(t),i=e.overflow,n=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+n)}function Ee(t){return["html","body","#document"].indexOf(Rt(t))>=0?t.ownerDocument.body:zt(t)&&we(t)?t:Ee(Zt(t))}function Ae(t,e){var i;void 0===e&&(e=[]);var n=Ee(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),o=Wt(n),r=s?[o].concat(o.visualViewport||[],we(n)?n:[]):n,a=e.concat(r);return s?a:a.concat(Ae(Zt(r)))}function Te(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Oe(t,e){return e===Tt?Te(function(t){var e=Wt(t),i=Gt(t),n=e.visualViewport,s=i.clientWidth,o=i.clientHeight,r=0,a=0;return n&&(s=n.width,o=n.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(r=n.offsetLeft,a=n.offsetTop)),{width:s,height:o,x:r+ye(t),y:a}}(t)):zt(e)?function(t){var e=Vt(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):Te(function(t){var e,i=Gt(t),n=ve(t),s=null==(e=t.ownerDocument)?void 0:e.body,o=ie(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),r=ie(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+ye(t),l=-n.scrollTop;return"rtl"===Yt(s||i).direction&&(a+=ie(i.clientWidth,s?s.clientWidth:0)-o),{width:o,height:r,x:a,y:l}}(Gt(t)))}function Ce(t){var e,i=t.reference,n=t.element,s=t.placement,o=s?Ut(s):null,r=s?ce(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(o){case mt:e={x:a,y:i.y-n.height};break;case gt:e={x:a,y:i.y+i.height};break;case _t:e={x:i.x+i.width,y:l};break;case bt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=o?ee(o):null;if(null!=c){var h="y"===c?"height":"width";switch(r){case wt:e[c]=e[c]-(i[h]/2-n[h]/2);break;case Et:e[c]=e[c]+(i[h]/2-n[h]/2)}}return e}function ke(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=void 0===n?t.placement:n,o=i.boundary,r=void 0===o?At:o,a=i.rootBoundary,l=void 0===a?Tt:a,c=i.elementContext,h=void 0===c?Ot:c,d=i.altBoundary,u=void 0!==d&&d,f=i.padding,p=void 0===f?0:f,m=re("number"!=typeof p?p:ae(p,yt)),g=h===Ot?Ct:Ot,_=t.rects.popper,b=t.elements[u?g:h],v=function(t,e,i){var n="clippingParents"===e?function(t){var e=Ae(Zt(t)),i=["absolute","fixed"].indexOf(Yt(t).position)>=0&&zt(t)?te(t):t;return $t(i)?e.filter((function(t){return $t(t)&&Xt(t,i)&&"body"!==Rt(t)})):[]}(t):[].concat(e),s=[].concat(n,[i]),o=s[0],r=s.reduce((function(e,i){var n=Oe(t,i);return e.top=ie(n.top,e.top),e.right=ne(n.right,e.right),e.bottom=ne(n.bottom,e.bottom),e.left=ie(n.left,e.left),e}),Oe(t,o));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}($t(b)?b:b.contextElement||Gt(t.elements.popper),r,l),y=Vt(t.elements.reference),w=Ce({reference:y,element:_,strategy:"absolute",placement:s}),E=Te(Object.assign({},_,w)),A=h===Ot?E:y,T={top:v.top-A.top+m.top,bottom:A.bottom-v.bottom+m.bottom,left:v.left-A.left+m.left,right:A.right-v.right+m.right},O=t.modifiersData.offset;if(h===Ot&&O){var C=O[s];Object.keys(T).forEach((function(t){var e=[_t,gt].indexOf(t)>=0?1:-1,i=[mt,gt].indexOf(t)>=0?"y":"x";T[t]+=C[i]*e}))}return T}function Le(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=i.boundary,o=i.rootBoundary,r=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?Lt:l,h=ce(n),d=h?a?kt:kt.filter((function(t){return ce(t)===h})):yt,u=d.filter((function(t){return c.indexOf(t)>=0}));0===u.length&&(u=d);var f=u.reduce((function(e,i){return e[i]=ke(t,{placement:i,boundary:s,rootBoundary:o,padding:r})[Ut(i)],e}),{});return Object.keys(f).sort((function(t,e){return f[t]-f[e]}))}const xe={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0===r||r,l=i.fallbackPlacements,c=i.padding,h=i.boundary,d=i.rootBoundary,u=i.altBoundary,f=i.flipVariations,p=void 0===f||f,m=i.allowedAutoPlacements,g=e.options.placement,_=Ut(g),b=l||(_!==g&&p?function(t){if(Ut(t)===vt)return[];var e=ge(t);return[be(t),e,be(e)]}(g):[ge(g)]),v=[g].concat(b).reduce((function(t,i){return t.concat(Ut(i)===vt?Le(e,{placement:i,boundary:h,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:m}):i)}),[]),y=e.rects.reference,w=e.rects.popper,E=new Map,A=!0,T=v[0],O=0;O=0,D=x?"width":"height",S=ke(e,{placement:C,boundary:h,rootBoundary:d,altBoundary:u,padding:c}),N=x?L?_t:bt:L?gt:mt;y[D]>w[D]&&(N=ge(N));var I=ge(N),P=[];if(o&&P.push(S[k]<=0),a&&P.push(S[N]<=0,S[I]<=0),P.every((function(t){return t}))){T=C,A=!1;break}E.set(C,P)}if(A)for(var j=function(t){var e=v.find((function(e){var i=E.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return T=e,"break"},M=p?3:1;M>0&&"break"!==j(M);M--);e.placement!==T&&(e.modifiersData[n]._skip=!0,e.placement=T,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function De(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Se(t){return[mt,_t,gt,bt].some((function(e){return t[e]>=0}))}const Ne={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,o=e.modifiersData.preventOverflow,r=ke(e,{elementContext:"reference"}),a=ke(e,{altBoundary:!0}),l=De(r,n),c=De(a,s,o),h=Se(l),d=Se(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}},Ie={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.offset,o=void 0===s?[0,0]:s,r=Lt.reduce((function(t,i){return t[i]=function(t,e,i){var n=Ut(t),s=[bt,mt].indexOf(n)>=0?-1:1,o="function"==typeof i?i(Object.assign({},e,{placement:t})):i,r=o[0],a=o[1];return r=r||0,a=(a||0)*s,[bt,_t].indexOf(n)>=0?{x:a,y:r}:{x:r,y:a}}(i,e.rects,o),t}),{}),a=r[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=r}},Pe={name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,i=t.name;e.modifiersData[i]=Ce({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},je={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0!==r&&r,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,d=i.padding,u=i.tether,f=void 0===u||u,p=i.tetherOffset,m=void 0===p?0:p,g=ke(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),_=Ut(e.placement),b=ce(e.placement),v=!b,y=ee(_),w="x"===y?"y":"x",E=e.modifiersData.popperOffsets,A=e.rects.reference,T=e.rects.popper,O="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,C={x:0,y:0};if(E){if(o||a){var k="y"===y?mt:bt,L="y"===y?gt:_t,x="y"===y?"height":"width",D=E[y],S=E[y]+g[k],N=E[y]-g[L],I=f?-T[x]/2:0,P=b===wt?A[x]:T[x],j=b===wt?-T[x]:-A[x],M=e.elements.arrow,H=f&&M?Kt(M):{width:0,height:0},B=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},R=B[k],W=B[L],$=oe(0,A[x],H[x]),z=v?A[x]/2-I-$-R-O:P-$-R-O,q=v?-A[x]/2+I+$+W+O:j+$+W+O,F=e.elements.arrow&&te(e.elements.arrow),U=F?"y"===y?F.clientTop||0:F.clientLeft||0:0,V=e.modifiersData.offset?e.modifiersData.offset[e.placement][y]:0,K=E[y]+z-V-U,X=E[y]+q-V;if(o){var Y=oe(f?ne(S,K):S,D,f?ie(N,X):N);E[y]=Y,C[y]=Y-D}if(a){var Q="x"===y?mt:bt,G="x"===y?gt:_t,Z=E[w],J=Z+g[Q],tt=Z-g[G],et=oe(f?ne(J,K):J,Z,f?ie(tt,X):tt);E[w]=et,C[w]=et-Z}}e.modifiersData[n]=C}},requiresIfExists:["offset"]};function Me(t,e,i){void 0===i&&(i=!1);var n=zt(e);zt(e)&&function(t){var e=t.getBoundingClientRect();e.width,t.offsetWidth,e.height,t.offsetHeight}(e);var s,o,r=Gt(e),a=Vt(t),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(n||!n&&!i)&&(("body"!==Rt(e)||we(r))&&(l=(s=e)!==Wt(s)&&zt(s)?{scrollLeft:(o=s).scrollLeft,scrollTop:o.scrollTop}:ve(s)),zt(e)?((c=Vt(e)).x+=e.clientLeft,c.y+=e.clientTop):r&&(c.x=ye(r))),{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}function He(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||s(t)})),n}var Be={placement:"bottom",modifiers:[],strategy:"absolute"};function Re(){for(var t=arguments.length,e=new Array(t),i=0;ij.on(t,"mouseover",d))),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(Je),this._element.classList.add(Je),j.trigger(this._element,"shown.bs.dropdown",t)}hide(){if(c(this._element)||!this._isShown(this._menu))return;const t={relatedTarget:this._element};this._completeHide(t)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(t){j.trigger(this._element,"hide.bs.dropdown",t).defaultPrevented||("ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>j.off(t,"mouseover",d))),this._popper&&this._popper.destroy(),this._menu.classList.remove(Je),this._element.classList.remove(Je),this._element.setAttribute("aria-expanded","false"),U.removeDataAttribute(this._menu,"popper"),j.trigger(this._element,"hidden.bs.dropdown",t))}_getConfig(t){if(t={...this.constructor.Default,...U.getDataAttributes(this._element),...t},a(Ue,t,this.constructor.DefaultType),"object"==typeof t.reference&&!o(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError(`${Ue.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return t}_createPopper(t){if(void 0===Fe)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let e=this._element;"parent"===this._config.reference?e=t:o(this._config.reference)?e=r(this._config.reference):"object"==typeof this._config.reference&&(e=this._config.reference);const i=this._getPopperConfig(),n=i.modifiers.find((t=>"applyStyles"===t.name&&!1===t.enabled));this._popper=qe(e,this._menu,i),n&&U.setDataAttribute(this._menu,"popper","static")}_isShown(t=this._element){return t.classList.contains(Je)}_getMenuElement(){return V.next(this._element,ei)[0]}_getPlacement(){const t=this._element.parentNode;if(t.classList.contains("dropend"))return ri;if(t.classList.contains("dropstart"))return ai;const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?ni:ii:e?oi:si}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return"static"===this._config.display&&(t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,..."function"==typeof this._config.popperConfig?this._config.popperConfig(t):this._config.popperConfig}}_selectMenuItem({key:t,target:e}){const i=V.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter(l);i.length&&v(i,e,t===Ye,!i.includes(e)).focus()}static jQueryInterface(t){return this.each((function(){const e=hi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}static clearMenus(t){if(t&&(2===t.button||"keyup"===t.type&&"Tab"!==t.key))return;const e=V.find(ti);for(let i=0,n=e.length;ie+t)),this._setElementAttributes(di,"paddingRight",(e=>e+t)),this._setElementAttributes(ui,"marginRight",(e=>e-t))}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,i){const n=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+n)return;this._saveInitialAttribute(t,e);const s=window.getComputedStyle(t)[e];t.style[e]=`${i(Number.parseFloat(s))}px`}))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(di,"paddingRight"),this._resetElementAttributes(ui,"marginRight")}_saveInitialAttribute(t,e){const i=t.style[e];i&&U.setDataAttribute(t,e,i)}_resetElementAttributes(t,e){this._applyManipulationCallback(t,(t=>{const i=U.getDataAttribute(t,e);void 0===i?t.style.removeProperty(e):(U.removeDataAttribute(t,e),t.style[e]=i)}))}_applyManipulationCallback(t,e){o(t)?e(t):V.find(t,this._element).forEach(e)}isOverflowing(){return this.getWidth()>0}}const pi={className:"modal-backdrop",isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},mi={className:"string",isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},gi="show",_i="mousedown.bs.backdrop";class bi{constructor(t){this._config=this._getConfig(t),this._isAppended=!1,this._element=null}show(t){this._config.isVisible?(this._append(),this._config.isAnimated&&u(this._getElement()),this._getElement().classList.add(gi),this._emulateAnimation((()=>{_(t)}))):_(t)}hide(t){this._config.isVisible?(this._getElement().classList.remove(gi),this._emulateAnimation((()=>{this.dispose(),_(t)}))):_(t)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_getConfig(t){return(t={...pi,..."object"==typeof t?t:{}}).rootElement=r(t.rootElement),a("backdrop",t,mi),t}_append(){this._isAppended||(this._config.rootElement.append(this._getElement()),j.on(this._getElement(),_i,(()=>{_(this._config.clickCallback)})),this._isAppended=!0)}dispose(){this._isAppended&&(j.off(this._element,_i),this._element.remove(),this._isAppended=!1)}_emulateAnimation(t){b(t,this._getElement(),this._config.isAnimated)}}const vi={trapElement:null,autofocus:!0},yi={trapElement:"element",autofocus:"boolean"},wi=".bs.focustrap",Ei="backward";class Ai{constructor(t){this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}activate(){const{trapElement:t,autofocus:e}=this._config;this._isActive||(e&&t.focus(),j.off(document,wi),j.on(document,"focusin.bs.focustrap",(t=>this._handleFocusin(t))),j.on(document,"keydown.tab.bs.focustrap",(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,j.off(document,wi))}_handleFocusin(t){const{target:e}=t,{trapElement:i}=this._config;if(e===document||e===i||i.contains(e))return;const n=V.focusableChildren(i);0===n.length?i.focus():this._lastTabNavDirection===Ei?n[n.length-1].focus():n[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?Ei:"forward")}_getConfig(t){return t={...vi,..."object"==typeof t?t:{}},a("focustrap",t,yi),t}}const Ti="modal",Oi="Escape",Ci={backdrop:!0,keyboard:!0,focus:!0},ki={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean"},Li="hidden.bs.modal",xi="show.bs.modal",Di="resize.bs.modal",Si="click.dismiss.bs.modal",Ni="keydown.dismiss.bs.modal",Ii="mousedown.dismiss.bs.modal",Pi="modal-open",ji="show",Mi="modal-static";class Hi extends B{constructor(t,e){super(t),this._config=this._getConfig(e),this._dialog=V.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollBar=new fi}static get Default(){return Ci}static get NAME(){return Ti}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||j.trigger(this._element,xi,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._scrollBar.hide(),document.body.classList.add(Pi),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),j.on(this._dialog,Ii,(()=>{j.one(this._element,"mouseup.dismiss.bs.modal",(t=>{t.target===this._element&&(this._ignoreBackdropClick=!0)}))})),this._showBackdrop((()=>this._showElement(t))))}hide(){if(!this._isShown||this._isTransitioning)return;if(j.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),this._focustrap.deactivate(),this._element.classList.remove(ji),j.off(this._element,Si),j.off(this._dialog,Ii),this._queueCallback((()=>this._hideModal()),this._element,t)}dispose(){[window,this._dialog].forEach((t=>j.off(t,".bs.modal"))),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new bi({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Ai({trapElement:this._element})}_getConfig(t){return t={...Ci,...U.getDataAttributes(this._element),..."object"==typeof t?t:{}},a(Ti,t,ki),t}_showElement(t){const e=this._isAnimated(),i=V.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,i&&(i.scrollTop=0),e&&u(this._element),this._element.classList.add(ji),this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,j.trigger(this._element,"shown.bs.modal",{relatedTarget:t})}),this._dialog,e)}_setEscapeEvent(){this._isShown?j.on(this._element,Ni,(t=>{this._config.keyboard&&t.key===Oi?(t.preventDefault(),this.hide()):this._config.keyboard||t.key!==Oi||this._triggerBackdropTransition()})):j.off(this._element,Ni)}_setResizeEvent(){this._isShown?j.on(window,Di,(()=>this._adjustDialog())):j.off(window,Di)}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(Pi),this._resetAdjustments(),this._scrollBar.reset(),j.trigger(this._element,Li)}))}_showBackdrop(t){j.on(this._element,Si,(t=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:t.target===t.currentTarget&&(!0===this._config.backdrop?this.hide():"static"===this._config.backdrop&&this._triggerBackdropTransition())})),this._backdrop.show(t)}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(j.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const{classList:t,scrollHeight:e,style:i}=this._element,n=e>document.documentElement.clientHeight;!n&&"hidden"===i.overflowY||t.contains(Mi)||(n||(i.overflowY="hidden"),t.add(Mi),this._queueCallback((()=>{t.remove(Mi),n||this._queueCallback((()=>{i.overflowY=""}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;(!i&&t&&!m()||i&&!t&&m())&&(this._element.style.paddingLeft=`${e}px`),(i&&!t&&!m()||!i&&t&&m())&&(this._element.style.paddingRight=`${e}px`)}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const i=Hi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e)}}))}}j.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(t){const e=n(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),j.one(e,xi,(t=>{t.defaultPrevented||j.one(e,Li,(()=>{l(this)&&this.focus()}))}));const i=V.findOne(".modal.show");i&&Hi.getInstance(i).hide(),Hi.getOrCreateInstance(e).toggle(this)})),R(Hi),g(Hi);const Bi="offcanvas",Ri={backdrop:!0,keyboard:!0,scroll:!1},Wi={backdrop:"boolean",keyboard:"boolean",scroll:"boolean"},$i="show",zi=".offcanvas.show",qi="hidden.bs.offcanvas";class Fi extends B{constructor(t,e){super(t),this._config=this._getConfig(e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get NAME(){return Bi}static get Default(){return Ri}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||j.trigger(this._element,"show.bs.offcanvas",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._element.style.visibility="visible",this._backdrop.show(),this._config.scroll||(new fi).hide(),this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add($i),this._queueCallback((()=>{this._config.scroll||this._focustrap.activate(),j.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:t})}),this._element,!0))}hide(){this._isShown&&(j.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.remove($i),this._backdrop.hide(),this._queueCallback((()=>{this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._element.style.visibility="hidden",this._config.scroll||(new fi).reset(),j.trigger(this._element,qi)}),this._element,!0)))}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_getConfig(t){return t={...Ri,...U.getDataAttributes(this._element),..."object"==typeof t?t:{}},a(Bi,t,Wi),t}_initializeBackDrop(){return new bi({className:"offcanvas-backdrop",isVisible:this._config.backdrop,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:()=>this.hide()})}_initializeFocusTrap(){return new Ai({trapElement:this._element})}_addEventListeners(){j.on(this._element,"keydown.dismiss.bs.offcanvas",(t=>{this._config.keyboard&&"Escape"===t.key&&this.hide()}))}static jQueryInterface(t){return this.each((function(){const e=Fi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}j.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',(function(t){const e=n(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),c(this))return;j.one(e,qi,(()=>{l(this)&&this.focus()}));const i=V.findOne(zi);i&&i!==e&&Fi.getInstance(i).hide(),Fi.getOrCreateInstance(e).toggle(this)})),j.on(window,"load.bs.offcanvas.data-api",(()=>V.find(zi).forEach((t=>Fi.getOrCreateInstance(t).show())))),R(Fi),g(Fi);const Ui=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Vi=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,Ki=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,Xi=(t,e)=>{const i=t.nodeName.toLowerCase();if(e.includes(i))return!Ui.has(i)||Boolean(Vi.test(t.nodeValue)||Ki.test(t.nodeValue));const n=e.filter((t=>t instanceof RegExp));for(let t=0,e=n.length;t{Xi(t,r)||i.removeAttribute(t.nodeName)}))}return n.body.innerHTML}const Qi="tooltip",Gi=new Set(["sanitize","allowList","sanitizeFn"]),Zi={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",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)"},Ji={AUTO:"auto",TOP:"top",RIGHT:m()?"left":"right",BOTTOM:"bottom",LEFT:m()?"right":"left"},tn={animation:!0,template:'',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:[0,0],container:!1,fallbackPlacements:["top","right","bottom","left"],boundary:"clippingParents",customClass:"",sanitize:!0,sanitizeFn:null,allowList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},en={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},nn="fade",sn="show",on="show",rn="out",an=".tooltip-inner",ln=".modal",cn="hide.bs.modal",hn="hover",dn="focus";class un extends B{constructor(t,e){if(void 0===Fe)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this._config=this._getConfig(e),this.tip=null,this._setListeners()}static get Default(){return tn}static get NAME(){return Qi}static get Event(){return en}static get DefaultType(){return Zi}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(t){if(this._isEnabled)if(t){const e=this._initializeOnDelegatedTarget(t);e._activeTrigger.click=!e._activeTrigger.click,e._isWithActiveTrigger()?e._enter(null,e):e._leave(null,e)}else{if(this.getTipElement().classList.contains(sn))return void this._leave(null,this);this._enter(null,this)}}dispose(){clearTimeout(this._timeout),j.off(this._element.closest(ln),cn,this._hideModalHandler),this.tip&&this.tip.remove(),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this.isWithContent()||!this._isEnabled)return;const t=j.trigger(this._element,this.constructor.Event.SHOW),e=h(this._element),i=null===e?this._element.ownerDocument.documentElement.contains(this._element):e.contains(this._element);if(t.defaultPrevented||!i)return;"tooltip"===this.constructor.NAME&&this.tip&&this.getTitle()!==this.tip.querySelector(an).innerHTML&&(this._disposePopper(),this.tip.remove(),this.tip=null);const n=this.getTipElement(),s=(t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t})(this.constructor.NAME);n.setAttribute("id",s),this._element.setAttribute("aria-describedby",s),this._config.animation&&n.classList.add(nn);const o="function"==typeof this._config.placement?this._config.placement.call(this,n,this._element):this._config.placement,r=this._getAttachment(o);this._addAttachmentClass(r);const{container:a}=this._config;H.set(n,this.constructor.DATA_KEY,this),this._element.ownerDocument.documentElement.contains(this.tip)||(a.append(n),j.trigger(this._element,this.constructor.Event.INSERTED)),this._popper?this._popper.update():this._popper=qe(this._element,n,this._getPopperConfig(r)),n.classList.add(sn);const l=this._resolvePossibleFunction(this._config.customClass);l&&n.classList.add(...l.split(" ")),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>{j.on(t,"mouseover",d)}));const c=this.tip.classList.contains(nn);this._queueCallback((()=>{const t=this._hoverState;this._hoverState=null,j.trigger(this._element,this.constructor.Event.SHOWN),t===rn&&this._leave(null,this)}),this.tip,c)}hide(){if(!this._popper)return;const t=this.getTipElement();if(j.trigger(this._element,this.constructor.Event.HIDE).defaultPrevented)return;t.classList.remove(sn),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>j.off(t,"mouseover",d))),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1;const e=this.tip.classList.contains(nn);this._queueCallback((()=>{this._isWithActiveTrigger()||(this._hoverState!==on&&t.remove(),this._cleanTipClass(),this._element.removeAttribute("aria-describedby"),j.trigger(this._element,this.constructor.Event.HIDDEN),this._disposePopper())}),this.tip,e),this._hoverState=""}update(){null!==this._popper&&this._popper.update()}isWithContent(){return Boolean(this.getTitle())}getTipElement(){if(this.tip)return this.tip;const t=document.createElement("div");t.innerHTML=this._config.template;const e=t.children[0];return this.setContent(e),e.classList.remove(nn,sn),this.tip=e,this.tip}setContent(t){this._sanitizeAndSetContent(t,this.getTitle(),an)}_sanitizeAndSetContent(t,e,i){const n=V.findOne(i,t);e||!n?this.setElementContent(n,e):n.remove()}setElementContent(t,e){if(null!==t)return o(e)?(e=r(e),void(this._config.html?e.parentNode!==t&&(t.innerHTML="",t.append(e)):t.textContent=e.textContent)):void(this._config.html?(this._config.sanitize&&(e=Yi(e,this._config.allowList,this._config.sanitizeFn)),t.innerHTML=e):t.textContent=e)}getTitle(){const t=this._element.getAttribute("data-bs-original-title")||this._config.title;return this._resolvePossibleFunction(t)}updateAttachment(t){return"right"===t?"end":"left"===t?"start":t}_initializeOnDelegatedTarget(t,e){return e||this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return"function"==typeof t?t.call(this._element):t}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"onChange",enabled:!0,phase:"afterWrite",fn:t=>this._handlePopperPlacementChange(t)}],onFirstUpdate:t=>{t.options.placement!==t.placement&&this._handlePopperPlacementChange(t)}};return{...e,..."function"==typeof this._config.popperConfig?this._config.popperConfig(e):this._config.popperConfig}}_addAttachmentClass(t){this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(t)}`)}_getAttachment(t){return Ji[t.toUpperCase()]}_setListeners(){this._config.trigger.split(" ").forEach((t=>{if("click"===t)j.on(this._element,this.constructor.Event.CLICK,this._config.selector,(t=>this.toggle(t)));else if("manual"!==t){const e=t===hn?this.constructor.Event.MOUSEENTER:this.constructor.Event.FOCUSIN,i=t===hn?this.constructor.Event.MOUSELEAVE:this.constructor.Event.FOCUSOUT;j.on(this._element,e,this._config.selector,(t=>this._enter(t))),j.on(this._element,i,this._config.selector,(t=>this._leave(t)))}})),this._hideModalHandler=()=>{this._element&&this.hide()},j.on(this._element.closest(ln),cn,this._hideModalHandler),this._config.selector?this._config={...this._config,trigger:"manual",selector:""}:this._fixTitle()}_fixTitle(){const t=this._element.getAttribute("title"),e=typeof this._element.getAttribute("data-bs-original-title");(t||"string"!==e)&&(this._element.setAttribute("data-bs-original-title",t||""),!t||this._element.getAttribute("aria-label")||this._element.textContent||this._element.setAttribute("aria-label",t),this._element.setAttribute("title",""))}_enter(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusin"===t.type?dn:hn]=!0),e.getTipElement().classList.contains(sn)||e._hoverState===on?e._hoverState=on:(clearTimeout(e._timeout),e._hoverState=on,e._config.delay&&e._config.delay.show?e._timeout=setTimeout((()=>{e._hoverState===on&&e.show()}),e._config.delay.show):e.show())}_leave(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusout"===t.type?dn:hn]=e._element.contains(t.relatedTarget)),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=rn,e._config.delay&&e._config.delay.hide?e._timeout=setTimeout((()=>{e._hoverState===rn&&e.hide()}),e._config.delay.hide):e.hide())}_isWithActiveTrigger(){for(const t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1}_getConfig(t){const e=U.getDataAttributes(this._element);return Object.keys(e).forEach((t=>{Gi.has(t)&&delete e[t]})),(t={...this.constructor.Default,...e,..."object"==typeof t&&t?t:{}}).container=!1===t.container?document.body:r(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),a(Qi,t,this.constructor.DefaultType),t.sanitize&&(t.template=Yi(t.template,t.allowList,t.sanitizeFn)),t}_getDelegateConfig(){const t={};for(const e in this._config)this.constructor.Default[e]!==this._config[e]&&(t[e]=this._config[e]);return t}_cleanTipClass(){const t=this.getTipElement(),e=new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`,"g"),i=t.getAttribute("class").match(e);null!==i&&i.length>0&&i.map((t=>t.trim())).forEach((e=>t.classList.remove(e)))}_getBasicClassPrefix(){return"bs-tooltip"}_handlePopperPlacementChange(t){const{state:e}=t;e&&(this.tip=e.elements.popper,this._cleanTipClass(),this._addAttachmentClass(this._getAttachment(e.placement)))}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null)}static jQueryInterface(t){return this.each((function(){const e=un.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g(un);const fn={...un.Default,placement:"right",offset:[0,8],trigger:"click",content:"",template:''},pn={...un.DefaultType,content:"(string|element|function)"},mn={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"};class gn extends un{static get Default(){return fn}static get NAME(){return"popover"}static get Event(){return mn}static get DefaultType(){return pn}isWithContent(){return this.getTitle()||this._getContent()}setContent(t){this._sanitizeAndSetContent(t,this.getTitle(),".popover-header"),this._sanitizeAndSetContent(t,this._getContent(),".popover-body")}_getContent(){return this._resolvePossibleFunction(this._config.content)}_getBasicClassPrefix(){return"bs-popover"}static jQueryInterface(t){return this.each((function(){const e=gn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g(gn);const _n="scrollspy",bn={offset:10,method:"auto",target:""},vn={offset:"number",method:"string",target:"(string|element)"},yn="active",wn=".nav-link, .list-group-item, .dropdown-item",En="position";class An extends B{constructor(t,e){super(t),this._scrollElement="BODY"===this._element.tagName?window:this._element,this._config=this._getConfig(e),this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,j.on(this._scrollElement,"scroll.bs.scrollspy",(()=>this._process())),this.refresh(),this._process()}static get Default(){return bn}static get NAME(){return _n}refresh(){const t=this._scrollElement===this._scrollElement.window?"offset":En,e="auto"===this._config.method?t:this._config.method,n=e===En?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),V.find(wn,this._config.target).map((t=>{const s=i(t),o=s?V.findOne(s):null;if(o){const t=o.getBoundingClientRect();if(t.width||t.height)return[U[e](o).top+n,s]}return null})).filter((t=>t)).sort(((t,e)=>t[0]-e[0])).forEach((t=>{this._offsets.push(t[0]),this._targets.push(t[1])}))}dispose(){j.off(this._scrollElement,".bs.scrollspy"),super.dispose()}_getConfig(t){return(t={...bn,...U.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}}).target=r(t.target)||document.documentElement,a(_n,t,vn),t}_getScrollTop(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}_getScrollHeight(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}_getOffsetHeight(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}_process(){const t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),i=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=i){const t=this._targets[this._targets.length-1];this._activeTarget!==t&&this._activate(t)}else{if(this._activeTarget&&t0)return this._activeTarget=null,void this._clear();for(let e=this._offsets.length;e--;)this._activeTarget!==this._targets[e]&&t>=this._offsets[e]&&(void 0===this._offsets[e+1]||t`${e}[data-bs-target="${t}"],${e}[href="${t}"]`)),i=V.findOne(e.join(","),this._config.target);i.classList.add(yn),i.classList.contains("dropdown-item")?V.findOne(".dropdown-toggle",i.closest(".dropdown")).classList.add(yn):V.parents(i,".nav, .list-group").forEach((t=>{V.prev(t,".nav-link, .list-group-item").forEach((t=>t.classList.add(yn))),V.prev(t,".nav-item").forEach((t=>{V.children(t,".nav-link").forEach((t=>t.classList.add(yn)))}))})),j.trigger(this._scrollElement,"activate.bs.scrollspy",{relatedTarget:t})}_clear(){V.find(wn,this._config.target).filter((t=>t.classList.contains(yn))).forEach((t=>t.classList.remove(yn)))}static jQueryInterface(t){return this.each((function(){const e=An.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}j.on(window,"load.bs.scrollspy.data-api",(()=>{V.find('[data-bs-spy="scroll"]').forEach((t=>new An(t)))})),g(An);const Tn="active",On="fade",Cn="show",kn=".active",Ln=":scope > li > .active";class xn extends B{static get NAME(){return"tab"}show(){if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&this._element.classList.contains(Tn))return;let t;const e=n(this._element),i=this._element.closest(".nav, .list-group");if(i){const e="UL"===i.nodeName||"OL"===i.nodeName?Ln:kn;t=V.find(e,i),t=t[t.length-1]}const s=t?j.trigger(t,"hide.bs.tab",{relatedTarget:this._element}):null;if(j.trigger(this._element,"show.bs.tab",{relatedTarget:t}).defaultPrevented||null!==s&&s.defaultPrevented)return;this._activate(this._element,i);const o=()=>{j.trigger(t,"hidden.bs.tab",{relatedTarget:this._element}),j.trigger(this._element,"shown.bs.tab",{relatedTarget:t})};e?this._activate(e,e.parentNode,o):o()}_activate(t,e,i){const n=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?V.children(e,kn):V.find(Ln,e))[0],s=i&&n&&n.classList.contains(On),o=()=>this._transitionComplete(t,n,i);n&&s?(n.classList.remove(Cn),this._queueCallback(o,t,!0)):o()}_transitionComplete(t,e,i){if(e){e.classList.remove(Tn);const t=V.findOne(":scope > .dropdown-menu .active",e.parentNode);t&&t.classList.remove(Tn),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1)}t.classList.add(Tn),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),u(t),t.classList.contains(On)&&t.classList.add(Cn);let n=t.parentNode;if(n&&"LI"===n.nodeName&&(n=n.parentNode),n&&n.classList.contains("dropdown-menu")){const e=t.closest(".dropdown");e&&V.find(".dropdown-toggle",e).forEach((t=>t.classList.add(Tn))),t.setAttribute("aria-expanded",!0)}i&&i()}static jQueryInterface(t){return this.each((function(){const e=xn.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}j.on(document,"click.bs.tab.data-api",'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',(function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),c(this)||xn.getOrCreateInstance(this).show()})),g(xn);const Dn="toast",Sn="hide",Nn="show",In="showing",Pn={animation:"boolean",autohide:"boolean",delay:"number"},jn={animation:!0,autohide:!0,delay:5e3};class Mn extends B{constructor(t,e){super(t),this._config=this._getConfig(e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get DefaultType(){return Pn}static get Default(){return jn}static get NAME(){return Dn}show(){j.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove(Sn),u(this._element),this._element.classList.add(Nn),this._element.classList.add(In),this._queueCallback((()=>{this._element.classList.remove(In),j.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide()}),this._element,this._config.animation))}hide(){this._element.classList.contains(Nn)&&(j.trigger(this._element,"hide.bs.toast").defaultPrevented||(this._element.classList.add(In),this._queueCallback((()=>{this._element.classList.add(Sn),this._element.classList.remove(In),this._element.classList.remove(Nn),j.trigger(this._element,"hidden.bs.toast")}),this._element,this._config.animation)))}dispose(){this._clearTimeout(),this._element.classList.contains(Nn)&&this._element.classList.remove(Nn),super.dispose()}_getConfig(t){return t={...jn,...U.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}},a(Dn,t,this.constructor.DefaultType),t}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){j.on(this._element,"mouseover.bs.toast",(t=>this._onInteraction(t,!0))),j.on(this._element,"mouseout.bs.toast",(t=>this._onInteraction(t,!1))),j.on(this._element,"focusin.bs.toast",(t=>this._onInteraction(t,!0))),j.on(this._element,"focusout.bs.toast",(t=>this._onInteraction(t,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){const e=Mn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}return R(Mn),g(Mn),{Alert:W,Button:z,Carousel:st,Collapse:pt,Dropdown:hi,Modal:Hi,Offcanvas:Fi,Popover:gn,ScrollSpy:An,Tab:xn,Toast:Mn,Tooltip:un}})); +//# sourceMappingURL=bootstrap.bundle.min.js.map \ No newline at end of file diff --git a/deps/bootstrap-5.1.3/bootstrap.bundle.min.js.map b/deps/bootstrap-5.1.3/bootstrap.bundle.min.js.map new file mode 100644 index 000000000..7d78e32a6 --- /dev/null +++ b/deps/bootstrap-5.1.3/bootstrap.bundle.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../js/src/util/index.js","../../js/src/dom/event-handler.js","../../js/src/dom/data.js","../../js/src/base-component.js","../../js/src/util/component-functions.js","../../js/src/alert.js","../../js/src/button.js","../../js/src/dom/manipulator.js","../../js/src/dom/selector-engine.js","../../js/src/carousel.js","../../js/src/collapse.js","../../node_modules/@popperjs/core/lib/enums.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../node_modules/@popperjs/core/lib/utils/math.js","../../node_modules/@popperjs/core/lib/utils/within.js","../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../node_modules/@popperjs/core/lib/createPopper.js","../../node_modules/@popperjs/core/lib/utils/debounce.js","../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../node_modules/@popperjs/core/lib/popper-lite.js","../../node_modules/@popperjs/core/lib/popper.js","../../js/src/dropdown.js","../../js/src/util/scrollbar.js","../../js/src/util/backdrop.js","../../js/src/util/focustrap.js","../../js/src/modal.js","../../js/src/offcanvas.js","../../js/src/util/sanitizer.js","../../js/src/tooltip.js","../../js/src/popover.js","../../js/src/scrollspy.js","../../js/src/tab.js","../../js/src/toast.js","../../js/index.umd.js"],"names":["TRANSITION_END","getSelector","element","selector","getAttribute","hrefAttr","includes","startsWith","split","trim","getSelectorFromElement","document","querySelector","getElementFromSelector","triggerTransitionEnd","dispatchEvent","Event","isElement","obj","jquery","nodeType","getElement","length","typeCheckConfig","componentName","config","configTypes","Object","keys","forEach","property","expectedTypes","value","valueType","toString","call","match","toLowerCase","RegExp","test","TypeError","toUpperCase","isVisible","getClientRects","getComputedStyle","getPropertyValue","isDisabled","Node","ELEMENT_NODE","classList","contains","disabled","hasAttribute","findShadowRoot","documentElement","attachShadow","getRootNode","root","ShadowRoot","parentNode","noop","reflow","offsetHeight","getjQuery","jQuery","window","body","DOMContentLoadedCallbacks","isRTL","dir","defineJQueryPlugin","plugin","callback","$","name","NAME","JQUERY_NO_CONFLICT","fn","jQueryInterface","Constructor","noConflict","readyState","addEventListener","push","execute","executeAfterTransition","transitionElement","waitForTransition","emulatedDuration","transitionDuration","transitionDelay","floatTransitionDuration","Number","parseFloat","floatTransitionDelay","getTransitionDurationFromElement","called","handler","target","removeEventListener","setTimeout","getNextActiveElement","list","activeElement","shouldGetNext","isCycleAllowed","index","indexOf","listLength","Math","max","min","namespaceRegex","stripNameRegex","stripUidRegex","eventRegistry","uidEvent","customEvents","mouseenter","mouseleave","customEventsRegex","nativeEvents","Set","getUidEvent","uid","getEvent","findHandler","events","delegationSelector","uidEventList","i","len","event","originalHandler","normalizeParams","originalTypeEvent","delegationFn","delegation","typeEvent","getTypeEvent","has","addHandler","oneOff","wrapFn","relatedTarget","delegateTarget","this","handlers","previousFn","replace","domElements","querySelectorAll","EventHandler","off","type","apply","bootstrapDelegationHandler","bootstrapHandler","removeHandler","Boolean","on","one","inNamespace","isNamespace","elementEvent","namespace","storeElementEvent","handlerKey","removeNamespacedHandlers","slice","keyHandlers","trigger","args","isNative","jQueryEvent","bubbles","nativeDispatch","defaultPrevented","evt","isPropagationStopped","isImmediatePropagationStopped","isDefaultPrevented","createEvent","initEvent","CustomEvent","cancelable","key","defineProperty","get","preventDefault","elementMap","Map","Data","set","instance","instanceMap","size","console","error","Array","from","remove","delete","BaseComponent","constructor","_element","DATA_KEY","dispose","EVENT_KEY","getOwnPropertyNames","propertyName","_queueCallback","isAnimated","static","getInstance","VERSION","Error","enableDismissTrigger","component","method","clickEvent","tagName","closest","getOrCreateInstance","Alert","close","_destroyElement","each","data","undefined","SELECTOR_DATA_TOGGLE","Button","toggle","setAttribute","normalizeData","val","normalizeDataKey","chr","button","Manipulator","setDataAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","dataset","filter","pureKey","charAt","getDataAttribute","offset","rect","getBoundingClientRect","top","pageYOffset","left","pageXOffset","position","offsetTop","offsetLeft","SelectorEngine","find","concat","Element","prototype","findOne","children","child","matches","parents","ancestor","prev","previous","previousElementSibling","next","nextElementSibling","focusableChildren","focusables","map","join","el","Default","interval","keyboard","slide","pause","wrap","touch","DefaultType","ORDER_NEXT","ORDER_PREV","DIRECTION_LEFT","DIRECTION_RIGHT","KEY_TO_DIRECTION","ArrowLeft","ArrowRight","EVENT_SLID","CLASS_NAME_ACTIVE","SELECTOR_ACTIVE_ITEM","Carousel","super","_items","_interval","_activeElement","_isPaused","_isSliding","touchTimeout","touchStartX","touchDeltaX","_config","_getConfig","_indicatorsElement","_touchSupported","navigator","maxTouchPoints","_pointerEvent","PointerEvent","_addEventListeners","_slide","nextWhenVisible","hidden","cycle","clearInterval","_updateInterval","setInterval","visibilityState","bind","to","activeIndex","_getItemIndex","order","_handleSwipe","absDeltax","abs","direction","_keydown","_addTouchEventListeners","hasPointerPenTouch","pointerType","start","clientX","touches","move","end","clearTimeout","itemImg","add","_getItemByOrder","isNext","_triggerSlideEvent","eventDirectionName","targetIndex","fromIndex","_setActiveIndicatorElement","activeIndicator","indicators","parseInt","elementInterval","defaultInterval","directionOrOrder","_directionToOrder","activeElementIndex","nextElement","nextElementIndex","isCycling","directionalClassName","orderClassName","_orderToDirection","triggerSlidEvent","completeCallBack","action","ride","carouselInterface","slideIndex","dataApiClickHandler","carousels","parent","CLASS_NAME_SHOW","CLASS_NAME_COLLAPSE","CLASS_NAME_COLLAPSING","CLASS_NAME_COLLAPSED","CLASS_NAME_DEEPER_CHILDREN","Collapse","_isTransitioning","_triggerArray","toggleList","elem","filterElement","foundElem","_selector","_initializeChildren","_addAriaAndCollapsedClass","_isShown","hide","show","activesData","actives","container","tempActiveData","elemActive","dimension","_getDimension","style","scrollSize","triggerArrayLength","selected","triggerArray","isOpen","bottom","right","auto","basePlacements","clippingParents","viewport","popper","reference","variationPlacements","reduce","acc","placement","placements","beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite","modifierPhases","getNodeName","nodeName","getWindow","node","ownerDocument","defaultView","isHTMLElement","HTMLElement","isShadowRoot","applyStyles$1","enabled","phase","_ref","state","elements","styles","assign","effect","_ref2","initialStyles","options","strategy","margin","arrow","hasOwnProperty","attribute","requires","getBasePlacement","includeScale","width","height","x","y","getLayoutRect","clientRect","offsetWidth","rootNode","isSameNode","host","isTableElement","getDocumentElement","getParentNode","assignedSlot","getTrueOffsetParent","offsetParent","getOffsetParent","isFirefox","userAgent","currentNode","css","transform","perspective","contain","willChange","getContainingBlock","getMainAxisFromPlacement","round","within","mathMax","mathMin","mergePaddingObject","paddingObject","expandToHashMap","hashMap","arrow$1","_state$modifiersData$","arrowElement","popperOffsets","modifiersData","basePlacement","axis","padding","rects","toPaddingObject","arrowRect","minProp","maxProp","endDiff","startDiff","arrowOffsetParent","clientSize","clientHeight","clientWidth","centerToReference","center","axisProp","centerOffset","_options$element","requiresIfExists","getVariation","unsetSides","mapToStyles","_Object$assign2","popperRect","variation","offsets","gpuAcceleration","adaptive","roundOffsets","_ref3","dpr","devicePixelRatio","roundOffsetsByDPR","_ref3$x","_ref3$y","hasX","hasY","sideX","sideY","win","heightProp","widthProp","_Object$assign","commonStyles","computeStyles$1","_ref4","_options$gpuAccelerat","_options$adaptive","_options$roundOffsets","passive","eventListeners","_options$scroll","scroll","_options$resize","resize","scrollParents","scrollParent","update","hash","getOppositePlacement","matched","getOppositeVariationPlacement","getWindowScroll","scrollLeft","scrollTop","getWindowScrollBarX","isScrollParent","_getComputedStyle","overflow","overflowX","overflowY","getScrollParent","listScrollParents","_element$ownerDocumen","isBody","visualViewport","updatedList","rectToClientRect","getClientRectFromMixedType","clippingParent","html","getViewportRect","clientTop","clientLeft","getInnerBoundingClientRect","winScroll","scrollWidth","scrollHeight","getDocumentRect","computeOffsets","commonX","commonY","mainAxis","detectOverflow","_options","_options$placement","_options$boundary","boundary","_options$rootBoundary","rootBoundary","_options$elementConte","elementContext","_options$altBoundary","altBoundary","_options$padding","altContext","clippingClientRect","mainClippingParents","clipperElement","getClippingParents","firstClippingParent","clippingRect","accRect","getClippingRect","contextElement","referenceClientRect","popperClientRect","elementClientRect","overflowOffsets","offsetData","multiply","computeAutoPlacement","flipVariations","_options$allowedAutoP","allowedAutoPlacements","allPlacements","allowedPlacements","overflows","sort","a","b","flip$1","_skip","_options$mainAxis","checkMainAxis","_options$altAxis","altAxis","checkAltAxis","specifiedFallbackPlacements","fallbackPlacements","_options$flipVariatio","preferredPlacement","oppositePlacement","getExpandedFallbackPlacements","referenceRect","checksMap","makeFallbackChecks","firstFittingPlacement","_basePlacement","isStartVariation","isVertical","mainVariationSide","altVariationSide","checks","every","check","_loop","_i","fittingPlacement","reset","getSideOffsets","preventedOffsets","isAnySideFullyClipped","some","side","hide$1","preventOverflow","referenceOverflow","popperAltOverflow","referenceClippingOffsets","popperEscapeOffsets","isReferenceHidden","hasPopperEscaped","offset$1","_options$offset","invertDistance","skidding","distance","distanceAndSkiddingToXY","_data$state$placement","popperOffsets$1","preventOverflow$1","_options$tether","tether","_options$tetherOffset","tetherOffset","isBasePlacement","tetherOffsetValue","mainSide","altSide","additive","minLen","maxLen","arrowPaddingObject","arrowPaddingMin","arrowPaddingMax","arrowLen","minOffset","maxOffset","clientOffset","offsetModifierValue","tetherMin","tetherMax","preventedOffset","_mainSide","_altSide","_offset","_min","_max","_preventedOffset","getCompositeRect","elementOrVirtualElement","isFixed","isOffsetParentAnElement","isElementScaled","modifiers","visited","result","modifier","dep","depModifier","DEFAULT_OPTIONS","areValidElements","_len","arguments","_key","popperGenerator","generatorOptions","_generatorOptions","_generatorOptions$def","defaultModifiers","_generatorOptions$def2","defaultOptions","pending","orderedModifiers","effectCleanupFns","isDestroyed","setOptions","setOptionsAction","cleanupModifierEffects","merged","orderModifiers","current","existing","m","_ref3$options","cleanupFn","forceUpdate","_state$elements","_state$orderedModifie","_state$orderedModifie2","Promise","resolve","then","destroy","onFirstUpdate","createPopper","computeStyles","applyStyles","flip","ESCAPE_KEY","SPACE_KEY","ARROW_UP_KEY","ARROW_DOWN_KEY","REGEXP_KEYDOWN","EVENT_CLICK_DATA_API","EVENT_KEYDOWN_DATA_API","SELECTOR_MENU","PLACEMENT_TOP","PLACEMENT_TOPEND","PLACEMENT_BOTTOM","PLACEMENT_BOTTOMEND","PLACEMENT_RIGHT","PLACEMENT_LEFT","display","popperConfig","autoClose","Dropdown","_popper","_menu","_getMenuElement","_inNavbar","_detectNavbar","getParentFromElement","_createPopper","focus","_completeHide","Popper","referenceElement","_getPopperConfig","isDisplayStatic","_getPlacement","parentDropdown","isEnd","_getOffset","popperData","defaultBsPopperConfig","_selectMenuItem","items","toggles","context","composedPath","isMenuTarget","isActive","stopPropagation","getToggleButton","clearMenus","dataApiKeydownHandler","SELECTOR_FIXED_CONTENT","SELECTOR_STICKY_CONTENT","ScrollBarHelper","getWidth","documentWidth","innerWidth","_disableOverFlow","_setElementAttributes","calculatedValue","_saveInitialAttribute","styleProp","scrollbarWidth","_applyManipulationCallback","_resetElementAttributes","actualValue","removeProperty","callBack","isOverflowing","className","rootElement","clickCallback","EVENT_MOUSEDOWN","Backdrop","_isAppended","_append","_getElement","_emulateAnimation","backdrop","createElement","append","trapElement","autofocus","TAB_NAV_BACKWARD","FocusTrap","_isActive","_lastTabNavDirection","activate","_handleFocusin","_handleKeydown","deactivate","shiftKey","EVENT_HIDDEN","EVENT_SHOW","EVENT_RESIZE","EVENT_CLICK_DISMISS","EVENT_KEYDOWN_DISMISS","EVENT_MOUSEDOWN_DISMISS","CLASS_NAME_OPEN","CLASS_NAME_STATIC","Modal","_dialog","_backdrop","_initializeBackDrop","_focustrap","_initializeFocusTrap","_ignoreBackdropClick","_scrollBar","_isAnimated","_adjustDialog","_setEscapeEvent","_setResizeEvent","_showBackdrop","_showElement","_hideModal","htmlElement","handleUpdate","modalBody","_triggerBackdropTransition","_resetAdjustments","currentTarget","isModalOverflowing","isBodyOverflowing","paddingLeft","paddingRight","showEvent","allReadyOpen","OPEN_SELECTOR","Offcanvas","visibility","blur","uriAttributes","SAFE_URL_PATTERN","DATA_URL_PATTERN","allowedAttribute","allowedAttributeList","attributeName","nodeValue","regExp","attributeRegex","sanitizeHtml","unsafeHtml","allowList","sanitizeFn","createdDocument","DOMParser","parseFromString","elementName","attributeList","allowedAttributes","innerHTML","DISALLOWED_ATTRIBUTES","animation","template","title","delay","customClass","sanitize","AttachmentMap","AUTO","TOP","RIGHT","BOTTOM","LEFT","area","br","col","code","div","em","hr","h1","h2","h3","h4","h5","h6","img","li","ol","p","pre","s","small","span","sub","sup","strong","u","ul","HIDE","HIDDEN","SHOW","SHOWN","INSERTED","CLICK","FOCUSIN","FOCUSOUT","MOUSEENTER","MOUSELEAVE","CLASS_NAME_FADE","HOVER_STATE_SHOW","HOVER_STATE_OUT","SELECTOR_TOOLTIP_INNER","SELECTOR_MODAL","EVENT_MODAL_HIDE","TRIGGER_HOVER","TRIGGER_FOCUS","Tooltip","_isEnabled","_timeout","_hoverState","_activeTrigger","tip","_setListeners","enable","disable","toggleEnabled","_initializeOnDelegatedTarget","click","_isWithActiveTrigger","_enter","_leave","getTipElement","_hideModalHandler","_disposePopper","isWithContent","shadowRoot","isInTheDom","getTitle","tipId","prefix","floor","random","getElementById","getUID","attachment","_getAttachment","_addAttachmentClass","_resolvePossibleFunction","prevHoverState","_cleanTipClass","setContent","_sanitizeAndSetContent","content","templateElement","setElementContent","textContent","updateAttachment","_getDelegateConfig","_handlePopperPlacementChange","_getBasicClassPrefix","eventIn","eventOut","_fixTitle","originalTitleType","dataAttributes","dataAttr","basicClassPrefixRegex","tabClass","token","tClass","Popover","_getContent","SELECTOR_LINK_ITEMS","METHOD_POSITION","ScrollSpy","_scrollElement","_offsets","_targets","_activeTarget","_scrollHeight","_process","refresh","autoMethod","offsetMethod","offsetBase","_getScrollTop","_getScrollHeight","targetSelector","targetBCR","item","_getOffsetHeight","innerHeight","maxScroll","_activate","_clear","queries","link","listGroup","navItem","spy","SELECTOR_ACTIVE","SELECTOR_ACTIVE_UL","Tab","listElement","itemSelector","hideEvent","complete","active","isTransitioning","_transitionComplete","dropdownChild","dropdownElement","dropdown","CLASS_NAME_HIDE","CLASS_NAME_SHOWING","autohide","Toast","_hasMouseInteraction","_hasKeyboardInteraction","_clearTimeout","_maybeSche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AaQ,GAAGd,KAAK2D,SA/KF,oBA+K2BzE,GAASc,KAAK65B,eAAe36B,GAAO,KAClFoB,EAAaQ,GAAGd,KAAK2D,SA/KD,qBA+K2BzE,GAASc,KAAK65B,eAAe36B,GAAO,KAGrFy6B,gBACErtB,aAAatM,KAAKszB,UAClBtzB,KAAKszB,SAAW,KAKInvB,uBAAC5L,GACrB,OAAOyH,KAAKiF,MAAK,WACf,MAAMC,EAAOs0B,GAAM30B,oBAAoB7E,KAAMzH,GAE7C,GAAsB,iBAAXA,EAAqB,CAC9B,QAA4B,IAAjB2M,EAAK3M,GACd,MAAM,IAAIe,UAAW,oBAAmBf,MAG1C2M,EAAK3M,GAAQyH,kBAMrBuE,EAAqBi1B,IASrBp+B,EAAmBo+B,IC3NJ,CACb10B,MAAAA,EACAO,OAAAA,EACAoE,SAAAA,GACAmF,SAAAA,GACA4Y,SAAAA,GACAgF,MAAAA,GACA4B,UAAAA,GACAsI,QAAAA,GACAI,UAAAA,GACA4B,IAAAA,GACAc,MAAAA,GACApG,QAAAA","sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nconst toType = obj => {\n if (obj === null || obj === undefined) {\n return `${obj}`\n }\n\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst getUID = prefix => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-bs-target')\n\n if (!selector || selector === '#') {\n let hrefAttr = element.getAttribute('href')\n\n // The only valid content that could double as a selector are IDs or classes,\n // so everything starting with `#` or `.`. If a \"real\" URL is used as the selector,\n // `document.querySelector` will rightfully complain it is invalid.\n // See https://github.com/twbs/bootstrap/issues/32273\n if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {\n return null\n }\n\n // Just in case some CMS puts out a full URL with the anchor appended\n if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {\n hrefAttr = `#${hrefAttr.split('#')[1]}`\n }\n\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null\n }\n\n return selector\n}\n\nconst getSelectorFromElement = element => {\n const selector = getSelector(element)\n\n if (selector) {\n return document.querySelector(selector) ? selector : null\n }\n\n return null\n}\n\nconst getElementFromSelector = element => {\n const selector = getSelector(element)\n\n return selector ? document.querySelector(selector) : null\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element)\n\n const floatTransitionDuration = Number.parseFloat(transitionDuration)\n const floatTransitionDelay = Number.parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n element.dispatchEvent(new Event(TRANSITION_END))\n}\n\nconst isElement = obj => {\n if (!obj || typeof obj !== 'object') {\n return false\n }\n\n if (typeof obj.jquery !== 'undefined') {\n obj = obj[0]\n }\n\n return typeof obj.nodeType !== 'undefined'\n}\n\nconst getElement = obj => {\n if (isElement(obj)) { // it's a jQuery object or a node element\n return obj.jquery ? obj[0] : obj\n }\n\n if (typeof obj === 'string' && obj.length > 0) {\n return document.querySelector(obj)\n }\n\n return null\n}\n\nconst typeCheckConfig = (componentName, config, configTypes) => {\n Object.keys(configTypes).forEach(property => {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new TypeError(\n `${componentName.toUpperCase()}: Option \"${property}\" provided type \"${valueType}\" but expected type \"${expectedTypes}\".`\n )\n }\n })\n}\n\nconst isVisible = element => {\n if (!isElement(element) || element.getClientRects().length === 0) {\n return false\n }\n\n return getComputedStyle(element).getPropertyValue('visibility') === 'visible'\n}\n\nconst isDisabled = element => {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n return true\n }\n\n if (element.classList.contains('disabled')) {\n return true\n }\n\n if (typeof element.disabled !== 'undefined') {\n return element.disabled\n }\n\n return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => {}\n\n/**\n * Trick to restart an element's animation\n *\n * @param {HTMLElement} element\n * @return void\n *\n * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation\n */\nconst reflow = element => {\n // eslint-disable-next-line no-unused-expressions\n element.offsetHeight\n}\n\nconst getjQuery = () => {\n const { jQuery } = window\n\n if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {\n return jQuery\n }\n\n return null\n}\n\nconst DOMContentLoadedCallbacks = []\n\nconst onDOMContentLoaded = callback => {\n if (document.readyState === 'loading') {\n // add listener on the first call when the document is in loading state\n if (!DOMContentLoadedCallbacks.length) {\n document.addEventListener('DOMContentLoaded', () => {\n DOMContentLoadedCallbacks.forEach(callback => callback())\n })\n }\n\n DOMContentLoadedCallbacks.push(callback)\n } else {\n callback()\n }\n}\n\nconst isRTL = () => document.documentElement.dir === 'rtl'\n\nconst defineJQueryPlugin = plugin => {\n onDOMContentLoaded(() => {\n const $ = getjQuery()\n /* istanbul ignore if */\n if ($) {\n const name = plugin.NAME\n const JQUERY_NO_CONFLICT = $.fn[name]\n $.fn[name] = plugin.jQueryInterface\n $.fn[name].Constructor = plugin\n $.fn[name].noConflict = () => {\n $.fn[name] = JQUERY_NO_CONFLICT\n return plugin.jQueryInterface\n }\n }\n })\n}\n\nconst execute = callback => {\n if (typeof callback === 'function') {\n callback()\n }\n}\n\nconst executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {\n if (!waitForTransition) {\n execute(callback)\n return\n }\n\n const durationPadding = 5\n const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding\n\n let called = false\n\n const handler = ({ target }) => {\n if (target !== transitionElement) {\n return\n }\n\n called = true\n transitionElement.removeEventListener(TRANSITION_END, handler)\n execute(callback)\n }\n\n transitionElement.addEventListener(TRANSITION_END, handler)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(transitionElement)\n }\n }, emulatedDuration)\n}\n\n/**\n * Return the previous/next element of a list.\n *\n * @param {array} list The list of elements\n * @param activeElement The active element\n * @param shouldGetNext Choose to get next or previous element\n * @param isCycleAllowed\n * @return {Element|elem} The proper element\n */\nconst getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {\n let index = list.indexOf(activeElement)\n\n // if the element does not exist in the list return an element depending on the direction and if cycle is allowed\n if (index === -1) {\n return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0]\n }\n\n const listLength = list.length\n\n index += shouldGetNext ? 1 : -1\n\n if (isCycleAllowed) {\n index = (index + listLength) % listLength\n }\n\n return list[Math.max(0, Math.min(index, listLength - 1))]\n}\n\nexport {\n getElement,\n getUID,\n getSelectorFromElement,\n getElementFromSelector,\n getTransitionDurationFromElement,\n triggerTransitionEnd,\n isElement,\n typeCheckConfig,\n isVisible,\n isDisabled,\n findShadowRoot,\n noop,\n getNextActiveElement,\n reflow,\n getjQuery,\n onDOMContentLoaded,\n isRTL,\n defineJQueryPlugin,\n execute,\n executeAfterTransition\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): dom/event-handler.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { getjQuery } from '../util/index'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst namespaceRegex = /[^.]*(?=\\..*)\\.|.*/\nconst stripNameRegex = /\\..*/\nconst stripUidRegex = /::\\d+$/\nconst eventRegistry = {} // Events storage\nlet uidEvent = 1\nconst customEvents = {\n mouseenter: 'mouseover',\n mouseleave: 'mouseout'\n}\nconst customEventsRegex = /^(mouseenter|mouseleave)/i\nconst nativeEvents = new Set([\n 'click',\n 'dblclick',\n 'mouseup',\n 'mousedown',\n 'contextmenu',\n 'mousewheel',\n 'DOMMouseScroll',\n 'mouseover',\n 'mouseout',\n 'mousemove',\n 'selectstart',\n 'selectend',\n 'keydown',\n 'keypress',\n 'keyup',\n 'orientationchange',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'touchcancel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointerleave',\n 'pointercancel',\n 'gesturestart',\n 'gesturechange',\n 'gestureend',\n 'focus',\n 'blur',\n 'change',\n 'reset',\n 'select',\n 'submit',\n 'focusin',\n 'focusout',\n 'load',\n 'unload',\n 'beforeunload',\n 'resize',\n 'move',\n 'DOMContentLoaded',\n 'readystatechange',\n 'error',\n 'abort',\n 'scroll'\n])\n\n/**\n * ------------------------------------------------------------------------\n * Private methods\n * ------------------------------------------------------------------------\n */\n\nfunction getUidEvent(element, uid) {\n return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++\n}\n\nfunction getEvent(element) {\n const uid = getUidEvent(element)\n\n element.uidEvent = uid\n eventRegistry[uid] = eventRegistry[uid] || {}\n\n return eventRegistry[uid]\n}\n\nfunction bootstrapHandler(element, fn) {\n return function handler(event) {\n event.delegateTarget = element\n\n if (handler.oneOff) {\n EventHandler.off(element, event.type, fn)\n }\n\n return fn.apply(element, [event])\n }\n}\n\nfunction bootstrapDelegationHandler(element, selector, fn) {\n return function handler(event) {\n const domElements = element.querySelectorAll(selector)\n\n for (let { target } = event; target && target !== this; target = target.parentNode) {\n for (let i = domElements.length; i--;) {\n if (domElements[i] === target) {\n event.delegateTarget = target\n\n if (handler.oneOff) {\n EventHandler.off(element, event.type, selector, fn)\n }\n\n return fn.apply(target, [event])\n }\n }\n }\n\n // To please ESLint\n return null\n }\n}\n\nfunction findHandler(events, handler, delegationSelector = null) {\n const uidEventList = Object.keys(events)\n\n for (let i = 0, len = uidEventList.length; i < len; i++) {\n const event = events[uidEventList[i]]\n\n if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {\n return event\n }\n }\n\n return null\n}\n\nfunction normalizeParams(originalTypeEvent, handler, delegationFn) {\n const delegation = typeof handler === 'string'\n const originalHandler = delegation ? delegationFn : handler\n\n let typeEvent = getTypeEvent(originalTypeEvent)\n const isNative = nativeEvents.has(typeEvent)\n\n if (!isNative) {\n typeEvent = originalTypeEvent\n }\n\n return [delegation, originalHandler, typeEvent]\n}\n\nfunction addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {\n if (typeof originalTypeEvent !== 'string' || !element) {\n return\n }\n\n if (!handler) {\n handler = delegationFn\n delegationFn = null\n }\n\n // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position\n // this prevents the handler from being dispatched the same way as mouseover or mouseout does\n if (customEventsRegex.test(originalTypeEvent)) {\n const wrapFn = fn => {\n return function (event) {\n if (!event.relatedTarget || (event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget))) {\n return fn.call(this, event)\n }\n }\n }\n\n if (delegationFn) {\n delegationFn = wrapFn(delegationFn)\n } else {\n handler = wrapFn(handler)\n }\n }\n\n const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn)\n const events = getEvent(element)\n const handlers = events[typeEvent] || (events[typeEvent] = {})\n const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null)\n\n if (previousFn) {\n previousFn.oneOff = previousFn.oneOff && oneOff\n\n return\n }\n\n const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''))\n const fn = delegation ?\n bootstrapDelegationHandler(element, handler, delegationFn) :\n bootstrapHandler(element, handler)\n\n fn.delegationSelector = delegation ? handler : null\n fn.originalHandler = originalHandler\n fn.oneOff = oneOff\n fn.uidEvent = uid\n handlers[uid] = fn\n\n element.addEventListener(typeEvent, fn, delegation)\n}\n\nfunction removeHandler(element, events, typeEvent, handler, delegationSelector) {\n const fn = findHandler(events[typeEvent], handler, delegationSelector)\n\n if (!fn) {\n return\n }\n\n element.removeEventListener(typeEvent, fn, Boolean(delegationSelector))\n delete events[typeEvent][fn.uidEvent]\n}\n\nfunction removeNamespacedHandlers(element, events, typeEvent, namespace) {\n const storeElementEvent = events[typeEvent] || {}\n\n Object.keys(storeElementEvent).forEach(handlerKey => {\n if (handlerKey.includes(namespace)) {\n const event = storeElementEvent[handlerKey]\n\n removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector)\n }\n })\n}\n\nfunction getTypeEvent(event) {\n // allow to get the native events from namespaced events ('click.bs.button' --> 'click')\n event = event.replace(stripNameRegex, '')\n return customEvents[event] || event\n}\n\nconst EventHandler = {\n on(element, event, handler, delegationFn) {\n addHandler(element, event, handler, delegationFn, false)\n },\n\n one(element, event, handler, delegationFn) {\n addHandler(element, event, handler, delegationFn, true)\n },\n\n off(element, originalTypeEvent, handler, delegationFn) {\n if (typeof originalTypeEvent !== 'string' || !element) {\n return\n }\n\n const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn)\n const inNamespace = typeEvent !== originalTypeEvent\n const events = getEvent(element)\n const isNamespace = originalTypeEvent.startsWith('.')\n\n if (typeof originalHandler !== 'undefined') {\n // Simplest case: handler is passed, remove that listener ONLY.\n if (!events || !events[typeEvent]) {\n return\n }\n\n removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null)\n return\n }\n\n if (isNamespace) {\n Object.keys(events).forEach(elementEvent => {\n removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1))\n })\n }\n\n const storeElementEvent = events[typeEvent] || {}\n Object.keys(storeElementEvent).forEach(keyHandlers => {\n const handlerKey = keyHandlers.replace(stripUidRegex, '')\n\n if (!inNamespace || originalTypeEvent.includes(handlerKey)) {\n const event = storeElementEvent[keyHandlers]\n\n removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector)\n }\n })\n },\n\n trigger(element, event, args) {\n if (typeof event !== 'string' || !element) {\n return null\n }\n\n const $ = getjQuery()\n const typeEvent = getTypeEvent(event)\n const inNamespace = event !== typeEvent\n const isNative = nativeEvents.has(typeEvent)\n\n let jQueryEvent\n let bubbles = true\n let nativeDispatch = true\n let defaultPrevented = false\n let evt = null\n\n if (inNamespace && $) {\n jQueryEvent = $.Event(event, args)\n\n $(element).trigger(jQueryEvent)\n bubbles = !jQueryEvent.isPropagationStopped()\n nativeDispatch = !jQueryEvent.isImmediatePropagationStopped()\n defaultPrevented = jQueryEvent.isDefaultPrevented()\n }\n\n if (isNative) {\n evt = document.createEvent('HTMLEvents')\n evt.initEvent(typeEvent, bubbles, true)\n } else {\n evt = new CustomEvent(event, {\n bubbles,\n cancelable: true\n })\n }\n\n // merge custom information in our event\n if (typeof args !== 'undefined') {\n Object.keys(args).forEach(key => {\n Object.defineProperty(evt, key, {\n get() {\n return args[key]\n }\n })\n })\n }\n\n if (defaultPrevented) {\n evt.preventDefault()\n }\n\n if (nativeDispatch) {\n element.dispatchEvent(evt)\n }\n\n if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {\n jQueryEvent.preventDefault()\n }\n\n return evt\n }\n}\n\nexport default EventHandler\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data'\nimport {\n executeAfterTransition,\n getElement\n} from './util/index'\nimport EventHandler from './dom/event-handler'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst VERSION = '5.1.3'\n\nclass BaseComponent {\n constructor(element) {\n element = getElement(element)\n\n if (!element) {\n return\n }\n\n this._element = element\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n EventHandler.off(this._element, this.constructor.EVENT_KEY)\n\n Object.getOwnPropertyNames(this).forEach(propertyName => {\n this[propertyName] = null\n })\n }\n\n _queueCallback(callback, element, isAnimated = true) {\n executeAfterTransition(callback, element, isAnimated)\n }\n\n /** Static */\n\n static getInstance(element) {\n return Data.get(getElement(element), this.DATA_KEY)\n }\n\n static getOrCreateInstance(element, config = {}) {\n return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)\n }\n\n static get VERSION() {\n return VERSION\n }\n\n static get NAME() {\n throw new Error('You have to implement the static method \"NAME\", for each component!')\n }\n\n static get DATA_KEY() {\n return `bs.${this.NAME}`\n }\n\n static get EVENT_KEY() {\n return `.${this.DATA_KEY}`\n }\n}\n\nexport default BaseComponent\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): util/component-functions.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler'\nimport { getElementFromSelector, isDisabled } from './index'\n\nconst enableDismissTrigger = (component, method = 'hide') => {\n const clickEvent = `click.dismiss${component.EVENT_KEY}`\n const name = component.NAME\n\n EventHandler.on(document, clickEvent, `[data-bs-dismiss=\"${name}\"]`, function (event) {\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n const target = getElementFromSelector(this) || this.closest(`.${name}`)\n const instance = component.getOrCreateInstance(target)\n\n // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method\n instance[method]()\n })\n}\n\nexport {\n enableDismissTrigger\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): alert.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin } from './util/index'\nimport EventHandler from './dom/event-handler'\nimport BaseComponent from './base-component'\nimport { enableDismissTrigger } from './util/component-functions'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'alert'\nconst DATA_KEY = 'bs.alert'\nconst EVENT_KEY = `.${DATA_KEY}`\n\nconst EVENT_CLOSE = `close${EVENT_KEY}`\nconst EVENT_CLOSED = `closed${EVENT_KEY}`\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Alert extends BaseComponent {\n // Getters\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n close() {\n const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE)\n\n if (closeEvent.defaultPrevented) {\n return\n }\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n const isAnimated = this._element.classList.contains(CLASS_NAME_FADE)\n this._queueCallback(() => this._destroyElement(), this._element, isAnimated)\n }\n\n // Private\n _destroyElement() {\n this._element.remove()\n EventHandler.trigger(this._element, EVENT_CLOSED)\n this.dispose()\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Alert.getOrCreateInstance(this)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nenableDismissTrigger(Alert, 'close')\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Alert to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Alert)\n\nexport default Alert\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): button.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin } from './util/index'\nimport EventHandler from './dom/event-handler'\nimport BaseComponent from './base-component'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'button'\nconst DATA_KEY = 'bs.button'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst CLASS_NAME_ACTIVE = 'active'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"button\"]'\n\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Button extends BaseComponent {\n // Getters\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n toggle() {\n // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method\n this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE))\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Button.getOrCreateInstance(this)\n\n if (config === 'toggle') {\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {\n event.preventDefault()\n\n const button = event.target.closest(SELECTOR_DATA_TOGGLE)\n const data = Button.getOrCreateInstance(button)\n\n data.toggle()\n})\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Button to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Button)\n\nexport default Button\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(val) {\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n\n if (val === Number(val).toString()) {\n return Number(val)\n }\n\n if (val === '' || val === 'null') {\n return null\n }\n\n return val\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n\n Object.keys(element.dataset)\n .filter(key => key.startsWith('bs'))\n .forEach(key => {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n },\n\n offset(element) {\n const rect = element.getBoundingClientRect()\n\n return {\n top: rect.top + window.pageYOffset,\n left: rect.left + window.pageXOffset\n }\n },\n\n position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft\n }\n }\n}\n\nexport default Manipulator\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nimport { isDisabled, isVisible } from '../util/index'\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children)\n .filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (ancestor.matches(selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n },\n\n focusableChildren(element) {\n const focusables = [\n 'a',\n 'button',\n 'input',\n 'textarea',\n 'select',\n 'details',\n '[tabindex]',\n '[contenteditable=\"true\"]'\n ].map(selector => `${selector}:not([tabindex^=\"-\"])`).join(', ')\n\n return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el))\n }\n}\n\nexport default SelectorEngine\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): carousel.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n defineJQueryPlugin,\n getElementFromSelector,\n isRTL,\n isVisible,\n getNextActiveElement,\n reflow,\n triggerTransitionEnd,\n typeCheckConfig\n} from './util/index'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\nimport BaseComponent from './base-component'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'carousel'\nconst DATA_KEY = 'bs.carousel'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ARROW_LEFT_KEY = 'ArrowLeft'\nconst ARROW_RIGHT_KEY = 'ArrowRight'\nconst TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch\nconst SWIPE_THRESHOLD = 40\n\nconst Default = {\n interval: 5000,\n keyboard: true,\n slide: false,\n pause: 'hover',\n wrap: true,\n touch: true\n}\n\nconst DefaultType = {\n interval: '(number|boolean)',\n keyboard: 'boolean',\n slide: '(boolean|string)',\n pause: '(string|boolean)',\n wrap: 'boolean',\n touch: 'boolean'\n}\n\nconst ORDER_NEXT = 'next'\nconst ORDER_PREV = 'prev'\nconst DIRECTION_LEFT = 'left'\nconst DIRECTION_RIGHT = 'right'\n\nconst KEY_TO_DIRECTION = {\n [ARROW_LEFT_KEY]: DIRECTION_RIGHT,\n [ARROW_RIGHT_KEY]: DIRECTION_LEFT\n}\n\nconst EVENT_SLIDE = `slide${EVENT_KEY}`\nconst EVENT_SLID = `slid${EVENT_KEY}`\nconst EVENT_KEYDOWN = `keydown${EVENT_KEY}`\nconst EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`\nconst EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`\nconst EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`\nconst EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`\nconst EVENT_TOUCHEND = `touchend${EVENT_KEY}`\nconst EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`\nconst EVENT_POINTERUP = `pointerup${EVENT_KEY}`\nconst EVENT_DRAG_START = `dragstart${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_CAROUSEL = 'carousel'\nconst CLASS_NAME_ACTIVE = 'active'\nconst CLASS_NAME_SLIDE = 'slide'\nconst CLASS_NAME_END = 'carousel-item-end'\nconst CLASS_NAME_START = 'carousel-item-start'\nconst CLASS_NAME_NEXT = 'carousel-item-next'\nconst CLASS_NAME_PREV = 'carousel-item-prev'\nconst CLASS_NAME_POINTER_EVENT = 'pointer-event'\n\nconst SELECTOR_ACTIVE = '.active'\nconst SELECTOR_ACTIVE_ITEM = '.active.carousel-item'\nconst SELECTOR_ITEM = '.carousel-item'\nconst SELECTOR_ITEM_IMG = '.carousel-item img'\nconst SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'\nconst SELECTOR_INDICATORS = '.carousel-indicators'\nconst SELECTOR_INDICATOR = '[data-bs-target]'\nconst SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'\nconst SELECTOR_DATA_RIDE = '[data-bs-ride=\"carousel\"]'\n\nconst POINTER_TYPE_TOUCH = 'touch'\nconst POINTER_TYPE_PEN = 'pen'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\nclass Carousel extends BaseComponent {\n constructor(element, config) {\n super(element)\n\n this._items = null\n this._interval = null\n this._activeElement = null\n this._isPaused = false\n this._isSliding = false\n this.touchTimeout = null\n this.touchStartX = 0\n this.touchDeltaX = 0\n\n this._config = this._getConfig(config)\n this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)\n this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0\n this._pointerEvent = Boolean(window.PointerEvent)\n\n this._addEventListeners()\n }\n\n // Getters\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n next() {\n this._slide(ORDER_NEXT)\n }\n\n nextWhenVisible() {\n // Don't call next when the page isn't visible\n // or the carousel or its parent isn't visible\n if (!document.hidden && isVisible(this._element)) {\n this.next()\n }\n }\n\n prev() {\n this._slide(ORDER_PREV)\n }\n\n pause(event) {\n if (!event) {\n this._isPaused = true\n }\n\n if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {\n triggerTransitionEnd(this._element)\n this.cycle(true)\n }\n\n clearInterval(this._interval)\n this._interval = null\n }\n\n cycle(event) {\n if (!event) {\n this._isPaused = false\n }\n\n if (this._interval) {\n clearInterval(this._interval)\n this._interval = null\n }\n\n if (this._config && this._config.interval && !this._isPaused) {\n this._updateInterval()\n\n this._interval = setInterval(\n (document.visibilityState ? this.nextWhenVisible : this.next).bind(this),\n this._config.interval\n )\n }\n }\n\n to(index) {\n this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)\n const activeIndex = this._getItemIndex(this._activeElement)\n\n if (index > this._items.length - 1 || index < 0) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.to(index))\n return\n }\n\n if (activeIndex === index) {\n this.pause()\n this.cycle()\n return\n }\n\n const order = index > activeIndex ?\n ORDER_NEXT :\n ORDER_PREV\n\n this._slide(order, this._items[index])\n }\n\n // Private\n\n _getConfig(config) {\n config = {\n ...Default,\n ...Manipulator.getDataAttributes(this._element),\n ...(typeof config === 'object' ? config : {})\n }\n typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n\n _handleSwipe() {\n const absDeltax = Math.abs(this.touchDeltaX)\n\n if (absDeltax <= SWIPE_THRESHOLD) {\n return\n }\n\n const direction = absDeltax / this.touchDeltaX\n\n this.touchDeltaX = 0\n\n if (!direction) {\n return\n }\n\n this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT)\n }\n\n _addEventListeners() {\n if (this._config.keyboard) {\n EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))\n }\n\n if (this._config.pause === 'hover') {\n EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event))\n EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event))\n }\n\n if (this._config.touch && this._touchSupported) {\n this._addTouchEventListeners()\n }\n }\n\n _addTouchEventListeners() {\n const hasPointerPenTouch = event => {\n return this._pointerEvent &&\n (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)\n }\n\n const start = event => {\n if (hasPointerPenTouch(event)) {\n this.touchStartX = event.clientX\n } else if (!this._pointerEvent) {\n this.touchStartX = event.touches[0].clientX\n }\n }\n\n const move = event => {\n // ensure swiping with one touch and not pinching\n this.touchDeltaX = event.touches && event.touches.length > 1 ?\n 0 :\n event.touches[0].clientX - this.touchStartX\n }\n\n const end = event => {\n if (hasPointerPenTouch(event)) {\n this.touchDeltaX = event.clientX - this.touchStartX\n }\n\n this._handleSwipe()\n if (this._config.pause === 'hover') {\n // If it's a touch-enabled device, mouseenter/leave are fired as\n // part of the mouse compatibility events on first tap - the carousel\n // would stop cycling until user tapped out of it;\n // here, we listen for touchend, explicitly pause the carousel\n // (as if it's the second time we tap on it, mouseenter compat event\n // is NOT fired) and after a timeout (to allow for mouse compatibility\n // events to fire) we explicitly restart cycling\n\n this.pause()\n if (this.touchTimeout) {\n clearTimeout(this.touchTimeout)\n }\n\n this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval)\n }\n }\n\n SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {\n EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault())\n })\n\n if (this._pointerEvent) {\n EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event))\n EventHandler.on(this._element, EVENT_POINTERUP, event => end(event))\n\n this._element.classList.add(CLASS_NAME_POINTER_EVENT)\n } else {\n EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event))\n EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event))\n EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event))\n }\n }\n\n _keydown(event) {\n if (/input|textarea/i.test(event.target.tagName)) {\n return\n }\n\n const direction = KEY_TO_DIRECTION[event.key]\n if (direction) {\n event.preventDefault()\n this._slide(direction)\n }\n }\n\n _getItemIndex(element) {\n this._items = element && element.parentNode ?\n SelectorEngine.find(SELECTOR_ITEM, element.parentNode) :\n []\n\n return this._items.indexOf(element)\n }\n\n _getItemByOrder(order, activeElement) {\n const isNext = order === ORDER_NEXT\n return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap)\n }\n\n _triggerSlideEvent(relatedTarget, eventDirectionName) {\n const targetIndex = this._getItemIndex(relatedTarget)\n const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element))\n\n return EventHandler.trigger(this._element, EVENT_SLIDE, {\n relatedTarget,\n direction: eventDirectionName,\n from: fromIndex,\n to: targetIndex\n })\n }\n\n _setActiveIndicatorElement(element) {\n if (this._indicatorsElement) {\n const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement)\n\n activeIndicator.classList.remove(CLASS_NAME_ACTIVE)\n activeIndicator.removeAttribute('aria-current')\n\n const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement)\n\n for (let i = 0; i < indicators.length; i++) {\n if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {\n indicators[i].classList.add(CLASS_NAME_ACTIVE)\n indicators[i].setAttribute('aria-current', 'true')\n break\n }\n }\n }\n }\n\n _updateInterval() {\n const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)\n\n if (!element) {\n return\n }\n\n const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10)\n\n if (elementInterval) {\n this._config.defaultInterval = this._config.defaultInterval || this._config.interval\n this._config.interval = elementInterval\n } else {\n this._config.interval = this._config.defaultInterval || this._config.interval\n }\n }\n\n _slide(directionOrOrder, element) {\n const order = this._directionToOrder(directionOrOrder)\n const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)\n const activeElementIndex = this._getItemIndex(activeElement)\n const nextElement = element || this._getItemByOrder(order, activeElement)\n\n const nextElementIndex = this._getItemIndex(nextElement)\n const isCycling = Boolean(this._interval)\n\n const isNext = order === ORDER_NEXT\n const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END\n const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV\n const eventDirectionName = this._orderToDirection(order)\n\n if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {\n this._isSliding = false\n return\n }\n\n if (this._isSliding) {\n return\n }\n\n const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName)\n if (slideEvent.defaultPrevented) {\n return\n }\n\n if (!activeElement || !nextElement) {\n // Some weirdness is happening, so we bail\n return\n }\n\n this._isSliding = true\n\n if (isCycling) {\n this.pause()\n }\n\n this._setActiveIndicatorElement(nextElement)\n this._activeElement = nextElement\n\n const triggerSlidEvent = () => {\n EventHandler.trigger(this._element, EVENT_SLID, {\n relatedTarget: nextElement,\n direction: eventDirectionName,\n from: activeElementIndex,\n to: nextElementIndex\n })\n }\n\n if (this._element.classList.contains(CLASS_NAME_SLIDE)) {\n nextElement.classList.add(orderClassName)\n\n reflow(nextElement)\n\n activeElement.classList.add(directionalClassName)\n nextElement.classList.add(directionalClassName)\n\n const completeCallBack = () => {\n nextElement.classList.remove(directionalClassName, orderClassName)\n nextElement.classList.add(CLASS_NAME_ACTIVE)\n\n activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName)\n\n this._isSliding = false\n\n setTimeout(triggerSlidEvent, 0)\n }\n\n this._queueCallback(completeCallBack, activeElement, true)\n } else {\n activeElement.classList.remove(CLASS_NAME_ACTIVE)\n nextElement.classList.add(CLASS_NAME_ACTIVE)\n\n this._isSliding = false\n triggerSlidEvent()\n }\n\n if (isCycling) {\n this.cycle()\n }\n }\n\n _directionToOrder(direction) {\n if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {\n return direction\n }\n\n if (isRTL()) {\n return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT\n }\n\n return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV\n }\n\n _orderToDirection(order) {\n if (![ORDER_NEXT, ORDER_PREV].includes(order)) {\n return order\n }\n\n if (isRTL()) {\n return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT\n }\n\n return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT\n }\n\n // Static\n\n static carouselInterface(element, config) {\n const data = Carousel.getOrCreateInstance(element, config)\n\n let { _config } = data\n if (typeof config === 'object') {\n _config = {\n ..._config,\n ...config\n }\n }\n\n const action = typeof config === 'string' ? config : _config.slide\n\n if (typeof config === 'number') {\n data.to(config)\n } else if (typeof action === 'string') {\n if (typeof data[action] === 'undefined') {\n throw new TypeError(`No method named \"${action}\"`)\n }\n\n data[action]()\n } else if (_config.interval && _config.ride) {\n data.pause()\n data.cycle()\n }\n }\n\n static jQueryInterface(config) {\n return this.each(function () {\n Carousel.carouselInterface(this, config)\n })\n }\n\n static dataApiClickHandler(event) {\n const target = getElementFromSelector(this)\n\n if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {\n return\n }\n\n const config = {\n ...Manipulator.getDataAttributes(target),\n ...Manipulator.getDataAttributes(this)\n }\n const slideIndex = this.getAttribute('data-bs-slide-to')\n\n if (slideIndex) {\n config.interval = false\n }\n\n Carousel.carouselInterface(target, config)\n\n if (slideIndex) {\n Carousel.getInstance(target).to(slideIndex)\n }\n\n event.preventDefault()\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler)\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE)\n\n for (let i = 0, len = carousels.length; i < len; i++) {\n Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]))\n }\n})\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Carousel to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Carousel)\n\nexport default Carousel\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): collapse.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n defineJQueryPlugin,\n getElement,\n getSelectorFromElement,\n getElementFromSelector,\n reflow,\n typeCheckConfig\n} from './util/index'\nimport Data from './dom/data'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\nimport BaseComponent from './base-component'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'collapse'\nconst DATA_KEY = 'bs.collapse'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst Default = {\n toggle: true,\n parent: null\n}\n\nconst DefaultType = {\n toggle: 'boolean',\n parent: '(null|element)'\n}\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_COLLAPSE = 'collapse'\nconst CLASS_NAME_COLLAPSING = 'collapsing'\nconst CLASS_NAME_COLLAPSED = 'collapsed'\nconst CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`\nconst CLASS_NAME_HORIZONTAL = 'collapse-horizontal'\n\nconst WIDTH = 'width'\nconst HEIGHT = 'height'\n\nconst SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"collapse\"]'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Collapse extends BaseComponent {\n constructor(element, config) {\n super(element)\n\n this._isTransitioning = false\n this._config = this._getConfig(config)\n this._triggerArray = []\n\n const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE)\n\n for (let i = 0, len = toggleList.length; i < len; i++) {\n const elem = toggleList[i]\n const selector = getSelectorFromElement(elem)\n const filterElement = SelectorEngine.find(selector)\n .filter(foundElem => foundElem === this._element)\n\n if (selector !== null && filterElement.length) {\n this._selector = selector\n this._triggerArray.push(elem)\n }\n }\n\n this._initializeChildren()\n\n if (!this._config.parent) {\n this._addAriaAndCollapsedClass(this._triggerArray, this._isShown())\n }\n\n if (this._config.toggle) {\n this.toggle()\n }\n }\n\n // Getters\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n toggle() {\n if (this._isShown()) {\n this.hide()\n } else {\n this.show()\n }\n }\n\n show() {\n if (this._isTransitioning || this._isShown()) {\n return\n }\n\n let actives = []\n let activesData\n\n if (this._config.parent) {\n const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent)\n actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)) // remove children if greater depth\n }\n\n const container = SelectorEngine.findOne(this._selector)\n if (actives.length) {\n const tempActiveData = actives.find(elem => container !== elem)\n activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null\n\n if (activesData && activesData._isTransitioning) {\n return\n }\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_SHOW)\n if (startEvent.defaultPrevented) {\n return\n }\n\n actives.forEach(elemActive => {\n if (container !== elemActive) {\n Collapse.getOrCreateInstance(elemActive, { toggle: false }).hide()\n }\n\n if (!activesData) {\n Data.set(elemActive, DATA_KEY, null)\n }\n })\n\n const dimension = this._getDimension()\n\n this._element.classList.remove(CLASS_NAME_COLLAPSE)\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n\n this._element.style[dimension] = 0\n\n this._addAriaAndCollapsedClass(this._triggerArray, true)\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n this._element.style[dimension] = ''\n\n EventHandler.trigger(this._element, EVENT_SHOWN)\n }\n\n const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)\n const scrollSize = `scroll${capitalizedDimension}`\n\n this._queueCallback(complete, this._element, true)\n this._element.style[dimension] = `${this._element[scrollSize]}px`\n }\n\n hide() {\n if (this._isTransitioning || !this._isShown()) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n if (startEvent.defaultPrevented) {\n return\n }\n\n const dimension = this._getDimension()\n\n this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`\n\n reflow(this._element)\n\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n const triggerArrayLength = this._triggerArray.length\n for (let i = 0; i < triggerArrayLength; i++) {\n const trigger = this._triggerArray[i]\n const elem = getElementFromSelector(trigger)\n\n if (elem && !this._isShown(elem)) {\n this._addAriaAndCollapsedClass([trigger], false)\n }\n }\n\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE)\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._element.style[dimension] = ''\n\n this._queueCallback(complete, this._element, true)\n }\n\n _isShown(element = this._element) {\n return element.classList.contains(CLASS_NAME_SHOW)\n }\n\n // Private\n\n _getConfig(config) {\n config = {\n ...Default,\n ...Manipulator.getDataAttributes(this._element),\n ...config\n }\n config.toggle = Boolean(config.toggle) // Coerce string values\n config.parent = getElement(config.parent)\n typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n\n _getDimension() {\n return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT\n }\n\n _initializeChildren() {\n if (!this._config.parent) {\n return\n }\n\n const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent)\n SelectorEngine.find(SELECTOR_DATA_TOGGLE, this._config.parent).filter(elem => !children.includes(elem))\n .forEach(element => {\n const selected = getElementFromSelector(element)\n\n if (selected) {\n this._addAriaAndCollapsedClass([element], this._isShown(selected))\n }\n })\n }\n\n _addAriaAndCollapsedClass(triggerArray, isOpen) {\n if (!triggerArray.length) {\n return\n }\n\n triggerArray.forEach(elem => {\n if (isOpen) {\n elem.classList.remove(CLASS_NAME_COLLAPSED)\n } else {\n elem.classList.add(CLASS_NAME_COLLAPSED)\n }\n\n elem.setAttribute('aria-expanded', isOpen)\n })\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n const _config = {}\n if (typeof config === 'string' && /show|hide/.test(config)) {\n _config.toggle = false\n }\n\n const data = Collapse.getOrCreateInstance(this, _config)\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n // preventDefault only for elements (which change the URL) not inside the collapsible element\n if (event.target.tagName === 'A' || (event.delegateTarget && event.delegateTarget.tagName === 'A')) {\n event.preventDefault()\n }\n\n const selector = getSelectorFromElement(this)\n const selectorElements = SelectorEngine.find(selector)\n\n selectorElements.forEach(element => {\n Collapse.getOrCreateInstance(element, { toggle: false }).toggle()\n })\n})\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Collapse to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Collapse)\n\nexport default Collapse\n","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","// import { isHTMLElement } from './instanceOf';\nexport default function getBoundingClientRect(element, // eslint-disable-next-line unused-imports/no-unused-vars\nincludeScale) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n var rect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1; // FIXME:\n // `offsetWidth` returns an integer while `getBoundingClientRect`\n // returns a float. This results in `scaleX` or `scaleY` being\n // non-1 when it should be for elements that aren't a full pixel in\n // width or height.\n // if (isHTMLElement(element) && includeScale) {\n // const offsetHeight = element.offsetHeight;\n // const offsetWidth = element.offsetWidth;\n // // Do not attempt to divide by 0, otherwise we get `Infinity` as scale\n // // Fallback to 1 in case both values are `0`\n // if (offsetWidth > 0) {\n // scaleX = rect.width / offsetWidth || 1;\n // }\n // if (offsetHeight > 0) {\n // scaleY = rect.height / offsetHeight || 1;\n // }\n // }\n\n return {\n width: rect.width / scaleX,\n height: rect.height / scaleY,\n top: rect.top / scaleY,\n right: rect.right / scaleX,\n bottom: rect.bottom / scaleY,\n left: rect.left / scaleX,\n x: rect.left / scaleX,\n y: rect.top / scaleY\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;\n var isIE = navigator.userAgent.indexOf('Trident') !== -1;\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport default function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport within from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!isHTMLElement(arrowElement)) {\n 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(' '));\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: \"arrow\" modifier\\'s `element` must be a child of the popper', 'element.'].join(' '));\n }\n\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref) {\n var x = _ref.x,\n y = _ref.y;\n var win = window;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(round(x * dpr) / dpr) || 0,\n y: round(round(y * dpr) / dpr) || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets;\n\n var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,\n _ref3$x = _ref3.x,\n x = _ref3$x === void 0 ? 0 : _ref3$x,\n _ref3$y = _ref3.y,\n y = _ref3$y === void 0 ? 0 : _ref3$y;\n\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom; // $FlowFixMe[prop-missing]\n\n y -= offsetParent[heightProp] - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right; // $FlowFixMe[prop-missing]\n\n x -= offsetParent[widthProp] - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref4) {\n var state = _ref4.state,\n options = _ref4.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n\n if (process.env.NODE_ENV !== \"production\") {\n var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';\n\n if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {\n return transitionProperty.indexOf(property) >= 0;\n })) {\n 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(' '));\n }\n }\n\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element) {\n var rect = getBoundingClientRect(element);\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nexport default function getViewportRect(element) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper\n // can be obscured underneath it.\n // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even\n // if it isn't open, so if this isn't available, the popper will be detected\n // to overflow the bottom of the screen too early.\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)\n // In Chrome, it returns a value very close to 0 (+/-) but contains rounding\n // errors due to floating point numbers, so we need to check precision.\n // Safari returns a number <= 0, usually < -1 when pinch-zoomed\n // Feature detection fails in mobile emulation mode in Chrome.\n // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <\n // 0.001\n // Fallback here: \"Not Safari\" userAgent\n\n if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n\n if (process.env.NODE_ENV !== \"production\") {\n 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(' '));\n }\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\";\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport within from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { max as mathMax, min as mathMin } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis || checkAltAxis) {\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = popperOffsets[mainAxis] + overflow[mainSide];\n var max = popperOffsets[mainAxis] - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;\n var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;\n\n if (checkMainAxis) {\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var _preventedOffset = within(tether ? mathMin(_min, tetherMin) : _min, _offset, tether ? mathMax(_max, tetherMax) : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = rect.width / element.offsetWidth || 1;\n var scaleY = rect.height / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport getComputedStyle from \"./dom-utils/getComputedStyle.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport validateModifiers from \"./utils/validateModifiers.js\";\nimport uniqueBy from \"./utils/uniqueBy.js\";\nimport getBasePlacement from \"./utils/getBasePlacement.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nimport { auto } from \"./enums.js\";\nvar INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';\nvar INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n }); // Validate the provided modifiers so that the consumer will get warned\n // if one of the modifiers is invalid for any reason\n\n if (process.env.NODE_ENV !== \"production\") {\n var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {\n var name = _ref.name;\n return name;\n });\n validateModifiers(modifiers);\n\n if (getBasePlacement(state.options.placement) === auto) {\n var flipModifier = state.orderedModifiers.find(function (_ref2) {\n var name = _ref2.name;\n return name === 'flip';\n });\n\n if (!flipModifier) {\n console.error(['Popper: \"auto\" placements require the \"flip\" modifier be', 'present and enabled to work.'].join(' '));\n }\n }\n\n var _getComputedStyle = getComputedStyle(popper),\n marginTop = _getComputedStyle.marginTop,\n marginRight = _getComputedStyle.marginRight,\n marginBottom = _getComputedStyle.marginBottom,\n marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can\n // cause bugs with positioning, so we'll warn the consumer\n\n\n if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {\n return parseFloat(margin);\n })) {\n 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(' '));\n }\n }\n\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n var __debug_loops__ = 0;\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (process.env.NODE_ENV !== \"production\") {\n __debug_loops__ += 1;\n\n if (__debug_loops__ > 100) {\n console.error(INFINITE_LOOP_ERROR);\n break;\n }\n }\n\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref3) {\n var name = _ref3.name,\n _ref3$options = _ref3.options,\n options = _ref3$options === void 0 ? {} : _ref3$options,\n effect = _ref3.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): dropdown.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport * as Popper from '@popperjs/core'\n\nimport {\n defineJQueryPlugin,\n getElement,\n getElementFromSelector,\n getNextActiveElement,\n isDisabled,\n isElement,\n isRTL,\n isVisible,\n noop,\n typeCheckConfig\n} from './util/index'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\nimport BaseComponent from './base-component'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'dropdown'\nconst DATA_KEY = 'bs.dropdown'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ESCAPE_KEY = 'Escape'\nconst SPACE_KEY = 'Space'\nconst TAB_KEY = 'Tab'\nconst ARROW_UP_KEY = 'ArrowUp'\nconst ARROW_DOWN_KEY = 'ArrowDown'\nconst RIGHT_MOUSE_BUTTON = 2 // MouseEvent.button value for the secondary button, usually the right button\n\nconst REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY}`)\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_DROPUP = 'dropup'\nconst CLASS_NAME_DROPEND = 'dropend'\nconst CLASS_NAME_DROPSTART = 'dropstart'\nconst CLASS_NAME_NAVBAR = 'navbar'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"dropdown\"]'\nconst SELECTOR_MENU = '.dropdown-menu'\nconst SELECTOR_NAVBAR_NAV = '.navbar-nav'\nconst SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'\n\nconst PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'\nconst PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'\nconst PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'\nconst PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'\nconst PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'\nconst PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'\n\nconst Default = {\n offset: [0, 2],\n boundary: 'clippingParents',\n reference: 'toggle',\n display: 'dynamic',\n popperConfig: null,\n autoClose: true\n}\n\nconst DefaultType = {\n offset: '(array|string|function)',\n boundary: '(string|element)',\n reference: '(string|element|object)',\n display: 'string',\n popperConfig: '(null|object|function)',\n autoClose: '(boolean|string)'\n}\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Dropdown extends BaseComponent {\n constructor(element, config) {\n super(element)\n\n this._popper = null\n this._config = this._getConfig(config)\n this._menu = this._getMenuElement()\n this._inNavbar = this._detectNavbar()\n }\n\n // Getters\n\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n toggle() {\n return this._isShown() ? this.hide() : this.show()\n }\n\n show() {\n if (isDisabled(this._element) || this._isShown(this._menu)) {\n return\n }\n\n const relatedTarget = {\n relatedTarget: this._element\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget)\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n const parent = Dropdown.getParentFromElement(this._element)\n // Totally disable Popper for Dropdowns in Navbar\n if (this._inNavbar) {\n Manipulator.setDataAttribute(this._menu, 'popper', 'none')\n } else {\n this._createPopper(parent)\n }\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement &&\n !parent.closest(SELECTOR_NAVBAR_NAV)) {\n [].concat(...document.body.children)\n .forEach(elem => EventHandler.on(elem, 'mouseover', noop))\n }\n\n this._element.focus()\n this._element.setAttribute('aria-expanded', true)\n\n this._menu.classList.add(CLASS_NAME_SHOW)\n this._element.classList.add(CLASS_NAME_SHOW)\n EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget)\n }\n\n hide() {\n if (isDisabled(this._element) || !this._isShown(this._menu)) {\n return\n }\n\n const relatedTarget = {\n relatedTarget: this._element\n }\n\n this._completeHide(relatedTarget)\n }\n\n dispose() {\n if (this._popper) {\n this._popper.destroy()\n }\n\n super.dispose()\n }\n\n update() {\n this._inNavbar = this._detectNavbar()\n if (this._popper) {\n this._popper.update()\n }\n }\n\n // Private\n\n _completeHide(relatedTarget) {\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n [].concat(...document.body.children)\n .forEach(elem => EventHandler.off(elem, 'mouseover', noop))\n }\n\n if (this._popper) {\n this._popper.destroy()\n }\n\n this._menu.classList.remove(CLASS_NAME_SHOW)\n this._element.classList.remove(CLASS_NAME_SHOW)\n this._element.setAttribute('aria-expanded', 'false')\n Manipulator.removeDataAttribute(this._menu, 'popper')\n EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget)\n }\n\n _getConfig(config) {\n config = {\n ...this.constructor.Default,\n ...Manipulator.getDataAttributes(this._element),\n ...config\n }\n\n typeCheckConfig(NAME, config, this.constructor.DefaultType)\n\n if (typeof config.reference === 'object' && !isElement(config.reference) &&\n typeof config.reference.getBoundingClientRect !== 'function'\n ) {\n // Popper virtual elements require a getBoundingClientRect method\n throw new TypeError(`${NAME.toUpperCase()}: Option \"reference\" provided type \"object\" without a required \"getBoundingClientRect\" method.`)\n }\n\n return config\n }\n\n _createPopper(parent) {\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s dropdowns require Popper (https://popper.js.org)')\n }\n\n let referenceElement = this._element\n\n if (this._config.reference === 'parent') {\n referenceElement = parent\n } else if (isElement(this._config.reference)) {\n referenceElement = getElement(this._config.reference)\n } else if (typeof this._config.reference === 'object') {\n referenceElement = this._config.reference\n }\n\n const popperConfig = this._getPopperConfig()\n const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false)\n\n this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)\n\n if (isDisplayStatic) {\n Manipulator.setDataAttribute(this._menu, 'popper', 'static')\n }\n }\n\n _isShown(element = this._element) {\n return element.classList.contains(CLASS_NAME_SHOW)\n }\n\n _getMenuElement() {\n return SelectorEngine.next(this._element, SELECTOR_MENU)[0]\n }\n\n _getPlacement() {\n const parentDropdown = this._element.parentNode\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {\n return PLACEMENT_RIGHT\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {\n return PLACEMENT_LEFT\n }\n\n // We need to trim the value because custom properties can also include spaces\n const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {\n return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP\n }\n\n return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM\n }\n\n _detectNavbar() {\n return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null\n }\n\n _getOffset() {\n const { offset } = this._config\n\n if (typeof offset === 'string') {\n return offset.split(',').map(val => Number.parseInt(val, 10))\n }\n\n if (typeof offset === 'function') {\n return popperData => offset(popperData, this._element)\n }\n\n return offset\n }\n\n _getPopperConfig() {\n const defaultBsPopperConfig = {\n placement: this._getPlacement(),\n modifiers: [{\n name: 'preventOverflow',\n options: {\n boundary: this._config.boundary\n }\n },\n {\n name: 'offset',\n options: {\n offset: this._getOffset()\n }\n }]\n }\n\n // Disable Popper if we have a static display\n if (this._config.display === 'static') {\n defaultBsPopperConfig.modifiers = [{\n name: 'applyStyles',\n enabled: false\n }]\n }\n\n return {\n ...defaultBsPopperConfig,\n ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)\n }\n }\n\n _selectMenuItem({ key, target }) {\n const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible)\n\n if (!items.length) {\n return\n }\n\n // if target isn't included in items (e.g. when expanding the dropdown)\n // allow cycling to get the last item in case key equals ARROW_UP_KEY\n getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus()\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Dropdown.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n\n static clearMenus(event) {\n if (event && (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))) {\n return\n }\n\n const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE)\n\n for (let i = 0, len = toggles.length; i < len; i++) {\n const context = Dropdown.getInstance(toggles[i])\n if (!context || context._config.autoClose === false) {\n continue\n }\n\n if (!context._isShown()) {\n continue\n }\n\n const relatedTarget = {\n relatedTarget: context._element\n }\n\n if (event) {\n const composedPath = event.composedPath()\n const isMenuTarget = composedPath.includes(context._menu)\n if (\n composedPath.includes(context._element) ||\n (context._config.autoClose === 'inside' && !isMenuTarget) ||\n (context._config.autoClose === 'outside' && isMenuTarget)\n ) {\n continue\n }\n\n // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu\n if (context._menu.contains(event.target) && ((event.type === 'keyup' && event.key === TAB_KEY) || /input|select|option|textarea|form/i.test(event.target.tagName))) {\n continue\n }\n\n if (event.type === 'click') {\n relatedTarget.clickEvent = event\n }\n }\n\n context._completeHide(relatedTarget)\n }\n }\n\n static getParentFromElement(element) {\n return getElementFromSelector(element) || element.parentNode\n }\n\n static dataApiKeydownHandler(event) {\n // If not input/textarea:\n // - And not a key in REGEXP_KEYDOWN => not a dropdown command\n // If input/textarea:\n // - If space key => not a dropdown command\n // - If key is other than escape\n // - If key is not up or down => not a dropdown command\n // - If trigger inside the menu => not a dropdown command\n if (/input|textarea/i.test(event.target.tagName) ?\n event.key === SPACE_KEY || (event.key !== ESCAPE_KEY &&\n ((event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY) ||\n event.target.closest(SELECTOR_MENU))) :\n !REGEXP_KEYDOWN.test(event.key)) {\n return\n }\n\n const isActive = this.classList.contains(CLASS_NAME_SHOW)\n\n if (!isActive && event.key === ESCAPE_KEY) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n if (isDisabled(this)) {\n return\n }\n\n const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0]\n const instance = Dropdown.getOrCreateInstance(getToggleButton)\n\n if (event.key === ESCAPE_KEY) {\n instance.hide()\n return\n }\n\n if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {\n if (!isActive) {\n instance.show()\n }\n\n instance._selectMenuItem(event)\n return\n }\n\n if (!isActive || event.key === SPACE_KEY) {\n Dropdown.clearMenus()\n }\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler)\nEventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler)\nEventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus)\nEventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus)\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n event.preventDefault()\n Dropdown.getOrCreateInstance(this).toggle()\n})\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Dropdown to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Dropdown)\n\nexport default Dropdown\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): util/scrollBar.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport SelectorEngine from '../dom/selector-engine'\nimport Manipulator from '../dom/manipulator'\nimport { isElement } from './index'\n\nconst SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'\nconst SELECTOR_STICKY_CONTENT = '.sticky-top'\n\nclass ScrollBarHelper {\n constructor() {\n this._element = document.body\n }\n\n getWidth() {\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n const documentWidth = document.documentElement.clientWidth\n return Math.abs(window.innerWidth - documentWidth)\n }\n\n hide() {\n const width = this.getWidth()\n this._disableOverFlow()\n // give padding to element to balance the hidden scrollbar width\n this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width)\n // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth\n this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width)\n this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width)\n }\n\n _disableOverFlow() {\n this._saveInitialAttribute(this._element, 'overflow')\n this._element.style.overflow = 'hidden'\n }\n\n _setElementAttributes(selector, styleProp, callback) {\n const scrollbarWidth = this.getWidth()\n const manipulationCallBack = element => {\n if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {\n return\n }\n\n this._saveInitialAttribute(element, styleProp)\n const calculatedValue = window.getComputedStyle(element)[styleProp]\n element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`\n }\n\n this._applyManipulationCallback(selector, manipulationCallBack)\n }\n\n reset() {\n this._resetElementAttributes(this._element, 'overflow')\n this._resetElementAttributes(this._element, 'paddingRight')\n this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight')\n this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight')\n }\n\n _saveInitialAttribute(element, styleProp) {\n const actualValue = element.style[styleProp]\n if (actualValue) {\n Manipulator.setDataAttribute(element, styleProp, actualValue)\n }\n }\n\n _resetElementAttributes(selector, styleProp) {\n const manipulationCallBack = element => {\n const value = Manipulator.getDataAttribute(element, styleProp)\n if (typeof value === 'undefined') {\n element.style.removeProperty(styleProp)\n } else {\n Manipulator.removeDataAttribute(element, styleProp)\n element.style[styleProp] = value\n }\n }\n\n this._applyManipulationCallback(selector, manipulationCallBack)\n }\n\n _applyManipulationCallback(selector, callBack) {\n if (isElement(selector)) {\n callBack(selector)\n } else {\n SelectorEngine.find(selector, this._element).forEach(callBack)\n }\n }\n\n isOverflowing() {\n return this.getWidth() > 0\n }\n}\n\nexport default ScrollBarHelper\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): util/backdrop.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler'\nimport { execute, executeAfterTransition, getElement, reflow, typeCheckConfig } from './index'\n\nconst Default = {\n className: 'modal-backdrop',\n isVisible: true, // if false, we use the backdrop helper without adding any element to the dom\n isAnimated: false,\n rootElement: 'body', // give the choice to place backdrop under different elements\n clickCallback: null\n}\n\nconst DefaultType = {\n className: 'string',\n isVisible: 'boolean',\n isAnimated: 'boolean',\n rootElement: '(element|string)',\n clickCallback: '(function|null)'\n}\nconst NAME = 'backdrop'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\n\nconst EVENT_MOUSEDOWN = `mousedown.bs.${NAME}`\n\nclass Backdrop {\n constructor(config) {\n this._config = this._getConfig(config)\n this._isAppended = false\n this._element = null\n }\n\n show(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._append()\n\n if (this._config.isAnimated) {\n reflow(this._getElement())\n }\n\n this._getElement().classList.add(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n execute(callback)\n })\n }\n\n hide(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._getElement().classList.remove(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n this.dispose()\n execute(callback)\n })\n }\n\n // Private\n\n _getElement() {\n if (!this._element) {\n const backdrop = document.createElement('div')\n backdrop.className = this._config.className\n if (this._config.isAnimated) {\n backdrop.classList.add(CLASS_NAME_FADE)\n }\n\n this._element = backdrop\n }\n\n return this._element\n }\n\n _getConfig(config) {\n config = {\n ...Default,\n ...(typeof config === 'object' ? config : {})\n }\n\n // use getElement() with the default \"body\" to get a fresh Element on each instantiation\n config.rootElement = getElement(config.rootElement)\n typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n\n _append() {\n if (this._isAppended) {\n return\n }\n\n this._config.rootElement.append(this._getElement())\n\n EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {\n execute(this._config.clickCallback)\n })\n\n this._isAppended = true\n }\n\n dispose() {\n if (!this._isAppended) {\n return\n }\n\n EventHandler.off(this._element, EVENT_MOUSEDOWN)\n\n this._element.remove()\n this._isAppended = false\n }\n\n _emulateAnimation(callback) {\n executeAfterTransition(callback, this._getElement(), this._config.isAnimated)\n }\n}\n\nexport default Backdrop\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): util/focustrap.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler'\nimport SelectorEngine from '../dom/selector-engine'\nimport { typeCheckConfig } from './index'\n\nconst Default = {\n trapElement: null, // The element to trap focus inside of\n autofocus: true\n}\n\nconst DefaultType = {\n trapElement: 'element',\n autofocus: 'boolean'\n}\n\nconst NAME = 'focustrap'\nconst DATA_KEY = 'bs.focustrap'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst EVENT_FOCUSIN = `focusin${EVENT_KEY}`\nconst EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`\n\nconst TAB_KEY = 'Tab'\nconst TAB_NAV_FORWARD = 'forward'\nconst TAB_NAV_BACKWARD = 'backward'\n\nclass FocusTrap {\n constructor(config) {\n this._config = this._getConfig(config)\n this._isActive = false\n this._lastTabNavDirection = null\n }\n\n activate() {\n const { trapElement, autofocus } = this._config\n\n if (this._isActive) {\n return\n }\n\n if (autofocus) {\n trapElement.focus()\n }\n\n EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop\n EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event))\n EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event))\n\n this._isActive = true\n }\n\n deactivate() {\n if (!this._isActive) {\n return\n }\n\n this._isActive = false\n EventHandler.off(document, EVENT_KEY)\n }\n\n // Private\n\n _handleFocusin(event) {\n const { target } = event\n const { trapElement } = this._config\n\n if (target === document || target === trapElement || trapElement.contains(target)) {\n return\n }\n\n const elements = SelectorEngine.focusableChildren(trapElement)\n\n if (elements.length === 0) {\n trapElement.focus()\n } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {\n elements[elements.length - 1].focus()\n } else {\n elements[0].focus()\n }\n }\n\n _handleKeydown(event) {\n if (event.key !== TAB_KEY) {\n return\n }\n\n this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD\n }\n\n _getConfig(config) {\n config = {\n ...Default,\n ...(typeof config === 'object' ? config : {})\n }\n typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n}\n\nexport default FocusTrap\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): modal.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n defineJQueryPlugin,\n getElementFromSelector,\n isRTL,\n isVisible,\n reflow,\n typeCheckConfig\n} from './util/index'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\nimport ScrollBarHelper from './util/scrollbar'\nimport BaseComponent from './base-component'\nimport Backdrop from './util/backdrop'\nimport FocusTrap from './util/focustrap'\nimport { enableDismissTrigger } from './util/component-functions'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'modal'\nconst DATA_KEY = 'bs.modal'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst ESCAPE_KEY = 'Escape'\n\nconst Default = {\n backdrop: true,\n keyboard: true,\n focus: true\n}\n\nconst DefaultType = {\n backdrop: '(boolean|string)',\n keyboard: 'boolean',\n focus: 'boolean'\n}\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_RESIZE = `resize${EVENT_KEY}`\nconst EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\nconst EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY}`\nconst EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_OPEN = 'modal-open'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_STATIC = 'modal-static'\n\nconst OPEN_SELECTOR = '.modal.show'\nconst SELECTOR_DIALOG = '.modal-dialog'\nconst SELECTOR_MODAL_BODY = '.modal-body'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"modal\"]'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Modal extends BaseComponent {\n constructor(element, config) {\n super(element)\n\n this._config = this._getConfig(config)\n this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element)\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._isShown = false\n this._ignoreBackdropClick = false\n this._isTransitioning = false\n this._scrollBar = new ScrollBarHelper()\n }\n\n // Getters\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown || this._isTransitioning) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {\n relatedTarget\n })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n\n if (this._isAnimated()) {\n this._isTransitioning = true\n }\n\n this._scrollBar.hide()\n\n document.body.classList.add(CLASS_NAME_OPEN)\n\n this._adjustDialog()\n\n this._setEscapeEvent()\n this._setResizeEvent()\n\n EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {\n EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {\n if (event.target === this._element) {\n this._ignoreBackdropClick = true\n }\n })\n })\n\n this._showBackdrop(() => this._showElement(relatedTarget))\n }\n\n hide() {\n if (!this._isShown || this._isTransitioning) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._isShown = false\n const isAnimated = this._isAnimated()\n\n if (isAnimated) {\n this._isTransitioning = true\n }\n\n this._setEscapeEvent()\n this._setResizeEvent()\n\n this._focustrap.deactivate()\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n EventHandler.off(this._element, EVENT_CLICK_DISMISS)\n EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS)\n\n this._queueCallback(() => this._hideModal(), this._element, isAnimated)\n }\n\n dispose() {\n [window, this._dialog]\n .forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY))\n\n this._backdrop.dispose()\n this._focustrap.deactivate()\n super.dispose()\n }\n\n handleUpdate() {\n this._adjustDialog()\n }\n\n // Private\n\n _initializeBackDrop() {\n return new Backdrop({\n isVisible: Boolean(this._config.backdrop), // 'static' option will be translated to true, and booleans will keep their value\n isAnimated: this._isAnimated()\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _getConfig(config) {\n config = {\n ...Default,\n ...Manipulator.getDataAttributes(this._element),\n ...(typeof config === 'object' ? config : {})\n }\n typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n\n _showElement(relatedTarget) {\n const isAnimated = this._isAnimated()\n const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog)\n\n if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {\n // Don't move modal's DOM position\n document.body.append(this._element)\n }\n\n this._element.style.display = 'block'\n this._element.removeAttribute('aria-hidden')\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.scrollTop = 0\n\n if (modalBody) {\n modalBody.scrollTop = 0\n }\n\n if (isAnimated) {\n reflow(this._element)\n }\n\n this._element.classList.add(CLASS_NAME_SHOW)\n\n const transitionComplete = () => {\n if (this._config.focus) {\n this._focustrap.activate()\n }\n\n this._isTransitioning = false\n EventHandler.trigger(this._element, EVENT_SHOWN, {\n relatedTarget\n })\n }\n\n this._queueCallback(transitionComplete, this._dialog, isAnimated)\n }\n\n _setEscapeEvent() {\n if (this._isShown) {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (this._config.keyboard && event.key === ESCAPE_KEY) {\n event.preventDefault()\n this.hide()\n } else if (!this._config.keyboard && event.key === ESCAPE_KEY) {\n this._triggerBackdropTransition()\n }\n })\n } else {\n EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS)\n }\n }\n\n _setResizeEvent() {\n if (this._isShown) {\n EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog())\n } else {\n EventHandler.off(window, EVENT_RESIZE)\n }\n }\n\n _hideModal() {\n this._element.style.display = 'none'\n this._element.setAttribute('aria-hidden', true)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n this._isTransitioning = false\n this._backdrop.hide(() => {\n document.body.classList.remove(CLASS_NAME_OPEN)\n this._resetAdjustments()\n this._scrollBar.reset()\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n })\n }\n\n _showBackdrop(callback) {\n EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {\n if (this._ignoreBackdropClick) {\n this._ignoreBackdropClick = false\n return\n }\n\n if (event.target !== event.currentTarget) {\n return\n }\n\n if (this._config.backdrop === true) {\n this.hide()\n } else if (this._config.backdrop === 'static') {\n this._triggerBackdropTransition()\n }\n })\n\n this._backdrop.show(callback)\n }\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_FADE)\n }\n\n _triggerBackdropTransition() {\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n const { classList, scrollHeight, style } = this._element\n const isModalOverflowing = scrollHeight > document.documentElement.clientHeight\n\n // return if the following background transition hasn't yet completed\n if ((!isModalOverflowing && style.overflowY === 'hidden') || classList.contains(CLASS_NAME_STATIC)) {\n return\n }\n\n if (!isModalOverflowing) {\n style.overflowY = 'hidden'\n }\n\n classList.add(CLASS_NAME_STATIC)\n this._queueCallback(() => {\n classList.remove(CLASS_NAME_STATIC)\n if (!isModalOverflowing) {\n this._queueCallback(() => {\n style.overflowY = ''\n }, this._dialog)\n }\n }, this._dialog)\n\n this._element.focus()\n }\n\n // ----------------------------------------------------------------------\n // the following methods are used to handle overflowing modals\n // ----------------------------------------------------------------------\n\n _adjustDialog() {\n const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight\n const scrollbarWidth = this._scrollBar.getWidth()\n const isBodyOverflowing = scrollbarWidth > 0\n\n if ((!isBodyOverflowing && isModalOverflowing && !isRTL()) || (isBodyOverflowing && !isModalOverflowing && isRTL())) {\n this._element.style.paddingLeft = `${scrollbarWidth}px`\n }\n\n if ((isBodyOverflowing && !isModalOverflowing && !isRTL()) || (!isBodyOverflowing && isModalOverflowing && isRTL())) {\n this._element.style.paddingRight = `${scrollbarWidth}px`\n }\n }\n\n _resetAdjustments() {\n this._element.style.paddingLeft = ''\n this._element.style.paddingRight = ''\n }\n\n // Static\n\n static jQueryInterface(config, relatedTarget) {\n return this.each(function () {\n const data = Modal.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](relatedTarget)\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n EventHandler.one(target, EVENT_SHOW, showEvent => {\n if (showEvent.defaultPrevented) {\n // only register focus restorer if modal will actually get shown\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n if (isVisible(this)) {\n this.focus()\n }\n })\n })\n\n // avoid conflict when clicking moddal toggler while another one is open\n const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (allReadyOpen) {\n Modal.getInstance(allReadyOpen).hide()\n }\n\n const data = Modal.getOrCreateInstance(target)\n\n data.toggle(this)\n})\n\nenableDismissTrigger(Modal)\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Modal to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Modal)\n\nexport default Modal\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): offcanvas.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n defineJQueryPlugin,\n getElementFromSelector,\n isDisabled,\n isVisible,\n typeCheckConfig\n} from './util/index'\nimport ScrollBarHelper from './util/scrollbar'\nimport EventHandler from './dom/event-handler'\nimport BaseComponent from './base-component'\nimport SelectorEngine from './dom/selector-engine'\nimport Manipulator from './dom/manipulator'\nimport Backdrop from './util/backdrop'\nimport FocusTrap from './util/focustrap'\nimport { enableDismissTrigger } from './util/component-functions'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'offcanvas'\nconst DATA_KEY = 'bs.offcanvas'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst ESCAPE_KEY = 'Escape'\n\nconst Default = {\n backdrop: true,\n keyboard: true,\n scroll: false\n}\n\nconst DefaultType = {\n backdrop: 'boolean',\n keyboard: 'boolean',\n scroll: 'boolean'\n}\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_BACKDROP = 'offcanvas-backdrop'\nconst OPEN_SELECTOR = '.offcanvas.show'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"offcanvas\"]'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Offcanvas extends BaseComponent {\n constructor(element, config) {\n super(element)\n\n this._config = this._getConfig(config)\n this._isShown = false\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._addEventListeners()\n }\n\n // Getters\n\n static get NAME() {\n return NAME\n }\n\n static get Default() {\n return Default\n }\n\n // Public\n\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n this._element.style.visibility = 'visible'\n\n this._backdrop.show()\n\n if (!this._config.scroll) {\n new ScrollBarHelper().hide()\n }\n\n this._element.removeAttribute('aria-hidden')\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.classList.add(CLASS_NAME_SHOW)\n\n const completeCallBack = () => {\n if (!this._config.scroll) {\n this._focustrap.activate()\n }\n\n EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget })\n }\n\n this._queueCallback(completeCallBack, this._element, true)\n }\n\n hide() {\n if (!this._isShown) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._focustrap.deactivate()\n this._element.blur()\n this._isShown = false\n this._element.classList.remove(CLASS_NAME_SHOW)\n this._backdrop.hide()\n\n const completeCallback = () => {\n this._element.setAttribute('aria-hidden', true)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n this._element.style.visibility = 'hidden'\n\n if (!this._config.scroll) {\n new ScrollBarHelper().reset()\n }\n\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._queueCallback(completeCallback, this._element, true)\n }\n\n dispose() {\n this._backdrop.dispose()\n this._focustrap.deactivate()\n super.dispose()\n }\n\n // Private\n\n _getConfig(config) {\n config = {\n ...Default,\n ...Manipulator.getDataAttributes(this._element),\n ...(typeof config === 'object' ? config : {})\n }\n typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n\n _initializeBackDrop() {\n return new Backdrop({\n className: CLASS_NAME_BACKDROP,\n isVisible: this._config.backdrop,\n isAnimated: true,\n rootElement: this._element.parentNode,\n clickCallback: () => this.hide()\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _addEventListeners() {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (this._config.keyboard && event.key === ESCAPE_KEY) {\n this.hide()\n }\n })\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Offcanvas.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n // focus on trigger when it is closed\n if (isVisible(this)) {\n this.focus()\n }\n })\n\n // avoid conflict when clicking a toggler of an offcanvas, while another is open\n const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (allReadyOpen && allReadyOpen !== target) {\n Offcanvas.getInstance(allReadyOpen).hide()\n }\n\n const data = Offcanvas.getOrCreateInstance(target)\n data.toggle(this)\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () =>\n SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show())\n)\n\nenableDismissTrigger(Offcanvas)\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\ndefineJQueryPlugin(Offcanvas)\n\nexport default Offcanvas\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): util/sanitizer.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst uriAttributes = new Set([\n 'background',\n 'cite',\n 'href',\n 'itemtype',\n 'longdesc',\n 'poster',\n 'src',\n 'xlink:href'\n])\n\nconst ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i\n\n/**\n * A pattern that recognizes a commonly useful subset of URLs that are safe.\n *\n * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts\n */\nconst SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i\n\n/**\n * A pattern that matches safe data URLs. Only matches image, video and audio types.\n *\n * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts\n */\nconst 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\n\nconst allowedAttribute = (attribute, allowedAttributeList) => {\n const attributeName = attribute.nodeName.toLowerCase()\n\n if (allowedAttributeList.includes(attributeName)) {\n if (uriAttributes.has(attributeName)) {\n return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue))\n }\n\n return true\n }\n\n const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)\n\n // Check if a regular expression validates the attribute.\n for (let i = 0, len = regExp.length; i < len; i++) {\n if (regExp[i].test(attributeName)) {\n return true\n }\n }\n\n return false\n}\n\nexport const DefaultAllowlist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n div: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n}\n\nexport function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {\n if (!unsafeHtml.length) {\n return unsafeHtml\n }\n\n if (sanitizeFn && typeof sanitizeFn === 'function') {\n return sanitizeFn(unsafeHtml)\n }\n\n const domParser = new window.DOMParser()\n const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')\n const elements = [].concat(...createdDocument.body.querySelectorAll('*'))\n\n for (let i = 0, len = elements.length; i < len; i++) {\n const element = elements[i]\n const elementName = element.nodeName.toLowerCase()\n\n if (!Object.keys(allowList).includes(elementName)) {\n element.remove()\n\n continue\n }\n\n const attributeList = [].concat(...element.attributes)\n const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])\n\n attributeList.forEach(attribute => {\n if (!allowedAttribute(attribute, allowedAttributes)) {\n element.removeAttribute(attribute.nodeName)\n }\n })\n }\n\n return createdDocument.body.innerHTML\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): tooltip.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport * as Popper from '@popperjs/core'\n\nimport {\n defineJQueryPlugin,\n findShadowRoot,\n getElement,\n getUID,\n isElement,\n isRTL,\n noop,\n typeCheckConfig\n} from './util/index'\nimport { DefaultAllowlist, sanitizeHtml } from './util/sanitizer'\nimport Data from './dom/data'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\nimport BaseComponent from './base-component'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'tooltip'\nconst DATA_KEY = 'bs.tooltip'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst CLASS_PREFIX = 'bs-tooltip'\nconst DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])\n\nconst DefaultType = {\n animation: 'boolean',\n template: 'string',\n title: '(string|element|function)',\n trigger: 'string',\n delay: '(number|object)',\n html: 'boolean',\n selector: '(string|boolean)',\n placement: '(string|function)',\n offset: '(array|string|function)',\n container: '(string|element|boolean)',\n fallbackPlacements: 'array',\n boundary: '(string|element)',\n customClass: '(string|function)',\n sanitize: 'boolean',\n sanitizeFn: '(null|function)',\n allowList: 'object',\n popperConfig: '(null|object|function)'\n}\n\nconst AttachmentMap = {\n AUTO: 'auto',\n TOP: 'top',\n RIGHT: isRTL() ? 'left' : 'right',\n BOTTOM: 'bottom',\n LEFT: isRTL() ? 'right' : 'left'\n}\n\nconst Default = {\n animation: true,\n template: '
' +\n '
' +\n '
' +\n '
',\n trigger: 'hover focus',\n title: '',\n delay: 0,\n html: false,\n selector: false,\n placement: 'top',\n offset: [0, 0],\n container: false,\n fallbackPlacements: ['top', 'right', 'bottom', 'left'],\n boundary: 'clippingParents',\n customClass: '',\n sanitize: true,\n sanitizeFn: null,\n allowList: DefaultAllowlist,\n popperConfig: null\n}\n\nconst Event = {\n HIDE: `hide${EVENT_KEY}`,\n HIDDEN: `hidden${EVENT_KEY}`,\n SHOW: `show${EVENT_KEY}`,\n SHOWN: `shown${EVENT_KEY}`,\n INSERTED: `inserted${EVENT_KEY}`,\n CLICK: `click${EVENT_KEY}`,\n FOCUSIN: `focusin${EVENT_KEY}`,\n FOCUSOUT: `focusout${EVENT_KEY}`,\n MOUSEENTER: `mouseenter${EVENT_KEY}`,\n MOUSELEAVE: `mouseleave${EVENT_KEY}`\n}\n\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_MODAL = 'modal'\nconst CLASS_NAME_SHOW = 'show'\n\nconst HOVER_STATE_SHOW = 'show'\nconst HOVER_STATE_OUT = 'out'\n\nconst SELECTOR_TOOLTIP_INNER = '.tooltip-inner'\nconst SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`\n\nconst EVENT_MODAL_HIDE = 'hide.bs.modal'\n\nconst TRIGGER_HOVER = 'hover'\nconst TRIGGER_FOCUS = 'focus'\nconst TRIGGER_CLICK = 'click'\nconst TRIGGER_MANUAL = 'manual'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Tooltip extends BaseComponent {\n constructor(element, config) {\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s tooltips require Popper (https://popper.js.org)')\n }\n\n super(element)\n\n // private\n this._isEnabled = true\n this._timeout = 0\n this._hoverState = ''\n this._activeTrigger = {}\n this._popper = null\n\n // Protected\n this._config = this._getConfig(config)\n this.tip = null\n\n this._setListeners()\n }\n\n // Getters\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n static get Event() {\n return Event\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n // Public\n\n enable() {\n this._isEnabled = true\n }\n\n disable() {\n this._isEnabled = false\n }\n\n toggleEnabled() {\n this._isEnabled = !this._isEnabled\n }\n\n toggle(event) {\n if (!this._isEnabled) {\n return\n }\n\n if (event) {\n const context = this._initializeOnDelegatedTarget(event)\n\n context._activeTrigger.click = !context._activeTrigger.click\n\n if (context._isWithActiveTrigger()) {\n context._enter(null, context)\n } else {\n context._leave(null, context)\n }\n } else {\n if (this.getTipElement().classList.contains(CLASS_NAME_SHOW)) {\n this._leave(null, this)\n return\n }\n\n this._enter(null, this)\n }\n }\n\n dispose() {\n clearTimeout(this._timeout)\n\n EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)\n\n if (this.tip) {\n this.tip.remove()\n }\n\n this._disposePopper()\n super.dispose()\n }\n\n show() {\n if (this._element.style.display === 'none') {\n throw new Error('Please use show on visible elements')\n }\n\n if (!(this.isWithContent() && this._isEnabled)) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW)\n const shadowRoot = findShadowRoot(this._element)\n const isInTheDom = shadowRoot === null ?\n this._element.ownerDocument.documentElement.contains(this._element) :\n shadowRoot.contains(this._element)\n\n if (showEvent.defaultPrevented || !isInTheDom) {\n return\n }\n\n // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title`\n // This will be removed later in favor of a `setContent` method\n if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {\n this._disposePopper()\n this.tip.remove()\n this.tip = null\n }\n\n const tip = this.getTipElement()\n const tipId = getUID(this.constructor.NAME)\n\n tip.setAttribute('id', tipId)\n this._element.setAttribute('aria-describedby', tipId)\n\n if (this._config.animation) {\n tip.classList.add(CLASS_NAME_FADE)\n }\n\n const placement = typeof this._config.placement === 'function' ?\n this._config.placement.call(this, tip, this._element) :\n this._config.placement\n\n const attachment = this._getAttachment(placement)\n this._addAttachmentClass(attachment)\n\n const { container } = this._config\n Data.set(tip, this.constructor.DATA_KEY, this)\n\n if (!this._element.ownerDocument.documentElement.contains(this.tip)) {\n container.append(tip)\n EventHandler.trigger(this._element, this.constructor.Event.INSERTED)\n }\n\n if (this._popper) {\n this._popper.update()\n } else {\n this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment))\n }\n\n tip.classList.add(CLASS_NAME_SHOW)\n\n const customClass = this._resolvePossibleFunction(this._config.customClass)\n if (customClass) {\n tip.classList.add(...customClass.split(' '))\n }\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement) {\n [].concat(...document.body.children).forEach(element => {\n EventHandler.on(element, 'mouseover', noop)\n })\n }\n\n const complete = () => {\n const prevHoverState = this._hoverState\n\n this._hoverState = null\n EventHandler.trigger(this._element, this.constructor.Event.SHOWN)\n\n if (prevHoverState === HOVER_STATE_OUT) {\n this._leave(null, this)\n }\n }\n\n const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE)\n this._queueCallback(complete, this.tip, isAnimated)\n }\n\n hide() {\n if (!this._popper) {\n return\n }\n\n const tip = this.getTipElement()\n const complete = () => {\n if (this._isWithActiveTrigger()) {\n return\n }\n\n if (this._hoverState !== HOVER_STATE_SHOW) {\n tip.remove()\n }\n\n this._cleanTipClass()\n this._element.removeAttribute('aria-describedby')\n EventHandler.trigger(this._element, this.constructor.Event.HIDDEN)\n\n this._disposePopper()\n }\n\n const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n tip.classList.remove(CLASS_NAME_SHOW)\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n [].concat(...document.body.children)\n .forEach(element => EventHandler.off(element, 'mouseover', noop))\n }\n\n this._activeTrigger[TRIGGER_CLICK] = false\n this._activeTrigger[TRIGGER_FOCUS] = false\n this._activeTrigger[TRIGGER_HOVER] = false\n\n const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE)\n this._queueCallback(complete, this.tip, isAnimated)\n this._hoverState = ''\n }\n\n update() {\n if (this._popper !== null) {\n this._popper.update()\n }\n }\n\n // Protected\n\n isWithContent() {\n return Boolean(this.getTitle())\n }\n\n getTipElement() {\n if (this.tip) {\n return this.tip\n }\n\n const element = document.createElement('div')\n element.innerHTML = this._config.template\n\n const tip = element.children[0]\n this.setContent(tip)\n tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)\n\n this.tip = tip\n return this.tip\n }\n\n setContent(tip) {\n this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER)\n }\n\n _sanitizeAndSetContent(template, content, selector) {\n const templateElement = SelectorEngine.findOne(selector, template)\n\n if (!content && templateElement) {\n templateElement.remove()\n return\n }\n\n // we use append for html objects to maintain js events\n this.setElementContent(templateElement, content)\n }\n\n setElementContent(element, content) {\n if (element === null) {\n return\n }\n\n if (isElement(content)) {\n content = getElement(content)\n\n // content is a DOM node or a jQuery\n if (this._config.html) {\n if (content.parentNode !== element) {\n element.innerHTML = ''\n element.append(content)\n }\n } else {\n element.textContent = content.textContent\n }\n\n return\n }\n\n if (this._config.html) {\n if (this._config.sanitize) {\n content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn)\n }\n\n element.innerHTML = content\n } else {\n element.textContent = content\n }\n }\n\n getTitle() {\n const title = this._element.getAttribute('data-bs-original-title') || this._config.title\n\n return this._resolvePossibleFunction(title)\n }\n\n updateAttachment(attachment) {\n if (attachment === 'right') {\n return 'end'\n }\n\n if (attachment === 'left') {\n return 'start'\n }\n\n return attachment\n }\n\n // Private\n\n _initializeOnDelegatedTarget(event, context) {\n return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig())\n }\n\n _getOffset() {\n const { offset } = this._config\n\n if (typeof offset === 'string') {\n return offset.split(',').map(val => Number.parseInt(val, 10))\n }\n\n if (typeof offset === 'function') {\n return popperData => offset(popperData, this._element)\n }\n\n return offset\n }\n\n _resolvePossibleFunction(content) {\n return typeof content === 'function' ? content.call(this._element) : content\n }\n\n _getPopperConfig(attachment) {\n const defaultBsPopperConfig = {\n placement: attachment,\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements: this._config.fallbackPlacements\n }\n },\n {\n name: 'offset',\n options: {\n offset: this._getOffset()\n }\n },\n {\n name: 'preventOverflow',\n options: {\n boundary: this._config.boundary\n }\n },\n {\n name: 'arrow',\n options: {\n element: `.${this.constructor.NAME}-arrow`\n }\n },\n {\n name: 'onChange',\n enabled: true,\n phase: 'afterWrite',\n fn: data => this._handlePopperPlacementChange(data)\n }\n ],\n onFirstUpdate: data => {\n if (data.options.placement !== data.placement) {\n this._handlePopperPlacementChange(data)\n }\n }\n }\n\n return {\n ...defaultBsPopperConfig,\n ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)\n }\n }\n\n _addAttachmentClass(attachment) {\n this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`)\n }\n\n _getAttachment(placement) {\n return AttachmentMap[placement.toUpperCase()]\n }\n\n _setListeners() {\n const triggers = this._config.trigger.split(' ')\n\n triggers.forEach(trigger => {\n if (trigger === 'click') {\n EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event))\n } else if (trigger !== TRIGGER_MANUAL) {\n const eventIn = trigger === TRIGGER_HOVER ?\n this.constructor.Event.MOUSEENTER :\n this.constructor.Event.FOCUSIN\n const eventOut = trigger === TRIGGER_HOVER ?\n this.constructor.Event.MOUSELEAVE :\n this.constructor.Event.FOCUSOUT\n\n EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event))\n EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event))\n }\n })\n\n this._hideModalHandler = () => {\n if (this._element) {\n this.hide()\n }\n }\n\n EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)\n\n if (this._config.selector) {\n this._config = {\n ...this._config,\n trigger: 'manual',\n selector: ''\n }\n } else {\n this._fixTitle()\n }\n }\n\n _fixTitle() {\n const title = this._element.getAttribute('title')\n const originalTitleType = typeof this._element.getAttribute('data-bs-original-title')\n\n if (title || originalTitleType !== 'string') {\n this._element.setAttribute('data-bs-original-title', title || '')\n if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {\n this._element.setAttribute('aria-label', title)\n }\n\n this._element.setAttribute('title', '')\n }\n }\n\n _enter(event, context) {\n context = this._initializeOnDelegatedTarget(event, context)\n\n if (event) {\n context._activeTrigger[\n event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER\n ] = true\n }\n\n if (context.getTipElement().classList.contains(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) {\n context._hoverState = HOVER_STATE_SHOW\n return\n }\n\n clearTimeout(context._timeout)\n\n context._hoverState = HOVER_STATE_SHOW\n\n if (!context._config.delay || !context._config.delay.show) {\n context.show()\n return\n }\n\n context._timeout = setTimeout(() => {\n if (context._hoverState === HOVER_STATE_SHOW) {\n context.show()\n }\n }, context._config.delay.show)\n }\n\n _leave(event, context) {\n context = this._initializeOnDelegatedTarget(event, context)\n\n if (event) {\n context._activeTrigger[\n event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER\n ] = context._element.contains(event.relatedTarget)\n }\n\n if (context._isWithActiveTrigger()) {\n return\n }\n\n clearTimeout(context._timeout)\n\n context._hoverState = HOVER_STATE_OUT\n\n if (!context._config.delay || !context._config.delay.hide) {\n context.hide()\n return\n }\n\n context._timeout = setTimeout(() => {\n if (context._hoverState === HOVER_STATE_OUT) {\n context.hide()\n }\n }, context._config.delay.hide)\n }\n\n _isWithActiveTrigger() {\n for (const trigger in this._activeTrigger) {\n if (this._activeTrigger[trigger]) {\n return true\n }\n }\n\n return false\n }\n\n _getConfig(config) {\n const dataAttributes = Manipulator.getDataAttributes(this._element)\n\n Object.keys(dataAttributes).forEach(dataAttr => {\n if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {\n delete dataAttributes[dataAttr]\n }\n })\n\n config = {\n ...this.constructor.Default,\n ...dataAttributes,\n ...(typeof config === 'object' && config ? config : {})\n }\n\n config.container = config.container === false ? document.body : getElement(config.container)\n\n if (typeof config.delay === 'number') {\n config.delay = {\n show: config.delay,\n hide: config.delay\n }\n }\n\n if (typeof config.title === 'number') {\n config.title = config.title.toString()\n }\n\n if (typeof config.content === 'number') {\n config.content = config.content.toString()\n }\n\n typeCheckConfig(NAME, config, this.constructor.DefaultType)\n\n if (config.sanitize) {\n config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn)\n }\n\n return config\n }\n\n _getDelegateConfig() {\n const config = {}\n\n for (const key in this._config) {\n if (this.constructor.Default[key] !== this._config[key]) {\n config[key] = this._config[key]\n }\n }\n\n // In the future can be replaced with:\n // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])\n // `Object.fromEntries(keysWithDifferentValues)`\n return config\n }\n\n _cleanTipClass() {\n const tip = this.getTipElement()\n const basicClassPrefixRegex = new RegExp(`(^|\\\\s)${this._getBasicClassPrefix()}\\\\S+`, 'g')\n const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex)\n if (tabClass !== null && tabClass.length > 0) {\n tabClass.map(token => token.trim())\n .forEach(tClass => tip.classList.remove(tClass))\n }\n }\n\n _getBasicClassPrefix() {\n return CLASS_PREFIX\n }\n\n _handlePopperPlacementChange(popperData) {\n const { state } = popperData\n\n if (!state) {\n return\n }\n\n this.tip = state.elements.popper\n this._cleanTipClass()\n this._addAttachmentClass(this._getAttachment(state.placement))\n }\n\n _disposePopper() {\n if (this._popper) {\n this._popper.destroy()\n this._popper = null\n }\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Tooltip.getOrCreateInstance(this, config)\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Tooltip to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Tooltip)\n\nexport default Tooltip\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): popover.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin } from './util/index'\nimport Tooltip from './tooltip'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'popover'\nconst DATA_KEY = 'bs.popover'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst CLASS_PREFIX = 'bs-popover'\n\nconst Default = {\n ...Tooltip.Default,\n placement: 'right',\n offset: [0, 8],\n trigger: 'click',\n content: '',\n template: '
' +\n '
' +\n '

' +\n '
' +\n '
'\n}\n\nconst DefaultType = {\n ...Tooltip.DefaultType,\n content: '(string|element|function)'\n}\n\nconst Event = {\n HIDE: `hide${EVENT_KEY}`,\n HIDDEN: `hidden${EVENT_KEY}`,\n SHOW: `show${EVENT_KEY}`,\n SHOWN: `shown${EVENT_KEY}`,\n INSERTED: `inserted${EVENT_KEY}`,\n CLICK: `click${EVENT_KEY}`,\n FOCUSIN: `focusin${EVENT_KEY}`,\n FOCUSOUT: `focusout${EVENT_KEY}`,\n MOUSEENTER: `mouseenter${EVENT_KEY}`,\n MOUSELEAVE: `mouseleave${EVENT_KEY}`\n}\n\nconst SELECTOR_TITLE = '.popover-header'\nconst SELECTOR_CONTENT = '.popover-body'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Popover extends Tooltip {\n // Getters\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n static get Event() {\n return Event\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n // Overrides\n\n isWithContent() {\n return this.getTitle() || this._getContent()\n }\n\n setContent(tip) {\n this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE)\n this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT)\n }\n\n // Private\n\n _getContent() {\n return this._resolvePossibleFunction(this._config.content)\n }\n\n _getBasicClassPrefix() {\n return CLASS_PREFIX\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Popover.getOrCreateInstance(this, config)\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Popover to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Popover)\n\nexport default Popover\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): scrollspy.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n defineJQueryPlugin,\n getElement,\n getSelectorFromElement,\n typeCheckConfig\n} from './util/index'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\nimport BaseComponent from './base-component'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'scrollspy'\nconst DATA_KEY = 'bs.scrollspy'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst Default = {\n offset: 10,\n method: 'auto',\n target: ''\n}\n\nconst DefaultType = {\n offset: 'number',\n method: 'string',\n target: '(string|element)'\n}\n\nconst EVENT_ACTIVATE = `activate${EVENT_KEY}`\nconst EVENT_SCROLL = `scroll${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'\nconst CLASS_NAME_ACTIVE = 'active'\n\nconst SELECTOR_DATA_SPY = '[data-bs-spy=\"scroll\"]'\nconst SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'\nconst SELECTOR_NAV_LINKS = '.nav-link'\nconst SELECTOR_NAV_ITEMS = '.nav-item'\nconst SELECTOR_LIST_ITEMS = '.list-group-item'\nconst SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`\nconst SELECTOR_DROPDOWN = '.dropdown'\nconst SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'\n\nconst METHOD_OFFSET = 'offset'\nconst METHOD_POSITION = 'position'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass ScrollSpy extends BaseComponent {\n constructor(element, config) {\n super(element)\n this._scrollElement = this._element.tagName === 'BODY' ? window : this._element\n this._config = this._getConfig(config)\n this._offsets = []\n this._targets = []\n this._activeTarget = null\n this._scrollHeight = 0\n\n EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process())\n\n this.refresh()\n this._process()\n }\n\n // Getters\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n refresh() {\n const autoMethod = this._scrollElement === this._scrollElement.window ?\n METHOD_OFFSET :\n METHOD_POSITION\n\n const offsetMethod = this._config.method === 'auto' ?\n autoMethod :\n this._config.method\n\n const offsetBase = offsetMethod === METHOD_POSITION ?\n this._getScrollTop() :\n 0\n\n this._offsets = []\n this._targets = []\n this._scrollHeight = this._getScrollHeight()\n\n const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target)\n\n targets.map(element => {\n const targetSelector = getSelectorFromElement(element)\n const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null\n\n if (target) {\n const targetBCR = target.getBoundingClientRect()\n if (targetBCR.width || targetBCR.height) {\n return [\n Manipulator[offsetMethod](target).top + offsetBase,\n targetSelector\n ]\n }\n }\n\n return null\n })\n .filter(item => item)\n .sort((a, b) => a[0] - b[0])\n .forEach(item => {\n this._offsets.push(item[0])\n this._targets.push(item[1])\n })\n }\n\n dispose() {\n EventHandler.off(this._scrollElement, EVENT_KEY)\n super.dispose()\n }\n\n // Private\n\n _getConfig(config) {\n config = {\n ...Default,\n ...Manipulator.getDataAttributes(this._element),\n ...(typeof config === 'object' && config ? config : {})\n }\n\n config.target = getElement(config.target) || document.documentElement\n\n typeCheckConfig(NAME, config, DefaultType)\n\n return config\n }\n\n _getScrollTop() {\n return this._scrollElement === window ?\n this._scrollElement.pageYOffset :\n this._scrollElement.scrollTop\n }\n\n _getScrollHeight() {\n return this._scrollElement.scrollHeight || Math.max(\n document.body.scrollHeight,\n document.documentElement.scrollHeight\n )\n }\n\n _getOffsetHeight() {\n return this._scrollElement === window ?\n window.innerHeight :\n this._scrollElement.getBoundingClientRect().height\n }\n\n _process() {\n const scrollTop = this._getScrollTop() + this._config.offset\n const scrollHeight = this._getScrollHeight()\n const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight()\n\n if (this._scrollHeight !== scrollHeight) {\n this.refresh()\n }\n\n if (scrollTop >= maxScroll) {\n const target = this._targets[this._targets.length - 1]\n\n if (this._activeTarget !== target) {\n this._activate(target)\n }\n\n return\n }\n\n if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {\n this._activeTarget = null\n this._clear()\n return\n }\n\n for (let i = this._offsets.length; i--;) {\n const isActiveTarget = this._activeTarget !== this._targets[i] &&\n scrollTop >= this._offsets[i] &&\n (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1])\n\n if (isActiveTarget) {\n this._activate(this._targets[i])\n }\n }\n }\n\n _activate(target) {\n this._activeTarget = target\n\n this._clear()\n\n const queries = SELECTOR_LINK_ITEMS.split(',')\n .map(selector => `${selector}[data-bs-target=\"${target}\"],${selector}[href=\"${target}\"]`)\n\n const link = SelectorEngine.findOne(queries.join(','), this._config.target)\n\n link.classList.add(CLASS_NAME_ACTIVE)\n if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {\n SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN))\n .classList.add(CLASS_NAME_ACTIVE)\n } else {\n SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP)\n .forEach(listGroup => {\n // Set triggered links parents as active\n // With both