diff --git a/.github/workflows/build-mex.yml b/.github/workflows/build-mex.yml new file mode 100644 index 0000000..e795027 --- /dev/null +++ b/.github/workflows/build-mex.yml @@ -0,0 +1,84 @@ +name: Build MATLAB MEX + +on: + workflow_call: + inputs: + runner: + description: GitHub Actions runner label + required: true + type: string + source_ref: + description: Repository ref to build + required: false + default: '' + type: string + release: + description: MATLAB release to use + required: true + type: string + mex_extension: + description: Expected MATLAB MEX extension, without a leading dot + required: true + type: string + artifact_name: + description: Optional artifact name; defaults to the MEX extension + required: false + default: '' + type: string + architecture: + description: Expected runner architecture, or skip + required: false + default: skip + type: string + run_tests: + description: Run the complete toolbox test suite after building + required: false + default: true + type: boolean + +permissions: + contents: read + +jobs: + build: + runs-on: ${{ inputs.runner }} + steps: + - name: Check out the repository + uses: actions/checkout@v6 + with: + ref: ${{ inputs.source_ref || github.ref }} + submodules: recursive + + - name: Verify runner architecture + if: ${{ inputs.architecture != 'skip' }} + shell: bash + run: test "$(uname -m)" = "${{ inputs.architecture }}" + + - name: Set up MATLAB + uses: matlab-actions/setup-matlab@v3 + with: + products: MATLAB + release: ${{ inputs.release }} + + - name: Configure the C compiler + uses: matlab-actions/run-command@v3 + with: + command: mex -setup C + + - name: Build MEX + uses: matlab-actions/run-command@v3 + with: + command: openProject(pwd); buildtool('mex') + + - name: Run the full test suite + if: ${{ inputs.run_tests }} + uses: matlab-actions/run-command@v3 + with: + command: openProject(pwd); buildtool('test') + + - name: Upload MEX artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.artifact_name || inputs.mex_extension }} + path: tbx/docmaker/+docmaker/cmarkmd2html.${{ inputs.mex_extension }} + if-no-files-found: error diff --git a/.github/workflows/docmaker-ci.md b/.github/workflows/docmaker-ci.md new file mode 100644 index 0000000..c8c6b04 --- /dev/null +++ b/.github/workflows/docmaker-ci.md @@ -0,0 +1,29 @@ +# CI workflows + +`docmaker-ci.yml` is the primary workflow. It selects `test-mini`, `test-full`, toolbox packaging, or a draft GitHub release based on the GitHub event or a manually selected mode. + +## Modes and triggers + +| Mode | Trigger | Work performed | +| --- | --- | --- | +| `test-mini` | Pull requests not targeting `master`; pushes to `master`; manual selection | Ubuntu 24.04 with the latest MATLAB builds and tests the Linux MEX. | +| `test-full` | Pull requests targeting `master`; manual selection | Builds and tests the latest Linux MEX and Windows/Mac MEX files. Linux compatibility tests run on R2021a, R2022b, R2023b, R2024b, and R2025b using the latest Linux MEX. The compatibility matrix can run alongside the Windows/Mac tests. | +| Package | Push of a `vMAJOR.MINOR.PATCH` tag reachable from `master`; manual selection | Builds Windows and Mac MEX files, stages them on Linux, then runs `buildtool('package')`. A valid tag publishes the MLTBX as a GitHub Release; manual runs upload it as a 14-day workflow artifact. | +| Draft | Manual selection | Builds and tests the MEX files, packages the toolbox, and creates a GitHub draft release tagged from the toolbox version in `Contents.m`. It does not run the tag ancestry check or publish to File Exchange. | + +For a master-targeted pull request, `test-linux-latest` and the Windows/Mac `test-platforms-latest` matrix run concurrently. `test-linux-releases` starts after the Linux latest MEX artifact is available, so it can overlap the Windows/Mac tests. Intel Mac uses MATLAB R2025b; Windows and Apple Silicon use `latest`. Linux compatibility jobs use Ubuntu 22.04 for R2021a, R2022b, and R2023b, and Ubuntu 24.04 for R2024b and R2025b. R2021a is best-effort on Ubuntu 22.04 because its newest officially supported Ubuntu release, 20.04, is no longer available as a GitHub-hosted runner. + +In the Actions job list, `test-mini` runs as `test-linux-latest`. Manual `test-full` runs `test-linux-latest` and `test-platforms-latest` concurrently, with `test-linux-releases` depending only on `test-linux-latest`. Tag packaging uses `check-tag`, `mex`, `package`, and `publish` in sequence. + +Manual runs use the `mode` selector (`test-mini`, `test-full`, `package`, or `draft`) and the ref selected in the Actions UI. The `docmaker-ci.yml` workflow must first be merged into the default branch (`master`) before GitHub exposes it there for manual dispatch. + +## Package flow + +The reusable `build-mex.yml` workflow compiles and tests each native MEX and uploads it as an artifact. The Ubuntu 24.04 package job checks out the selected source, downloads the Windows and Mac artifacts, stages them in `tbx/docmaker/+docmaker`, and runs `buildtool('package')`. That build task creates the Linux MEX and runs its check, test, and documentation dependencies before packaging. CI checks that the resulting MLTBX contains all four platform MEX files. + +The manual `draft` mode uses that package artifact to create a GitHub draft release. It reads the toolbox version from `tbx/docmaker/Contents.m` to form the release tag. Draft releases support prerelease and build versions: their tag and title keep the full version, while release notes use the matching `MAJOR.MINOR.PATCH` changelog section. Automatic publishing accepts only plain `vMAJOR.MINOR.PATCH` tags. The draft job does not run `check-tag`; the normal tag-push publish flow retains that gate. + +MEX artifacts use their extensions as names: `mexa64`, `mexw64`, `mexmaci64`, and `mexmaca64`. The toolbox artifact is named `mltbx`. + +For tag-push releases, `check-tag` requires the exact `vMAJOR.MINOR.PATCH` format and verifies that the commit is reachable from `master` before MEX builds and packaging begin. The package task also checks that the toolbox version matches the tag. The GitHub Release uses the corresponding `MAJOR.MINOR.PATCH` section from `tbx/docmakerdoc/changelog.md`. + diff --git a/.github/workflows/docmaker-ci.yml b/.github/workflows/docmaker-ci.yml index bb2dba6..9a8d06d 100644 --- a/.github/workflows/docmaker-ci.yml +++ b/.github/workflows/docmaker-ci.yml @@ -1,98 +1,385 @@ -name: MATLAB DocMaker Actions - -on: - push: - branches: [master] - tags: - - 'v*' - pull_request: - branches: [master] - workflow_dispatch: - -env: - DOCMAKER_GITHUB_TOKEN: ${{ secrets.DOCMAKER_GITHUB_TOKEN }} - -jobs: - - run-tests: - strategy: - matrix: - platform: [ubuntu-latest, windows-latest] - matlab-version: [R2022b, R2023b, R2024b, R2025b, R2026a, R2026b, latest-including-prerelease] - runs-on: ${{ matrix.platform }} - continue-on-error: false - steps: - - name: Check out the repository - uses: actions/checkout@v6 - - - name: Start a display server for jobs running on Linux - if: ${{ matrix.platform == 'ubuntu-latest' }} - run: | - sudo apt-get install -y xvfb - Xvfb :99 & - echo "DISPLAY=:99" >> $GITHUB_ENV - - - name: Set up MATLAB on the runner - uses: matlab-actions/setup-matlab@v3 - with: - products: MATLAB - release: ${{ matrix.matlab-version }} - - - name: Run the toolbox tests - uses: matlab-actions/run-tests@v3 - - package-and-release-toolbox: - if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest - - steps: - - name: Check out the repository - uses: actions/checkout@v6 - - - name: Extract version from tag - shell: bash - run: | - TOOLBOX_VERSION="${GITHUB_REF_NAME#v}" - echo "TOOLBOX_VERSION=$TOOLBOX_VERSION" >> $GITHUB_ENV - - - name: Set up MATLAB on the runner - uses: matlab-actions/setup-matlab@v3 - with: - products: MATLAB - - - name: Package toolbox - uses: matlab-actions/run-command@v3 - with: - command: | - logLines = readlines( "tbx/docmakerdoc/changelog.md" ); - startIdx = find( logLines == "## Version " + getenv( "TOOLBOX_VERSION" ) ) + 1; - allVersionLines = find( startsWith( logLines, "##" ) ); - endIdx = allVersionLines(find( allVersionLines > startIdx, 1 )) - 1; - releaseNotes = join( logLines(startIdx:endIdx), newline() ); - tempFile = "ReleaseNotes.txt"; - writelines( releaseNotes, tempFile ) - delimiter = "EOF_" + matlab.lang.internal.uuid(); - systemCommand = sprintf( [ ... - 'echo "RELEASE_NOTES<<%s" >> $GITHUB_ENV && ', ... - 'cat "%s" >> $GITHUB_ENV && ', ... - 'echo "%s" >> $GITHUB_ENV' ], ... - delimiter, tempFile, delimiter ); - system( systemCommand ); - delete( tempFile ) - buildtool package -skip test -skip check - - tasks: package - build-options: -skip test -skip check - - - name: Release toolbox - uses: softprops/action-gh-release@v3 - with: - name: MATLAB DocMaker ${{ env.TOOLBOX_VERSION }} - tag_name: v${{ env.TOOLBOX_VERSION }} - body: ${{ env.RELEASE_NOTES }} - draft: false - make_latest: true - files: releases/MATLAB_DocMaker.mltbx - env: - - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +name: MATLAB DocMaker CI + +on: + push: + branches: [master] + tags: + - 'v*' + pull_request: + workflow_dispatch: + inputs: + mode: + description: CI workload to run for the selected ref + required: true + default: test-mini + type: choice + options: + - test-mini + - test-full + - package + - draft + +permissions: + contents: read + +jobs: + test-linux-latest: + if: >- + ${{ + (github.event_name == 'workflow_dispatch' && + (inputs.mode == 'test-mini' || inputs.mode == 'test-full')) || + github.event_name == 'pull_request' || + (github.event_name == 'push' && github.ref == 'refs/heads/master') + }} + uses: ./.github/workflows/build-mex.yml + with: + runner: ubuntu-24.04 + release: latest + mex_extension: mexa64 + run_tests: true + + test-platforms-latest: + if: >- + ${{ + (github.event_name == 'workflow_dispatch' && inputs.mode == 'test-full') || + (github.event_name == 'pull_request' && github.base_ref == 'master') + }} + strategy: + fail-fast: false + matrix: + include: + - platform: windows + runner: windows-latest + release: latest + extension: mexw64 + architecture: skip + - platform: macos-intel + runner: macos-15-intel + release: R2025b + extension: mexmaci64 + architecture: x86_64 + - platform: macos-arm64 + runner: macos-15 + release: latest + extension: mexmaca64 + architecture: arm64 + uses: ./.github/workflows/build-mex.yml + with: + runner: ${{ matrix.runner }} + release: ${{ matrix.release }} + mex_extension: ${{ matrix.extension }} + architecture: ${{ matrix.architecture }} + run_tests: true + + test-linux-releases: + needs: test-linux-latest + if: >- + ${{ + always() && + ((github.event_name == 'workflow_dispatch' && inputs.mode == 'test-full') || + (github.event_name == 'pull_request' && github.base_ref == 'master')) && + needs.test-linux-latest.result == 'success' + }} + strategy: + fail-fast: false + matrix: + include: + # GitHub-hosted Ubuntu 20.04 runners are unavailable; R2021a is best-effort on 22.04. + - matlab-version: R2021a + runner: ubuntu-22.04 + - matlab-version: R2022b + runner: ubuntu-22.04 + - matlab-version: R2023b + runner: ubuntu-22.04 + - matlab-version: R2024b + runner: ubuntu-24.04 + - matlab-version: R2025b + runner: ubuntu-24.04 + runs-on: ${{ matrix.runner }} + steps: + - name: Check out the source + uses: actions/checkout@v6 + with: + ref: ${{ github.sha }} + submodules: recursive + + - name: Download the Linux MEX built with the latest MATLAB + uses: actions/download-artifact@v4 + with: + name: mexa64 + path: artifacts/linux + + - name: Stage the Linux MEX + shell: bash + run: cp artifacts/linux/cmarkmd2html.mexa64 tbx/docmaker/+docmaker/ + + - name: Set up MATLAB + uses: matlab-actions/setup-matlab@v3 + with: + products: MATLAB + release: ${{ matrix.matlab-version }} + + - name: Run the compatibility suite + uses: matlab-actions/run-command@v3 + with: + command: >- + openProject(pwd); + results = runtests('tests'); + assertSuccess(results) + + check-tag: + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} + runs-on: ubuntu-24.04 + steps: + - name: Check out the repository history + uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: false + + - name: Verify the tag points to a commit on master + shell: bash + env: + TAG_REF: ${{ github.ref }} + run: | + tag_name="${TAG_REF#refs/tags/}" + if [[ ! "$tag_name" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then + echo "Release tag $TAG_REF must match vMAJOR.MINOR.PATCH without prerelease or build metadata." + exit 1 + fi + + git fetch --no-tags origin master + tag_commit="$(git rev-parse "${TAG_REF}^{commit}")" + if ! git merge-base --is-ancestor "$tag_commit" FETCH_HEAD; then + echo "Release tag $TAG_REF does not point to a commit reachable from master." + exit 1 + fi + + mex: + needs: check-tag + if: >- + ${{ + always() && + ((github.event_name == 'workflow_dispatch' && + (inputs.mode == 'package' || inputs.mode == 'draft')) || + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && + needs.check-tag.result == 'success')) + }} + strategy: + fail-fast: false + matrix: + include: + - platform: windows + runner: windows-latest + release: latest + extension: mexw64 + architecture: skip + - platform: macos-intel + runner: macos-15-intel + release: R2025b + extension: mexmaci64 + architecture: x86_64 + - platform: macos-arm64 + runner: macos-15 + release: latest + extension: mexmaca64 + architecture: arm64 + uses: ./.github/workflows/build-mex.yml + with: + runner: ${{ matrix.runner }} + release: ${{ matrix.release }} + mex_extension: ${{ matrix.extension }} + architecture: ${{ matrix.architecture }} + run_tests: true + + package: + needs: [check-tag, mex] + if: >- + ${{ + always() && + ((github.event_name == 'workflow_dispatch' && + (inputs.mode == 'package' || inputs.mode == 'draft')) || + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && + needs.check-tag.result == 'success' && + needs.mex.result == 'success')) + }} + runs-on: ubuntu-24.04 + steps: + - name: Check out the selected source and submodules + uses: actions/checkout@v6 + with: + submodules: recursive + + - name: Download the Windows and Mac MEX files + uses: actions/download-artifact@v4 + with: + pattern: mex* + path: artifacts/platforms + merge-multiple: true + + - name: Stage the non-Linux MEX files + shell: bash + run: | + cp artifacts/platforms/cmarkmd2html.mexw64 tbx/docmaker/+docmaker/ + cp artifacts/platforms/cmarkmd2html.mexmaci64 tbx/docmaker/+docmaker/ + cp artifacts/platforms/cmarkmd2html.mexmaca64 tbx/docmaker/+docmaker/ + + - name: Set up MATLAB + uses: matlab-actions/setup-matlab@v3 + with: + products: MATLAB + release: latest + + - name: Configure the C compiler + uses: matlab-actions/run-command@v3 + with: + command: mex -setup C + + - name: Build and package the toolbox + uses: matlab-actions/run-command@v3 + with: + command: openProject(pwd); buildtool('package') + + - name: Verify the package contains all platform MEX files + shell: bash + run: | + if [[ "$GITHUB_REF" == refs/tags/v* ]]; then + toolbox="releases/MATLAB_DocMaker.mltbx" + else + toolbox="$(find releases -maxdepth 1 -name '*.mltbx' -print -quit)" + fi + test -n "$toolbox" && test -f "$toolbox" + for mex in cmarkmd2html.mexw64 cmarkmd2html.mexa64 cmarkmd2html.mexmaca64 cmarkmd2html.mexmaci64; do + if ! unzip -Z1 "$toolbox" | awk -F/ -v file="$mex" '$NF == file { found = 1 } END { exit !found }'; then + echo "Missing $mex in $toolbox" + exit 1 + fi + done + + - name: Upload the toolbox artifact + uses: actions/upload-artifact@v4 + with: + name: mltbx + path: releases/*.mltbx + if-no-files-found: error + retention-days: 14 + + draft: + needs: package + if: >- + ${{ + github.event_name == 'workflow_dispatch' && + inputs.mode == 'draft' && + needs.package.result == 'success' + }} + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - name: Check out the selected source and release notes + uses: actions/checkout@v6 + with: + ref: ${{ github.sha }} + submodules: false + + - name: Download the toolbox package + uses: actions/download-artifact@v4 + with: + name: mltbx + path: release-assets + + - name: Extract the toolbox version + shell: pwsh + run: | + $contents = Get-Content tbx/docmaker/Contents.m -Raw + if ($contents -notmatch '(?m)^% Version (\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)\b') { + throw "Unable to read the toolbox version from Contents.m." + } + $version = $Matches[1] + $releaseNotesVersion = $version -replace '[-+].*$', '' + $tag = "v$version" + [IO.File]::AppendAllText($env:GITHUB_ENV, "TOOLBOX_VERSION=$version`nRELEASE_NOTES_VERSION=$releaseNotesVersion`nRELEASE_TAG=$tag`n", [Text.UTF8Encoding]::new($false)) + + - name: Extract release notes + shell: pwsh + run: | + $lines = Get-Content tbx/docmakerdoc/changelog.md + $heading = "## Version $env:RELEASE_NOTES_VERSION" + $start = [Array]::IndexOf($lines, $heading) + if ($start -lt 0) { throw "Release notes for $env:RELEASE_NOTES_VERSION were not found." } + $end = $start + 1 + while ($end -lt $lines.Length -and -not $lines[$end].StartsWith('## ')) { $end++ } + $notes = $lines[($start + 1)..($end - 1)] -join "`n" + $delimiter = "EOF_$([guid]::NewGuid().ToString('N'))" + $content = "RELEASE_NOTES<<$delimiter`n$notes`n$delimiter`n" + [IO.File]::AppendAllText($env:GITHUB_ENV, $content, [Text.UTF8Encoding]::new($false)) + + - name: Create a GitHub draft release + uses: softprops/action-gh-release@v3 + with: + name: MATLAB DocMaker ${{ env.TOOLBOX_VERSION }} + tag_name: ${{ env.RELEASE_TAG }} + target_commitish: ${{ github.sha }} + body: ${{ env.RELEASE_NOTES }} + draft: true + make_latest: false + files: release-assets/*.mltbx + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish: + needs: [check-tag, package] + if: >- + ${{ + github.event_name == 'push' && + startsWith(github.ref, 'refs/tags/v') && + needs.check-tag.result == 'success' && + needs.package.result == 'success' + }} + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - name: Check out the release notes + uses: actions/checkout@v6 + with: + submodules: false + + - name: Download the toolbox package + uses: actions/download-artifact@v4 + with: + name: mltbx + path: release-assets + + - name: Extract the version from the tag + shell: pwsh + run: | + $version = $env:GITHUB_REF_NAME.TrimStart('v') + $releaseNotesVersion = $version -replace '[-+].*$', '' + [IO.File]::AppendAllText($env:GITHUB_ENV, "TOOLBOX_VERSION=$version`nRELEASE_NOTES_VERSION=$releaseNotesVersion`n", [Text.UTF8Encoding]::new($false)) + + - name: Extract release notes + shell: pwsh + run: | + $lines = Get-Content tbx/docmakerdoc/changelog.md + $heading = "## Version $env:RELEASE_NOTES_VERSION" + $start = [Array]::IndexOf($lines, $heading) + if ($start -lt 0) { throw "Release notes for $env:RELEASE_NOTES_VERSION were not found." } + $end = $start + 1 + while ($end -lt $lines.Length -and -not $lines[$end].StartsWith('## ')) { $end++ } + $notes = $lines[($start + 1)..($end - 1)] -join "`n" + $delimiter = "EOF_$([guid]::NewGuid().ToString('N'))" + $content = "RELEASE_NOTES<<$delimiter`n$notes`n$delimiter`n" + [IO.File]::AppendAllText($env:GITHUB_ENV, $content, [Text.UTF8Encoding]::new($false)) + + - name: Publish the GitHub Release + uses: softprops/action-gh-release@v3 + with: + name: MATLAB DocMaker ${{ env.TOOLBOX_VERSION }} + tag_name: ${{ github.ref_name }} + body: ${{ env.RELEASE_NOTES }} + draft: false + make_latest: true + files: release-assets/MATLAB_DocMaker.mltbx + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 76991e0..60cbada 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,7 @@ tbx/docmakerdoc/info.xml tbx/docmakerdoc/custom_toolbox.json tbx/docmakerdoc/resources tbx/docmakerdoc/helpsearch-v* -releases/*.mltbx \ No newline at end of file +releases/*.mltbx +build/ +*.mex* +tbx/docmaker/+docmaker/*.rights diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..42c570d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "ext/cmark-gfm"] + path = ext/cmark-gfm + url = https://github.com/github/cmark-gfm.git +[submodule "ext/gemoji"] + path = ext/gemoji + url = https://github.com/github/gemoji.git diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d7fe4cd..72c95d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,17 +1,17 @@ # Contributing ->_If you believe you have discovered a security vulnerability, please **do not** open an issue or make a pull request. Follow the instructions in the [SECURITY.MD](SECURITY.MD) file in this repository._ +>_If you believe you have discovered a security vulnerability, please **do not** open an issue or make a pull request. Follow the instructions in the [SECURITY.MD](SECURITY.MD) file in this repository._ -Thank you for your interest in contributing to a MathWorks repository! We encourage contributions large and small to this repository. +Thank you for your interest in contributing to a MathWorks repository! We encourage contributions large and small to this repository. -**Contributions do not have to be code!** If you see a way to explain things more clearly or a great example of how to use something, please contribute it (or a link to your content). We welcome issues even if you don't code the solution. We also welcome pull requests to resolve issues that we haven't gotten to yet! +**Contributions do not have to be code!** If you see a way to explain things more clearly or a great example of how to use something, please contribute it (or a link to your content). We welcome issues even if you don't code the solution. We also welcome pull requests to resolve issues that we haven't gotten to yet! ## How to contribute -* **Open an issue:** Start by [creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) in the repository that you're interested in. That will start a conversation with the maintainer. When you are creating a bug report, please include as many details as possible. Please remember that other people do not have your background or understanding of the issue; make sure you are clear and complete in your description. -* **Work in your own public fork:** If you choose to make a contribution, you should [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo). This creates an editable copy on GitHub where you can write, test, and refine your changes. We suggest that you keep your changes small and focused on the issue you submitted. -* **Sign a Contributor License Agreement (CLA):** We require that all outside contributors sign a [CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement) before we can accept your contribution. When you create a pull request (see below), we'll reach out to you if you do not already have one on file. Essentially, the CLA gives us permission to publish your contribution as part of the repository. -* **Make a pull request:** "[Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)" is a confusing term, but it means exactly what it says: You're requesting that the maintainers of the repository pull your changes in. If you don't have a CLA on file, we'll reach out to you. Your contribution will be reviewed, and we may ask you to revise your pull request based on our feedback. Once everyone is satisfied, we'll merge your pull request into the repository. +* **Open an issue:** Start by [creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) in the repository that you're interested in. That will start a conversation with the maintainer. When you are creating a bug report, please include as many details as possible. Please remember that other people do not have your background or understanding of the issue; make sure you are clear and complete in your description. +* **Work in your own public fork:** If you choose to make a contribution, you should [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo). This creates an editable copy on GitHub where you can write, test, and refine your changes. We suggest that you keep your changes small and focused on the issue you submitted. +* **Sign a Contributor License Agreement (CLA):** We require that all outside contributors sign a [CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement) before we can accept your contribution. When you create a pull request (see below), we'll reach out to you if you do not already have one on file. Essentially, the CLA gives us permission to publish your contribution as part of the repository. +* **Make a pull request:** "[Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-pull-requests/about-pull-requests)" is a confusing term, but it means exactly what it says: You're requesting that the maintainers of the repository pull your changes in. If you don't have a CLA on file, we'll reach out to you. Your contribution will be reviewed, and we may ask you to revise your pull request based on our feedback. Once everyone is satisfied, we'll merge your pull request into the repository. ## Repository structure @@ -23,12 +23,12 @@ There are no tests *per se*, but DocMaker generates its own documentation, which ## Guidelines -We support MATLAB versions from R2021a. Do not use features that require later versions of MATLAB. +We support MATLAB versions from R2021a. Do not use features that require later versions of MATLAB. We don't have best practices for writing MATLAB code, but we do have some recommendations: * You should not have any warnings or errors in the [code analyzer report](http://www.mathworks.com/help/matlab/matlab_prog/matlab-code-analyzer-report.html) * [Loren Shure's blog](https://blogs.mathworks.com/loren) has [great advice on improving your MATLAB code](https://blogs.mathworks.com/loren/category/best-practice/) -* We adhere to the [CommonMark](https://commonmark.org/) specification where it does not conflict with GitHub rendering. If you edit your Markdown in Visual Studio Code or a similar editor, it uses [markdownlint](https://github.com/DavidAnson/markdownlint) to highlight issues in your Markdown. +* We adhere to the [CommonMark](https://commonmark.org/) specification where it does not conflict with GitHub rendering. If you edit your Markdown in Visual Studio Code or a similar editor, it uses [markdownlint](https://github.com/DavidAnson/markdownlint) to highlight issues in your Markdown. -**Again, thanks for contributing, and we look forward to your issues and pull requests!** \ No newline at end of file +**Again, thanks for contributing, and we look forward to your issues and pull requests!** diff --git a/LICENSE b/LICENSE index 0051e60..52920b8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,27 +1,28 @@ -Copyright (c) 2024, The MathWorks, Inc. -All rights reserved. +Copyright 2024-2026 The MathWorks, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the distribution - * Neither the name of the The MathWorks, Inc. nor the names - of its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS +IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 1de8916..9881752 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MATLAB® DocMaker :hatching_chick: -[![MATLAB DocMaker Actions](https://github.com/mathworks/docmaker/actions/workflows/docmaker-ci.yml/badge.svg)](https://github.com/mathworks/docmaker/actions/workflows/docmaker-ci.yml) +[![MATLAB DocMaker CI](https://github.com/mathworks/docmaker/actions/workflows/docmaker-ci.yml/badge.svg)](https://github.com/mathworks/docmaker/actions/workflows/docmaker-ci.yml) DocMaker is a tool for generating MATLAB toolbox documentation. @@ -9,7 +9,9 @@ With DocMaker, you can: * run MATLAB code blocks in documents and include textual and graphical output * create MATLAB documentation index files from a Markdown table of contents -DocMaker requires MATLAB R2021a or later to *generate* documentation. Documentation generated by DocMaker can be *viewed* in much older releases of MATLAB, and offline. +DocMaker requires MATLAB R2021a or later. Documentation generated by DocMaker can be *viewed* in much older releases of MATLAB, and offline. + +DocMaker's default `cmark` Markdown converter uses a MEX wrapper around cmark-gfm. It supports GitHub-Flavored Markdown tables, strikethrough, autolinks, and task lists. Emoji shortcodes such as `:smile:` are expanded using the gemoji database before parsing. Conversion runs locally without network access; shortcodes are left unchanged in code spans and blocks, HTML tags, link destinations, and escaped forms. `docconvert`, `docindex`, and `DocMakerTask` also accept `Converter="github"` or `Converter="gitlab"` to use a hosted Markdown API, which sends Markdown to the service and requires network access. GitLab conversion requires a personal access token; see [Markdown conversion](./tbx/docmakerdoc/conversion.md). ## User documentation @@ -23,21 +25,57 @@ DocMaker ships with documentation that you can [browse online](./tbx/docmakerdoc The repository contains a top-level [MATLAB project](https://www.mathworks.com/help/matlab/projects.html). -Development requires the [MATLAB Build Tool](https://www.mathworks.com/help/matlab/matlab_prog/overview-of-matlab-build-tool.html) which was introduced in MATLAB R2022b. Tasks are provided to: +Development requires MATLAB R2022b or later for the [MATLAB Build Tool](https://www.mathworks.com/help/matlab/matlab_prog/overview-of-matlab-build-tool.html), and a MATLAB-supported C compiler for building the MEX. Configure the compiler in MATLAB with `mex -setup C`. + +Tasks are provided to: -* `check`: identify code issues +* `check`: check code issues and project configuration +* `mex`: generate cmark-gfm version and emoji sources, then compile the MEX for the current MATLAB platform * `test`: run unit tests * `doc`: generate documentation * `package`: package as a MATLAB Toolbox file (`.mltbx`) * `clean`: delete derived artifacts -Finally, configure [Markdown conversion](./tbx/docmakerdoc/conversion.md) by generating an access token on `github.com` and registering the token with MATLAB. +### Build and test the local converter + +The repository pins cmark-gfm and gemoji as Git submodules. Initialize them from the repository root before building: + +```sh +git submodule update --init --recursive +``` + +From the repository root in MATLAB, open the project and build the MEX with: + +```matlab +buildtool mex +``` + +The `mex` task generates `build/cmark-gfm/cmark-gfm_version.h` and `build/cmark-gfm/emoji_map.c`, then compiles the cmark-gfm sources directly into `tbx/docmaker/+docmaker/cmarkmd2html.`. A separately installed cmark-gfm library is not required. + +Run the full check and test workflow with: + +```matlab +buildtool clean +buildtool test +``` + +The `test` task runs `check` and `mex` first. The `clean` task removes the generated source files and compiled MEX; they are disposable build outputs. + +### Continuous integration + +The `docmaker-ci.yml` workflow runs `test-mini` on Ubuntu 24.04 for pull requests not targeting `master` and pushes to `master`. Pull requests targeting `master` run `test-full`: native MEX tests on Linux, Windows, and both Mac architectures, plus Linux compatibility tests on older MATLAB releases. Intel Mac uses R2025b; the other platforms use the latest MATLAB release. Compatibility jobs select the newest supported Ubuntu LTS per MATLAB release where GitHub-hosted runners are available; R2021a uses Ubuntu 22.04 best-effort because its officially supported Ubuntu 20.04 runner is no longer hosted by GitHub. + +Published release tags must match `vMAJOR.MINOR.PATCH` exactly and point to a commit reachable from `master`. CI builds and tests the Windows and Mac MEX files, stages them on Linux, builds the toolbox with `buildtool('package')`, verifies that all four platform MEX files are included, and publishes the MLTBX as a GitHub Release. Manual drafts also support SemVer prerelease and build versions: their tag and title keep the full version, while release notes come from the matching `MAJOR.MINOR.PATCH` changelog section. + +The Actions UI can run `docmaker-ci.yml` manually in `test-mini`, `test-full`, `package`, or `draft` mode on a selected ref. `draft` builds the toolbox and creates a GitHub draft release using the version in `tbx/docmaker/Contents.m`, without the tag ancestry check or File Exchange publishing. The workflow must first be merged to `master` to appear in the UI. Manually built toolboxes are uploaded as workflow artifacts. See [.github/workflows/docmaker-ci.md](.github/workflows/docmaker-ci.md) for details. + +The submodule commits are pinned by the parent repository. When updating a dependency, select an explicit upstream release, rebuild and test, then review the submodule changes. Keep project integration code in `src`; do not edit files inside `ext/cmark-gfm` or `ext/gemoji`. ## About DocMaker is developed by [David Sampson](https://www.mathworks.com/matlabcentral/profile/authors/16247) from [MathWorks](https://www.mathworks.com/services/consulting.html) on [GitHub](https://github.com/mathworks/docmaker). -DocMaker uses the [GitHub Markdown API](https://docs.github.com/en/rest/markdown) or the [GitLab Markdown API](https://docs.gitlab.com/api/markdown/) for converting Markdown to HTML, and the [GitHub Markdown CSS](https://github.com/sindresorhus/github-markdown-css) by [Sindre Sorhus](https://github.com/sindresorhus) for HTML styling. +DocMaker converts Markdown to HTML using [cmark-gfm](https://github.com/github/cmark-gfm), [gemoji](https://github.com/github/gemoji), and [GitHub Markdown CSS](https://github.com/sindresorhus/github-markdown-css). The author thanks [Ken Deeley](https://www.mathworks.com/matlabcentral/profile/authors/2987674) from MathWorks for his support during the development of DocMaker. diff --git a/SECURITY.md b/SECURITY.md index 221952e..41ac10d 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,6 +1,3 @@ # Reporting Security Vulnerabilities -If you believe you have discovered a security vulnerability, please report it to -[security@mathworks.com](mailto:security@mathworks.com). Please see -[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html) -for additional information. \ No newline at end of file +If you believe you have discovered a security vulnerability, please report it to [security@mathworks.com](mailto:security@mathworks.com). Please see [MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html) for additional information. diff --git a/buildfile.m b/buildfile.m index 40119a6..44109fe 100644 --- a/buildfile.m +++ b/buildfile.m @@ -15,23 +15,65 @@ % Clean task plan("clean") = matlab.buildtool.tasks.CleanTask; +plan("clean").Description = "Remove generated build artifacts"; % Check task +plan("check").Description = "Check code quality and project configuration"; plan("check").Inputs = api; +% MEX task +sourceDir = fullfile( prj, "src" ); +extDir = fullfile( prj, "ext" ); +cmarkDir = fullfile( extDir, "cmark-gfm" ); +gemojiDir = fullfile( extDir, "gemoji" ); +genDir = fullfile( prj, "build", "cmark-gfm" ); +mexDir = fullfile( api, "+docmaker" ); +mexFile = fullfile( mexDir, "cmarkmd2html." + mexext() ); +rightsInputs = [ ... + fullfile( cmarkDir, "COPYING" ) + fullfile( gemojiDir, "LICENSE" ) ]; +rightsFiles = [ ... + fullfile( mexDir, "cmark-gfm.rights" ) + fullfile( mexDir, "gemoji.rights" ) ]; +genFiles = [ ... + fullfile( genDir, "cmark-gfm_version.h" ) + fullfile( genDir, "emoji_map.c" ) ]; +mexSourceFiles = cmarkSourceFiles( cmarkDir, sourceDir, genDir ); +genEmojiMap = fullfile( genDir, "emoji_map.c" ); +mexInputs = [ ... + mexSourceFiles(mexSourceFiles ~= genEmojiMap) + filesIn( fullfile( cmarkDir, "src" ), "*.h" ) + filesIn( fullfile( cmarkDir, "extensions" ), "*.h" ) + filesIn( sourceDir, "*.h" ) + fullfile( prj, "buildfile.m" ) + fullfile( cmarkDir, "CMakeLists.txt" ) + fullfile( cmarkDir, "src", "cmark-gfm_version.h.in" ) + rightsInputs + fullfile( gemojiDir, "db", "emoji.json" ) + fullfile( sourceDir, "emoji_map.c.in" ) ]; +mexInputs = mexInputs(isfile(mexInputs)); +plan("mex").Description = ... + "Generate and build the cmark-gfm MEX"; +plan("mex").Inputs = mexInputs; +plan("mex").Outputs = [genFiles; mexFile; rightsFiles]; + % Test task plan("test") = matlab.buildtool.tasks.TestTask( test, ... "SourceFiles", tbx, "Strict", true ); +plan("test").Description = "Run the toolbox test suite"; plan("test").Inputs = [api test]; -plan("test").Dependencies = "check"; +plan("test").Dependencies = ["check", "mex"]; % Documentation task plan("doc") = DocMakerTask( fullfile( doc, "**", "*.md" ), ... "Theme", "light", ... "FigureSize", [600, 400], ... "FigureTheme", "light" ); +plan("doc").Description = "Build toolbox documentation"; +plan("doc").Dependencies = "mex"; % Package task +plan("package").Description = "Package the toolbox as an MLTBX"; plan("package").Inputs = tbx; plan("package").Dependencies = ["test", "doc"]; @@ -41,7 +83,11 @@ end % buildfile function n = tbxname() -%tbxname Toolbox name +%tbxname Return the toolbox name +% +% n = tbxname() returns the toolbox name as a string. +% +% See also: packageTask, ver n = "docmaker"; @@ -60,7 +106,7 @@ function checkTask( c ) % Check project p = currentProject(); -p.updateDependencies() +p.refreshSourceControl() % refresh status for project checks t = table( p.runChecks() ); ok = t.Passed; if any( ~ok ) @@ -72,7 +118,41 @@ function checkTask( c ) end % checkTask -function packageTask( ~ ) +function mexTask( ~ ) +% Build cmark-gfm and its generated emoji lookup table + +root = fileparts( mfilename( "fullpath" ) ); +sourceDir = fullfile( root, "src" ); +extDir = fullfile( root, "ext" ); +cmarkDir = fullfile( extDir, "cmark-gfm" ); +gemojiDir = fullfile( extDir, "gemoji" ); +genDir = fullfile( root, "build", "cmark-gfm" ); +mexDir = fullfile( root, "tbx", "docmaker", "+docmaker" ); + +generateSources( root ); + +sourceFiles = cmarkSourceFiles( cmarkDir, sourceDir, genDir ); +options = [ ... + "-R2018a" + "-I" + sourceDir + "-I" + genDir + "-I" + fullfile( cmarkDir, "src" ) + "-I" + fullfile( cmarkDir, "extensions" ) ]; + +mexArgs = [ ... + cellstr(options) + cellstr(sourceFiles) + { "-outdir"; char(mexDir); "-output"; "cmarkmd2html" } ]; +mex( mexArgs{:} ); + +copyfile( fullfile( cmarkDir, "COPYING" ), ... + fullfile( mexDir, "cmark-gfm.rights" ) ); +copyfile( fullfile( gemojiDir, "LICENSE" ), ... + fullfile( mexDir, "gemoji.rights" ) ); + +end % mexTask + +function packageTask( c ) % Package toolbox % Load and tweak metadata @@ -83,7 +163,8 @@ function packageTask( ~ ) s.ToolboxName = v.Name; s.ToolboxVersion = v.Version; -if getenv( "GITHUB_ACTIONS" ) == "true" +if getenv( "GITHUB_ACTIONS" ) == "true" && ... + startsWith( getenv( "GITHUB_REF" ), "refs/tags/v" ) % Check version and tag compatibility for release ref = string( getenv( "GITHUB_REF" ) ); gitTagNumber = extractAfter( ref, "refs/tags/v" ); @@ -109,12 +190,254 @@ function packageTask( ~ ) o = matlab.addons.toolbox.ToolboxOptions( f, id, pv{:} ); o.ToolboxVersion = string( o.ToolboxVersion ); % g3079185 +% Add license (modern versions) +mpj = ~isMATLABReleaseOlderThan( "R2026b" ); % version uses mpackage.json +if mpj, o.UseLicenseBSD = true; end + % Package matlab.addons.toolbox.packageToolbox( o ) fprintf( 1, "[+] %s\n", o.OutputFile ); -% Add license -lic = fileread( "LICENSE" ); -mlAddonSetLicense( char( o.OutputFile ), struct( "type", 'BSD', "text", lic ) ); +% Add license (earlier versions) +if ~mpj + lic = fileread( fullfile( c.Plan.RootFolder, "LICENSE" ) ); + mlAddonSetLicense( char( o.OutputFile ), struct( "type", 'BSD', "text", lic ) ); +end + +end % packageTask + +function files = cmarkSourceFiles( cmarkDir, sourceDir, genDir ) +%cmarkSourceFiles List cmark-gfm files for MEX compilation +% +% files = cmarkSourceFiles(cmarkDir,sourceDir,genDir) returns the C +% source files used to compile the cmark-gfm MEX, including the +% generated emoji map in genDir. +% +% See also: mexTask, generateSources + +srcNames = [ ... + "cmark.c"; "node.c"; "iterator.c"; "blocks.c"; "inlines.c"; ... + "scanners.c"; "utf8.c"; "buffer.c"; "references.c"; "footnotes.c"; ... + "map.c"; "render.c"; "man.c"; "xml.c"; "html.c"; "commonmark.c"; ... + "plaintext.c"; "latex.c"; "houdini_href_e.c"; "houdini_html_e.c"; ... + "houdini_html_u.c"; "cmark_ctype.c"; "arena.c"; "linked_list.c"; ... + "syntax_extension.c"; "registry.c"; "plugin.c" ]; +extensionNames = [ ... + "core-extensions.c"; "table.c"; "strikethrough.c"; "autolink.c"; ... + "tagfilter.c"; "ext_scanners.c"; "tasklist.c" ]; + +files = [ ... + fullfile( cmarkDir, "src", srcNames ) + fullfile( cmarkDir, "extensions", extensionNames ) + fullfile( sourceDir, "emoji.c" ) + fullfile( sourceDir, "cmark-gfm_mex.c" ) + fullfile( genDir, "emoji_map.c" ) ]; + +end % cmarkSourceFiles + +function generateSources( root ) +%generateSources Generate cmark-gfm headers and emoji map +% +% generateSources(root) creates the cmark-gfm version header and emoji +% map under root/build/cmark-gfm. +% +% root must contain initialized cmark-gfm and gemoji submodules. +% +% See also: read_cmark_version, write_cmark_version, write_emoji_map + +cmarkDir = fullfile( root, "ext", "cmark-gfm" ); +gemojiDir = fullfile( root, "ext", "gemoji" ); +cmarkCMakeFile = fullfile( cmarkDir, "CMakeLists.txt" ); +cmarkVersionTemplate = fullfile( cmarkDir, "src", "cmark-gfm_version.h.in" ); +emojiJsonFile = fullfile( gemojiDir, "db", "emoji.json" ); +genDir = fullfile( root, "build", "cmark-gfm" ); + +missingSubmodules = strings( 0, 1 ); +if ~isfile( cmarkCMakeFile ) || ~isfile( cmarkVersionTemplate ) + missingSubmodules(end + 1, 1) = "ext/cmark-gfm"; +end +if ~isfile( emojiJsonFile ) + missingSubmodules(end + 1, 1) = "ext/gemoji"; +end +if ~isempty( missingSubmodules ) + error( "cmark_gfm:MissingSubmodule", ... + "Missing or uninitialized submodule content: %s. Run " + ... + "git submodule update --init --recursive before building.", ... + strjoin( missingSubmodules, ", " ) ) +end +if ~isfolder( genDir ) + mkdir( genDir ); +end + +version = read_cmark_version( cmarkCMakeFile ); +write_cmark_version( ... + cmarkVersionTemplate, version, ... + fullfile( genDir, "cmark-gfm_version.h" ) ); +write_emoji_map( ... + fullfile( root, "src", "emoji_map.c.in" ), emojiJsonFile, ... + fullfile( genDir, "emoji_map.c" ) ); + +end % generateSources + +function version = read_cmark_version( file ) +%read_cmark_version Read cmark-gfm version metadata +% +% version = read_cmark_version(file) reads the major, minor, patch, +% and GFM version values from the specified CMakeLists.txt file. +% +% See also: generateSources, write_cmark_version + +text = fileread( file ); +names = ["major", "minor", "patch", "gfm"]; +version = struct; +for name = names + expression = sprintf( "set\\(PROJECT_VERSION_%s\\s+(\\d+)\\)", ... + upper( name ) ); + token = regexp( text, expression, "tokens", "once" ); + if isempty( token ) + error( "cmark_gfm:VersionMetadata", ... + "Unable to find PROJECT_VERSION_%s in %s.", upper( name ), file ); + end + version.(name) = str2double( token{1} ); +end + +end % read_cmark_version + +function write_cmark_version( template, version, output ) +%write_cmark_version Write the cmark-gfm version header +% +% write_cmark_version(template,version,output) fills the version +% template and writes the generated header to output. +% +% version is a struct containing fields major, minor, patch, and gfm. +% +% See also: read_cmark_version, write_text + +headerText = fileread( template ); +names = ["major", "minor", "patch", "gfm"]; +for name = names + token = "@PROJECT_VERSION_" + upper( name ) + "@"; + value = sprintf( "%d", version.(name) ); + headerText = strrep( headerText, char( token ), value ); +end +write_text( output, headerText ); + +end % write_cmark_version + +function files = filesIn( folder, pattern ) +%filesIn List folder entries matching a pattern +% +% files = filesIn(folder,pattern) returns matching paths as a +% string array. +% +% See also: dir, fullfile + +listing = dir( fullfile( folder, pattern ) ); +files = fullfile( string( {listing.folder} ), string( {listing.name} ) )'; + +end % filesIn + +function write_text( file, text ) +%write_text Write text to a file +% +% write_text(file,text) writes text to the specified file without +% adding a newline. +% +% See also: fopen, fclose + +fileId = fopen( file, "w" ); +if fileId < 0 + error( "cmark_gfm:GeneratedHeader", "Unable to create %s.", file ); +end +cleanup = onCleanup( @() fclose( fileId ) ); +fprintf( fileId, "%s", text ); + +end % write_text + +function write_emoji_map( template, jsonFile, output ) +%write_emoji_map Generate C source for the emoji lookup table +% +% write_emoji_map(template,jsonFile,output) reads emoji aliases from +% jsonFile, inserts C-escaped entries into template, and writes the +% generated source to output. +% +% See also: read_utf8_text, c_string, c_utf8_string, write_text + +entries = jsondecode( read_utf8_text( jsonFile ) ); +aliases = strings( 0, 1 ); +emojis = strings( 0, 1 ); + +for entry = entries' + for alias = entry{1}.aliases + aliases(end + 1, 1) = string( alias{1} ); %#ok + emojis(end + 1, 1) = string( entry{1}.emoji ); %#ok + end +end + +[aliases, order] = sort( aliases ); +emojis = emojis(order); +[aliases, uniqueIndices] = unique( aliases, "stable" ); +emojis = emojis(uniqueIndices); + +entryLines = cell( numel( aliases ), 1 ); +for index = 1:numel( aliases ) + entryLines{index} = sprintf( ' {"%s", "%s"},', ... + c_string( aliases(index) ), c_utf8_string( emojis(index) ) ); +end + +templateText = fileread( template ); +placeholder = "@EMOJI_ENTRIES@"; +if numel( strfind( templateText, placeholder ) ) ~= 1 + error( "cmark_gfm:EmojiTemplate", ... + "Expected exactly one %s placeholder in %s.", ... + placeholder, template ); +end +sourceText = strrep( templateText, placeholder, ... + strjoin( entryLines, newline() ) ); + +write_text( output, sourceText ); + +end % write_emoji_map + +function text = read_utf8_text( file ) +%read_utf8_text Read and decode UTF-8 text from a file +% +% text = read_utf8_text(file) reads file as bytes and decodes them as +% UTF-8. +% +% See also: fread, native2unicode + +fileId = fopen( file, "r", "n", "ISO-8859-1" ); +if fileId == -1 + error( "cmark_gfm:EmojiData", "Unable to read emoji data: %s", file ); +end +cleanup = onCleanup( @() fclose( fileId ) ); +bytes = fread( fileId, "*uint8" )'; +text = native2unicode( bytes, "UTF-8" ); + +end % read_utf8_text + +function text = c_string( value ) +%c_string Escape text for a C string literal +% +% text = c_string(value) escapes backslashes and double quotes. +% +% See also: c_utf8_string, write_emoji_map + +text = char( value ); +text = strrep( text, '\', '\\' ); +text = strrep( text, '"', '\"' ); + +end % c_string + +function text = c_utf8_string( value ) +%c_utf8_string Encode text as C UTF-8 escape sequences +% +% text = c_utf8_string(value) returns UTF-8 bytes as \xNN escapes. +% +% See also: c_string, write_emoji_map + +bytes = unicode2native( char( value ), "UTF-8" ); +text = char( strjoin( compose( "\\x%02X", bytes ), "" ) ); -end % packageTask \ No newline at end of file +end % c_utf8_string diff --git a/demo/.gitignore b/demo/.gitignore index 16c2078..697f92a 100644 --- a/demo/.gitignore +++ b/demo/.gitignore @@ -5,4 +5,4 @@ helptoc.xml info.xml custom_toolbox.json resources -helpsearch-v* \ No newline at end of file +helpsearch-v* diff --git a/demo/Grid.md b/demo/Grid.md index 681fcdc..a80bf63 100644 --- a/demo/Grid.md +++ b/demo/Grid.md @@ -10,9 +10,9 @@ The number of rows and columns are *dynamic* with the number of contents: * Changing the number of rows may change the number of columns, and vice versa. * Adding and removing contents may increase and decrease the number of columns. -Contents are laid out dynamically, top-to-bottom then left-to-right. To interleave empty space, use [`uix.Empty`](Empty.md). +Contents are laid out dynamically, top-to-bottom then left-to-right. To interleave empty space, use [`uix.Empty`](Empty.md). -Row heights and column widths can be fixed or variable, with minima. Variable-sized rows and columns fill available container space, subject to minima, according to specified weights. +Row heights and column widths can be fixed or variable, with minima. Variable-sized rows and columns fill available container space, subject to minima, according to specified weights. `uix.GridFlex` extends `uix.Grid`, adding draggable dividers between the rows and columns. @@ -71,4 +71,4 @@ set(g,'Widths',[-1 100 -2],'Heights',[-1 100]) [:house:](index.md) | :arrow_right: [HBox](hbox.md) | :arrow_down: [VBox](vbox.md) | :symbols: [Grid](grid.md) | :card_index: [CardPanel](CardPanel.md) | :point_right: [TabPanel](TabPanel.md) | :scroll: [ScrollingPanel](ScrollingPanel.md) | :white_square_button: [BoxPanel](BoxPanel.md) | :vertical_traffic_light: [VButtonBox](VButtonBox.md) | :traffic_light: [HButtonBox](VButtonBox.md) -:copyright: 2009-2024 [The MathWorks, Inc.](https://www.mathworks.com/services/consulting.html) \ No newline at end of file +:copyright: 2009-2024 [The MathWorks, Inc.](https://www.mathworks.com/services/consulting.html) diff --git a/demo/TabPanel.md b/demo/TabPanel.md index 792cdaf..1627feb 100644 --- a/demo/TabPanel.md +++ b/demo/TabPanel.md @@ -10,9 +10,9 @@ The number of rows and columns are *dynamic* with the number of contents: * Changing the number of rows may change the number of columns, and vice versa. * Adding and removing contents may increase and decrease the number of columns. -Contents are laid out dynamically, top-to-bottom then left-to-right. To interleave empty space, use [`uix.Empty`](Empty.md). +Contents are laid out dynamically, top-to-bottom then left-to-right. To interleave empty space, use [`uix.Empty`](Empty.md). -Row heights and column widths can be fixed or variable, with minima. Variable-sized rows and columns fill available container space, subject to minima, accoring to specified weights. +Row heights and column widths can be fixed or variable, with minima. Variable-sized rows and columns fill available container space, subject to minima, accoring to specified weights. `uix.GridFlex` extends `uix.Grid`, adding draggable dividers between the rows and columns. @@ -73,4 +73,4 @@ p.Selection = 2; [:house:](index.md) | :arrow_right: [HBox](hbox.md) | :arrow_down: [VBox](vbox.md) | :symbols: [Grid](grid.md) | :card_index: [CardPanel](CardPanel.md) | :point_right: [TabPanel](TabPanel.md) | :scroll: [ScrollingPanel](ScrollingPanel.md) | :white_square_button: [BoxPanel](BoxPanel.md) | :vertical_traffic_light: [VButtonBox](VButtonBox.md) | :traffic_light: [HButtonBox](VButtonBox.md) -:copyright: 2009-2024 [The MathWorks, Inc.](https://www.mathworks.com/services/consulting.html) \ No newline at end of file +:copyright: 2009-2024 [The MathWorks, Inc.](https://www.mathworks.com/services/consulting.html) diff --git a/demo/Workspace.md b/demo/Workspace.md index bac5171..18c2d23 100644 --- a/demo/Workspace.md +++ b/demo/Workspace.md @@ -73,7 +73,7 @@ evalinc(w,"e=a+b*c") ### Loading and saving -There is nothing special about the `.mat` files that `docmaker.Workspace` can load and save. Let's save a `.mat` file from the *base* workspace and load it to a workspace *object*: +There is nothing special about the `.mat` files that `docmaker.Workspace` can load and save. Let's save a `.mat` file from the *base* workspace and load it to a workspace *object*: ```matlab clear @@ -84,4 +84,4 @@ assignin(w,"b",-3,"c","pluto"); % data in workspace load(w,"data.mat") % load from .mat to workspace w delete("data.mat") % clean up -``` \ No newline at end of file +``` diff --git a/demo/elements.md b/demo/elements.md index bf897a7..a133fb1 100644 --- a/demo/elements.md +++ b/demo/elements.md @@ -44,11 +44,11 @@ Nested out of order: s = "vanilla ice cream" ``` -The last example :point_up: behaves differently in MATLAB, which tries to render the ``, and discards the `` within it, but does render the ``. DocMaker first discards the ``, and then matches and discards the `` that spanned the `` boundary. We won't bother trying to address this edge case. +The last example :point_up: behaves differently in MATLAB, which tries to render the ``, and discards the `` within it, but does render the ``. DocMaker first discards the ``, and then matches and discards the `` that spanned the `` boundary. We won't bother trying to address this edge case. ## Tables -Here is a table. The variable names are rendered as `` and this needs to be stripped out. +Here is a table. The variable names are rendered as `` and this needs to be stripped out. ```matlab t = table([1;2;3],["a";"b";"c"],VariableNames=["foo","bar"]) @@ -74,4 +74,4 @@ t = table([1;2;3],["ice";"b";""],VariableNam DocMaker matches the plain text appearance of MATLAB in this case :point_up:. -The end. :hatching_chick: \ No newline at end of file +The end. :hatching_chick: diff --git a/demo/griddemo.m b/demo/griddemo.m index 9d37b89..70047e8 100644 --- a/demo/griddemo.m +++ b/demo/griddemo.m @@ -1,3 +1,5 @@ +% Copyright 2024-2026 The MathWorks, Inc. + f = figure(); g = uix.Grid('Parent',f,'Padding',5,'Spacing',5); uicontrol('Parent',g,'Background','r') @@ -6,4 +8,4 @@ uix.Empty('Parent',g); uicontrol('Parent',g,'Background','c') uicontrol('Parent',g,'Background','y') -set(g,'Widths',[-1 100 -2],'Heights',[-1 100]) \ No newline at end of file +set(g,'Widths',[-1 100 -2],'Heights',[-1 100]) diff --git a/demo/helptoc.md b/demo/helptoc.md index 0fd07a3..40db3bc 100644 --- a/demo/helptoc.md +++ b/demo/helptoc.md @@ -7,4 +7,4 @@ 3. [E](e.md) * [F](f.md) -This table of contents is used to generate [`info.xml`](https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.html) and [`helptoc.xml`](https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.html). \ No newline at end of file +This table of contents is used to generate [`info.xml`](https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.html) and [`helptoc.xml`](https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.html). diff --git a/demo/io.md b/demo/io.md index 8f26f66..8c3d61d 100644 --- a/demo/io.md +++ b/demo/io.md @@ -49,4 +49,4 @@ plot(x,sin(x)) ```matlab why -``` \ No newline at end of file +``` diff --git a/docmaker.json b/docmaker.json index a40dc0a..8931c88 100644 --- a/docmaker.json +++ b/docmaker.json @@ -2,11 +2,11 @@ "Identifier":"ae82d5d2-45be-4fc5-a01b-70d8bb905ca2", "Summary":"Create MATLAB toolbox documentation from Markdown documents and MATLAB scripts", "Description":"With DocMaker, you can:\n* write documentation in Markdown and convert to HTML for viewing in MATLAB\n* run MATLAB scripts and capture output as images for inclusion in documentation\n* create MATLAB documentation index files from a Markdown table of contents", - "AuthorCompany":"MathWorks", + "AuthorCompany":"The MathWorks, Inc.", "AuthorName":"David Sampson", "AuthorEmail":"dsampson@mathworks.com", "ToolboxFolder":"./tbx", "ToolboxMatlabPath": ["./tbx/docmaker", "./tbx/docmakerdoc"], "ToolboxImageFile":"./hatching_chick.png", "MinimumMatlabRelease":"R2021a" -} \ No newline at end of file +} diff --git a/ext/cmark-gfm b/ext/cmark-gfm new file mode 160000 index 0000000..587a12b --- /dev/null +++ b/ext/cmark-gfm @@ -0,0 +1 @@ +Subproject commit 587a12bb54d95ac37241377e6ddc93ea0e45439b diff --git a/ext/gemoji b/ext/gemoji new file mode 160000 index 0000000..5476a66 --- /dev/null +++ b/ext/gemoji @@ -0,0 +1 @@ +Subproject commit 5476a66d2794e0d1551b1f96e449afc72e9f7bec diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/CJ7Mv9uDL9jesiZbnXk0OHGPHbgd.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/0GKrTVTqpjCbq0NZQhnddCIcLUod.xml similarity index 100% rename from resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/CJ7Mv9uDL9jesiZbnXk0OHGPHbgd.xml rename to resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/0GKrTVTqpjCbq0NZQhnddCIcLUod.xml diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zTJqdyqp7yNsOaoi61WgD234bw4p.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/0GKrTVTqpjCbq0NZQhnddCIcLUop.xml similarity index 50% rename from resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zTJqdyqp7yNsOaoi61WgD234bw4p.xml rename to resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/0GKrTVTqpjCbq0NZQhnddCIcLUop.xml index 112a6bf..5f764e4 100644 --- a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zTJqdyqp7yNsOaoi61WgD234bw4p.xml +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/0GKrTVTqpjCbq0NZQhnddCIcLUop.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/Vhexto3DVEbdTHF-VleCw4WeZj0d.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/2TLXeus0B9Zd1VOooKNExpOH9ogd.xml similarity index 100% rename from resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/Vhexto3DVEbdTHF-VleCw4WeZj0d.xml rename to resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/2TLXeus0B9Zd1VOooKNExpOH9ogd.xml diff --git a/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/2TLXeus0B9Zd1VOooKNExpOH9ogp.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/2TLXeus0B9Zd1VOooKNExpOH9ogp.xml new file mode 100644 index 0000000..287a939 --- /dev/null +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/2TLXeus0B9Zd1VOooKNExpOH9ogp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/qYKM9f7GAZMWoNLvZ4-cV0kSqQ4d.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/4FyHV_eQ9x5aGnlDTU4iCv6aPHYd.xml similarity index 100% rename from resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/qYKM9f7GAZMWoNLvZ4-cV0kSqQ4d.xml rename to resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/4FyHV_eQ9x5aGnlDTU4iCv6aPHYd.xml diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/Vhexto3DVEbdTHF-VleCw4WeZj0p.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/4FyHV_eQ9x5aGnlDTU4iCv6aPHYp.xml similarity index 50% rename from resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/Vhexto3DVEbdTHF-VleCw4WeZj0p.xml rename to resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/4FyHV_eQ9x5aGnlDTU4iCv6aPHYp.xml index 1f47b1a..2f2f911 100644 --- a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/Vhexto3DVEbdTHF-VleCw4WeZj0p.xml +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/4FyHV_eQ9x5aGnlDTU4iCv6aPHYp.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/DTFJbpn5p3Xh-gNZ_f06DVZ0XSId.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/DTFJbpn5p3Xh-gNZ_f06DVZ0XSId.xml new file mode 100644 index 0000000..4356a6a --- /dev/null +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/DTFJbpn5p3Xh-gNZ_f06DVZ0XSId.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/DTFJbpn5p3Xh-gNZ_f06DVZ0XSIp.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/DTFJbpn5p3Xh-gNZ_f06DVZ0XSIp.xml new file mode 100644 index 0000000..ce95990 --- /dev/null +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/DTFJbpn5p3Xh-gNZ_f06DVZ0XSIp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zIfMZrfhDzPKJkl-pwpYI0_25Ycd.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/hZRavFkhai1tqnAQLLVBytrBlMQd.xml similarity index 100% rename from resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zIfMZrfhDzPKJkl-pwpYI0_25Ycd.xml rename to resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/hZRavFkhai1tqnAQLLVBytrBlMQd.xml diff --git a/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/hZRavFkhai1tqnAQLLVBytrBlMQp.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/hZRavFkhai1tqnAQLLVBytrBlMQp.xml new file mode 100644 index 0000000..e120db9 --- /dev/null +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/hZRavFkhai1tqnAQLLVBytrBlMQp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/vH6_y7kgT4t7f1SDCWtzaJXb8W4d.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/vH6_y7kgT4t7f1SDCWtzaJXb8W4d.xml new file mode 100644 index 0000000..4356a6a --- /dev/null +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/vH6_y7kgT4t7f1SDCWtzaJXb8W4d.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/vH6_y7kgT4t7f1SDCWtzaJXb8W4p.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/vH6_y7kgT4t7f1SDCWtzaJXb8W4p.xml new file mode 100644 index 0000000..01cb34e --- /dev/null +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/vH6_y7kgT4t7f1SDCWtzaJXb8W4p.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zTJqdyqp7yNsOaoi61WgD234bw4d.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/xFCWFSaDU2Vj77-Q7kyo2eKYWI8d.xml similarity index 100% rename from resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zTJqdyqp7yNsOaoi61WgD234bw4d.xml rename to resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/xFCWFSaDU2Vj77-Q7kyo2eKYWI8d.xml diff --git a/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/xFCWFSaDU2Vj77-Q7kyo2eKYWI8p.xml b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/xFCWFSaDU2Vj77-Q7kyo2eKYWI8p.xml new file mode 100644 index 0000000..ee53c01 --- /dev/null +++ b/resources/project/R6m7AxFfSX7StHtVJ9WG44h96GM/xFCWFSaDU2Vj77-Q7kyo2eKYWI8p.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/W7civUV8nZd65rl1QJN6xmVMVQI/-QZV9Nuy1zv83bU-kSqXt0VltGMd.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/A8eiNniqareNVfHxLW_MZ8OErEwd.xml similarity index 100% rename from resources/project/W7civUV8nZd65rl1QJN6xmVMVQI/-QZV9Nuy1zv83bU-kSqXt0VltGMd.xml rename to resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/A8eiNniqareNVfHxLW_MZ8OErEwd.xml diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/A8eiNniqareNVfHxLW_MZ8OErEwp.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/A8eiNniqareNVfHxLW_MZ8OErEwp.xml new file mode 100644 index 0000000..68a2508 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/A8eiNniqareNVfHxLW_MZ8OErEwp.xml @@ -0,0 +1,2 @@ + + diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/CJ7Mv9uDL9jesiZbnXk0OHGPHbgp.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/CJ7Mv9uDL9jesiZbnXk0OHGPHbgp.xml deleted file mode 100644 index c026322..0000000 --- a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/CJ7Mv9uDL9jesiZbnXk0OHGPHbgp.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/IAp6IUrnI4FdjeNE0_vFZ1BqTl8d.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/IAp6IUrnI4FdjeNE0_vFZ1BqTl8d.xml new file mode 100644 index 0000000..99772b4 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/IAp6IUrnI4FdjeNE0_vFZ1BqTl8d.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/IAp6IUrnI4FdjeNE0_vFZ1BqTl8p.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/IAp6IUrnI4FdjeNE0_vFZ1BqTl8p.xml new file mode 100644 index 0000000..366ebaf --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/IAp6IUrnI4FdjeNE0_vFZ1BqTl8p.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/eVX5HqJoYz9G5nLYbRBW9vpUUTod.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/eVX5HqJoYz9G5nLYbRBW9vpUUTod.xml new file mode 100644 index 0000000..99772b4 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/eVX5HqJoYz9G5nLYbRBW9vpUUTod.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/eVX5HqJoYz9G5nLYbRBW9vpUUTop.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/eVX5HqJoYz9G5nLYbRBW9vpUUTop.xml new file mode 100644 index 0000000..4928b78 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/eVX5HqJoYz9G5nLYbRBW9vpUUTop.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/gE_yQga5xG0PlvYzsdVQRNdl1ikd.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/gE_yQga5xG0PlvYzsdVQRNdl1ikd.xml new file mode 100644 index 0000000..99772b4 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/gE_yQga5xG0PlvYzsdVQRNdl1ikd.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/gE_yQga5xG0PlvYzsdVQRNdl1ikp.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/gE_yQga5xG0PlvYzsdVQRNdl1ikp.xml new file mode 100644 index 0000000..e00472c --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/gE_yQga5xG0PlvYzsdVQRNdl1ikp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/nDYc9Zck5t_6smGJJbnMUHjtQkAd.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/nDYc9Zck5t_6smGJJbnMUHjtQkAd.xml new file mode 100644 index 0000000..99772b4 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/nDYc9Zck5t_6smGJJbnMUHjtQkAd.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/nDYc9Zck5t_6smGJJbnMUHjtQkAp.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/nDYc9Zck5t_6smGJJbnMUHjtQkAp.xml new file mode 100644 index 0000000..787b685 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/nDYc9Zck5t_6smGJJbnMUHjtQkAp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/qYKM9f7GAZMWoNLvZ4-cV0kSqQ4p.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/qYKM9f7GAZMWoNLvZ4-cV0kSqQ4p.xml deleted file mode 100644 index e14ac0e..0000000 --- a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/qYKM9f7GAZMWoNLvZ4-cV0kSqQ4p.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/u2oyr9CWJM15VfmJlE-8QpnQMMYd.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/u2oyr9CWJM15VfmJlE-8QpnQMMYd.xml new file mode 100644 index 0000000..99772b4 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/u2oyr9CWJM15VfmJlE-8QpnQMMYd.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/u2oyr9CWJM15VfmJlE-8QpnQMMYp.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/u2oyr9CWJM15VfmJlE-8QpnQMMYp.xml new file mode 100644 index 0000000..2b94189 --- /dev/null +++ b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/u2oyr9CWJM15VfmJlE-8QpnQMMYp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zIfMZrfhDzPKJkl-pwpYI0_25Ycp.xml b/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zIfMZrfhDzPKJkl-pwpYI0_25Ycp.xml deleted file mode 100644 index 0e1bc55..0000000 --- a/resources/project/UMvhTnfaEKsbCRaOOLl1x86F4Is/zIfMZrfhDzPKJkl-pwpYI0_25Ycp.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/resources/project/W7civUV8nZd65rl1QJN6xmVMVQI/-QZV9Nuy1zv83bU-kSqXt0VltGMp.xml b/resources/project/W7civUV8nZd65rl1QJN6xmVMVQI/-QZV9Nuy1zv83bU-kSqXt0VltGMp.xml deleted file mode 100644 index 7bdb975..0000000 --- a/resources/project/W7civUV8nZd65rl1QJN6xmVMVQI/-QZV9Nuy1zv83bU-kSqXt0VltGMp.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/7GAnox74ZbXdootxCv64I9nhMOkp.xml b/resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/7GAnox74ZbXdootxCv64I9nhMOkp.xml deleted file mode 100644 index c7166c3..0000000 --- a/resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/7GAnox74ZbXdootxCv64I9nhMOkp.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/7GAnox74ZbXdootxCv64I9nhMOkd.xml b/resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/kYIJa40hDyfBHNNA7HEZOULvq0Qd.xml similarity index 100% rename from resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/7GAnox74ZbXdootxCv64I9nhMOkd.xml rename to resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/kYIJa40hDyfBHNNA7HEZOULvq0Qd.xml diff --git a/resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/kYIJa40hDyfBHNNA7HEZOULvq0Qp.xml b/resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/kYIJa40hDyfBHNNA7HEZOULvq0Qp.xml new file mode 100644 index 0000000..5b52809 --- /dev/null +++ b/resources/project/hLMKfvmMZYFbdoE4Xco7ryXas6s/kYIJa40hDyfBHNNA7HEZOULvq0Qp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/4g7II1mmlNoOtppzbzSZI8Ja2q4d.xml b/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/4g7II1mmlNoOtppzbzSZI8Ja2q4d.xml new file mode 100644 index 0000000..4356a6a --- /dev/null +++ b/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/4g7II1mmlNoOtppzbzSZI8Ja2q4d.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/4g7II1mmlNoOtppzbzSZI8Ja2q4p.xml b/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/4g7II1mmlNoOtppzbzSZI8Ja2q4p.xml new file mode 100644 index 0000000..53fe30c --- /dev/null +++ b/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/4g7II1mmlNoOtppzbzSZI8Ja2q4p.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/BPAQkVv8abdfl4GuA4Gt8XmbFCUd.xml b/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/BPAQkVv8abdfl4GuA4Gt8XmbFCUd.xml new file mode 100644 index 0000000..4356a6a --- /dev/null +++ b/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/BPAQkVv8abdfl4GuA4Gt8XmbFCUd.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/BPAQkVv8abdfl4GuA4Gt8XmbFCUp.xml b/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/BPAQkVv8abdfl4GuA4Gt8XmbFCUp.xml new file mode 100644 index 0000000..1895cc0 --- /dev/null +++ b/resources/project/p2B2kuKn-TR4inf0L2-zoGElvj0/BPAQkVv8abdfl4GuA4Gt8XmbFCUp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/NTqKTk5GXJ50iyVRWNQZdIM_krkd.xml b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/NTqKTk5GXJ50iyVRWNQZdIM_krkd.xml new file mode 100644 index 0000000..4356a6a --- /dev/null +++ b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/NTqKTk5GXJ50iyVRWNQZdIM_krkd.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/NTqKTk5GXJ50iyVRWNQZdIM_krkp.xml b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/NTqKTk5GXJ50iyVRWNQZdIM_krkp.xml new file mode 100644 index 0000000..d586f30 --- /dev/null +++ b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/NTqKTk5GXJ50iyVRWNQZdIM_krkp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/R6m7AxFfSX7StHtVJ9WG44h96GMd.xml b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/R6m7AxFfSX7StHtVJ9WG44h96GMd.xml new file mode 100644 index 0000000..4356a6a --- /dev/null +++ b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/R6m7AxFfSX7StHtVJ9WG44h96GMd.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/R6m7AxFfSX7StHtVJ9WG44h96GMp.xml b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/R6m7AxFfSX7StHtVJ9WG44h96GMp.xml new file mode 100644 index 0000000..b0b0690 --- /dev/null +++ b/resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/R6m7AxFfSX7StHtVJ9WG44h96GMp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/cmark-gfm_export.h b/src/cmark-gfm_export.h new file mode 100644 index 0000000..31af38e --- /dev/null +++ b/src/cmark-gfm_export.h @@ -0,0 +1,11 @@ +/* + * Project-owned export shim for the MEX's static cmark-gfm build. + * Upstream CMake normally generates this header with GenerateExportHeader; + * the MEX does not need shared-library export annotations. + * + * Copyright 2026 The MathWorks, Inc. + */ +#ifndef CMARK_GFM_EXPORT_H +#define CMARK_GFM_EXPORT_H +#define CMARK_GFM_EXPORT +#endif diff --git a/src/cmark-gfm_mex.c b/src/cmark-gfm_mex.c new file mode 100644 index 0000000..b1e7824 --- /dev/null +++ b/src/cmark-gfm_mex.c @@ -0,0 +1,165 @@ +/* + * Thin MATLAB MEX gateway for cmark-gfm. + * + * cmark-gfm remains an unmodified BSD-2-Clause licensed submodule in + * ext/cmark-gfm. This file contains only project-owned integration code. + * + * Copyright 2026 The MathWorks, Inc. + */ + +#include "mex.h" + +#include +#include +#include + +#include "cmark-gfm.h" +#include "cmark-gfm-core-extensions.h" + +char *cmark_gfm_expand_emojis(const char *markdown, size_t length, + size_t *expanded_length); + +static int is_scalar_text(const mxArray *value) +{ + if (mxIsClass(value, "string")) { + return mxIsScalar(value); + } + if (mxIsChar(value)) { + return mxGetNumberOfElements(value) == 0 || + mxGetM(value) == 1 || mxGetN(value) == 1; + } + return 0; +} + +static char *input_as_utf8(const mxArray *input, mxArray **temporary_char) +{ + const mxArray *char_input = input; + + *temporary_char = NULL; + if (mxIsClass(input, "string")) { + if (mexCallMATLAB(1, temporary_char, 1, (mxArray **)&input, "char") != 0) { + mexErrMsgIdAndTxt("cmarkmd2html:ConversionFailed", + "Unable to convert the MATLAB string input to a character vector."); + } + char_input = *temporary_char; + } + + return mxArrayToUTF8String(char_input); +} + +void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) +{ + char *markdown; + char *expanded_markdown; + char *html; + mxArray *html_char; + mxArray *temporary_char; + size_t expanded_length; + cmark_parser *parser; + cmark_node *document; + cmark_syntax_extension *extension; + static const char *extension_names[] = { + "table", "strikethrough", "autolink", "tasklist" + }; + size_t i; + int input_is_string; + + if (nrhs != 1) { + mexErrMsgIdAndTxt("cmarkmd2html:InvalidNumInputs", + "cmarkmd2html requires exactly one input."); + } + if (nlhs > 1) { + mexErrMsgIdAndTxt("cmarkmd2html:InvalidNumOutputs", + "cmarkmd2html returns exactly one output."); + } + if (!is_scalar_text(prhs[0])) { + mexErrMsgIdAndTxt("cmarkmd2html:InvalidInput", + "Input must be a scalar MATLAB string or character vector."); + } + input_is_string = mxIsClass(prhs[0], "string"); + + markdown = input_as_utf8(prhs[0], &temporary_char); + if (markdown == NULL) { + if (temporary_char != NULL) { + mxDestroyArray(temporary_char); + } + mexErrMsgIdAndTxt("cmarkmd2html:ConversionFailed", + "Unable to convert the Markdown input to UTF-8."); + } + + expanded_markdown = cmark_gfm_expand_emojis(markdown, strlen(markdown), + &expanded_length); + mxFree(markdown); + if (temporary_char != NULL) { + mxDestroyArray(temporary_char); + } + if (expanded_markdown == NULL) { + mexErrMsgIdAndTxt("cmarkmd2html:AllocationFailed", + "Unable to expand Markdown emoji shortcodes."); + } + + cmark_gfm_core_extensions_ensure_registered(); + parser = cmark_parser_new(CMARK_OPT_DEFAULT); + if (parser == NULL) { + free(expanded_markdown); + mexErrMsgIdAndTxt("cmarkmd2html:AllocationFailed", + "Unable to allocate a cmark-gfm parser."); + } + + for (i = 0; i < sizeof(extension_names) / sizeof(extension_names[0]); ++i) { + extension = cmark_find_syntax_extension(extension_names[i]); + if (extension == NULL || !cmark_parser_attach_syntax_extension(parser, extension)) { + cmark_parser_free(parser); + free(expanded_markdown); + mexErrMsgIdAndTxt("cmarkmd2html:ExtensionUnavailable", + "Unable to enable the requested cmark-gfm extension."); + } + } + + cmark_parser_feed(parser, expanded_markdown, expanded_length); + document = cmark_parser_finish(parser); + free(expanded_markdown); + + if (document == NULL) { + cmark_parser_free(parser); + mexErrMsgIdAndTxt("cmarkmd2html:ParseFailed", + "cmark-gfm was unable to parse the Markdown input."); + } + + html = cmark_render_html(document, CMARK_OPT_DEFAULT, + cmark_parser_get_syntax_extensions(parser)); + cmark_parser_free(parser); + cmark_node_free(document); + if (html == NULL) { + mexErrMsgIdAndTxt("cmarkmd2html:RenderFailed", + "cmark-gfm was unable to render HTML."); + } + + html_char = mxCreateString(html); + free(html); + if (html_char == NULL) { + mexErrMsgIdAndTxt("cmarkmd2html:AllocationFailed", + "Unable to allocate the MATLAB HTML output."); + } + + if (!input_is_string) { + plhs[0] = html_char; + return; + } + + plhs[0] = NULL; + if (mexCallMATLAB(1, &plhs[0], 1, &html_char, "string") != 0) { + mxDestroyArray(html_char); + if (plhs[0] != NULL) { + mxDestroyArray(plhs[0]); + plhs[0] = NULL; + } + mexErrMsgIdAndTxt("cmarkmd2html:ConversionFailed", + "Unable to convert the HTML output to a MATLAB string."); + } + mxDestroyArray(html_char); + if (plhs[0] == NULL) { + mexErrMsgIdAndTxt("cmarkmd2html:AllocationFailed", + "Unable to allocate the MATLAB string output."); + } +} diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..09a0edf --- /dev/null +++ b/src/config.h @@ -0,0 +1,26 @@ +/* + * Project-owned configuration shim for compiling cmark-gfm sources directly + * with MATLAB mex. Upstream CMake normally generates this header from + * ext/cmark-gfm/src/config.h.in; these definitions encode the feature + * assumptions and compiler conditionals used by this project. + * + * Copyright 2026 The MathWorks, Inc. + */ +#ifndef CMARK_CONFIG_H +#define CMARK_CONFIG_H +#define HAVE_STDBOOL_H 1 +#include +#if defined(__GNUC__) || defined(__clang__) +#define HAVE___ATTRIBUTE__ 1 +#define CMARK_ATTRIBUTE(list) __attribute__ (list) +#else +#define CMARK_ATTRIBUTE(list) +#endif +#ifndef CMARK_INLINE +#if defined(_MSC_VER) && !defined(__cplusplus) +#define CMARK_INLINE __inline +#else +#define CMARK_INLINE inline +#endif +#endif +#endif diff --git a/src/emoji.c b/src/emoji.c new file mode 100644 index 0000000..f652ad3 --- /dev/null +++ b/src/emoji.c @@ -0,0 +1,266 @@ +/* + * GitHub emoji shortcode expansion for the cmark-gfm gateway. + * + * The shortcode table is generated by buildfile.m from + * ext/gemoji/db/emoji.json. + * The upstream cmark-gfm submodule is intentionally not modified. + * + * Copyright 2026 The MathWorks, Inc. + */ + +#include +#include +#include +#include + +#include "emoji_map.h" + +static int is_shortcode_char(unsigned char character) +{ + return isalnum(character) || character == '_' || + character == '+' || character == '-'; +} + +static size_t line_indent(const char *line, size_t length) +{ + size_t index = 0; + while (index < length && index < 3 && line[index] == ' ') { + ++index; + } + return index; +} + +static int is_fence_line(const char *line, size_t length, + char *fence_character, size_t *fence_length) +{ + size_t index = line_indent(line, length); + size_t run_start = index; + + if (index >= length || (line[index] != '`' && line[index] != '~')) { + return 0; + } + while (index < length && line[index] == line[run_start]) { + ++index; + } + if (index - run_start < 3) { + return 0; + } + *fence_character = line[run_start]; + *fence_length = index - run_start; + return 1; +} + +static int append_bytes(char **output, size_t *length, size_t *capacity, + const char *bytes, size_t count) +{ + char *grown; + size_t required = *length + count + 1; + + if (required > *capacity) { + while (*capacity < required) { + *capacity *= 2; + } + grown = (char *)realloc(*output, *capacity); + if (grown == NULL) { + return 0; + } + *output = grown; + } + memcpy(*output + *length, bytes, count); + *length += count; + (*output)[*length] = '\0'; + return 1; +} + +static int append_expanded_line(const char *line, size_t length, + char **output, size_t *output_length, size_t *output_capacity) +{ + size_t index = 0; + + while (index < length) { + size_t start; + size_t alias_length; + const char *replacement; + + if (line[index] == '`') { + start = index++; + while (index < length && line[index] == '`') { + ++index; + } + alias_length = index - start; + while (index < length) { + if (line[index] == '`') { + size_t closing_start = index++; + while (index < length && line[index] == '`') { + ++index; + } + if (index - closing_start == alias_length) { + break; + } + } else { + ++index; + } + } + if (!append_bytes(output, output_length, output_capacity, + line + start, index - start)) { + return 0; + } + continue; + } + + if (line[index] == '<') { + start = index; + while (index < length && line[index] != '>') { + ++index; + } + if (index < length) { + ++index; + } + if (!append_bytes(output, output_length, output_capacity, + line + start, index - start)) { + return 0; + } + continue; + } + + if (line[index] == ']' && index + 1 < length && + line[index + 1] == '(') { + start = index; + index += 2; + while (index < length && line[index] != ')') { + ++index; + } + if (index < length) { + ++index; + } + if (!append_bytes(output, output_length, output_capacity, + line + start, index - start)) { + return 0; + } + continue; + } + + if (line[index] == ':' && + (index == 0 || line[index - 1] != '\\')) { + start = index + 1; + index = start; + while (index < length && is_shortcode_char((unsigned char)line[index])) { + ++index; + } + if (index > start && index < length && line[index] == ':') { + alias_length = index - start; + replacement = cmark_gfm_emoji_lookup(line + start, alias_length); + if (replacement != NULL) { + if (!append_bytes(output, output_length, output_capacity, + replacement, strlen(replacement))) { + return 0; + } + ++index; + continue; + } + } + index = start - 1; + } + + if (!append_bytes(output, output_length, output_capacity, + line + index, 1)) { + return 0; + } + ++index; + } + return 1; +} + +char *cmark_gfm_expand_emojis(const char *markdown, size_t length, + size_t *expanded_length) +{ + char *output; + size_t output_length = 0; + size_t output_capacity = length + 1; + size_t line_start = 0; + char fence_character = '\0'; + size_t fence_length = 0; + + if (output_capacity < 64) { + output_capacity = 64; + } + output = (char *)malloc(output_capacity); + if (output == NULL) { + return NULL; + } + output[0] = '\0'; + if (length == 0) { + *expanded_length = 0; + return output; + } + + while (line_start < length || (length == 0 && line_start == 0)) { + size_t line_end = line_start; + size_t content_length; + int line_is_fence; + char line_fence_character = '\0'; + size_t line_fence_length = 0; + int fence_active = fence_length != 0; + + while (line_end < length && markdown[line_end] != '\n') { + ++line_end; + } + content_length = line_end - line_start; + line_is_fence = is_fence_line(markdown + line_start, content_length, + &line_fence_character, &line_fence_length); + + if (fence_active) { + if (line_is_fence && + line_fence_character == fence_character && + line_fence_length >= fence_length) { + if (!append_bytes(&output, &output_length, &output_capacity, + markdown + line_start, content_length)) { + free(output); + return NULL; + } + fence_length = 0; + } else if (!append_bytes(&output, &output_length, &output_capacity, + markdown + line_start, content_length)) { + free(output); + return NULL; + } + } else if (line_is_fence) { + fence_character = line_fence_character; + fence_length = line_fence_length; + if (!append_bytes(&output, &output_length, &output_capacity, + markdown + line_start, content_length)) { + free(output); + return NULL; + } + } else if (content_length == 0 || markdown[line_start] == '\t' || + (content_length >= 4 && + markdown[line_start] == ' ' && markdown[line_start + 1] == ' ' && + markdown[line_start + 2] == ' ' && markdown[line_start + 3] == ' ')) { + if (!append_bytes(&output, &output_length, &output_capacity, + markdown + line_start, content_length)) { + free(output); + return NULL; + } + } else { + if (!append_expanded_line(markdown + line_start, content_length, + &output, &output_length, &output_capacity)) { + free(output); + return NULL; + } + } + + if (line_end < length) { + if (!append_bytes(&output, &output_length, &output_capacity, + "\n", 1)) { + free(output); + return NULL; + } + line_start = line_end + 1; + } else { + line_start = length; + } + } + + *expanded_length = output_length; + return output; +} diff --git a/src/emoji_map.c.in b/src/emoji_map.c.in new file mode 100644 index 0000000..f4d4f18 --- /dev/null +++ b/src/emoji_map.c.in @@ -0,0 +1,25 @@ +/* + * Template for the emoji lookup table. buildfile.m replaces its entry marker + * with entries generated from ext/gemoji/db/emoji.json. + * + * Copyright 2026 The MathWorks, Inc. + */ + +#include "emoji_map.h" +#include + +typedef struct { const char *alias; const char *emoji; } emoji_entry; +static const emoji_entry entries[] = { +@EMOJI_ENTRIES@ +}; + +const char *cmark_gfm_emoji_lookup(const char *alias, size_t length) +{ + size_t index; + for (index = 0; index < sizeof(entries) / sizeof(entries[0]); ++index) { + if (strlen(entries[index].alias) == length && + memcmp(entries[index].alias, alias, length) == 0) + return entries[index].emoji; + } + return NULL; +} diff --git a/src/emoji_map.h b/src/emoji_map.h new file mode 100644 index 0000000..4b58a2f --- /dev/null +++ b/src/emoji_map.h @@ -0,0 +1,12 @@ +/* + * Project-owned interface for the generated emoji lookup table. + * buildfile.m generates its implementation in build/cmark-gfm/emoji_map.c + * from ext/gemoji/db/emoji.json. + * + * Copyright 2026 The MathWorks, Inc. + */ +#ifndef CMARK_GFM_EMOJI_MAP_H +#define CMARK_GFM_EMOJI_MAP_H +#include +const char *cmark_gfm_emoji_lookup(const char *alias, size_t length); +#endif diff --git a/tbx/docmaker/+docmaker/GitHub.m b/tbx/docmaker/+docmaker/GitHub.m deleted file mode 100644 index 870b1c9..0000000 --- a/tbx/docmaker/+docmaker/GitHub.m +++ /dev/null @@ -1,98 +0,0 @@ -classdef GitHub < docmaker.MarkdownConverter - %docmaker.GitHub GitHub Markdown converter - % - % docmaker.GitHub is an adapter to GitHub to facilitate conversion - % from Markdown to XML. - % - % g = docmaker.GitHub(h,t) creates a GitHub adapter with the hostname - % h and the access token t. - - % Copyright 2024-2026 The MathWorks, Inc. - - properties ( SetAccess = immutable ) - Hostname - end - - properties ( SetAccess = immutable, Dependent ) - Token - end - - properties ( Access = private ) - Token_ - end - - methods - - function obj = GitHub( hostname, token ) - %GitHub GitHub Markdown converter - - arguments - hostname (1,1) string = "api.github.com" - token (1,1) string = missing - end - - obj.Hostname = hostname; - obj.Token_ = token; - - end % constructor - - function value = get.Token( obj ) - - value = obj.Token_; - if ~ismissing( value ) - value = string( repmat( '*', size( char( value ) ) ) ); % mask - end - - end % get.Token - - function doc = md2xml( obj, md ) - %md2xml Convert Markdown to XML - % - % x = md2xml(g,md) converts the Markdown md to the XML - % document x using the adapter g. - % - % For more details of the GitHub Markdown API, see: - % https://docs.github.com/en/rest/markdown - - arguments - obj (1,1) docmaker.GitHub - md (1,1) string - end - - % Submit request - hostname = obj.Hostname; - token = obj.Token_; - method = matlab.net.http.RequestMethod.POST; - request = matlab.net.http.RequestMessage( method, [], md ); - request = addFields( request, "Content-Type", "text/plain" ); - if ~ismissing( token ) - request = addFields( request, "Authorization", "Bearer " + token ); - end - uri = matlab.net.URI( "https://" + hostname + "/markdown/raw" ); - response = request.send( uri ); - - % Handle response - switch response.StatusCode - case matlab.net.http.StatusCode.OK - xml = response.Body.Data; - xml = strtrim( xml ); - otherwise - throw( MException( "docmaker:UnhandledError", "[%s] %s", ... - string( response.StatusLine ), response.Body.Data.message ) ) - end - - % Close self-closing to ensure valid XML - xml = docmaker.closetags( xml, "img" ); - xml = docmaker.closetags( xml, "hr" ); - xml = docmaker.closetags( xml, "br" ); - - % Wrap in div - parser = matlab.io.xml.dom.Parser(); - doc = parser.parseString( "
" + xml + "
" ); - doc.XMLStandalone = true; - - end % md2xml - - end % methods - -end % classdef \ No newline at end of file diff --git a/tbx/docmaker/+docmaker/GitLab.m b/tbx/docmaker/+docmaker/GitLab.m deleted file mode 100644 index c28fd82..0000000 --- a/tbx/docmaker/+docmaker/GitLab.m +++ /dev/null @@ -1,142 +0,0 @@ -classdef GitLab < docmaker.MarkdownConverter - %docmaker.GitLab GitLab Markdown converter - % - % docmaker.GitLab is an adapter to GitLab to facilitate conversion - % from Markdown to XML. - % - % g = docmaker.GitLab(h,t) creates a GitLab adapter with the hostname - % h and the access token t. - - % Copyright 2024-2026 The MathWorks, Inc. - - properties ( SetAccess = immutable ) - Hostname - end - - properties ( SetAccess = immutable, Dependent ) - Token - end - - properties ( Access = private ) - Token_ - end - - methods - - function obj = GitLab( hostname, token ) - %GitLab GitLab Markdown converter - - arguments - hostname (1,1) string = "gitlab.com" - token (1,1) string = missing - end - - obj.Hostname = hostname; - obj.Token_ = token; - - end % constructor - - function value = get.Token( obj ) - - value = obj.Token_; - if ~ismissing( value ) - value = string( repmat( '*', size( char( value ) ) ) ); % mask - end - - end % get.Token - - function doc = md2xml( obj, md ) - %md2xml Convert Markdown to XML - % - % x = md2xml(g,md) converts the Markdown md to the XML - % document x using the adapter g. - % - % For more details of the GitLab Markdown API, see: - % https://docs.gitlab.com/api/markdown/ - - arguments - obj (1,1) docmaker.GitLab - md (1,1) string - end - - % Submit request - hostname = obj.Hostname; - token = obj.Token_; - method = matlab.net.http.RequestMethod.POST; - body = struct( "text", md, "gfm", true ); - request = matlab.net.http.RequestMessage( method, [], body ); - request = addFields( request, "Content-Type", "application/json" ); - if ~ismissing( token ) - request = addFields( request, "PRIVATE-TOKEN", token ); - end - uri = matlab.net.URI( "https://" + hostname + "/api/v4/markdown" ); - response = request.send( uri ); - - % Handle response - switch response.StatusCode - case matlab.net.http.StatusCode.Created - xml = response.Body.Data.html; - xml = strtrim( xml ); - otherwise - throw( MException( "docmaker:UnhandledError", "[%s] %s", ... - string( response.StatusLine ), response.Body.Data.message ) ) - end - - % Close self-closing to ensure valid XML - xml = docmaker.closetags( xml, "img" ); - xml = docmaker.closetags( xml, "hr" ); - xml = docmaker.closetags( xml, "br" ); - - % Wrap in div - parser = matlab.io.xml.dom.Parser(); - doc = parser.parseString( "
" + xml + "
" ); - doc.XMLStandalone = true; - - % Remove GitLab web UI lazy-loading from images - docmaker.cleanGitLabImages( doc ) - - % Remove anchors - anchors = docmaker.list2array( doc.getElementsByTagName( "a" ) ); - for ii = 1:numel( anchors ) - anchor = anchors(ii); - if anchor.hasChildNodes == false - anchor.getParentNode().removeChild( anchor ); - end - end - - % Fix MATLAB code blocks - pres = docmaker.list2array( doc.getElementsByTagName( "pre" ) ); - for ii = 1:numel( pres ) - pre = pres(ii); - if docmaker.hasclass( pre, "highlight" ) && ... - docmaker.hasclass( pre, "language-matlab" ) - div = getCodeBlock( pre ); - if ~isequal( div, [] ) - docmaker.addclass( div, "highlight" ) - docmaker.addclass( div, "highlight-source-matlab" ) - end - end - end - - end % md2xml - - end % methods - -end % classdef - -function div = getCodeBlock( e ) -%getCodeBlock Get code block of element -% -% d = getCodeBlock(e) gets the code block of the element e, that is, the -% closest div ancestor with class "markdown-code-block". - -if ~isa( e, "matlab.io.xml.dom.Element" ) - div = []; % give up -elseif e.TagName == "div" && ... - docmaker.hasclass( e, "markdown-code-block" ) - div = e; % found it -else - div = getCodeBlock( e.getParentNode() ); % keep looking -end - -end % getCodeBlock diff --git a/tbx/docmaker/+docmaker/MarkdownConverter.m b/tbx/docmaker/+docmaker/MarkdownConverter.m deleted file mode 100644 index ef2a473..0000000 --- a/tbx/docmaker/+docmaker/MarkdownConverter.m +++ /dev/null @@ -1,13 +0,0 @@ -classdef ( Abstract ) MarkdownConverter < handle - %docmaker.MarkdownConverter Markdown converter - % - % docmaker.MarkdownConverter is an adapter API to facilitate - % conversion from Markdown to XML. - - % Copyright 2024-2026 The MathWorks, Inc. - - methods - xml = md2xml( md ) - end - -end % classdef \ No newline at end of file diff --git a/tbx/docmaker/+docmaker/Workspace.m b/tbx/docmaker/+docmaker/Workspace.m index e85bbcf..7e5816a 100644 --- a/tbx/docmaker/+docmaker/Workspace.m +++ b/tbx/docmaker/+docmaker/Workspace.m @@ -339,4 +339,4 @@ function keyboard( obj ) end % methods -end % classdef \ No newline at end of file +end % classdef diff --git a/tbx/docmaker/+docmaker/addclass.m b/tbx/docmaker/+docmaker/addclass.m index 99ccac9..6b82693 100644 --- a/tbx/docmaker/+docmaker/addclass.m +++ b/tbx/docmaker/+docmaker/addclass.m @@ -1,5 +1,5 @@ function addclass( e, n ) -%addclass Add class to XML element +%docmaker.addclass Add class to XML element % % docmaker.addclass(e,c) adds the class c to the element e. @@ -21,4 +21,4 @@ function addclass( e, n ) e.setAttribute( "class", n ); end -end % addclass \ No newline at end of file +end % addclass diff --git a/tbx/docmaker/+docmaker/capture.m b/tbx/docmaker/+docmaker/capture.m index 2eb0eb6..c4e6f9e 100644 --- a/tbx/docmaker/+docmaker/capture.m +++ b/tbx/docmaker/+docmaker/capture.m @@ -1,5 +1,5 @@ function x = capture( fig ) -%capture Capture figure +%docmaker.capture Capture figure % % x = docmaker.capture(f) captures the figure f to image data x. % @@ -31,4 +31,4 @@ ax(ii).Toolbar.Visible = tf(ii); end -end % capture \ No newline at end of file +end % capture diff --git a/tbx/docmaker/+docmaker/cleanGitLabImages.m b/tbx/docmaker/+docmaker/cleanGitLabImages.m deleted file mode 100644 index a042b0f..0000000 --- a/tbx/docmaker/+docmaker/cleanGitLabImages.m +++ /dev/null @@ -1,45 +0,0 @@ -function cleanGitLabImages( doc ) -%cleanGitLabImages Remove GitLab lazy-loading from image elements -% -% docmaker.cleanGitLabImages(doc) normalizes GitLab Markdown API image -% output so generated documentation can render without GitLab's web UI -% JavaScript. - -% Copyright 2026 The MathWorks, Inc. - -arguments - doc (1,1) matlab.io.xml.dom.Document -end - -imgs = docmaker.list2array( doc.getElementsByTagName( "img" ) ); -for imgIdx = 1:numel( imgs ) - img = imgs(imgIdx); - if img.hasAttribute( "data-src" ) - img.setAttribute( "src", img.getAttribute( "data-src" ) ) - img.removeAttribute( "data-src" ) - end - if img.hasAttribute( "decoding" ) && ... - string( img.getAttribute( "decoding" ) ) == "async" - img.removeAttribute( "decoding" ) - end - removeLazyClass( img ) -end - -end % cleanGitLabImages - -function removeLazyClass( img ) -%removeLazyClass Remove the GitLab lazy-load class from an image - -if ~img.hasAttribute( "class" ) - return -end - -classes = string( strsplit( string( img.getAttribute( "class" ) ), " " ) ); -classes(classes == "" | classes == "lazy") = []; -if isempty( classes ) - img.removeAttribute( "class" ) -else - img.setAttribute( "class", strjoin( classes, " " ) ) -end - -end % removeLazyClass diff --git a/tbx/docmaker/+docmaker/closetags.m b/tbx/docmaker/+docmaker/closetags.m index a460399..599121c 100644 --- a/tbx/docmaker/+docmaker/closetags.m +++ b/tbx/docmaker/+docmaker/closetags.m @@ -1,24 +1,22 @@ -function xml = closetags( xml, t ) -%closetags Close self-closing tag +function s = closetags( s, t ) +%docmaker.closetags Close self-closing tag % -% x = docmaker.closetags(x,t) closes the self-closing tags t in the xml -% string x. +% xml = docmaker.closetags(html,t) closes the self-closing tags t in the +% HTML string html. % % Self-closing tags are HTML tags that cannot contain content, e.g. -% "img", "hr", "br". Unclosed self-closing tags -- e.g.,
rather -% than
-- are valid HTML but invalid XML. GitHub and GitLab return -% valid HTML that may be invalid XML, so closetag closes unclosed -% self-closing tags. +% "img", "hr", "br". Unclosed self-closing tags -- e.g.,
rather than +%
-- are valid HTML but invalid XML. % Copyright 2024-2026 The MathWorks, Inc. -lt = sort( [strfind( xml, "<" + t + " " ), ... - strfind( xml, "<" + t + ">" )], "descend" ); % all *matching* tag opens -gt = strfind( xml, ">" ); % *all* tag closes +lt = sort( [strfind( s, "<" + t + " " ), ... + strfind( s, "<" + t + ">" )], "descend" ); % all *matching* tag opens +gt = strfind( s, ">" ); % *all* tag closes for ii = 1:numel( lt ) % backwards i = min( gt(gt>lt(ii)) ); % first ">" after "<" + tag - if extract( xml, i-1 ) == "/", continue, end % already closed - xml = extractBefore( xml, i ) + "/>" + extractAfter( xml, i ); % replace > with /> + if extract( s, i-1 ) == "/", continue, end % already closed + s = extractBefore( s, i ) + "/>" + extractAfter( s, i ); % replace > with /> end -end % closetags \ No newline at end of file +end % closetags diff --git a/tbx/docmaker/+docmaker/converter.m b/tbx/docmaker/+docmaker/converter.m deleted file mode 100644 index 36b35cb..0000000 --- a/tbx/docmaker/+docmaker/converter.m +++ /dev/null @@ -1,77 +0,0 @@ -function c = converter() -%docmaker.converter Get Markdown converter -% -% c = docmaker.converter() returns the current Markdown converter. -% -% The converter can be "GitHub" (default) or "GitLab" and is controlled -% by the environment variable DOCMAKER_CONVERTER, the secret "DocMaker -% converter" or the preference "converter". -% -% The GitHub hostname and token are stored in DOCMAKER_GITHUB_HOSTNAME -% and DOCMAKER_GITHUB_TOKEN, "DocMaker GitHub hostname" and "DocMaker -% GitHub token", or "github_hostname" and "github_token". The same naming -% convention applies to GitLab. - -% Copyright 2024-2026 The MathWorks, Inc. - -n = getValue( "converter", "GitHub" ); -switch lower( n ) - case "github" - h = getValue( "GitHub hostname", "api.github.com" ); - t = getValue( "GitHub token", "" ); - c = docmaker.GitHub( h, t ); - case "gitlab" - h = getValue( "GitLab hostname", "www.gitlab.com" ); - t = getValue( "GitLab token", "" ); - c = docmaker.GitLab( h, t ); - otherwise - error( "docmaker:Unhandled", "Unknown converter ""%s"".", n ) -end - -end % getDefaultConverter - -function value = getValue( shortName, defaultValue ) -%getValue Get value from environment variables, secrets, or preferences -% -% v = getValue(n,d) gets the value of the variable n from environment -% variables, secrets, or preferences. If not found the default value d is -% used. - -envName = "DOCMAKER_" + upper( strrep( shortName, " ", "_" ) ); -secretName = "DocMaker " + shortName; -prefName = lower( strrep( shortName, " ", "_" ) ); -if isenv( envName ) - value = getenv( envName ); -elseif hasSecrets() && isSecret( secretName ) - value = getSecret( secretName ); -elseif ispref( "docmaker", prefName ) - value = getpref( "docmaker", prefName ); -else - value = defaultValue; -end - -end % getValue - -function tf = hasSecrets() -%hasSecrets Test whether MATLAB has secrets -% -% tf = hasSecrets() returns true if MATLAB has secrets, and false -% otherwise. -% -% MATLAB Vault is not available prior to R2024a and in some environments. - -persistent HAS_SECRETS - -if isempty( HAS_SECRETS ) % first time - try - [~] = listSecrets; - tf = true; - catch - tf = false; - end - HAS_SECRETS = tf; % store -else % not first time - tf = HAS_SECRETS; % retrieve -end - -end % hasSecrets \ No newline at end of file diff --git a/tbx/docmaker/+docmaker/dir.m b/tbx/docmaker/+docmaker/dir.m index e1fbde7..3b99509 100644 --- a/tbx/docmaker/+docmaker/dir.m +++ b/tbx/docmaker/+docmaker/dir.m @@ -1,5 +1,5 @@ function s = dir( p, varargin ) -%dir List folder contents +%docmaker.dir List folder contents % % s = docmaker.dir(f) returns the contents of the folder f, which can be % specified as an absolute or relative path, and can include wildcards. @@ -51,4 +51,4 @@ [~, i] = unique( f, "stable" ); s = s(i); -end % dir \ No newline at end of file +end % dir diff --git a/tbx/docmaker/+docmaker/encode.m b/tbx/docmaker/+docmaker/encode.m index 5d25d15..2db5ac5 100644 --- a/tbx/docmaker/+docmaker/encode.m +++ b/tbx/docmaker/+docmaker/encode.m @@ -1,5 +1,5 @@ function s = encode( fig ) -%encode Encode image data +%docmaker.encode Encode image data % % s = docmaker.encode(f) encodes the figure f to the string s using Base % 64 encoding. @@ -50,4 +50,4 @@ s = matlab.net.base64encode( u ); % encode s = string( s ); % convert -end % encode \ No newline at end of file +end % encode diff --git a/tbx/docmaker/+docmaker/extensions.m b/tbx/docmaker/+docmaker/extensions.m index 6525390..a40d1ef 100644 --- a/tbx/docmaker/+docmaker/extensions.m +++ b/tbx/docmaker/+docmaker/extensions.m @@ -1,5 +1,5 @@ function x = extensions( s ) -%extensions File extensions +%docmaker.extensions File extensions % % x = docmaker.extensions(s) returns file extensions x from the folder % struct s. @@ -13,4 +13,4 @@ [~, ~, x{ii}] = fileparts( s(ii).name ); end -end % extensions \ No newline at end of file +end % extensions diff --git a/tbx/docmaker/+docmaker/figures.m b/tbx/docmaker/+docmaker/figures.m index 4902fe7..ebe8c4e 100644 --- a/tbx/docmaker/+docmaker/figures.m +++ b/tbx/docmaker/+docmaker/figures.m @@ -1,5 +1,5 @@ function f = figures() -%figures Find all figures +%docmaker.figures Find all figures % % f = docmaker.figures() returns all current figures in ascending number % order. @@ -13,4 +13,4 @@ [~, i] = sort( n, "ascend" ); % sort ascending f = f(i); % return in ascending order of figure number -end % figures \ No newline at end of file +end % figures diff --git a/tbx/docmaker/+docmaker/getDefaultFigureSize.m b/tbx/docmaker/+docmaker/getDefaultFigureSize.m index 91d4544..cd1f1fd 100644 --- a/tbx/docmaker/+docmaker/getDefaultFigureSize.m +++ b/tbx/docmaker/+docmaker/getDefaultFigureSize.m @@ -1,7 +1,9 @@ function s = getDefaultFigureSize() -%getDefaultFigureSize Default figure size +%docmaker.getDefaultFigureSize Default figure size +% +% Copyright 2026 The MathWorks, Inc. p = get( 0, "DefaultFigurePosition" ); % [x y w h] s = p(3:4); % [w h] -end % getDefaultFigureSize \ No newline at end of file +end % getDefaultFigureSize diff --git a/tbx/docmaker/+docmaker/githubmd2html.m b/tbx/docmaker/+docmaker/githubmd2html.m new file mode 100644 index 0000000..679875c --- /dev/null +++ b/tbx/docmaker/+docmaker/githubmd2html.m @@ -0,0 +1,72 @@ +function html = githubmd2html( markdown ) +%docmaker.githubmd2html Convert Markdown to HTML using GitHub +% +% html = docmaker.githubmd2html(md) converts Markdown md to HTML using +% the GitHub Markdown API. +% +% Requests to this service are rate limited, and authenticated requests +% get a higher limit. A GitHub access token with no permissions is +% sufficient. To authenticate, set DOCMAKER_GITHUB_TOKEN as a MATLAB +% secret (recommended for local machines from R2024a) or as an +% environment variable (recommended for build runners). +% +% See also: docmaker.cmarkmd2html, docmaker.gitlabmd2html, docconvert + +% Copyright 2026 The MathWorks, Inc. + +arguments + markdown (1,1) string +end + +% Create a request with the Markdown as a plain-text body +method = matlab.net.http.RequestMethod.POST; +request = matlab.net.http.RequestMessage( method, [], markdown ); +request = addFields( request, "Content-Type", "text/plain" ); + +% Look for token, in a MATLAB secret, or in an environment variable +tokenName = "DOCMAKER_GITHUB_TOKEN"; +if hasSecrets() && isSecret( tokenName ) + token = string( getSecret( tokenName ) ); +else % fallback + token = string( getenv( tokenName ) ); % empty if no env var +end +if strlength( token ) > 0 + request = addFields( request, "Authorization", "Bearer " + token ); +end + +% Request HTML output from GitHub +uri = matlab.net.URI( "https://api.github.com/markdown/raw" ); +response = request.send( uri ); + +% Return the HTML response, or report the HTTP failure +switch response.StatusCode + case matlab.net.http.StatusCode.OK + html = strtrim( string( response.Body.Data ) ); + otherwise + body = response.Body.Data; + if isstruct( body ) && isfield( body, "message" ) + body = body.message; + end + body = string( body ); + if isempty( body ) + body = ""; + else + body = strjoin( body(:), " " ); + end + error( "docmaker:githubmd2html:RequestFailed", ... + "GitHub Markdown API returned %s: %s", ... + string( response.StatusLine ), body ) +end + +end % githubmd2html + +function tf = hasSecrets() +%hasSecrets Test whether MATLAB secrets are supported + +persistent HAS_SECRETS +if isempty( HAS_SECRETS ) + HAS_SECRETS = ~isMATLABReleaseOlderThan( "R2024a" ); +end +tf = HAS_SECRETS; + +end % hasSecrets diff --git a/tbx/docmaker/+docmaker/gitlabfixxml.m b/tbx/docmaker/+docmaker/gitlabfixxml.m new file mode 100644 index 0000000..64e2d3f --- /dev/null +++ b/tbx/docmaker/+docmaker/gitlabfixxml.m @@ -0,0 +1,84 @@ +function gitlabfixxml( doc ) +%docmaker.gitlabfixxml Apply GitLab-specific cleanup to an XML DOM +% +% docmaker.gitlabfixxml(doc) modifies the XML DOM document doc to handle +% GitLab lazy images, empty anchors, and MATLAB code blocks. +% +% See also: docmaker.html2xml, docmaker.md2xml + +% Copyright 2026 The MathWorks, Inc. + +arguments + doc (1,1) matlab.io.xml.dom.Document +end + +% Promote image URLs out of GitLab's lazy-loading attributes +images = docmaker.list2array( doc.getElementsByTagName( "img" ) ); +for ii = 1:numel( images ) + image = images(ii); + if image.hasAttribute( "data-src" ) + image.setAttribute( "src", image.getAttribute( "data-src" ) ) + image.removeAttribute( "data-src" ) + end + if image.hasAttribute( "decoding" ) && ... + string( image.getAttribute( "decoding" ) ) == "async" + image.removeAttribute( "decoding" ) + end + removeLazyClass( image ) +end + +% Remove empty anchors +anchors = docmaker.list2array( doc.getElementsByTagName( "a" ) ); +for ii = 1:numel( anchors ) + anchor = anchors(ii); + if ~anchor.hasChildNodes + anchor.getParentNode().removeChild( anchor ); + end +end + +% Adjust MATLAB code blocks +pres = docmaker.list2array( doc.getElementsByTagName( "pre" ) ); +for ii = 1:numel( pres ) + pre = pres(ii); + if docmaker.hasclass( pre, "highlight" ) && ... + docmaker.hasclass( pre, "language-matlab" ) + div = getCodeBlock( pre ); + if ~isempty( div ) + docmaker.addclass( div, "highlight" ) + docmaker.addclass( div, "highlight-source-matlab" ) + end + end +end + +end % gitlabfixxml + +function removeLazyClass( image ) +%removeLazyClass Remove the GitLab lazy-load class from an image + +if ~image.hasAttribute( "class" ) + return +end + +classes = string( strsplit( string( image.getAttribute( "class" ) ), " " ) ); +classes(classes == "" | classes == "lazy") = []; +if isempty( classes ) + image.removeAttribute( "class" ) +else + image.setAttribute( "class", strjoin( classes, " " ) ) +end + +end % removeLazyClass + +function div = getCodeBlock( element ) +%getCodeBlock Get the GitLab div containing a MATLAB code block + +if ~isa( element, "matlab.io.xml.dom.Element" ) + div = []; +elseif element.TagName == "div" && ... + docmaker.hasclass( element, "markdown-code-block" ) + div = element; +else + div = getCodeBlock( element.getParentNode() ); +end + +end % getCodeBlock diff --git a/tbx/docmaker/+docmaker/gitlabmd2html.m b/tbx/docmaker/+docmaker/gitlabmd2html.m new file mode 100644 index 0000000..142d101 --- /dev/null +++ b/tbx/docmaker/+docmaker/gitlabmd2html.m @@ -0,0 +1,92 @@ +function html = gitlabmd2html( markdown ) +%docmaker.gitlabmd2html Convert Markdown to HTML using GitLab +% +% html = docmaker.gitlabmd2html(md) converts Markdown md using the +% GitLab Markdown API. +% +% Requests to this service must be authenticated. A GitLab access token +% scope "api" is sufficient. To authenticate, set DOCMAKER_GITLAB_TOKEN +% as a MATLAB secret (recommended for local machines from R2024a) or as +% an environment variable (recommended for build runners). +% +% See also: docmaker.githubmd2html, docmaker.cmarkmd2html, docconvert + +% Copyright 2026 The MathWorks, Inc. + +arguments + markdown (1,1) string +end + +% Look for the token in a MATLAB secret, then in the environment. +tokenName = "DOCMAKER_GITLAB_TOKEN"; +if hasSecrets() && isSecret( tokenName ) + token = string( getSecret( tokenName ) ); +else + token = string( getenv( tokenName ) ); +end +if strlength( token ) == 0 + error( "docmaker:gitlabmd2html:MissingToken", ... + "GitLab Markdown conversion requires a personal access token." + ... + newline() + "Set DOCMAKER_GITLAB_TOKEN as an environment " + ... + "variable or MATLAB Secret." ) +end + +% Create a request with GitLab-flavored Markdown as JSON. +method = matlab.net.http.RequestMethod.POST; +body = struct( "text", markdown, "gfm", true ); +request = matlab.net.http.RequestMessage( method, [], body ); +request = addFields( request, "Content-Type", "application/json" ); +request = addFields( request, "Accept", "application/json" ); +request = addFields( request, "PRIVATE-TOKEN", token ); + +% Request HTML output from GitLab.com. +uri = matlab.net.URI( "https://gitlab.com/api/v4/markdown" ); +response = request.send( uri ); + +% Return the HTML response, or report the HTTP failure. +switch response.StatusCode + case matlab.net.http.StatusCode.Created + data = response.Body.Data; + if isstruct( data ) && isfield( data, "html" ) + html = strtrim( string( data.html ) ); + else + error( "docmaker:gitlabmd2html:InvalidResponse", ... + "GitLab Markdown API response did not contain HTML." ) + end + otherwise + message = getResponseMessage( response ); + error( "docmaker:gitlabmd2html:RequestFailed", ... + "GitLab Markdown API returned %s: %s", ... + string( response.StatusLine ), message ) +end + +end % gitlabmd2html + +function message = getResponseMessage( response ) +%getResponseMessage Get a readable message from an API response + +body = response.Body.Data; +if isstruct( body ) && isfield( body, "message" ) + body = body.message; +end +try + message = strjoin( string( body(:) ), " " ); +catch + message = ""; +end +if strlength( message ) == 0 + message = ""; +end + +end % getResponseMessage + +function tf = hasSecrets() +%hasSecrets Test whether MATLAB secrets are supported + +persistent HAS_SECRETS +if isempty( HAS_SECRETS ) + HAS_SECRETS = ~isMATLABReleaseOlderThan( "R2024a" ); +end +tf = HAS_SECRETS; + +end % hasSecrets diff --git a/tbx/docmaker/+docmaker/hasclass.m b/tbx/docmaker/+docmaker/hasclass.m index 10897dc..3f877f6 100644 --- a/tbx/docmaker/+docmaker/hasclass.m +++ b/tbx/docmaker/+docmaker/hasclass.m @@ -1,5 +1,5 @@ function tf = hasclass( e, n ) -%hasclass Test whether XML element has class +%docmaker.hasclass Test whether XML element has class % % docmaker.hasclass(e,c) returns true if the element e has the class c, % and false otherwise. @@ -20,4 +20,4 @@ tf = false; end -end % hasclass \ No newline at end of file +end % hasclass diff --git a/tbx/docmaker/+docmaker/html2xml.m b/tbx/docmaker/+docmaker/html2xml.m new file mode 100644 index 0000000..1eabf98 --- /dev/null +++ b/tbx/docmaker/+docmaker/html2xml.m @@ -0,0 +1,68 @@ +function doc = html2xml( html ) +%docmaker.html2xml Convert HTML output to an XML DOM document +% +% doc = docmaker.html2xml(html) converts HTML output to an XML DOM +% document and normalizes MATLAB code blocks for docrun. +% +% See also: docconvert, docmaker.md2xml + +% Copyright 2026 The MathWorks, Inc. + +arguments + html (1,1) string +end + +html = strtrim( html ); + +% Close HTML void elements to make the response valid XML +html = docmaker.closetags( html, "img" ); +html = docmaker.closetags( html, "hr" ); +html = docmaker.closetags( html, "br" ); +html = docmaker.closetags( html, "input" ); + +parser = matlab.io.xml.dom.Parser(); +doc = parser.parseString( "
" + html + "
" ); +doc.XMLStandalone = true; + +% Normalize MATLAB code blocks for docrun +pres = docmaker.list2array( doc.getElementsByTagName( "pre" ) ); +for ii = 1:numel( pres ) + pre = pres(ii); + codes = docmaker.list2array( pre.getElementsByTagName( "code" ) ); + parent = pre.getParentNode(); + hasMatlabWrapper = isa( parent, "matlab.io.xml.dom.Element" ) && ... + docmaker.hasclass( parent, "highlight-source-matlab" ); + isMatlab = hasMatlabWrapper; + if ~isempty( codes ) + code = codes(1); + isMatlab = isMatlab || ... + docmaker.hasclass( code, "language-matlab" ); + end + if pre.hasAttribute( "lang" ) + isMatlab = isMatlab || ... + lower( string( pre.getAttribute( "lang" ) ) ) == "matlab"; + end + if ~isMatlab + continue + end + + % cmark-gfm appends a newline to fenced code blocks + if ~isempty( codes ) + content = string( code.TextContent ); + if endsWith( content, newline() ) + code.TextContent = extractBefore( content, strlength( content ) ); + end + end + + % GitHub may already wrap syntax-highlighted code for docrun + if hasMatlabWrapper + continue + end + + div = doc.createElement( "div" ); + div.setAttribute( "class", "highlight highlight-source-matlab" ); + parent.insertBefore( div, pre ); + div.appendChild( pre ); +end + +end % html2xml diff --git a/tbx/docmaker/+docmaker/list2array.m b/tbx/docmaker/+docmaker/list2array.m index fa93d0b..ae628c8 100644 --- a/tbx/docmaker/+docmaker/list2array.m +++ b/tbx/docmaker/+docmaker/list2array.m @@ -1,5 +1,5 @@ function elements = list2array( nodeList ) -%list2array Convert node list to element array +%docmaker.list2array Convert node list to element array % % e = docmaker.list2array(n) converts the node list n to an element array % e. @@ -20,4 +20,4 @@ end elements = elements(:); % return column vector -end % list2array \ No newline at end of file +end % list2array diff --git a/tbx/docmaker/+docmaker/md2xml.m b/tbx/docmaker/+docmaker/md2xml.m new file mode 100644 index 0000000..b8b9836 --- /dev/null +++ b/tbx/docmaker/+docmaker/md2xml.m @@ -0,0 +1,51 @@ +function doc = md2xml( md, options ) +%docmaker.md2xml Convert Markdown to XML +% +% doc = docmaker.md2xml(md) converts Markdown md using the cmark-gfm MEX. +% This is the default and runs offline. +% +% doc = docmaker.md2xml(md,"Converter","github") uses GitHub's Markdown +% API. The token DOCMAKER_GITHUB_TOKEN is optional. +% +% doc = docmaker.md2xml(md,"Converter","gitlab") uses GitLab's Markdown +% API. The token DOCMAKER_GITLAB_TOKEN is required. +% +% See also: docconvert, docmaker.githubmd2html, docmaker.gitlabmd2html + +% Copyright 2026 The MathWorks, Inc. + +arguments + md (1,1) string + options.Converter (1,1) string {mustBeMember( ... + options.Converter, ["cmark", "github", "gitlab"])} = "cmark" +end + +% Convert Markdown to HTML +switch options.Converter + case "cmark" + % Check for a MEX binary built for this platform. + mex = fullfile( fileparts( mfilename( "fullpath" ) ), ... + "cmarkmd2html." + mexext() ); + if ~isfile( mex ) + error( "docmaker:md2xml:MissingMEX", ... + "cmark-gfm converter not found: %s " + newline + ... + "Run `buildtool mex` to build from source for this platform", ... + mex ) + end + html = string( docmaker.cmarkmd2html( md ) ); + case "github" + html = docmaker.githubmd2html( md ); + case "gitlab" + html = docmaker.gitlabmd2html( md ); +end + +% Convert HTML to XML +doc = docmaker.html2xml( html ); + +% Fix XML +switch options.Converter + case "gitlab" + docmaker.gitlabfixxml( doc ) +end + +end % md2xml diff --git a/tbx/docmaker/+docmaker/mustBeTheme.m b/tbx/docmaker/+docmaker/mustBeTheme.m index cc24c11..d31d62d 100644 --- a/tbx/docmaker/+docmaker/mustBeTheme.m +++ b/tbx/docmaker/+docmaker/mustBeTheme.m @@ -1,5 +1,7 @@ function mustBeTheme( theme ) -%mustBeTheme Validation function for optional named argument Theme +%docmaker.mustBeTheme Validation function for named argument Theme +% +% Copyright 2026 The MathWorks, Inc. themes = ["none","light","dark","auto"]; assert( ( ischar( theme ) && ismember( theme, themes ) ) || ... @@ -7,4 +9,4 @@ function mustBeTheme( theme ) ( isa( theme, "matlab.graphics.theme.GraphicsTheme" ) && isscalar( theme ) ), ... "Theme must be ""none"", ""light"", ""dark"", ""auto"", or a GraphicsTheme." ) -end % mustBeTheme \ No newline at end of file +end % mustBeTheme diff --git a/tbx/docmaker/+docmaker/removeemojis.m b/tbx/docmaker/+docmaker/removeemojis.m index e3486bd..ebefb5e 100644 --- a/tbx/docmaker/+docmaker/removeemojis.m +++ b/tbx/docmaker/+docmaker/removeemojis.m @@ -1,5 +1,5 @@ function s = removeemojis( s ) -%removeemojis Remove emojis from string +%docmaker.removeemojis Remove emojis from string % % s = docmaker.removeemojis(s) removes emojis from the string s. % @@ -29,4 +29,4 @@ s = erase( s, e ); s = strtrim( s ); -end % removeemojis \ No newline at end of file +end % removeemojis diff --git a/tbx/docmaker/+docmaker/replacelinks.m b/tbx/docmaker/+docmaker/replacelinks.m index 1aa5442..8713247 100644 --- a/tbx/docmaker/+docmaker/replacelinks.m +++ b/tbx/docmaker/+docmaker/replacelinks.m @@ -1,11 +1,11 @@ function replacelinks( doc, old, new ) -%replacelinks Replace links in XML document +%docmaker.replacelinks Replace links in XML document % -% docmaker.replacelinks(x,o,n) replaces link extensions o with n in the -% XML document x. +% docmaker.replacelinks(doc,o,n) replaces link extensions o with n in +% the XML document doc. % % For example, replace Markdown links with HTML links using: -% docmaker.replacelinks(x,".md",".html") +% docmaker.replacelinks(doc,".md",".html") % Copyright 2024-2026 The MathWorks, Inc. @@ -30,4 +30,4 @@ function replacelinks( doc, old, new ) end end -end % replacelinks \ No newline at end of file +end % replacelinks diff --git a/tbx/docmaker/+docmaker/superfolder.m b/tbx/docmaker/+docmaker/superfolder.m index abe97f6..936f59f 100644 --- a/tbx/docmaker/+docmaker/superfolder.m +++ b/tbx/docmaker/+docmaker/superfolder.m @@ -1,9 +1,9 @@ function s = superfolder( varargin ) -%superfolder Common ancestor folder +%docmaker.superfolder Common ancestor folder % -% s = superfolder(p1,p2,...) returns the common ancestor of the folders -% p1, p2, ... The folders must exist. If there is no common ancestor -% then superfolder returns []. +% s = docmaker.superfolder(p1,p2,...) returns the common ancestor of the +% folders p1, p2, ... The folders must exist. If there is no common +% ancestor, then docmaker.superfolder returns []. % Copyright 2024-2026 The MathWorks, Inc. @@ -41,4 +41,4 @@ % Return matching datatype if iscellstr( varargin ), s = char( s ); end %#ok -end % superfolder \ No newline at end of file +end % superfolder diff --git a/tbx/docmaker/Contents.m b/tbx/docmaker/Contents.m index 07e7c55..dbb1c5d 100644 --- a/tbx/docmaker/Contents.m +++ b/tbx/docmaker/Contents.m @@ -1,5 +1,5 @@ % MATLAB DocMaker -% Version 0.8.0 (R2026b) 15-Oct-2026 +% Version 0.9.0 (R2026b) 14-Nov-2026 % % docconvert - convert Markdown documents to HTML % docrun - run MATLAB code in HTML documents and insert output diff --git a/tbx/docmaker/DocMakerTask.m b/tbx/docmaker/DocMakerTask.m index 42dcfac..c7ff105 100644 --- a/tbx/docmaker/DocMakerTask.m +++ b/tbx/docmaker/DocMakerTask.m @@ -1,12 +1,14 @@ classdef DocMakerTask < matlab.buildtool.Task - %DOCMAKERTASK Generate toolbox documentation using DocMaker. + %DocMakerTask Generate toolbox documentation using DocMaker % - % See also docconvert, docrun, docindex + % See also: docconvert, docrun, docindex + % + % Copyright 2026 The MathWorks, Inc. properties % Documentation theme. - Theme(1, 1) string {mustBeMember( Theme, ... - ["light", "dark", "auto"] )} = "auto" + Theme(1, 1) string {mustBeMember( ... + Theme, ["light", "dark", "auto"] )} = "auto" % Stylesheets to include. Stylesheets(1, :) string {mustBeFile} % Scripts to include. @@ -14,8 +16,11 @@ % Root folder for publishing. Root(1, :) string {mustBeFolder, mustBeScalarOrEmpty} % LaTeX interpreter. - Interpreter(1, 1) string {mustBeMember( Interpreter, ... - ["latex", "none"] )} = "none" + Interpreter(1, 1) string {mustBeMember( ... + Interpreter, ["latex", "none"] )} = "none" + % Markdown converter. + Converter(1, 1) string {mustBeMember( ... + Converter, ["cmark", "github", "gitlab"] )} = "cmark" % Batching level. Level(1, 1) double {mustBeInteger, ... mustBeInRange( Level, 0, 7 )} = 0 @@ -45,17 +50,20 @@ methods function task = DocMakerTask( markdownFiles, namedArgs ) - %DOCMAKERTASK Construct the DocMaker build task. + %DocMakerTask Construct the DocMaker build task + % + % task = DocMakerTask(markdownFiles,Name=Value) constructs a + % task that generates documentation from Markdown files. - arguments ( Input, Repeating ) + arguments ( Repeating ) markdownFiles - end % arguments ( Input, Repeating ) + end - arguments ( Input ) + arguments namedArgs.?DocMakerTask - end % arguments ( Input ) + end - % Assign the markdown files (the task input). + % Assign the markdown files (the task input). task.MarkdownFiles = [markdownFiles{:}]; % Derive the task outputs. @@ -67,7 +75,7 @@ html = fullfile( mdFolders, name + ".html" ); task.HTMLFiles = html; - % Root folder. + % Root folder. if ~isempty( task.Root ) rootInfo = dir( task.Root ); root = rootInfo(1).folder; @@ -101,7 +109,10 @@ methods ( TaskAction ) function buildDoc( task, ~ ) - %BUILDDOC Build the toolbox documentation. + %buildDoc Build the toolbox documentation + % + % buildDoc(task,context) converts, runs, and indexes the + % task's Markdown documentation. % % * Convert Markdown documents to HTML % * Run MATLAB code in HTML documents and insert output @@ -112,7 +123,7 @@ function buildDoc( task, ~ ) if ~isempty( task.Stylesheets ) convertArgs = {"Stylesheets", task.Stylesheets}; end % if - + if ~isempty( task.Scripts ) convertArgs = [convertArgs, {"Scripts", task.Scripts}]; end % if @@ -125,6 +136,7 @@ function buildDoc( task, ~ ) html = docconvert( task.MarkdownFiles.paths(), ... "Theme", task.Theme, ... "Interpreter", task.Interpreter, ... + "Converter", task.Converter, ... convertArgs{:} ); fprintf( 1, "** Converted Markdown doc to HTML\n" ) @@ -136,18 +148,18 @@ function buildDoc( task, ~ ) fprintf( 1, "** Inserted MATLAB output into doc\n" ) % Build the documentation search index. - if ~isempty( task.Root ) - docindex( task.Root ) + if ~isempty( task.Root ) + pRoot = task.Root; else sMd = docmaker.dir( task.MarkdownFiles.paths() ); pMd = reshape( {sMd.folder}, size( sMd ) ); pRoot = docmaker.superfolder( pMd{:} ); - docindex( pRoot ) end % if + docindex( pRoot, "Converter", task.Converter ) fprintf( 1, "** Indexed doc\n" ) end % buildDoc end % methods ( TaskAction ) -end % classdef \ No newline at end of file +end % classdef diff --git a/tbx/docmaker/docconvert.m b/tbx/docmaker/docconvert.m index 161f4fe..9db9d3c 100644 --- a/tbx/docmaker/docconvert.m +++ b/tbx/docmaker/docconvert.m @@ -27,6 +27,11 @@ % inline, and double dollar signs $$...$$ to display equations on their % own line, centered. % +% docconvert(...,"Converter",c) selects the Markdown converter. Available +% converters are "cmark" (default), "github", and "gitlab". GitHub and +% GitLab conversion send Markdown to their APIs and require network +% access. +% % [html, res] = docconvert(...) returns the names of the HTML document(s) % html and the resources folder res created. % @@ -39,11 +44,15 @@ end arguments - options.Theme (1,1) string {mustBeMember(options.Theme,["light","dark","auto"])} = "auto" + options.Theme (1,1) string {mustBeMember( ... + options.Theme, ["light","dark","auto"] )} = "auto" options.Stylesheets (1,:) string {mustBeFile} options.Scripts (1,:) string {mustBeFile} options.Root (1,1) string {mustBeFolder} - options.Interpreter(1, 1) string {mustBeMember(options.Interpreter, ["latex", "none"])} = "none" + options.Interpreter (1,1) string {mustBeMember( ... + options.Interpreter, ["latex", "none"] )} = "none" + options.Converter (1,1) string {mustBeMember( ... + options.Converter, ["cmark", "github", "gitlab"] )} = "cmark" end % Initialize output @@ -70,7 +79,8 @@ % Include math scripts if LaTeX interpreter is requested if options.Interpreter == "latex" - mathScripts = fullfile( docmakerroot(), "resources", ... + mathScripts = fullfile( fileparts( mfilename( "fullpath" ) ), ... + "resources", ... ["mathjax-config.js", "tex-mml-chtml.js"] ); if ~isfield( options, "Scripts" ) options.Scripts = mathScripts; @@ -143,7 +153,7 @@ fMd = fullfile( sMd(ii).folder, sMd(ii).name ); [pMd, nMd, ~] = fileparts( fMd ); fHtml = fullfile( pMd, nMd + ".html" ); - doc = convert( fMd, fCss, fJs ); + doc = convert( fMd, fCss, fJs, options.Converter ); writer.writeToFile( doc, fHtml, "utf-8" ) if options.Interpreter == "latex" cleanLaTeXExpressions( fHtml ) @@ -159,19 +169,18 @@ end % docconvert -function doc = convert( fMd, fCss, fJs ) +function doc = convert( fMd, fCss, fJs, converter ) %convert Convert Markdown document to HTML with stylesheets and scripts % -% convert(md,css,js) converts the Markdown document md to HTML and -% includes references to the stylesheets css and scripts js. +% convert(md,css,js,converter) converts the Markdown document md to HTML +% using converter and includes the requested stylesheets and scripts. % Read Markdown from file pMd = fileparts( fMd ); md = fileread( fMd ); % Convert Markdown to XML -converter = docmaker.converter(); -xml = converter.md2xml( md ); +xml = docmaker.md2xml( md, "Converter", converter ); % Replace Markdown links docmaker.replacelinks( xml, ".md", ".html" ) @@ -288,55 +297,37 @@ end % relpath function cleanLaTeXExpressions( fHTML ) -%CLEANLATEXEXPRESSIONS Postprocess LaTeX expressions after conversion to -%HTML via the GitHub or GitLab APIs. We remove spurious HTML tags and add -%delimiters to the expressions as needed. -% -% For the GitHub API, we replace ... with _..._ inside $...$ or -% $$...$$. -% -% Markdown italics and LaTeX subscripts both use an underscore, causing a -% conflict when Markdown is parsed with priority over LaTeX inside a LaTeX -% expression. For example, the underscores in the expression: +%cleanLaTeXExpressions Restore LaTeX syntax after Markdown conversion % -% $$ -% \Phi = \frac{\dot{m}_{th} + \dot{m}}{2} ht_{in} - ... -% \frac{\dot{m}_{th} - \dot{m}}{2} ht_{out} -% $$ +% cleanLaTeXExpressions(fHTML) restores underscores in LaTeX expressions +% after Markdown conversion. Markdown emphasis and LaTeX subscripts both +% use underscores, so emphasis tags inside expressions must be converted +% back. For example, the underscores in: % -% are converted to ... tags in HTML. +% $$ +% \Phi = \frac{\dot{m}_{th} + \dot{m}}{2} ht_{in} - ... +% \frac{\dot{m}_{th} - \dot{m}}{2} ht_{out} +% $$ % -% For the GitLab API, we enclose span contents with class="js-render-math" -% and data-math-style="display" or "inline" with $$ and $, respectively. -% -% Any future conflicting syntax will be added to this function on a -% case-by-case basis. - -arguments ( Input ) - fHTML(1, 1) string {mustBeFile} -end % arguments ( Input ) +% may be converted to ... tags in HTML. -converterType = erase( class( docmaker.converter() ), "docmaker." ); +arguments + fHTML(1, 1) string {mustBeFile} +end % arguments -switch converterType - case "GitHub" - removeItalicTags( fHTML ) - case "GitLab" - wrapMathSpans( fHTML ) - otherwise - error( "docconvert:cleanLaTeXExpressions", ... - "Unsupported converter type %s.", converterType ) -end % switch/case +removeItalicTags( fHTML ) end % cleanLaTeXExpressions function removeItalicTags( fHTML ) -%REMOVEITALICTAGS Postprocess the generated HTML to remove spurious HTML -%tags from the LaTeX expressions. +%removeItalicTags Restore LaTeX underscores in generated HTML +% +% removeItalicTags(fHTML) replaces emphasis tags around underscores in +% LaTeX expressions with literal underscores. -arguments ( Input ) +arguments fHTML(1, 1) string {mustBeFile} -end % arguments ( Input ) +end % arguments % Read the file contents. rawHTML = fileread( fHTML ); @@ -386,28 +377,3 @@ function removeItalicTags( fHTML ) fclose( fileID ); end % removeItalicTags - -function wrapMathSpans( fHTML ) -%WRAPMATHSPANS Enclose GitLab-style LaTeX span contents within $$ or $. - -arguments ( Input ) - fHTML(1, 1) string {mustBeFile} -end % arguments ( Input ) - -% Read the file contents. -rawHTML = fileread( fHTML ); - -% Display LaTeX → wrap inner content with $$...$$. -displayPattern = ']*data-math-style="display"[^>]*>(.*?)'; -cleanHTML = regexprep( rawHTML, displayPattern, "$$$1$$" ); - -% Inline LaTeX → wrap inner content with $...$. -inlinePattern = ']*data-math-style="inline"[^>]*>(.*?)'; -cleanHTML = regexprep( cleanHTML, inlinePattern, "$$1$" ); - -% Write the file contents. -fileID = fopen( fHTML, "w" ); -fprintf( fileID, "%s", cleanHTML ); -fclose( fileID ); - -end % wrapMathSpans \ No newline at end of file diff --git a/tbx/docmaker/docdelete.m b/tbx/docmaker/docdelete.m index ca43b68..09388e4 100644 --- a/tbx/docmaker/docdelete.m +++ b/tbx/docmaker/docdelete.m @@ -85,4 +85,4 @@ varargout{2} = oFolders; end -end % docdelete \ No newline at end of file +end % docdelete diff --git a/tbx/docmaker/docindex.m b/tbx/docmaker/docindex.m index a0c50a2..19a70f4 100644 --- a/tbx/docmaker/docindex.m +++ b/tbx/docmaker/docindex.m @@ -1,9 +1,14 @@ -function varargout = docindex( pRoot ) +function varargout = docindex( pRoot, options ) %docindex Create info.xml and helptoc.xml from helptoc.md % % docindex(d) creates documentation index files "info.xml" and % "helptoc.xml" and search database "helpsearch-v4" in the folder d. % +% docindex(...,"Converter",c) selects the Markdown converter. Available +% converters are "cmark" (default), "github", and "gitlab". GitHub and +% GitLab conversion send Markdown to their APIs and require network +% access. +% % [xml,db] = docindex(...) returns the names of the index files xml and % the search database folder db created. % @@ -13,6 +18,8 @@ arguments pRoot (1,1) string {mustBeFolder} + options.Converter (1,1) string {mustBeMember( ... + options.Converter, ["cmark", "github", "gitlab"])} = "cmark" end % Canonicalize @@ -20,10 +27,9 @@ pRoot = sRoot(1).folder; % absolute % Read helptoc.md -converter = docmaker.converter(); fToc = fullfile( pRoot, "helptoc.md" ); % source mToc = fileread( fToc ); % Markdown -xToc = converter.md2xml( mToc ); % parse +xToc = docmaker.md2xml( mToc, "Converter", options.Converter ); % convert docmaker.replacelinks( xToc, ".md", ".html" ) % replace links % Extract name @@ -111,4 +117,4 @@ function addElement( parent, name, value ) text = doc.createTextNode( value ); % create element.appendChild( text ); % add -end % addElement \ No newline at end of file +end % addElement diff --git a/tbx/docmaker/docmakerroot.m b/tbx/docmaker/docmakerroot.m deleted file mode 100644 index c66a92f..0000000 --- a/tbx/docmaker/docmakerroot.m +++ /dev/null @@ -1,12 +0,0 @@ -function folder = docmakerroot() -%DOCMAKERROOT DocMaker root folder. - -% Copyright 2026 The MathWorks, Inc. - -arguments ( Output ) - folder(1, 1) string {mustBeFolder} -end % arguments ( Output ) - -folder = fileparts( mfilename( "fullpath" ) ); - -end % docmakerroot \ No newline at end of file diff --git a/tbx/docmaker/docrun.m b/tbx/docmaker/docrun.m index d98414f..c296df5 100644 --- a/tbx/docmaker/docrun.m +++ b/tbx/docmaker/docrun.m @@ -404,4 +404,4 @@ function runDiv( div, w, theme ) "px; height: auto" ); % apply display scaling picture.appendChild( img ); -end % createResponsiveImage \ No newline at end of file +end % createResponsiveImage diff --git a/tbx/docmaker/resources/copycode.css b/tbx/docmaker/resources/copycode.css index e44a019..b3d375a 100644 --- a/tbx/docmaker/resources/copycode.css +++ b/tbx/docmaker/resources/copycode.css @@ -23,4 +23,4 @@ pre { .copy-button-icon { width: 16px; height: 16px; -} \ No newline at end of file +} diff --git a/tbx/docmaker/resources/copycode.js b/tbx/docmaker/resources/copycode.js index 8dac513..9426459 100644 --- a/tbx/docmaker/resources/copycode.js +++ b/tbx/docmaker/resources/copycode.js @@ -1,3 +1,5 @@ +/* Copyright 2024-2026 The MathWorks, Inc. */ + document.querySelectorAll('pre').forEach(pre => { // Check if the
 element has an ancestor with the class 'highlight-output'
     if (pre.closest('.highlight-output')) {
@@ -100,4 +102,4 @@ function docmakerCopyToClipboard(text, body) {
             body.removeChild(textArea);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/tbx/docmaker/resources/functionSignatures.json b/tbx/docmaker/resources/functionSignatures.json
index 0fce4d1..7d5acd3 100644
--- a/tbx/docmaker/resources/functionSignatures.json
+++ b/tbx/docmaker/resources/functionSignatures.json
@@ -64,6 +64,34 @@
                     "choices={'latex','none'}"
                     ],
                 "purpose": "math interpreter"
+            },
+            {
+                "name": "Converter",
+                "kind": "namevalue",
+                "type": [
+                    "char",
+                    "choices={'cmark','github','gitlab'}"
+                ],
+                "purpose": "Markdown converter"
+            }
+        ]
+    },
+    "docindex": {
+        "inputs": [
+            {
+                "name": "d",
+                "kind": "required",
+                "type": "folder",
+                "purpose": "documentation folder"
+            },
+            {
+                "name": "Converter",
+                "kind": "namevalue",
+                "type": [
+                    "char",
+                    "choices={'cmark','github','gitlab'}"
+                ],
+                "purpose": "Markdown converter"
             }
         ]
     },
@@ -213,4 +241,4 @@
             }
         ]
     }
-}
\ No newline at end of file
+}
diff --git a/tbx/docmaker/resources/helptoc.xsl b/tbx/docmaker/resources/helptoc.xsl
index d5a669d..8ce9c9b 100644
--- a/tbx/docmaker/resources/helptoc.xsl
+++ b/tbx/docmaker/resources/helptoc.xsl
@@ -1,4 +1,5 @@
 
+
 
     
     
@@ -20,4 +21,4 @@
     
     
     
-
\ No newline at end of file
+
diff --git a/tbx/docmaker/resources/mathjax-config.js b/tbx/docmaker/resources/mathjax-config.js
index 72c96db..bab4657 100644
--- a/tbx/docmaker/resources/mathjax-config.js
+++ b/tbx/docmaker/resources/mathjax-config.js
@@ -1,4 +1,6 @@
 // MathJax configuration
+//
+// Copyright 2026 The MathWorks, Inc.
 window.MathJax = {
     tex: {
         inlineMath: [['$', '$']],
@@ -12,4 +14,4 @@ window.MathJax = {
     script.src = "tex-mml-chtml.js";
     script.async = true;
     document.head.appendChild(script);
-})();
\ No newline at end of file
+})();
diff --git a/tbx/docmaker/resources/tex-mml-chtml.js b/tbx/docmaker/resources/tex-mml-chtml.js
index 10315d6..7cc4769 100644
--- a/tbx/docmaker/resources/tex-mml-chtml.js
+++ b/tbx/docmaker/resources/tex-mml-chtml.js
@@ -1 +1 @@
-(()=>{var t,e,s={981(t,e){"use strict";function s(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.getOwnPropertyDescriptors&&(t=e.create(null,e.getOwnPropertyDescriptors(t))),e&&"function"==typeof e.freeze?e.freeze(t):t}function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var r=s({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});var n=s({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});var o=s({script:!1,style:!1,textarea:!0,title:!0});function a(t){return t===l.HTML}var l=s({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),c=Object.keys(l).map(function(t){return l[t]});var h=s({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});e.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var s in e)i(e,s)&&(t[s]=e[s]);return t},e.find=function(t,e,s){if(void 0===s&&(s=Array.prototype),t&&"function"==typeof s.find)return s.find.call(t,e);for(var r=0;r-1},e.MIME_TYPE=l,e.NAMESPACE=h},985(t,e,s){"use strict";var i=s(981),r=s(553),n=s(918),o=s(334),a=s(309),l=r.DOMImplementation,c=i.hasDefaultHTMLNamespace,h=i.isHTMLMimeType,d=i.isValidMimeType,u=i.MIME_TYPE,p=i.NAMESPACE,m=n.ParseError,f=a.XMLReader;function g(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function b(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||i.assign,this.domHandler=t.domHandler||E,this.onError=t.onError||t.errorHandler,t.errorHandler&&"function"!=typeof t.errorHandler)throw new TypeError("errorHandler object is no longer supported, switch to onError!");t.errorHandler&&t.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=t.normalizeLineEndings||g,this.locator=!!t.locator,this.xmlns=this.assign(Object.create(null),t.xmlns)}function E(t){var e=t||{};this.mimeType=e.mimeType||u.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}function x(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function y(t,e,s){return"string"==typeof t?t.substr(e,s):t.length>=e+s||e?new java.lang.String(t,e,s)+"":t}function N(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}b.prototype.parseFromString=function(t,e){if(!d(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var s=this.assign(Object.create(null),this.xmlns),r=o.XML_ENTITIES,n=s[""]||null;c(e)?(r=o.HTML_ENTITIES,n=p.HTML):e===u.XML_SVG_IMAGE&&(n=p.SVG),s[""]=n,s.xml=s.xml||p.XML;var a=new this.domHandler({mimeType:e,defaultNamespace:n,onError:this.onError}),l=this.locator?{}:void 0;this.locator&&a.setDocumentLocator(l);var h=new f;return h.errorHandler=a,h.domBuilder=a,!i.isHTMLMimeType(e)&&"string"!=typeof t&&h.errorHandler.fatalError("source is not a string"),h.parse(this.normalizeLineEndings(String(t)),s,r),a.doc.documentElement||h.errorHandler.fatalError("missing root element"),a.doc},E.prototype={startDocument:function(){var t=new l;this.doc=h(this.mimeType)?t.createHTMLDocument(!1):t.createDocument(this.defaultNamespace,"")},startElement:function(t,e,s,i){var r=this.doc,n=r.createElementNS(t,s||e),o=i.length;N(this,n),this.currentElement=n,this.locator&&x(this.locator,n);for(var a=0;a=0){var n=e.split(":");s=n[0],r=n[1]}if(null!==s&&null===t)throw new m(m.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===s&&t!==i.NAMESPACE.XML)throw new m(m.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===s||"xmlns"===e)&&t!==i.NAMESPACE.XMLNS)throw new m(m.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===i.NAMESPACE.XMLNS&&"xmlns"!==s&&"xmlns"!==e)throw new m(m.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,s,r]}function T(t,e){for(var s in t)o(t,s)&&(e[s]=t[s])}function C(t,e){var s=t.prototype;if(!(s instanceof e)){function i(){}i.prototype=e.prototype,T(s,i=new i),t.prototype=s=i}s.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),s.constructor=t)}var A={},L=A.ELEMENT_NODE=1,S=A.ATTRIBUTE_NODE=2,R=A.TEXT_NODE=3,M=A.CDATA_SECTION_NODE=4,I=A.ENTITY_REFERENCE_NODE=5,w=A.ENTITY_NODE=6,k=A.PROCESSING_INSTRUCTION_NODE=7,O=A.COMMENT_NODE=8,D=A.DOCUMENT_NODE=9,P=A.DOCUMENT_TYPE_NODE=10,B=A.DOCUMENT_FRAGMENT_NODE=11,F=A.NOTATION_NODE=12,j=i.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function _(t,e){if(e.length=0){for(var r=e.length-1;i<=r;)e[i]=e[++i];if(e.length=r,t){var n=t.ownerDocument;n&&tt(n,t,s),s.ownerElement=null}}}function J(){}function K(t){b(t)}function $(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function Y(t,e){Q(t,null,{enter:function(t){return!e(t)||Q.STOP}})}function Q(t,e,s){for(var i=[{node:t,context:e,phase:Q.ENTER}];i.length>0;){var r=i.pop();if(r.phase===Q.ENTER){var n=s.enter(r.node,r.context);if(n===Q.STOP)return Q.STOP;if(i.push({node:r.node,context:n,phase:Q.EXIT}),null==n)continue;for(var o=r.node.lastChild;o;)i.push({node:o,context:n,phase:Q.ENTER}),o=o.previousSibling}else s.exit&&s.exit(r.node,r.context)}}function Z(t,e){b(t);var s=e||{};this.ownerDocument=this,this.contentType=s.contentType||h.XML_APPLICATION,this.type=a(this.contentType)?"html":"xml"}function tt(t,e,s,i){t&&t._inc++,s.namespaceURI===d.XMLNS&&delete e._nsMap[s.prefix?s.localName:""]}function et(t,e,s){if(t&&t._inc){t._inc++;var i=e.childNodes;if(s&&!s.nextSibling)i[i.length++]=s;else{for(var r=e.firstChild,n=0;r;)i[n++]=r,r=r.nextSibling;i.length=n,delete i[i.length]}}}function st(t,e){if(t!==e.parentNode)throw new m(m.NOT_FOUND_ERR,"child's parent is not parent");var s=e.previousSibling,i=e.nextSibling;return s?s.nextSibling=i:t.firstChild=i,i?i.previousSibling=s:t.lastChild=s,et(t.ownerDocument,t),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function it(t){return t&&t.nodeType===K.DOCUMENT_TYPE_NODE}function rt(t){return t&&t.nodeType===K.ELEMENT_NODE}function nt(t){return t&&t.nodeType===K.TEXT_NODE}function ot(t,e){var s=t.childNodes||[];if(r(s,rt)||it(e))return!1;var i=r(s,it);return!(e&&i&&s.indexOf(i)>s.indexOf(e))}function at(t,e){var s=t.childNodes||[];if(r(s,function(t){return rt(t)&&t!==e}))return!1;var i=r(s,it);return!(e&&i&&s.indexOf(i)>s.indexOf(e))}function lt(t,e,s){if(!function(t){return t&&(t.nodeType===K.DOCUMENT_NODE||t.nodeType===K.DOCUMENT_FRAGMENT_NODE||t.nodeType===K.ELEMENT_NODE)}(t))throw new m(m.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+t.nodeType);if(s&&s.parentNode!==t)throw new m(m.NOT_FOUND_ERR,"child not in parent");if(!function(t){return t&&(t.nodeType===K.CDATA_SECTION_NODE||t.nodeType===K.COMMENT_NODE||t.nodeType===K.DOCUMENT_FRAGMENT_NODE||t.nodeType===K.DOCUMENT_TYPE_NODE||t.nodeType===K.ELEMENT_NODE||t.nodeType===K.PROCESSING_INSTRUCTION_NODE||t.nodeType===K.TEXT_NODE)}(e)||it(e)&&t.nodeType!==K.DOCUMENT_NODE)throw new m(m.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function ct(t,e,s){var i=t.childNodes||[],n=e.childNodes||[];if(e.nodeType===K.DOCUMENT_FRAGMENT_NODE){var o=n.filter(rt);if(o.length>1||r(n,nt))throw new m(m.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!ot(t,s))throw new m(m.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(rt(e)&&!ot(t,s))throw new m(m.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(it(e)){if(r(i,it))throw new m(m.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=r(i,rt);if(s&&i.indexOf(a)1||r(n,nt))throw new m(m.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!at(t,s))throw new m(m.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(rt(e)&&!at(t,s))throw new m(m.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(it(e)){function l(t){return it(t)&&t!==s}if(r(i,l))throw new m(m.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=r(i,rt);if(s&&i.indexOf(a)=0;N--){if(""===(v=h[N]).prefix&&v.namespace===t.namespaceURI){x=v.namespace;break}}if(x!==t.namespaceURI)for(N=h.length-1;N>=0;N--){var v;if((v=h[N]).namespace===t.namespaceURI){v.prefix&&(E=v.prefix+":"+b);break}}}e.push("<",E);for(var T=h.slice(),C=0;C"),null;if(e.push(">"),a&&l(b)){for(var H=t.firstChild;H;)H.data?e.push(H.data):Rt(H,e,T.slice(),i),H=H.nextSibling;return e.push(""),null}return{ns:T,tag:E};case D:case B:if(n&&t.nodeType===D&&null==t.documentElement)throw new m("The Document has no documentElement",f.InvalidStateError);return{ns:h};case S:return St(e,t.name,t.value),null;case R:if(n&&g.InvalidChar.test(t.data))throw new m("The Text node data contains characters outside the XML Char production",f.InvalidStateError);return e.push(t.data.replace(/[<&>]/g,$)),null;case M:if(n&&-1!==t.data.indexOf("]]>"))throw new m('The CDATASection data contains "]]>"',f.InvalidStateError);return o?e.push(g.CDATA_START,t.data.replace(/]]>/g,"]]]]>"),g.CDATA_END):e.push(g.CDATA_START,t.data,g.CDATA_END),null;case O:if(n){if(g.InvalidChar.test(t.data))throw new m("The comment node data contains characters outside the XML Char production",f.InvalidStateError);if(-1!==t.data.indexOf("--")||"-"===t.data[t.data.length-1])throw new m('The comment node data contains "--" or ends with "-"',f.InvalidStateError)}return e.push(g.COMMENT_START,t.data,g.COMMENT_END),null;case P:var W=t.publicId,z=t.systemId;if(n){if(W&&!g.PubidLiteral_match.test(W))throw new m("DocumentType publicId is not a valid PubidLiteral",f.InvalidStateError);if(z&&"."!==z&&!g.SystemLiteral_match.test(z))throw new m("DocumentType systemId is not a valid SystemLiteral",f.InvalidStateError);if(t.internalSubset&&-1!==t.internalSubset.indexOf("]>"))throw new m('DocumentType internalSubset contains "]>"',f.InvalidStateError)}return e.push(g.DOCTYPE_DECL_START," ",t.name),W?(e.push(" ",g.PUBLIC," ",W),z&&"."!==z&&e.push(" ",z)):z&&"."!==z&&e.push(" ",g.SYSTEM," ",z),t.internalSubset&&e.push(" [",t.internalSubset,"]"),e.push(">"),null;case k:if(n){if(-1!==t.target.indexOf(":")||"xml"===t.target.toLowerCase())throw new m("The ProcessingInstruction target is not well-formed",f.InvalidStateError);if(g.InvalidChar.test(t.data))throw new m("The ProcessingInstruction data contains characters outside the XML Char production",f.InvalidStateError);if(-1!==t.data.indexOf("?>"))throw new m('The ProcessingInstruction data contains "?>"',f.InvalidStateError)}return e.push(""),null;case I:return e.push("&",t.nodeName,";"),null;default:return e.push("??",t.nodeName),null}},exit:function(t,s){s&&s.tag&&e.push("")}})}function Mt(t,e,s){var i;return Q(e,null,{enter:function(e,r){var n=new e.constructor(u);for(var a in e)if(o(e,a)){var l=e[a];"object"!=typeof l&&l!=n[a]&&(n[a]=l)}e.childNodes&&(n.childNodes=new H),n.ownerDocument=t;var c=s;switch(n.nodeType){case L:var h=e.attributes,d=n.attributes=new q,p=h.length;d._ownerElement=n;for(var m=0;m=0&&t0;){var s=e.pop(),i=s.node,r=s.other;if(i.nodeType!==r.nodeType)return!1;switch(i.nodeType){case i.DOCUMENT_TYPE_NODE:if(i.name!==r.name)return!1;if(i.publicId!==r.publicId)return!1;if(i.systemId!==r.systemId)return!1;break;case i.ELEMENT_NODE:if(i.namespaceURI!==r.namespaceURI)return!1;if(i.prefix!==r.prefix)return!1;if(i.localName!==r.localName)return!1;if(i.attributes.length!==r.attributes.length)return!1;for(var n=0;n=0;n--)e.push({node:i.childNodes[n],other:r.childNodes[n]})}return!0},isSameNode:function(t){return this===t},insertBefore:function(t,e){return dt(this,t,e)},replaceChild:function(t,e){dt(this,t,e,ht),e&&this.removeChild(e)},removeChild:function(t){return st(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Mt(this.ownerDocument||this,this,t)},normalize:function(){Q(this,null,{enter:function(t){for(var e=t.firstChild;e;){var s=e.nextSibling;null!==s&&s.nodeType===R&&e.nodeType===R?(t.removeChild(s),e.appendData(s.data)):e=s}return!0}})},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},lookupPrefix:function(t){for(var e=this;e;){var s=e._nsMap;if(s)for(var i in s)if(o(s,i)&&s[i]===t)return i;e=e.nodeType==S?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var s=e._nsMap;if(s&&o(s,t))return s[t];e=e.nodeType==S?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)},compareDocumentPosition:function(t){if(this===t)return 0;var e=t,s=this,i=null,r=null;if(e instanceof pt&&(e=(i=e).ownerElement),s instanceof pt&&(s=(r=s).ownerElement,i&&e&&s===e))for(var n,o=0;n=s.attributes[o];o++){if(n===i)return j.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+j.DOCUMENT_POSITION_PRECEDING;if(n===r)return j.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+j.DOCUMENT_POSITION_FOLLOWING}if(!e||!s||s.ownerDocument!==e.ownerDocument)return j.DOCUMENT_POSITION_DISCONNECTED+j.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(U(s.ownerDocument)>U(e.ownerDocument)?j.DOCUMENT_POSITION_FOLLOWING:j.DOCUMENT_POSITION_PRECEDING);if(r&&e===s)return j.DOCUMENT_POSITION_CONTAINS+j.DOCUMENT_POSITION_PRECEDING;if(i&&e===s)return j.DOCUMENT_POSITION_CONTAINED_BY+j.DOCUMENT_POSITION_FOLLOWING;for(var a=[],l=e.parentNode;l;){if(!r&&l===s)return j.DOCUMENT_POSITION_CONTAINED_BY+j.DOCUMENT_POSITION_FOLLOWING;a.push(l),l=l.parentNode}a.reverse();for(var c=[],h=s.parentNode;h;){if(!i&&h===e)return j.DOCUMENT_POSITION_CONTAINS+j.DOCUMENT_POSITION_PRECEDING;c.push(h),h=h.parentNode}c.reverse();var d=_(a,c);for(var u in d.childNodes){var p=d.childNodes[u];if(p===s)return j.DOCUMENT_POSITION_FOLLOWING;if(p===e)return j.DOCUMENT_POSITION_PRECEDING;if(c.indexOf(p)>=0)return j.DOCUMENT_POSITION_FOLLOWING;if(a.indexOf(p)>=0)return j.DOCUMENT_POSITION_PRECEDING}return 0}},T(A,K),T(A,K.prototype),T(j,K),T(j,K.prototype),Q.STOP=Symbol("walkDOM.STOP"),Q.ENTER=0,Q.EXIT=1,Z.prototype={implementation:null,nodeName:"#document",nodeType:D,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType===B){for(var s=t.firstChild;s;){var i=s.nextSibling;this.insertBefore(s,e),s=i}return t}return dt(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===L&&(this.documentElement=t),t},removeChild:function(t){var e=st(this,t);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(t,e){dt(this,t,e,ht),t.ownerDocument=this,e&&this.removeChild(e),rt(t)&&(this.documentElement=t)},importNode:function(t,e){return function(t,e,s){var i;return Q(e,null,{enter:function(e,r){var n=e.cloneNode(!1);return n.ownerDocument=t,n.parentNode=null,null===r?i=n:r.appendChild(n),e.nodeType===S||s?n:null}}),i}(this,t,e)},getElementById:function(t){var e=null;return Y(this.documentElement,function(s){if(s.nodeType==L&&s.getAttribute("id")==t)return e=s,!0}),e},createElement:function(t){var e=new ut(u);return e.ownerDocument=this,"html"===this.type&&(t=t.toLowerCase()),n(this.contentType)&&(e.namespaceURI=d.HTML),e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new H,(e.attributes=new q)._ownerElement=e,e},createDocumentFragment:function(){var t=new vt(u);return t.ownerDocument=this,t.childNodes=new H,t},createTextNode:function(t){var e=new ft(u);return e.ownerDocument=this,e.childNodes=new H,e.appendData(t),e},createComment:function(t){var e=new gt(u);return e.ownerDocument=this,e.childNodes=new H,e.appendData(t),e},createCDATASection:function(t){if(-1!==t.indexOf("]]>"))throw new m(m.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new bt(u);return e.ownerDocument=this,e.childNodes=new H,e.appendData(t),e},createProcessingInstruction:function(t,e){var s=new Tt(u);return s.ownerDocument=this,s.childNodes=new H,s.nodeName=s.target=t,s.nodeValue=s.data=e,s},createAttribute:function(t){if(!g.QName_exact.test(t))throw new m(m.INVALID_CHARACTER_ERR,'invalid character in name "'+t+'"');return"html"===this.type&&(t=t.toLowerCase()),this._createAttribute(t)},_createAttribute:function(t){var e=new pt(u);return e.ownerDocument=this,e.childNodes=new H,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){if(!g.Name.test(t))throw new m(m.INVALID_CHARACTER_ERR,'not a valid xml name "'+t+'"');if("html"===this.type)throw new m("document is an html document",f.NotSupportedError);var e=new Nt(u);return e.ownerDocument=this,e.childNodes=new H,e.nodeName=t,e},createElementNS:function(t,e){var s=v(t,e),i=new ut(u),r=i.attributes=new q;return i.childNodes=new H,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=s[0],i.prefix=s[1],i.localName=s[2],r._ownerElement=i,i},createAttributeNS:function(t,e){var s=v(t,e),i=new pt(u);return i.ownerDocument=this,i.childNodes=new H,i.nodeName=e,i.name=e,i.specified=!0,i.namespaceURI=s[0],i.prefix=s[1],i.localName=s[2],i}},C(Z,K),ut.prototype={nodeType:L,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===d.HTML},hasAttributes:function(){return!(!this.attributes||!this.attributes.length)},hasAttribute:function(t){return!!this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e?e.value:null},getAttributeNode:function(t){return this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase()),this.attributes.getNamedItem(t)},setAttribute:function(t,e){this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());var s=this.getAttributeNode(t);s?s.value=s.nodeValue=""+e:((s=this.ownerDocument._createAttribute(t)).value=s.nodeValue=""+e,this.setAttributeNode(s))},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var s=this.getAttributeNodeNS(t,e);s&&this.removeAttributeNode(s)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var s=this.getAttributeNodeNS(t,e);return s?s.value:null},setAttributeNS:function(t,e,s){var i=v(t,e)[2],r=this.getAttributeNodeNS(t,i);r?r.value=r.nodeValue=""+s:((r=this.ownerDocument.createAttributeNS(t,e)).value=r.nodeValue=""+s,this.setAttributeNode(r))},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByClassName:function(t){var e=y(t);return new W(this,function(s){var i=[];return e.length>0&&Y(s,function(r){if(r!==s&&r.nodeType===L){var n=r.getAttribute("class");if(n){var o=t===n;if(!o){var a=y(n);o=e.every((l=a,function(t){return l&&-1!==l.indexOf(t)}))}o&&i.push(r)}}var l}),i})},getElementsByTagName:function(t){var e="html"===(this.nodeType===D?this:this.ownerDocument).type,s=t.toLowerCase();return new W(this,function(i){var r=[];return Y(i,function(n){n!==i&&n.nodeType===L&&(("*"===t||n.getQualifiedName()===(e&&n.namespaceURI===d.HTML?s:t))&&r.push(n))}),r})},getElementsByTagNameNS:function(t,e){return new W(this,function(s){var i=[];return Y(s,function(r){r===s||r.nodeType!==L||"*"!==t&&r.namespaceURI!==t||"*"!==e&&r.localName!=e||i.push(r)}),i})}},Z.prototype.getElementsByClassName=ut.prototype.getElementsByClassName,Z.prototype.getElementsByTagName=ut.prototype.getElementsByTagName,Z.prototype.getElementsByTagNameNS=ut.prototype.getElementsByTagNameNS,C(ut,K),pt.prototype.nodeType=S,C(pt,K),mt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,s){s=this.data.substring(0,t)+s+this.data.substring(t+e),this.nodeValue=this.data=s,this.length=s.length}},C(mt,K),ft.prototype={nodeName:"#text",nodeType:R,splitText:function(t){var e=this.data,s=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var i=this.ownerDocument.createTextNode(s);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},C(ft,mt),gt.prototype={nodeName:"#comment",nodeType:O},C(gt,mt),bt.prototype={nodeName:"#cdata-section",nodeType:M},C(bt,ft),Et.prototype.nodeType=P,C(Et,K),xt.prototype.nodeType=F,C(xt,K),yt.prototype.nodeType=w,C(yt,K),Nt.prototype.nodeType=I,C(Nt,K),vt.prototype.nodeName="#document-fragment",vt.prototype.nodeType=B,C(vt,K),Tt.prototype.nodeType=k,C(Tt,mt),Ct.prototype.serializeToString=function(t,e){return At.call(t,e)},K.prototype.toString=At;try{Object.defineProperty&&(Object.defineProperty(W.prototype,"length",{get:function(){return z(this),this.$$length}}),Object.defineProperty(K.prototype,"textContent",{get:function(){if(this.nodeType===L||this.nodeType===B){var t=[];return Q(this,null,{enter:function(e){return e.nodeType===L||e.nodeType===B||(e.nodeType===k||e.nodeType===O?null:void t.push(e.nodeValue))}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case L:case B:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Object.defineProperty(ut.prototype,"children",{get:function(){return new W(this,wt)}}),Object.defineProperty(Z.prototype,"children",{get:function(){return new W(this,wt)}}),Object.defineProperty(vt.prototype,"children",{get:function(){return new W(this,wt)}}),It=function(t,e,s){t["$$"+e]=s})}catch(t){}e._updateLiveList=z,e.Attr=pt,e.CDATASection=bt,e.CharacterData=mt,e.Comment=gt,e.Document=Z,e.DocumentFragment=vt,e.DocumentType=Et,e.DOMImplementation=J,e.Element=ut,e.Entity=yt,e.EntityReference=Nt,e.LiveNodeList=W,e.NamedNodeMap=q,e.Node=K,e.NodeList=H,e.Notation=xt,e.Text=ft,e.ProcessingInstruction=Tt,e.walkDOM=Q,e.XMLSerializer=Ct},334(t,e,s){"use strict";var i=s(981).freeze;e.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=i({Aacute:"\xc1",aacute:"\xe1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223e",acd:"\u223f",acE:"\u223e\u0333",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"\u0410",acy:"\u0430",AElig:"\xc6",aelig:"\xe6",af:"\u2061",Afr:"\u{1d504}",afr:"\u{1d51e}",Agrave:"\xc0",agrave:"\xe0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03b1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2a3f",AMP:"&",amp:"&",And:"\u2a53",and:"\u2227",andand:"\u2a55",andd:"\u2a5c",andslope:"\u2a58",andv:"\u2a5a",ang:"\u2220",ange:"\u29a4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29a8",angmsdab:"\u29a9",angmsdac:"\u29aa",angmsdad:"\u29ab",angmsdae:"\u29ac",angmsdaf:"\u29ad",angmsdag:"\u29ae",angmsdah:"\u29af",angrt:"\u221f",angrtvb:"\u22be",angrtvbd:"\u299d",angsph:"\u2222",angst:"\xc5",angzarr:"\u237c",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1d538}",aopf:"\u{1d552}",ap:"\u2248",apacir:"\u2a6f",apE:"\u2a70",ape:"\u224a",apid:"\u224b",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224a",Aring:"\xc5",aring:"\xe5",Ascr:"\u{1d49c}",ascr:"\u{1d4b6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224d",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",awconint:"\u2233",awint:"\u2a11",backcong:"\u224c",backepsilon:"\u03f6",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",Backslash:"\u2216",Barv:"\u2ae7",barvee:"\u22bd",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23b5",bbrktbrk:"\u23b6",bcong:"\u224c",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201e",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29b0",bepsi:"\u03f6",bernou:"\u212c",Bernoullis:"\u212c",Beta:"\u0392",beta:"\u03b2",beth:"\u2136",between:"\u226c",Bfr:"\u{1d505}",bfr:"\u{1d51f}",bigcap:"\u22c2",bigcirc:"\u25ef",bigcup:"\u22c3",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",bigvee:"\u22c1",bigwedge:"\u22c0",bkarow:"\u290d",blacklozenge:"\u29eb",blacksquare:"\u25aa",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20e5",bnequiv:"\u2261\u20e5",bNot:"\u2aed",bnot:"\u2310",Bopf:"\u{1d539}",bopf:"\u{1d553}",bot:"\u22a5",bottom:"\u22a5",bowtie:"\u22c8",boxbox:"\u29c9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250c",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252c",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxUL:"\u255d",boxUl:"\u255c",boxuL:"\u255b",boxul:"\u2518",boxUR:"\u255a",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256c",boxVh:"\u256b",boxvH:"\u256a",boxvh:"\u253c",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255f",boxvR:"\u255e",boxvr:"\u251c",bprime:"\u2035",Breve:"\u02d8",breve:"\u02d8",brvbar:"\xa6",Bscr:"\u212c",bscr:"\u{1d4b7}",bsemi:"\u204f",bsim:"\u223d",bsime:"\u22cd",bsol:"\\",bsolb:"\u29c5",bsolhsub:"\u27c8",bull:"\u2022",bullet:"\u2022",bump:"\u224e",bumpE:"\u2aae",bumpe:"\u224f",Bumpeq:"\u224e",bumpeq:"\u224f",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22d2",cap:"\u2229",capand:"\u2a44",capbrcup:"\u2a49",capcap:"\u2a4b",capcup:"\u2a47",capdot:"\u2a40",CapitalDifferentialD:"\u2145",caps:"\u2229\ufe00",caret:"\u2041",caron:"\u02c7",Cayleys:"\u212d",ccaps:"\u2a4d",Ccaron:"\u010c",ccaron:"\u010d",Ccedil:"\xc7",ccedil:"\xe7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2a4c",ccupssm:"\u2a50",Cdot:"\u010a",cdot:"\u010b",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"\u29b2",cent:"\xa2",CenterDot:"\xb7",centerdot:"\xb7",Cfr:"\u212d",cfr:"\u{1d520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03a7",chi:"\u03c7",cir:"\u25cb",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",CircleDot:"\u2299",circledR:"\xae",circledS:"\u24c8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29c3",cire:"\u2257",cirfnint:"\u2a10",cirmid:"\u2aef",cirscir:"\u29c2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201d",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2a74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2a6d",Congruent:"\u2261",Conint:"\u222f",conint:"\u222e",ContourIntegral:"\u222e",Copf:"\u2102",copf:"\u{1d554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xa9",copy:"\xa9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21b5",Cross:"\u2a2f",cross:"\u2717",Cscr:"\u{1d49e}",cscr:"\u{1d4b8}",csub:"\u2acf",csube:"\u2ad1",csup:"\u2ad0",csupe:"\u2ad2",ctdot:"\u22ef",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22de",cuesc:"\u22df",cularr:"\u21b6",cularrp:"\u293d",Cup:"\u22d3",cup:"\u222a",cupbrcap:"\u2a48",CupCap:"\u224d",cupcap:"\u2a46",cupcup:"\u2a4a",cupdot:"\u228d",cupor:"\u2a45",cups:"\u222a\ufe00",curarr:"\u21b7",curarrm:"\u293c",curlyeqprec:"\u22de",curlyeqsucc:"\u22df",curlyvee:"\u22ce",curlywedge:"\u22cf",curren:"\xa4",curvearrowleft:"\u21b6",curvearrowright:"\u21b7",cuvee:"\u22ce",cuwed:"\u22cf",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232d",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21a1",dArr:"\u21d3",darr:"\u2193",dash:"\u2010",Dashv:"\u2ae4",dashv:"\u22a3",dbkarow:"\u290f",dblac:"\u02dd",Dcaron:"\u010e",dcaron:"\u010f",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21ca",DDotrahd:"\u2911",ddotseq:"\u2a77",deg:"\xb0",Del:"\u2207",Delta:"\u0394",delta:"\u03b4",demptyv:"\u29b1",dfisht:"\u297f",Dfr:"\u{1d507}",dfr:"\u{1d521}",dHar:"\u2965",dharl:"\u21c3",dharr:"\u21c2",DiacriticalAcute:"\xb4",DiacriticalDot:"\u02d9",DiacriticalDoubleAcute:"\u02dd",DiacriticalGrave:"`",DiacriticalTilde:"\u02dc",diam:"\u22c4",Diamond:"\u22c4",diamond:"\u22c4",diamondsuit:"\u2666",diams:"\u2666",die:"\xa8",DifferentialD:"\u2146",digamma:"\u03dd",disin:"\u22f2",div:"\xf7",divide:"\xf7",divideontimes:"\u22c7",divonx:"\u22c7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231e",dlcrop:"\u230d",dollar:"$",Dopf:"\u{1d53b}",dopf:"\u{1d555}",Dot:"\xa8",dot:"\u02d9",DotDot:"\u20dc",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22a1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222f",DoubleDot:"\xa8",DoubleDownArrow:"\u21d3",DoubleLeftArrow:"\u21d0",DoubleLeftRightArrow:"\u21d4",DoubleLeftTee:"\u2ae4",DoubleLongLeftArrow:"\u27f8",DoubleLongLeftRightArrow:"\u27fa",DoubleLongRightArrow:"\u27f9",DoubleRightArrow:"\u21d2",DoubleRightTee:"\u22a8",DoubleUpArrow:"\u21d1",DoubleUpDownArrow:"\u21d5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21d3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21f5",DownBreve:"\u0311",downdownarrows:"\u21ca",downharpoonleft:"\u21c3",downharpoonright:"\u21c2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295e",DownLeftVector:"\u21bd",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295f",DownRightVector:"\u21c1",DownRightVectorBar:"\u2957",DownTee:"\u22a4",DownTeeArrow:"\u21a7",drbkarow:"\u2910",drcorn:"\u231f",drcrop:"\u230c",Dscr:"\u{1d49f}",dscr:"\u{1d4b9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29f6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22f1",dtri:"\u25bf",dtrif:"\u25be",duarr:"\u21f5",duhar:"\u296f",dwangle:"\u29a6",DZcy:"\u040f",dzcy:"\u045f",dzigrarr:"\u27ff",Eacute:"\xc9",eacute:"\xe9",easter:"\u2a6e",Ecaron:"\u011a",ecaron:"\u011b",ecir:"\u2256",Ecirc:"\xca",ecirc:"\xea",ecolon:"\u2255",Ecy:"\u042d",ecy:"\u044d",eDDot:"\u2a77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1d508}",efr:"\u{1d522}",eg:"\u2a9a",Egrave:"\xc8",egrave:"\xe8",egs:"\u2a96",egsdot:"\u2a98",el:"\u2a99",Element:"\u2208",elinters:"\u23e7",ell:"\u2113",els:"\u2a95",elsdot:"\u2a97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25fb",emptyv:"\u2205",EmptyVerySmallSquare:"\u25ab",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014a",eng:"\u014b",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1d53c}",eopf:"\u{1d556}",epar:"\u22d5",eparsl:"\u29e3",eplus:"\u2a71",epsi:"\u03b5",Epsilon:"\u0395",epsilon:"\u03b5",epsiv:"\u03f5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2a96",eqslantless:"\u2a95",Equal:"\u2a75",equals:"=",EqualTilde:"\u2242",equest:"\u225f",Equilibrium:"\u21cc",equiv:"\u2261",equivDD:"\u2a78",eqvparsl:"\u29e5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212f",esdot:"\u2250",Esim:"\u2a73",esim:"\u2242",Eta:"\u0397",eta:"\u03b7",ETH:"\xd0",eth:"\xf0",Euml:"\xcb",euml:"\xeb",euro:"\u20ac",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\ufb03",fflig:"\ufb00",ffllig:"\ufb04",Ffr:"\u{1d509}",ffr:"\u{1d523}",filig:"\ufb01",FilledSmallSquare:"\u25fc",FilledVerySmallSquare:"\u25aa",fjlig:"fj",flat:"\u266d",fllig:"\ufb02",fltns:"\u25b1",fnof:"\u0192",Fopf:"\u{1d53d}",fopf:"\u{1d557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22d4",forkv:"\u2ad9",Fouriertrf:"\u2131",fpartint:"\u2a0d",frac12:"\xbd",frac13:"\u2153",frac14:"\xbc",frac15:"\u2155",frac16:"\u2159",frac18:"\u215b",frac23:"\u2154",frac25:"\u2156",frac34:"\xbe",frac35:"\u2157",frac38:"\u215c",frac45:"\u2158",frac56:"\u215a",frac58:"\u215d",frac78:"\u215e",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1d4bb}",gacute:"\u01f5",Gamma:"\u0393",gamma:"\u03b3",Gammad:"\u03dc",gammad:"\u03dd",gap:"\u2a86",Gbreve:"\u011e",gbreve:"\u011f",Gcedil:"\u0122",Gcirc:"\u011c",gcirc:"\u011d",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2a8c",gel:"\u22db",geq:"\u2265",geqq:"\u2267",geqslant:"\u2a7e",ges:"\u2a7e",gescc:"\u2aa9",gesdot:"\u2a80",gesdoto:"\u2a82",gesdotol:"\u2a84",gesl:"\u22db\ufe00",gesles:"\u2a94",Gfr:"\u{1d50a}",gfr:"\u{1d524}",Gg:"\u22d9",gg:"\u226b",ggg:"\u22d9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2aa5",glE:"\u2a92",glj:"\u2aa4",gnap:"\u2a8a",gnapprox:"\u2a8a",gnE:"\u2269",gne:"\u2a88",gneq:"\u2a88",gneqq:"\u2269",gnsim:"\u22e7",Gopf:"\u{1d53e}",gopf:"\u{1d558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22db",GreaterFullEqual:"\u2267",GreaterGreater:"\u2aa2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2a7e",GreaterTilde:"\u2273",Gscr:"\u{1d4a2}",gscr:"\u210a",gsim:"\u2273",gsime:"\u2a8e",gsiml:"\u2a90",Gt:"\u226b",GT:">",gt:">",gtcc:"\u2aa7",gtcir:"\u2a7a",gtdot:"\u22d7",gtlPar:"\u2995",gtquest:"\u2a7c",gtrapprox:"\u2a86",gtrarr:"\u2978",gtrdot:"\u22d7",gtreqless:"\u22db",gtreqqless:"\u2a8c",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\ufe00",gvnE:"\u2269\ufe00",Hacek:"\u02c7",hairsp:"\u200a",half:"\xbd",hamilt:"\u210b",HARDcy:"\u042a",hardcy:"\u044a",hArr:"\u21d4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21ad",Hat:"^",hbar:"\u210f",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22b9",Hfr:"\u210c",hfr:"\u{1d525}",HilbertSpace:"\u210b",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21ff",homtht:"\u223b",hookleftarrow:"\u21a9",hookrightarrow:"\u21aa",Hopf:"\u210d",hopf:"\u{1d559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210b",hscr:"\u{1d4bd}",hslash:"\u210f",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224e",HumpEqual:"\u224f",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xcd",iacute:"\xed",ic:"\u2063",Icirc:"\xce",icirc:"\xee",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xa1",iff:"\u21d4",Ifr:"\u2111",ifr:"\u{1d526}",Igrave:"\xcc",igrave:"\xec",ii:"\u2148",iiiint:"\u2a0c",iiint:"\u222d",iinfin:"\u29dc",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012a",imacr:"\u012b",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22b7",imped:"\u01b5",Implies:"\u21d2",in:"\u2208",incare:"\u2105",infin:"\u221e",infintie:"\u29dd",inodot:"\u0131",Int:"\u222c",int:"\u222b",intcal:"\u22ba",integers:"\u2124",Integral:"\u222b",intercal:"\u22ba",Intersection:"\u22c2",intlarhk:"\u2a17",intprod:"\u2a3c",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012e",iogon:"\u012f",Iopf:"\u{1d540}",iopf:"\u{1d55a}",Iota:"\u0399",iota:"\u03b9",iprod:"\u2a3c",iquest:"\xbf",Iscr:"\u2110",iscr:"\u{1d4be}",isin:"\u2208",isindot:"\u22f5",isinE:"\u22f9",isins:"\u22f4",isinsv:"\u22f3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xcf",iuml:"\xef",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1d50d}",jfr:"\u{1d527}",jmath:"\u0237",Jopf:"\u{1d541}",jopf:"\u{1d55b}",Jscr:"\u{1d4a5}",jscr:"\u{1d4bf}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039a",kappa:"\u03ba",kappav:"\u03f0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041a",kcy:"\u043a",Kfr:"\u{1d50e}",kfr:"\u{1d528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040c",kjcy:"\u045c",Kopf:"\u{1d542}",kopf:"\u{1d55c}",Kscr:"\u{1d4a6}",kscr:"\u{1d4c0}",lAarr:"\u21da",Lacute:"\u0139",lacute:"\u013a",laemptyv:"\u29b4",lagran:"\u2112",Lambda:"\u039b",lambda:"\u03bb",Lang:"\u27ea",lang:"\u27e8",langd:"\u2991",langle:"\u27e8",lap:"\u2a85",Laplacetrf:"\u2112",laquo:"\xab",Larr:"\u219e",lArr:"\u21d0",larr:"\u2190",larrb:"\u21e4",larrbfs:"\u291f",larrfs:"\u291d",larrhk:"\u21a9",larrlp:"\u21ab",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21a2",lat:"\u2aab",lAtail:"\u291b",latail:"\u2919",late:"\u2aad",lates:"\u2aad\ufe00",lBarr:"\u290e",lbarr:"\u290c",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298b",lbrksld:"\u298f",lbrkslu:"\u298d",Lcaron:"\u013d",lcaron:"\u013e",Lcedil:"\u013b",lcedil:"\u013c",lceil:"\u2308",lcub:"{",Lcy:"\u041b",lcy:"\u043b",ldca:"\u2936",ldquo:"\u201c",ldquor:"\u201e",ldrdhar:"\u2967",ldrushar:"\u294b",ldsh:"\u21b2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27e8",LeftArrow:"\u2190",Leftarrow:"\u21d0",leftarrow:"\u2190",LeftArrowBar:"\u21e4",LeftArrowRightArrow:"\u21c6",leftarrowtail:"\u21a2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27e6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21c3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230a",leftharpoondown:"\u21bd",leftharpoonup:"\u21bc",leftleftarrows:"\u21c7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21d4",leftrightarrow:"\u2194",leftrightarrows:"\u21c6",leftrightharpoons:"\u21cb",leftrightsquigarrow:"\u21ad",LeftRightVector:"\u294e",LeftTee:"\u22a3",LeftTeeArrow:"\u21a4",LeftTeeVector:"\u295a",leftthreetimes:"\u22cb",LeftTriangle:"\u22b2",LeftTriangleBar:"\u29cf",LeftTriangleEqual:"\u22b4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21bf",LeftUpVectorBar:"\u2958",LeftVector:"\u21bc",LeftVectorBar:"\u2952",lEg:"\u2a8b",leg:"\u22da",leq:"\u2264",leqq:"\u2266",leqslant:"\u2a7d",les:"\u2a7d",lescc:"\u2aa8",lesdot:"\u2a7f",lesdoto:"\u2a81",lesdotor:"\u2a83",lesg:"\u22da\ufe00",lesges:"\u2a93",lessapprox:"\u2a85",lessdot:"\u22d6",lesseqgtr:"\u22da",lesseqqgtr:"\u2a8b",LessEqualGreater:"\u22da",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2aa1",lesssim:"\u2272",LessSlantEqual:"\u2a7d",LessTilde:"\u2272",lfisht:"\u297c",lfloor:"\u230a",Lfr:"\u{1d50f}",lfr:"\u{1d529}",lg:"\u2276",lgE:"\u2a91",lHar:"\u2962",lhard:"\u21bd",lharu:"\u21bc",lharul:"\u296a",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22d8",ll:"\u226a",llarr:"\u21c7",llcorner:"\u231e",Lleftarrow:"\u21da",llhard:"\u296b",lltri:"\u25fa",Lmidot:"\u013f",lmidot:"\u0140",lmoust:"\u23b0",lmoustache:"\u23b0",lnap:"\u2a89",lnapprox:"\u2a89",lnE:"\u2268",lne:"\u2a87",lneq:"\u2a87",lneqq:"\u2268",lnsim:"\u22e6",loang:"\u27ec",loarr:"\u21fd",lobrk:"\u27e6",LongLeftArrow:"\u27f5",Longleftarrow:"\u27f8",longleftarrow:"\u27f5",LongLeftRightArrow:"\u27f7",Longleftrightarrow:"\u27fa",longleftrightarrow:"\u27f7",longmapsto:"\u27fc",LongRightArrow:"\u27f6",Longrightarrow:"\u27f9",longrightarrow:"\u27f6",looparrowleft:"\u21ab",looparrowright:"\u21ac",lopar:"\u2985",Lopf:"\u{1d543}",lopf:"\u{1d55d}",loplus:"\u2a2d",lotimes:"\u2a34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25ca",lozenge:"\u25ca",lozf:"\u29eb",lpar:"(",lparlt:"\u2993",lrarr:"\u21c6",lrcorner:"\u231f",lrhar:"\u21cb",lrhard:"\u296d",lrm:"\u200e",lrtri:"\u22bf",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1d4c1}",Lsh:"\u21b0",lsh:"\u21b0",lsim:"\u2272",lsime:"\u2a8d",lsimg:"\u2a8f",lsqb:"[",lsquo:"\u2018",lsquor:"\u201a",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226a",LT:"<",lt:"<",ltcc:"\u2aa6",ltcir:"\u2a79",ltdot:"\u22d6",lthree:"\u22cb",ltimes:"\u22c9",ltlarr:"\u2976",ltquest:"\u2a7b",ltri:"\u25c3",ltrie:"\u22b4",ltrif:"\u25c2",ltrPar:"\u2996",lurdshar:"\u294a",luruhar:"\u2966",lvertneqq:"\u2268\ufe00",lvnE:"\u2268\ufe00",macr:"\xaf",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21a6",mapsto:"\u21a6",mapstodown:"\u21a7",mapstoleft:"\u21a4",mapstoup:"\u21a5",marker:"\u25ae",mcomma:"\u2a29",Mcy:"\u041c",mcy:"\u043c",mdash:"\u2014",mDDot:"\u223a",measuredangle:"\u2221",MediumSpace:"\u205f",Mellintrf:"\u2133",Mfr:"\u{1d510}",mfr:"\u{1d52a}",mho:"\u2127",micro:"\xb5",mid:"\u2223",midast:"*",midcir:"\u2af0",middot:"\xb7",minus:"\u2212",minusb:"\u229f",minusd:"\u2238",minusdu:"\u2a2a",MinusPlus:"\u2213",mlcp:"\u2adb",mldr:"\u2026",mnplus:"\u2213",models:"\u22a7",Mopf:"\u{1d544}",mopf:"\u{1d55e}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1d4c2}",mstpos:"\u223e",Mu:"\u039c",mu:"\u03bc",multimap:"\u22b8",mumap:"\u22b8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20d2",nap:"\u2249",napE:"\u2a70\u0338",napid:"\u224b\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266e",natural:"\u266e",naturals:"\u2115",nbsp:"\xa0",nbump:"\u224e\u0338",nbumpe:"\u224f\u0338",ncap:"\u2a43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2a6d\u0338",ncup:"\u2a42",Ncy:"\u041d",ncy:"\u043d",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21d7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200b",NegativeThickSpace:"\u200b",NegativeThinSpace:"\u200b",NegativeVeryThinSpace:"\u200b",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226b",NestedLessLess:"\u226a",NewLine:"\n",nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1d511}",nfr:"\u{1d52b}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2a7e\u0338",nges:"\u2a7e\u0338",nGg:"\u22d9\u0338",ngsim:"\u2275",nGt:"\u226b\u20d2",ngt:"\u226f",ngtr:"\u226f",nGtv:"\u226b\u0338",nhArr:"\u21ce",nharr:"\u21ae",nhpar:"\u2af2",ni:"\u220b",nis:"\u22fc",nisd:"\u22fa",niv:"\u220b",NJcy:"\u040a",njcy:"\u045a",nlArr:"\u21cd",nlarr:"\u219a",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21cd",nleftarrow:"\u219a",nLeftrightarrow:"\u21ce",nleftrightarrow:"\u21ae",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2a7d\u0338",nles:"\u2a7d\u0338",nless:"\u226e",nLl:"\u22d8\u0338",nlsim:"\u2274",nLt:"\u226a\u20d2",nlt:"\u226e",nltri:"\u22ea",nltrie:"\u22ec",nLtv:"\u226a\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xa0",Nopf:"\u2115",nopf:"\u{1d55f}",Not:"\u2aec",not:"\xac",NotCongruent:"\u2262",NotCupCap:"\u226d",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226f",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226b\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2a7e\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224e\u0338",NotHumpEqual:"\u224f\u0338",notin:"\u2209",notindot:"\u22f5\u0338",notinE:"\u22f9\u0338",notinva:"\u2209",notinvb:"\u22f7",notinvc:"\u22f6",NotLeftTriangle:"\u22ea",NotLeftTriangleBar:"\u29cf\u0338",NotLeftTriangleEqual:"\u22ec",NotLess:"\u226e",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226a\u0338",NotLessSlantEqual:"\u2a7d\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2aa2\u0338",NotNestedLessLess:"\u2aa1\u0338",notni:"\u220c",notniva:"\u220c",notnivb:"\u22fe",notnivc:"\u22fd",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2aaf\u0338",NotPrecedesSlantEqual:"\u22e0",NotReverseElement:"\u220c",NotRightTriangle:"\u22eb",NotRightTriangleBar:"\u29d0\u0338",NotRightTriangleEqual:"\u22ed",NotSquareSubset:"\u228f\u0338",NotSquareSubsetEqual:"\u22e2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22e3",NotSubset:"\u2282\u20d2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2ab0\u0338",NotSucceedsSlantEqual:"\u22e1",NotSucceedsTilde:"\u227f\u0338",NotSuperset:"\u2283\u20d2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2afd\u20e5",npart:"\u2202\u0338",npolint:"\u2a14",npr:"\u2280",nprcue:"\u22e0",npre:"\u2aaf\u0338",nprec:"\u2280",npreceq:"\u2aaf\u0338",nrArr:"\u21cf",nrarr:"\u219b",nrarrc:"\u2933\u0338",nrarrw:"\u219d\u0338",nRightarrow:"\u21cf",nrightarrow:"\u219b",nrtri:"\u22eb",nrtrie:"\u22ed",nsc:"\u2281",nsccue:"\u22e1",nsce:"\u2ab0\u0338",Nscr:"\u{1d4a9}",nscr:"\u{1d4c3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22e2",nsqsupe:"\u22e3",nsub:"\u2284",nsubE:"\u2ac5\u0338",nsube:"\u2288",nsubset:"\u2282\u20d2",nsubseteq:"\u2288",nsubseteqq:"\u2ac5\u0338",nsucc:"\u2281",nsucceq:"\u2ab0\u0338",nsup:"\u2285",nsupE:"\u2ac6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20d2",nsupseteq:"\u2289",nsupseteqq:"\u2ac6\u0338",ntgl:"\u2279",Ntilde:"\xd1",ntilde:"\xf1",ntlg:"\u2278",ntriangleleft:"\u22ea",ntrianglelefteq:"\u22ec",ntriangleright:"\u22eb",ntrianglerighteq:"\u22ed",Nu:"\u039d",nu:"\u03bd",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224d\u20d2",nVDash:"\u22af",nVdash:"\u22ae",nvDash:"\u22ad",nvdash:"\u22ac",nvge:"\u2265\u20d2",nvgt:">\u20d2",nvHarr:"\u2904",nvinfin:"\u29de",nvlArr:"\u2902",nvle:"\u2264\u20d2",nvlt:"<\u20d2",nvltrie:"\u22b4\u20d2",nvrArr:"\u2903",nvrtrie:"\u22b5\u20d2",nvsim:"\u223c\u20d2",nwarhk:"\u2923",nwArr:"\u21d6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xd3",oacute:"\xf3",oast:"\u229b",ocir:"\u229a",Ocirc:"\xd4",ocirc:"\xf4",Ocy:"\u041e",ocy:"\u043e",odash:"\u229d",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2a38",odot:"\u2299",odsold:"\u29bc",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29bf",Ofr:"\u{1d512}",ofr:"\u{1d52c}",ogon:"\u02db",Ograve:"\xd2",ograve:"\xf2",ogt:"\u29c1",ohbar:"\u29b5",ohm:"\u03a9",oint:"\u222e",olarr:"\u21ba",olcir:"\u29be",olcross:"\u29bb",oline:"\u203e",olt:"\u29c0",Omacr:"\u014c",omacr:"\u014d",Omega:"\u03a9",omega:"\u03c9",Omicron:"\u039f",omicron:"\u03bf",omid:"\u29b6",ominus:"\u2296",Oopf:"\u{1d546}",oopf:"\u{1d560}",opar:"\u29b7",OpenCurlyDoubleQuote:"\u201c",OpenCurlyQuote:"\u2018",operp:"\u29b9",oplus:"\u2295",Or:"\u2a54",or:"\u2228",orarr:"\u21bb",ord:"\u2a5d",order:"\u2134",orderof:"\u2134",ordf:"\xaa",ordm:"\xba",origof:"\u22b6",oror:"\u2a56",orslope:"\u2a57",orv:"\u2a5b",oS:"\u24c8",Oscr:"\u{1d4aa}",oscr:"\u2134",Oslash:"\xd8",oslash:"\xf8",osol:"\u2298",Otilde:"\xd5",otilde:"\xf5",Otimes:"\u2a37",otimes:"\u2297",otimesas:"\u2a36",Ouml:"\xd6",ouml:"\xf6",ovbar:"\u233d",OverBar:"\u203e",OverBrace:"\u23de",OverBracket:"\u23b4",OverParenthesis:"\u23dc",par:"\u2225",para:"\xb6",parallel:"\u2225",parsim:"\u2af3",parsl:"\u2afd",part:"\u2202",PartialD:"\u2202",Pcy:"\u041f",pcy:"\u043f",percnt:"%",period:".",permil:"\u2030",perp:"\u22a5",pertenk:"\u2031",Pfr:"\u{1d513}",pfr:"\u{1d52d}",Phi:"\u03a6",phi:"\u03c6",phiv:"\u03d5",phmmat:"\u2133",phone:"\u260e",Pi:"\u03a0",pi:"\u03c0",pitchfork:"\u22d4",piv:"\u03d6",planck:"\u210f",planckh:"\u210e",plankv:"\u210f",plus:"+",plusacir:"\u2a23",plusb:"\u229e",pluscir:"\u2a22",plusdo:"\u2214",plusdu:"\u2a25",pluse:"\u2a72",PlusMinus:"\xb1",plusmn:"\xb1",plussim:"\u2a26",plustwo:"\u2a27",pm:"\xb1",Poincareplane:"\u210c",pointint:"\u2a15",Popf:"\u2119",popf:"\u{1d561}",pound:"\xa3",Pr:"\u2abb",pr:"\u227a",prap:"\u2ab7",prcue:"\u227c",prE:"\u2ab3",pre:"\u2aaf",prec:"\u227a",precapprox:"\u2ab7",preccurlyeq:"\u227c",Precedes:"\u227a",PrecedesEqual:"\u2aaf",PrecedesSlantEqual:"\u227c",PrecedesTilde:"\u227e",preceq:"\u2aaf",precnapprox:"\u2ab9",precneqq:"\u2ab5",precnsim:"\u22e8",precsim:"\u227e",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2ab9",prnE:"\u2ab5",prnsim:"\u22e8",prod:"\u220f",Product:"\u220f",profalar:"\u232e",profline:"\u2312",profsurf:"\u2313",prop:"\u221d",Proportion:"\u2237",Proportional:"\u221d",propto:"\u221d",prsim:"\u227e",prurel:"\u22b0",Pscr:"\u{1d4ab}",pscr:"\u{1d4c5}",Psi:"\u03a8",psi:"\u03c8",puncsp:"\u2008",Qfr:"\u{1d514}",qfr:"\u{1d52e}",qint:"\u2a0c",Qopf:"\u211a",qopf:"\u{1d562}",qprime:"\u2057",Qscr:"\u{1d4ac}",qscr:"\u{1d4c6}",quaternions:"\u210d",quatint:"\u2a16",quest:"?",questeq:"\u225f",QUOT:'"',quot:'"',rAarr:"\u21db",race:"\u223d\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221a",raemptyv:"\u29b3",Rang:"\u27eb",rang:"\u27e9",rangd:"\u2992",range:"\u29a5",rangle:"\u27e9",raquo:"\xbb",Rarr:"\u21a0",rArr:"\u21d2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21e5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291e",rarrhk:"\u21aa",rarrlp:"\u21ac",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21a3",rarrw:"\u219d",rAtail:"\u291c",ratail:"\u291a",ratio:"\u2236",rationals:"\u211a",RBarr:"\u2910",rBarr:"\u290f",rbarr:"\u290d",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298c",rbrksld:"\u298e",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201d",rdquor:"\u201d",rdsh:"\u21b3",Re:"\u211c",real:"\u211c",realine:"\u211b",realpart:"\u211c",reals:"\u211d",rect:"\u25ad",REG:"\xae",reg:"\xae",ReverseElement:"\u220b",ReverseEquilibrium:"\u21cb",ReverseUpEquilibrium:"\u296f",rfisht:"\u297d",rfloor:"\u230b",Rfr:"\u211c",rfr:"\u{1d52f}",rHar:"\u2964",rhard:"\u21c1",rharu:"\u21c0",rharul:"\u296c",Rho:"\u03a1",rho:"\u03c1",rhov:"\u03f1",RightAngleBracket:"\u27e9",RightArrow:"\u2192",Rightarrow:"\u21d2",rightarrow:"\u2192",RightArrowBar:"\u21e5",RightArrowLeftArrow:"\u21c4",rightarrowtail:"\u21a3",RightCeiling:"\u2309",RightDoubleBracket:"\u27e7",RightDownTeeVector:"\u295d",RightDownVector:"\u21c2",RightDownVectorBar:"\u2955",RightFloor:"\u230b",rightharpoondown:"\u21c1",rightharpoonup:"\u21c0",rightleftarrows:"\u21c4",rightleftharpoons:"\u21cc",rightrightarrows:"\u21c9",rightsquigarrow:"\u219d",RightTee:"\u22a2",RightTeeArrow:"\u21a6",RightTeeVector:"\u295b",rightthreetimes:"\u22cc",RightTriangle:"\u22b3",RightTriangleBar:"\u29d0",RightTriangleEqual:"\u22b5",RightUpDownVector:"\u294f",RightUpTeeVector:"\u295c",RightUpVector:"\u21be",RightUpVectorBar:"\u2954",RightVector:"\u21c0",RightVectorBar:"\u2953",ring:"\u02da",risingdotseq:"\u2253",rlarr:"\u21c4",rlhar:"\u21cc",rlm:"\u200f",rmoust:"\u23b1",rmoustache:"\u23b1",rnmid:"\u2aee",roang:"\u27ed",roarr:"\u21fe",robrk:"\u27e7",ropar:"\u2986",Ropf:"\u211d",ropf:"\u{1d563}",roplus:"\u2a2e",rotimes:"\u2a35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2a12",rrarr:"\u21c9",Rrightarrow:"\u21db",rsaquo:"\u203a",Rscr:"\u211b",rscr:"\u{1d4c7}",Rsh:"\u21b1",rsh:"\u21b1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22cc",rtimes:"\u22ca",rtri:"\u25b9",rtrie:"\u22b5",rtrif:"\u25b8",rtriltri:"\u29ce",RuleDelayed:"\u29f4",ruluhar:"\u2968",rx:"\u211e",Sacute:"\u015a",sacute:"\u015b",sbquo:"\u201a",Sc:"\u2abc",sc:"\u227b",scap:"\u2ab8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227d",scE:"\u2ab4",sce:"\u2ab0",Scedil:"\u015e",scedil:"\u015f",Scirc:"\u015c",scirc:"\u015d",scnap:"\u2aba",scnE:"\u2ab6",scnsim:"\u22e9",scpolint:"\u2a13",scsim:"\u227f",Scy:"\u0421",scy:"\u0441",sdot:"\u22c5",sdotb:"\u22a1",sdote:"\u2a66",searhk:"\u2925",seArr:"\u21d8",searr:"\u2198",searrow:"\u2198",sect:"\xa7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1d516}",sfr:"\u{1d530}",sfrown:"\u2322",sharp:"\u266f",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xad",Sigma:"\u03a3",sigma:"\u03c3",sigmaf:"\u03c2",sigmav:"\u03c2",sim:"\u223c",simdot:"\u2a6a",sime:"\u2243",simeq:"\u2243",simg:"\u2a9e",simgE:"\u2aa0",siml:"\u2a9d",simlE:"\u2a9f",simne:"\u2246",simplus:"\u2a24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2a33",smeparsl:"\u29e4",smid:"\u2223",smile:"\u2323",smt:"\u2aaa",smte:"\u2aac",smtes:"\u2aac\ufe00",SOFTcy:"\u042c",softcy:"\u044c",sol:"/",solb:"\u29c4",solbar:"\u233f",Sopf:"\u{1d54a}",sopf:"\u{1d564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\ufe00",sqcup:"\u2294",sqcups:"\u2294\ufe00",Sqrt:"\u221a",sqsub:"\u228f",sqsube:"\u2291",sqsubset:"\u228f",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25a1",Square:"\u25a1",square:"\u25a1",SquareIntersection:"\u2293",SquareSubset:"\u228f",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25aa",squf:"\u25aa",srarr:"\u2192",Sscr:"\u{1d4ae}",sscr:"\u{1d4c8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22c6",Star:"\u22c6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03f5",straightphi:"\u03d5",strns:"\xaf",Sub:"\u22d0",sub:"\u2282",subdot:"\u2abd",subE:"\u2ac5",sube:"\u2286",subedot:"\u2ac3",submult:"\u2ac1",subnE:"\u2acb",subne:"\u228a",subplus:"\u2abf",subrarr:"\u2979",Subset:"\u22d0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2ac5",SubsetEqual:"\u2286",subsetneq:"\u228a",subsetneqq:"\u2acb",subsim:"\u2ac7",subsub:"\u2ad5",subsup:"\u2ad3",succ:"\u227b",succapprox:"\u2ab8",succcurlyeq:"\u227d",Succeeds:"\u227b",SucceedsEqual:"\u2ab0",SucceedsSlantEqual:"\u227d",SucceedsTilde:"\u227f",succeq:"\u2ab0",succnapprox:"\u2aba",succneqq:"\u2ab6",succnsim:"\u22e9",succsim:"\u227f",SuchThat:"\u220b",Sum:"\u2211",sum:"\u2211",sung:"\u266a",Sup:"\u22d1",sup:"\u2283",sup1:"\xb9",sup2:"\xb2",sup3:"\xb3",supdot:"\u2abe",supdsub:"\u2ad8",supE:"\u2ac6",supe:"\u2287",supedot:"\u2ac4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27c9",suphsub:"\u2ad7",suplarr:"\u297b",supmult:"\u2ac2",supnE:"\u2acc",supne:"\u228b",supplus:"\u2ac0",Supset:"\u22d1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2ac6",supsetneq:"\u228b",supsetneqq:"\u2acc",supsim:"\u2ac8",supsub:"\u2ad4",supsup:"\u2ad6",swarhk:"\u2926",swArr:"\u21d9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292a",szlig:"\xdf",Tab:"\t",target:"\u2316",Tau:"\u03a4",tau:"\u03c4",tbrk:"\u23b4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20db",telrec:"\u2315",Tfr:"\u{1d517}",tfr:"\u{1d531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03b8",thetasym:"\u03d1",thetav:"\u03d1",thickapprox:"\u2248",thicksim:"\u223c",ThickSpace:"\u205f\u200a",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223c",THORN:"\xde",thorn:"\xfe",Tilde:"\u223c",tilde:"\u02dc",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xd7",timesb:"\u22a0",timesbar:"\u2a31",timesd:"\u2a30",tint:"\u222d",toea:"\u2928",top:"\u22a4",topbot:"\u2336",topcir:"\u2af1",Topf:"\u{1d54b}",topf:"\u{1d565}",topfork:"\u2ada",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25b5",triangledown:"\u25bf",triangleleft:"\u25c3",trianglelefteq:"\u22b4",triangleq:"\u225c",triangleright:"\u25b9",trianglerighteq:"\u22b5",tridot:"\u25ec",trie:"\u225c",triminus:"\u2a3a",TripleDot:"\u20db",triplus:"\u2a39",trisb:"\u29cd",tritime:"\u2a3b",trpezium:"\u23e2",Tscr:"\u{1d4af}",tscr:"\u{1d4c9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040b",tshcy:"\u045b",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226c",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",Uacute:"\xda",uacute:"\xfa",Uarr:"\u219f",uArr:"\u21d1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040e",ubrcy:"\u045e",Ubreve:"\u016c",ubreve:"\u016d",Ucirc:"\xdb",ucirc:"\xfb",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21c5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296e",ufisht:"\u297e",Ufr:"\u{1d518}",ufr:"\u{1d532}",Ugrave:"\xd9",ugrave:"\xf9",uHar:"\u2963",uharl:"\u21bf",uharr:"\u21be",uhblk:"\u2580",ulcorn:"\u231c",ulcorner:"\u231c",ulcrop:"\u230f",ultri:"\u25f8",Umacr:"\u016a",umacr:"\u016b",uml:"\xa8",UnderBar:"_",UnderBrace:"\u23df",UnderBracket:"\u23b5",UnderParenthesis:"\u23dd",Union:"\u22c3",UnionPlus:"\u228e",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1d54c}",uopf:"\u{1d566}",UpArrow:"\u2191",Uparrow:"\u21d1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21c5",UpDownArrow:"\u2195",Updownarrow:"\u21d5",updownarrow:"\u2195",UpEquilibrium:"\u296e",upharpoonleft:"\u21bf",upharpoonright:"\u21be",uplus:"\u228e",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03d2",upsi:"\u03c5",upsih:"\u03d2",Upsilon:"\u03a5",upsilon:"\u03c5",UpTee:"\u22a5",UpTeeArrow:"\u21a5",upuparrows:"\u21c8",urcorn:"\u231d",urcorner:"\u231d",urcrop:"\u230e",Uring:"\u016e",uring:"\u016f",urtri:"\u25f9",Uscr:"\u{1d4b0}",uscr:"\u{1d4ca}",utdot:"\u22f0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25b5",utrif:"\u25b4",uuarr:"\u21c8",Uuml:"\xdc",uuml:"\xfc",uwangle:"\u29a7",vangrt:"\u299c",varepsilon:"\u03f5",varkappa:"\u03f0",varnothing:"\u2205",varphi:"\u03d5",varpi:"\u03d6",varpropto:"\u221d",vArr:"\u21d5",varr:"\u2195",varrho:"\u03f1",varsigma:"\u03c2",varsubsetneq:"\u228a\ufe00",varsubsetneqq:"\u2acb\ufe00",varsupsetneq:"\u228b\ufe00",varsupsetneqq:"\u2acc\ufe00",vartheta:"\u03d1",vartriangleleft:"\u22b2",vartriangleright:"\u22b3",Vbar:"\u2aeb",vBar:"\u2ae8",vBarv:"\u2ae9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22ab",Vdash:"\u22a9",vDash:"\u22a8",vdash:"\u22a2",Vdashl:"\u2ae6",Vee:"\u22c1",vee:"\u2228",veebar:"\u22bb",veeeq:"\u225a",vellip:"\u22ee",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200a",Vfr:"\u{1d519}",vfr:"\u{1d533}",vltri:"\u22b2",vnsub:"\u2282\u20d2",vnsup:"\u2283\u20d2",Vopf:"\u{1d54d}",vopf:"\u{1d567}",vprop:"\u221d",vrtri:"\u22b3",Vscr:"\u{1d4b1}",vscr:"\u{1d4cb}",vsubnE:"\u2acb\ufe00",vsubne:"\u228a\ufe00",vsupnE:"\u2acc\ufe00",vsupne:"\u228b\ufe00",Vvdash:"\u22aa",vzigzag:"\u299a",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2a5f",Wedge:"\u22c0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1d51a}",wfr:"\u{1d534}",Wopf:"\u{1d54e}",wopf:"\u{1d568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1d4b2}",wscr:"\u{1d4cc}",xcap:"\u22c2",xcirc:"\u25ef",xcup:"\u22c3",xdtri:"\u25bd",Xfr:"\u{1d51b}",xfr:"\u{1d535}",xhArr:"\u27fa",xharr:"\u27f7",Xi:"\u039e",xi:"\u03be",xlArr:"\u27f8",xlarr:"\u27f5",xmap:"\u27fc",xnis:"\u22fb",xodot:"\u2a00",Xopf:"\u{1d54f}",xopf:"\u{1d569}",xoplus:"\u2a01",xotime:"\u2a02",xrArr:"\u27f9",xrarr:"\u27f6",Xscr:"\u{1d4b3}",xscr:"\u{1d4cd}",xsqcup:"\u2a06",xuplus:"\u2a04",xutri:"\u25b3",xvee:"\u22c1",xwedge:"\u22c0",Yacute:"\xdd",yacute:"\xfd",YAcy:"\u042f",yacy:"\u044f",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042b",ycy:"\u044b",yen:"\xa5",Yfr:"\u{1d51c}",yfr:"\u{1d536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1d550}",yopf:"\u{1d56a}",Yscr:"\u{1d4b4}",yscr:"\u{1d4ce}",YUcy:"\u042e",yucy:"\u044e",Yuml:"\u0178",yuml:"\xff",Zacute:"\u0179",zacute:"\u017a",Zcaron:"\u017d",zcaron:"\u017e",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017b",zdot:"\u017c",zeetrf:"\u2128",ZeroWidthSpace:"\u200b",Zeta:"\u0396",zeta:"\u03b6",Zfr:"\u2128",zfr:"\u{1d537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21dd",Zopf:"\u2124",zopf:"\u{1d56b}",Zscr:"\u{1d4b5}",zscr:"\u{1d4cf}",zwj:"\u200d",zwnj:"\u200c"}),e.entityMap=e.HTML_ENTITIES},918(t,e,s){"use strict";function i(t,e){t.prototype=Object.create(Error.prototype,{constructor:{value:t},name:{value:t.name,enumerable:!0,writable:e}})}var r=s(981).freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),n=Object.keys(r);function o(t){return"number"==typeof t&&t>=1&&t<=25}function a(t,e){var s;o(t)?(this.name=n[t],this.message=e||""):(this.message=t,this.name="string"==typeof(s=e)&&s.substring(s.length-r.Error.length)===r.Error?e:r.Error),Error.captureStackTrace&&Error.captureStackTrace(this,a)}i(a,!0),Object.defineProperties(a.prototype,{code:{enumerable:!0,get:function(){var t=n.indexOf(this.name);return o(t)?t:0}}});for(var l={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},c=Object.entries(l),h=0;h/),I=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,w=a('"',I,'*"',"|","'",n(I,"'"),"*'"),k="\x3c!--",O=o(k,a(n(l,"-"),"|",o("-",n(l,"-"))),"*","--\x3e"),D="#PCDATA",P=a(o(/\(/,p,D,a(p,/\|/,p,A),"*",p,/\)\*/),"|",o(/\(/,p,D,p,/\)/)),B=a("EMPTY","|","ANY","|",P,"|",o(/\([^>]+\)/,/[?*+]?/)),F=o(""),j=o("NOTATION",u,/\(/,p,g,a(p,/\|/,p,g),"*",p,/\)/),_=o(/\(/,p,b,a(p,/\|/,p,b),"*",p,/\)/),U=a(j,"|",_),H=a(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",U),W=a(/#REQUIRED|#IMPLIED/,"|",a(a("#FIXED",u),"?",T)),z=o(""),q="about:legacy-compat",V=a('"'+q+'"',"|","'"+q+"'"),X="SYSTEM",G="PUBLIC",J=a(a(X,u,R),"|",a(G,u,w,u,R)),K=o("^",a(a(X,u,"(?",R,")"),"|",a(G,u,"(?",w,")",u,"(?",R,")"))),$=o("^",w,"$"),Y=o("^",R,"$"),Q=a(u,"NDATA",u,g),Z=""),et=a(v,"|",J),st=a(tt,"|",o(Z,u,"%",u,g,u,et,p,">")),it=o(G,u,w),rt=o(""),nt=o(p,"=",p),ot=/1[.]\d+/,at=o(u,"version",nt,a("'",ot,"'","|",'"',ot,'"')),lt=/[A-Za-z][-A-Za-z0-9._]*/,ct=o(/^<\?xml/,at,a(u,"encoding",nt,a('"',lt,'"',"|","'",lt,"'")),"?",a(u,"standalone",nt,a("'",a("yes","|","no"),"'","|",'"',a("yes","|","no"),'"')),"?",p,/\?>/),ht=o(l,"*?",/\]\]>/),dt=o(/",e.CDSect=dt,e.Char=l,e.Comment=O,e.COMMENT_START=k,e.COMMENT_END="--\x3e",e.DOCTYPE_DECL_START="=0&&o.warning("Unicode replacement character detected, source encoding issues?");function h(t){if(t>65535){var e=55296+((t-=65536)>>10),s=56320+(1023&t);return String.fromCharCode(e,s)}return String.fromCharCode(t)}function p(t){var e=";"===t[t.length-1]?t:t+";";if(!l&&e!==t)return o.error("EntityRef: expecting ;"),t;var i=r.Reference.exec(e);if(!i||i[0].length!==e.length)return o.error("entity not matching Reference production: "+t),t;var n=e.slice(1,-1);return c(s,n)?s[n]:"#"===n.charAt(0)?h(parseInt(n.substring(1).replace("x","0x"))):(o.error("entity not found:"+t),t)}function x(e){if(e>I){var s=t.substring(I,e).replace(m,p);L&&S(I),n.characters(s,0,e-I),I=e}}var y=0,C=0,A=/\r\n?|\n|$/g,L=n.locator;function S(e,s){for(;e>=C&&(s=A.exec(t));)y=C,C=s.index+s[0].length,L.lineNumber++;L.columnNumber=e-y+1}var R=[{currentNSMap:e}],M=[],I=0;for(;;){try{var w=t.indexOf("<",I);if(w<0){if(!l&&M.length>0)return o.fatalError("unclosed xml tag(s): "+M.join(", "));if(!t.substring(I).match(/^\s*$/)){var k=n.doc,O=k.createTextNode(t.substring(I));if(k.documentElement)return o.error("Extra content at the end of the document");k.appendChild(O),n.currentElement=O}return}if(w>I){var D=t.substring(I,w);l||0!==M.length||(D=D.replace(new RegExp(r.S_OPT.source,"g"),""))&&o.error("Unexpected content outside root element: '"+D+"'"),x(w)}switch(t.charAt(w+1)){case"/":var P=t.indexOf(">",w+2),B=t.substring(w+2,P>0?P:void 0);if(!B)return o.fatalError("end tag name missing");var F=P>0&&r.reg("^",r.QName_group,r.S_OPT,"$").exec(B);if(!F)return o.fatalError('end tag name contains invalid characters: "'+B+'"');if(!n.currentElement&&!n.doc.documentElement)return;var j=M[M.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(j!==F[1]){var _=F[1].toLowerCase();if(!l||j.toLowerCase()!==_)return o.fatalError('Opening and ending tag mismatch: "'+j+'" != "'+B+'"')}var U=R.pop();M.pop();var H=U.localNSMap;if(n.endElement(U.uri,U.localName,j),H)for(var W in H)c(H,W)&&n.endPrefixMapping(W);P++;break;case"?":L&&S(w),P=v(t,w,n,o);break;case"!":L&&S(w),P=N(t,w,n,o,l);break;default:L&&S(w);var z=new T,q=R[R.length-1].currentNSMap,V=(P=g(t,w,z,q,p,o,l),z.length);if(z.closed||(l&&i.isHTMLVoidElement(z.tagName)?z.closed=!0:M.push(z.tagName)),L&&V){for(var X=f(L,{}),G=0;GI?I=P:x(Math.max(w,I)+1)}}(t,e,s,n,this.errorHandler),n.endDocument()}};var m=/&#?\w+;?/g;function f(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function g(t,e,s,i,r,n,o){function a(t,e,i){return c(s.attributeNames,t)?n.fatalError("Attribute "+t+" redefined"):!o&&e.indexOf("<")>=0?n.fatalError("Unescaped '<' not allowed in attributes values"):void s.addValue(t,e.replace(/[\t\n\r]/g," ").replace(m,r),i)}for(var l,h=++e,d=0;;){var u=t.charAt(h);switch(u){case"=":if(1===d)l=t.slice(e,h),d=3;else{if(2!==d)throw new Error("attribute equal must after attrName");d=3}break;case"'":case'"':if(3===d||1===d){if(1===d&&(n.warning('attribute value must after "="'),l=t.slice(e,h)),e=h+1,!((h=t.indexOf(u,e))>0))throw new Error("attribute value no end '"+u+"' match");a(l,p=t.slice(e,h),e-1),d=5}else{if(4!=d)throw new Error('attribute value must after "="');a(l,p=t.slice(e,h),e),n.warning('attribute "'+l+'" missed start quot('+u+")!!"),e=h+1,d=5}break;case"/":switch(d){case 0:s.setTagName(t.slice(e,h));case 5:case 6:case 7:d=7,s.closed=!0;case 4:case 1:break;case 2:s.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),0==d&&s.setTagName(t.slice(e,h)),h;case">":switch(d){case 0:s.setTagName(t.slice(e,h));case 5:case 6:case 7:break;case 4:case 1:"/"===(p=t.slice(e,h)).slice(-1)&&(s.closed=!0,p=p.slice(0,-1));case 2:2===d&&(p=l),4==d?(n.warning('attribute "'+p+'" missed quot(")!'),a(l,p,e)):(o||n.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!'),a(p,p,e));break;case 3:if(!o)return n.fatalError("AttValue: ' or \" expected")}return h;case"\x80":u=" ";default:if(u<=" ")switch(d){case 0:s.setTagName(t.slice(e,h)),d=6;break;case 1:l=t.slice(e,h),d=2;break;case 4:var p=t.slice(e,h);n.warning('attribute "'+p+'" missed quot(")!!'),a(l,p,e);case 5:d=6}else switch(d){case 2:o||n.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=h,d=1;break;case 5:n.warning('attribute space is required"'+l+'"!!');case 6:d=1,e=h;break;case 3:d=4,e=h;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function b(t,e,s){for(var i=t.tagName,r=null,n=t.length;n--;){var o=t[n],a=o.qName,l=o.value;if((m=a.indexOf(":"))>0)var d=o.prefix=a.slice(0,m),u=a.slice(m+1),p="xmlns"===d&&u;else u=a,d=null,p="xmlns"===a&&"";o.localName=u,!1!==p&&(null==r&&(r=Object.create(null),x(s,s=Object.create(null))),s[p]=r[p]=l,o.uri=h.XMLNS,e.startPrefixMapping(p,l))}for(n=t.length;n--;)(o=t[n]).prefix&&("xml"===o.prefix&&(o.uri=h.XML),"xmlns"!==o.prefix&&(o.uri=s[o.prefix]));var m;(m=i.indexOf(":"))>0?(d=t.prefix=i.slice(0,m),u=t.localName=i.slice(m+1)):(d=null,u=t.localName=i);var f=t.uri=s[d||""];if(e.startElement(f,u,i,t),!t.closed)return t.currentNSMap=s,t.localNSMap=r,!0;if(e.endElement(f,u,i),r)for(d in r)c(r,d)&&e.endPrefixMapping(d)}function E(t,e,s,i,r){var n=o(s);if(n||l(s)){var a=t.indexOf("",e),c=t.substring(e+1,a);return n&&(c=c.replace(m,i)),r.characters(c,0,c.length),a}return e+1}function x(t,e){for(var s in t)c(t,s)&&(e[s]=t[s])}function y(t,e){var s=e;function i(e){return e=e||0,t.charAt(s+e)}function n(t){s+=t=t||1}function o(){return t.substring(s)}return{char:i,getIndex:function(){return s},getMatch:function(t){var e=r.reg("^",t).exec(o());return e?(n(e[0].length),e[0]):null},getSource:function(){return t},skip:n,skipBlanks:function(){for(var e=0;s"!==o.char()?i.fatalError("doctype not terminated with > at position "+o.getIndex()):(o.skip(1),s.startDTD(c.name,c.publicId,c.systemId,c.internalSubset),s.endDTD(),o.getIndex());default:return i.fatalError('Not well-formed XML starting with "0)return i.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!r.XMLDecl.test(t.substring(e)))return i.fatalError("xml declaration is not well-formed")}return s.processingInstruction(n[1],n[2]),e+n[0].length}function T(){this.attributeNames=Object.create(null)}T.prototype={setTagName:function(t){if(!r.QName_exact.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,s){if(!r.QName_exact.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:s}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},e.XMLReader=p,e.parseUtils=y,e.parseDoctypeCommentOrCData=N},999(t,e,s){(function(){"use strict";var e=this;function s(t){return"string"==typeof t}function i(t,e,s){return t.call.apply(t.bind,arguments)}function r(t,e,s){if(!t)throw Error();if(2e?1:0}var h,d=Array.prototype.indexOf?function(t,e,s){return Array.prototype.indexOf.call(t,e,s)}:function(t,e,i){if(i=null==i?0:0>i?Math.max(0,t.length+i):i,s(t))return s(e)&&1==e.length?t.indexOf(e,i):-1;for(;iparseFloat(L)){E=String(R);break t}}E=L}var M={};function I(t){if(!M[t]){for(var e=0,s=a(String(E)).split("."),i=a(String(t)).split("."),r=Math.max(s.length,i.length),n=0;0==e&&n",4,2,function(t,e,s){return mt(function(t,e){return t>e},t,e,s)}),bt("<=",4,2,function(t,e,s){return mt(function(t,e){return t<=e},t,e,s)}),bt(">=",4,2,function(t,e,s){return mt(function(t,e){return t>=e},t,e,s)});var Et=bt("=",3,2,function(t,e,s){return mt(function(t,e){return t==e},t,e,s,!0)});function xt(t,e,s){this.a=t,this.b=e||1,this.f=s||1}function yt(t,e){if(e.a.length&&4!=t.i)throw Error("Primary expression must evaluate to nodeset if filter has predicate(s).");ot.call(this,t.i),this.c=t,this.h=e,this.g=t.g,this.b=t.b}function Nt(t,e){if(e.lengtht.v)throw Error("Function "+t.j+" expects at most "+t.v+" arguments, "+e.length+" given");t.B&&u(e,function(e,s){if(4!=e.i)throw Error("Argument "+s+" to function "+t.j+" is not of type Nodeset: "+e)}),ot.call(this,t.i),this.h=t,this.c=e,lt(this,t.g||f(e,function(t){return t.g})),ct(this,t.D&&!e.length||t.C&&!!e.length||f(e,function(t){return t.b}))}function vt(t,e,s,i,r,n,o,a,l){this.j=t,this.i=e,this.g=s,this.D=i,this.C=r,this.m=n,this.A=o,this.v=void 0!==a?a:o,this.B=!!l}bt("!=",3,2,function(t,e,s){return mt(function(t,e){return t!=e},t,e,s,!0)}),bt("and",2,2,function(t,e,s){return ut(t,s)&&ut(e,s)}),bt("or",1,2,function(t,e,s){return ut(t,s)||ut(e,s)}),o(yt),yt.prototype.a=function(t){return t=this.c.a(t),Ht(this.h,t)},yt.prototype.toString=function(){return"Filter:"+at(this.c)+at(this.h)},o(Nt),Nt.prototype.a=function(t){return this.h.m.apply(null,function(t){return Array.prototype.concat.apply(Array.prototype,arguments)}(t,this.c))},Nt.prototype.toString=function(){var t="Function: "+this.h;if(this.c.length){var e=m(this.c,function(t,e){return t+at(e)},"Arguments:");t=t+at(e)}return t},vt.prototype.toString=function(){return this.j};var Tt={};function Ct(t,e,s,i,r,n,o,a){if(Tt.hasOwnProperty(t))throw Error("Function already created: "+t+".");Tt[t]=new vt(t,e,s,i,!1,r,n,o,a)}function At(t,e){switch(this.h=t,this.c=void 0!==e?e:null,this.b=null,t){case"comment":this.b=8;break;case"text":this.b=3;break;case"processing-instruction":this.b=7;break;case"node":break;default:throw Error("Unexpected argument")}}function Lt(t){return"comment"==t||"text"==t||"processing-instruction"==t||"node"==t}function St(t){this.b=t,this.a=0}Ct("boolean",2,!1,!1,function(t,e){return ut(e,t)},1),Ct("ceiling",1,!1,!1,function(t,e){return Math.ceil(ht(e,t))},1),Ct("concat",3,!1,!1,function(t,e){return m(function(t,e,s){return 2>=arguments.length?Array.prototype.slice.call(t,e):Array.prototype.slice.call(t,e,s)}(arguments,1),function(e,s){return e+dt(s,t)},"")},2,null),Ct("contains",2,!1,!1,function(t,e,s){return l(dt(e,t),dt(s,t))},2),Ct("count",1,!1,!1,function(t,e){return e.a(t).l},1,1,!0),Ct("false",2,!1,!1,function(){return!1},0),Ct("floor",1,!1,!1,function(t,e){return Math.floor(ht(e,t))},1),Ct("id",4,!1,!1,function(t,e){function i(t){if(O){var e=r.all[t];if(e){if(e.nodeType&&t==e.id)return e;if(e.length)return function(t,e){var i;t:{i=t.length;for(var r=s(t)?t.split(""):t,n=0;ni?null:s(t)?t.charAt(i):t[i]}(e,function(e){return t==e.id})}return null}return r.getElementById(t)}var r=9==(n=t.a).nodeType?n:n.ownerDocument,n=dt(e,t).split(/\s+/),o=[];u(n,function(t){!(t=i(t))||0<=d(o,t)||o.push(t)}),o.sort(G);var a=new $;return u(o,function(t){tt(a,t)}),a},1),Ct("lang",2,!1,!1,function(){return!1},1),Ct("last",1,!0,!1,function(t){if(1!=arguments.length)throw Error("Function last expects ()");return t.f},0),Ct("local-name",3,!1,!0,function(t,e){var s=e?et(e.a(t)):t.a;return s?s.localName||s.nodeName.toLowerCase():""},0,1,!0),Ct("name",3,!1,!0,function(t,e){var s=e?et(e.a(t)):t.a;return s?s.nodeName.toLowerCase():""},0,1,!0),Ct("namespace-uri",3,!0,!1,function(){return""},0,1,!0),Ct("normalize-space",3,!1,!0,function(t,e){return(e?dt(e,t):F(t.a)).replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},0,1),Ct("not",2,!1,!1,function(t,e){return!ut(e,t)},1),Ct("number",1,!1,!0,function(t,e){return e?ht(e,t):+F(t.a)},0,1),Ct("position",1,!0,!1,function(t){return t.b},0),Ct("round",1,!1,!1,function(t,e){return Math.round(ht(e,t))},1),Ct("starts-with",2,!1,!1,function(t,e,s){return e=dt(e,t),t=dt(s,t),0==e.lastIndexOf(t,0)},2),Ct("string",3,!1,!0,function(t,e){return e?dt(e,t):F(t.a)},0,1),Ct("string-length",1,!1,!0,function(t,e){return(e?dt(e,t):F(t.a)).length},0,1),Ct("substring",3,!1,!1,function(t,e,s,i){if(s=ht(s,t),isNaN(s)||1/0==s||-1/0==s)return"";if(i=i?ht(i,t):1/0,isNaN(i)||-1/0===i)return"";s=Math.round(s)-1;var r=Math.max(s,0);return t=dt(e,t),1/0==i?t.substring(r):t.substring(r,s+Math.round(i))},2,3),Ct("substring-after",3,!1,!1,function(t,e,s){return e=dt(e,t),t=dt(s,t),-1==(s=e.indexOf(t))?"":e.substring(s+t.length)},2),Ct("substring-before",3,!1,!1,function(t,e,s){return e=dt(e,t),t=dt(s,t),-1==(t=e.indexOf(t))?"":e.substring(0,t)},2),Ct("sum",1,!1,!1,function(t,e){for(var s=it(e.a(t)),i=0,r=nt(s);r;r=nt(s))i+=+F(r);return i},1,1,!0),Ct("translate",3,!1,!1,function(t,e,s,i){e=dt(e,t),s=dt(s,t);var r=dt(i,t);for(t={},i=0;i]=|\s+|./g,Mt=/^\s/;function It(t,e){return t.b[t.a+(e||0)]}function wt(t){return t.b[t.a++]}function kt(t){return t.b.length<=t.a}function Ot(t){ot.call(this,3),this.c=t.substring(1,t.length-1)}function Dt(t,e){var s;this.j=t.toLowerCase(),s="*"==this.j?"*":"http://www.w3.org/1999/xhtml",this.c=e?e.toLowerCase():s}function Pt(t,e){if(ot.call(this,t.i),this.h=t,this.c=e,this.g=t.g,this.b=t.b,1==this.c.length){var s=this.c[0];s.u||s.c!=Xt||"*"!=(s=s.o).f()&&(this.f={name:s.f(),s:null})}}function Bt(){ot.call(this,4)}function Ft(){ot.call(this,4)}function jt(t){return"/"==t||"//"==t}function _t(t){ot.call(this,4),this.c=t,lt(this,f(this.c,function(t){return t.g})),ct(this,f(this.c,function(t){return t.b}))}function Ut(t,e){this.a=t,this.b=!!e}function Ht(t,e,s){for(s=s||0;s(t=wt(t.a)).length)throw Error("Unclosed literal string");return new Ot(t)}function ae(t){var e,s,i=[];if(jt(It(t.a))){if(e=wt(t.a),s=It(t.a),"/"==e&&(kt(t.a)||"."!=s&&".."!=s&&"@"!=s&&"*"!=s&&!/(?![0-9])[\w]/.test(s)))return new Bt;s=new Bt,ie(t,"Missing next location step."),e=le(t,e),i.push(e)}else{t:{switch(s=(e=It(t.a)).charAt(0)){case"$":throw Error("Variable reference not allowed in HTML XPath");case"(":wt(t.a),e=se(t),ie(t,'unclosed "("'),re(t,")");break;case'"':case"'":e=oe(t);break;default:if(isNaN(+e)){if(Lt(e)||!/(?![0-9])[\w]/.test(s)||"("!=It(t.a,1)){e=null;break t}for(e=wt(t.a),e=Tt[e]||null,wt(t.a),s=[];")"!=It(t.a)&&(ie(t,"Missing function argument list."),s.push(se(t)),","==It(t.a));)wt(t.a);ie(t,"Unclosed function argument list."),ne(t),e=new Nt(e,s)}else e=new te(+wt(t.a))}"["==It(t.a)&&(e=new yt(e,s=new Ut(ce(t))))}if(e){if(!jt(It(t.a)))return e;s=e}else e=le(t,"/"),s=new Ft,i.push(e)}for(;jt(It(t.a));)e=wt(t.a),ie(t,"Missing next location step."),e=le(t,e),i.push(e);return new Pt(s,i)}function le(t,e){var s,i,r,n;if("/"!=e&&"//"!=e)throw Error('Step op should be "/" or "//"');if("."==It(t.a))return i=new Wt(Qt,new At("node")),wt(t.a),i;if(".."==It(t.a))return i=new Wt($t,new At("node")),wt(t.a),i;if("@"==It(t.a))n=Xt,wt(t.a),ie(t,"Missing attribute name");else if("::"==It(t.a,1)){if(!/(?![0-9])[\w]/.test(It(t.a).charAt(0)))throw Error("Bad token: "+wt(t.a));if(s=wt(t.a),!(n=qt[s]||null))throw Error("No axis with name: "+s);wt(t.a),ie(t,"Missing node name")}else n=Gt;if(s=It(t.a),!/(?![0-9])[\w\*]/.test(s.charAt(0)))throw Error("Bad token: "+wt(t.a));if("("==It(t.a,1)){if(!Lt(s))throw Error("Invalid node type: "+s);if(!Lt(s=wt(t.a)))throw Error("Invalid type name: "+s);re(t,"("),ie(t,"Bad nodetype");var o=null;'"'!=(r=It(t.a).charAt(0))&&"'"!=r||(o=oe(t)),ie(t,"Bad nodetype"),ne(t),s=new At(s,o)}else if(-1==(r=(s=wt(t.a)).indexOf(":")))s=new Dt(s);else{var a;if("*"==(o=s.substring(0,r)))a="*";else if(!(a=t.b(o)))throw Error("Namespace prefix not declared: "+o);s=new Dt(s=s.substr(r+1),a)}return r=new Ut(ce(t),n.a),i||new Wt(n,s,r,"//"==e)}function ce(t){for(var e=[];"["==It(t.a);){wt(t.a),ie(t,"Missing predicate expression.");var s=se(t);e.push(s),ie(t,"Unclosed predicate expression."),re(t,"]")}return e}function he(t){if("-"==It(t.a))return wt(t.a),new Zt(he(t));var e=ae(t);if("|"!=It(t.a))t=e;else{for(e=[e];"|"==wt(t.a);)ie(t,"Missing next union location path."),e.push(ae(t));t.a.a--,t=new _t(e)}return t}function de(t){switch(t.nodeType){case 1:return function(t,e){var s=Array.prototype.slice.call(arguments,1);return function(){var e=s.slice();return e.push.apply(e,arguments),t.apply(this,e)}}(pe,t);case 9:return de(t.documentElement);case 11:case 10:case 6:case 12:return ue;default:return t.parentNode?de(t.parentNode):ue}}function ue(){return null}function pe(t,e){if(t.prefix==e)return t.namespaceURI||"http://www.w3.org/1999/xhtml";var s=t.getAttributeNode("xmlns:"+e);return s&&s.specified?s.value||null:t.parentNode&&9!=t.parentNode.nodeType?pe(t.parentNode,e):null}function me(t,e){if(!t.length)throw Error("Empty XPath expression.");var s=function(t){t=t.match(Rt);for(var e=0;e=s.length?null:s[n++]},this.snapshotItem=function(t){if(6!=e&&7!=e)throw Error("snapshotItem called with wrong result type");return t>=s.length||0>t?null:s[t]}}function ge(t){this.lookupNamespaceURI=de(t)}function be(t,s){var i=t||e,r=i.Document&&i.Document.prototype||i.document;r.evaluate&&!s||(i.XPathResult=fe,r.evaluate=function(t,e,s,i){return new me(t,s).evaluate(e,i)},r.createExpression=function(t,e){return new me(t,e)},r.createNSResolver=function(t){return new ge(t)})}o(Zt),Zt.prototype.a=function(t){return-ht(this.c,t)},Zt.prototype.toString=function(){return"Unary Expression: -"+at(this.c)},o(te),te.prototype.a=function(){return this.c},te.prototype.toString=function(){return"Number: "+this.c},fe.ANY_TYPE=0,fe.NUMBER_TYPE=1,fe.STRING_TYPE=2,fe.BOOLEAN_TYPE=3,fe.UNORDERED_NODE_ITERATOR_TYPE=4,fe.ORDERED_NODE_ITERATOR_TYPE=5,fe.UNORDERED_NODE_SNAPSHOT_TYPE=6,fe.ORDERED_NODE_SNAPSHOT_TYPE=7,fe.ANY_UNORDERED_NODE_TYPE=8,fe.FIRST_ORDERED_NODE_TYPE=9;var Ee,xe=["wgxpath","install"],ye=e;xe[0]in ye||!ye.execScript||ye.execScript("var "+xe[0]);for(;xe.length&&(Ee=xe.shift());)xe.length||void 0===be?ye=ye[Ee]?ye[Ee]:ye[Ee]={}:ye[Ee]=be;t.exports.install=be,t.exports.XPathResultType={ANY_TYPE:0,NUMBER_TYPE:1,STRING_TYPE:2,BOOLEAN_TYPE:3,UNORDERED_NODE_ITERATOR_TYPE:4,ORDERED_NODE_ITERATOR_TYPE:5,UNORDERED_NODE_SNAPSHOT_TYPE:6,ORDERED_NODE_SNAPSHOT_TYPE:7,ANY_UNORDERED_NODE_TYPE:8,FIRST_ORDERED_NODE_TYPE:9}}).call(s.g)}},i={};function r(t){var e=i[t];if(void 0!==e)return e.exports;var n=i[t]={exports:{}};return s[t](n,n.exports,r),n.exports}e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,r.t=function(s,i){if(1&i&&(s=this(s)),8&i)return s;if("object"==typeof s&&s){if(4&i&&s.__esModule)return s;if(16&i&&"function"==typeof s.then)return s}var n=Object.create(null);r.r(n);var o={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&s;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(t=>o[t]=()=>s[t]);return o.default=()=>s,r.d(n,o),n},r.d=(t,e)=>{for(var s in e)r.o(e,s)&&!r.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};r.r(t),r.d(t,{GLOBAL:()=>oi,MathJax:()=>di,combineConfig:()=>li,combineDefaults:()=>ci,combineWithMathJax:()=>hi,isObject:()=>ai});var e={};r.r(e),r.d(e,{context:()=>pi,hasWindow:()=>ui});var s={};r.r(s),r.d(s,{Package:()=>fi,PackageError:()=>mi});var i={};r.r(i),r.d(i,{PrioritizedList:()=>gi});var n={};r.r(n),r.d(n,{FunctionList:()=>bi});var o={};r.r(o),r.d(o,{CONFIG:()=>Ci,Loader:()=>vi,MathJax:()=>Ti,PathFilters:()=>yi});var a={};r.r(a),r.d(a,{APPEND:()=>Si,Expandable:()=>Ii,OPTIONS:()=>Mi,REMOVE:()=>Ri,copy:()=>Di,defaultOptions:()=>Bi,expandable:()=>wi,insert:()=>Pi,isObject:()=>Li,keys:()=>Oi,lookup:()=>Hi,makeArray:()=>ki,selectOptions:()=>ji,selectOptionsFromKeys:()=>_i,separateOptions:()=>Ui,userOptions:()=>Fi});var l={};r.r(l),r.d(l,{CONFIG:()=>Vi,MathJax:()=>qi,Startup:()=>zi});var c={};r.r(c),r.d(c,{AbstractDOMAdaptor:()=>Gi});var h={};r.r(h),r.d(h,{HTMLAdaptor:()=>Ki});var d={};r.r(d),r.d(d,{browserAdaptor:()=>Yi});var u={};r.r(u),r.d(u,{AbstractFindMath:()=>Qi});var p={};r.r(p),r.d(p,{AbstractInputJax:()=>Zi});var m={};r.r(m),r.d(m,{AbstractOutputJax:()=>tr});var f={};r.r(f),r.d(f,{END:()=>er,LinkedList:()=>ir,ListItem:()=>sr});var g={};r.r(g),r.d(g,{AbstractMathList:()=>rr});var b={};r.r(b),r.d(b,{AbstractMathItem:()=>or,STATE:()=>ar,newState:()=>lr,protoItem:()=>nr});var E={};r.r(E),r.d(E,{AbstractFactory:()=>cr});var x={};r.r(x),r.d(x,{AbstractNodeFactory:()=>hr});var y={};r.r(y),r.d(y,{Attributes:()=>ur,INHERIT:()=>dr});var N={};r.r(N),r.d(N,{AbstractEmptyNode:()=>mr,AbstractNode:()=>pr});var v={};r.r(v),r.d(v,{AbstractMmlBaseNode:()=>Cr,AbstractMmlEmptyNode:()=>Ar,AbstractMmlLayoutNode:()=>Tr,AbstractMmlNode:()=>Nr,AbstractMmlTokenNode:()=>vr,MATHVARIANTS:()=>xr,TEXCLASS:()=>fr,TEXCLASSNAMES:()=>gr,TextNode:()=>Lr,XMLNode:()=>Sr,indentAttributes:()=>yr});var T={};r.r(T),r.d(T,{MmlMath:()=>Rr});var C={};r.r(C),r.d(C,{MmlMi:()=>Mr});var A={};r.r(A),r.d(A,{MmlMn:()=>Ir});var L={};r.r(L),r.d(L,{MMLSPACING:()=>Pr,MO:()=>kr,OPDEF:()=>wr,OPTABLE:()=>Br,RANGES:()=>Or,getRange:()=>Dr});var S={};r.r(S),r.d(S,{isPercent:()=>Hr,quotePattern:()=>jr,replaceUnicode:()=>zr,sortLength:()=>Fr,split:()=>Wr,toEntity:()=>qr,unicodeChars:()=>_r,unicodeString:()=>Ur});var R={};r.r(R),r.d(R,{MmlMo:()=>Vr});var M={};r.r(M),r.d(M,{MmlMtext:()=>Xr});var I={};r.r(I),r.d(I,{MmlMspace:()=>Gr});var w={};r.r(w),r.d(w,{MmlMs:()=>Jr});var k={};r.r(k),r.d(k,{MmlInferredMrow:()=>$r,MmlMrow:()=>Kr});var O={};r.r(O),r.d(O,{MmlMfrac:()=>Yr});var D={};r.r(D),r.d(D,{MmlMsqrt:()=>Qr});var P={};r.r(P),r.d(P,{MmlMroot:()=>Zr});var B={};r.r(B),r.d(B,{MmlMstyle:()=>tn});var F={};r.r(F),r.d(F,{MmlMerror:()=>en});var j={};r.r(j),r.d(j,{MmlMpadded:()=>sn});var _={};r.r(_),r.d(_,{MmlMphantom:()=>rn});var U={};r.r(U),r.d(U,{MmlMfenced:()=>nn});var H={};r.r(H),r.d(H,{MmlMenclose:()=>on});var W={};r.r(W),r.d(W,{MmlMaction:()=>an});var z={};r.r(z),r.d(z,{MmlMsub:()=>cn,MmlMsubsup:()=>ln,MmlMsup:()=>hn});var q={};r.r(q),r.d(q,{MmlMover:()=>pn,MmlMunder:()=>un,MmlMunderover:()=>dn});var V={};r.r(V),r.d(V,{MmlMmultiscripts:()=>mn,MmlMprescripts:()=>fn,MmlNone:()=>gn});var X={};r.r(X),r.d(X,{MmlMtable:()=>bn});var G={};r.r(G),r.d(G,{MmlMlabeledtr:()=>xn,MmlMtr:()=>En});var J={};r.r(J),r.d(J,{MmlMtd:()=>yn});var K={};r.r(K),r.d(K,{MmlMaligngroup:()=>Nn});var $={};r.r($),r.d($,{MmlMalignmark:()=>vn});var Y={};r.r(Y),r.d(Y,{MmlMglyph:()=>Tn});var Q={};r.r(Q),r.d(Q,{MmlAnnotation:()=>Ln,MmlAnnotationXML:()=>An,MmlSemantics:()=>Cn});var Z={};r.r(Z),r.d(Z,{TeXAtom:()=>Sn});var tt={};r.r(tt),r.d(tt,{MathChoice:()=>Rn});var et={};r.r(et),r.d(et,{HtmlNode:()=>Mn});var st={};r.r(st),r.d(st,{MML:()=>In});var it={};r.r(it),r.d(it,{MmlFactory:()=>wn});var rt={};r.r(rt),r.d(rt,{BitField:()=>kn,BitFieldClass:()=>On});var nt={};r.r(nt),r.d(nt,{handleRetriesFor:()=>Dn,retryAfter:()=>Pn});var ot={};r.r(ot),r.d(ot,{AbstractMathDocument:()=>zn,RenderList:()=>Fn,resetAllOptions:()=>_n,resetOptions:()=>jn});var at={};r.r(at),r.d(at,{AbstractHandler:()=>Vn});var lt={};r.r(lt),r.d(lt,{HandlerList:()=>Xn});var ct={};r.r(ct),r.d(ct,{AbstractVisitor:()=>Gn});var ht={};r.r(ht),r.d(ht,{DATAMJX:()=>Jn,MmlVisitor:()=>Kn});var dt={};r.r(dt),r.d(dt,{MathMLVisitor:()=>$n});var ut={};r.r(ut),r.d(ut,{SerializedMmlVisitor:()=>Yn});var pt={};r.r(pt),r.d(pt,{AbstractWrapper:()=>Qn});var mt={};r.r(mt),r.d(mt,{AbstractWrapperFactory:()=>Zn});var ft={};r.r(ft),r.d(ft,{mathjax:()=>to});var gt={};r.r(gt),r.d(gt,{HTMLMathItem:()=>eo});var bt={};r.r(bt),r.d(bt,{HTMLMathList:()=>so});var Et={};r.r(Et),r.d(Et,{HTMLDomStrings:()=>io});var xt={};r.r(xt),r.d(xt,{HTMLDocument:()=>ro});var yt={};r.r(yt),r.d(yt,{HTMLHandler:()=>no});var Nt={};r.r(Nt),r.d(Nt,{RegisterHTMLHandler:()=>oo});var vt={};r.r(vt),r.d(vt,{StyleJsonSheet:()=>ao});var Tt={};r.r(Tt),r.d(Tt,{DraggableDialog:()=>ho,isDialog:()=>co});var Ct={};r.r(Ct),r.d(Ct,{InfoDialog:()=>uo});var At={};r.r(At),r.d(At,{asyncLoad:()=>po});var Lt={};r.r(Lt),r.d(Lt,{BIGDIMEN:()=>mo,MATHSPACE:()=>bo,RELUNITS:()=>go,UNITS:()=>fo,em:()=>yo,length2em:()=>Eo,percent:()=>xo,px:()=>No});var St={};r.r(St),r.d(St,{BBox:()=>vo});var Rt={};r.r(Rt),r.d(Rt,{add:()=>Lo,entities:()=>Co,numeric:()=>Io,options:()=>To,remove:()=>So,translate:()=>Ro});var Mt={};r.r(Mt),r.d(Mt,{Styles:()=>qo,TRBL:()=>wo,WSC:()=>ko});var It={};r.r(It),r.d(It,{max:()=>Xo,sum:()=>Vo});var wt={};r.r(wt),r.d(wt,{FindTeX:()=>Go});var kt={};r.r(kt),r.d(kt,{default:()=>Ko});var Ot={};r.r(Ot),r.d(Ot,{TexConstant:()=>$o});var Dt={};r.r(Dt),r.d(Dt,{default:()=>sa});var Pt={};r.r(Pt),r.d(Pt,{ConfigurationType:()=>ia,HandlerType:()=>ra});var Bt={};r.r(Bt),r.d(Bt,{UnitUtil:()=>oa});var Ft={};r.r(Ft),r.d(Ft,{default:()=>aa});var jt={};r.r(jt),r.d(jt,{default:()=>ca});var _t={};r.r(_t),r.d(_t,{BaseItem:()=>da,MmlStack:()=>ha});var Ut={};r.r(Ut),r.d(Ut,{default:()=>ua});var Ht={};r.r(Ht),r.d(Ht,{default:()=>fa});var Wt={};r.r(Wt),r.d(Wt,{NodeFactory:()=>ga});var zt={};r.r(zt),r.d(zt,{KeyValueDef:()=>ba,KeyValueTypes:()=>Ea,ParseUtil:()=>Na});var qt={};r.r(qt),r.d(qt,{ColumnParser:()=>va});var Vt={};r.r(Vt),r.d(Vt,{default:()=>Aa});var Xt={};r.r(Xt),r.d(Xt,{AbstractTags:()=>Ra,AllTags:()=>Ia,Label:()=>La,NoTags:()=>Ma,TagInfo:()=>Sa,TagsFactory:()=>Oa});var Gt={};r.r(Gt),r.d(Gt,{Macro:()=>Pa,Token:()=>Da});var Jt={};r.r(Jt),r.d(Jt,{AbstractParseMap:()=>_a,AbstractTokenMap:()=>Fa,CharacterMap:()=>Ua,CommandMap:()=>za,DelimiterMap:()=>Ha,EnvironmentMap:()=>qa,MacroMap:()=>Wa,RegExpMap:()=>ja,parseResult:()=>Ba});var Kt={};r.r(Kt),r.d(Kt,{MapHandler:()=>Xa,SubHandler:()=>Ga,SubHandlers:()=>Ja});var $t={};r.r($t),r.d($t,{Configuration:()=>Ka,ConfigurationHandler:()=>Ya,ParserConfiguration:()=>Qa});var Yt={};r.r(Yt),r.d(Yt,{ArrayItem:()=>Nl,BeginItem:()=>dl,BreakItem:()=>hl,CellItem:()=>fl,CloseItem:()=>sl,DotsItem:()=>yl,EndItem:()=>ul,EqnArrayItem:()=>vl,EquationItem:()=>Cl,FnItem:()=>bl,LeftItem:()=>al,Middle:()=>ll,MmlItem:()=>gl,MstyleItem:()=>Tl,NonscriptItem:()=>xl,NotItem:()=>El,NullItem:()=>il,OpenItem:()=>el,OverItem:()=>ol,PositionItem:()=>ml,PrimeItem:()=>rl,RightItem:()=>cl,StartItem:()=>Za,StopItem:()=>tl,StyleItem:()=>pl,SubsupItem:()=>nl});var Qt={};r.r(Qt),r.d(Qt,{default:()=>Il,splitAlignArray:()=>Sl});var Zt={};r.r(Zt),r.d(Zt,{default:()=>Ol});var te={};r.r(te),r.d(te,{BaseConfiguration:()=>_l,BaseTags:()=>jl,Other:()=>Fl});var ee={};r.r(ee),r.d(ee,{TeX:()=>Ul});var se={};r.r(se),r.d(se,{FlalignItem:()=>Wl,MultlineItem:()=>Hl});var ie={};r.r(ie),r.d(ie,{NewcommandPriority:()=>ql,NewcommandTables:()=>zl,NewcommandUtil:()=>Vl});var re={};r.r(re),r.d(re,{AmsMethods:()=>Jl});var ne={};r.r(ne),r.d(ne,{BeginEnvItem:()=>Kl});var oe={};r.r(oe),r.d(oe,{default:()=>Yl});var ae={};r.r(ae),r.d(ae,{NewcommandConfig:()=>Ql,NewcommandConfiguration:()=>Zl});var le={};r.r(le),r.d(le,{AmsConfiguration:()=>ec,AmsTags:()=>tc});var ce={};r.r(ce),r.d(ce,{RequireConfiguration:()=>lc,RequireLoad:()=>nc,RequireMethods:()=>oc,options:()=>ac});var he={};r.r(he),r.d(he,{AutoloadConfiguration:()=>uc});var de={};r.r(de),r.d(de,{ConfigMacrosConfiguration:()=>bc});var ue={};r.r(ue),r.d(ue,{NoUndefinedConfiguration:()=>Ec});var pe={};r.r(pe),r.d(pe,{TextParser:()=>xc});var me={};r.r(me),r.d(me,{TextMacrosMethods:()=>yc});var fe={};r.r(fe),r.d(fe,{TextBaseConfiguration:()=>vc,TextMacrosConfiguration:()=>Cc});var ge={};r.r(ge),r.d(ge,{FindMathML:()=>Lc});var be={};r.r(be),r.d(be,{MathMLCompile:()=>Sc});var Ee={};r.r(Ee),r.d(Ee,{MathML:()=>Rc});var xe={};r.r(xe),r.d(xe,{DIRECTION:()=>Mc,H:()=>wc,V:()=>Ic});var ye={};r.r(ye),r.d(ye,{DIRECTION:()=>Mc,FontData:()=>Fc,HFUZZ:()=>Dc,NOSTRETCH:()=>Pc,VFUZZ:()=>Oc,mergeOptions:()=>Bc});var Ne={};r.r(Ne),r.d(Ne,{LineBBox:()=>jc});var ve={};r.r(ve),r.d(ve,{LinebreakVisitor:()=>Hc,Linebreaks:()=>Uc,NOBREAK:()=>_c});var Te={};r.r(Te),r.d(Te,{CommonOutputJax:()=>zc,FONTPATH:()=>Wc});var Ce={};r.r(Ce),r.d(Ce,{CommonWrapperFactory:()=>qc});var Ae={};r.r(Ae),r.d(Ae,{CommonWrapper:()=>Kc,SPACE:()=>Jc});var Le={};r.r(Le),r.d(Le,{ChtmlWrapper:()=>Yc,FONTSIZE:()=>$c});var Se={};r.r(Se),r.d(Se,{CommonMathMixin:()=>Qc});var Re={};r.r(Re),r.d(Re,{ChtmlMath:()=>Zc});var Me={};r.r(Me),r.d(Me,{CommonMiMixin:()=>th});var Ie={};r.r(Ie),r.d(Ie,{ChtmlMi:()=>eh});var we={};r.r(we),r.d(we,{Usage:()=>sh});var ke={};r.r(ke),r.d(ke,{AddCSS:()=>rh,ChtmlFontData:()=>ih,DIRECTION:()=>Mc,FontData:()=>Fc,HFUZZ:()=>Dc,NOSTRETCH:()=>Pc,VFUZZ:()=>Oc,mergeOptions:()=>Bc});var Oe={};r.r(Oe),r.d(Oe,{CommonMoMixin:()=>nh});var De={};r.r(De),r.d(De,{ChtmlMo:()=>oh});var Pe={};r.r(Pe),r.d(Pe,{CommonMnMixin:()=>ah});var Be={};r.r(Be),r.d(Be,{ChtmlMn:()=>lh});var Fe={};r.r(Fe),r.d(Fe,{CommonMsMixin:()=>ch});var je={};r.r(je),r.d(je,{ChtmlMs:()=>hh});var _e={};r.r(_e),r.d(_e,{CommonMtextMixin:()=>dh});var Ue={};r.r(Ue),r.d(Ue,{ChtmlMtext:()=>uh});var He={};r.r(He),r.d(He,{CommonMspaceMixin:()=>ph});var We={};r.r(We),r.d(We,{ChtmlMspace:()=>mh});var ze={};r.r(ze),r.d(ze,{CommonMpaddedMixin:()=>fh});var qe={};r.r(qe),r.d(qe,{ChtmlMpadded:()=>gh});var Ve={};r.r(Ve),r.d(Ve,{ARROWDX:()=>Eh,ARROWX:()=>bh,ARROWY:()=>xh,CommonArrow:()=>jh,CommonBorder:()=>Dh,CommonBorder2:()=>Ph,CommonDiagonalArrow:()=>Fh,CommonDiagonalStrike:()=>Bh,PADDING:()=>Nh,SOLID:()=>vh,THICKNESS:()=>yh,arrowBBox:()=>Oh,arrowBBoxHD:()=>Mh,arrowBBoxW:()=>Ih,arrowDef:()=>wh,arrowHead:()=>Rh,diagonalArrowDef:()=>kh,fullBBox:()=>Ah,fullBorder:()=>Sh,fullPadding:()=>Lh,sideIndex:()=>Th,sideNames:()=>Ch});var Xe={};r.r(Xe),r.d(Xe,{CommonMencloseMixin:()=>_h});var Ge={};r.r(Ge),r.d(Ge,{ARROWDX:()=>Eh,ARROWX:()=>bh,ARROWY:()=>xh,Arrow:()=>Vh,Border:()=>Hh,Border2:()=>Wh,CommonArrow:()=>jh,CommonBorder:()=>Dh,CommonBorder2:()=>Ph,CommonDiagonalArrow:()=>Fh,CommonDiagonalStrike:()=>Bh,DiagonalArrow:()=>qh,DiagonalStrike:()=>zh,PADDING:()=>Nh,RenderElement:()=>Uh,SOLID:()=>vh,THICKNESS:()=>yh,arrowBBox:()=>Oh,arrowBBoxHD:()=>Mh,arrowBBoxW:()=>Ih,arrowDef:()=>wh,arrowHead:()=>Rh,diagonalArrowDef:()=>kh,fullBBox:()=>Ah,fullBorder:()=>Sh,fullPadding:()=>Lh,sideIndex:()=>Th,sideNames:()=>Ch});var Je={};r.r(Je),r.d(Je,{ChtmlMenclose:()=>Jh});var Ke={};r.r(Ke),r.d(Ke,{CommonInferredMrowMixin:()=>$h,CommonMrowMixin:()=>Kh});var $e={};r.r($e),r.d($e,{ChtmlInferredMrow:()=>Qh,ChtmlMrow:()=>Yh});var Ye={};r.r(Ye),r.d(Ye,{CommonMfencedMixin:()=>Zh});var Qe={};r.r(Qe),r.d(Qe,{ChtmlMfenced:()=>td});var Ze={};r.r(Ze),r.d(Ze,{CommonMfracMixin:()=>ed});var ts={};r.r(ts),r.d(ts,{ChtmlMfrac:()=>sd});var es={};r.r(es),r.d(es,{CommonMsqrtMixin:()=>id});var ss={};r.r(ss),r.d(ss,{ChtmlMsqrt:()=>rd});var is={};r.r(is),r.d(is,{CommonMrootMixin:()=>nd});var rs={};r.r(rs),r.d(rs,{ChtmlMroot:()=>od});var ns={};r.r(ns),r.d(ns,{CommonMsubMixin:()=>ad,CommonMsubsupMixin:()=>cd,CommonMsupMixin:()=>ld});var os={};r.r(os),r.d(os,{CommonScriptbaseMixin:()=>hd});var as={};r.r(as),r.d(as,{ChtmlScriptbase:()=>dd});var ls={};r.r(ls),r.d(ls,{ChtmlMsub:()=>ud,ChtmlMsubsup:()=>md,ChtmlMsup:()=>pd});var cs={};r.r(cs),r.d(cs,{CommonMoverMixin:()=>gd,CommonMunderMixin:()=>fd,CommonMunderoverMixin:()=>bd});var hs={};r.r(hs),r.d(hs,{ChtmlMover:()=>xd,ChtmlMunder:()=>Ed,ChtmlMunderover:()=>yd});var ds={};r.r(ds),r.d(ds,{CommonMmultiscriptsMixin:()=>Td,NextScript:()=>Nd,ScriptNames:()=>vd});var us={};r.r(us),r.d(us,{ChtmlMmultiscripts:()=>Cd});var ps={};r.r(ps),r.d(ps,{BREAK_BELOW:()=>Ad,CommonMtableMixin:()=>Ld});var ms={};r.r(ms),r.d(ms,{ChtmlMtable:()=>Sd});var fs={};r.r(fs),r.d(fs,{CommonMlabeledtrMixin:()=>Md,CommonMtrMixin:()=>Rd});var gs={};r.r(gs),r.d(gs,{ChtmlMlabeledtr:()=>wd,ChtmlMtr:()=>Id});var bs={};r.r(bs),r.d(bs,{CommonMtdMixin:()=>kd});var Es={};r.r(Es),r.d(Es,{ChtmlMtd:()=>Od});var xs={};r.r(xs),r.d(xs,{CommonMactionMixin:()=>Pd,TooltipData:()=>Dd});var ys={};r.r(ys),r.d(ys,{ChtmlMaction:()=>Bd});var Ns={};r.r(Ns),r.d(Ns,{CommonMglyphMixin:()=>Fd});var vs={};r.r(vs),r.d(vs,{ChtmlMglyph:()=>jd});var Ts={};r.r(Ts),r.d(Ts,{CommonSemanticsMixin:()=>_d});var Cs={};r.r(Cs),r.d(Cs,{CommonXmlNodeMixin:()=>Ud});var As={};r.r(As),r.d(As,{ChtmlAnnotation:()=>Wd,ChtmlAnnotationXML:()=>zd,ChtmlSemantics:()=>Hd,ChtmlXmlNode:()=>qd});var Ls={};r.r(Ls),r.d(Ls,{CommonTeXAtomMixin:()=>Vd});var Ss={};r.r(Ss),r.d(Ss,{ChtmlTeXAtom:()=>Xd});var Rs={};r.r(Rs),r.d(Rs,{CommonTextNodeMixin:()=>Gd});var Ms={};r.r(Ms),r.d(Ms,{ChtmlTextNode:()=>Jd});var Is={};r.r(Is),r.d(Is,{ChtmlHtmlNode:()=>Kd});var ws={};r.r(ws),r.d(ws,{ChtmlWrappers:()=>$d});var ks={};r.r(ks),r.d(ks,{ChtmlWrapperFactory:()=>Yd});var Os={};r.r(Os),r.d(Os,{DefaultFont:()=>iu,fontName:()=>su});var Ds={};r.r(Ds),r.d(Ds,{CHTML:()=>ru});var Ps={};r.r(Ps),r.d(Ps,{AddFontIds:()=>nu});var Bs={};r.r(Bs),r.d(Bs,{MJContextMenu:()=>rp});var Fs={};r.r(Fs),r.d(Fs,{addPreference:()=>_b,engineSetup:()=>Bb,fromPreference:()=>Ub,locales:()=>Db,parseDOM:()=>jb,setupEngine:()=>Pb,toEnriched:()=>Fb,toPreference:()=>Hb});var js={};r.r(js),r.d(js,{clearspeakMenu:()=>$b,localeMenu:()=>Qb});var _s={};r.r(_s),r.d(_s,{copyToClipboard:()=>tE,isMac:()=>Zb});var Us={};r.r(Us),r.d(Us,{annotation:()=>rE,copyAnnotations:()=>sE,showAnnotations:()=>eE});var Hs={};r.r(Hs),r.d(Hs,{RadioCompare:()=>aE});var Ws={};r.r(Ws),r.d(Ws,{MmlVisitor:()=>lE});var zs={};r.r(zs),r.d(zs,{Menu:()=>dE});var qs={};r.r(qs),r.d(qs,{MenuHandler:()=>mE,MenuMathDocumentMixin:()=>pE,MenuMathItemMixin:()=>uE});var Vs={};r.r(Vs),r.d(Vs,{EnrichHandler:()=>EE,EnrichedMathDocumentMixin:()=>bE,EnrichedMathItemMixin:()=>gE,enrichVisitor:()=>fE});var Xs={};r.r(Xs),r.d(Xs,{InPlace:()=>ME,SemAttr:()=>IE,buildLabel:()=>LE,buildSpeech:()=>SE,honk:()=>RE,ssmlParsing:()=>yE});var Gs={};r.r(Gs),r.d(Gs,{GeneratorPool:()=>wE});var Js={};r.r(Js),r.d(Js,{WorkerHandler:()=>DE});var Ks={};r.r(Ks),r.d(Ks,{SpeechHandler:()=>UE,SpeechMathDocumentMixin:()=>_E,SpeechMathItemMixin:()=>jE});var $s={};r.r($s),r.d($s,{AbstractRegion:()=>HE,DummyRegion:()=>WE,HoverRegion:()=>GE,LiveRegion:()=>VE,SpeechRegion:()=>XE,StringRegion:()=>zE,ToolTip:()=>qE});var Ys={};r.r(Ys),r.d(Ys,{AbstractExplorer:()=>JE});var Qs={};r.r(Qs),r.d(Qs,{SpeechExplorer:()=>ex,hasModifiers:()=>tx,isContainer:()=>ZE});var Zs={};r.r(Zs),r.d(Zs,{AbstractMouseExplorer:()=>ix,ContentHoverer:()=>ox,FlameHoverer:()=>ax,Hoverer:()=>rx,ValueHoverer:()=>nx});var ti={};r.r(ti),r.d(ti,{AbstractTreeExplorer:()=>lx,ContrastPicker:()=>dx,FlameColorer:()=>cx,TreeColorer:()=>hx});var ei={};r.r(ei),r.d(ei,{ATTR:()=>mx,getHighlighter:()=>Ex});var si={};r.r(si),r.d(si,{ExplorerPool:()=>vx,RegionPool:()=>yx});var ii={};r.r(ii),r.d(ii,{ExplorerHandler:()=>Lx,ExplorerMathDocumentMixin:()=>Ax,ExplorerMathItemMixin:()=>Cx,setA11yOption:()=>Rx,setA11yOptions:()=>Sx});const ri="4.1.2",ni={},oi="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof globalThis?globalThis:ni;function ai(t){return"object"==typeof t&&null!==t}function li(t,e,s=!1){var i;for(const r of Object.keys(e))"__esModule"!==r&&t[r]!==e[r]&&null!==e[r]&&void 0!==e[r]&&(ai(t[r])&&ai(e[r])?li(t[r],e[r],s||"_"===r):s&&(null===(i=Object.getOwnPropertyDescriptor(t,r))||void 0===i?void 0:i.get)||(t[r]=e[r]));return t}function ci(t,e,s){t[e]||(t[e]={}),t=t[e];for(const e of Object.keys(s))ai(t[e])&&ai(s[e])?ci(t,e,s[e]):null==t[e]&&null!=s[e]&&(t[e]=s[e]);return t}function hi(t){return li(di,t)}void 0!==oi.MathJax&&oi.MathJax.constructor==={}.constructor||(oi.MathJax={}),oi.MathJax.version||(oi.MathJax={version:ri,_:{},config:oi.MathJax});const di=oi.MathJax;!Object.hasOwn&&di.config.startup.polyfillHasOwn&&(Object.hasOwn=function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)});const ui="undefined"!=typeof window,pi={window:ui?window:null,document:ui?window.document:null,os:(()=>{if(ui&&window.navigator){const t=window.navigator.appVersion,e=[["Win","Windows"],["Mac","MacOS"],["X11","Unix"],["Linux","Unix"]];for(const[s,i]of e)if(t.includes(s))return i;if(window.navigator.userAgent.includes("Android"))return"Unix"}else if("undefined"!=typeof process)return{linux:"Unix",android:"Unix",aix:"Unix",freebsd:"Unix",netbsd:"Unix",openbsd:"Unix",sunos:"Unix",darwin:"MacOS",win32:"Windows",cygwin:"Windows"}[process.platform]||process.platform;return"unknown"})(),path:t=>t};"Windows"===pi.os&&(pi.path=t=>t.match(/^[/\\]?[a-zA-Z]:[/\\]/)?"file://"+t.replace(/\\/g,"/").replace(/^\//,""):t.replace(/^\//,"file:///"));class mi extends Error{constructor(t,e){super(t),this.package=e}}class fi{get canLoad(){return 0===this.dependencyCount&&!this.noLoad&&!this.isLoading&&!this.hasFailed}static loadPromise(t){const e=Ci[t]||{},s=e.extraLoads?vi.load(...e.extraLoads):Promise.resolve(),i=e.checkReady||(()=>Promise.resolve());return s.then(()=>i())}static resolvePath(t,e=!0){const s={name:t,original:t,addExtension:e};return vi.pathFilters.execute(s),s.name}static loadAll(){for(const t of this.packages.values())t.canLoad&&t.load()}constructor(t,e=!1){this.isLoaded=!1,this.result={},this.isLoading=!1,this.hasFailed=!1,this.dependents=[],this.dependencies=[],this.dependencyCount=0,this.provided=[],this.name=t,this.noLoad=e,fi.packages.set(t,this),this.promise=this.makePromise(this.makeDependencies())}makeDependencies(){const t=[],e=fi.packages,s=this.noLoad,i=this.name,r=[];Object.hasOwn(Ci.dependencies,i)?r.push(...Ci.dependencies[i]):"core"!==i&&r.push("core");for(const i of r){const r=e.get(i)||new fi(i,s);this.dependencies.includes(r)||(r.addDependent(this,s),this.dependencies.push(r),r.isLoaded||(this.dependencyCount++,t.push(r.promise)))}return t}makePromise(t){let e=new Promise((t,e)=>{this.resolve=t,this.reject=e});const s=Ci[this.name]||{};return s.ready&&(e=e.then(t=>s.ready(this.name))),t.length&&(t.push(e),e=Promise.all(t).then(t=>t.join(", "))),s.failed&&e.catch(t=>s.failed(new mi(t,this.name))),e}load(){if(!this.isLoaded&&!this.isLoading&&!this.noLoad){this.isLoading=!0;const t=fi.resolvePath(this.name);Ci.require?this.loadCustom(t):this.loadScript(t)}}loadCustom(t){try{const e=Ci.require(t);e instanceof Promise?e.then(t=>this.result=t).then(()=>this.checkLoad()).catch(e=>this.failed("Can't load \""+t+'"\n'+e.message.trim())):(this.result=e,this.checkLoad())}catch(t){this.failed(t.message)}}loadScript(t){const e=pi.document.createElement("script");e.src=t,e.charset="UTF-8",e.onload=t=>this.checkLoad(),e.onerror=e=>this.failed("Can't load \""+t+'"'),pi.document.head.appendChild(e)}loaded(){this.isLoaded=!0,this.isLoading=!1;for(const t of this.dependents)t.requirementSatisfied();for(const t of this.provided)t.loaded();this.resolve(this.name)}failed(t){this.hasFailed=!0,this.isLoading=!1,this.reject(new mi(t,this.name))}checkLoad(){fi.loadPromise(this.name).then(()=>this.loaded()).catch(t=>this.failed(t))}requirementSatisfied(){this.dependencyCount&&(this.dependencyCount--,this.canLoad&&this.load())}provides(t=[]){for(const e of t){let t=fi.packages.get(e);t||(Ci.dependencies[e]||(Ci.dependencies[e]=[]),Ci.dependencies[e].push(e),t=new fi(e,!0),t.isLoading=!0),this.provided.push(t)}}addDependent(t,e){this.dependents.push(t),e||this.checkNoLoad()}checkNoLoad(){if(this.noLoad){this.noLoad=!1;for(const t of this.dependencies)t.checkNoLoad()}}}fi.packages=new Map;class gi{constructor(){this.items=[],this.items=[]}[Symbol.iterator](){let t=0;const e=this.items;return{next:()=>({value:e[t++],done:t>e.length})}}add(t,e=gi.DEFAULTPRIORITY){let s=this.items.length;do{s--}while(s>=0&&e=0&&this.items[e].item!==t);return e>=0&&this.items.splice(e,1),this}}gi.DEFAULTPRIORITY=5;class bi extends gi{constructor(t=null){super(),t&&this.addList(t)}addList(t){for(const e of t)Array.isArray(e)?this.add(e[0],e[1]):this.add(e)}execute(...t){for(const e of this){if(!1===e.item(...t))return!1}return!0}asyncExecute(...t){let e=-1;const s=this.items;return new Promise((i,r)=>{!function n(){for(;++er(t));if(!1===o)return void i(!1)}i(!0)}()})}}const Ei=di.config||{};var xi=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const yi={source:t=>(Object.hasOwn(Ci.source,t.name)&&(t.name=Ci.source[t.name]),!0),normalize:t=>{const e=t.name;return e.match(/^(?:[a-z]+:\/)?\/|[a-z]:[/\\]|\[/i)||(t.name="[mathjax]/"+e.replace(/^\.\//,"")),!0},prefix:t=>{let e;for(;(e=t.name.match(/^\[([^\]]*)\]/))&&Object.hasOwn(Ci.paths,e[1]);)t.name=Ci.paths[e[1]]+t.name.substring(e[0].length);return!0},addExtension:t=>(t.addExtension&&!t.name.match(/\.[^/]+$/)&&(t.name+=".js"),!0)},Ni=di.version,vi={versions:new Map,nestedLoads:[],ready(...t){0===t.length&&(t=Array.from(fi.packages.keys()));const e=[];for(const s of t){const t=fi.packages.get(s)||new fi(s,!0);e.push(t.promise)}return Promise.all(e)},load(...t){if(0===t.length)return Promise.resolve([]);let e=[];this.nestedLoads.unshift(e);const s=Promise.resolve().then(()=>xi(this,void 0,void 0,function*(){const s=[];for(const e of t){let t=fi.packages.get(e);t||(t=new fi(e),t.provides(Ci.provides[e])),t.checkNoLoad(),s.push(t.promise.then(()=>(Ci.versionWarnings&&t.isLoaded&&!vi.versions.has(fi.resolvePath(e))&&console.warn(`No version information available for component ${e}`),t.result)))}fi.loadAll();const i=yield Promise.all(s);for(;e.length;){const t=Promise.all(e);e=this.nestedLoads[this.nestedLoads.indexOf(e)]=[],yield t}return this.nestedLoads.splice(this.nestedLoads.indexOf(e),1),i}));return this.nestedLoads.slice(1).forEach(t=>t.push(s)),s},preLoaded(...t){for(const e of t){let t=fi.packages.get(e);t||(t=new fi(e,!0),t.provides(Ci.provides[e])),t.loaded()}},addPackageData(t,e){let s=Ci[t];s||(s=Ci[t]={});for(const[t,i]of Object.entries(e))if(Array.isArray(i)){s[t]||(s[t]=[]);const e=new Set([...s[t],...i]);s[t]=[...e]}else s[t]=i},defaultReady(){void 0!==Ti.startup&&Ti.config.startup.ready()},getRoot(){if(pi.document){const t=pi.document.currentScript||pi.document.getElementById("MathJax-script");if(t&&t instanceof HTMLScriptElement)return t.src.replace(/\/[^/]*$/,"")}return Ei?.loader?.paths?.mathjax||Ei?.__dirname||"/"},checkVersion(t,e,s){return this.saveVersion(t),!(!Ci.versionWarnings||e===Ni)&&(console.warn(`Component ${t} uses ${e} of MathJax; version in use is ${Ni}`),!0)},saveVersion(t){vi.versions.set(fi.resolvePath(t),Ni)},pathFilters:new bi};vi.pathFilters.add(yi.source,0),vi.pathFilters.add(yi.normalize,10),vi.pathFilters.add(yi.prefix,20),vi.pathFilters.add(yi.addExtension,30);const Ti=di;if(void 0===Ti.loader){ci(Ti.config,"loader",{paths:{mathjax:vi.getRoot(),fonts:pi.window?"https://cdn.jsdelivr.net/npm/@mathjax":"@mathjax"},source:{},dependencies:{},provides:{},load:[],ready:vi.defaultReady.bind(vi),failed:t=>console.log(`MathJax(${t.package||"?"}): ${t.message}`),require:null,pathFilters:[],versionWarnings:!0}),hi({loader:vi});for(const t of Ti.config.loader.pathFilters)Array.isArray(t)?vi.pathFilters.add(t[0],t[1]):vi.pathFilters.add(t)}const Ci=Ti.config.loader,Ai={}.constructor;function Li(t){return"object"==typeof t&&null!==t&&(t.constructor===Ai||t.constructor===Ii)}const Si="[+]",Ri="[-]",Mi={invalidOption:"warn",optionError:(t,e)=>{if("fatal"===Mi.invalidOption)throw new Error(t);console.warn("MathJax: "+t)}};class Ii{}function wi(t){return Object.assign(Object.create(Ii.prototype),t)}function ki(t){return Array.isArray(t)?t:[t]}function Oi(t){return t?Object.keys(t).concat(Object.getOwnPropertySymbols(t)):[]}function Di(t){const e={};for(const s of Oi(t)){const i=Object.getOwnPropertyDescriptor(t,s),r=i.value;Array.isArray(r)?i.value=Pi([],r,!1):Li(r)&&(i.value=Di(r)),i.enumerable&&(e[s]=i)}return Object.defineProperties(t.constructor===Ii?wi({}):{},e)}function Pi(t,e,s=!0){for(let i of Oi(e)){if(s&&void 0===t[i]&&t.constructor!==Ii){"symbol"==typeof i&&(i=i.toString()),Mi.optionError(`Invalid option "${i}" (no default value).`,i);continue}const r=e[i];let n=t[i];if(!Li(r)||null===n||"object"!=typeof n&&"function"!=typeof n)Array.isArray(r)?(t[i]=[],Pi(t[i],r,!1)):Li(r)?t[i]=Di(r):t[i]=r;else{const e=Oi(r);Array.isArray(n)&&(1===e.length&&(e[0]===Si||e[0]===Ri)&&Array.isArray(r[e[0]])||2===e.length&&e.sort().join(",")===Si+","+Ri&&Array.isArray(r[Si])&&Array.isArray(r[Ri]))?(r[Ri]&&(n=t[i]=n.filter(t=>r[Ri].indexOf(t)<0)),r[Si]&&(t[i]=[...n,...r[Si]])):Pi(n,r,s)}}return t}function Bi(t,...e){return e.forEach(e=>Pi(t,e,!1)),t}function Fi(t,...e){return e.forEach(e=>Pi(t,e,!0)),t}function ji(t,...e){const s={};for(const i of e)Object.hasOwn(t,i)&&(s[i]=t[i]);return s}function _i(t,e){return ji(t,...Object.keys(e))}function Ui(t,...e){const s=[];for(const i of e){const e={},r={};for(const s of Object.keys(t||{}))(void 0===i[s]?r:e)[s]=t[s];s.push(e),t=r}return s.unshift(t),s}function Hi(t,e,s=null){return Object.hasOwn(e,t)?e[t]:s}var Wi=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};class zi{static toMML(t){return zi.visitor.visitTree(t,this.document)}static registerConstructor(t,e){zi.constructors[t]=e}static useHandler(t,e=!1){Vi.handler&&!e||(Vi.handler=t)}static useAdaptor(t,e=!1){Vi.adaptor&&!e||(Vi.adaptor=t)}static useInput(t,e=!1){Xi&&!e||Vi.input.push(t)}static useOutput(t,e=!1){Vi.output&&!e||(Vi.output=t)}static extendHandler(t,e=10){zi.extensions.add(t,e)}static defaultReady(){zi.getComponents(),zi.makeMethods(),zi.pagePromise.then(()=>Vi.pageReady()).then(()=>zi.promiseResolve()).catch(t=>zi.promiseReject(t))}static defaultPageReady(){return(Vi.loadAllFontFiles&&zi.output.font?zi.output.font.loadDynamicFiles():Promise.resolve()).then(()=>{var t;return null===(t=zi.document.menu)||void 0===t?void 0:t.loadingPromise}).then(Vi.typeset&&qi.typesetPromise?()=>zi.typesetPromise(Vi.elements):Promise.resolve()).then(()=>zi.promiseResolve())}static typesetPromise(t){return this.hasTypeset=!0,zi.document.whenReady(()=>Wi(this,void 0,void 0,function*(){zi.document.options.elements=t,zi.document.reset(),yield zi.document.renderPromise()}))}static getComponents(){zi.visitor=new qi._.core.MmlTree.SerializedMmlVisitor.SerializedMmlVisitor,zi.mathjax=qi._.mathjax.mathjax,zi.input=zi.getInputJax(),zi.output=zi.getOutputJax(),zi.adaptor=zi.getAdaptor(),zi.handler&&zi.mathjax.handlers.unregister(zi.handler),zi.handler=zi.getHandler(),zi.handler&&(zi.mathjax.handlers.register(zi.handler),zi.document=zi.getDocument())}static makeMethods(){zi.input&&zi.output&&zi.makeTypesetMethods();const t=zi.output?zi.output.name.toLowerCase():"";for(const e of zi.input){const s=e.name.toLowerCase();zi.makeMmlMethods(s,e),zi.makeResetMethod(s,e),zi.output&&zi.makeOutputMethods(s,t,e)}qi.done=()=>zi.document.done(),qi.whenReady=t=>zi.document.whenReady(t)}static makeTypesetMethods(){qi.typeset=(t=null)=>{this.hasTypeset=!0,zi.document.options.elements=t,zi.document.reset(),zi.document.render()},qi.typesetPromise=(t=null)=>zi.typesetPromise(t),qi.typesetClear=(t=null)=>{t?zi.document.clearMathItemsWithin(t):zi.document.clear()}}static makeOutputMethods(t,e,s){const i=t+"2"+e;qi[i]=(t,e={})=>(e=Object.assign(Object.assign({},e),{format:s.name}),zi.document.convert(t,e)),qi[i+"Promise"]=(t,e={})=>(e=Object.assign(Object.assign({},e),{format:s.name}),zi.document.convertPromise(t,e)),qi[e+"Stylesheet"]=()=>zi.output.styleSheet(zi.document),"getMetricsFor"in zi.output&&(qi.getMetricsFor=(t,e)=>zi.output.getMetricsFor(t,e))}static makeMmlMethods(t,e){const s=qi._.core.MathItem.STATE;qi[t+"2mml"]=(t,i={})=>(i=Object.assign(Object.assign({},i),{end:s.CONVERT,format:e.name}),zi.toMML(zi.document.convert(t,i))),qi[t+"2mmlPromise"]=(t,...i)=>Wi(this,[t,...i],void 0,function*(t,i={}){i=Object.assign(Object.assign({},i),{end:s.CONVERT,format:e.name});const r=yield zi.document.convertPromise(t,i);return zi.toMML(r)})}static makeResetMethod(t,e){qi[t+"Reset"]=(...t)=>e.reset(...t)}static getInputJax(){const t=[];for(const e of Vi.input){const s=zi.constructors[e];if(!s)throw Error('Input Jax "'+e+'" is not defined (has it been loaded?)');t[e]=new s(qi.config[e]),t.push(t[e])}return t}static getOutputJax(){const t=Vi.output;if(!t)return null;const e=zi.constructors[t];if(!e)throw Error('Output Jax "'+t+'" is not defined (has it been loaded?)');return new e(qi.config[t])}static getAdaptor(){const t=Vi.adaptor;if(!t||"none"===t)return null;const e=zi.constructors[t];if(!e)throw Error('DOMAdaptor "'+t+'" is not defined (has it been loaded?)');return e(qi.config[t])}static getHandler(){const t=Vi.handler;if(!t||"none"===t||!zi.adaptor)return null;const e=zi.constructors[t];if(!e)throw Error('Handler "'+t+'" is not defined (has it been loaded?)');let s=new e(zi.adaptor,5);for(const t of zi.extensions)s=t.item(s);return s}static getDocument(t=null){return zi.mathjax.document(t||Vi.document,Object.assign(Object.assign({},qi.config.options),{InputJax:zi.input,OutputJax:zi.output}))}}zi.extensions=new gi,zi.constructors={},zi.input=[],zi.output=null,zi.handler=null,zi.adaptor=null,zi.elements=null,zi.document=null,zi.promise=new Promise((t,e)=>{zi.promiseResolve=t,zi.promiseReject=e}),zi.pagePromise=new Promise((t,e)=>{const s=oi.document;if(s&&s.readyState&&"complete"!==s.readyState&&"interactive"!==s.readyState){const e=()=>t();s.defaultView.addEventListener("load",e,!0),s.defaultView.addEventListener("DOMContentLoaded",e,!0)}else t()}),zi.hasTypeset=!1,zi.defaultOptionError=Mi.optionError;const qi=di;void 0===qi._.startup&&(ci(qi.config,"startup",{input:[],output:"",handler:null,adaptor:null,document:pi.document||"",elements:null,typeset:!0,ready:zi.defaultReady.bind(zi),pageReady:zi.defaultPageReady.bind(zi),polyfillHasOwn:!0}),hi({startup:zi,options:{}}),qi.config.startup.invalidOption&&(Mi.invalidOption=qi.config.startup.invalidOption),qi.config.startup.optionError&&(Mi.optionError=qi.config.startup.optionError));const Vi=qi.config.startup,Xi=0!==Vi.input.length;MathJax.loader&&MathJax.loader.checkVersion("startup",ri,"startup"),hi({_:{components:{loader:o,package:s,startup:l}}});vi.preLoaded("loader","startup"),ci(MathJax.config.loader,"dependencies",{"a11y/semantic-enrich":["input/mml","a11y/sre"],"a11y/speech":["a11y/semantic-enrich"],"a11y/complexity":["a11y/semantic-enrich"],"a11y/explorer":["a11y/speech"],"[mml]/mml3":["input/mml"],"[tex]/action":["input/tex-base"],"[tex]/ams":["input/tex-base","[tex]/newcommand"],"[tex]/amscd":["input/tex-base"],"[tex]/autoload":["input/tex-base","[tex]/require"],"[tex]/bbm":["input/tex-base"],"[tex]/bboldx":["input/tex-base","[tex]/textmacros"],"[tex]/bbox":["input/tex-base"],"[tex]/begingroup":["input/tex-base","[tex]/newcommand"],"[tex]/boldsymbol":["input/tex-base"],"[tex]/braket":["input/tex-base"],"[tex]/bussproofs":["input/tex-base"],"[tex]/cancel":["input/tex-base","[tex]/enclose"],"[tex]/cases":["[tex]/empheq"],"[tex]/centernot":["input/tex-base"],"[tex]/color":["input/tex-base"],"[tex]/colortbl":["input/tex-base","[tex]/color"],"[tex]/colorv2":["input/tex-base"],"[tex]/configmacros":["input/tex-base","[tex]/newcommand"],"[tex]/dsfont":["input/tex-base"],"[tex]/empheq":["input/tex-base","[tex]/ams"],"[tex]/enclose":["input/tex-base"],"[tex]/extpfeil":["input/tex-base","[tex]/newcommand","[tex]/ams"],"[tex]/gensymb":["input/tex-base"],"[tex]/html":["input/tex-base"],"[tex]/mathtools":["input/tex-base","[tex]/newcommand","[tex]/ams","[tex]/boldsymbol"],"[tex]/mhchem":["input/tex-base","[tex]/ams"],"[tex]/newcommand":["input/tex-base"],"[tex]/noerrors":["input/tex-base"],"[tex]/noundefined":["input/tex-base"],"[tex]/physics":["input/tex-base"],"[tex]/require":["input/tex-base"],"[tex]/setoptions":["input/tex-base"],"[tex]/tagformat":["input/tex-base"],"[tex]/texhtml":["input/tex-base"],"[tex]/textcomp":["input/tex-base","[tex]/textmacros"],"[tex]/textmacros":["input/tex-base"],"[tex]/unicode":["input/tex-base"],"[tex]/units":["input/tex-base"],"[tex]/upgreek":["input/tex-base"],"[tex]/verb":["input/tex-base"],"ui/menu":["a11y/sre"]}),ci(MathJax.config.loader,"paths",{tex:"[mathjax]/input/tex/extensions",mml:"[mathjax]/input/mml/extensions",sre:"[mathjax]/sre",mathmaps:"[sre]/mathmaps"}),ci(MathJax.config.loader,"provides",{startup:["loader"],"input/tex":["input/tex-base","[tex]/ams","[tex]/newcommand","[tex]/textmacros","[tex]/noundefined","[tex]/require","[tex]/autoload","[tex]/configmacros"]}),ci(MathJax.config.loader,"source",{"[tex]/amsCd":"[tex]/amscd","[tex]/colorV2":"[tex]/colorv2","[tex]/configMacros":"[tex]/configmacros","[tex]/tagFormat":"[tex]/tagformat"});class Gi{constructor(t=null){this.canMeasureNodes=!0,this.document=t}node(t,e={},s=[],i){const r=this.create(t,i);this.setAttributes(r,e);for(const t of s)this.append(r,t);return r}setProperty(t,e,s){t[e]=s}getProperty(t,e){return t[e]}setAttributes(t,e){if(e.style&&"string"!=typeof e.style)for(const s of Object.keys(e.style))this.setStyle(t,s.replace(/-([a-z])/g,(t,e)=>e.toUpperCase()),e.style[s]);if(e.properties)for(const s of Object.keys(e.properties))t[s]=e.properties[s];for(const s of Object.keys(e))"style"===s&&"string"!=typeof e.style||"properties"===s||this.setAttribute(t,s,e[s])}replace(t,e){return this.insert(t,e),this.remove(e),e}childNode(t,e){return this.childNodes(t)[e]}allClasses(t){const e=this.getAttribute(t,"class");return e?e.replace(/  +/g," ").replace(/^ /,"").replace(/ $/,"").split(/ /):[]}cssText(t){return"style"===this.kind(t)?this.textContent(t):""}}var Ji=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};class Ki extends Gi{constructor(t){super(t.document),this.canMeasureNodes=!0,this.window=t,this.parser=new t.DOMParser}parse(t,e="text/html"){return this.parser.parseFromString(t,e)}create(t,e){return e?this.document.createElementNS(e,t):this.document.createElement(t)}text(t){return this.document.createTextNode(t)}head(t=this.document){return t.head||t}body(t=this.document){return t.body||t}root(t=this.document){return t.documentElement||t}doctype(t=this.document){return t.doctype?``:""}tags(t,e,s=null){const i=s?t.getElementsByTagNameNS(s,e):t.getElementsByTagName(e);return Array.from(i)}getElements(t,e){let s=[];for(const e of t)"string"==typeof e?s=s.concat(Array.from(this.document.querySelectorAll(e))):Array.isArray(e)||e instanceof this.window.NodeList||e instanceof this.window.HTMLCollection?s=s.concat(Array.from(e)):s.push(e);return s}getElement(t,e=this.document){return e.querySelector(t)}contains(t,e){return t.contains(e)}parent(t){return t.parentNode}append(t,e){return t.appendChild(e)}insert(t,e){return this.parent(e).insertBefore(t,e)}remove(t){return this.parent(t).removeChild(t)}replace(t,e){return this.parent(e).replaceChild(t,e)}clone(t,e=!0){return t.cloneNode(e)}split(t,e){return t.splitText(e)}next(t){return t.nextSibling}previous(t){return t.previousSibling}firstChild(t){return t.firstChild}lastChild(t){return t.lastChild}childNodes(t){return Array.from(t.childNodes)}childNode(t,e){return t.childNodes[e]}kind(t){const e=t.nodeType;return 1===e||3===e||8===e?t.nodeName.toLowerCase():""}value(t){return t.nodeValue||""}textContent(t){return t.textContent}innerHTML(t){return t.innerHTML}outerHTML(t){return t.outerHTML}serializeXML(t){return(new this.window.XMLSerializer).serializeToString(t)}setAttribute(t,e,s,i=null){return i?(e=i.replace(/.*\//,"")+":"+e.replace(/^.*:/,""),t.setAttributeNS(i,e,s)):("style"===e&&(s=s.replace(/\n/g," ")),t.setAttribute(e,s))}getAttribute(t,e){return t.getAttribute(e)}removeAttribute(t,e){return t.removeAttribute(e)}hasAttribute(t,e){return t.hasAttribute(e)}allAttributes(t){return Array.from(t.attributes).map(t=>({name:t.name,value:t.value}))}addClass(t,e){t.classList?t.classList.add(e):t.className=(t.className+" "+e).trim()}removeClass(t,e){t.classList?t.classList.remove(e):t.className=t.className.split(/ /).filter(t=>t!==e).join(" ")}hasClass(t,e){return t.classList?t.classList.contains(e):t.className.split(/ /).includes(e)}setStyle(t,e,s){t.style[e]=String(s).replace(/\n/g," ")}getStyle(t,e){return t.style[e]}allStyles(t){return t.style.cssText}insertRules(t,e){for(const s of e)try{t.sheet.insertRule(s,t.sheet.cssRules.length)}catch(t){console.warn(`MathJax: can't insert css rule '${s}': ${t.message}`)}}cssText(t){return"style"!==this.kind(t)?"":Array.from(t.sheet.cssRules).map(t=>t.cssText).join("\n")}fontSize(t){const e=this.window.getComputedStyle(t);return parseFloat(e.fontSize||String(this.constructor.DEFAULT_FONT_SIZE))}fontFamily(t){return this.window.getComputedStyle(t).fontFamily||""}nodeSize(t,e=1,s=!1){if(s&&t.getBBox){const{width:s,height:i}=t.getBBox();return[s/e,i/e]}return[t.offsetWidth/e,t.offsetHeight/e]}nodeBBox(t){const{left:e,right:s,top:i,bottom:r}=t.getBoundingClientRect();return{left:e,right:s,top:i,bottom:r}}createWorker(t,e){return Ji(this,void 0,void 0,function*(){const{path:s,maps:i,worker:r}=e,n=`${s}/${r}`,o=`\n      self.maps = '${$i(i)}';\n      importScripts('${$i(n)}');\n    `,a=URL.createObjectURL(new Blob([o],{type:"text/javascript"})),l=new Worker(a);return l.onmessage=t,URL.revokeObjectURL(a),l})}}function $i(t){return[...t].map(t=>("\\"===t||"'"===t?t="\\"+t:(t<" "||t>"~")&&(t=`\\u{${t.codePointAt(0).toString(16)}}`),t)).join("")}function Yi(){return new Ki(window)}Ki.DEFAULT_FONT_SIZE=16;class Qi{constructor(t){const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t)}}Qi.OPTIONS={};class Zi{constructor(t={}){this.adaptor=null,this.mmlFactory=null;const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t),this.preFilters=new bi(this.options.preFilters),this.postFilters=new bi(this.options.postFilters)}get name(){return this.constructor.NAME}setAdaptor(t){this.adaptor=t}setMmlFactory(t){this.mmlFactory=t}initialize(){}reset(...t){}get processStrings(){return!0}findMath(t,e){return[]}executeFilters(t,e,s,i){const r={math:e,document:s,data:i};return t.execute(r),r.data}}Zi.NAME="generic",Zi.OPTIONS={preFilters:[],postFilters:[]};class tr{constructor(t={}){this.adaptor=null;const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t),this.preFilters=new bi(this.options.preFilters),this.postFilters=new bi(this.options.postFilters)}get name(){return this.constructor.NAME}setAdaptor(t){this.adaptor=t}initialize(){}reset(...t){}getMetrics(t){}styleSheet(t){return null}pageElements(t){return null}executeFilters(t,e,s,i){const r={math:e,document:s,data:i};return t.execute(r),r.data}}tr.NAME="generic",tr.OPTIONS={preFilters:[],postFilters:[]};const er=Symbol();class sr{constructor(t=null){this.next=null,this.prev=null,this.data=t}}class ir{constructor(...t){this.list=new sr(er),this.list.next=this.list.prev=this.list,this.push(...t)}isBefore(t,e){return t1;){const s=e.shift(),i=e.shift();s.merge(i,t),e.push(s)}return e.length&&(this.list=e[0].list),this}merge(t,e=null){null===e&&(e=this.isBefore.bind(this));let s=this.list.next,i=t.list.next;for(;s.data!==er&&i.data!==er;)e(i.data,s.data)?([i.prev.next,s.prev.next]=[s,i],[i.prev,s.prev]=[s.prev,i.prev],[this.list.prev.next,t.list.prev.next]=[t.list,this.list],[this.list.prev,t.list.prev]=[t.list.prev,this.list.prev],[s,i]=[i.next,s]):s=s.next;return i.data!==er&&(this.list.prev.next=t.list.next,t.list.next.prev=this.list.prev,t.list.prev.next=this.list,this.list.prev=t.list.prev,t.list.next=t.list.prev=t.list),this}}class rr extends ir{isBefore(t,e){return t.start.i=e&&this.state(e-1),t.renderActions.renderMath(this,t,e)}convert(t,e=ar.LAST){t.renderActions.renderConvert(this,t,e)}compile(t){this.state()=ar.INSERTED&&this.removeFromDocument(e),t=ar.TYPESET&&(this.outputData={}),t=ar.COMPILED&&(this.inputData={}),this._state=t),this._state}reset(t=!1){this.state(ar.UNPROCESSED,t)}clear(){}}const ar={UNPROCESSED:0,FINDMATH:10,COMPILED:20,CONVERT:100,METRICS:110,RERENDER:125,TYPESET:150,INSERTED:200,LAST:1e4};function lr(t,e){if(t in ar)throw Error("State "+t+" already exists");ar[t]=e}class cr{constructor(t=null){this.defaultKind="unknown",this.nodeMap=new Map,this.node={},null===t&&(t=this.constructor.defaultNodes);for(const e of Object.keys(t))this.setNodeClass(e,t[e])}create(t,...e){return(this.node[t]||this.node[this.defaultKind])(...e)}setNodeClass(t,e){this.nodeMap.set(t,e);const s=this.nodeMap.get(t);this.node[t]=(...t)=>new s(this,...t)}getNodeClass(t){return this.nodeMap.get(t)}deleteNodeClass(t){this.nodeMap.delete(t),delete this.node[t]}nodeIsKind(t,e){return t instanceof this.getNodeClass(e)}getKinds(){return Array.from(this.nodeMap.keys())}}cr.defaultNodes={};class hr extends cr{create(t,e={},s=[]){return this.node[t](e,s)}}const dr="_inherit_";class ur{constructor(t,e){this.global=e,this.defaults=Object.create(e),this.inherited=Object.create(this.defaults),this.attributes=Object.create(this.inherited),Object.assign(this.defaults,t)}set(t,e){this.attributes[t]=e}setList(t){Object.assign(this.attributes,t)}unset(t){delete this.attributes[t]}get(t){let e=this.attributes[t];return e===dr&&(e=this.global[t]),e}getExplicit(t){return this.hasExplicit(t)?this.attributes[t]:void 0}hasExplicit(t){return Object.hasOwn(this.attributes,t)}hasOneOf(t){for(const e of t)if(this.hasExplicit(e))return!0;return!1}getList(...t){const e={};for(const s of t)e[s]=this.get(s);return e}setInherited(t,e){this.inherited[t]=e}getInherited(t){return this.inherited[t]}getDefault(t){return this.defaults[t]}isSet(t){return Object.hasOwn(this.attributes,t)||Object.hasOwn(this.inherited,t)}hasDefault(t){return t in this.defaults}getExplicitNames(){return Object.keys(this.attributes)}getInheritedNames(){return Object.keys(this.inherited)}getDefaultNames(){return Object.keys(this.defaults)}getGlobalNames(){return Object.keys(this.global)}getAllAttributes(){return this.attributes}getAllInherited(){return this.inherited}getAllDefaults(){return this.defaults}getAllGlobals(){return this.global}}class pr{constructor(t,e={},s=[]){this.factory=t,this.parent=null,this.properties={},this.childNodes=[];for(const t of Object.keys(e))this.setProperty(t,e[t]);s.length&&this.setChildren(s)}get kind(){return"unknown"}setProperty(t,e){this.properties[t]=e}getProperty(t){return this.properties[t]}getPropertyNames(){return Object.keys(this.properties)}getAllProperties(){return this.properties}removeProperty(...t){for(const e of t)delete this.properties[e]}isKind(t){return this.factory.nodeIsKind(this,t)}setChildren(t){this.childNodes=[];for(const e of t)this.appendChild(e)}appendChild(t){return this.childNodes.push(t),t.parent=this,t}replaceChild(t,e){const s=this.childIndex(e);return null!==s&&(this.childNodes[s]=t,t.parent=this,e.parent===this&&(e.parent=null)),t}removeChild(t){const e=this.childIndex(t);return null!==e&&(this.childNodes.splice(e,1),t.parent=null),t}childIndex(t){const e=this.childNodes.indexOf(t);return-1===e?null:e}copy(){const t=this.factory.create(this.kind);t.properties=Object.assign({},this.properties);for(const e of this.childNodes||[])e&&t.appendChild(e.copy());return t}findNodes(t){const e=[];return this.walkTree(s=>{s.isKind(t)&&e.push(s)}),e}walkTree(t,e){t(this,e);for(const s of this.childNodes)s&&s.walkTree(t,e);return e}toString(){return this.kind+"("+this.childNodes.join(",")+")"}}class mr extends pr{setChildren(t){}appendChild(t){return t}replaceChild(t,e){return e}childIndex(t){return null}walkTree(t,e){return t(this,e),e}toString(){return this.kind}}const fr={ORD:0,OP:1,BIN:2,REL:3,OPEN:4,CLOSE:5,PUNCT:6,INNER:7,NONE:-1},gr=["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER"],br=["","thinmathspace","mediummathspace","thickmathspace"],Er=[[0,-1,2,3,0,0,0,1],[-1,-1,0,3,0,0,0,1],[2,2,0,0,2,0,0,2],[3,3,0,0,3,0,0,3],[0,0,0,0,0,0,0,0],[0,-1,2,3,0,0,0,1],[1,1,0,1,1,1,1,1],[1,-1,2,3,1,0,1,1]],xr=new Set(["normal","bold","italic","bold-italic","double-struck","fraktur","bold-fraktur","script","bold-script","sans-serif","bold-sans-serif","sans-serif-italic","sans-serif-bold-italic","monospace","inital","tailed","looped","stretched"]),yr=["indentalign","indentalignfirst","indentshift","indentshiftfirst"];class Nr extends pr{constructor(t,e={},s=[]){super(t),this.prevClass=null,this.prevLevel=null,this.texclass=null,this.arity<0&&(this.childNodes=[t.create("inferredMrow")],this.childNodes[0].parent=this),this.setChildren(s),this.attributes=new ur(t.getNodeClass(this.kind).defaults,t.getNodeClass("math").defaults),this.attributes.setList(e)}copy(t=!1){const e=this.factory.create(this.kind);if(e.properties=Object.assign({},this.properties),this.attributes){const s=this.attributes.getAllAttributes();for(const i of Object.keys(s))("id"!==i||t)&&e.attributes.set(i,s[i])}if(this.childNodes&&this.childNodes.length){let t=this.childNodes;1===t.length&&t[0].isInferred&&(t=t[0].childNodes);for(const s of t)s?e.appendChild(s.copy()):e.childNodes.push(null)}return e}get texClass(){return this.texclass}set texClass(t){this.texclass=t}get isToken(){return!1}get isEmbellished(){return!1}get isSpacelike(){return!1}get linebreakContainer(){return!1}get linebreakAlign(){return"data-align"}get isEmpty(){for(const t of this.childNodes)if(t&&!t.isEmpty)return!1;return!0}get arity(){return 1/0}get isInferred(){return!1}get Parent(){let t=this.parent;for(;t&&t.notParent;)t=t.Parent;return t}get notParent(){return!1}setChildren(t){return this.arity<0?this.childNodes[0].setChildren(t):super.setChildren(t)}appendChild(t){if(this.arity<0)return this.childNodes[0].appendChild(t),t;if(t.isInferred){if(this.arity===1/0)return t.childNodes.forEach(t=>super.appendChild(t)),t;const e=t;(t=this.factory.create("mrow")).setChildren(e.childNodes),t.attributes=e.attributes;for(const s of e.getPropertyNames())t.setProperty(s,e.getProperty(s))}return super.appendChild(t)}replaceChild(t,e){return this.arity<0?(this.childNodes[0].replaceChild(t,e),t):super.replaceChild(t,e)}core(){return this}coreMO(){return this}coreIndex(){return 0}childPosition(){let t=null,e=this.parent;for(;e&&e.notParent;)t=e,e=e.parent;if(t=t||this,e){let s=0;for(const i of e.childNodes){if(i===t)return s;s++}}return null}setTeXclass(t){return this.getPrevClass(t),null!=this.texClass?this:t}updateTeXclass(t){t&&(this.prevClass=t.prevClass,this.prevLevel=t.prevLevel,t.prevClass=t.prevLevel=null,this.texClass=t.texClass)}getPrevClass(t){t&&(this.prevClass=t.texClass,this.prevLevel=t.attributes.get("scriptlevel"))}texSpacing(){const t=null!=this.prevClass?this.prevClass:fr.NONE,e=this.texClass||fr.ORD;if(t===fr.NONE||e===fr.NONE)return"";const s=Er[t][e];return(this.prevLevel>0||this.attributes.get("scriptlevel")>0)&&s>=0?"":br[Math.abs(s)]}hasSpacingAttributes(){return this.isEmbellished&&this.coreMO().hasSpacingAttributes()}setInheritedAttributes(t={},e=!1,s=0,i=!1){var r,n,o;const a=this.attributes.getAllDefaults();for(const e of Object.keys(t)){if(Object.hasOwn(a,e)||Object.hasOwn(Nr.alwaysInherit,e)){const[s,i]=t[e];(null===(n=null===(r=Nr.noInherit[s])||void 0===r?void 0:r[this.kind])||void 0===n?void 0:n[e])||this.attributes.setInherited(e,i)}(null===(o=Nr.stopInherit[this.kind])||void 0===o?void 0:o[e])&&delete(t=Object.assign({},t))[e]}void 0===this.attributes.getExplicit("displaystyle")&&this.attributes.setInherited("displaystyle",e);void 0===this.attributes.getExplicit("scriptlevel")&&this.attributes.setInherited("scriptlevel",s),i&&this.setProperty("texprimestyle",i);const l=this.arity;if(l>=0&&l!==1/0&&(1===l&&0===this.childNodes.length||1!==l&&this.childNodes.length!==l))if(l=0&&e!==1/0&&(1===e&&0===this.childNodes.length||1!==e&&this.childNodes.length!==e)&&this.mError('Wrong number of children for "'+this.kind+'" node',t,!0),this.verifyChildren(t)}verifyAttributes(t){if(t.checkAttributes){const e=this.attributes,s=[];for(const t of e.getExplicitNames())"data-"===t.substring(0,5)||void 0!==e.getDefault(t)||t.match(/^(?:class|style|id|(?:xlink:)?href)$/)||s.push(t);s.length&&this.mError("Unknown attributes for "+this.kind+" node: "+s.join(", "),t)}if(t.checkMathvariants){const e=this.attributes.getExplicit("mathvariant");!e||xr.has(e)||this.getProperty("ignore-variant")||this.mError(`Invalid mathvariant: ${e}`,t,!0)}}verifyChildren(t){for(const e of this.childNodes)e.verifyTree(t)}mError(t,e,s=!1){if(this.parent&&this.parent.isKind("merror"))return null;const i=this.factory.create("merror");if(i.attributes.set("data-mjx-message",t),e.fullErrors||s){const s=this.factory.create("mtext"),r=this.factory.create("text");r.setText(e.fullErrors?t:this.kind),s.appendChild(r),i.appendChild(s),this.parent.replaceChild(i,this),e.fullErrors||i.attributes.set("title",t)}else this.parent.replaceChild(i,this),i.appendChild(this);return i}}Nr.defaults={mathbackground:dr,mathcolor:dr,mathsize:dr,dir:dr},Nr.noInherit={mstyle:{mpadded:{width:!0,height:!0,depth:!0,lspace:!0,voffset:!0},mtable:{width:!0,height:!0,depth:!0,align:!0}},maligngroup:{mrow:{groupalign:!0},mtable:{groupalign:!0}},mtr:{msqrt:{"data-vertical-align":!0},mroot:{"data-vertical-align":!0}},mlabeledtr:{msqrt:{"data-vertical-align":!0},mroot:{"data-vertical-align":!0}}},Nr.stopInherit={mtd:{columnalign:!0,rowalign:!0,groupalign:!0}},Nr.alwaysInherit={scriptminsize:!0,scriptsizemultiplier:!0,infixlinebreakstyle:!0},Nr.verifyDefaults={checkArity:!0,checkAttributes:!1,checkMathvariants:!0,fullErrors:!1,fixMmultiscripts:!0,fixMtables:!0};class vr extends Nr{get isToken(){return!0}get isEmpty(){for(const t of this.childNodes)if(!(t instanceof Lr)||t.getText().length)return!1;return!0}getText(){let t="";for(const e of this.childNodes)e instanceof Lr?t+=e.getText():"textContent"in e&&(t+=e.textContent());return t}setChildInheritedAttributes(t,e,s,i){for(const r of this.childNodes)r instanceof Nr&&r.setInheritedAttributes(t,e,s,i)}walkTree(t,e){t(this,e);for(const s of this.childNodes)s instanceof Nr&&s.walkTree(t,e);return e}}vr.defaults=Object.assign(Object.assign({},Nr.defaults),{mathvariant:"normal",mathsize:dr});class Tr extends Nr{get isSpacelike(){return this.childNodes[0].isSpacelike}get isEmbellished(){return this.childNodes[0].isEmbellished}get arity(){return-1}core(){return this.childNodes[0]}coreMO(){return this.childNodes[0].coreMO()}setTeXclass(t){return t=this.childNodes[0].setTeXclass(t),this.updateTeXclass(this.childNodes[0]),t}}Tr.defaults=Nr.defaults;class Cr extends Nr{get isEmbellished(){return this.childNodes[0].isEmbellished}core(){return this.childNodes[0]}coreMO(){return this.childNodes[0].coreMO()}setTeXclass(t){this.getPrevClass(t),this.texClass=fr.ORD;const e=this.childNodes[0];let s=null;e&&(this.isEmbellished||e.isKind("mi")?(s=e.setTeXclass(t),this.updateTeXclass(this.core())):(e.setTeXclass(null),e.isKind("TeXAtom")&&(this.texClass=e.texClass)));for(const t of this.childNodes.slice(1))t&&t.setTeXclass(null);return s||this}}Cr.defaults=Nr.defaults;class Ar extends mr{get isToken(){return!1}get isEmpty(){return!0}get isEmbellished(){return!1}get isSpacelike(){return!1}get linebreakContainer(){return!1}get linebreakAlign(){return""}get arity(){return 0}get isInferred(){return!1}get notParent(){return!1}get Parent(){return this.parent}get texClass(){return fr.NONE}get prevClass(){return fr.NONE}get prevLevel(){return 0}hasSpacingAttributes(){return!1}get attributes(){return null}core(){return this}coreMO(){return this}coreIndex(){return 0}childPosition(){return 0}setTeXclass(t){return t}texSpacing(){return""}setInheritedAttributes(t,e,s,i){}inheritAttributesFrom(t){}verifyTree(t){}mError(t,e,s=!1){return null}}class Lr extends Ar{constructor(){super(...arguments),this.text=""}get kind(){return"text"}getText(){return this.text}setText(t){return this.text=t,this}copy(){return this.factory.create(this.kind).setText(this.getText())}toString(){return this.text}}class Sr extends Ar{constructor(){super(...arguments),this.xml=null,this.adaptor=null}get kind(){return"XML"}getXML(){return this.xml}setXML(t,e=null){return this.xml=t,this.adaptor=e,this}getSerializedXML(){return this.adaptor.serializeXML(this.xml)}copy(){return this.factory.create(this.kind).setXML(this.adaptor.clone(this.xml))}toString(){return"XML data"}}class Rr extends Tr{get kind(){return"math"}get linebreakContainer(){return!0}get linebreakAlign(){return""}setChildInheritedAttributes(t,e,s,i){"display"===this.attributes.get("mode")&&this.attributes.setInherited("display","block"),t=this.addInheritedAttributes(t,this.attributes.getAllAttributes()),e=!!this.attributes.get("displaystyle")||!this.attributes.get("displaystyle")&&"block"===this.attributes.get("display"),this.attributes.setInherited("displaystyle",e),s=this.attributes.get("scriptlevel")||this.constructor.defaults.scriptlevel,super.setChildInheritedAttributes(t,e,s,i)}verifyTree(t=null){super.verifyTree(t),this.parent&&this.mError("Improper nesting of math tags",t,!0)}}Rr.defaults=Object.assign(Object.assign({},Tr.defaults),{mathvariant:"normal",mathsize:"normal",mathcolor:"",mathbackground:"transparent",dir:"ltr",scriptlevel:0,displaystyle:!1,display:"inline",maxwidth:"",overflow:"linebreak",altimg:"","altimg-width":"","altimg-height":"","altimg-valign":"",alttext:"",cdgroup:"",scriptsizemultiplier:1/Math.sqrt(2),scriptminsize:".4em",infixlinebreakstyle:"before",lineleading:"100%",linebreakmultchar:"\u2062",indentshift:"auto",indentalign:"auto",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"});class Mr extends vr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mi"}setInheritedAttributes(t={},e=!1,s=0,i=!1){super.setInheritedAttributes(t,e,s,i);this.getText().match(Mr.singleCharacter)&&!t.mathvariant&&this.attributes.setInherited("mathvariant","italic")}setTeXclass(t){this.getPrevClass(t);const e=this.getText();return e.length>1&&e.match(Mr.operatorName)&&"normal"===this.attributes.get("mathvariant")&&void 0===this.getProperty("autoOP")&&void 0===this.getProperty("texClass")&&(this.texClass=fr.OP,this.setProperty("autoOP",!0)),this}}Mr.defaults=Object.assign({},vr.defaults),Mr.operatorName=/^[a-z][a-z0-9]*$/i,Mr.singleCharacter=/^[\uD800-\uDBFF]?.[\u0300-\u036F\u1AB0-\u1ABE\u1DC0-\u1DFF\u20D0-\u20EF]*$/;class Ir extends vr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mn"}}function wr(t,e,s=fr.BIN,i=null){return[t,e,s,i]}Ir.defaults=Object.assign({},vr.defaults);const kr={REL:wr(5,5,fr.REL),WIDEREL:wr(5,5,fr.REL,{accent:!0,stretchy:!0}),BIN4:wr(4,4,fr.BIN),RELSTRETCH:wr(5,5,fr.REL,{stretchy:!0}),ORD:wr(0,0,fr.ORD),BIN3:wr(3,3,fr.BIN),OPEN:wr(0,0,fr.OPEN,{fence:!0,stretchy:!0,symmetric:!0}),CLOSE:wr(0,0,fr.CLOSE,{fence:!0,stretchy:!0,symmetric:!0}),INTEGRAL:wr(3,3,fr.OP,{largeop:!0,symmetric:!0}),ACCENT:wr(0,0,fr.ORD,{accent:!0}),WIDEACCENT:wr(0,0,fr.ORD,{accent:!0,stretchy:!0}),OP:wr(3,3,fr.OP,{largeop:!0,movablelimits:!0,symmetric:!0}),RELACCENT:wr(5,5,fr.REL,{accent:!0}),BIN0:wr(0,0,fr.BIN),BIN5:wr(5,5,fr.BIN),FENCE:wr(0,0,fr.ORD,{fence:!0,stretchy:!0,symmetric:!0}),INNER:wr(1,1,fr.INNER),ORD30:wr(3,0,fr.ORD),NONE:wr(0,0,fr.NONE),ORDSTRETCH0:wr(0,0,fr.ORD,{stretchy:!0}),BINSTRETCH0:wr(0,0,fr.BIN,{stretchy:!0}),RELSTRETCH0:wr(0,0,fr.REL,{stretchy:!0}),CLOSE0:wr(0,0,fr.CLOSE,{fence:!0}),ORD3:wr(3,3,fr.ORD),PUNCT03:wr(0,3,fr.PUNCT,{linebreakstyle:"after"}),OPEN0:wr(0,0,fr.OPEN,{fence:!0}),STRETCH4:wr(4,4,fr.BIN,{stretchy:!0})},Or=[[32,127,fr.REL,"mo"],[160,191,fr.ORD,"mo"],[192,591,fr.ORD,"mi"],[688,879,fr.ORD,"mo"],[880,6688,fr.ORD,"mi"],[6832,6911,fr.ORD,"mo"],[6912,7615,fr.ORD,"mi"],[7616,7679,fr.ORD,"mo"],[7680,8191,fr.ORD,"mi"],[8192,8303,fr.ORD,"mo"],[8304,8351,fr.ORD,"mo"],[8448,8527,fr.ORD,"mi"],[8528,8591,fr.ORD,"mn"],[8592,8703,fr.REL,"mo"],[8704,8959,fr.BIN,"mo"],[8960,9215,fr.ORD,"mo"],[9312,9471,fr.ORD,"mn"],[9472,10223,fr.ORD,"mo"],[10224,10239,fr.REL,"mo"],[10240,10495,fr.ORD,"mtext"],[10496,10623,fr.REL,"mo"],[10624,10751,fr.ORD,"mo"],[10752,11007,fr.BIN,"mo"],[11008,11055,fr.ORD,"mo"],[11056,11087,fr.REL,"mo"],[11088,11263,fr.ORD,"mo"],[11264,11744,fr.ORD,"mi"],[11776,11903,fr.ORD,"mo"],[11904,12255,fr.ORD,"mi","normal"],[12272,12351,fr.ORD,"mo"],[12352,42143,fr.ORD,"mi","normal"],[42192,43055,fr.ORD,"mi"],[43056,43071,fr.ORD,"mn"],[43072,55295,fr.ORD,"mi"],[63744,64255,fr.ORD,"mi","normal"],[64256,65023,fr.ORD,"mi"],[65024,65135,fr.ORD,"mo"],[65136,65791,fr.ORD,"mi"],[65792,65935,fr.ORD,"mn"],[65936,74751,fr.ORD,"mi","normal"],[74752,74879,fr.ORD,"mn"],[74880,113823,fr.ORD,"mi","normal"],[113824,119391,fr.ORD,"mo"],[119648,119679,fr.ORD,"mn"],[119808,120781,fr.ORD,"mi"],[120782,120831,fr.ORD,"mn"],[122624,129023,fr.ORD,"mo"],[129024,129279,fr.REL,"mo"],[129280,129535,fr.ORD,"mo"],[131072,195103,fr.ORD,"mi","normal"]];function Dr(t){const e=Br.infix[t]||Br.prefix[t]||Br.postfix[t];if(e)return[0,0,e[2],"mo"];const s=t.codePointAt(0);for(const t of Or)if(s<=t[1]){if(s>=t[0])return t;break}return[0,0,fr.REL,"mo"]}const Pr=[[0,0],[1,2],[3,3],[4,4],[0,0],[0,0],[0,3],[1,1]],Br={prefix:{"!":kr.ORD,"(":kr.OPEN,"+":kr.BIN0,"-":kr.BIN0,"[":kr.OPEN,"{":kr.OPEN,"|":kr.OPEN,"||":kr.BIN0,"\xac":kr.ORD,"\xb1":kr.BIN0,"\u2016":kr.FENCE,"\u2018":kr.OPEN0,"\u201c":kr.OPEN0,\u2145:kr.ORD30,\u2146:kr.ORD30,"\u2200":kr.ORD,"\u2201":kr.ORD,"\u2202":kr.ORD30,"\u2203":kr.ORD,"\u2204":kr.ORD,"\u2207":kr.ORD,"\u220f":kr.OP,"\u2210":kr.OP,"\u2211":kr.OP,"\u2212":kr.BIN0,"\u2213":kr.BIN0,"\u221a":[3,0,fr.ORD,{stretchy:!0}],"\u221b":kr.ORD30,"\u221c":kr.ORD30,"\u221f":kr.ORD,"\u2220":kr.ORD,"\u2221":kr.ORD,"\u2222":kr.ORD,"\u222b":kr.INTEGRAL,"\u222c":kr.INTEGRAL,"\u222d":kr.INTEGRAL,"\u222e":kr.INTEGRAL,"\u222f":kr.INTEGRAL,"\u2230":kr.INTEGRAL,"\u2231":kr.INTEGRAL,"\u2232":kr.INTEGRAL,"\u2233":kr.INTEGRAL,"\u2234":kr.REL,"\u2235":kr.REL,"\u223c":[0,0,fr.REL,{}],"\u22be":kr.ORD,"\u22bf":kr.ORD,"\u22c0":kr.OP,"\u22c1":kr.OP,"\u22c2":kr.OP,"\u22c3":kr.OP,"\u2308":kr.OPEN,"\u230a":kr.OPEN,"\u2310":kr.ORD,"\u2319":kr.ORD,"\u2772":kr.OPEN,"\u2795":kr.ORD,"\u2796":kr.ORD,"\u27c0":kr.ORD,"\u27e6":kr.OPEN,"\u27e8":kr.OPEN,"\u27ea":kr.OPEN,"\u27ec":kr.OPEN,"\u27ee":kr.OPEN,"\u2980":kr.FENCE,"\u2983":kr.OPEN,"\u2985":kr.OPEN,"\u2987":kr.OPEN,"\u2989":kr.OPEN,"\u298b":kr.OPEN,"\u298d":kr.OPEN,"\u298f":kr.OPEN,"\u2991":kr.OPEN,"\u2993":kr.OPEN,"\u2995":kr.OPEN,"\u2997":kr.OPEN,"\u2999":kr.FENCE,"\u299b":kr.ORD,"\u299c":kr.ORD,"\u299d":kr.ORD,"\u299e":kr.ORD,"\u299f":kr.ORD,"\u29a0":kr.ORD,"\u29a1":kr.ORD,"\u29a2":kr.ORD,"\u29a3":kr.ORD,"\u29a4":kr.ORD,"\u29a5":kr.ORD,"\u29a6":kr.ORD,"\u29a7":kr.ORD,"\u29a8":kr.ORD,"\u29a9":kr.ORD,"\u29aa":kr.ORD,"\u29ab":kr.ORD,"\u29ac":kr.ORD,"\u29ad":kr.ORD,"\u29ae":kr.ORD,"\u29af":kr.ORD,"\u29d8":kr.OPEN,"\u29da":kr.OPEN,"\u29fc":kr.OPEN,"\u2a00":kr.OP,"\u2a01":kr.OP,"\u2a02":kr.OP,"\u2a03":kr.OP,"\u2a04":kr.OP,"\u2a05":kr.OP,"\u2a06":kr.OP,"\u2a07":kr.OP,"\u2a08":kr.OP,"\u2a09":kr.OP,"\u2a0a":kr.OP,"\u2a0b":kr.INTEGRAL,"\u2a0c":kr.INTEGRAL,"\u2a0d":kr.INTEGRAL,"\u2a0e":kr.INTEGRAL,"\u2a0f":kr.INTEGRAL,"\u2a10":kr.INTEGRAL,"\u2a11":kr.INTEGRAL,"\u2a12":kr.INTEGRAL,"\u2a13":kr.INTEGRAL,"\u2a14":kr.INTEGRAL,"\u2a15":kr.INTEGRAL,"\u2a16":kr.INTEGRAL,"\u2a17":kr.INTEGRAL,"\u2a18":kr.INTEGRAL,"\u2a19":kr.INTEGRAL,"\u2a1a":kr.INTEGRAL,"\u2a1b":kr.INTEGRAL,"\u2a1c":kr.INTEGRAL,"\u2a1d":kr.OP,"\u2a1e":kr.OP,"\u2aec":kr.ORD,"\u2aed":kr.ORD,"\u2afc":kr.OP,"\u2aff":kr.OP,"\u3008":kr.OPEN},postfix:{"!!":kr.BIN0,"!":kr.CLOSE0,'"':kr.ORD,"%":kr.ORD,"&":kr.ORD,"'":kr.ACCENT,")":kr.CLOSE,"++":kr.BIN0,"--":kr.BIN0,"]":kr.CLOSE,"^":kr.WIDEACCENT,_:kr.WIDEACCENT,"`":kr.ACCENT,"|":kr.CLOSE,"||":kr.BIN0,"}":kr.CLOSE,"~":kr.WIDEACCENT,"\xa8":kr.ACCENT,"\xaf":kr.WIDEACCENT,"\xb0":kr.ACCENT,"\xb2":kr.ORD,"\xb3":kr.ORD,"\xb4":kr.ACCENT,"\xb8":kr.ACCENT,"\xb9":kr.ORD,\u02c6:kr.WIDEACCENT,\u02c7:kr.WIDEACCENT,\u02c9:kr.WIDEACCENT,\u02ca:kr.ACCENT,\u02cb:kr.ACCENT,\u02cd:kr.WIDEACCENT,"\u02d8":kr.ACCENT,"\u02d9":kr.ACCENT,"\u02da":kr.ACCENT,"\u02dc":kr.WIDEACCENT,"\u02dd":kr.ACCENT,"\u02f7":kr.WIDEACCENT,"\u0302":kr.WIDEACCENT,"\u0311":kr.ACCENT,"\u2016":kr.FENCE,"\u2019":kr.CLOSE0,"\u201a":kr.ORD,"\u201b":kr.ORD,"\u201d":kr.CLOSE0,"\u201e":kr.ORD,"\u201f":kr.ORD,"\u2032":kr.ORD,"\u2033":kr.ORD,"\u2034":kr.ORD,"\u2035":kr.ORD,"\u2036":kr.ORD,"\u2037":kr.ORD,"\u203e":kr.WIDEACCENT,"\u2057":kr.ORD,"\u20db":kr.ACCENT,"\u20dc":kr.ACCENT,"\u2309":kr.CLOSE,"\u230b":kr.CLOSE,"\u2322":kr.RELSTRETCH0,"\u2323":kr.RELSTRETCH0,"\u23b4":kr.WIDEACCENT,"\u23b5":kr.WIDEACCENT,"\u23cd":kr.ORD,"\u23dc":kr.WIDEACCENT,"\u23dd":kr.WIDEACCENT,"\u23de":kr.WIDEACCENT,"\u23df":kr.WIDEACCENT,"\u23e0":kr.WIDEACCENT,"\u23e1":kr.WIDEACCENT,"\u2773":kr.CLOSE,"\u27e7":kr.CLOSE,"\u27e9":kr.CLOSE,"\u27eb":kr.CLOSE,"\u27ed":kr.CLOSE,"\u27ef":kr.CLOSE,"\u2980":kr.FENCE,"\u2984":kr.CLOSE,"\u2986":kr.CLOSE,"\u2988":kr.CLOSE,"\u298a":kr.CLOSE,"\u298c":kr.CLOSE,"\u298e":kr.CLOSE,"\u2990":kr.CLOSE,"\u2992":kr.CLOSE,"\u2994":kr.CLOSE,"\u2996":kr.CLOSE,"\u2998":kr.CLOSE,"\u2999":kr.FENCE,"\u29d9":kr.CLOSE,"\u29db":kr.CLOSE,"\u29fd":kr.CLOSE,"\u3009":kr.CLOSE,"\u{1eef0}":kr.BINSTRETCH0,"\u{1eef1}":kr.BINSTRETCH0},infix:{"!":kr.ORD,"!=":kr.BIN5,"#":kr.ORD,$:kr.ORD,"%":kr.ORD3,"&&":kr.BIN4,"**":kr.BIN3,"*":kr.BIN3,"*=":kr.BIN5,"+":kr.BIN4,"+=":kr.BIN5,",":kr.PUNCT03,"":kr.ORD,"-":kr.BIN4,"-=":kr.BIN5,"->":kr.BIN5,".":kr.ORD3,"..":kr.BIN3,"...":kr.INNER,"/":[4,4,fr.ORD,{}],"//":kr.BIN5,"/=":kr.BIN5,":":[0,3,fr.REL,{}],":=":kr.BIN5,";":kr.PUNCT03,"<":kr.REL,"<=":kr.REL,"<>":[3,3,fr.REL,{}],"=":kr.REL,"==":kr.REL,">":kr.REL,">=":kr.REL,"?":[3,3,fr.CLOSE,{fence:!0}],"@":kr.ORD3,"\\":kr.ORD,"^":[3,3,fr.ORD,{accent:!0,stretchy:!0}],_:kr.WIDEACCENT,"|":[5,5,fr.ORD,{}],"||":kr.BIN5,"\xb1":kr.BIN4,"\xb7":kr.BIN3,"\xd7":kr.BIN3,"\xf7":kr.BIN4,\u02b9:kr.ORD,"\u0300":kr.ACCENT,"\u0301":kr.ACCENT,"\u0303":kr.WIDEACCENT,"\u0304":kr.ACCENT,"\u0306":kr.ACCENT,"\u0307":kr.ACCENT,"\u0308":kr.ACCENT,"\u030c":kr.ACCENT,"\u0332":kr.WIDEACCENT,"\u0338":kr.REL,"\u03f6":kr.REL,"\u2015":kr.ORDSTRETCH0,"\u2017":kr.ORDSTRETCH0,"\u2020":kr.BIN3,"\u2021":kr.BIN3,"\u2022":kr.BIN3,"\u2026":kr.INNER,"\u2043":kr.BIN3,"\u2044":kr.STRETCH4,"\u2061":kr.NONE,"\u2062":kr.NONE,"\u2063":[0,0,fr.NONE,{linebreakstyle:"after"}],"\u2064":kr.NONE,"\u20d7":kr.ACCENT,\u2111:kr.ORD,\u2113:kr.ORD,\u2118:kr.ORD,\u211c:kr.ORD,"\u2190":kr.WIDEREL,"\u2191":kr.RELSTRETCH,"\u2192":kr.WIDEREL,"\u2193":kr.RELSTRETCH,"\u2194":kr.WIDEREL,"\u2195":kr.RELSTRETCH,"\u2196":kr.REL,"\u2197":kr.REL,"\u2198":kr.REL,"\u2199":kr.REL,"\u219a":kr.WIDEREL,"\u219b":kr.WIDEREL,"\u219c":kr.WIDEREL,"\u219d":kr.WIDEREL,"\u219e":kr.WIDEREL,"\u219f":kr.RELSTRETCH,"\u21a0":kr.WIDEREL,"\u21a1":kr.RELSTRETCH,"\u21a2":kr.WIDEREL,"\u21a3":kr.WIDEREL,"\u21a4":kr.WIDEREL,"\u21a5":kr.RELSTRETCH,"\u21a6":kr.WIDEREL,"\u21a7":kr.RELSTRETCH,"\u21a8":kr.RELSTRETCH,"\u21a9":kr.WIDEREL,"\u21aa":kr.WIDEREL,"\u21ab":kr.WIDEREL,"\u21ac":kr.WIDEREL,"\u21ad":kr.WIDEREL,"\u21ae":kr.WIDEREL,"\u21af":kr.REL,"\u21b0":kr.RELSTRETCH,"\u21b1":kr.RELSTRETCH,"\u21b2":kr.RELSTRETCH,"\u21b3":kr.RELSTRETCH,"\u21b4":kr.RELSTRETCH,"\u21b5":kr.RELSTRETCH,"\u21b6":kr.REL,"\u21b7":kr.REL,"\u21b8":kr.REL,"\u21b9":kr.WIDEREL,"\u21ba":kr.REL,"\u21bb":kr.REL,"\u21bc":kr.WIDEREL,"\u21bd":kr.WIDEREL,"\u21be":kr.RELSTRETCH,"\u21bf":kr.RELSTRETCH,"\u21c0":kr.WIDEREL,"\u21c1":kr.WIDEREL,"\u21c2":kr.RELSTRETCH,"\u21c3":kr.RELSTRETCH,"\u21c4":kr.WIDEREL,"\u21c5":kr.RELSTRETCH,"\u21c6":kr.WIDEREL,"\u21c7":kr.WIDEREL,"\u21c8":kr.RELSTRETCH,"\u21c9":kr.WIDEREL,"\u21ca":kr.RELSTRETCH,"\u21cb":kr.WIDEREL,"\u21cc":kr.WIDEREL,"\u21cd":kr.WIDEREL,"\u21ce":kr.WIDEREL,"\u21cf":kr.WIDEREL,"\u21d0":kr.WIDEREL,"\u21d1":kr.RELSTRETCH,"\u21d2":kr.WIDEREL,"\u21d3":kr.RELSTRETCH,"\u21d4":kr.WIDEREL,"\u21d5":kr.RELSTRETCH,"\u21d6":kr.REL,"\u21d7":kr.REL,"\u21d8":kr.REL,"\u21d9":kr.REL,"\u21da":kr.WIDEREL,"\u21db":kr.WIDEREL,"\u21dc":kr.WIDEREL,"\u21dd":kr.WIDEREL,"\u21de":kr.RELSTRETCH,"\u21df":kr.RELSTRETCH,"\u21e0":kr.WIDEREL,"\u21e1":kr.RELSTRETCH,"\u21e2":kr.WIDEREL,"\u21e3":kr.RELSTRETCH,"\u21e4":kr.WIDEREL,"\u21e5":kr.WIDEREL,"\u21e6":kr.WIDEREL,"\u21e7":kr.RELSTRETCH,"\u21e8":kr.WIDEREL,"\u21e9":kr.RELSTRETCH,"\u21ea":kr.RELSTRETCH,"\u21eb":kr.RELSTRETCH,"\u21ec":kr.RELSTRETCH,"\u21ed":kr.RELSTRETCH,"\u21ee":kr.RELSTRETCH,"\u21ef":kr.RELSTRETCH,"\u21f0":kr.WIDEREL,"\u21f1":kr.REL,"\u21f2":kr.REL,"\u21f3":kr.RELSTRETCH,"\u21f4":kr.WIDEREL,"\u21f5":kr.RELSTRETCH,"\u21f6":kr.WIDEREL,"\u21f7":kr.WIDEREL,"\u21f8":kr.WIDEREL,"\u21f9":kr.WIDEREL,"\u21fa":kr.WIDEREL,"\u21fb":kr.WIDEREL,"\u21fc":kr.WIDEREL,"\u21fd":kr.WIDEREL,"\u21fe":kr.WIDEREL,"\u21ff":kr.WIDEREL,"\u2205":kr.ORD,"\u2206":kr.ORD,"\u2208":kr.REL,"\u2209":kr.REL,"\u220a":kr.REL,"\u220b":kr.REL,"\u220c":kr.REL,"\u220d":kr.REL,"\u2212":kr.BIN4,"\u2213":kr.BIN4,"\u2214":kr.BIN4,"\u2215":kr.STRETCH4,"\u2216":kr.BIN4,"\u2217":kr.BIN3,"\u2218":kr.BIN3,"\u2219":kr.BIN3,"\u221d":kr.REL,"\u221e":kr.ORD,"\u2223":kr.REL,"\u2224":kr.REL,"\u2225":kr.REL,"\u2226":kr.REL,"\u2227":kr.BIN4,"\u2228":kr.BIN4,"\u2229":kr.BIN4,"\u222a":kr.BIN4,"\u2236":kr.BIN4,"\u2237":kr.REL,"\u2238":kr.BIN4,"\u2239":kr.REL,"\u223a":kr.REL,"\u223b":kr.REL,"\u223c":kr.REL,"\u223d":kr.REL,"\u223e":kr.REL,"\u2240":kr.BIN3,"\u2241":kr.REL,"\u2242":kr.REL,"\u2242\u0338":kr.REL,"\u2243":kr.REL,"\u2244":kr.REL,"\u2245":kr.REL,"\u2246":kr.REL,"\u2247":kr.REL,"\u2248":kr.REL,"\u2249":kr.REL,"\u224a":kr.REL,"\u224b":kr.REL,"\u224c":kr.REL,"\u224d":kr.REL,"\u224e":kr.REL,"\u224f":kr.REL,"\u2250":kr.REL,"\u2251":kr.REL,"\u2252":kr.REL,"\u2253":kr.REL,"\u2254":kr.REL,"\u2255":kr.REL,"\u2256":kr.REL,"\u2257":kr.REL,"\u2258":kr.REL,"\u2259":kr.REL,"\u225a":kr.REL,"\u225b":kr.REL,"\u225c":kr.REL,"\u225d":kr.REL,"\u225e":kr.REL,"\u225f":kr.REL,"\u2260":kr.REL,"\u2261":kr.REL,"\u2262":kr.REL,"\u2263":kr.REL,"\u2264":kr.REL,"\u2265":kr.REL,"\u2266":kr.REL,"\u2266\u0338":kr.REL,"\u2267":kr.REL,"\u2267\u0338":kr.REL,"\u2268":kr.REL,"\u2269":kr.REL,"\u226a":kr.REL,"\u226a\u0338":kr.REL,"\u226b":kr.REL,"\u226b\u0338":kr.REL,"\u226c":kr.REL,"\u226d":kr.REL,"\u226e":kr.REL,"\u226f":kr.REL,"\u2270":kr.REL,"\u2271":kr.REL,"\u2272":kr.REL,"\u2273":kr.REL,"\u2274":kr.REL,"\u2275":kr.REL,"\u2276":kr.REL,"\u2277":kr.REL,"\u2278":kr.REL,"\u2279":kr.REL,"\u227a":kr.REL,"\u227b":kr.REL,"\u227c":kr.REL,"\u227d":kr.REL,"\u227e":kr.REL,"\u227e\u0338":kr.REL,"\u227f":kr.REL,"\u227f\u0338":kr.REL,"\u2280":kr.REL,"\u2281":kr.REL,"\u2282":kr.REL,"\u2283":kr.REL,"\u2284":kr.REL,"\u2285":kr.REL,"\u2286":kr.REL,"\u2287":kr.REL,"\u2288":kr.REL,"\u2289":kr.REL,"\u228a":kr.REL,"\u228b":kr.REL,"\u228c":kr.BIN4,"\u228d":kr.BIN4,"\u228e":kr.BIN4,"\u228f":kr.REL,"\u228f\u0338":kr.REL,"\u2290":kr.REL,"\u2290\u0338":kr.REL,"\u2291":kr.REL,"\u2292":kr.REL,"\u2293":kr.BIN4,"\u2294":kr.BIN4,"\u2295":kr.BIN4,"\u2296":kr.BIN4,"\u2297":kr.BIN3,"\u2298":kr.BIN4,"\u2299":kr.BIN3,"\u229a":kr.BIN3,"\u229b":kr.BIN3,"\u229c":kr.REL,"\u229d":kr.BIN4,"\u229e":kr.BIN4,"\u229f":kr.BIN4,"\u22a0":kr.BIN3,"\u22a1":kr.BIN3,"\u22a2":kr.REL,"\u22a3":kr.REL,"\u22a4":kr.ORD,"\u22a5":kr.ORD,"\u22a6":kr.REL,"\u22a7":kr.REL,"\u22a8":kr.REL,"\u22a9":kr.REL,"\u22aa":kr.REL,"\u22ab":kr.REL,"\u22ac":kr.REL,"\u22ad":kr.REL,"\u22ae":kr.REL,"\u22af":kr.REL,"\u22b0":kr.REL,"\u22b1":kr.REL,"\u22b2":kr.REL,"\u22b3":kr.REL,"\u22b4":kr.REL,"\u22b5":kr.REL,"\u22b6":kr.REL,"\u22b7":kr.REL,"\u22b8":kr.REL,"\u22ba":kr.BIN3,"\u22bb":kr.BIN4,"\u22bc":kr.BIN4,"\u22bd":kr.BIN4,"\u22c4":kr.BIN3,"\u22c5":kr.BIN3,"\u22c6":kr.BIN3,"\u22c7":kr.BIN3,"\u22c8":kr.REL,"\u22c9":kr.BIN3,"\u22ca":kr.BIN3,"\u22cb":kr.BIN3,"\u22cc":kr.BIN3,"\u22cd":kr.REL,"\u22ce":kr.BIN4,"\u22cf":kr.BIN4,"\u22d0":kr.REL,"\u22d1":kr.REL,"\u22d2":kr.BIN4,"\u22d3":kr.BIN4,"\u22d4":kr.REL,"\u22d5":kr.REL,"\u22d6":kr.REL,"\u22d7":kr.REL,"\u22d8":kr.REL,"\u22d9":kr.REL,"\u22da":kr.REL,"\u22db":kr.REL,"\u22dc":kr.REL,"\u22dd":kr.REL,"\u22de":kr.REL,"\u22df":kr.REL,"\u22e0":kr.REL,"\u22e1":kr.REL,"\u22e2":kr.REL,"\u22e3":kr.REL,"\u22e4":kr.REL,"\u22e5":kr.REL,"\u22e6":kr.REL,"\u22e7":kr.REL,"\u22e8":kr.REL,"\u22e9":kr.REL,"\u22ea":kr.REL,"\u22eb":kr.REL,"\u22ec":kr.REL,"\u22ed":kr.REL,"\u22ee":kr.ORD,"\u22ef":kr.INNER,"\u22f0":kr.INNER,"\u22f1":kr.INNER,"\u22f2":kr.REL,"\u22f3":kr.REL,"\u22f4":kr.REL,"\u22f5":kr.REL,"\u22f6":kr.REL,"\u22f7":kr.REL,"\u22f8":kr.REL,"\u22f9":kr.REL,"\u22fa":kr.REL,"\u22fb":kr.REL,"\u22fc":kr.REL,"\u22fd":kr.REL,"\u22fe":kr.REL,"\u22ff":kr.REL,"\u2301":kr.REL,"\u2305":kr.BIN3,"\u2306":kr.BIN3,"\u2329":kr.OPEN,"\u232a":kr.CLOSE,"\u237c":kr.REL,"\u238b":kr.REL,"\u23aa":kr.ORD,"\u23af":kr.ORDSTRETCH0,"\u23b0":kr.OPEN,"\u23b1":kr.CLOSE,"\u2500":kr.ORD,"\u25b3":kr.BIN3,"\u25b5":kr.BIN3,"\u25b9":kr.BIN3,"\u25bd":kr.BIN3,"\u25bf":kr.BIN3,"\u25c3":kr.BIN3,"\u25ef":kr.BIN3,"\u2660":kr.ORD,"\u2661":kr.ORD,"\u2662":kr.ORD,"\u2663":kr.ORD,"\u266d":kr.ORD,"\u266e":kr.ORD,"\u266f":kr.ORD,"\u2758":[5,5,fr.REL,{stretchy:!0,symmetric:!0}],"\u2794":kr.WIDEREL,"\u2795":kr.BIN4,"\u2796":kr.BIN4,"\u2797":kr.BIN4,"\u2798":kr.REL,"\u2799":kr.WIDEREL,"\u279a":kr.REL,"\u279b":kr.WIDEREL,"\u279c":kr.WIDEREL,"\u279d":kr.WIDEREL,"\u279e":kr.WIDEREL,"\u279f":kr.WIDEREL,"\u27a0":kr.WIDEREL,"\u27a1":kr.WIDEREL,"\u27a5":kr.WIDEREL,"\u27a6":kr.WIDEREL,"\u27a7":kr.RELACCENT,"\u27a8":kr.WIDEREL,"\u27a9":kr.WIDEREL,"\u27aa":kr.WIDEREL,"\u27ab":kr.WIDEREL,"\u27ac":kr.WIDEREL,"\u27ad":kr.WIDEREL,"\u27ae":kr.WIDEREL,"\u27af":kr.WIDEREL,"\u27b1":kr.WIDEREL,"\u27b2":kr.RELACCENT,"\u27b3":kr.WIDEREL,"\u27b4":kr.REL,"\u27b5":kr.WIDEREL,"\u27b6":kr.REL,"\u27b7":kr.REL,"\u27b8":kr.WIDEREL,"\u27b9":kr.REL,"\u27ba":kr.WIDEREL,"\u27bb":kr.WIDEREL,"\u27bc":kr.WIDEREL,"\u27bd":kr.WIDEREL,"\u27be":kr.WIDEREL,"\u27c2":kr.REL,"\u27c2\u0338":kr.REL,"\u27cb":kr.BIN3,"\u27cd":kr.BIN3,"\u27f0":kr.RELSTRETCH,"\u27f1":kr.RELSTRETCH,"\u27f2":kr.REL,"\u27f3":kr.REL,"\u27f4":kr.RELSTRETCH,"\u27f5":kr.WIDEREL,"\u27f6":kr.WIDEREL,"\u27f7":kr.WIDEREL,"\u27f8":kr.WIDEREL,"\u27f9":kr.WIDEREL,"\u27fa":kr.WIDEREL,"\u27fb":kr.WIDEREL,"\u27fc":kr.WIDEREL,"\u27fd":kr.WIDEREL,"\u27fe":kr.WIDEREL,"\u27ff":kr.WIDEREL,"\u2900":kr.WIDEREL,"\u2901":kr.WIDEREL,"\u2902":kr.WIDEREL,"\u2903":kr.WIDEREL,"\u2904":kr.WIDEREL,"\u2905":kr.WIDEREL,"\u2906":kr.WIDEREL,"\u2907":kr.WIDEREL,"\u2908":kr.RELSTRETCH,"\u2909":kr.RELSTRETCH,"\u290a":kr.RELSTRETCH,"\u290b":kr.RELSTRETCH,"\u290c":kr.WIDEREL,"\u290d":kr.WIDEREL,"\u290e":kr.WIDEREL,"\u290f":kr.WIDEREL,"\u2910":kr.WIDEREL,"\u2911":kr.WIDEREL,"\u2912":kr.RELSTRETCH,"\u2913":kr.RELSTRETCH,"\u2914":kr.WIDEREL,"\u2915":kr.WIDEREL,"\u2916":kr.WIDEREL,"\u2917":kr.WIDEREL,"\u2918":kr.WIDEREL,"\u2919":kr.WIDEREL,"\u291a":kr.WIDEREL,"\u291b":kr.WIDEREL,"\u291c":kr.WIDEREL,"\u291d":kr.WIDEREL,"\u291e":kr.WIDEREL,"\u291f":kr.WIDEREL,"\u2920":kr.WIDEREL,"\u2921":kr.REL,"\u2922":kr.REL,"\u2923":kr.REL,"\u2924":kr.REL,"\u2925":kr.REL,"\u2926":kr.REL,"\u2927":kr.REL,"\u2928":kr.REL,"\u2929":kr.REL,"\u292a":kr.REL,"\u292b":kr.REL,"\u292c":kr.REL,"\u292d":kr.REL,"\u292e":kr.REL,"\u292f":kr.REL,"\u2930":kr.REL,"\u2931":kr.REL,"\u2932":kr.REL,"\u2933":kr.RELACCENT,"\u2934":kr.RELSTRETCH,"\u2935":kr.RELSTRETCH,"\u2936":kr.RELSTRETCH,"\u2937":kr.RELSTRETCH,"\u2938":kr.REL,"\u2939":kr.REL,"\u293a":kr.RELACCENT,"\u293b":kr.RELACCENT,"\u293c":kr.RELACCENT,"\u293d":kr.RELACCENT,"\u293e":kr.REL,"\u293f":kr.REL,"\u2940":kr.REL,"\u2941":kr.REL,"\u2942":kr.WIDEREL,"\u2943":kr.WIDEREL,"\u2944":kr.WIDEREL,"\u2945":kr.RELSTRETCH,"\u2946":kr.RELSTRETCH,"\u2947":kr.WIDEREL,"\u2948":kr.WIDEREL,"\u2949":kr.RELSTRETCH,"\u294a":kr.WIDEREL,"\u294b":kr.WIDEREL,"\u294c":kr.RELSTRETCH,"\u294d":kr.RELSTRETCH,"\u294e":kr.WIDEREL,"\u294f":kr.RELSTRETCH,"\u2950":kr.WIDEREL,"\u2951":kr.RELSTRETCH,"\u2952":kr.WIDEREL,"\u2953":kr.WIDEREL,"\u2954":kr.RELSTRETCH,"\u2955":kr.RELSTRETCH,"\u2956":kr.WIDEREL,"\u2957":kr.WIDEREL,"\u2958":kr.RELSTRETCH,"\u2959":kr.RELSTRETCH,"\u295a":kr.WIDEREL,"\u295b":kr.WIDEREL,"\u295c":kr.RELSTRETCH,"\u295d":kr.RELSTRETCH,"\u295e":kr.WIDEREL,"\u295f":kr.WIDEREL,"\u2960":kr.RELSTRETCH,"\u2961":kr.RELSTRETCH,"\u2962":kr.WIDEREL,"\u2963":kr.RELSTRETCH,"\u2964":kr.WIDEREL,"\u2965":kr.RELSTRETCH,"\u2966":kr.WIDEREL,"\u2967":kr.WIDEREL,"\u2968":kr.WIDEREL,"\u2969":kr.WIDEREL,"\u296a":kr.WIDEREL,"\u296b":kr.WIDEREL,"\u296c":kr.WIDEREL,"\u296d":kr.WIDEREL,"\u296e":kr.RELSTRETCH,"\u296f":kr.RELSTRETCH,"\u2970":kr.WIDEREL,"\u2971":kr.WIDEREL,"\u2972":kr.WIDEREL,"\u2973":kr.WIDEREL,"\u2974":kr.WIDEREL,"\u2975":kr.WIDEREL,"\u2976":kr.RELACCENT,"\u2977":kr.RELACCENT,"\u2978":kr.RELACCENT,"\u2979":kr.RELACCENT,"\u297a":kr.RELACCENT,"\u297b":kr.RELACCENT,"\u297c":kr.WIDEREL,"\u297d":kr.WIDEREL,"\u297e":kr.RELSTRETCH,"\u297f":kr.RELSTRETCH,"\u2981":kr.REL,"\u2982":kr.REL,"\u29b6":kr.REL,"\u29b7":kr.REL,"\u29b8":kr.BIN4,"\u29b9":kr.REL,"\u29bc":kr.BIN4,"\u29c0":kr.REL,"\u29c1":kr.REL,"\u29c4":kr.BIN4,"\u29c5":kr.BIN4,"\u29c6":kr.BIN3,"\u29c7":kr.BIN3,"\u29c8":kr.BIN3,"\u29ce":kr.REL,"\u29cf":kr.REL,"\u29d0":kr.REL,"\u29d1":kr.REL,"\u29d2":kr.REL,"\u29d3":kr.REL,"\u29d4":kr.BIN3,"\u29d5":kr.BIN3,"\u29d6":kr.BIN3,"\u29d7":kr.BIN3,"\u29df":kr.REL,"\u29e1":kr.REL,"\u29e2":kr.BIN3,"\u29e3":kr.REL,"\u29e4":kr.REL,"\u29e5":kr.REL,"\u29e6":kr.REL,"\u29f4":kr.REL,"\u29f5":kr.BIN4,"\u29f6":kr.BIN4,"\u29f7":kr.BIN4,"\u29f8":kr.BIN4,"\u29f9":kr.BIN4,"\u29fa":kr.BIN4,"\u29fb":kr.BIN4,"\u2a1d":kr.BIN3,"\u2a1e":kr.BIN3,"\u2a1f":kr.BIN4,"\u2a20":kr.BIN4,"\u2a21":kr.BIN4,"\u2a22":kr.BIN4,"\u2a23":kr.BIN4,"\u2a24":kr.BIN4,"\u2a25":kr.BIN4,"\u2a26":kr.BIN4,"\u2a27":kr.BIN4,"\u2a28":kr.BIN4,"\u2a29":kr.BIN4,"\u2a2a":kr.BIN4,"\u2a2b":kr.BIN4,"\u2a2c":kr.BIN4,"\u2a2d":kr.BIN4,"\u2a2e":kr.BIN4,"\u2a2f":kr.BIN3,"\u2a30":kr.BIN3,"\u2a31":kr.BIN3,"\u2a32":kr.BIN3,"\u2a33":kr.BIN3,"\u2a34":kr.BIN3,"\u2a35":kr.BIN3,"\u2a36":kr.BIN3,"\u2a37":kr.BIN3,"\u2a38":kr.BIN4,"\u2a39":kr.BIN4,"\u2a3a":kr.BIN4,"\u2a3b":kr.BIN3,"\u2a3c":kr.BIN3,"\u2a3d":kr.BIN3,"\u2a3e":kr.BIN4,"\u2a3f":kr.BIN3,"\u2a40":kr.BIN4,"\u2a41":kr.BIN4,"\u2a42":kr.BIN4,"\u2a43":kr.BIN4,"\u2a44":kr.BIN4,"\u2a45":kr.BIN4,"\u2a46":kr.BIN4,"\u2a47":kr.BIN4,"\u2a48":kr.BIN4,"\u2a49":kr.BIN4,"\u2a4a":kr.BIN4,"\u2a4b":kr.BIN4,"\u2a4c":kr.BIN4,"\u2a4d":kr.BIN4,"\u2a4e":kr.BIN4,"\u2a4f":kr.BIN4,"\u2a50":kr.BIN3,"\u2a51":kr.BIN4,"\u2a52":kr.BIN4,"\u2a53":kr.BIN4,"\u2a54":kr.BIN4,"\u2a55":kr.BIN4,"\u2a56":kr.BIN4,"\u2a57":kr.BIN4,"\u2a58":kr.BIN4,"\u2a59":kr.BIN4,"\u2a5a":kr.BIN4,"\u2a5b":kr.BIN4,"\u2a5c":kr.BIN4,"\u2a5d":kr.BIN4,"\u2a5e":kr.BIN4,"\u2a5f":kr.BIN4,"\u2a60":kr.BIN4,"\u2a61":kr.BIN4,"\u2a62":kr.BIN4,"\u2a63":kr.BIN4,"\u2a64":kr.BIN3,"\u2a65":kr.BIN3,"\u2a66":kr.REL,"\u2a67":kr.REL,"\u2a68":kr.REL,"\u2a69":kr.REL,"\u2a6a":kr.REL,"\u2a6b":kr.REL,"\u2a6c":kr.REL,"\u2a6d":kr.REL,"\u2a6e":kr.REL,"\u2a6f":kr.REL,"\u2a70":kr.REL,"\u2a71":kr.REL,"\u2a72":kr.REL,"\u2a73":kr.REL,"\u2a74":kr.REL,"\u2a75":kr.REL,"\u2a76":kr.REL,"\u2a77":kr.REL,"\u2a78":kr.REL,"\u2a79":kr.REL,"\u2a7a":kr.REL,"\u2a7b":kr.REL,"\u2a7c":kr.REL,"\u2a7d":kr.REL,"\u2a7d\u0338":kr.REL,"\u2a7e":kr.REL,"\u2a7e\u0338":kr.REL,"\u2a7f":kr.REL,"\u2a80":kr.REL,"\u2a81":kr.REL,"\u2a82":kr.REL,"\u2a83":kr.REL,"\u2a84":kr.REL,"\u2a85":kr.REL,"\u2a86":kr.REL,"\u2a87":kr.REL,"\u2a88":kr.REL,"\u2a89":kr.REL,"\u2a8a":kr.REL,"\u2a8b":kr.REL,"\u2a8c":kr.REL,"\u2a8d":kr.REL,"\u2a8e":kr.REL,"\u2a8f":kr.REL,"\u2a90":kr.REL,"\u2a91":kr.REL,"\u2a92":kr.REL,"\u2a93":kr.REL,"\u2a94":kr.REL,"\u2a95":kr.REL,"\u2a96":kr.REL,"\u2a97":kr.REL,"\u2a98":kr.REL,"\u2a99":kr.REL,"\u2a9a":kr.REL,"\u2a9b":kr.REL,"\u2a9c":kr.REL,"\u2a9d":kr.REL,"\u2a9e":kr.REL,"\u2a9f":kr.REL,"\u2aa0":kr.REL,"\u2aa1":kr.REL,"\u2aa2":kr.REL,"\u2aa3":kr.REL,"\u2aa4":kr.REL,"\u2aa5":kr.REL,"\u2aa6":kr.REL,"\u2aa7":kr.REL,"\u2aa8":kr.REL,"\u2aa9":kr.REL,"\u2aaa":kr.REL,"\u2aab":kr.REL,"\u2aac":kr.REL,"\u2aad":kr.REL,"\u2aae":kr.REL,"\u2aaf":kr.REL,"\u2aaf\u0338":kr.REL,"\u2ab0":kr.REL,"\u2ab0\u0338":kr.REL,"\u2ab1":kr.REL,"\u2ab2":kr.REL,"\u2ab3":kr.REL,"\u2ab4":kr.REL,"\u2ab5":kr.REL,"\u2ab6":kr.REL,"\u2ab7":kr.REL,"\u2ab8":kr.REL,"\u2ab9":kr.REL,"\u2aba":kr.REL,"\u2abb":kr.REL,"\u2abc":kr.REL,"\u2abd":kr.REL,"\u2abe":kr.REL,"\u2abf":kr.REL,"\u2ac0":kr.REL,"\u2ac1":kr.REL,"\u2ac2":kr.REL,"\u2ac3":kr.REL,"\u2ac4":kr.REL,"\u2ac5":kr.REL,"\u2ac6":kr.REL,"\u2ac7":kr.REL,"\u2ac8":kr.REL,"\u2ac9":kr.REL,"\u2aca":kr.REL,"\u2acb":kr.REL,"\u2acc":kr.REL,"\u2acd":kr.REL,"\u2ace":kr.REL,"\u2acf":kr.REL,"\u2ad0":kr.REL,"\u2ad1":kr.REL,"\u2ad2":kr.REL,"\u2ad3":kr.REL,"\u2ad4":kr.REL,"\u2ad5":kr.REL,"\u2ad6":kr.REL,"\u2ad7":kr.REL,"\u2ad8":kr.REL,"\u2ad9":kr.REL,"\u2ada":kr.REL,"\u2adb":kr.BIN4,"\u2add":kr.BIN3,"\u2add\u0338":kr.REL,"\u2ade":kr.REL,"\u2adf":kr.REL,"\u2ae0":kr.REL,"\u2ae1":kr.REL,"\u2ae2":kr.REL,"\u2ae3":kr.REL,"\u2ae4":kr.REL,"\u2ae5":kr.REL,"\u2ae6":kr.REL,"\u2ae7":kr.REL,"\u2ae8":kr.REL,"\u2ae9":kr.REL,"\u2aea":kr.REL,"\u2aeb":kr.REL,"\u2aee":kr.REL,"\u2af2":kr.REL,"\u2af3":kr.REL,"\u2af4":kr.REL,"\u2af5":kr.REL,"\u2af6":kr.BIN4,"\u2af7":kr.REL,"\u2af8":kr.REL,"\u2af9":kr.REL,"\u2afa":kr.REL,"\u2afb":kr.BIN4,"\u2afd":kr.BIN4,"\u2afe":kr.BIN3,"\u2b00":kr.REL,"\u2b01":kr.REL,"\u2b02":kr.REL,"\u2b03":kr.REL,"\u2b04":kr.WIDEREL,"\u2b05":kr.WIDEREL,"\u2b06":kr.RELSTRETCH,"\u2b07":kr.RELSTRETCH,"\u2b08":kr.REL,"\u2b09":kr.REL,"\u2b0a":kr.REL,"\u2b0b":kr.REL,"\u2b0c":kr.WIDEREL,"\u2b0d":kr.RELSTRETCH,"\u2b0e":kr.RELSTRETCH,"\u2b0f":kr.RELSTRETCH,"\u2b10":kr.RELSTRETCH,"\u2b11":kr.RELSTRETCH,"\u2b30":kr.WIDEREL,"\u2b31":kr.WIDEREL,"\u2b32":kr.RELSTRETCH,"\u2b33":kr.WIDEREL,"\u2b34":kr.WIDEREL,"\u2b35":kr.WIDEREL,"\u2b36":kr.WIDEREL,"\u2b37":kr.WIDEREL,"\u2b38":kr.WIDEREL,"\u2b39":kr.WIDEREL,"\u2b3a":kr.WIDEREL,"\u2b3b":kr.WIDEREL,"\u2b3c":kr.WIDEREL,"\u2b3d":kr.WIDEREL,"\u2b3e":kr.WIDEREL,"\u2b3f":kr.RELACCENT,"\u2b40":kr.WIDEREL,"\u2b41":kr.WIDEREL,"\u2b42":kr.WIDEREL,"\u2b43":kr.WIDEREL,"\u2b44":kr.WIDEREL,"\u2b45":kr.WIDEREL,"\u2b46":kr.WIDEREL,"\u2b47":kr.WIDEREL,"\u2b48":kr.WIDEREL,"\u2b49":kr.WIDEREL,"\u2b4a":kr.WIDEREL,"\u2b4b":kr.WIDEREL,"\u2b4c":kr.WIDEREL,"\u2b4d":kr.REL,"\u2b4e":kr.REL,"\u2b4f":kr.REL,"\u2b5a":kr.REL,"\u2b5b":kr.REL,"\u2b5c":kr.REL,"\u2b5d":kr.REL,"\u2b5e":kr.REL,"\u2b5f":kr.REL,"\u2b60":kr.WIDEREL,"\u2b61":kr.RELSTRETCH,"\u2b62":kr.WIDEREL,"\u2b63":kr.RELSTRETCH,"\u2b64":kr.WIDEREL,"\u2b65":kr.RELSTRETCH,"\u2b66":kr.REL,"\u2b67":kr.REL,"\u2b68":kr.REL,"\u2b69":kr.REL,"\u2b6a":kr.WIDEREL,"\u2b6b":kr.RELSTRETCH,"\u2b6c":kr.WIDEREL,"\u2b6d":kr.RELSTRETCH,"\u2b6e":kr.REL,"\u2b6f":kr.REL,"\u2b70":kr.WIDEREL,"\u2b71":kr.RELSTRETCH,"\u2b72":kr.WIDEREL,"\u2b73":kr.RELSTRETCH,"\u2b76":kr.REL,"\u2b77":kr.REL,"\u2b78":kr.REL,"\u2b79":kr.REL,"\u2b7a":kr.WIDEREL,"\u2b7b":kr.RELSTRETCH,"\u2b7c":kr.WIDEREL,"\u2b7d":kr.RELSTRETCH,"\u2b80":kr.WIDEREL,"\u2b81":kr.RELSTRETCH,"\u2b82":kr.WIDEREL,"\u2b83":kr.RELSTRETCH,"\u2b84":kr.WIDEREL,"\u2b85":kr.RELSTRETCH,"\u2b86":kr.WIDEREL,"\u2b87":kr.RELSTRETCH,"\u2b88":kr.RELACCENT,"\u2b89":kr.REL,"\u2b8a":kr.RELACCENT,"\u2b8b":kr.REL,"\u2b8c":kr.REL,"\u2b8d":kr.REL,"\u2b8e":kr.REL,"\u2b8f":kr.REL,"\u2b94":kr.REL,"\u2b95":kr.WIDEREL,"\u2ba0":kr.RELSTRETCH,"\u2ba1":kr.RELSTRETCH,"\u2ba2":kr.RELSTRETCH,"\u2ba3":kr.RELSTRETCH,"\u2ba4":kr.RELSTRETCH,"\u2ba5":kr.RELSTRETCH,"\u2ba6":kr.RELSTRETCH,"\u2ba7":kr.RELSTRETCH,"\u2ba8":kr.WIDEREL,"\u2ba9":kr.WIDEREL,"\u2baa":kr.WIDEREL,"\u2bab":kr.WIDEREL,"\u2bac":kr.RELSTRETCH,"\u2bad":kr.RELSTRETCH,"\u2bae":kr.RELSTRETCH,"\u2baf":kr.RELSTRETCH,"\u2bb0":kr.REL,"\u2bb1":kr.REL,"\u2bb2":kr.REL,"\u2bb3":kr.REL,"\u2bb4":kr.REL,"\u2bb5":kr.REL,"\u2bb6":kr.REL,"\u2bb7":kr.REL,"\u2bb8":kr.RELSTRETCH,"\u2bd1":kr.REL,\u3adc:kr.BIN3,"\ufe37":kr.WIDEACCENT,"\ufe38":kr.WIDEACCENT}};function Fr(t,e){return t.length!==e.length?e.length-t.length:t===e?0:tt.codePointAt(0))}function Ur(t){return String.fromCodePoint(...t)}function Hr(t){return!!t.match(/%\s*$/)}function Wr(t){return t.trim().split(/\s+/)}function zr(t){return t.replace(/\\U(?:([0-9A-Fa-f]{4})|\{\s*([0-9A-Fa-f]{1,6})\s*\})|\\./g,(t,e,s)=>"\\\\"===t?"\\":String.fromCodePoint(parseInt(e||s,16)))}function qr(t){return`&#x${t.codePointAt(0).toString(16).toUpperCase()};`}class Vr extends vr{constructor(){super(...arguments),this._texClass=null,this.lspace=5/18,this.rspace=5/18}get texClass(){return null===this._texClass?this.getOperatorDef(this.getText())[2]:this._texClass}set texClass(t){this._texClass=t}get kind(){return"mo"}get isEmbellished(){return!0}coreParent(){let t=null,e=this;const s=this.factory.getNodeClass("math");for(;e&&e.isEmbellished&&e.coreMO()===this&&!(e instanceof s);)t=e,e=e.parent;return t||this}coreText(t){if(!t)return"";if(t.isEmbellished)return t.coreMO().getText();for(;((t.isKind("mrow")||t.isKind("TeXAtom")||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():""}hasSpacingAttributes(){return this.attributes.isSet("lspace")||this.attributes.isSet("rspace")}get isAccent(){let t=!1;const e=this.coreParent().parent;if(e){const s=e.isKind("mover")?e.childNodes[e.over].coreMO()?"accent":"":e.isKind("munder")?e.childNodes[e.under].coreMO()?"accentunder":"":e.isKind("munderover")?this===e.childNodes[e.over].coreMO()?"accent":this===e.childNodes[e.under].coreMO()?"accentunder":"":"";if(s){t=void 0!==e.attributes.getExplicit(s)?t:this.attributes.get("accent")}}return t}setTeXclass(t){const{form:e,fence:s}=this.attributes.getList("form","fence");return void 0===this.getProperty("texClass")&&this.hasSpacingAttributes()?null:(s&&this.texClass===fr.REL&&("prefix"===e&&(this.texClass=fr.OPEN),"postfix"===e&&(this.texClass=fr.CLOSE)),this.adjustTeXclass(t))}adjustTeXclass(t){const e=this.texClass;let s=this.prevClass;if(e===fr.NONE)return t;if(t?(!t.getProperty("autoOP")||e!==fr.BIN&&e!==fr.REL||(s=t.texClass=fr.ORD),s=this.prevClass=t.texClass||fr.ORD,this.prevLevel=this.attributes.getInherited("scriptlevel")):s=this.prevClass=fr.NONE,e!==fr.BIN||s!==fr.NONE&&s!==fr.BIN&&s!==fr.OP&&s!==fr.REL&&s!==fr.OPEN&&s!==fr.PUNCT)if(s!==fr.BIN||e!==fr.REL&&e!==fr.CLOSE&&e!==fr.PUNCT){if(e===fr.BIN){let t=null,e=this.parent;for(;e&&e.parent&&e.isEmbellished&&(1===e.childNodes.length||!e.isKind("mrow")&&e.core()===t);)t=e,e=e.parent;t=t||this,e.childNodes[e.childNodes.length-1]===t&&(this.texClass=fr.ORD)}}else t.texClass=this.prevClass=fr.ORD;else this.texClass=fr.ORD;return this}setInheritedAttributes(t={},e=!1,s=0,i=!1){super.setInheritedAttributes(t,e,s,i);const r=this.getText();this.checkOperatorTable(r),this.checkPseudoScripts(r),this.checkPrimes(r),this.checkMathAccent(r)}getOperatorDef(t){const[e,s,i]=this.handleExplicitForm(this.getForms());this.attributes.setInherited("form",e);const r=this.constructor,n=r.OPTABLE,o=n[e][t]||n[s][t]||n[i][t];if(o)return o;this.setProperty("noDictDef",!0);const a=this.attributes.get("movablelimits");if((!!t.match(r.opPattern)||a)&&void 0===this.getProperty("texClass"))return wr(1,2,fr.OP);const l=Dr(t),[c,h]=r.MMLSPACING[l[2]];return wr(c,h,l[2])}checkOperatorTable(t){const e=this.getOperatorDef(t);void 0===this.getProperty("texClass")&&(this.texClass=e[2]);for(const t of Object.keys(e[3]||{}))this.attributes.setInherited(t,e[3][t]);this.lspace=e[0]/18,this.rspace=e[1]/18}getForms(){let t=null,e=this.parent,s=this.Parent;for(;s&&s.isEmbellished;)t=e,e=s.parent,s=s.Parent;if(t=t||this,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"]}handleExplicitForm(t){if(this.attributes.isSet("form")){const e=this.attributes.get("form");t=[e].concat(t.filter(t=>t!==e))}return t}checkPseudoScripts(t){const e=this.constructor.pseudoScripts;if(!t.match(e))return;const s=this.coreParent().Parent,i=!s||!(s.isKind("msubsup")&&!s.isKind("msub"));this.setProperty("pseudoscript",i),i&&(this.attributes.setInherited("lspace",0),this.attributes.setInherited("rspace",0))}checkPrimes(t){const e=this.constructor.primes;if(!t.match(e))return;const s=this.constructor.remapPrimes,i=Ur(_r(t).map(t=>s[t]));this.setProperty("primes",i)}checkMathAccent(t){const e=this.Parent;if(void 0!==this.getProperty("mathaccent")||!e||!e.isKind("munderover"))return;const[s,i,r]=e.childNodes;if(s.isEmbellished&&s.coreMO()===this)return;const n=!(!i||!i.isEmbellished||i.coreMO()!==this),o=!(!r||!r.isEmbellished||i.coreMO()!==this);(n||o)&&(this.isMathAccent(t)?this.setProperty("mathaccent",!0):this.isMathAccentWithWidth(t)&&this.setProperty("mathaccent",!1))}isMathAccent(t=this.getText()){const e=this.constructor.mathaccents;return!!t.match(e)}isMathAccentWithWidth(t=this.getText()){const e=this.constructor.mathaccentsWithWidth;return!!t.match(e)}}Vr.defaults=Object.assign(Object.assign({},vr.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:"100%",linebreakstyle:"before",indentalign:"auto",indentshift:"0",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),Vr.MMLSPACING=Pr,Vr.OPTABLE=Br,Vr.pseudoScripts=new RegExp(["^[\"'*`","\xaa","\xb0","\xb2-\xb4","\xb9","\xba","\u2018-\u201f","\u2032-\u2037\u2057","\u2070\u2071","\u2074-\u207f","\u2080-\u208e","]+$"].join("")),Vr.primes=new RegExp(["^[\"'","\u2018-\u201f","]+$"].join("")),Vr.opPattern=/^[a-zA-Z]{2,}$/,Vr.remapPrimes={34:8243,39:8242,8216:8245,8217:8242,8218:8242,8219:8245,8220:8246,8221:8243,8222:8243,8223:8246},Vr.mathaccents=new RegExp(["^[","\xb4\u0301\u02ca","`\u0300\u02cb","\xa8\u0308","~\u0303\u02dc","\xaf\u0304\u02c9","\u02d8\u0306","\u02c7\u030c","^\u0302\u02c6","\u20d0\u20d1","\u20d6\u20d7\u20e1","\u02d9\u0307","\u02da\u030a","\u20db","\u20dc","]$"].join("")),Vr.mathaccentsWithWidth=new RegExp(["^[","\u2190\u2192\u2194","\u23dc\u23dd","\u23de\u23df","]$"].join(""));class Xr extends vr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mtext"}get isSpacelike(){return!!this.getText().match(/^\s*$/)&&!this.attributes.hasOneOf(Xr.NONSPACELIKE)}}Xr.NONSPACELIKE=["style","mathbackground","background"],Xr.defaults=Object.assign({},vr.defaults);class Gr extends vr{constructor(){super(...arguments),this.texclass=fr.NONE}setTeXclass(t){return t}get kind(){return"mspace"}get arity(){return 0}get isSpacelike(){return!this.attributes.hasExplicit("linebreak")&&this.canBreak}get hasNewline(){const t=this.attributes.get("linebreak");return this.canBreak&&("newline"===t||"indentingnewline"===t)}get canBreak(){return!this.attributes.hasOneOf(Gr.NONSPACELIKE)&&"-"!==String(this.attributes.get("width")).trim().charAt(0)}}Gr.NONSPACELIKE=["height","depth","style","mathbackground","background"],Gr.defaults=Object.assign(Object.assign({},vr.defaults),{width:"0em",height:"0ex",depth:"0ex",linebreak:"auto",indentshift:"auto",indentalign:"auto",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"});class Jr extends vr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"ms"}}Jr.defaults=Object.assign(Object.assign({},vr.defaults),{lquote:'"',rquote:'"'});class Kr extends Nr{constructor(){super(...arguments),this._core=null}get kind(){return"mrow"}get isSpacelike(){for(const t of this.childNodes)if(!t.isSpacelike)return!1;return!0}get isEmbellished(){let t=!1,e=0;for(const s of this.childNodes){if(s)if(s.isEmbellished){if(t)return!1;t=!0,this._core=e}else if(!s.isSpacelike)return!1;e++}return t}core(){return this.isEmbellished&&null!=this._core?this.childNodes[this._core]:this}coreMO(){return this.isEmbellished&&null!=this._core?this.childNodes[this._core].coreMO():this}nonSpaceLength(){let t=0;for(const e of this.childNodes)e&&!e.isSpacelike&&t++;return t}firstNonSpace(){for(const t of this.childNodes)if(t&&!t.isSpacelike)return t;return null}lastNonSpace(){let t=this.childNodes.length;for(;--t>=0;){const e=this.childNodes[t];if(e&&!e.isSpacelike)return e}return null}setTeXclass(t){if(null!=this.getProperty("open")||null!=this.getProperty("close")){this.getPrevClass(t),t=null;for(const e of this.childNodes)t=e.setTeXclass(t);return null==this.texClass&&(this.texClass=fr.INNER),this}for(const e of this.childNodes)t=e.setTeXclass(t);return this.childNodes[0]&&this.updateTeXclass(this.childNodes[0]),t}}Kr.defaults=Object.assign({},Nr.defaults);class $r extends Kr{get kind(){return"inferredMrow"}get isInferred(){return!0}get notParent(){return!0}toString(){return"["+this.childNodes.join(",")+"]"}}$r.defaults=Kr.defaults;class Yr extends Cr{get kind(){return"mfrac"}get arity(){return 2}get linebreakContainer(){return!0}get linebreakAlign(){return""}setTeXclass(t){this.getPrevClass(t);for(const t of this.childNodes)t.setTeXclass(null);return this}setChildInheritedAttributes(t,e,s,i){(!e||s>0)&&s++;const r=this.attributes.get("numalign"),n=this.attributes.get("denomalign"),o=this.addInheritedAttributes(Object.assign({},t),{numalign:r,indentshift:"0",indentalignfirst:r,indentshiftfirst:"0",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),a=this.addInheritedAttributes(Object.assign({},t),{denalign:n,indentshift:"0",indentalignfirst:n,indentshiftfirst:"0",indentalignlast:"indentalign",indentshiftlast:"indentshift"});this.childNodes[0].setInheritedAttributes(o,!1,s,i),this.childNodes[1].setInheritedAttributes(a,!1,s,!0)}}Yr.defaults=Object.assign(Object.assign({},Cr.defaults),{linethickness:"medium",numalign:"center",denomalign:"center",bevelled:!1});class Qr extends Nr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"msqrt"}get arity(){return-1}get linebreakContainer(){return!0}setTeXclass(t){return this.getPrevClass(t),this.childNodes[0].setTeXclass(null),this}setChildInheritedAttributes(t,e,s,i){this.childNodes[0].setInheritedAttributes(t,e,s,!0)}}Qr.defaults=Object.assign(Object.assign({},Nr.defaults),{"data-vertical-align":"bottom"});class Zr extends Nr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mroot"}get arity(){return 2}get linebreakContainer(){return!0}setTeXclass(t){return this.getPrevClass(t),this.childNodes[0].setTeXclass(null),this.childNodes[1].setTeXclass(null),this}setChildInheritedAttributes(t,e,s,i){this.childNodes[0].setInheritedAttributes(t,e,s,!0),this.childNodes[1].setInheritedAttributes(t,!1,s+2,i)}}Zr.defaults=Object.assign(Object.assign({},Nr.defaults),{"data-vertical-align":"bottom"});class tn extends Tr{get kind(){return"mstyle"}get notParent(){return this.childNodes[0]&&1===this.childNodes[0].childNodes.length}setInheritedAttributes(t={},e=!1,s=0,i=!1){this.attributes.setInherited("displaystyle",e),this.attributes.setInherited("scriptlevel",s),super.setInheritedAttributes(t,e,s,i)}setChildInheritedAttributes(t,e,s,i){let r=this.attributes.getExplicit("scriptlevel");null!=r&&(r=r.toString(),r.match(/^\s*[-+]/)?s+=parseInt(r):s=parseInt(r),i=!1);const n=this.attributes.getExplicit("displaystyle");null!=n&&(e=!0===n,i=!1);const o=this.attributes.getExplicit("data-cramped");null!=o&&(i=o),t=this.addInheritedAttributes(t,this.attributes.getAllAttributes()),this.childNodes[0].setInheritedAttributes(t,e,s,i)}}tn.defaults=Object.assign(Object.assign({},Tr.defaults),{scriptlevel:dr,displaystyle:dr,scriptsizemultiplier:1/Math.sqrt(2),scriptminsize:".4em",mathbackground:dr,mathcolor:dr,dir:dr,infixlinebreakstyle:"before"});class en extends Nr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"merror"}get arity(){return-1}get linebreakContainer(){return!0}}en.defaults=Object.assign({},Nr.defaults);class sn extends Tr{get kind(){return"mpadded"}get linebreakContainer(){return!0}setTeXclass(t){return this.getProperty("vbox")?(this.getPrevClass(t),this.texClass=fr.ORD,this.childNodes[0].setTeXclass(null),this):super.setTeXclass(t)}}sn.defaults=Object.assign(Object.assign({},Tr.defaults),{width:"",height:"",depth:"",lspace:0,voffset:0});class rn extends Tr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mphantom"}}rn.defaults=Object.assign({},Tr.defaults);class nn extends Nr{constructor(){super(...arguments),this.texclass=fr.INNER,this.separators=[],this.open=null,this.close=null}get kind(){return"mfenced"}setTeXclass(t){this.getPrevClass(t),this.open&&(t=this.open.setTeXclass(t)),this.childNodes[0]&&(t=this.childNodes[0].setTeXclass(t));for(let e=1,s=this.childNodes.length;ethis.childNodes.length&&(t=1),this.attributes.set("selection",t)}setChildInheritedAttributes(t,e,s,i){var r,n;"tooltip"===this.attributes.get("actiontype").toLowerCase()?(null===(r=this.childNodes[0])||void 0===r||r.setInheritedAttributes(t,e,s,i),null===(n=this.childNodes[1])||void 0===n||n.setInheritedAttributes(t,!1,1,!1)):super.setChildInheritedAttributes(t,e,s,i)}}an.defaults=Object.assign(Object.assign({},Nr.defaults),{actiontype:"toggle",selection:1});class ln extends Cr{get kind(){return"msubsup"}get arity(){return 3}get base(){return 0}get sub(){return 1}get sup(){return 2}setChildInheritedAttributes(t,e,s,i){const r=this.childNodes;r[0].setInheritedAttributes(t,e,s,i),r[1].setInheritedAttributes(t,!1,s+1,i||1===this.sub),r[2]&&r[2].setInheritedAttributes(t,!1,s+1,i||2===this.sub)}}ln.defaults=Object.assign(Object.assign({},Cr.defaults),{subscriptshift:"",superscriptshift:""});class cn extends ln{get kind(){return"msub"}get arity(){return 2}}cn.defaults=Object.assign({},ln.defaults);class hn extends ln{get kind(){return"msup"}get arity(){return 2}get sup(){return 1}get sub(){return 2}}hn.defaults=Object.assign({},ln.defaults);class dn extends Cr{get kind(){return"munderover"}get arity(){return 3}get base(){return 0}get under(){return 1}get over(){return 2}get linebreakContainer(){return!0}setChildInheritedAttributes(t,e,s,i){const r=this.childNodes;r[0].setInheritedAttributes(t,e,s,i||!!r[this.over]);const n=!(e||!r[0].coreMO().attributes.get("movablelimits")),o=this.constructor.ACCENTS;r[1].setInheritedAttributes(t,!1,this.getScriptlevel(o[1],n,s),i||1===this.under),this.setInheritedAccent(1,o[1],e,s,i,n),r[2]&&(r[2].setInheritedAttributes(t,!1,this.getScriptlevel(o[2],n,s),i||2===this.under),this.setInheritedAccent(2,o[2],e,s,i,n))}getScriptlevel(t,e,s){return!e&&this.attributes.get(t)||s++,s}setInheritedAccent(t,e,s,i,r,n){const o=this.childNodes[t];if(!this.attributes.hasExplicit(e)&&o.isEmbellished){const t=o.coreMO().attributes.get("accent");this.attributes.setInherited(e,t),t!==this.attributes.getDefault(e)&&o.setInheritedAttributes({},s,this.getScriptlevel(e,n,i),r)}}}dn.defaults=Object.assign(Object.assign({},Cr.defaults),{accent:!1,accentunder:!1,align:"center"}),dn.ACCENTS=["","accentunder","accent"];class un extends dn{get kind(){return"munder"}get arity(){return 2}}un.defaults=Object.assign({},dn.defaults);class pn extends dn{get kind(){return"mover"}get arity(){return 2}get over(){return 1}get under(){return 2}}pn.defaults=Object.assign({},dn.defaults),pn.ACCENTS=["","accent","accentunder"];class mn extends ln{get kind(){return"mmultiscripts"}get arity(){return 1}setChildInheritedAttributes(t,e,s,i){this.childNodes[0].setInheritedAttributes(t,e,s,i);let r=!1;for(let e=1,n=0;e...`}verifyTree(t){!this.parent||this.parent.isToken||this.mError("HTML can only be a child of a token element",t,!0)}}const In={[Rr.prototype.kind]:Rr,[Mr.prototype.kind]:Mr,[Ir.prototype.kind]:Ir,[Vr.prototype.kind]:Vr,[Xr.prototype.kind]:Xr,[Gr.prototype.kind]:Gr,[Jr.prototype.kind]:Jr,[Kr.prototype.kind]:Kr,[$r.prototype.kind]:$r,[Yr.prototype.kind]:Yr,[Qr.prototype.kind]:Qr,[Zr.prototype.kind]:Zr,[tn.prototype.kind]:tn,[en.prototype.kind]:en,[sn.prototype.kind]:sn,[rn.prototype.kind]:rn,[nn.prototype.kind]:nn,[on.prototype.kind]:on,[an.prototype.kind]:an,[cn.prototype.kind]:cn,[hn.prototype.kind]:hn,[ln.prototype.kind]:ln,[un.prototype.kind]:un,[pn.prototype.kind]:pn,[dn.prototype.kind]:dn,[mn.prototype.kind]:mn,[fn.prototype.kind]:fn,[gn.prototype.kind]:gn,[bn.prototype.kind]:bn,[xn.prototype.kind]:xn,[En.prototype.kind]:En,[yn.prototype.kind]:yn,[Nn.prototype.kind]:Nn,[vn.prototype.kind]:vn,[Tn.prototype.kind]:Tn,[Cn.prototype.kind]:Cn,[Ln.prototype.kind]:Ln,[An.prototype.kind]:An,[Sn.prototype.kind]:Sn,[Rn.prototype.kind]:Rn,[Lr.prototype.kind]:Lr,[Sr.prototype.kind]:Sr,[Mn.prototype.kind]:Mn};class wn extends hr{get MML(){return this.node}}wn.defaultNodes=In;class kn{constructor(){this.bits=0}static allocate(...t){for(const e of t){if(this.has(e))throw new Error("Bit already allocated for "+e);if(this.next===kn.MAXBIT)throw new Error("Maximum number of bits already allocated");this.names.set(e,this.next),this.next<<=1}}static has(t){return this.names.has(t)}set(t){this.bits|=this.getBit(t)}clear(t){this.bits&=~this.getBit(t)}isSet(t){return!!(this.bits&this.getBit(t))}reset(){this.bits=0}getBit(t){const e=this.constructor.names.get(t);if(!e)throw new Error("Unknown bit-field name: "+t);return e}}function On(...t){const e=class extends kn{};return e.allocate(...t),e}function Dn(t){return new Promise(function e(s,i){const r=t=>{var r;t.retry instanceof Promise?t.retry.then(()=>e(s,i)).catch(t=>i(t)):(null===(r=t.restart)||void 0===r?void 0:r.isCallback)?MathJax.Callback.After(()=>e(s,i),t.restart):i(t)};try{const e=t();e instanceof Promise?e.then(t=>s(t)).catch(t=>r(t)):s(e)}catch(t){r(t)}})}function Pn(t){const e=new Error("MathJax retry -- an asynchronous action is required; try using one of the promise-based functions and await its resolution.");throw e.retry=t,e}kn.MAXBIT=1<<31,kn.next=1,kn.names=new Map;var Bn=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};class Fn extends gi{static create(t){const e=new this;for(const s of Object.keys(t)){const[i,r]=this.action(s,t[s]);r&&e.add(i,r)}return e}static action(t,e){let s,i,r=!0;const n=e[0];if(1===e.length||"boolean"==typeof e[1])2===e.length&&(r=e[1]),[s,i]=this.methodActions(t);else if("string"==typeof e[1])if("string"==typeof e[2]){4===e.length&&(r=e[3]);const[t,n]=e.slice(1);[s,i]=this.methodActions(t,n)}else 3===e.length&&(r=e[2]),[s,i]=this.methodActions(e[1]);else 4===e.length&&(r=e[3]),[s,i]=e.slice(1);return[{id:t,renderDoc:s,renderMath:i,convert:r},n]}static methodActions(t,e=t){return[e=>(t&&e[t](),!1),(t,s)=>(e&&t[e](s),!1)]}renderDoc(t,e=ar.UNPROCESSED){for(const s of this.items)if(s.priority>=e&&s.item.renderDoc(t))return}renderMath(t,e,s=ar.UNPROCESSED){for(const i of this.items)if(i.priority>=s&&i.item.renderMath(t,e))return}renderConvert(t,e,s=ar.LAST){for(const i of this.items){if(i.priority>s)return;if(i.item.convert&&i.item.renderMath(t,e))return}}findID(t){for(const e of this.items)if(e.item.id===t)return e.item;return null}}const jn={all:!1,processed:!1,inputJax:null,outputJax:null},_n={all:!0,processed:!0,inputJax:[],outputJax:[]};class Un extends Zi{compile(t){return null}}class Hn extends tr{typeset(t,e=null){return null}escaped(t,e){return null}}class Wn extends rr{}class zn{constructor(t,e,s){const i=this.constructor;this.document=t,this.options=Fi(Bi({},i.OPTIONS),s),this.math=new(this.options.MathList||Wn),this.renderActions=Fn.create(this.options.renderActions),this._actionPromises=[],this._readyPromise=Promise.resolve(),this.processed=new zn.ProcessBits,this.outputJax=this.options.OutputJax||new Hn;let r=this.options.InputJax||[new Un];Array.isArray(r)||(r=[r]),this.inputJax=r,this.adaptor=e,this.outputJax.setAdaptor(e),this.inputJax.map(t=>t.setAdaptor(e)),this.mmlFactory=this.options.MmlFactory||new wn,this.inputJax.map(t=>t.setMmlFactory(this.mmlFactory)),this.outputJax.initialize(),this.inputJax.map(t=>t.initialize())}get kind(){return this.constructor.KIND}addRenderAction(t,...e){const[s,i]=Fn.action(t,e);this.renderActions.add(s,i)}removeRenderAction(t){const e=this.renderActions.findID(t);e&&this.renderActions.remove(e)}render(){return this.clearPromises(),this.renderActions.renderDoc(this),this}renderPromise(){return this.whenReady(()=>Dn(()=>Bn(this,void 0,void 0,function*(){return this.render(),yield this.actionPromises(),this.clearPromises(),this})))}rerender(t=ar.RERENDER){return this.state(t-1),this.render(),this}rerenderPromise(t=ar.RERENDER){return this.whenReady(()=>Dn(()=>Bn(this,void 0,void 0,function*(){return this.rerender(t),yield this.actionPromises(),this.clearPromises(),this})))}convert(t,e={}){let{format:s,display:i,end:r,ex:n,em:o,containerWidth:a,scale:l,family:c}=Fi({format:this.inputJax[0].name,display:!0,end:ar.LAST,em:16,ex:8,containerWidth:null,scale:1,family:""},e);null===a&&(a=80*n);const h=this.inputJax.reduce((t,e)=>e.name===s?e:t,null),d=new this.options.MathItem(t,h,i);return d.start.node=this.adaptor.body(this.document),d.setMetrics(o,n,a,l),c&&this.outputJax.options.mtextInheritFont&&(d.outputData.mtextFamily=c),c&&this.outputJax.options.merrorInheritFont&&(d.outputData.merrorFamily=c),this.clearPromises(),d.convert(this,r),d.typesetRoot||d.root}convertPromise(t,e={}){return this.whenReady(()=>Dn(()=>Bn(this,void 0,void 0,function*(){const s=this.convert(t,e);return yield this.actionPromises(),this.clearPromises(),s})))}whenReady(t){return this._readyPromise=this._readyPromise.catch(t=>{}).then(()=>{const e=this._readyPromise;this._readyPromise=Promise.resolve();const s=t(),i=this._readyPromise.then(()=>s);return this._readyPromise=e,i})}actionPromises(){return Promise.all(this._actionPromises)}clearPromises(){this._actionPromises=[]}savePromise(t){this._actionPromises.push(t)}findMath(t=null){return this.processed.set("findMath"),this}compile(){if(!this.processed.isSet("compile")){const t=[];for(const e of this.math)this.compileMath(e),void 0!==e.inputData.recompile&&t.push(e);for(const e of t){const t=e.inputData.recompile;e.state(t.state),e.inputData.recompile=t,this.compileMath(e)}this.processed.set("compile")}return this}compileMath(t){try{t.compile(this)}catch(e){if(e.retry||e.restart)throw e;this.options.compileError(this,t,e),t.inputData.error=e}}compileError(t,e){t.root=this.mmlFactory.create("math",null,[this.mmlFactory.create("merror",{"data-mjx-error":e.message,title:e.message},[this.mmlFactory.create("mtext",null,[this.mmlFactory.create("text").setText("Math input error")])])]),t.display&&t.root.attributes.set("display","block"),t.inputData.error=e.message}typeset(){if(!this.processed.isSet("typeset")){for(const t of this.math)try{t.typeset(this)}catch(e){if(e.retry||e.restart)throw e;this.options.typesetError(this,t,e),t.outputData.error=e}this.processed.set("typeset")}return this}typesetError(t,e){t.typesetRoot=this.adaptor.node("mjx-container",{class:"MathJax mjx-output-error",jax:this.outputJax.name},[this.adaptor.node("span",{"data-mjx-error":e.message,title:e.message,style:{color:"red","background-color":"yellow","line-height":"normal"}},[this.adaptor.text("Math output error")])]),t.display&&this.adaptor.setAttributes(t.typesetRoot,{style:{display:"block",margin:"1em 0","text-align":"center"}}),t.outputData.error=e.message}getMetrics(){return this.processed.isSet("getMetrics")||(this.outputJax.getMetrics(this),this.processed.set("getMetrics")),this}updateDocument(){if(!this.processed.isSet("updateDocument")){for(const t of this.math.reversed())t.updateDocument(this);this.processed.set("updateDocument")}return this}removeFromDocument(t=!1){return this}state(t,e=!1){for(const s of this.math)s.state(t,e);return te.reset(...t.inputJax)),t.outputJax&&this.outputJax.reset(...t.outputJax),this}clear(){return this.reset(),this.math.clear(),this}done(){return Promise.resolve()}concat(t){return this.math.merge(t),this}clearMathItemsWithin(t){const e=this.getMathItemsWithin(t);for(const t of e.slice(0).reverse())t.clear();return this.math.remove(...e),e}getMathItemsWithin(t){Array.isArray(t)||(t=[t]);const e=this.adaptor,s=[],i=e.getElements(t,this.document);t:for(const t of this.math)for(const r of i)if(t.start.node&&e.contains(r,t.start.node)){s.push(t);continue t}return s}}zn.KIND="MathDocument",zn.OPTIONS={OutputJax:null,InputJax:null,MmlFactory:null,MathList:Wn,MathItem:class extends or{},compileError:(t,e,s)=>{t.compileError(e,s)},typesetError:(t,e,s)=>{t.typesetError(e,s)},renderActions:wi({find:[ar.FINDMATH,"findMath","",!1],compile:[ar.COMPILED],metrics:[ar.METRICS,"getMetrics","",!1],typeset:[ar.TYPESET],update:[ar.INSERTED,"updateDocument",!1]})},zn.ProcessBits=On("findMath","compile","getMetrics","typeset","updateDocument");class qn extends zn{}class Vn{constructor(t,e=5){this.documentClass=qn,this.adaptor=t,this.priority=e}get name(){return this.constructor.NAME}handlesDocument(t){return!1}create(t,e){return new this.documentClass(t,this.adaptor,e)}}Vn.NAME="generic";class Xn extends gi{register(t){return this.add(t,t.priority)}unregister(t){this.remove(t)}handlesDocument(t){for(const e of this){const s=e.item;if(s.handlesDocument(t))return s}throw new Error("Can't find handler for document")}document(t,e=null){return this.handlesDocument(t).create(t,e)}}class Gn{static methodName(t){return"visit"+(t.charAt(0).toUpperCase()+t.substring(1)).replace(/[^a-z0-9_]/gi,"_")+"Node"}constructor(t){this.nodeHandlers=new Map;for(const e of t.getKinds()){const t=this[Gn.methodName(e)];t&&this.nodeHandlers.set(e,t)}}visitTree(t,...e){return this.visitNode(t,...e)}visitNode(t,...e){return(this.nodeHandlers.get(t.kind)||this.visitDefault).call(this,t,...e)}visitDefault(t,...e){if("childNodes"in t)for(const s of t.childNodes)this.visitNode(s,...e)}setNodeHandler(t,e){this.nodeHandlers.set(t,e)}removeNodeHandler(t){this.nodeHandlers.delete(t)}}const Jn="data-mjx-";class Kn extends Gn{constructor(t=null){t||(t=new wn),super(t)}visitTextNode(t,...e){}visitXMLNode(t,...e){}visitHtmlNode(t,...e){}getKind(t){const e=t.kind;return Hi(e,this.constructor.rename,e)}getAttributeList(t){const e=this.constructor,s=Hi(t.kind,e.defaultAttributes,{}),i=Object.assign({},s,this.getDataAttributes(t),t.attributes.getAllAttributes()),r=e.variants;return Object.hasOwn(i,"mathvariant")&&(Object.hasOwn(r,i.mathvariant)?i.mathvariant=r[i.mathvariant]:t.getProperty("ignore-variant")&&delete i.mathvariant),i}getDataAttributes(t){const e={},s=t.attributes.getExplicit("mathvariant"),i=this.constructor.variants;s&&(t.getProperty("ignore-variant")||Object.hasOwn(i,s))&&this.setDataAttribute(e,"variant",s),t.getProperty("variantForm")&&this.setDataAttribute(e,"alternate","1"),t.getProperty("pseudoscript")&&this.setDataAttribute(e,"pseudoscript","true"),!1===t.getProperty("autoOP")&&this.setDataAttribute(e,"auto-op","false");const r=t.getProperty("vbox");r&&this.setDataAttribute(e,"vbox",r);const n=t.getProperty("scriptalign");n&&this.setDataAttribute(e,"script-align",n);const o=t.getProperty("mathaccent");void 0!==o&&(o&&!t.isMathAccent()||!o&&!t.isMathAccentWithWidth())&&this.setDataAttribute(e,"mathaccent",o.toString());const a=t.getProperty("texClass");if(void 0!==a){let s=!0;if(a===fr.OP&&t.isKind("mi")){const e=t.getText();s=!(e.length>1&&e.match(Mr.operatorName))}s&&this.setDataAttribute(e,"texclass",a<0?"NONE":gr[a])}return t.getProperty("smallmatrix")&&this.setDataAttribute(e,"smallmatrix","true"),e}setDataAttribute(t,e,s){t[Jn+e]=s}}Kn.rename={TeXAtom:"mrow"},Kn.variants={"-tex-calligraphic":"script","-tex-bold-calligraphic":"bold-script","-tex-oldstyle":"normal","-tex-bold-oldstyle":"bold","-tex-mathit":"italic"},Kn.defaultAttributes={math:{xmlns:"http://www.w3.org/1998/Math/MathML"}};class $n extends Kn{constructor(){super(...arguments),this.document=null}visitTree(t,e){this.document=e;const s=e.createElement("top");return this.visitNode(t,s),this.document=null,s.firstChild}visitTextNode(t,e){e.appendChild(this.document.createTextNode(t.getText()))}visitXMLNode(t,e){e.appendChild(t.getXML().cloneNode(!0))}visitHtmlNode(t,e){e.appendChild(t.getHTML().cloneNode(!0))}visitInferredMrowNode(t,e){for(const s of t.childNodes)this.visitNode(s,e)}visitDefault(t,e){const s=this.document.createElement(this.getKind(t));this.addAttributes(t,s);for(const e of t.childNodes)this.visitNode(e,s);e.appendChild(s)}addAttributes(t,e){const s=this.getAttributeList(t);for(const t of Object.keys(s))e.setAttribute(t,s[t].toString())}}class Yn extends Kn{visitTree(t){return this.visitNode(t,"")}visitTextNode(t,e){return this.quoteHTML(t.getText())}visitXMLNode(t,e){return e+t.getSerializedXML()}visitHtmlNode(t,e){return t.getSerializedHTML()}visitInferredMrowNode(t,e){const s=[];for(const i of t.childNodes)s.push(this.visitNode(i,e));return s.join("\n")}visitAnnotationNode(t,e){const s=this.childNodeMml(t,"","");return`${e}${s}`}visitDefault(t,e){const s=this.getKind(t),[i,r]=t.isToken||0===t.childNodes.length?["",""]:["\n",e],n=this.childNodeMml(t,e+"  ",i),o=n.match(/\S/)?i+n+r:"";return`${e}<${s}${this.getAttributes(t)}>${o}`}childNodeMml(t,e,s){let i="";for(const r of t.childNodes)i+=this.visitNode(r,e)+s;return i}getAttributes(t){const e=[],s=this.getAttributeList(t);for(const t of Object.keys(s)){const i=String(s[t]);void 0!==i&&e.push(t+'="'+this.quoteHTML(i)+'"')}return e.length?" "+e.join(" "):""}quoteHTML(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/[\uD800-\uDBFF]./g,this.toEntity).replace(/[\u0080-\uD7FF\uE000-\uFFFF]/g,this.toEntity)}toEntity(t){return qr(t)}}class Qn{get kind(){return this.node.kind}constructor(t,e){this.factory=t,this.node=e}wrap(t){return this.factory.wrap(t)}walkTree(t,e){if(t(this,e),"childNodes"in this)for(const s of this.childNodes)s&&s.walkTree(t,e);return e}}class Zn extends cr{wrap(t,...e){return this.create(t.kind,t,...e)}}const to={version:ri,context:pi,handlers:new Xn,document:function(t,e){return to.handlers.document(t,e)},handleRetriesFor:Dn,retryAfter:Pn,asyncLoad:null,asyncIsSynchronous:!1};class eo extends or{get adaptor(){return this.inputJax.adaptor}constructor(t,e,s=!0,i={node:null,n:0,delim:""},r={node:null,n:0,delim:""}){super(t,e,s,i,r)}updateDocument(t){if(this.state()=ar.TYPESET){const e=this.adaptor,s=this.start.node;let i=e.text("");if(t){const t=this.start.delim+this.math+this.end.delim;if(this.inputJax.processStrings)i=e.text(t);else{const s=e.parse(t,"text/html");i=e.firstChild(e.body(s))}}e.parent(s)&&e.replace(i,s),this.start.node=this.end.node=i,this.start.n=this.end.n=0}}}class so extends rr{}class io{constructor(t=null){const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t),this.init(),this.getPatterns()}init(){this.strings=[],this.string="",this.snodes=[],this.nodes=[],this.stack=[]}getPatterns(){const t=ki(this.options.skipHtmlTags),e=ki(this.options.ignoreHtmlClass),s=ki(this.options.processHtmlClass);this.skipHtmlTags=new RegExp("^(?:"+t.join("|")+")$","i"),this.ignoreHtmlClass=new RegExp("(?:^| )(?:"+e.join("|")+")(?: |$)"),this.processHtmlClass=new RegExp("(?:^| )(?:"+s+")(?: |$)")}pushString(){this.string.match(/\S/)&&(this.strings.push(this.string),this.nodes.push(this.snodes)),this.string="",this.snodes=[]}extendString(t,e){this.snodes.push([t,e.length]),this.string+=e}handleText(t,e){return e||this.extendString(t,this.adaptor.value(t)),this.adaptor.next(t)}handleTag(t,e){if(!e){const e=this.options.includeHtmlTags[this.adaptor.kind(t)];e instanceof Function?this.extendString(t,e(t,this.adaptor)):this.extendString(t,e)}return this.adaptor.next(t)}handleContainer(t,e){this.pushString();const s=this.adaptor.getAttribute(t,"class")||"",i=this.adaptor.kind(t)||"",r=this.processHtmlClass.exec(s);let n=t;return!this.adaptor.firstChild(t)||this.adaptor.getAttribute(t,"data-MJX")||!r&&this.skipHtmlTags.exec(i)?n=this.adaptor.next(t):(this.adaptor.next(t)&&this.stack.push([this.adaptor.next(t),e]),n=this.adaptor.firstChild(t),e=(e||this.ignoreHtmlClass.exec(s))&&!r),[n,e]}handleOther(t,e){return this.pushString(),this.adaptor.next(t)}find(t){this.init();const e=this.adaptor.next(t);let s=!1;const i=this.options.includeHtmlTags;for(;t&&t!==e;){const e=this.adaptor.kind(t);"#text"===e?t=this.handleText(t,s):Object.hasOwn(i,e)?t=this.handleTag(t,s):e?[t,s]=this.handleContainer(t,s):t=this.handleOther(t,s),!t&&this.stack.length&&(this.pushString(),[t,s]=this.stack.pop())}this.pushString();const r=[this.strings,this.nodes];return this.init(),r}}io.OPTIONS={skipHtmlTags:["script","noscript","style","textarea","pre","code","math","select","option","mjx-container"],includeHtmlTags:wi({br:"\n",wbr:"","#comment":""}),ignoreHtmlClass:"mathjax_ignore",processHtmlClass:"mathjax_process"},lr("STYLES",ar.INSERTED+1);class ro extends zn{constructor(t,e,s){const[i,r]=Ui(s,io.OPTIONS);super(t,e,i),this.domStrings=this.options.DomStrings||new io(r),this.domStrings.adaptor=e,this.styles=[]}findPosition(t,e,s,i){const r=this.adaptor,n=1/(i[t].length||1);let o=t;for(const[a,l]of i[t]){if(e<=l&&"#text"===r.kind(a))return{i:o,node:a,n:Math.max(e,0),delim:s};e-=l,o+=n}return{node:null,n:0,delim:s}}mathItem(t,e,s){const i=t.math,r=this.findPosition(t.n,t.start.n,t.open,s),n=this.findPosition(t.n,t.end.n,t.close,s);return new this.options.MathItem(i,e,t.display,r,n)}findMath(t){if(!this.processed.isSet("findMath")){this.adaptor.document=this.document,t=Fi({elements:this.options.elements||[this.adaptor.body(this.document)]},t);const e=this.adaptor.getElements(t.elements,this.document);for(const t of this.inputJax){const s=t.processStrings?this.findMathFromStrings(t,e):this.findMathFromDOM(t,e);this.math.merge(s)}this.processed.set("findMath")}return this}findMathFromStrings(t,e){const s=[],i=[];for(const t of e){const[e,r]=this.domStrings.find(t);s.push(...e),i.push(...r)}const r=new this.options.MathList;for(const e of t.findMath(s))r.push(this.mathItem(e,t,i));return r}findMathFromDOM(t,e){const s=[];for(const i of e)for(const e of t.findMath(i))s.push(new this.options.MathItem(e.math,t,e.display,e.start,e.end));return new this.options.MathList(...s)}updateDocument(){return this.processed.isSet("updateDocument")||(this.addPageElements(),this.addStyleSheet(),super.updateDocument(),this.processed.set("updateDocument")),this}addPageElements(){const t=this.adaptor,e=t.body(this.document),s=this.documentPageElements();if(s){const i=t.firstChild(e);i?t.insert(s,i):t.append(e,s)}}addStyleSheet(){const t=this.documentStyleSheet(),e=this.adaptor;if(t&&!e.parent(t)){const s=e.head(this.document),i=this.findSheet(s,e.getAttribute(t,"id"));i?e.replace(t,i):e.append(s,t)}}findSheet(t,e){if(e)for(const s of this.adaptor.tags(t,"style"))if(this.adaptor.getAttribute(s,"id")===e)return s;return null}removeFromDocument(t=!1){if(this.processed.isSet("updateDocument"))for(const e of this.math)e.state()>=ar.INSERTED&&e.state(ar.TYPESET,t);return this.processed.clear("updateDocument"),this}documentStyleSheet(){return this.outputJax.styleSheet(this)}documentPageElements(){return this.outputJax.pageElements(this)}addStyles(t){this.styles.push(t),"insertStyles"in this.outputJax&&this.outputJax.insertStyles(t)}getStyles(){return this.styles}}ro.KIND="HTML",ro.OPTIONS=Object.assign(Object.assign({},zn.OPTIONS),{renderActions:wi(Object.assign(Object.assign({},zn.OPTIONS.renderActions),{styles:[ar.STYLES,"","updateStyleSheet",!1]})),MathList:so,MathItem:eo,DomStrings:null});class no extends Vn{constructor(){super(...arguments),this.documentClass=ro}handlesDocument(t){const e=this.adaptor;if("string"==typeof t)try{t=e.parse(t,"text/html")}catch(t){}return t instanceof e.window.Document||t instanceof e.window.HTMLElement||t instanceof e.window.DocumentFragment}create(t,e){const s=this.adaptor;if("string"==typeof t)t=s.parse(t,"text/html");else if(t instanceof s.window.HTMLElement||t instanceof s.window.DocumentFragment){const e=t;t=s.parse("","text/html"),s.append(s.body(t),e)}return super.create(t,e)}}function oo(t){const e=new no(t);return to.handlers.register(e),e}class ao{get cssText(){return this.getStyleString()}constructor(t=null){this.styles={},this.addStyles(t)}addStyles(t){if(t)for(const e of Object.keys(t))this.styles[e]||(this.styles[e]={}),Object.assign(this.styles[e],t[e])}removeStyles(...t){for(const e of t)delete this.styles[e]}clear(){this.styles={}}getStyleString(){return this.getStyleRules().join("\n\n")}getStyleRules(t=this.styles,e=""){const s=Object.keys(t),i=new Array(s.length);let r=0;for(const n of s){const s=t[n];i[r++]=`${e}${n} {\n${this.getStyleDefString(s,e)}\n${e}}`}return i}getStyleDefString(t,e){const s=Object.keys(t),i=new Array(s.length);let r=0;for(const n of s)i[r++]=t[n]instanceof Object?e+this.getStyleRules({[n]:t[n]},e+"  ").join("\n"+e):"  "+e+n+": "+t[n]+";";return i.join("\n"+e)}}var lo;const co=!!(null===(lo=pi.window)||void 0===lo?void 0:lo.HTMLDialogElement);class ho{constructor(t){this.minW=200,this.minH=80,this.tx=0,this.ty=0,this.dragging=!1,this.events=[["mousemove",this.MouseMove.bind(this)],["mouseup",this.MouseUp.bind(this)]],this.mode="",this.actions={down:{move:t=>{t.dialog.classList.add("mjx-moving")}},move:{move:(t,e)=>[e.x-t.x,e.y-t.y,0,0],top:(t,e)=>[0,(e.y-t.y)/2,0,t.y-e.y],bottom:(t,e)=>[0,(e.y-t.y)/2,0,e.y-t.y],left:(t,e)=>[(e.x-t.x)/2,0,t.x-e.x,0],right:(t,e)=>[(e.x-t.x)/2,0,e.x-t.x,0],topleft:(t,e)=>[(e.x-t.x)/2,(e.y-t.y)/2,t.x-e.x,t.y-e.y],topright:(t,e)=>[(e.x-t.x)/2,(e.y-t.y)/2,e.x-t.x,t.y-e.y],botleft:(t,e)=>[(e.x-t.x)/2,(e.y-t.y)/2,t.x-e.x,e.y-t.y],botright:(t,e)=>[(e.x-t.x)/2,(e.y-t.y)/2,e.x-t.x,e.y-t.y]},up:{move:t=>{t.dialog.classList.remove("mjx-moving")}},keymove:{left:()=>[-5,0,0,0],right:()=>[5,0,0,0],up:()=>[0,-5,0,0],down:()=>[0,5,0,0]},bigmove:{left:()=>[-20,0,0,0],right:()=>[20,0,0,0],up:()=>[0,-20,0,0],down:()=>[0,20,0,0]},keysize:{left:()=>[-3,0,-6,0],right:()=>[3,0,6,0],up:()=>[0,-3,0,-6],down:()=>[0,3,0,6]},bigsize:{left:()=>[-10,0,-20,0],right:()=>[10,0,20,0],up:()=>[0,-10,0,-20],down:()=>[0,10,0,20]}};const{adaptor:e,node:s=null}=t;this.init(e),this.node=s,this.background=co?null:e.node("mjx-dialog-background"),this.x=this.y=0,this.dragging=!1,this.action="",this.dialog=this.html(t),this.title=this.dialog.firstChild.firstChild.firstChild,this.content=this.dialog.firstChild.firstChild.nextSibling;const i=this.dialog.lastChild;i.addEventListener("click",this.closeDialog.bind(this)),i.addEventListener("keydown",this.actionKey.bind(this,this.closeDialog.bind(this)));const r=this.dialog.lastChild.previousSibling;r.addEventListener("click",this.helpDialog.bind(this,e)),r.addEventListener("keydown",this.actionKey.bind(this,this.helpDialog.bind(this,e))),this.noDrag=Array.from(this.dialog.querySelectorAll('[data-drag="none"]'))}init(t){const e=this.constructor;if(!t.document.head.querySelector("#"+e.styleId)){const s=t.node("style",{id:e.styleId});s.textContent=new ao(e.styles).cssText,t.document.head.append(s)}}html(t){const{title:e,message:s,adaptor:i,styles:r=null,extraNodes:n=[],className:o=ho.className}=t;if(r){const t=i.node("style");t.textContent=new ao(r).cssText,n.unshift(t)}const a="mjx-dialog-label-"+ho.id++,l=i.node("dialog",{closedby:"any",class:("mjx-dialog "+o).trim()},[i.node("mjx-dialog",{"aria-labeledby":a},[i.node("mjx-title",{},[i.node("h1",{id:a,tabIndex:0})]),i.node("div",{"data-drag":"none",tabIndex:0})]),...n,i.node("mjx-dialog-spacer",{"aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"top","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"bottom","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"left","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"right","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"topleft","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"topright","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"botleft","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"botright","aria-hidden":!0}),i.node("mjx-dialog-help",{class:"mjx-dialog-button","data-drag":"none",tabIndex:0,role:"button","aria-label":"Dialog Help"},[i.node("mjx-dialog-icon",{"aria-hidden":!0},[i.text("?")])]),i.node("mjx-dialog-close",{class:"mjx-dialog-button","data-drag":"none",tabIndex:0,role:"button","aria-label":"Close Dialog Box"},[i.node("mjx-dialog-icon",{"aria-hidden":!0},[i.text("\xd7")])])]);return l.firstChild.firstChild.firstChild.innerHTML=e,l.firstChild.childNodes[1].innerHTML=s,l}attach(){co?(this.dialog.addEventListener("mousedown",this.MouseDown.bind(this)),this.dialog.addEventListener("keydown",this.KeyDown.bind(this),!0),document.body.append(this.dialog),this.dialog.showModal()):(this.background.addEventListener("mousedown",this.MouseDown.bind(this)),this.background.addEventListener("keydown",this.KeyDown.bind(this),!0),this.dialog.setAttribute("tabindex","0"),this.dialog.addEventListener("click",this.stop),this.background.append(this.dialog),document.body.append(this.background)),pi.window.addEventListener("visibilitychange",this.Visibility.bind(this)),this.minW=Math.min(this.minW,this.dialog.clientWidth-8),this.minH=Math.min(this.minH,this.dialog.clientHeight-this.title.offsetHeight-8),this.title.focus()}dragAction(t,e=null){e&&this.stop(e);const s=this.actions[t][this.action],i=s?s(this,e):null;if(!i)return;let[r,n,o,a]=i;if(o){const t=this.w+o;t>=this.minW?(this.x=null==e?void 0:e.x,this.w=t,this.dialog.style.maxWidth=this.dialog.style.width=t+"px"):r=0}if(a){const t=this.h+a;t>=this.minH+this.title.offsetHeight?(this.y=null==e?void 0:e.y,this.h=t,this.dialog.style.maxHeight=this.dialog.style.height=t+"px"):n=0}(r||n)&&(r&&(this.x=null==e?void 0:e.x,this.tx+=r||0),n&&(this.y=null==e?void 0:e.y,this.ty+=n||0),this.dialog.style.transform=`translate(${this.tx}px, ${this.ty}px)`)}MouseDown(t){const e=t.target;if(!(1!==t.buttons||t.shiftKey||t.metaKey||t.altKey||t.ctrlKey))if(this.inDialog(t)){for(const t of this.noDrag)if(e===t||t.contains(e))return;this.action=e.getAttribute("data-drag")||"move",this.startDrag(t),this.dragAction("down",t)}else this.closeDialog(t)}MouseMove(t){1!==t.buttons&&this.endDrag(),this.dragging&&this.dragAction("move",t)}MouseUp(t){this.dragging&&(this.dragAction("up",t),this.endDrag())}Visibility(){pi.document.hidden&&this.closeDialog()}KeyDown(t){const e=this.constructor.keyActions.get(t.key);e&&e(this,t)}escKey(t){this.closeDialog(t)}aKey(t){(t.ctrlKey||t.metaKey)&&(this.selectAll(),this.stop(t))}mKey(t){this.mode="move"===this.mode?"":"move",this.stop(t)}sKey(t){this.mode="size"===this.mode?"":"size",this.stop(t)}arrowKey(t,e){t.ctrlKey||this.dragging||(this.action=e,this.getWH(),t.altKey||"move"===this.mode?(this.dragAction(t.shiftKey?"bigmove":"keymove"),this.stop(t)):(t.metaKey||"size"===this.mode)&&(this.dragAction(t.shiftKey?"bigsize":"keysize"),this.stop(t)),this.action="")}actionKey(t,e){"Enter"!==e.code&&"Space"!==e.code||t(e)}selectAll(){document.getSelection().selectAllChildren(this.content)}copyToClipboard(){this.selectAll();try{document.execCommand("copy")}catch(t){alert(`Can't copy to clipboard: ${t.message}`)}document.getSelection().removeAllRanges()}startDrag(t){this.x=t.x,this.y=t.y,this.getWH(),this.dragging=!0;const e=this.background||this.dialog;for(const[t,s]of this.events)e.addEventListener(t,s)}getWH(){this.w=this.dialog.clientWidth-8,this.h=this.dialog.clientHeight-8}endDrag(){this.action="",this.dragging=!1;const t=this.background||this.dialog;for(const[e,s]of this.events)t.removeEventListener(e,s)}closeDialog(t){var e;co?(this.dialog.close(),this.dialog.remove()):this.background.remove(),null===(e=this.node)||void 0===e||e.focus(),t&&this.stop(t)}helpDialog(t,e){new ho({title:"MathJax Dialog Help",message:this.constructor.helpMessage,adaptor:t,className:"mjx-dialog-help",styles:{".mjx-dialog-help":{"max-width":"calc(min(50em, 80%))"}}}).attach(),this.stop(e)}inDialog(t){if(!this.dialog.contains(t.target))return!1;const{x:e,y:s}=t,{left:i,right:r,top:n,bottom:o}=this.dialog.getBoundingClientRect();return e>=i&&e<=r&&s>=n&&s<=o}stop(t){t.preventDefault&&t.preventDefault(),t.stopImmediatePropagation?t.stopImmediatePropagation():t.stopPropagation&&t.stopPropagation()}}ho.keyActions=new Map([["Escape",(t,e)=>t.escKey(e)],["a",(t,e)=>t.aKey(e)],["m",(t,e)=>t.mKey(e)],["s",(t,e)=>t.sKey(e)],["ArrowRight",(t,e)=>t.arrowKey(e,"right")],["ArrowLeft",(t,e)=>t.arrowKey(e,"left")],["ArrowUp",(t,e)=>t.arrowKey(e,"up")],["ArrowDown",(t,e)=>t.arrowKey(e,"down")]]),ho.styleId="MJX-DIALOG-styles",ho.className="",ho.id=0,ho.styles={"mjx-dialog-background":{display:"flex","flex-direction":"column","justify-content":"center",position:"fixed",top:0,left:0,right:0,bottom:0,"z-index":1001},".mjx-dialog":{"max-width":"calc(min(60em, 90%))","max-height":"calc(min(50em, 85%))",border:"3px outset","border-radius":"15px",color:"black","background-color":"#DDDDDD","box-shadow":"0px 10px 20px #808080",padding:"4px 4px",cursor:"grab",overflow:"visible",display:"flex","flex-direction":"column","align-items":"center",position:"fixed",top:"-4%"},".mjx-dialog.mjx-moving":{cursor:"grabbing"},'.mjx-dialog > input[type="button"]':{width:"fit-content"},".mjx-dialog > mjx-dialog-spacer":{display:"block",height:".75em","flex-shrink":0},".mjx-dialog::backdrop":{opacity:0,cursor:"default"},"mjx-dialog":{all:"initial",cursor:"inherit",width:"100%",display:"flex","flex-direction":"column","flex-grow":1,"flex-shrink":1,overflow:"hidden"},"mjx-dialog > mjx-title":{display:"block","text-align":"center",margin:".25em 1.75em",overflow:"hidden","white-space":"nowrap","-webkit-user-select":"none","user-select":"none","flex-shrink":0},"mjx-dialog > mjx-title > h1":{"font-size":"125%",margin:0},"mjx-dialog > div":{margin:"0 1em .5em",padding:"8px 18px",overflow:"auto",border:"2px inset black","background-color":"white","text-align":"left",cursor:"default","flex-grow":1,"flex-shrink":1},"mjx-dialog > div > pre":{margin:0},".mjx-dialog-button":{position:"absolute",top:"6px",height:"17px",width:"17px",cursor:"default",display:"block",border:"2px solid #AAA","border-radius":"18px","font-family":'"Courier New", Courier',"text-align":"center",color:"#F0F0F0","-webkit-user-select":"none","user-select":"none"},".mjx-dialog-button:hover":{color:"white !important",border:"2px solid #CCC !important"},".mjx-dialog-button > mjx-dialog-icon":{display:"block","background-color":"#AAA",border:"1.5px solid","border-radius":"18px","line-height":0,padding:"8px 0 6px"},".mjx-dialog-button > mjx-dialog-icon:hover":{"background-color":"#CCC !important"},"mjx-dialog-close":{right:"6px","font-size":"20px;"},"mjx-dialog-help":{left:"6px","font-size":"14px;","font-weight":"bold"},".mjx-dialog-help mjx-dialog-help":{display:"none"},"mjx-dialog kbd":{display:"inline-block",padding:"3px 5px","font-size":"11px","line-height":"10px",color:"#444d56","vertical-align":"middle","background-color":"#fafbfc",border:"solid 1.5px #c6cbd1","border-bottom-color":"#959da5","border-radius":"3px","box-shadow":"inset -.5px -1px 0 #959da5"},'mjx-dialog-drag[data-drag="top"]':{height:"5px",position:"absolute",top:"-3px",left:"10px",right:"10px",cursor:"ns-resize"},'mjx-dialog-drag[data-drag="bottom"]':{height:"5px",position:"absolute",bottom:"-3px",left:"10px",right:"10px",cursor:"ns-resize"},'mjx-dialog-drag[data-drag="left"]':{width:"5px",position:"absolute",left:"-3px",top:"10px",bottom:"10px",cursor:"ew-resize"},'mjx-dialog-drag[data-drag="right"]':{width:"5px",position:"absolute",right:"-3px",top:"10px",bottom:"10px",cursor:"ew-resize"},'mjx-dialog-drag[data-drag="topleft"]':{width:"13px",height:"13px",position:"absolute",left:"-3px",top:"-3px",cursor:"nwse-resize"},'mjx-dialog-drag[data-drag="topright"]':{width:"13px",height:"13px",position:"absolute",right:"-3px",top:"-3px",cursor:"nesw-resize"},'mjx-dialog-drag[data-drag="botleft"]':{width:"13px",height:"13px",position:"absolute",left:"-3px",bottom:"-3px",cursor:"nesw-resize"},'mjx-dialog-drag[data-drag="botright"]':{width:"13px",height:"13px",position:"absolute",right:"-3px",bottom:"-3px",cursor:"nwse-resize"},"@media (prefers-color-scheme: dark)":{".mjx-dialog":{"background-color":"#303030","box-shadow":"0px 10px 20px #000",border:"3px outset #7C7C7C"},"mjx-dialog":{color:"#E0E0E0"},"mjx-dialog > div":{border:"2px inset #7C7C7C","background-color":"#222025"},".mjx-dialog a[href]":{color:"#86A7F5"},".mjx-dialog a[href]:visited":{color:"#DD98E2"},"mjx-dialog kbd":{color:"#F8F8F8","background-color":"#545454",border:"solid 1.5px #7A7C7E","border-bottom-color":"#707070","box-shadow":"inset -.5px -1px 0 #818589"},".mjx-dialog-button":{border:"2px solid #686868",color:"#A4A4A4"},".mjx-dialog-button:hover":{color:"#CBCBCB !important",border:"2px solid #888888 !important"},".mjx-dialog-button > mjx-dialog-icon":{"background-color":"#646464"},".mjx-dialog-button > mjx-dialog-icon:hover":{"background-color":"#888888 !important"}}},ho.helpMessage='\n    

The dialog boxes in MathJax are movable and sizeable.

\n\n

For mouse users, dragging any of the edges will enlarge or shrink\n the dialog box by moving that side. Dragging any of the corners\n changes the two sides that meet at that corner. Dragging elsewhere on\n the dialog frame will move the dialog without changing its size.

\n\n

For keyboard users, there are two ways to adjust the position\n and size of the dialog box. The first is to hold the\n Alt or Option key and press any of the arrow\n keys to move the dialog box in the given direction. Hold the\n Win or Command key and press any of the\n arrow keys to enlarge or shrink the dialog box. Left and right\n move the right-hand edge of the dialog, while up and down move the\n bottom edge of the dialog.\n

\n\n

For some users, holding two keys down at once may be difficult,\n so the second way is to press the m to start "move"\n mode, then use the arrow keys to move the dialog box in the given\n direction. Press m again to stop moving the dialog.\n Similarly, press s to start and stop "sizing" mode,\n where the arrows will change the size of the dialog box.

\n\n

Holding a shift key along with the arrow key will\n make larger changes in the size or position, for either method\n described above.

\n\n

Use Tab to move among the text, buttons, and links\n within the dialog. The Enter or Space key\n activates the focused item. The Escape key closes the\n dialog, as does clicking outside the dialog box, or clicking the\n "\xd7" icon in the upper right-hand corner of the dialog.

\n ';class uo extends ho{static post(t){const e=new this(t);return e.attach(),e}}function po(t){return to.asyncLoad?new Promise((e,s)=>{const i=to.asyncLoad(t);i instanceof Promise?i.then(t=>e(t)).catch(t=>s(t)):e(i)}):Promise.reject(`Can't load '${t}': No mathjax.asyncLoad method specified`)}const mo=1e6,fo={px:1,in:96,cm:96/2.54,mm:96/25.4},go={em:1,ex:.431,pt:.1,pc:1.2,mu:1/18},bo={veryverythinmathspace:1/18,verythinmathspace:2/18,thinmathspace:3/18,mediummathspace:4/18,thickmathspace:5/18,verythickmathspace:6/18,veryverythickmathspace:7/18,negativeveryverythinmathspace:-1/18,negativeverythinmathspace:-2/18,negativethinmathspace:-3/18,negativemediummathspace:-4/18,negativethickmathspace:-5/18,negativeverythickmathspace:-6/18,negativeveryverythickmathspace:-7/18,thin:.04,medium:.06,thick:.1,normal:1,big:2,small:1/Math.sqrt(2),infinity:mo};function Eo(t,e=0,s=1,i=16){if("string"!=typeof t&&(t=String(t)),""===t||null==t)return e;if(bo[t])return bo[t];const r=t.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);if(!r||""===r[0])return e;const n=parseFloat(r[1]||"1"),o=r[2];return Object.hasOwn(fo,o)?n*fo[o]/i/s:Object.hasOwn(go,o)?n*go[o]:"%"===o?n/100*e:n*e}function xo(t){return(100*t).toFixed(1).replace(/\.?0+$/,"")+"%"}function yo(t){return Math.abs(t)<.001?"0":t.toFixed(3).replace(/\.?0+$/,"")+"em"}function No(t,e=-mo,s=16){return t*=s,e&&tthis.w&&(this.w=r),n>this.h&&(this.h=n),o>this.d&&(this.d=o)}append(t){const 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)}updateFrom(t){this.h=t.h,this.d=t.d,this.w=t.w,t.pwidth&&(this.pwidth=t.pwidth)}copy(){const t=new vo;return Object.assign(t,this),t}}vo.fullWidth="100%",vo.boxSides=[["Top",0,"h"],["Right",1,"w"],["Bottom",2,"d"],["Left",3,"w"]];const To={loadMissingEntities:!0},Co={ApplyFunction:"\u2061",Backslash:"\u2216",Because:"\u2235",Breve:"\u02d8",Cap:"\u22d2",CenterDot:"\xb7",CircleDot:"\u2299",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",Congruent:"\u2261",ContourIntegral:"\u222e",Coproduct:"\u2210",Cross:"\u2a2f",Cup:"\u22d3",CupCap:"\u224d",Dagger:"\u2021",Del:"\u2207",Delta:"\u0394",Diamond:"\u22c4",DifferentialD:"\u2146",DotEqual:"\u2250",DoubleDot:"\xa8",DoubleRightTee:"\u22a8",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",DownLeftVector:"\u21bd",DownRightVector:"\u21c1",DownTee:"\u22a4",Downarrow:"\u21d3",Element:"\u2208",EqualTilde:"\u2242",Equilibrium:"\u21cc",Exists:"\u2203",ExponentialE:"\u2147",FilledVerySmallSquare:"\u25aa",ForAll:"\u2200",Gamma:"\u0393",Gg:"\u22d9",GreaterEqual:"\u2265",GreaterEqualLess:"\u22db",GreaterFullEqual:"\u2267",GreaterLess:"\u2277",GreaterSlantEqual:"\u2a7e",GreaterTilde:"\u2273",Hacek:"\u02c7",Hat:"^",HumpDownHump:"\u224e",HumpEqual:"\u224f",Im:"\u2111",ImaginaryI:"\u2148",Integral:"\u222b",Intersection:"\u22c2",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",Lambda:"\u039b",Larr:"\u219e",LeftAngleBracket:"\u27e8",LeftArrow:"\u2190",LeftArrowRightArrow:"\u21c6",LeftCeiling:"\u2308",LeftDownVector:"\u21c3",LeftFloor:"\u230a",LeftRightArrow:"\u2194",LeftTee:"\u22a3",LeftTriangle:"\u22b2",LeftTriangleEqual:"\u22b4",LeftUpVector:"\u21bf",LeftVector:"\u21bc",Leftarrow:"\u21d0",Leftrightarrow:"\u21d4",LessEqualGreater:"\u22da",LessFullEqual:"\u2266",LessGreater:"\u2276",LessSlantEqual:"\u2a7d",LessTilde:"\u2272",Ll:"\u22d8",Lleftarrow:"\u21da",LongLeftArrow:"\u27f5",LongLeftRightArrow:"\u27f7",LongRightArrow:"\u27f6",Longleftarrow:"\u27f8",Longleftrightarrow:"\u27fa",Longrightarrow:"\u27f9",Lsh:"\u21b0",MinusPlus:"\u2213",NestedGreaterGreater:"\u226b",NestedLessLess:"\u226a",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotExists:"\u2204",NotGreater:"\u226f",NotGreaterEqual:"\u2271",NotLeftTriangle:"\u22ea",NotLeftTriangleEqual:"\u22ec",NotLess:"\u226e",NotLessEqual:"\u2270",NotPrecedes:"\u2280",NotPrecedesSlantEqual:"\u22e0",NotRightTriangle:"\u22eb",NotRightTriangleEqual:"\u22ed",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsSlantEqual:"\u22e1",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotVerticalBar:"\u2224",Omega:"\u03a9",OverBar:"\u203e",OverBrace:"\u23de",PartialD:"\u2202",Phi:"\u03a6",Pi:"\u03a0",PlusMinus:"\xb1",Precedes:"\u227a",PrecedesEqual:"\u2aaf",PrecedesSlantEqual:"\u227c",PrecedesTilde:"\u227e",Product:"\u220f",Proportional:"\u221d",Psi:"\u03a8",Rarr:"\u21a0",Re:"\u211c",ReverseEquilibrium:"\u21cb",RightAngleBracket:"\u27e9",RightArrow:"\u2192",RightArrowLeftArrow:"\u21c4",RightCeiling:"\u2309",RightDownVector:"\u21c2",RightFloor:"\u230b",RightTee:"\u22a2",RightTeeArrow:"\u21a6",RightTriangle:"\u22b3",RightTriangleEqual:"\u22b5",RightUpVector:"\u21be",RightVector:"\u21c0",Rightarrow:"\u21d2",Rrightarrow:"\u21db",Rsh:"\u21b1",Sigma:"\u03a3",SmallCircle:"\u2218",Sqrt:"\u221a",Square:"\u25a1",SquareIntersection:"\u2293",SquareSubset:"\u228f",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",Star:"\u22c6",Subset:"\u22d0",SubsetEqual:"\u2286",Succeeds:"\u227b",SucceedsEqual:"\u2ab0",SucceedsSlantEqual:"\u227d",SucceedsTilde:"\u227f",SuchThat:"\u220b",Sum:"\u2211",Superset:"\u2283",SupersetEqual:"\u2287",Supset:"\u22d1",Therefore:"\u2234",Theta:"\u0398",Tilde:"\u223c",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",UnderBar:"_",UnderBrace:"\u23df",Union:"\u22c3",UnionPlus:"\u228e",UpArrow:"\u2191",UpDownArrow:"\u2195",UpTee:"\u22a5",Uparrow:"\u21d1",Updownarrow:"\u21d5",Upsilon:"\u03a5",Vdash:"\u22a9",Vee:"\u22c1",VerticalBar:"\u2223",VerticalTilde:"\u2240",Vvdash:"\u22aa",Wedge:"\u22c0",Xi:"\u039e",amp:"&",acute:"\xb4",aleph:"\u2135",alpha:"\u03b1",amalg:"\u2a3f",and:"\u2227",ang:"\u2220",angmsd:"\u2221",angsph:"\u2222",ape:"\u224a",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",beta:"\u03b2",beth:"\u2136",between:"\u226c",bigcirc:"\u25ef",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",blacklozenge:"\u29eb",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",bowtie:"\u22c8",boxdl:"\u2510",boxdr:"\u250c",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxul:"\u2518",boxur:"\u2514",bsol:"\\",bull:"\u2022",cap:"\u2229",check:"\u2713",chi:"\u03c7",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledR:"\xae",circledS:"\u24c8",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",clubs:"\u2663",colon:":",comp:"\u2201",ctdot:"\u22ef",cuepr:"\u22de",cuesc:"\u22df",cularr:"\u21b6",cup:"\u222a",curarr:"\u21b7",curlyvee:"\u22ce",curlywedge:"\u22cf",dagger:"\u2020",daleth:"\u2138",ddarr:"\u21ca",deg:"\xb0",delta:"\u03b4",digamma:"\u03dd",div:"\xf7",divideontimes:"\u22c7",dot:"\u02d9",doteqdot:"\u2251",dotplus:"\u2214",dotsquare:"\u22a1",dtdot:"\u22f1",ecir:"\u2256",efDot:"\u2252",egs:"\u2a96",ell:"\u2113",els:"\u2a95",empty:"\u2205",epsi:"\u03b5",epsiv:"\u03f5",erDot:"\u2253",eta:"\u03b7",eth:"\xf0",flat:"\u266d",fork:"\u22d4",frown:"\u2322",gEl:"\u2a8c",gamma:"\u03b3",gap:"\u2a86",gimel:"\u2137",gnE:"\u2269",gnap:"\u2a8a",gne:"\u2a88",gnsim:"\u22e7",gt:">",gtdot:"\u22d7",harrw:"\u21ad",hbar:"\u210f",hellip:"\u2026",hookleftarrow:"\u21a9",hookrightarrow:"\u21aa",imath:"\u0131",infin:"\u221e",intcal:"\u22ba",iota:"\u03b9",jmath:"\u0237",kappa:"\u03ba",kappav:"\u03f0",lEg:"\u2a8b",lambda:"\u03bb",lap:"\u2a85",larrlp:"\u21ab",larrtl:"\u21a2",lbrace:"{",lbrack:"[",le:"\u2264",leftleftarrows:"\u21c7",leftthreetimes:"\u22cb",lessdot:"\u22d6",lmoust:"\u23b0",lnE:"\u2268",lnap:"\u2a89",lne:"\u2a87",lnsim:"\u22e6",longmapsto:"\u27fc",looparrowright:"\u21ac",lowast:"\u2217",loz:"\u25ca",lt:"<",ltimes:"\u22c9",ltri:"\u25c3",macr:"\xaf",malt:"\u2720",mho:"\u2127",mu:"\u03bc",multimap:"\u22b8",nLeftarrow:"\u21cd",nLeftrightarrow:"\u21ce",nRightarrow:"\u21cf",nVDash:"\u22af",nVdash:"\u22ae",natur:"\u266e",nearr:"\u2197",nharr:"\u21ae",nlarr:"\u219a",not:"\xac",nrarr:"\u219b",nu:"\u03bd",nvDash:"\u22ad",nvdash:"\u22ac",nwarr:"\u2196",omega:"\u03c9",omicron:"\u03bf",or:"\u2228",osol:"\u2298",period:".",phi:"\u03c6",phiv:"\u03d5",pi:"\u03c0",piv:"\u03d6",prap:"\u2ab7",precnapprox:"\u2ab9",precneqq:"\u2ab5",precnsim:"\u22e8",prime:"\u2032",psi:"\u03c8",quot:'"',rarrtl:"\u21a3",rbrace:"}",rbrack:"]",rho:"\u03c1",rhov:"\u03f1",rightrightarrows:"\u21c9",rightthreetimes:"\u22cc",ring:"\u02da",rmoust:"\u23b1",rtimes:"\u22ca",rtri:"\u25b9",scap:"\u2ab8",scnE:"\u2ab6",scnap:"\u2aba",scnsim:"\u22e9",sdot:"\u22c5",searr:"\u2198",sect:"\xa7",sharp:"\u266f",sigma:"\u03c3",sigmav:"\u03c2",simne:"\u2246",smile:"\u2323",spades:"\u2660",sub:"\u2282",subE:"\u2ac5",subnE:"\u2acb",subne:"\u228a",supE:"\u2ac6",supnE:"\u2acc",supne:"\u228b",swarr:"\u2199",tau:"\u03c4",theta:"\u03b8",thetav:"\u03d1",tilde:"\u02dc",times:"\xd7",triangle:"\u25b5",triangleq:"\u225c",upsi:"\u03c5",upuparrows:"\u21c8",veebar:"\u22bb",vellip:"\u22ee",weierp:"\u2118",xi:"\u03be",yen:"\xa5",zeta:"\u03b6",zigrarr:"\u21dd",nbsp:"\xa0",rsquo:"\u2019",lsquo:"\u2018"},Ao={};function Lo(t,e){Object.assign(Co,t),Ao[e]=!0}function So(t){delete Co[t]}function Ro(t){return t.replace(/&([a-z][a-z0-9]*|#(?:[0-9]+|x[0-9a-f]+));/gi,Mo)}function Mo(t,e){if("#"===e.charAt(0))return Io(e.slice(1));if(Co[e])return Co[e];if(To.loadMissingEntities){const t=e.match(/^[a-zA-Z](fr|scr|opf)$/)?RegExp.$1:e.charAt(0).toLowerCase();Ao[t]||(Ao[t]=!0,Pn(po("./util/entities/"+t+".js")))}return t}function Io(t){const e="x"===t.charAt(0)?parseInt(t.slice(1),16):parseInt(t);return String.fromCodePoint(e)}const wo=["top","right","bottom","left"],ko=["width","style","color"];function Oo(t){const e=t.split(/((?:'[^'\n]*'|"[^"\n]*"|,[\s\n]|[^\s\n])*)/g),s=[];for(;e.length>1;)e.shift(),s.push(e.shift());return s}function Do(t){const e=Oo(this.styles[t]);0===e.length&&e.push(""),1===e.length&&e.push(e[0]),2===e.length&&e.push(e[0]),3===e.length&&e.push(e[1]);for(const s of qo.connect[t].children)this.setStyle(this.childName(t,s),e.shift())}function Po(t){const e=qo.connect[t].children,s=[];for(const i of e){const e=this.styles[this.childName(t,i)];if(!e)return void delete this.styles[t];s.push(e)}s[3]===s[1]&&(s.pop(),s[2]===s[0]&&(s.pop(),s[1]===s[0]&&s.pop())),this.styles[t]=s.join(" ")}function Bo(t){Po.call(this,t),this.combineChildren(t),Fo.call(this,t),this.combineParent(t)}function Fo(t){if(!qo.connect[t])return;const e=[...qo.connect[t].children],s=this.styles[this.childName(t,e.shift())];for(const i of e)if(this.styles[this.childName(t,i)]!==s)return void delete this.styles[t];s&&(this.styles[t]=s)}const jo=/^(?:[\d.]+(?:[a-z]+)|thin|medium|thick|inherit|initial|unset)$/,_o=/^(?:none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|unset)$/;function Uo(t){const e={width:"",style:"",color:""};for(const s of Oo(this.styles[t]))s.match(jo)&&""===e.width?e.width=s:s.match(_o)&&""===e.style?e.style=s:e.color=s;for(const s of qo.connect[t].children)this.setStyle(this.childName(t,s),e[s])}function Ho(t){const e=[];for(const s of qo.connect[t].children){const i=this.styles[this.childName(t,s)];i&&e.push(i)}e.length>1?this.styles[t]=e.join(" "):delete this.styles[t]}const Wo={style:/^(?:normal|italic|oblique|inherit|initial|unset)$/,variant:new RegExp("^(?:"+["normal|none","inherit|initial|unset","common-ligatures|no-common-ligatures","discretionary-ligatures|no-discretionary-ligatures","historical-ligatures|no-historical-ligatures","contextual|no-contextual","(?:stylistic|character-variant|swash|ornaments|annotation)\\([^)]*\\)","small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","lining-nums|oldstyle-nums|proportional-nums|tabular-nums","diagonal-fractions|stacked-fractions","ordinal|slashed-zero","jis78|jis83|jis90|jis04|simplified|traditional","full-width|proportional-width","ruby"].join("|")+")$"),weight:/^(?:normal|bold|bolder|lighter|[1-9]00|inherit|initial|unset)$/,stretch:new RegExp("^(?:"+["normal","(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)","inherit|initial|unset"].join("|")+")$"),size:new RegExp("^(?:"+["xx-small|x-small|small|medium|large|x-large|xx-large|larger|smaller","[\\d.]+%|[\\d.]+[a-z]+","inherit|initial|unset"].join("|")+")(?:/(?:normal|[\\d.]+(?:%|[a-z]+)?))?$")};function zo(t,e){for(const s of qo.connect[t].children){const i=this.childName(t,s);if(Array.isArray(e[s])){const t=e[s];t.length&&(this.styles[i]=t.join(" "))}else""!==e[s]&&(this.styles[i]=e[s])}}class qo{constructor(t=""){this.parse(t)}sanitizeValue(t){const e=this.constructor.pattern;if(!t.match(e.sanitize))return t;const s=(t=t.replace(e.value,"$1")).replace(/\\./g,"").replace(/(['"]).*?\1/g,"").replace(/[^'"]/g,"");return s.length&&(t+=s.charAt(0)),t}get cssText(){var t,e;const s=[];for(const i of Object.keys(this.styles)){const r=this.parentName(i),n=i.replace(/.*-/,""),o=this.childName(this.parentName(r),n);!this.styles[i]||this.styles[o]||this.styles[r]&&(null===(e=null===(t=qo.connect[r])||void 0===t?void 0:t.children)||void 0===e?void 0:e.includes(n))||s.push(`${i}: ${this.styles[i]};`)}return s.join(" ")}get styleList(){return Object.assign({},this.styles)}set(t,e){t=this.normalizeName(t),this.setStyle(t,String(e));const s=qo.connect[t];if(null==s?void 0:s.subPart)s.combine.call(this,t);else if(this.combineParent(t),t.match(/-.*-/)){const e=t.replace(/-.*-/,"-");Fo.call(this,e)}}combineParent(t){for(var e;t.match(/-/);){const s=t;t=this.parentName(t);const i=qo.connect[t];if(!qo.connect[s]&&!(null===(e=null==i?void 0:i.children)||void 0===e?void 0:e.includes(s.substring(t.length+1))))break;i.combine.call(this,t)}if(!this.styles[t])return;const s=qo.connect[t];for(const e of(null==s?void 0:s.parts)||[])delete this.styles[this.childName(t,e)]}get(t){return t=this.normalizeName(t),Object.hasOwn(this.styles,t)?this.styles[t]:""}setStyle(t,e){var s;this.styles[t]=this.sanitizeValue(e),(null===(s=qo.connect[t])||void 0===s?void 0:s.children)&&qo.connect[t].split.call(this,t),""===e&&delete this.styles[t]}combineChildren(t){const e=this.parentName(t);for(const s of qo.connect[t].children){const t=this.childName(e,s);qo.connect[t].combine.call(this,t)}}parentName(t){const e=t.replace(/-[^-]*$/,"");return t===e?"":e}childName(t,e){var s;return e.match(/-/)?e:((null===(s=qo.connect[t])||void 0===s?void 0:s.subPart)&&(e+=t.replace(/.*-/,"-"),t=this.parentName(t)),t+"-"+e)}normalizeName(t){return t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}parse(t=""){const e=this.constructor.pattern;this.styles={};const s=t.replace(/\n/g," ").replace(e.comment,"").split(e.style);for(;s.length>1;){const[t,e,i]=s.splice(0,3);if(t.match(/[^\s\n;]/))return;this.set(e,i)}}}function Vo(t){return t.reduce((t,e)=>t+e,0)}function Xo(t){return t.reduce((t,e)=>Math.max(t,e),0)}if(qo.pattern={sanitize:/['";]/,value:/^((:?'(?:\\.|[^'])*(?:'|$)|"(?:\\.|[^"])*(?:"|$)|\n|\\.|[^'";])*?)[\s\n]*(?:;|$).*/,style:/([-a-z]+)[\s\n]*:[\s\n]*((?:'(?:\\.|[^'])*(?:'|$)|"(?:\\.|[^"])*(?:"|$)|\n|\\.|[^'";])*?)[\s\n]*(?:;|$)/g,comment:/\/\*[^]*?\*\//g},qo.connect={padding:{children:wo,split:Do,combine:Po},margin:{children:wo,split:Do,combine:Po},border:{children:wo,parts:ko,split:function(t){for(const e of qo.connect[t].children)this.setStyle(this.childName(t,e),this.styles[t])},combine:Fo},"border-top":{children:ko,split:Uo,combine:Ho},"border-right":{children:ko,split:Uo,combine:Ho},"border-bottom":{children:ko,split:Uo,combine:Ho},"border-left":{children:ko,split:Uo,combine:Ho},"border-width":{children:wo,split:Do,combine:Bo,subPart:!0},"border-style":{children:wo,split:Do,combine:Bo,subPart:!0},"border-color":{children:wo,split:Do,combine:Bo,subPart:!0},font:{children:["style","variant","weight","stretch","line-height","size","family"],split:function(t){const e=Oo(this.styles[t]),s={style:"",variant:[],weight:"",stretch:"",size:"",family:"","line-height":""};for(const t of e){s.family||(s.family=t);for(const e of Object.keys(Wo))if((Array.isArray(s[e])||""===s[e])&&t.match(Wo[e]))if(s.family===t&&(s.family=""),"size"===e){const[i,r]=t.split(/\//);s[e]=i,r&&(s["line-height"]=r)}else""===s.size&&(Array.isArray(s[e])?s[e].push(t):""===s[e]&&(s[e]=t))}zo.call(this,t,s),delete this.styles[t]},combine:function(t){}}},MathJax.loader&&MathJax.loader.checkVersion("core",ri,"core"),hi({_:{adaptors:{HTMLAdaptor:h,browserAdaptor:d},components:{global:t},core:{DOMAdaptor:c,FindMath:u,Handler:at,HandlerList:lt,InputJax:p,MathDocument:ot,MathItem:b,MathList:g,MmlTree:{Attributes:y,MML:st,MathMLVisitor:dt,MmlFactory:it,MmlNode:v,MmlNodes:{HtmlNode:et,TeXAtom:Z,maction:W,maligngroup:K,malignmark:$,math:T,mathchoice:tt,menclose:H,merror:F,mfenced:U,mfrac:O,mglyph:Y,mi:C,mmultiscripts:V,mn:A,mo:R,mpadded:j,mphantom:_,mroot:P,mrow:k,ms:w,mspace:I,msqrt:D,mstyle:B,msubsup:z,mtable:X,mtd:J,mtext:M,mtr:G,munderover:q,semantics:Q},MmlVisitor:ht,OperatorDictionary:L,SerializedMmlVisitor:ut},OutputJax:m,Tree:{Factory:E,Node:N,NodeFactory:x,Visitor:ct,Wrapper:pt,WrapperFactory:mt}},handlers:{html_ts:Nt,html:{HTMLDocument:xt,HTMLDomStrings:Et,HTMLHandler:yt,HTMLMathItem:gt,HTMLMathList:bt}},mathjax:ft,ui:{dialog:{DraggableDialog:Tt,InfoDialog:Ct}},util:{AsyncLoad:At,BBox:St,BitField:rt,Entities:Rt,FunctionList:n,LinkedList:f,Options:a,PrioritizedList:i,Retries:nt,StyleJson:vt,Styles:Mt,context:e,lengths:Lt,numeric:It,string:S}}}),MathJax.startup&&(MathJax.startup.registerConstructor("HTMLHandler",no),MathJax.startup.registerConstructor("browserAdaptor",Yi),MathJax.startup.useHandler("HTMLHandler"),MathJax.startup.useAdaptor("browserAdaptor")),MathJax.loader){const t=MathJax.config.loader;MathJax._.mathjax.mathjax.asyncLoad=e=>"node:"===e.substring(0,5)?t.require(e):MathJax.loader.load(e).then(t=>t[0])}class Go extends Qi{constructor(t){super(t),this.getPatterns()}getPatterns(){const t=this.options,e=[],s=[],i=[];this.end={},this.env=this.sub=0;let r=1;t.inlineMath.forEach(t=>this.addPattern(e,t,!1)),t.displayMath.forEach(t=>this.addPattern(e,t,!0)),e.length&&s.push(e.sort(Fr).join("|")),t.processEnvironments&&(s.push("\\\\begin\\s*\\{([^}]*)\\}"),this.env=r,r++),t.processEscapes&&i.push("\\\\([\\\\$])"),t.processRefs&&i.push("(\\\\(?:eq)?ref\\s*\\{[^}]*\\})"),i.length&&(s.push("("+i.join("|")+")"),this.sub=r),this.start=new RegExp(s.join("|"),"g"),this.hasPatterns=s.length>0}addPattern(t,e,s){const[i,r]=e;t.push(jr(i)),this.end[i]=[r,s,this.endPattern(r)]}endPattern(t,e){return new RegExp((e||jr(t))+"|\\\\(?:[a-zA-Z]|.)|[{}]","g")}findEnd(t,e,s,i){const[r,n,o]=i,a=o.lastIndex=s.index+s[0].length;let l,c=0;for(;l=o.exec(t);){if((l[1]||l[0])===r&&0===c)return nr(s[0],t.substring(a,l.index),l[0],e,s.index,l.index+l[0].length,n);"{"===l[0]?c++:"}"===l[0]&&c&&c--}return null}findMathInString(t,e,s){let i,r;for(this.start.lastIndex=0;i=this.start.exec(s);){if(void 0!==i[this.env]&&this.env){const t="\\\\end\\s*(\\{"+jr(i[this.env])+"\\})";r=this.findEnd(s,e,i,["{"+i[this.env]+"}",!0,this.endPattern(null,t)]),r&&(r.math=r.open+r.math+r.close,r.open=r.close="")}else if(void 0!==i[this.sub]&&this.sub){const t=i[this.sub],s=i.index+i[this.sub].length;r=2===t.length?nr("\\",t.substring(1),"",e,i.index,s):nr("",t,"",e,i.index,s,!1)}else r=this.findEnd(s,e,i,this.end[i[0]]);r&&(t.push(r),this.start.lastIndex=r.end.n)}}findMath(t){const e=[];if(this.hasPatterns)for(let s=0,i=t.length;sString.fromCodePoint(parseInt(t,16)),getChildren:t=>t.childNodes,getText:t=>t.getText(),appendChildren(t,e){for(const s of e)t.appendChild(s)},setAttribute(t,e,s){t.attributes.set(e,s)},setProperty(t,e,s){t.setProperty(e,s)},setProperties(t,e){for(const s of Object.keys(e)){const i=e[s];"texClass"===s?(t.texClass=i,t.setProperty(s,i)):"movablelimits"===s?(t.setProperty("movablelimits",i),(t.isKind("mo")||t.isKind("mstyle"))&&t.attributes.set("movablelimits",i)):"inferred"===s||(Jo.attrs.has(s)?t.setProperty(s,i):t.attributes.set(s,i))}},getProperty:(t,e)=>t.getProperty(e),getAttribute:(t,e)=>t.attributes.get(e),removeAttribute(t,e){t.attributes.unset(e)},removeProperties(t,...e){t.removeProperty(...e)},getChildAt:(t,e)=>t.childNodes[e],setChild(t,e,s){t.childNodes[e]=s,s&&(s.parent=t)},copyChildren(t,e){const s=t.childNodes;for(let t=0;tt.isKind(e),isEmbellished:t=>t.isEmbellished,getTexClass:t=>t.texClass,getCoreMO:t=>t.coreMO(),isNode:t=>t instanceof Nr||t instanceof Ar,isInferred:t=>t.isInferred,getForm(t){if(!t.isKind("mo"))return null;const e=t,s=e.getForms();for(const t of s){const s=this.getOp(e,t);if(s)return s}return null},getOp:(t,e="infix")=>Vr.OPTABLE[e][t.getText()]||null,getMoAttribute(t,e){var s,i;if(!t.attributes.isSet(e))for(const r of["infix","postfix","prefix"]){const n=null===(i=null===(s=this.getOp(t,r))||void 0===s?void 0:s[3])||void 0===i?void 0:i[e];if(void 0!==n)return n}return t.attributes.get(e)}},Ko=Jo,$o={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"},Form:{PREFIX:"prefix",INFIX:"infix",POSTFIX:"postfix"},LineBreak:{AUTO:"auto",NEWLINE:"newline",NOBREAK:"nobreak",GOODBREAK:"goodbreak",BADBREAK:"badbreak"},LineBreakStyle:{BEFORE:"before",AFTER:"after",DUPLICATE:"duplicate",INFIXLINBREAKSTYLE:"infixlinebreakstyle"},IndentAlign:{LEFT:"left",CENTER:"center",RIGHT:"right",AUTO:"auto",ID:"id",INDENTALIGN:"indentalign"},IndentShift:{INDENTSHIFT:"indentshift"},LineThickness:{THIN:"thin",MEDIUM:"medium",THICK:"thick"},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"},Align:{TOP:"top",BOTTOM:"bottom",CENTER:"center",BASELINE:"baseline",AXIS:"axis",LEFT:"left",RIGHT:"right"},Lines:{NONE:"none",SOLID:"solid",DASHED:"dashed"},Side:{LEFT:"left",RIGHT:"right",LEFTOVERLAP:"leftoverlap",RIGHTOVERLAP:"rightoverlap"},Width:{AUTO:"auto",FIT:"fit"},Actiontype:{TOGGLE:"toggle",STATUSLINE:"statusline",TOOLTIP:"tooltip",INPUT:"input"},Overflow:{LINBREAK:"linebreak",SCROLL:"scroll",ELIDE:"elide",TRUNCATE:"truncate",SCALE:"scale"},Unit:{EM:"em",EX:"ex",PX:"px",IN:"in",CM:"cm",MM:"mm",PT:"pt",PC:"pc"},Attr:{LATEX:"data-latex",LATEXITEM:"data-latex-item"}};function Yo(t,e,s){const i=e.attributes,r=s.attributes;t.forEach(t=>{const e=r.getExplicit(t);null!=e&&i.set(t,e)})}function Qo(t,e){const s=(t,e)=>t.getExplicitNames().filter(s=>s!==e&&("stretchy"!==s||t.getExplicit("stretchy"))&&"data-latex"!==s&&"data-latex-item"!==s),i=t.attributes,r=e.attributes,n=s(i,"lspace"),o=s(r,"rspace");if(n.length!==o.length)return!1;for(const t of n)if(i.getExplicit(t)!==r.getExplicit(t))return!1;return!0}function Zo(t,e,s){const i=[];for(const r of t.getList("m"+e+s)){const n=r.childNodes;if(n[r[e]]&&n[r[s]])continue;const o=r.parent,a=n[r[e]]?t.nodeFactory.create("node","m"+e,[n[r.base],n[r[e]]]):t.nodeFactory.create("node","m"+s,[n[r.base],n[r[s]]]);Ko.copyAttributes(r,a),o.replaceChild(a,r),i.push(r)}t.removeFromList("m"+e+s,i)}function ta(t,e,s){const i=[];for(const r of t.getList(e)){if(r.attributes.get("displaystyle"))continue;const e=r.childNodes[r.base],n=e.coreMO();if(e.getProperty("movablelimits")&&!n.attributes.hasExplicit("movablelimits")){const e=t.nodeFactory.create("node",s,r.childNodes);Ko.copyAttributes(r,e),r.parent.replaceChild(e,r),i.push(r)}}t.removeFromList(e,i)}const ea={cleanStretchy(t){var e;const s=t.data;for(const t of s.getList("fixStretchy"))if(Ko.getProperty(t,"fixStretchy")){const s=Ko.getForm(t);(null===(e=null==s?void 0:s[3])||void 0===e?void 0:e.stretchy)&&Ko.setAttribute(t,"stretchy",!1),Ko.removeProperties(t,"fixStretchy")}},cleanAttributes(t){t.data.root.walkTree(t=>{const e=new Set((t.getProperty("keep-attrs")||"").split(/ /)),s=t.attributes;s.unset($o.Attr.LATEXITEM);for(const t of s.getExplicitNames())e.has(t)||s.get(t)!==s.getInherited(t)||s.unset(t)})},combineRelations(t){const e=[];for(const s of t.data.getList("mo")){if(s.getProperty("relationsCombined")||!s.parent||s.parent&&!Ko.isType(s.parent,"mrow")||Ko.getTexClass(s)!==fr.REL)continue;let t;const i=s.parent.childNodes,r=i.indexOf(s)+1,n=Ko.getProperty(s,"variantForm");for(;r"data-latex"!==t.substring(0,10)).length){const r=t.childNodes[0].childNodes[0];i.forEach(t=>r.attributes.set(t,e.get(t))),t.parent.replaceChild(r,t),s.push(t)}}e.removeFromList("mstyle",s)}},sa=ea;var ia,ra;!function(t){t.HANDLER="handler",t.FALLBACK="fallback",t.ITEMS="items",t.TAGS="tags",t.OPTIONS="options",t.NODES="nodes",t.PREPROCESSORS="preprocessors",t.POSTPROCESSORS="postprocessors",t.INIT="init",t.CONFIG="config",t.PRIORITY="priority",t.PARSER="parser"}(ia||(ia={})),function(t){t.DELIMITER="delimiter",t.MACRO="macro",t.CHARACTER="character",t.ENVIRONMENT="environment"}(ra||(ra={}));const na=7.2;const oa={UNIT_CASES:new class{constructor(t){this.num="([-+]?([.,]\\d+|\\d+([.,]\\d*)?))",this.unit="",this.dimenEnd=/./,this.dimenRest=/./,this.map=new Map(t),this.updateDimen()}updateDimen(){this.unit=`(${Array.from(this.map.keys()).join("|")})`,this.dimenEnd=RegExp("^\\s*"+this.num+"\\s*"+this.unit+"\\s*$"),this.dimenRest=RegExp("^\\s*"+this.num+"\\s*"+this.unit+" ?")}set(t,e){return this.map.set(t,e),this.updateDimen(),this}get(t){return this.map.get(t)||this.map.get("pt")}delete(t){return!!this.map.delete(t)&&(this.updateDimen(),!0)}}([["em",1],["ex",.43],["pt",.1],["pc",1.2],["px",.1],["in",na],["cm",na/2.54],["mm",na/25.4],["mu",1/18]]),matchDimen(t,e=!1){const s=t.match(e?oa.UNIT_CASES.dimenRest:oa.UNIT_CASES.dimenEnd);return s?function([t,e,s]){return"mu"!==e?[t,e,s]:[oa.em(oa.UNIT_CASES.get(e)*parseFloat(t)).slice(0,-2),"em",s]}([s[1].replace(/,/,"."),s[4],s[0].length]):[null,null,0]},dimen2em(t){const[e,s]=oa.matchDimen(t),i=parseFloat(e||"1");return oa.UNIT_CASES.get(s)*i},em:t=>Math.abs(t)<6e-4?"0em":t.toFixed(3).replace(/\.?0+$/,"")+"em",trimSpaces(t){if("string"!=typeof t)return t;let e=t.trim();return e.match(/\\$/)&&t.match(/ $/)&&(e+=" "),e}};class aa{constructor(t,e,s){this._factory=t,this._env=e,this.global={},this.stack=[],this.global={isInner:s},this.stack=[this._factory.create("start",this.global)],e&&(this.stack[0].env=e),this.env=this.stack[0].env}set env(t){this._env=t}get env(){return this._env}Push(...t){for(const e of t){if(!e)continue;const t=Ko.isNode(e)?this._factory.create("mml",e):e;t.global=this.global;const[s,i]=this.stack.length?this.Top().checkItem(t):[null,!0];i&&(s?(this.Pop(),this.Push(...s)):(t.isKind("null")||this.stack.push(t),t.env?(t.copyEnv&&Object.assign(t.env,this.env),this.env=t.env):t.env=this.env))}}Pop(){const t=this.stack.pop();return t.isOpen||delete t.env,this.env=this.stack.length?this.Top().env:{},t}Top(t=1){return this.stack.length="0"&&i<="9")s[t]=e[parseInt(s[t],10)-1],"number"==typeof s[t]&&(s[t]=s[t].toString());else if("{"===i)if(i=s[t].substring(1),i>="0"&&i<="9")s[t]=e[parseInt(s[t].substring(1,s[t].length-1),10)-1],"number"==typeof s[t]&&(s[t]=s[t].toString());else{s[t].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/)&&(s[t]="%"+s[t])}}return s.join("")}constructor(t,e,...s){this.id=t,this.message=la.processString(e,s)}}la.pattern=/%(\d+|\{\d+\}|\{[a-z]+:%\d+(?:\|(?:%\{\d+\}|%.|[^}])*)+\}|.)/g;const ca=la;class ha{constructor(t){this._nodes=t,this.startStr="",this.startI=0,this.stopI=0}get nodes(){return this._nodes}Push(...t){this._nodes.push(...t)}Pop(){return this._nodes.pop()}get First(){return this._nodes[this.Size()-1]}set First(t){this._nodes[this.Size()-1]=t}get Last(){return this._nodes[0]}set Last(t){this._nodes[0]=t}Peek(t){return null==t&&(t=1),this._nodes.slice(this.Size()-t)}Size(){return this._nodes.length}Clear(){this._nodes=[]}toMml(t=!0,e){return 1!==this._nodes.length||e?this.create("node",t?"inferredMrow":"mrow",this._nodes,{}):this.First}create(t,...e){return this.factory.configuration.nodeFactory.create(t,...e)}}class da extends ha{constructor(t,...e){super(e),this.factory=t,this.global={},this._properties={},this.isOpen&&(this._env={})}get kind(){return"base"}get env(){return this._env}set env(t){this._env=t}get copyEnv(){return!0}getProperty(t){return this._properties[t]}setProperty(t,e){return this._properties[t]=e,this}get isOpen(){return!1}get isClose(){return!1}get isFinal(){return!1}isKind(t){return t===this.kind}checkItem(t){if(t.isKind("over")&&this.isOpen&&(t.setProperty("num",this.toMml(!1)),this.Clear()),t.isKind("cell")&&this.isOpen){if(t.getProperty("linebreak"))return da.fail;throw new ca("Misplaced","Misplaced %1",t.getName())}if(t.isClose&&this.getErrors(t.kind)){const[e,s]=this.getErrors(t.kind);throw new ca(e,s,t.getName())}return t.isFinal?(this.Push(t.First),da.fail):da.success}clearEnv(){for(const t of Object.keys(this.env))delete this.env[t]}setProperties(t){return Object.assign(this._properties,t),this}getName(){return this.getProperty("name")}toString(){return this.kind+"["+this.nodes.join("; ")+"]"}getErrors(t){return this.constructor.errors[t]||da.errors[t]}addLatexItem(t,e=""){const s=this.startStr.slice(this.startI,this.stopI);if(s){const i=e?e+s:s;t.attributes.set($o.Attr.LATEXITEM,i),"}"!==i&&t.attributes.set($o.Attr.LATEX,i)}}}da.fail=[null,!1],da.success=[null,!0],da.errors={end:["MissingBeginExtraEnd","Missing \\begin{%1} or extra \\end{%1}"],close:["ExtraCloseMissingOpen","Extra close brace or missing open brace"],right:["MissingLeftExtraRight","Missing \\left or extra \\right"],middle:["ExtraMiddle","Extra \\middle"]};class ua{constructor(t,e,s){this._string=t,this.configuration=s,this.macroCount=0,this.i=0,this.currentCS="",this.saveI=0;const i=Object.hasOwn(e,"isInner"),r=e.isInner;let n;if(delete e.isInner,e){n={};for(const t of Object.keys(e))n[t]=e[t]}this.configuration.pushParser(this),this.stack=new aa(this.itemFactory,n,!i||r),this.Parse(),this.Push(this.itemFactory.create("stop")),this.stack.env=n}get options(){return this.configuration.options}get itemFactory(){return this.configuration.itemFactory}get tags(){return this.configuration.tags}set string(t){this._string=t}get string(){return this._string}parse(t,e){const s=this.saveI;this.saveI=this.i-("character"===t&&"&"!==e[1]?1:0);const i=this.configuration.handlers.get(t).parse(e);return"macro"!==t&&this.updateResult(e[1],s),this.saveI=s,i}lookup(t,e){return this.configuration.handlers.get(t).lookup(e)}contains(t,e){return this.configuration.handlers.get(t).contains(e)}toString(){let t="";for(const e of Array.from(this.configuration.handlers.keys()))t+=e+": "+this.configuration.handlers.get(e)+"\n";return t}Parse(){let t;for(;this.it.includes(e),t=>t)}constructor(t,e,s){this.name=t,this.verify=e,this.convert=s}}const Ea={boolean:new ba("boolean",t=>"true"===t||"false"===t,t=>"true"===t),number:new ba("number",t=>!!t.match(/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[-+]?\d+)?$/),t=>parseFloat(t)),integer:new ba("integer",t=>!!t.match(/^[-+]?\d+$/),t=>parseInt(t)),string:new ba("string",t=>!0,t=>t),dimen:new ba("dimen",t=>null!==oa.matchDimen(t)[0],t=>t)};function xa(t,e){if(0===e)return t.replace(/^\s+/,"").replace(/([^\\\s]|^)((?:\\\\)*(?:\\\s)?)?\s+$/,"$1$2");for(;e>0;)t=t.trim().slice(1,-1),e--;return t}function ya(t,e,s=!1,i=!1){const r=t.length;let n=0,o="",a=0,l=0,c=!0;for(;an&&(l=n),c=!1}o+=i}if(n)throw new ca("ExtraOpenMissingClose","Extra open brace or missing close brace");return i&&l?["","",xa(o,1)]:[xa(o,s?Math.min(1,l):l),"",t.slice(a)]}const Na={cols:(...t)=>t.map(t=>oa.em(t)).join(" "),fenced(t,e,s,i,r="",n=""){const o=t.nodeFactory,a=o.create("node","mrow",[],{open:e,close:i,texClass:fr.INNER});let l;if(r)l=new ua("\\"+r+"l"+e,t.parser.stack.env,t).mml();else{const t=o.create("text",e);l=o.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:fr.OPEN},t)}if(Ko.appendChildren(a,[l,s]),r)l=new ua("\\"+r+"r"+i,t.parser.stack.env,t).mml();else{const t=o.create("text",i);l=o.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:fr.CLOSE},t)}return n&&l.attributes.set("mathcolor",n),Ko.appendChildren(a,[l]),a},fixedFence(t,e,s,i){const r=t.nodeFactory.create("node","mrow",[],{open:e,close:i,texClass:fr.ORD});return e&&Ko.appendChildren(r,[Na.mathPalette(t,e,"l")]),Ko.isType(s,"mrow")?Ko.appendChildren(r,Ko.getChildren(s)):Ko.appendChildren(r,[s]),i&&Ko.appendChildren(r,[Na.mathPalette(t,i,"r")]),r},mathPalette(t,e,s){"{"!==e&&"}"!==e||(e="\\"+e);const i="{\\big"+s+" "+e+"}";return new ua("\\mathchoice"+("{\\bigg"+s+" "+e+"}")+i+i+i,{},t).mml()},fixInitialMO(t,e){for(let s=0,i=e.length;s1&&(l=[t.create("node","mrow",l)]),l},internalText(t,e,s){e=e.replace(/\n+/g," ").replace(/^ +/,Co.nbsp).replace(/ +$/,Co.nbsp);const i=t.create("text",e);return t.create("node","mtext",[],s,i)},underOver(t,e,s,i,r){if(Na.checkMovableLimits(e),Ko.isType(e,"munderover")&&Ko.isEmbellished(e)){Ko.setProperties(Ko.getCoreMO(e),{lspace:0,rspace:0});const s=t.create("node","mo",[],{rspace:0});e=t.create("node","mrow",[s,e])}const n=t.create("node","munderover",[e]);Ko.setChild(n,"over"===i?n.over:n.under,s);let o=n;return r&&(o=t.create("node","TeXAtom",[t.create("node","mstyle",[n],{displaystyle:!0,scriptlevel:0})],{texClass:fr.OP,movesupsub:!0})),Ko.setProperty(o,"subsupOK",!0),o},checkMovableLimits(t){const e=Ko.isType(t,"mo")?Ko.getForm(t):null;(Ko.getProperty(t,"movablelimits")||e&&e[3]&&e[3].movablelimits)&&Ko.setProperties(t,{movablelimits:!1})},setArrayAlign:(t,e,s)=>(s||(e=oa.trimSpaces(e||"")),"t"===e?t.arraydef.align="baseline 1":"b"===e?t.arraydef.align="baseline -1":"c"===e?t.arraydef.align="axis":e&&(s?(s.string=`[${e}]`+s.string.slice(s.i),s.i=0):t.arraydef.align=e),t),substituteArgs(t,e,s){let i="",r="",n=0;for(;ne.length)throw new ca("IllegalMacroParam","Illegal macro parameter reference");r=Na.addArgs(t,Na.addArgs(t,r,i),e[parseInt(o,10)-1]),i=""}else i+=o}return Na.addArgs(t,r,i)},addArgs(t,e,s){if(s.match(/^[a-z]/i)&&e.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)&&(e+=" "),e.length+s.length>t.configuration.options.maxBuffer)throw new ca("MaxBufferSize","MathJax internal buffer size exceeded; is there a recursive macro call?");return e+s},checkMaxMacros(t,e=!0){if(!(++t.macroCount<=t.configuration.options.maxMacros))throw e?new ca("MaxMacroSub1","MathJax maximum macro substitution count exceeded; is here a recursive macro call?"):new ca("MaxMacroSub2","MathJax maximum substitution count exceeded; is there a recursive latex environment?")},checkEqnEnv(t,e=!0){const s=t.stack.Top(),i=s.First;if(!(s.getProperty("nestable")&&e&&!i||s.getProperty("nestStart"))&&(!s.isKind("start")||i))throw new ca("ErroneousNestingEq","Erroneous nesting of equation structures")},copyNode(t,e){const s=t.copy(),i=e.configuration;return s.walkTree(t=>{i.addNode(t.kind,t);const e=(t.getProperty("in-lists")||"").split(/,/);for(const s of e)s&&i.addNode(s,t)}),s},mmlFilterAttribute:(t,e,s)=>s,getFontDef(t){const e=t.stack.env.font;return e?{mathvariant:e}:{}},keyvalOptions(t,e=null,s=!1,i=!1){const r=function(t,e=!1){const s={};let i,r,n,o=t,a=!0;for(;o;)[r,i,o]=ya(o,["=",","],e,a),a=!1,"="===i?([n,i,o]=ya(o,[","],e),n="false"===n||"true"===n?JSON.parse(n):n,s[r]=n):r&&(s[r]=!0);return s}(t,i);if(e)for(const t of Object.keys(r))if(Object.hasOwn(e,t)){if(e[t]instanceof ba){const s=e[t],i=String(r[t]);if(!s.verify(i))throw new ca("InvalidValue","Value for key '%1' is not of the expected type",t);r[t]=s.convert(i)}}else{if(s)throw new ca("InvalidOption","Invalid option: %1",t);delete r[t]}return r},isLatinOrGreekChar:t=>!!t.normalize("NFD").match(/[a-zA-Z\u0370-\u03F0]/)};class va{constructor(){this.columnHandler={l:t=>t.calign[t.j++]="left",c:t=>t.calign[t.j++]="center",r:t=>t.calign[t.j++]="right",p:t=>this.getColumn(t,"top"),m:t=>this.getColumn(t,"middle"),b:t=>this.getColumn(t,"bottom"),w:t=>this.getColumn(t,"top",""),W:t=>this.getColumn(t,"top",""),"|":t=>this.addRule(t,"solid"),":":t=>this.addRule(t,"dashed"),">":t=>t.cstart[t.j]=(t.cstart[t.j]||"")+this.getBraces(t),"<":t=>t.cend[t.j-1]=(t.cend[t.j-1]||"")+this.getBraces(t),"@":t=>this.addAt(t,this.getBraces(t)),"!":t=>this.addBang(t,this.getBraces(t)),"*":t=>this.repeat(t),P:t=>this.macroColumn(t,">{$}p{#1}<{$}",1),M:t=>this.macroColumn(t,">{$}m{#1}<{$}",1),B:t=>this.macroColumn(t,">{$}b{#1}<{$}",1)," ":t=>{}},this.MAXCOLUMNS=1e4}process(t,e,s){const i={parser:t,template:e,i:0,j:0,c:"",cwidth:[],calign:[],cspace:[],clines:[],cstart:s.cstart,cend:s.cend,ralign:s.ralign,cextra:s.cextra};let r=0;for(;i.ithis.MAXCOLUMNS)throw new ca("MaxColumns","Too many column specifiers (perhaps looping column definitions?)");const t=i.template.codePointAt(i.i),e=i.c=String.fromCodePoint(t);if(i.i+=e.length,!Object.hasOwn(this.columnHandler,e))throw new ca("BadPreamToken","Illegal pream-token (%1)",e);this.columnHandler[e](i)}this.setColumnAlign(i,s),this.setColumnWidths(i,s),this.setColumnSpacing(i,s),this.setColumnLines(i,s),this.setPadding(i,s)}setColumnAlign(t,e){e.arraydef.columnalign=t.calign.join(" ")}setColumnWidths(t,e){if(!t.cwidth.length)return;const s=[...t.cwidth];s.lengtht||"auto").join(" ")}setColumnSpacing(t,e){if(!t.cspace.length)return;const s=[...t.cspace];s.lengtht||"1em").join(" ")}setColumnLines(t,e){if(!t.clines.length)return;const s=[...t.clines];s[0]&&e.frame.push(["left",s[0]]),s.length>t.calign.length?e.frame.push(["right",s.pop()]):s.length1&&(e.arraydef.columnlines=s.slice(1).map(t=>t||"none").join(" "))}setPadding(t,e){if(!t.cextra[0]&&!t.cextra[t.calign.length-1])return;const s=t.calign.length-1,i=t.cspace,r=t.cextra[s]?i[s]:null;e.arraydef["data-array-padding"]=`${i[0]||".5em"} ${r||".5em"}`}getColumn(t,e,s="left"){t.calign[t.j]=s||this.getAlign(t),t.cwidth[t.j]=this.getDimen(t),t.ralign[t.j]=[e,t.cwidth[t.j],t.calign[t.j]],t.j++}getDimen(t){const e=this.getBraces(t);if(!oa.matchDimen(e)[0])throw new ca("MissingColumnDimOrUnits","Missing dimension or its units for %1 column declaration",t.c);return e}getAlign(t){return Hi(this.getBraces(t).toLowerCase(),{l:"left",c:"center",r:"right"},"")}getBraces(t){for(;" "===t.template[t.i];)t.i++;if(t.i>=t.template.length)throw new ca("MissingArgForColumn","Missing argument for %1 column declaration",t.c);if("{"!==t.template[t.i])return t.template[t.i++];const e=++t.i;let s=1;for(;t.i0&&s--;)i.push(this.getBraces(t));t.template=Na.substituteArgs(t.parser,i,e)+t.template.slice(t.i),t.i=0}addRule(t,e){t.clines[t.j]&&this.addAt(t,"\\,"),t.clines[t.j]=e,"0"===t.cspace[t.j]&&(t.cstart[t.j]="\\hspace{.5em}")}addAt(t,e){const{cstart:s,cspace:i,j:r}=t;t.cextra[r]=!0,t.calign[r]="center",t.clines[r]&&(".5em"===i[r]?s[r-1]+="\\hspace{.25em}":i[r]||(t.cend[r-1]=(t.cend[r-1]||"")+"\\hspace{.5em}")),s[r]=e,i[r]="0",i[++t.j]="0"}addBang(t,e){const{cstart:s,cspace:i,j:r}=t;t.cextra[r]=!0,t.calign[r]="center",s[r]=("0"===i[r]&&t.clines[r]?"\\hspace{.25em}":"")+e,i[r]||(i[r]=".5em"),i[++t.j]=".5em"}repeat(t){const e=this.getBraces(t),s=this.getBraces(t),i=parseInt(e);if(String(i)!==e)throw new ca("ColArgNotNum","First argument to %1 column specifier must be a number","*");t.template=new Array(i).fill(s).join("")+t.template.substring(t.i),t.i=0}}const Ta=$o.Variant;class Ca{constructor(t,e=[]){this.options={},this.columnParser=new va,this.packageData=new Map,this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.handlers=t.handlers,this.nodeFactory=new ga,this.nodeFactory.configuration=this,this.nodeFactory.setCreators(t.nodes),this.itemFactory=new fa(t.items),this.itemFactory.configuration=this,Bi(this.options,...e),Bi(this.options,t.options),this.mathStyle=Ca.getVariant.get(this.options.mathStyle)||Ca.getVariant.get("TeX")}pushParser(t){this.parsers.unshift(t)}popParser(){this.parsers.shift()}get parser(){return this.parsers[0]}clear(){this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.tags.resetTag()}addNode(t,e){let s=this.nodeLists[t];if(s||(s=this.nodeLists[t]=[]),s.push(e),e.kind!==t){const s=Ko.getProperty(e,"in-lists")||"",i=(s?s.split(/,/):[]).concat(t).join(",");Ko.setProperty(e,"in-lists",i)}}getList(t){const e=this.nodeLists[t]||[],s=[];for(const t of e)this.inTree(t)&&s.push(t);return this.nodeLists[t]=s,s}removeFromList(t,e){const s=this.nodeLists[t]||[];for(const t of e){const e=s.indexOf(t);e>=0&&s.splice(e,1)}}inTree(t){for(;t&&t!==this.root;)t=t.parent;return!!t}}Ca.getVariant=new Map([["TeX",(t,e)=>e&&t.match(/^[\u0391-\u03A9\u03F4]/)?Ta.NORMAL:""],["ISO",t=>Ta.ITALIC],["French",t=>t.normalize("NFD").match(/^[a-z]/)?Ta.ITALIC:Ta.NORMAL],["upright",t=>Ta.NORMAL]]);const Aa=Ca;class La{constructor(t="???",e=""){this.tag=t,this.id=e}}class Sa{constructor(t="",e=!1,s=!1,i=null,r="",n="",o=!1,a=""){this.env=t,this.taggable=e,this.defaultTags=s,this.tag=i,this.tagId=r,this.tagFormat=n,this.noTag=o,this.labelId=a}}class Ra{constructor(){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 Sa,this.history=[],this.stack=[],this.enTag=function(t,e){const s=this.configuration.nodeFactory,i=s.create("node","mtd",[t]),r=s.create("node","mlabeledtr",[e,i]);return s.create("node","mtable",[r],{side:this.configuration.options.tagSide,minlabelspacing:this.configuration.options.tagIndent,displaystyle:!0})}}start(t,e,s){this.currentTag&&this.stack.push(this.currentTag);const i=this.label;this.currentTag=new Sa(t,e,s),this.label=i}get env(){return this.currentTag.env}end(){this.history.push(this.currentTag);const t=this.label;this.currentTag=this.stack.pop(),t&&!this.label&&(this.label=t)}tag(t,e){this.currentTag.tag=t,this.currentTag.tagFormat=e?t:this.formatTag(t),this.currentTag.noTag=!1}notag(){this.tag("",!0),this.currentTag.noTag=!0}get noTag(){return this.currentTag.noTag}set label(t){this.currentTag.labelId=t}get label(){return this.currentTag.labelId}formatUrl(t,e){return e+"#"+encodeURIComponent(t)}formatTag(t){return["(",t,")"]}formatRef(t){return this.formatTag(t)}formatId(t){return"mjx-eqn:"+t.replace(/\s/g,"_")}formatNumber(t){return t.toString()}autoTag(){null==this.currentTag.tag&&(this.counter++,this.tag(this.formatNumber(this.counter),!1))}clearTag(){this.tag(null,!0),this.currentTag.tagId=""}getTag(t=!1){if(t)return this.autoTag(),this.makeTag();const e=this.currentTag;return e.taggable&&!e.noTag&&(e.defaultTags&&this.autoTag(),e.tag)?this.makeTag():null}resetTag(){this.history=[],this.redo=!1,this.refUpdate=!1,this.clearTag()}reset(t=0){this.resetTag(),this.counter=this.allCounter=t,this.allLabels={},this.allIds={},this.label=""}startEquation(t){this.history=[],this.stack=[],this.clearTag(),this.currentTag=new Sa("",void 0,void 0),this.labels={},this.ids={},this.counter=this.allCounter,this.redo=!1;const e=t.inputData.recompile;e&&(this.refUpdate=!0,this.counter=e.counter)}finishEquation(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)}finalize(t,e){if(!e.display||this.currentTag.env||null==this.currentTag.tag)return t;const s=this.makeTag();return this.enTag(t,s)}makeId(){this.currentTag.tagId=this.formatId(this.configuration.options.useLabelIds&&this.label||this.currentTag.tag)}makeTag(){var t;this.makeId(),this.label&&(this.labels[this.label]=new La(this.currentTag.tag,this.currentTag.tagId),this.label="");const e=this.currentTag.tagFormat,s=Array.isArray(e)?e:(null===(t=e.match(/^(\(|\[|\{)(.*)(\}|\]|\))$/))||void 0===t?void 0:t.slice(1))||[e],i=new ua(s.map(t=>t?`\\text{${t}}`:"").join(""),{},this.configuration).mml();return this.configuration.nodeFactory.create("node","mtd",[i],{id:this.currentTag.tagId,rowalign:this.configuration.options.tagAlign})}}class Ma extends Ra{autoTag(){}getTag(){return this.currentTag.tag?super.getTag():null}}class Ia extends Ra{finalize(t,e){if(!e.display||this.history.find(function(t){return t.taggable}))return t;const s=this.getTag(!0);return this.enTag(t,s)}}const wa=new Map([["none",Ma],["all",Ia]]);let ka="none";const Oa={OPTIONS:{tags:ka,tagSide:"right",tagIndent:"0.8em",useLabelIds:!0,ignoreDuplicateLabels:!1,tagAlign:"baseline"},add(t,e){wa.set(t,e)},addTags(t){for(const e of Object.keys(t))Oa.add(e,t[e])},create(t){const e=wa.get(t)||wa.get(ka);if(!e)throw Error("Unknown tags class");return new e},setDefault(t){ka=t},getDefault:()=>Oa.create(ka)};class Da{constructor(t,e,s){this._token=t,this._char=e,this._attributes=s}get token(){return this._token}get char(){return this._char}get attributes(){return this._attributes}}class Pa{constructor(t,e,s=[]){this._token=t,this._func=e,this._args=s}get token(){return this._token}get func(){return this._func}get args(){return this._args}}function Ba(t){return void 0===t||t}class Fa{constructor(t,e){this._name=t,this._parser=e,Xa.register(this)}get name(){return this._name}parserFor(t){return this.contains(t)?this.parser:null}parse([t,e]){const s=this.parserFor(e),i=this.lookup(e);return s&&i?Ba(s(t,i)):null}set parser(t){this._parser=t}get parser(){return this._parser}}class ja extends Fa{constructor(t,e,s){super(t,e),this._regExp=s}contains(t){return this._regExp.test(t)}lookup(t){return this.contains(t)?t:null}}class _a extends Fa{constructor(){super(...arguments),this.map=new Map}lookup(t){return this.map.get(t)}contains(t){return this.map.has(t)}add(t,e){this.map.set(t,e)}remove(t){this.map.delete(t)}}class Ua extends _a{constructor(t,e,s){super(t,e);for(const t of Object.keys(s)){const e=s[t],[i,r]="string"==typeof e?[e,null]:e,n=new Da(t,i,r);this.add(t,n)}}}class Ha extends Ua{parse([t,e]){return super.parse([t,"\\"+e])}}class Wa extends _a{constructor(t,e,s={}){super(t,null);const i=t=>"string"==typeof t?s[t]:t;for(const[t,s]of Object.entries(e)){let e,r;Array.isArray(s)?(e=i(s[0]),r=s.slice(1)):(e=i(s),r=[]);const n=new Pa(t,e,r);this.add(t,n)}}parserFor(t){const e=this.lookup(t);return e?e.func:null}parse([t,e]){const s=this.lookup(e),i=this.parserFor(e);return s&&i?Ba(i(t,s.token,...s.args)):null}}class za extends Wa{parse([t,e]){const s=this.lookup(e),i=this.parserFor(e);if(!s||!i)return null;const r=t.currentCS;t.currentCS="\\"+e;const n=i(t,"\\"+s.token,...s.args);return t.currentCS=r,Ba(n)}}class qa extends Wa{constructor(t,e,s,i={}){super(t,s,i),this.parser=e}parse([t,e]){const s=this.lookup(e),i=this.parserFor(e);return s&&i?Ba(this.parser(t,s.token,i,s.args)):null}}const Va=new Map,Xa={register(t){Va.set(t.name,t)},getMap:t=>Va.get(t)};class Ga{constructor(){this._configuration=new gi,this._fallback=new bi}add(t,e,s=gi.DEFAULTPRIORITY){for(const e of t.slice().reverse()){const t=Xa.getMap(e);if(!t)return void this.warn(`Configuration '${e}' not found! Omitted.`);this._configuration.add(t,s)}e&&this._fallback.add(e,s)}remove(t,e=null){for(const e of t){const t=this.retrieve(e);t&&this._configuration.remove(t)}e&&this._fallback.remove(e)}parse(t){for(const{item:e}of this._configuration){const s=e.parse(t);if(s===Ga.FALLBACK)break;if(s)return s}const[e,s]=t;Array.from(this._fallback)[0].item(e,s)}lookup(t){const e=this.applicable(t);return e?e.lookup(t):null}contains(t){const e=this.applicable(t);return!(!e||e instanceof Ua&&null===e.lookup(t).char)}toString(){const t=[];for(const{item:e}of this._configuration)t.push(e.name);return t.join(", ")}applicable(t){for(const{item:e}of this._configuration)if(e.contains(t))return e;return null}retrieve(t){for(const{item:e}of this._configuration)if(e.name===t)return e;return null}warn(t){console.log("TexParser Warning: "+t)}}Ga.FALLBACK=Symbol("fallback");class Ja{constructor(){this.map=new Map}add(t,e,s=gi.DEFAULTPRIORITY){for(const i of Object.keys(t)){const r=i;let n=this.get(r);n||(n=new Ga,this.set(r,n)),n.add(t[r],e[r],s)}}remove(t,e){for(const s of Object.keys(t)){const i=this.get(s);i&&i.remove(t[s],e[s])}}set(t,e){this.map.set(t,e)}get(t){return this.map.get(t)}retrieve(t){for(const e of this.map.values()){const s=e.retrieve(t);if(s)return s}return null}keys(){return this.map.keys()}}class Ka{static makeProcessor(t,e){return Array.isArray(t)?t:[t,e]}static _create(t,e={}){var s;const i=null!==(s=e.priority)&&void 0!==s?s:gi.DEFAULTPRIORITY,r=e.init?this.makeProcessor(e.init,i):null,n=e.config?this.makeProcessor(e.config,i):null,o=(e.preprocessors||[]).map(t=>this.makeProcessor(t,i)),a=(e.postprocessors||[]).map(t=>this.makeProcessor(t,i)),l=e.parser||"tex";return new Ka(t,e[ia.HANDLER]||{},e[ia.FALLBACK]||{},e[ia.ITEMS]||{},e[ia.TAGS]||{},e[ia.OPTIONS]||{},e[ia.NODES]||{},o,a,r,n,i,l)}static create(t,e={}){const s=Ka._create(t,e);return Ya.set(t,s),s}static local(t={}){return Ka._create("",t)}constructor(t,e={},s={},i={},r={},n={},o={},a=[],l=[],c=null,h=null,d,u){this.name=t,this.handler=e,this.fallback=s,this.items=i,this.tags=r,this.options=n,this.nodes=o,this.preprocessors=a,this.postprocessors=l,this.initMethod=c,this.configMethod=h,this.priority=d,this.parser=u,this.handler=Object.assign({[ra.CHARACTER]:[],[ra.DELIMITER]:[],[ra.MACRO]:[],[ra.ENVIRONMENT]:[]},e)}get init(){return this.initMethod?this.initMethod[0]:null}get config(){return this.configMethod?this.configMethod[0]:null}}const $a=new Map,Ya={set(t,e){$a.set(t,e)},get:t=>$a.get(t),keys:()=>$a.keys()};class Qa{constructor(t,e=["tex"]){this.initMethod=new bi,this.configMethod=new bi,this.configurations=new gi,this.parsers=[],this.handlers=new Ja,this.items={},this.tags={},this.options={},this.nodes={},this.parsers=e;for(const e of t.slice().reverse())this.addPackage(e);for(const{item:t,priority:e}of this.configurations)this.append(t,e)}init(){this.initMethod.execute(this)}config(t){this.configMethod.execute(this,t);for(const e of this.configurations)this.addFilters(t,e.item)}addPackage(t){const e="string"==typeof t?t:t[0],s=this.getPackage(e);s&&this.configurations.add(s,"string"==typeof t?s.priority:t[1])}add(t,e,s={}){const i=this.getPackage(t);this.append(i),this.configurations.add(i,i.priority),this.init();const r=e.parseOptions;r.nodeFactory.setCreators(i.nodes);for(const t of Object.keys(i.items))r.itemFactory.setNodeClass(t,i.items[t]);Oa.addTags(i.tags),Bi(r.options,i.options),Fi(r.options,s),this.addFilters(e,i),i.config&&i.config(this,e)}getPackage(t){const e=Ya.get(t);if(e&&!this.parsers.includes(e.parser))throw Error(`Package '${t}' doesn't target the proper parser`);return e||this.warn(`Package '${t}' not found. Omitted.`),e}append(t,e){e=e||t.priority,t.initMethod&&this.initMethod.add(t.initMethod[0],t.initMethod[1]),t.configMethod&&this.configMethod.add(t.configMethod[0],t.configMethod[1]),this.handlers.add(t.handler,t.fallback,e),Object.assign(this.items,t.items),Object.assign(this.tags,t.tags),Bi(this.options,t.options),Object.assign(this.nodes,t.nodes)}addFilters(t,e){for(const[s,i]of e.preprocessors)t.preFilters.add(s,i);for(const[s,i]of e.postprocessors)t.postFilters.add(s,i)}warn(t){console.warn("MathJax Warning: "+t)}}class Za extends da{constructor(t,e){super(t),this.global=e}get kind(){return"start"}get isOpen(){return!0}checkItem(t){if(t.isKind("stop")){let t=this.toMml();return this.global.isInner||(t=this.factory.configuration.tags.finalize(t,this.env)),[[this.factory.create("mml",t)],!0]}return super.checkItem(t)}}class tl extends da{get kind(){return"stop"}get isClose(){return!0}}class el extends da{get kind(){return"open"}get isOpen(){return!0}checkItem(t){if(t.isKind("close")){const e=this.toMml(),s=this.create("node","TeXAtom",[e]);return t.addLatexItem(s),[[this.factory.create("mml",s)],!0]}return super.checkItem(t)}}el.errors=Object.assign(Object.create(da.errors),{stop:["ExtraOpenMissingClose","Extra open brace or missing close brace"]});class sl extends da{get kind(){return"close"}get isClose(){return!0}}class il extends da{get kind(){return"null"}}class rl extends da{get kind(){return"prime"}checkItem(t){const[e,s]=this.Peek(2),i=(Ko.isType(e,"msubsup")||Ko.isType(e,"msup"))&&!Ko.getChildAt(e,e.sup),r=(Ko.isType(e,"munderover")||Ko.isType(e,"mover"))&&!Ko.getChildAt(e,e.over)&&!Ko.getProperty(e,"subsupOK");if(!i&&!r){return[[this.create("node",e.getProperty("movesupsub")?"mover":"msup",[e,s]),t],!0]}const n=i?e.sup:e.over;return Ko.setChild(e,n,s),[[e,t],!0]}}class nl extends da{get kind(){return"subsup"}checkItem(t){if(t.isKind("open")||t.isKind("left"))return da.success;const e=this.First,s=this.getProperty("position");if(t.isKind("mml")){if(this.getProperty("primes"))if(2!==s)Ko.setChild(e,2,this.getProperty("primes"));else{Ko.setProperty(this.getProperty("primes"),"variantForm",!0);const e=this.create("node","mrow",[this.getProperty("primes"),t.First]);t.First=e}Ko.setChild(e,s,t.First),null!=this.getProperty("movesupsub")&&Ko.setProperty(e,"movesupsub",this.getProperty("movesupsub"));return[[this.factory.create("mml",e)],!0]}super.checkItem(t);const i=this.getErrors(["","sub","sup"][s]);throw new ca(i[0],i[1],...i.splice(2))}}nl.errors=Object.assign(Object.create(da.errors),{stop:["MissingScript","Missing superscript or subscript argument"],sup:["MissingOpenForSup","Missing open brace for superscript"],sub:["MissingOpenForSub","Missing open brace for subscript"]});class ol extends da{constructor(t){super(t),this.setProperty("name","\\over")}get kind(){return"over"}get isClose(){return!0}checkItem(t){if(t.isKind("over"))throw new ca("AmbiguousUseOf","Ambiguous use of %1",t.getName());if(t.isClose){let e=this.create("node","mfrac",[this.getProperty("num"),this.toMml(!1)]);return null!=this.getProperty("thickness")&&Ko.setAttribute(e,"linethickness",this.getProperty("thickness")),(this.getProperty("ldelim")||this.getProperty("rdelim"))&&(Ko.setProperty(e,"withDelims",!0),e=Na.fixedFence(this.factory.configuration,this.getProperty("ldelim"),e,this.getProperty("rdelim"))),e.attributes.set($o.Attr.LATEXITEM,this.getProperty("name")),[[this.factory.create("mml",e),t],!0]}return super.checkItem(t)}toString(){return"over["+this.getProperty("num")+" / "+this.nodes.join("; ")+"]"}}class al extends da{constructor(t,e){super(t),this.setProperty("delim",e)}get kind(){return"left"}get isOpen(){return!0}checkItem(t){if(t.isKind("right")){const e=Na.fenced(this.factory.configuration,this.getProperty("delim"),this.toMml(),t.getProperty("delim"),"",t.getProperty("color")),s=e.childNodes[0],i=e.childNodes[e.childNodes.length-1],r=this.factory.create("mml",e);return this.addLatexItem(s,"\\left"),t.addLatexItem(i,"\\right"),r.Peek()[0].attributes.set($o.Attr.LATEXITEM,"\\left"+t.startStr.slice(this.startI,t.stopI)),[[r],!0]}if(t.isKind("middle")){const e={stretchy:!0};t.getProperty("color")&&(e.mathcolor=t.getProperty("color"));const s=this.create("token","mo",e,t.getProperty("delim"));return t.addLatexItem(s,"\\middle"),this.Push(this.create("node","TeXAtom",[],{texClass:fr.CLOSE}),s,this.create("node","TeXAtom",[],{texClass:fr.OPEN})),this.env={},[[this],!0]}return super.checkItem(t)}}al.errors=Object.assign(Object.create(da.errors),{stop:["ExtraLeftMissingRight","Extra \\left or missing \\right"]});class ll extends da{constructor(t,e,s){super(t),this.setProperty("delim",e),s&&this.setProperty("color",s)}get kind(){return"middle"}get isClose(){return!0}}class cl extends da{constructor(t,e,s){super(t),this.setProperty("delim",e),s&&this.setProperty("color",s)}get kind(){return"right"}get isClose(){return!0}}class hl extends da{get kind(){return"break"}constructor(t,e,s){super(t),this.setProperty("linebreak",e),this.setProperty("insert",s)}checkItem(t){var e,s;const i=this.getProperty("linebreak");if(t.isKind("mml")){const r=t.First;if(r.isKind("mo")){if("after"!==((null===(s=null===(e=Ko.getOp(r))||void 0===e?void 0:e[3])||void 0===s?void 0:s.linebreakstyle)||Ko.getAttribute(r,"linebreakstyle")))return Ko.setAttribute(r,"linebreak",i),[[t],!0];if(!this.getProperty("insert"))return[[t],!0]}}const r=this.create("token","mspace",{linebreak:i});return[[this.factory.create("mml",r),t],!0]}}class dl extends da{get kind(){return"begin"}get isOpen(){return!0}checkItem(t){if(t.isKind("end")){if(t.getName()!==this.getName())throw new ca("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),t.getName());const e=this.toMml();return t.addLatexItem(e),[[this.factory.create("mml",e)],!0]}if(t.isKind("stop"))throw new ca("EnvMissingEnd","Missing \\end{%1}",this.getName());return super.checkItem(t)}}class ul extends da{get kind(){return"end"}get isClose(){return!0}}class pl extends da{get kind(){return"style"}checkItem(t){if(!t.isClose)return super.checkItem(t);const e=this.create("node","mstyle",this.nodes,this.getProperty("styles"));return[[this.factory.create("mml",e),t],!0]}}class ml extends da{get kind(){return"position"}checkItem(t){if(t.isClose)throw new ca("MissingBoxFor","Missing box for %1",this.getName());if(t.isFinal){let e=t.toMml();switch(this.getProperty("move")){case"vertical":return e=this.create("node","mpadded",[e],{height:this.getProperty("dh"),depth:this.getProperty("dd"),voffset:this.getProperty("dh")}),[[this.factory.create("mml",e)],!0];case"horizontal":return[[this.factory.create("mml",this.getProperty("left")),t,this.factory.create("mml",this.getProperty("right"))],!0]}}return super.checkItem(t)}}class fl extends da{get kind(){return"cell"}get isClose(){return!0}}class gl extends da{get isFinal(){return!0}get kind(){return"mml"}}class bl extends da{get kind(){return"fn"}checkItem(t){const e=this.First;if(e){if(t.isOpen)return da.success;if(!t.isKind("fn")){let s=t.First;if(!t.isKind("mml")||!s)return[[e,t],!0];if(Ko.isType(s,"mstyle")&&s.childNodes.length&&Ko.isType(s.childNodes[0].childNodes[0],"mspace")||Ko.isType(s,"mspace"))return[[e,t],!0];Ko.isEmbellished(s)&&(s=Ko.getCoreMO(s));const i=Ko.getForm(s);if(null!=i&&[0,0,1,1,0,1,1,0,0,0][i[2]])return[[e,t],!0]}if(e.isKind("TeXAtom")&&e.isEmpty)return[[e,t],!0];return[[e,this.create("token","mo",{texClass:fr.NONE},Co.ApplyFunction),t],!0]}return super.checkItem(t)}}class El extends da{constructor(){super(...arguments),this.remap=Xa.getMap("not_remap")}get kind(){return"not"}checkItem(t){let e,s,i;if(t.isKind("open")||t.isKind("left"))return da.success;if(t.isKind("mml")&&(Ko.isType(t.First,"mo")||Ko.isType(t.First,"mi")||Ko.isType(t.First,"mtext"))&&(e=t.First,s=Ko.getText(e),1===s.length&&!Ko.getProperty(e,"movesupsub")&&1===Ko.getChildren(e).length))return this.remap.contains(s)?(i=this.create("text",this.remap.lookup(s).char),Ko.setChild(e,0,i)):(i=this.create("text","\u0338"),Ko.appendChildren(e,[i])),[[t],!0];i=this.create("text","\u29f8");const r=this.create("node","mtext",[],{},i),n=this.create("node","mpadded",[r],{width:0});return e=this.create("node","TeXAtom",[n],{texClass:fr.REL}),[[e,t],!0]}}class xl extends da{get kind(){return"nonscript"}checkItem(t){if(t.isKind("mml")&&1===t.Size()){let e=t.First;if(e.isKind("mstyle")&&e.notParent&&(e=Ko.getChildren(Ko.getChildren(e)[0])[0]),e.isKind("mspace")){if(e!==t.First){const e=this.create("node","mrow",[t.Pop()]);t.Push(e)}this.factory.configuration.addNode("nonscript",t.First)}}return[[t],!0]}}class yl extends da{get kind(){return"dots"}checkItem(t){if(t.isKind("open")||t.isKind("left"))return da.success;let e=this.getProperty("ldots");const s=t.First;if(t.isKind("mml")&&Ko.isEmbellished(s)){const t=Ko.getTexClass(Ko.getCoreMO(s));t!==fr.BIN&&t!==fr.REL||(e=this.getProperty("cdots"))}return[[e,t],!0]}}class Nl extends da{constructor(){super(...arguments),this.table=[],this.row=[],this.frame=[],this.hfill=[],this.arraydef={},this.cstart=[],this.cend=[],this.cextra=[],this.atEnd=!1,this.ralign=[],this.breakAlign={cell:"",row:"",table:""},this.templateSubs=0}get kind(){return"array"}get isOpen(){return!0}get copyEnv(){return!1}checkItem(t){if(t.isClose&&!t.isKind("over")){if(t.getProperty("isEntry"))return this.EndEntry(),this.clearEnv(),this.StartEntry(),da.fail;if(t.getProperty("isCR"))return this.EndEntry(),this.EndRow(),this.clearEnv(),this.StartEntry(),da.fail;this.EndTable(),this.clearEnv();const e=this.factory.create("mml",this.createMml());if(this.getProperty("requireClose")){if(t.isKind("close"))return[[e],!0];throw new ca("MissingCloseBrace","Missing close brace")}return[[e,t],!0]}return super.checkItem(t)}createMml(){const t=this.arraydef.scriptlevel;delete this.arraydef.scriptlevel;let e=this.create("node","mtable",this.table,this.arraydef);return t&&e.setProperty("smallmatrix",!0),this.breakAlign.table&&Ko.setAttribute(e,"data-break-align",this.breakAlign.table),this.getProperty("arrayPadding")&&(Ko.setAttribute(e,"data-frame-styles",""),Ko.setAttribute(e,"framespacing",this.getProperty("arrayPadding"))),e=this.handleFrame(e),void 0!==t&&(e=this.create("node","mstyle",[e],{scriptlevel:t})),(this.getProperty("open")||this.getProperty("close"))&&(e=Na.fenced(this.factory.configuration,this.getProperty("open"),e,this.getProperty("close"))),e}handleFrame(t){if(!this.frame.length)return t;const e=new Map(this.frame),s=this.frame.reduce((t,[,e])=>e===t?e:"",this.frame[0][1]);if(s){if(4===this.frame.length)return Ko.setAttribute(t,"frame",s),Ko.removeAttribute(t,"data-frame-styles"),t;if("solid"===s)return Ko.setAttribute(t,"data-frame-styles",""),t=this.create("node","menclose",[t],{notation:Array.from(e.keys()).join(" "),"data-padding":0})}const i=wo.map(t=>e.get(t)||"none").join(" ");return Ko.setAttribute(t,"data-frame-styles",i),t}StartEntry(){const t=this.row.length;let e=this.cstart[t],s=this.cend[t];const i=this.ralign[t],r=this.cextra;if(!(e||s||i||r[t]||r[t+1]))return;let[n,o,a,l]=this.getEntry();if(!r[t]||this.atEnd&&!r[t+1]||(e+="&"),"&"!==a&&(l=!!o.trim()||!!(t||a&&"\\end"!==a.substring(0,4)),r[t+1]&&!r[t]&&(s=(s||"")+"&",this.atEnd=!0)),!l&&!n)return;const c=this.parser;if(l&&(e&&(o=Na.addArgs(c,e,o)),s&&(o=Na.addArgs(c,o,s)),i&&(o="\\text{"+o.trim()+"}"),(e||s||i)&&++this.templateSubs>c.configuration.options.maxTemplateSubtitutions))throw new ca("MaxTemplateSubs","Maximum template substitutions exceeded; is there an invalid use of \\\\ in the template?");n&&(o=Na.addArgs(c,n,o)),c.string=Na.addArgs(c,o,c.string),c.i=0}getEntry(){const t=this.parser,e=/^([^]*?)([&{}]|\\\\|\\(?:begin|end)\s*\{array\}|\\cr|\\)/;let s,i=0,r=0,n=t.i;const o=["","","",!1];for(;null!==(s=t.string.slice(n).match(e));)switch(n+=s[0].length,s[2]){case"\\":n++;break;case"{":i++;break;case"}":if(!i)return o;i--;break;case"\\begin{array}":i||r++;break;case"\\end{array}":if(!i&&r){r--;break}default:{if(i||r)continue;n-=s[2].length;let e=t.string.slice(t.i,n).trim();const o=e.match(/^(?:\s*\\(?:h(?:dash)?line|hfil{1,3}|rowcolor\s*\{.*?\}))+/);return o&&(e=e.slice(o[0].length)),t.string=t.string.slice(n),t.i=0,[(null==o?void 0:o[0])||"",e,s[2],!0]}}return o}EndEntry(){const t=this.create("node","mtd",this.nodes);this.hfill.length&&(0===this.hfill[0]&&Ko.setAttribute(t,"columnalign","right"),this.hfill[this.hfill.length-1]===this.Size()&&Ko.setAttribute(t,"columnalign",Ko.getAttribute(t,"columnalign")?"center":"left"));const e=this.ralign[this.row.length];if(e){const[s,i,r]=e,n=this.create("node","mpadded",t.childNodes[0].childNodes,{width:i,"data-overflow":"auto","data-align":r,"data-vertical-align":s});n.setProperty("vbox",s),t.childNodes[0].childNodes=[],t.appendChild(n)}else this.breakAlign.cell&&Ko.setAttribute(t,"data-vertical-align",this.breakAlign.cell);this.breakAlign.cell="",this.row.push(t),this.Clear(),this.hfill=[]}EndRow(){let t="mtr";this.getProperty("isNumbered")&&3===this.row.length?(this.row.unshift(this.row.pop()),t="mlabeledtr"):this.getProperty("isLabeled")&&(t="mlabeledtr",this.setProperty("isLabeled",!1));const e=this.create("node",t,this.row);this.breakAlign.row&&(Ko.setAttribute(e,"data-break-align",this.breakAlign.row),this.breakAlign.row=""),this.addLatexItem(e),this.table.push(e),this.row=[],this.atEnd=!1}EndTable(){(this.Size()||this.row.length)&&(this.EndEntry(),this.EndRow()),this.checkLines()}checkLines(){if(this.arraydef.rowlines){const t=this.arraydef.rowlines.split(/ /);t.length===this.table.length?(this.frame.push(["bottom",t.pop()]),t.length?this.arraydef.rowlines=t.join(" "):delete this.arraydef.rowlines):t.lengththis.maxrow&&(this.maxrow=this.row.length);const t=this.factory.configuration.tags.getTag();t&&(this.row=[t].concat(this.row),this.setProperty("isLabeled",!0)),this.factory.configuration.tags.clearTag(),super.EndRow()}EndTable(){super.EndTable(),this.factory.configuration.tags.end(),this.extendArray("columnalign",this.maxrow),this.extendArray("columnwidth",this.maxrow),this.extendArray("columnspacing",this.maxrow-1),this.extendArray("data-break-align",this.maxrow),this.addIndentshift()}extendArray(t,e){if(!this.arraydef[t])return;const s=this.arraydef[t].split(/ /),i=[...s];if(i.length>1){for(;i.length0){const t="center"===e?".7em":"2em";for(const e of this.table){const i=e.childNodes[e.isKind("mlabeledtr")?s+1:s];if(i){const e=this.create("node","mstyle",i.childNodes[0].childNodes,{indentshift:t});i.childNodes[0].childNodes=[],i.appendChild(e)}}}e=t[s]}}}class Tl extends dl{get kind(){return"mstyle"}constructor(t,e,s){super(t),this.attrList=e,this.setProperty("name",s)}checkItem(t){if(t.isKind("end")&&t.getName()===this.getName()){return[[this.create("node","mstyle",[this.toMml()],this.attrList)],!0]}return super.checkItem(t)}}class Cl extends da{constructor(t,...e){super(t),this.factory.configuration.tags.start("equation",!0,e[0])}get kind(){return"equation"}get isOpen(){return!0}checkItem(t){if(t.isKind("end")){const e=this.toMml(),s=this.factory.configuration.tags.getTag();return this.factory.configuration.tags.end(),[[s?this.factory.configuration.tags.enTag(e,s):e,t],!0]}if(t.isKind("stop"))throw new ca("EnvMissingEnd","Missing \\end{%1}",this.getName());return super.checkItem(t)}}const Al=1.2/.85,Ll={fontfamily:1,fontsize:1,fontweight:1,fontstyle:1,color:1,background:1,id:1,class:1,href:1,style:1};function Sl(t,e=1/0){const s=t.replace(/\s+/g,"").split("").map(t=>{const e={t:"top",b:"bottom",m:"middle",c:"center"}[t];if(!e)throw new ca("BadBreakAlign","Invalid alignment character: %1",t);return e});if(s.length>e)throw new ca("TooManyAligns","Too many alignment characters: %1",t);return 1===e?s[0]:s.join(" ")}function Rl(t,e){const s=t.stack.env,i=s.inRoot;s.inRoot=!0;const r=new ua(e,s,t.configuration);let n=r.mml();const o=r.stack.global;if(o.leftRoot||o.upRoot){const e={};o.leftRoot&&(e.width=o.leftRoot),o.upRoot&&(e.voffset=o.upRoot,e.height=o.upRoot),n=t.create("node","mpadded",[n],e)}return s.inRoot=i,n}const Ml={Open(t,e){t.Push(t.itemFactory.create("open"))},Close(t,e){t.Push(t.itemFactory.create("close"))},Bar(t,e){const s=t.create("token","mo",{stretchy:!1,texClass:fr.ORD},e);s.setProperty("keep-attrs","stretchy"),t.Push(s)},Tilde(t,e){t.Push(t.create("token","mtext",{},Co.nbsp))},Space(t,e){},Superscript(t,e){let s,i;t.GetNext().match(/\d/)&&(t.string=t.string.substring(0,t.i+1)+" "+t.string.substring(t.i+1));const r=t.stack.Top();r.isKind("prime")?([i,s]=r.Peek(2),t.stack.Pop()):(i=t.stack.Prev(),i||(i=t.create("token","mi",{},"")));const n=Ko.getProperty(i,"movesupsub");let o=Ko.isType(i,"msubsup")?i.sup:i.over;if(Ko.isType(i,"msubsup")&&!Ko.isType(i,"msup")&&Ko.getChildAt(i,i.sup)||Ko.isType(i,"munderover")&&!Ko.isType(i,"mover")&&Ko.getChildAt(i,i.over)&&!Ko.getProperty(i,"subsupOK"))throw new ca("DoubleExponent","Double exponent: use braces to clarify");Ko.isType(i,"msubsup")&&!Ko.isType(i,"msup")||(n?((!Ko.isType(i,"munderover")||Ko.isType(i,"mover")||Ko.getChildAt(i,i.over))&&(i=t.create("node","munderover",[i],{movesupsub:!0})),o=i.over):(i=t.create("node","msubsup",[i]),o=i.sup)),t.Push(t.itemFactory.create("subsup",i).setProperties({position:o,primes:s,movesupsub:n}))},Subscript(t,e){let s,i;t.GetNext().match(/\d/)&&(t.string=t.string.substring(0,t.i+1)+" "+t.string.substring(t.i+1));const r=t.stack.Top();r.isKind("prime")?([i,s]=r.Peek(2),t.stack.Pop()):(i=t.stack.Prev(),i||(i=t.create("token","mi",{},"")));const n=Ko.getProperty(i,"movesupsub");let o=Ko.isType(i,"msubsup")?i.sub:i.under;if(Ko.isType(i,"msubsup")&&!Ko.isType(i,"msup")&&Ko.getChildAt(i,i.sub)||Ko.isType(i,"munderover")&&!Ko.isType(i,"mover")&&Ko.getChildAt(i,i.under)&&!Ko.getProperty(i,"subsupOK"))throw new ca("DoubleSubscripts","Double subscripts: use braces to clarify");Ko.isType(i,"msubsup")&&!Ko.isType(i,"msup")||(n?((!Ko.isType(i,"munderover")||Ko.isType(i,"mover")||Ko.getChildAt(i,i.under))&&(i=t.create("node","munderover",[i],{movesupsub:!0})),o=i.under):(i=t.create("node","msubsup",[i]),o=i.sub)),t.Push(t.itemFactory.create("subsup",i).setProperties({position:o,primes:s,movesupsub:n}))},Prime(t,e){let s=t.stack.Prev();if(s||(s=t.create("token","mi")),Ko.isType(s,"msubsup")&&!Ko.isType(s,"msup")&&Ko.getChildAt(s,s.sup)||Ko.isType(s,"munderover")&&!Ko.isType(s,"mover")&&Ko.getChildAt(s,s.over)&&!Ko.getProperty(s,"subsupOK"))throw new ca("DoubleExponentPrime","Prime causes double exponent: use braces to clarify");let i="";t.i--;do{i+=Co.prime,t.i++,e=t.GetNext()}while("'"===e||e===Co.rsquo);i=["","\u2032","\u2033","\u2034","\u2057"][i.length]||i;const r=t.create("token","mo",{variantForm:!0},i);t.Push(t.itemFactory.create("prime",s,r))},Comment(t,e){for(;t.in.macroColumn(t,r,parseInt(i)),t.Push(t.itemFactory.create("null"))},BeginEnd(t,e){const s=t.GetArgument(e);if(s.match(/\\/))throw new ca("InvalidEnv","Invalid environment name '%1'",s);const i=t.configuration.handlers.get(ra.ENVIRONMENT).lookup(s);if(i&&"\\end"===e){if(!i.args[0]){const e=t.itemFactory.create("end").setProperty("name",s);return void t.Push(e)}t.stack.env.closing=s}Na.checkMaxMacros(t,!1),t.parse(ra.ENVIRONMENT,[t,s])},Array(t,e,s,i,r,n,o,a,l){r||(r=t.GetArgument("\\begin{"+e.getName()+"}"));const c=t.itemFactory.create("array");return"array"===e.getName()&&c.setProperty("arrayPadding",".5em .125em"),c.parser=t,c.arraydef={columnspacing:n||"1em",rowspacing:o||"4pt"},t.configuration.columnParser.process(t,r,c),s&&c.setProperty("open",t.convertDelimiter(s)),i&&c.setProperty("close",t.convertDelimiter(i)),"'"===(a||"").charAt(1)&&(c.arraydef["data-cramped"]=!0,a=a.charAt(0)),"D"===a?c.arraydef.displaystyle=!0:a&&(c.arraydef.displaystyle=!1),c.arraydef.scriptlevel="S"===a?1:0,l&&(c.arraydef.useHeight=!1),t.Push(e),c.StartEntry(),c},AlignedArray(t,e,s=""){const i=t.GetBrackets("\\begin{"+e.getName()+"}"),r=Ml.Array(t,e,null,null,null,null,null,s);return Na.setArrayAlign(r,i)},IndentAlign(t,e){const s=`\\begin{${e.getName()}}`,i=t.GetBrackets(s,""),r=t.GetBrackets(s,""),n=t.GetBrackets(s,"");if(i&&!oa.matchDimen(i)[0]||r&&!oa.matchDimen(r)[0]||n&&!oa.matchDimen(n)[0])throw new ca("BracketMustBeDimension","Bracket argument to %1 must be a dimension",s);const o=t.GetArgument(s);if(o&&!o.match(/^([lcr]{1,3})?$/))throw new ca("BadAlignment","Alignment must be one to three copies of l, c, or r");const a=[...o].map(t=>({l:"left",c:"center",r:"right"}[t]));1===a.length&&a.push(a[0]);const l={};for(const[t,e]of[["indentshiftfirst",i],["indentshift",r||i],["indentshiftlast",n],["indentalignfirst",a[0]],["indentalign",a[1]],["indentalignlast",a[2]]])e&&(l[t]=e);t.Push(t.itemFactory.create("mstyle",l,e.getName()))},Equation:(t,e,s,i=!0)=>(t.configuration.mathItem.display=i,t.stack.env.display=i,Na.checkEqnEnv(t),t.Push(e),t.itemFactory.create("equation",s).setProperty("name",e.getName())),EqnArray(t,e,s,i,r,n,o){const a=e.getName(),l="gather"===a||"gather*"===a;i&&Na.checkEqnEnv(t,!l),t.Push(e),r=(r=r.replace(/[^clr]/g,"").split("").join(" ")).replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center"),n=Sl(n);const c=t.itemFactory.create("eqnarray",a,s,i,t.stack.global);return c.arraydef={displaystyle:!0,columnalign:r,columnspacing:o||"1em",rowspacing:"3pt","data-break-align":n,side:t.options.tagSide,minlabelspacing:t.options.tagIndent},l&&c.setProperty("nestable",!0),c},HandleNoTag(t,e){t.tags.notag()},HandleLabel(t,e){const s=t.GetArgument(e);if(""!==s&&!t.tags.refUpdate){if(t.tags.label)throw new ca("MultipleCommand","Multiple %1",t.currentCS);if(t.tags.label=s,(t.tags.allLabels[s]||t.tags.labels[s])&&!t.options.ignoreDuplicateLabels)throw new ca("MultipleLabel","Label '%1' multiply defined",s);t.tags.labels[s]=new La}},HandleRef(t,e,s){const i=t.GetArgument(e);let r=t.tags.allLabels[i]||t.tags.labels[i];r||(t.tags.refUpdate||(t.tags.redo=!0),r=new La);let n=r.tag;s&&(n=t.tags.formatRef(n));const o=t.create("node","mrow",Na.internalMath(t,Array.isArray(n)?n.join(""):n),{href:t.tags.formatUrl(r.id,t.options.baseURL),class:"MathJax_ref"});t.Push(o)},Macro(t,e,s,i,r){if(i){const n=[];if(null!=r){const s=t.GetBrackets(e);n.push(null==s?r:s)}for(let s=n.length;s1&&(i.autoOP=!1)),!i.mathvariant&&Na.isLatinOrGreekChar(e)){const s=t.configuration.mathStyle(e);s&&(i.mathvariant=s)}const n=t.create("token","mi",i,e);t.Push(n)},digit(t,e){const s=t.configuration.options.numberPattern,i=t.string.slice(t.i-1).match(s);if(!i)return!1;const r=Na.getFontDef(t),n=t.create("token","mn",r,i[0].replace(/[{}]/g,""));return t.i+=i[0].length-1,t.Push(n),!0},controlSequence(t,e){const s=t.GetCS();t.parse(ra.MACRO,[t,s])},lcGreek(t,e){const s={mathvariant:t.configuration.mathStyle(e.char)||wl.ITALIC},i=t.create("token","mi",s,e.char);t.Push(i)},ucGreek(t,e){const s={mathvariant:t.stack.env.font||t.configuration.mathStyle(e.char,!0)||wl.NORMAL},i=t.create("token","mi",s,e.char);t.Push(i)},mathchar0mi(t,e){const s=e.attributes||{mathvariant:wl.ITALIC},i=t.create("token","mi",s,e.char);t.Push(i)},mathchar0mo(t,e){const s=e.attributes||{};s.stretchy=!1;const i=t.create("token","mo",s,e.char);Ko.setProperty(i,"fixStretchy",!0),t.configuration.addNode("fixStretchy",i),t.Push(i)},mathchar7(t,e){const s=e.attributes||{mathvariant:wl.NORMAL};t.stack.env.font&&(s.mathvariant=t.stack.env.font);const i=t.create("token","mi",s,e.char);t.Push(i)},delimiter(t,e){let s=e.attributes||{};s=Object.assign({fence:!1,stretchy:!1},s);const i=t.create("token","mo",s,e.char);"|"===e.char&&i.setProperty("keep-attrs","stretchy"),t.Push(i)},environment(t,e,s,i){const r=t.itemFactory.create("begin").setProperty("name",e);t.Push(s(t,r,...i.slice(1)))}},Ol=kl,Dl=yo(bo.thickmathspace),Pl=$o.Variant;new ja("letter",Ol.variable,/[a-z]/i),new ja("digit",Ol.digit,/[0-9.,]/),new ja("command",Ol.controlSequence,/^\\/),new Wa("special",{"{":Il.Open,"}":Il.Close,"~":Il.Tilde,"^":Il.Superscript,_:Il.Subscript,"|":Il.Bar," ":Il.Space,"\t":Il.Space,"\r":Il.Space,"\n":Il.Space,"'":Il.Prime,"%":Il.Comment,"&":Il.Entry,"#":Il.Hash,"\xa0":Il.Space,"\u2019":Il.Prime}),new Ua("lcGreek",Ol.lcGreek,{alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsilon:"\u03f5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",lambda:"\u03bb",mu:"\u03bc",nu:"\u03bd",xi:"\u03be",omicron:"\u03bf",pi:"\u03c0",rho:"\u03c1",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03d5",chi:"\u03c7",psi:"\u03c8",omega:"\u03c9",varepsilon:"\u03b5",vartheta:"\u03d1",varpi:"\u03d6",varrho:"\u03f1",varsigma:"\u03c2",varphi:"\u03c6"}),new Ua("ucGreek",Ol.ucGreek,{Gamma:"\u0393",Delta:"\u0394",Theta:"\u0398",Lambda:"\u039b",Xi:"\u039e",Pi:"\u03a0",Sigma:"\u03a3",Upsilon:"\u03a5",Phi:"\u03a6",Psi:"\u03a8",Omega:"\u03a9"}),new Ua("mathchar0mi",Ol.mathchar0mi,{AA:"\u212b",S:["\xa7",{mathvariant:Pl.NORMAL}],aleph:["\u2135",{mathvariant:Pl.NORMAL}],hbar:["\u210f",{variantForm:!0}],imath:"\u0131",jmath:"\u0237",ell:"\u2113",wp:["\u2118",{mathvariant:Pl.NORMAL}],Re:["\u211c",{mathvariant:Pl.NORMAL}],Im:["\u2111",{mathvariant:Pl.NORMAL}],partial:["\u2202",{mathvariant:Pl.ITALIC}],infty:["\u221e",{mathvariant:Pl.NORMAL}],prime:["\u2032",{variantForm:!0}],emptyset:["\u2205",{mathvariant:Pl.NORMAL}],nabla:["\u2207",{mathvariant:Pl.NORMAL}],top:["\u22a4",{mathvariant:Pl.NORMAL}],bot:["\u22a5",{mathvariant:Pl.NORMAL}],angle:["\u2220",{mathvariant:Pl.NORMAL}],triangle:["\u25b3",{mathvariant:Pl.NORMAL}],backslash:["\\",{mathvariant:Pl.NORMAL}],forall:["\u2200",{mathvariant:Pl.NORMAL}],exists:["\u2203",{mathvariant:Pl.NORMAL}],neg:["\xac",{mathvariant:Pl.NORMAL}],lnot:["\xac",{mathvariant:Pl.NORMAL}],flat:["\u266d",{mathvariant:Pl.NORMAL}],natural:["\u266e",{mathvariant:Pl.NORMAL}],sharp:["\u266f",{mathvariant:Pl.NORMAL}],clubsuit:["\u2663",{mathvariant:Pl.NORMAL}],diamondsuit:["\u2662",{mathvariant:Pl.NORMAL}],heartsuit:["\u2661",{mathvariant:Pl.NORMAL}],spadesuit:["\u2660",{mathvariant:Pl.NORMAL}]}),new Ua("mathchar0mo",Ol.mathchar0mo,{surd:["\u221a",{symmetric:!0}],coprod:["\u2210",{movesupsub:!0}],bigvee:["\u22c1",{movesupsub:!0}],bigwedge:["\u22c0",{movesupsub:!0}],biguplus:["\u2a04",{movesupsub:!0}],bigcap:["\u22c2",{movesupsub:!0}],bigcup:["\u22c3",{movesupsub:!0}],int:"\u222b",intop:["\u222b",{movesupsub:!0,movablelimits:!0}],iint:"\u222c",iiint:"\u222d",prod:["\u220f",{movesupsub:!0}],sum:["\u2211",{movesupsub:!0}],bigotimes:["\u2a02",{movesupsub:!0}],bigoplus:["\u2a01",{movesupsub:!0}],bigodot:["\u2a00",{movesupsub:!0}],oint:"\u222e",ointop:["\u222e",{movesupsub:!0,movablelimits:!0}],oiint:"\u222f",oiiint:"\u2230",bigsqcup:["\u2a06",{movesupsub:!0}],smallint:["\u222b",{largeop:!1}],triangleleft:"\u25c3",triangleright:"\u25b9",bigtriangleup:"\u25b3",bigtriangledown:"\u25bd",wedge:"\u2227",land:"\u2227",vee:"\u2228",lor:"\u2228",cap:"\u2229",cup:"\u222a",ddagger:"\u2021",dagger:"\u2020",sqcap:"\u2293",sqcup:"\u2294",uplus:"\u228e",amalg:"\u2a3f",diamond:"\u22c4",bullet:"\u2219",wr:"\u2240",div:"\xf7",odot:["\u2299",{largeop:!1}],oslash:["\u2298",{largeop:!1}],otimes:["\u2297",{largeop:!1}],ominus:["\u2296",{largeop:!1}],oplus:["\u2295",{largeop:!1}],mp:"\u2213",pm:"\xb1",circ:"\u2218",bigcirc:"\u25ef",setminus:"\u2216",cdot:"\u22c5",ast:"\u2217",times:"\xd7",star:"\u22c6",propto:"\u221d",sqsubseteq:"\u2291",sqsupseteq:"\u2292",parallel:"\u2225",mid:"\u2223",dashv:"\u22a3",vdash:"\u22a2",leq:"\u2264",le:"\u2264",geq:"\u2265",ge:"\u2265",lt:"<",gt:">",succ:"\u227b",prec:"\u227a",approx:"\u2248",succeq:"\u2ab0",preceq:"\u2aaf",supset:"\u2283",subset:"\u2282",supseteq:"\u2287",subseteq:"\u2286",in:"\u2208",ni:"\u220b",notin:"\u2209",owns:"\u220b",gg:"\u226b",ll:"\u226a",sim:"\u223c",simeq:"\u2243",perp:"\u27c2",equiv:"\u2261",asymp:"\u224d",smile:"\u2323",frown:"\u2322",ne:"\u2260",neq:"\u2260",cong:"\u2245",doteq:"\u2250",bowtie:"\u22c8",models:"\u22a7",notChar:"\u29f8",Leftrightarrow:"\u21d4",Leftarrow:"\u21d0",Rightarrow:"\u21d2",leftrightarrow:"\u2194",leftarrow:"\u2190",gets:"\u2190",rightarrow:"\u2192",to:["\u2192",{accent:!1}],mapsto:"\u21a6",leftharpoonup:"\u21bc",leftharpoondown:"\u21bd",rightharpoonup:"\u21c0",rightharpoondown:"\u21c1",nearrow:"\u2197",searrow:"\u2198",nwarrow:"\u2196",swarrow:"\u2199",rightleftharpoons:"\u21cc",hookrightarrow:"\u21aa",hookleftarrow:"\u21a9",longleftarrow:"\u27f5",Longleftarrow:"\u27f8",longrightarrow:"\u27f6",Longrightarrow:"\u27f9",Longleftrightarrow:"\u27fa",longleftrightarrow:"\u27f7",longmapsto:"\u27fc",ldots:"\u2026",cdots:"\u22ef",vdots:"\u22ee",ddots:"\u22f1",iddots:"\u22f0",dotsc:"\u2026",dotsb:"\u22ef",dotsm:"\u22ef",dotsi:"\u22ef",dotso:"\u2026",ldotp:[".",{texClass:fr.PUNCT}],cdotp:["\u22c5",{texClass:fr.PUNCT}],colon:[":",{texClass:fr.PUNCT}]}),new Ua("mathchar7",Ol.mathchar7,{_:"_","#":"#",$:"$","%":"%","&":"&",And:"&"}),new Ha("delimiter",Ol.delimiter,{"(":"(",")":")","[":"[","]":"]","<":"\u27e8",">":"\u27e9","\\lt":"\u27e8","\\gt":"\u27e9","/":"/","|":["|",{texClass:fr.ORD}],".":"","\\lmoustache":"\u23b0","\\rmoustache":"\u23b1","\\lgroup":"\u27ee","\\rgroup":"\u27ef","\\arrowvert":"\u23d0","\\Arrowvert":"\u2016","\\bracevert":"\u23aa","\\Vert":["\u2016",{texClass:fr.ORD}],"\\|":["\u2016",{texClass:fr.ORD}],"\\vert":["|",{texClass:fr.ORD}],"\\uparrow":"\u2191","\\downarrow":"\u2193","\\updownarrow":"\u2195","\\Uparrow":"\u21d1","\\Downarrow":"\u21d3","\\Updownarrow":"\u21d5","\\backslash":"\\","\\rangle":"\u27e9","\\langle":"\u27e8","\\rbrace":"}","\\lbrace":"{","\\}":"}","\\{":"{","\\rceil":"\u2309","\\lceil":"\u2308","\\rfloor":"\u230b","\\lfloor":"\u230a","\\lbrack":"[","\\rbrack":"]"}),new za("macros",{displaystyle:[Il.SetStyle,"D",!0,0],textstyle:[Il.SetStyle,"T",!1,0],scriptstyle:[Il.SetStyle,"S",!1,1],scriptscriptstyle:[Il.SetStyle,"SS",!1,2],rm:[Il.SetFont,Pl.NORMAL],mit:[Il.SetFont,Pl.ITALIC],oldstyle:[Il.SetFont,Pl.OLDSTYLE],cal:[Il.SetFont,Pl.CALLIGRAPHIC],it:[Il.SetFont,Pl.MATHITALIC],bf:[Il.SetFont,Pl.BOLD],sf:[Il.SetFont,Pl.SANSSERIF],tt:[Il.SetFont,Pl.MONOSPACE],frak:[Il.MathFont,Pl.FRAKTUR],Bbb:[Il.MathFont,Pl.DOUBLESTRUCK],mathrm:[Il.MathFont,Pl.NORMAL],mathup:[Il.MathFont,Pl.NORMAL],mathnormal:[Il.MathFont,""],mathbf:[Il.MathFont,Pl.BOLD],mathbfup:[Il.MathFont,Pl.BOLD],mathit:[Il.MathFont,Pl.MATHITALIC],mathbfit:[Il.MathFont,Pl.BOLDITALIC],mathbb:[Il.MathFont,Pl.DOUBLESTRUCK],mathfrak:[Il.MathFont,Pl.FRAKTUR],mathbffrak:[Il.MathFont,Pl.BOLDFRAKTUR],mathscr:[Il.MathFont,Pl.SCRIPT],mathbfscr:[Il.MathFont,Pl.BOLDSCRIPT],mathsf:[Il.MathFont,Pl.SANSSERIF],mathsfup:[Il.MathFont,Pl.SANSSERIF],mathbfsf:[Il.MathFont,Pl.BOLDSANSSERIF],mathbfsfup:[Il.MathFont,Pl.BOLDSANSSERIF],mathsfit:[Il.MathFont,Pl.SANSSERIFITALIC],mathbfsfit:[Il.MathFont,Pl.SANSSERIFBOLDITALIC],mathtt:[Il.MathFont,Pl.MONOSPACE],mathcal:[Il.MathFont,Pl.CALLIGRAPHIC],mathbfcal:[Il.MathFont,Pl.BOLDCALLIGRAPHIC],symrm:[Il.MathFont,Pl.NORMAL],symup:[Il.MathFont,Pl.NORMAL],symnormal:[Il.MathFont,""],symbf:[Il.MathFont,Pl.BOLD,Pl.BOLDITALIC],symbfup:[Il.MathFont,Pl.BOLD],symit:[Il.MathFont,Pl.ITALIC],symbfit:[Il.MathFont,Pl.BOLDITALIC],symbb:[Il.MathFont,Pl.DOUBLESTRUCK],symfrak:[Il.MathFont,Pl.FRAKTUR],symbffrak:[Il.MathFont,Pl.BOLDFRAKTUR],symscr:[Il.MathFont,Pl.SCRIPT],symbfscr:[Il.MathFont,Pl.BOLDSCRIPT],symsf:[Il.MathFont,Pl.SANSSERIF,Pl.SANSSERIFITALIC],symsfup:[Il.MathFont,Pl.SANSSERIF],symbfsf:[Il.MathFont,Pl.BOLDSANSSERIF],symbfsfup:[Il.MathFont,Pl.BOLDSANSSERIF],symsfit:[Il.MathFont,Pl.SANSSERIFITALIC],symbfsfit:[Il.MathFont,Pl.SANSSERIFBOLDITALIC],symtt:[Il.MathFont,Pl.MONOSPACE],symcal:[Il.MathFont,Pl.CALLIGRAPHIC],symbfcal:[Il.MathFont,Pl.BOLDCALLIGRAPHIC],textrm:[Il.HBox,null,Pl.NORMAL],textup:[Il.HBox,null,Pl.NORMAL],textnormal:[Il.HBox],textit:[Il.HBox,null,Pl.ITALIC],textbf:[Il.HBox,null,Pl.BOLD],textsf:[Il.HBox,null,Pl.SANSSERIF],texttt:[Il.HBox,null,Pl.MONOSPACE],Tiny:[Il.SetSize,.5],tiny:[Il.SetSize,.6],scriptsize:[Il.SetSize,.7],SMALL:[Il.SetSize,.7],Small:[Il.SetSize,.8],footnotesize:[Il.SetSize,.8],small:[Il.SetSize,.9],normalsize:[Il.SetSize,1],large:[Il.SetSize,1.095],Large:[Il.SetSize,1.2],LARGE:[Il.SetSize,1.44],huge:[Il.SetSize,1.728],Huge:[Il.SetSize,2.074],HUGE:[Il.SetSize,2.49],arcsin:Il.NamedFn,arccos:Il.NamedFn,arctan:Il.NamedFn,arg:Il.NamedFn,cos:Il.NamedFn,cosh:Il.NamedFn,cot:Il.NamedFn,coth:Il.NamedFn,csc:Il.NamedFn,deg:Il.NamedFn,det:Il.NamedOp,dim:Il.NamedFn,exp:Il.NamedFn,gcd:Il.NamedOp,hom:Il.NamedFn,inf:Il.NamedOp,ker:Il.NamedFn,lg:Il.NamedFn,lim:Il.NamedOp,liminf:[Il.NamedOp,"lim inf"],limsup:[Il.NamedOp,"lim sup"],ln:Il.NamedFn,log:Il.NamedFn,max:Il.NamedOp,min:Il.NamedOp,Pr:Il.NamedOp,sec:Il.NamedFn,sin:Il.NamedFn,sinh:Il.NamedFn,sup:Il.NamedOp,tan:Il.NamedFn,tanh:Il.NamedFn,limits:[Il.Limits,!0],nolimits:[Il.Limits,!1],overline:[Il.UnderOver,"2015"],underline:[Il.UnderOver,"2015"],overbrace:[Il.UnderOver,"23DE",!0],underbrace:[Il.UnderOver,"23DF",!0],overparen:[Il.UnderOver,"23DC"],underparen:[Il.UnderOver,"23DD"],overrightarrow:[Il.UnderOver,"2192"],underrightarrow:[Il.UnderOver,"2192"],overleftarrow:[Il.UnderOver,"2190"],underleftarrow:[Il.UnderOver,"2190"],overleftrightarrow:[Il.UnderOver,"2194"],underleftrightarrow:[Il.UnderOver,"2194"],overset:Il.Overset,underset:Il.Underset,overunderset:Il.Overunderset,stackrel:[Il.Macro,"\\mathrel{\\mathop{#2}\\limits^{#1}}",2],stackbin:[Il.Macro,"\\mathbin{\\mathop{#2}\\limits^{#1}}",2],over:Il.Over,overwithdelims:Il.Over,atop:Il.Over,atopwithdelims:Il.Over,above:Il.Over,abovewithdelims:Il.Over,brace:[Il.Over,"{","}"],brack:[Il.Over,"[","]"],choose:[Il.Over,"(",")"],frac:Il.Frac,sqrt:Il.Sqrt,root:Il.Root,uproot:[Il.MoveRoot,"upRoot"],leftroot:[Il.MoveRoot,"leftRoot"],left:Il.LeftRight,right:Il.LeftRight,middle:Il.LeftRight,llap:Il.Lap,rlap:Il.Lap,raise:Il.RaiseLower,lower:Il.RaiseLower,moveleft:Il.MoveLeftRight,moveright:Il.MoveLeftRight,",":[Il.Spacer,bo.thinmathspace],":":[Il.Spacer,bo.mediummathspace],">":[Il.Spacer,bo.mediummathspace],";":[Il.Spacer,bo.thickmathspace],"!":[Il.Spacer,bo.negativethinmathspace],enspace:[Il.Spacer,.5],quad:[Il.Spacer,1],qquad:[Il.Spacer,2],thinspace:[Il.Spacer,bo.thinmathspace],negthinspace:[Il.Spacer,bo.negativethinmathspace],"*":Il.DiscretionaryTimes,allowbreak:Il.AllowBreak,goodbreak:[Il.Linebreak,$o.LineBreak.GOODBREAK],badbreak:[Il.Linebreak,$o.LineBreak.BADBREAK],nobreak:[Il.Linebreak,$o.LineBreak.NOBREAK],break:Il.Break,hskip:Il.Hskip,hspace:Il.Hskip,kern:[Il.Hskip,!0],mskip:Il.Hskip,mspace:Il.Hskip,mkern:[Il.Hskip,!0],rule:Il.rule,Rule:[Il.Rule],Space:[Il.Rule,"blank"],nonscript:Il.Nonscript,big:[Il.MakeBig,fr.ORD,.85],Big:[Il.MakeBig,fr.ORD,1.15],bigg:[Il.MakeBig,fr.ORD,1.45],Bigg:[Il.MakeBig,fr.ORD,1.75],bigl:[Il.MakeBig,fr.OPEN,.85],Bigl:[Il.MakeBig,fr.OPEN,1.15],biggl:[Il.MakeBig,fr.OPEN,1.45],Biggl:[Il.MakeBig,fr.OPEN,1.75],bigr:[Il.MakeBig,fr.CLOSE,.85],Bigr:[Il.MakeBig,fr.CLOSE,1.15],biggr:[Il.MakeBig,fr.CLOSE,1.45],Biggr:[Il.MakeBig,fr.CLOSE,1.75],bigm:[Il.MakeBig,fr.REL,.85],Bigm:[Il.MakeBig,fr.REL,1.15],biggm:[Il.MakeBig,fr.REL,1.45],Biggm:[Il.MakeBig,fr.REL,1.75],mathord:[Il.TeXAtom,fr.ORD],mathop:[Il.TeXAtom,fr.OP],mathopen:[Il.TeXAtom,fr.OPEN],mathclose:[Il.TeXAtom,fr.CLOSE],mathbin:[Il.TeXAtom,fr.BIN],mathrel:[Il.TeXAtom,fr.REL],mathpunct:[Il.TeXAtom,fr.PUNCT],mathinner:[Il.TeXAtom,fr.INNER],vtop:[Il.VBox,"top"],vcenter:[Il.VBox,"center"],vbox:[Il.VBox,"bottom"],hsize:Il.Hsize,parbox:Il.ParBox,breakAlign:Il.BreakAlign,buildrel:Il.BuildRel,hbox:[Il.HBox,0],text:Il.HBox,mbox:[Il.HBox,0],fbox:Il.FBox,boxed:[Il.Macro,"\\fbox{$\\displaystyle{#1}$}",1],framebox:Il.FrameBox,makebox:Il.MakeBox,strut:Il.Strut,mathstrut:[Il.Macro,"\\vphantom{(}"],phantom:Il.Phantom,vphantom:[Il.Phantom,1,0],hphantom:[Il.Phantom,0,1],smash:Il.Smash,acute:[Il.Accent,"00B4"],grave:[Il.Accent,"0060"],ddot:[Il.Accent,"00A8"],dddot:[Il.Accent,"20DB"],ddddot:[Il.Accent,"20DC"],tilde:[Il.Accent,"007E"],bar:[Il.Accent,"00AF"],breve:[Il.Accent,"02D8"],check:[Il.Accent,"02C7"],hat:[Il.Accent,"005E"],vec:[Il.Accent,"2192",!1],dot:[Il.Accent,"02D9"],widetilde:[Il.Accent,"007E",!0],widehat:[Il.Accent,"005E",!0],matrix:Il.Matrix,array:Il.Matrix,pmatrix:[Il.Matrix,"(",")"],cases:[Il.Matrix,"{","","left left",null,".2em",null,!0],eqalign:[Il.Matrix,null,null,"right left",Dl,".5em","D"],displaylines:[Il.Matrix,null,null,"center",null,".5em","D"],cr:Il.Cr,"\\":Il.CrLaTeX,newline:[Il.CrLaTeX,!0],hline:Il.HLine,hdashline:[Il.HLine,"dashed"],eqalignno:[Il.Matrix,null,null,"right left",Dl,".5em","D",null,"right"],leqalignno:[Il.Matrix,null,null,"right left",Dl,".5em","D",null,"left"],hfill:Il.HFill,hfil:Il.HFill,hfilll:Il.HFill,bmod:[Il.Macro,`\\mmlToken{mo}[lspace="${Dl}" rspace="${Dl}"]{mod}`],pmod:[Il.Macro,"\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}",1],mod:[Il.Macro,"\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1",1],pod:[Il.Macro,"\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)",1],iff:[Il.Macro,"\\;\\Longleftrightarrow\\;"],skew:[Il.Macro,"{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}",3],pmb:[Il.Macro,"\\rlap{#1}\\kern1px{#1}",1],TeX:[Il.Macro,"T\\kern-.14em\\lower.5ex{E}\\kern-.115em X"],LaTeX:[Il.Macro,"L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX"],not:Il.Not,dots:Il.Dots,space:Il.Tilde,"\xa0":Il.Tilde," ":Il.Tilde,begin:Il.BeginEnd,end:Il.BeginEnd,label:Il.HandleLabel,ref:Il.HandleRef,nonumber:Il.HandleNoTag,newcolumntype:Il.NewColumnType,mathchoice:Il.MathChoice,mmlToken:Il.MmlToken}),new qa("environment",Ol.environment,{displaymath:[Il.Equation,null,!1],math:[Il.Equation,null,!1,!1],array:[Il.AlignedArray],darray:[Il.AlignedArray,null,"D"],equation:[Il.Equation,null,!0],eqnarray:[Il.EqnArray,null,!0,!0,"rcl","bmt",Na.cols(0,bo.thickmathspace),".5em"],indentalign:[Il.IndentAlign]}),new Ua("not_remap",null,{"\u2190":"\u219a","\u2192":"\u219b","\u2194":"\u21ae","\u21d0":"\u21cd","\u21d2":"\u21cf","\u21d4":"\u21ce","\u2208":"\u2209","\u220b":"\u220c","\u2223":"\u2224","\u2225":"\u2226","\u223c":"\u2241","~":"\u2241","\u2243":"\u2244","\u2245":"\u2247","\u2248":"\u2249","\u224d":"\u226d","=":"\u2260","\u2261":"\u2262","<":"\u226e",">":"\u226f","\u2264":"\u2270","\u2265":"\u2271","\u2272":"\u2274","\u2273":"\u2275","\u2276":"\u2278","\u2277":"\u2279","\u227a":"\u2280","\u227b":"\u2281","\u2282":"\u2284","\u2283":"\u2285","\u2286":"\u2288","\u2287":"\u2289","\u22a2":"\u22ac","\u22a8":"\u22ad","\u22a9":"\u22ae","\u22ab":"\u22af","\u227c":"\u22e0","\u227d":"\u22e1","\u2291":"\u22e2","\u2292":"\u22e3","\u22b2":"\u22ea","\u22b3":"\u22eb","\u22b4":"\u22ec","\u22b5":"\u22ed","\u2203":"\u2204"});const Bl=$o.Variant;function Fl(t,e){const s=t.stack.env.font,i=t.stack.env.italicFont,r=s?{mathvariant:s}:{},n=Xa.getMap("remap").lookup(e),o=Dr(e),a=o[3],l=t.create("token",a,r,n?n.char:e),c=Na.isLatinOrGreekChar(e)?t.configuration.mathStyle(e,!0)||i:"",h=o[4]||(s&&c===Bl.NORMAL?"":c);h&&l.attributes.set("mathvariant",h),"mo"===a&&(Ko.setProperty(l,"fixStretchy",!0),t.configuration.addNode("fixStretchy",l)),t.Push(l)}new Ua("remap",null,{"-":"\u2212","*":"\u2217","`":"\u2018"});class jl extends Ra{}const _l=Ka.create("base",{[ia.CONFIG]:function(t,e){const s=e.parseOptions.options;s.digits&&(s.numberPattern=s.digits),new ja("digit",Ol.digit,s.initialDigit),new ja("letter",Ol.variable,s.initialLetter);t.handlers.get(ra.CHARACTER).add(["letter","digit"],null,4)},[ia.HANDLER]:{[ra.CHARACTER]:["command","special"],[ra.DELIMITER]:["delimiter"],[ra.MACRO]:["delimiter","macros","lcGreek","ucGreek","mathchar0mi","mathchar0mo","mathchar7"],[ra.ENVIRONMENT]:["environment"]},[ia.FALLBACK]:{[ra.CHARACTER]:Fl,[ra.MACRO]:function(t,e){throw new ca("UndefinedControlSequence","Undefined control sequence %1","\\"+e)},[ra.ENVIRONMENT]:function(t,e){throw new ca("UnknownEnv","Unknown environment '%1'",e)}},[ia.ITEMS]:{[Za.prototype.kind]:Za,[tl.prototype.kind]:tl,[el.prototype.kind]:el,[sl.prototype.kind]:sl,[il.prototype.kind]:il,[rl.prototype.kind]:rl,[nl.prototype.kind]:nl,[ol.prototype.kind]:ol,[al.prototype.kind]:al,[ll.prototype.kind]:ll,[cl.prototype.kind]:cl,[hl.prototype.kind]:hl,[dl.prototype.kind]:dl,[ul.prototype.kind]:ul,[pl.prototype.kind]:pl,[ml.prototype.kind]:ml,[fl.prototype.kind]:fl,[gl.prototype.kind]:gl,[bl.prototype.kind]:bl,[El.prototype.kind]:El,[xl.prototype.kind]:xl,[yl.prototype.kind]:yl,[Nl.prototype.kind]:Nl,[vl.prototype.kind]:vl,[Cl.prototype.kind]:Cl,[Tl.prototype.kind]:Tl},[ia.OPTIONS]:{maxMacros:1e3,digits:"",numberPattern:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,initialDigit:/[0-9.,]/,identifierPattern:/^[a-zA-Z]+/,initialLetter:/[a-zA-Z]/,baseURL:pi.document&&0!==pi.document.getElementsByTagName("base").length?String(pi.document.location).replace(/#.*$/,""):""},[ia.TAGS]:{base:jl},[ia.POSTPROCESSORS]:[[function({data:t}){for(const e of t.getList("nonscript"))if(e.attributes.get("scriptlevel")>0){const s=e.parent;if(s.childNodes.splice(s.childIndex(e),1),t.removeFromList(e.kind,[e]),e.isKind("mrow")){const s=e.childNodes[0];t.removeFromList("mstyle",[s]),t.removeFromList("mspace",s.childNodes[0].childNodes)}}else e.isKind("mrow")&&(e.parent.replaceChild(e.childNodes[0],e),t.removeFromList("mrow",[e]))},-4]]});class Ul extends Zi{static configure(t){const e=new Qa(t,["tex"]);return e.init(),e}static tags(t,e){Oa.addTags(e.tags),Oa.setDefault(t.options.tags),t.tags=Oa.getDefault(),t.tags.configuration=t}constructor(t={}){const[e,s,i]=Ui(t,Ul.OPTIONS,Go.OPTIONS);super(s),this.findTeX=this.options.FindTeX||new Go(i);const r=this.options.packages,n=this.configuration=Ul.configure(r),o=this._parseOptions=new Aa(n,[this.options,Oa.OPTIONS]);Fi(o.options,e),n.config(this),Ul.tags(o,n),this.postFilters.addList([[sa.cleanSubSup,-7],[sa.setInherited,-6],[sa.checkScriptlevel,-5],[sa.moveLimits,-4],[sa.cleanStretchy,-3],[sa.cleanAttributes,-2],[sa.combineRelations,-1]])}setMmlFactory(t){super.setMmlFactory(t),this._parseOptions.nodeFactory.setMmlFactory(t)}get parseOptions(){return this._parseOptions}reset(t=0){this.parseOptions.tags.reset(t)}compile(t,e){let s,i;this.parseOptions.clear(),this.parseOptions.mathItem=t,this.executeFilters(this.preFilters,t,e,this.parseOptions),this.latex=t.math,this.parseOptions.tags.startEquation(t);try{i=new ua(this.latex,{display:t.display,isInner:!1},this.parseOptions),s=i.mml()}catch(t){if(!(t instanceof ca))throw t;this.parseOptions.error=!0,s=this.options.formatError(this,t)}return s=this.parseOptions.nodeFactory.create("node","math",[s]),s.attributes.set($o.Attr.LATEX,this.latex),t.display&&Ko.setAttribute(s,"display","block"),this.parseOptions.tags.finishEquation(t),this.parseOptions.root=s,this.executeFilters(this.postFilters,t,e,this.parseOptions),i&&i.stack.env.hsize&&(Ko.setAttribute(s,"maxwidth",i.stack.env.hsize),Ko.setAttribute(s,"overflow","linebreak")),this.mathNode=this.parseOptions.root,this.mathNode}findMath(t){return this.findTeX.findMath(t)}formatError(t){const e=t.message.replace(/\n.*/,"");return this.parseOptions.nodeFactory.create("error",e,t.id,this.latex)}}Ul.NAME="TeX",Ul.OPTIONS=Object.assign(Object.assign({},Zi.OPTIONS),{FindTeX:null,packages:["base"],maxBuffer:5120,maxTemplateSubtitutions:1e4,mathStyle:"TeX",formatError:(t,e)=>t.formatError(e)});class Hl extends Nl{constructor(t,...e){super(t),this.factory.configuration.tags.start("multline",!0,e[0])}get kind(){return"multline"}EndEntry(){this.table.length&&Na.fixInitialMO(this.factory.configuration,this.nodes);const t=this.getProperty("shove"),e=this.create("node","mtd",this.nodes,t?{columnalign:t}:{});this.setProperty("shove",null),this.row.push(e),this.Clear()}EndRow(){if(1!==this.row.length)throw new ca("MultlineRowsOneCol","The rows within the %1 environment must have exactly one column","multline");const t=this.create("node","mtr",this.row);this.table.push(t),this.row=[]}EndTable(){if(super.EndTable(),this.table.length){const t=this.table.length-1;let e=-1;Ko.getAttribute(Ko.getChildren(this.table[0])[0],"columnalign")||Ko.setAttribute(Ko.getChildren(this.table[0])[0],"columnalign",$o.Align.LEFT),Ko.getAttribute(Ko.getChildren(this.table[t])[0],"columnalign")||Ko.setAttribute(Ko.getChildren(this.table[t])[0],"columnalign",$o.Align.RIGHT);const s=this.factory.configuration.tags.getTag();if(s){e=this.arraydef.side===$o.Align.LEFT?0:this.table.length-1;const t=this.table[e],i=this.create("node","mlabeledtr",[s].concat(Ko.getChildren(t)));Ko.copyAttributes(t,i),this.table[e]=i}}this.factory.configuration.tags.end()}}class Wl extends vl{get kind(){return"flalign"}constructor(t,e,s,i,r){super(t),this.name=e,this.numbered=s,this.padded=i,this.center=r,this.factory.configuration.tags.start(e,s,s)}EndEntry(){super.EndEntry();const t=this.getProperty("xalignat");if(t&&this.row.length>t)throw new ca("XalignOverflow","Extra %1 in row of %2","&",this.name)}EndRow(){let t;const e=this.row,s=this.getProperty("xalignat");for(;e.lengththis.maxrow&&(this.maxrow=this.row.length),super.EndRow();const i=this.table[this.table.length-1];if(this.getProperty("zeroWidthLabel")&&i.isKind("mlabeledtr")){const t=Ko.getChildren(i)[0],e=this.factory.configuration.options.tagSide,s=Object.assign({width:0},"right"===e?{lspace:"-1width"}:{}),r=this.create("node","mpadded",Ko.getChildren(t),s);t.setChildren([r])}}EndTable(){if(super.EndTable(),this.center&&this.maxrow<=2){delete this.arraydef.width,delete this.global.indentalign}}}var zl;!function(t){t.NEW_DELIMITER="new-Delimiter",t.NEW_COMMAND="new-Command",t.NEW_ENVIRONMENT="new-Environment"}(zl||(zl={}));const ql=-100,Vl={GetCSname(t,e){if("\\"!==t.GetNext())throw new ca("MissingCS","%1 must be followed by a control sequence",e);const s=oa.trimSpaces(t.GetArgument(e)).substring(1);return this.checkProtectedMacros(t,s),s},GetCsNameArgument(t,e){let s=oa.trimSpaces(t.GetArgument(e));if("\\"===s.charAt(0)&&(s=s.substring(1)),!s.match(/^(.|[a-z]+)$/i))throw new ca("IllegalControlSequenceName","Illegal control sequence name for %1",e);return this.checkProtectedMacros(t,s),s},GetArgCount(t,e){let s=t.GetBrackets(e);if(s&&(s=oa.trimSpaces(s),!s.match(/^[0-9]+$/)))throw new ca("IllegalParamNumber","Illegal number of parameters specified in %1",e);return s},GetTemplate(t,e,s){let i=t.GetNext();const r=[];let n=0,o=t.i;for(;t.i0?[n.toString()].concat(r):n;t.i++}throw new ca("MissingReplacementString","Missing replacement string for definition of %1",e)},GetParameter(t,e,s){if(null==s)return t.GetArgument(e);let i=t.i,r=0,n=!1;for(;t.it.string.substring(t.i,t.i+e.length)!==e||e.match(/\\[a-z]+$/i)&&t.string.charAt(t.i+e.length).match(/[a-z]/i)?0:(t.i+=e.length,1),checkGlobal:(t,e,s)=>t.stack.env.isGlobal?t.configuration.packageData.get("begingroup").stack.checkGlobal(e,s):s.map(e=>t.configuration.handlers.retrieve(e)),checkProtectedMacros(t,e){var s;if(null===(s=t.options.protectedMacros)||void 0===s?void 0:s.includes(e))throw new ca("ProtectedMacro","The control sequence %1 can't be redefined",`\\${e}`)},addDelimiter(t,e,s,i){const r=e.substring(1);this.checkProtectedMacros(t,r);const[n,o]=Vl.checkGlobal(t,[r,e],[zl.NEW_COMMAND,zl.NEW_DELIMITER]);r!==e&&n.remove(r),o.add(e,new Da(e,s,i)),delete t.stack.env.isGlobal},addMacro(t,e,s,i,r=""){this.checkProtectedMacros(t,e);const n=Vl.checkGlobal(t,[e],[zl.NEW_COMMAND])[0];this.undefineDelimiter(t,"\\"+e),n.add(e,new Pa(r||e,s,i)),delete t.stack.env.isGlobal},addEnvironment(t,e,s,i){Vl.checkGlobal(t,[e],[zl.NEW_ENVIRONMENT])[0].add(e,new Pa(e,s,i)),delete t.stack.env.isGlobal},undefineMacro(t,e){const s=Vl.checkGlobal(t,[e],[zl.NEW_COMMAND])[0];s.remove(e),t.configuration.handlers.get(ra.MACRO).applicable(e)&&(s.add(e,new Pa(e,()=>Ga.FALLBACK,[])),this.undefineDelimiter(t,"\\"+e)),delete t.stack.env.isGlobal},undefineDelimiter(t,e){const s=Vl.checkGlobal(t,[e],[zl.NEW_DELIMITER])[0];s.remove(e),t.configuration.handlers.get(ra.DELIMITER).applicable(e)&&s.add(e,new Da(e,null,{})),delete t.stack.env.isGlobal}};function Xl(t){if(!t||t.isInferred&&0===t.childNodes.length)return[null,null];if(t.isKind("msubsup")&&Gl(t))return[t,null];const e=Ko.getChildAt(t,0);return t.isInferred&&e&&Gl(e)?(t.childNodes.splice(0,1),[e,t]):[null,t]}function Gl(t){const e=t.childNodes[0];return e&&e.isKind("mi")&&""===e.getText()}const Jl={AmsEqnArray(t,e,s,i,r,n,o,a){const l=t.GetBrackets("\\begin{"+e.getName()+"}"),c=Il.EqnArray(t,e,s,i,r,n,o,a);return Na.setArrayAlign(c,l,t)},AlignAt(t,e,s,i){const r=e.getName();let n,o="",a="";const l=[];i||(n=t.GetBrackets("\\begin{"+r+"}"));const c=t.GetArgument("\\begin{"+r+"}");if(c.match(/[^0-9]/))throw new ca("PositiveIntegerArg","Argument to %1 must be a positive integer","\\begin{"+r+"}");let h=parseInt(c,10);for(;h>0;)o+="rl",a+="bt",l.push("0em 0em"),h--;const d=l.join(" ");if(i)return Jl.EqnArray(t,e,s,i,o,a,d);const u=Jl.EqnArray(t,e,s,i,o,a,d);return Na.setArrayAlign(u,n,t)},Multline(t,e,s){Na.checkEqnEnv(t),t.Push(e);const i=t.options.ams.multlineIndent,r=t.itemFactory.create("multline",s,t.stack);return r.arraydef={displaystyle:!0,rowspacing:".5em",columnspacing:"100%",width:t.options.ams.multlineWidth,side:t.options.tagSide,minlabelspacing:t.options.tagIndent,"data-array-padding":`${i} ${i}`,"data-width-includes-label":!0},r},XalignAt(t,e,s,i){const r=t.GetArgument("\\begin{"+e.getName()+"}");if(r.match(/[^0-9]/))throw new ca("PositiveIntegerArg","Argument to %1 must be a positive integer","\\begin{"+e.getName()+"}");const n=i?"crl":"rlc",o=i?"mbt":"btm",a=i?"fit auto auto":"auto auto fit",l=Jl.FlalignArray(t,e,s,i,!1,n,o,a,!0);return l.setProperty("xalignat",2*parseInt(r)),l},FlalignArray(t,e,s,i,r,n,o,a,l=!1){Na.checkEqnEnv(t),t.Push(e),n=n.split("").join(" ").replace(/r/g,"right").replace(/l/g,"left").replace(/c/g,"center"),o=Sl(o);const c=t.itemFactory.create("flalign",e.getName(),s,i,r,t.stack);return c.arraydef={width:"100%",displaystyle:!0,columnalign:n,columnspacing:"0em",columnwidth:a,rowspacing:"3pt","data-break-align":o,side:t.options.tagSide,minlabelspacing:l?"0":t.options.tagIndent,"data-width-includes-label":!0},c.setProperty("zeroWidthLabel",l),c},HandleDeclareOp(t,e){const s=t.GetStar()?"*":"",i=Vl.GetCsNameArgument(t,e),r=t.GetArgument(e);Vl.addMacro(t,i,Jl.Macro,[`\\operatorname${s}{${r}}`]),t.Push(t.itemFactory.create("null"))},HandleOperatorName(t,e){const s=t.GetStar(),i=oa.trimSpaces(t.GetArgument(e));let r=new ua(i,Object.assign(Object.assign({},t.stack.env),{font:$o.Variant.NORMAL,multiLetterIdentifiers:t.options.ams.operatornamePattern,operatorLetters:!0,noAutoOP:!0}),t.configuration).mml();if(r.isKind("mi")?r.removeProperty("autoOP"):r=t.create("node","TeXAtom",[r]),Ko.setProperties(r,{movesupsub:s,movablelimits:!0,texClass:fr.OP}),!s){const e=t.GetNext(),s=t.i;"\\"===e&&++t.i&&"limits"!==t.GetCS()&&(t.i=s)}t.Push(t.itemFactory.create("fn",r))},SideSet(t,e){const[s,i]=Xl(t.ParseArg(e)),[r,n]=Xl(t.ParseArg(e)),o=t.ParseArg(e);let a=o;s&&(i?s.replaceChild(t.create("node","mphantom",[t.create("node","mpadded",[Na.copyNode(o,t)],{width:0})]),Ko.getChildAt(s,0)):(a=t.create("node","mmultiscripts",[o]),r&&Ko.appendChildren(a,[Ko.getChildAt(r,1)||t.create("node","none"),Ko.getChildAt(r,2)||t.create("node","none")]),Ko.setProperty(a,"scriptalign","left"),Ko.appendChildren(a,[t.create("node","mprescripts"),Ko.getChildAt(s,1)||t.create("node","none"),Ko.getChildAt(s,2)||t.create("node","none")]))),r&&a===o&&(r.replaceChild(o,Ko.getChildAt(r,0)),a=r);const l=t.create("node","TeXAtom",[],{texClass:fr.OP,movesupsub:!0,movablelimits:!0});i&&(s&&l.appendChild(s),l.appendChild(i)),l.appendChild(a),n&&l.appendChild(n),t.Push(l)},operatorLetter:(t,e)=>!!t.stack.env.operatorLetters&&Ol.variable(t,e),MultiIntegral(t,e,s){let i=t.GetNext();if("\\"===i){const r=t.i;i=t.GetArgument(e),t.i=r,"\\limits"===i&&(s="\\!\\!\\mathop{\\,\\,"+s+"}")}t.string=s+" "+t.string.slice(t.i),t.i=0},xArrow(t,e,s,i,r,n=0){const o={width:"+"+oa.em((i+r)/18),lspace:oa.em(i/18)},a=t.GetBrackets(e),l=t.ParseArg(e),c=t.create("node","mspace",[],{depth:".2em"});let h=t.create("token","mo",{stretchy:!0,texClass:fr.ORD},String.fromCodePoint(s));n&&h.attributes.set("minsize",oa.em(n)),h=t.create("node","mstyle",[h],{scriptlevel:0});const d=t.create("node","munderover",[h]);let u=t.create("node","mpadded",[l,c],o);if(Ko.setAttribute(u,"voffset","-.2em"),Ko.setAttribute(u,"height","-.2em"),Ko.setChild(d,d.over,u),a){const e=new ua(a,t.stack.env,t.configuration).mml(),s=t.create("node","mspace",[],{height:".75em"});u=t.create("node","mpadded",[e,s],o),Ko.setAttribute(u,"voffset",".15em"),Ko.setAttribute(u,"depth","-.15em"),Ko.setChild(d,d.under,u)}Ko.setProperty(d,"subsupOK",!0),t.Push(t.create("node","TeXAtom",[t.create("node","TeXAtom",[],{texClass:fr.NONE}),d],{texClass:fr.REL}))},HandleShove(t,e,s){const i=t.stack.Top();if("multline"!==i.kind)throw new ca("CommandOnlyAllowedInEnv","%1 only allowed in %2 environment",t.currentCS,"multline");if(i.Size())throw new ca("CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",t.currentCS);i.setProperty("shove",s)},CFrac(t,e){let s=oa.trimSpaces(t.GetBrackets(e,""));const i=t.GetArgument(e),r=t.GetArgument(e),n={l:$o.Align.LEFT,r:$o.Align.RIGHT,"":""},o=new ua("\\strut\\textstyle{"+i+"}",t.stack.env,t.configuration).mml(),a=new ua("\\strut\\textstyle{"+r+"}",t.stack.env,t.configuration).mml(),l=t.create("node","mfrac",[o,a]);if(s=n[s],null==s)throw new ca("IllegalAlign","Illegal alignment specified in %1",t.currentCS);s&&Ko.setProperties(l,{numalign:s,denomalign:s}),t.Push(l)},Genfrac(t,e,s,i,r,n){null==s&&(s=t.GetDelimiterArg(e)),null==i&&(i=t.GetDelimiterArg(e)),null==r&&(r=t.GetArgument(e)),null==n&&(n=oa.trimSpaces(t.GetArgument(e)));const o=t.ParseArg(e),a=t.ParseArg(e);let l=t.create("node","mfrac",[o,a]);if(""!==r&&Ko.setAttribute(l,"linethickness",r),(s||i)&&(Ko.setProperty(l,"withDelims",!0),l=Na.fixedFence(t.configuration,s,l,i)),""!==n){const e=parseInt(n,10),s=["D","T","S","SS"][e];if(null==s)throw new ca("BadMathStyleFor","Bad math style for %1",t.currentCS);l=t.create("node","mstyle",[l]),"D"===s?Ko.setProperties(l,{displaystyle:!0,scriptlevel:0}):Ko.setProperties(l,{displaystyle:!1,scriptlevel:e-1})}t.Push(l)},HandleTag(t,e){if(!t.tags.currentTag.taggable&&t.tags.env)throw new ca("CommandNotAllowedInEnv","%1 not allowed in %2 environment",t.currentCS,t.tags.env);if(t.tags.currentTag.tag)throw new ca("MultipleCommand","Multiple %1",t.currentCS);const s=t.GetStar(),i=oa.trimSpaces(t.GetArgument(e));t.tags.tag(i,s),t.Push(t.itemFactory.create("null"))},HandleNoTag:Il.HandleNoTag,HandleRef:Il.HandleRef,Macro:Il.Macro,Accent:Il.Accent,Tilde:Il.Tilde,Array:Il.Array,Spacer:Il.Spacer,NamedOp:Il.NamedOp,EqnArray:Il.EqnArray,Equation:Il.Equation};new Ua("AMSmath-mathchar0mo",Ol.mathchar0mo,{iiiint:["\u2a0c",{texClass:fr.OP}]}),new ja("AMSmath-operatorLetter",Jl.operatorLetter,/[-*]/i),new za("AMSmath-macros",{mathring:[Jl.Accent,"02DA"],nobreakspace:Jl.Tilde,negmedspace:[Jl.Spacer,bo.negativemediummathspace],negthickspace:[Jl.Spacer,bo.negativethickmathspace],idotsint:[Jl.MultiIntegral,"\\int\\cdots\\int"],dddot:[Jl.Accent,"20DB"],ddddot:[Jl.Accent,"20DC"],sideset:Jl.SideSet,boxed:[Jl.Macro,"\\fbox{$\\displaystyle{#1}$}",1],tag:Jl.HandleTag,notag:Jl.HandleNoTag,eqref:[Jl.HandleRef,!0],substack:[Jl.Macro,"\\begin{subarray}{c}#1\\end{subarray}",1],injlim:[Jl.NamedOp,"inj lim"],projlim:[Jl.NamedOp,"proj lim"],varliminf:[Jl.Macro,"\\mathop{\\underline{\\mmlToken{mi}{lim}}}"],varlimsup:[Jl.Macro,"\\mathop{\\overline{\\mmlToken{mi}{lim}}}"],varinjlim:[Jl.Macro,"\\mathop{\\underrightarrow{\\mmlToken{mi}{lim}}}"],varprojlim:[Jl.Macro,"\\mathop{\\underleftarrow{\\mmlToken{mi}{lim}}}"],DeclareMathOperator:Jl.HandleDeclareOp,operatorname:Jl.HandleOperatorName,genfrac:Jl.Genfrac,frac:[Jl.Genfrac,"","","",""],tfrac:[Jl.Genfrac,"","","","1"],dfrac:[Jl.Genfrac,"","","","0"],binom:[Jl.Genfrac,"(",")","0",""],tbinom:[Jl.Genfrac,"(",")","0","1"],dbinom:[Jl.Genfrac,"(",")","0","0"],cfrac:Jl.CFrac,shoveleft:[Jl.HandleShove,$o.Align.LEFT],shoveright:[Jl.HandleShove,$o.Align.RIGHT],xrightarrow:[Jl.xArrow,8594,5,10],xleftarrow:[Jl.xArrow,8592,10,5]}),new qa("AMSmath-environment",Ol.environment,{"equation*":[Jl.Equation,null,!1],"eqnarray*":[Jl.EqnArray,null,!1,!0,"rcl","bmt",Na.cols(0,bo.thickmathspace),".5em"],align:[Jl.EqnArray,null,!0,!0,"rl","bt",Na.cols(0,2)],"align*":[Jl.EqnArray,null,!1,!0,"rl","bt",Na.cols(0,2)],multline:[Jl.Multline,null,!0],"multline*":[Jl.Multline,null,!1],split:[Jl.EqnArray,null,!1,!1,"rl","bt",Na.cols(0)],gather:[Jl.EqnArray,null,!0,!0,"c","m"],"gather*":[Jl.EqnArray,null,!1,!0,"c","m"],alignat:[Jl.AlignAt,null,!0,!0],"alignat*":[Jl.AlignAt,null,!1,!0],alignedat:[Jl.AlignAt,null,!1,!1],aligned:[Jl.AmsEqnArray,null,null,null,"rl","bt",Na.cols(0,2),".5em","D"],gathered:[Jl.AmsEqnArray,null,null,null,"c","m",null,".5em","D"],xalignat:[Jl.XalignAt,null,!0,!0],"xalignat*":[Jl.XalignAt,null,!1,!0],xxalignat:[Jl.XalignAt,null,!1,!1],flalign:[Jl.FlalignArray,null,!0,!1,!0,"rlc","btm","auto auto fit"],"flalign*":[Jl.FlalignArray,null,!1,!1,!0,"rlc","btm","auto auto fit"],subarray:[Jl.Array,null,null,null,null,Na.cols(0),"0.1em","S",!0],smallmatrix:[Jl.Array,null,null,null,"c",Na.cols(1/3),".2em","S",!0],matrix:[Jl.Array,null,null,null,"c"],pmatrix:[Jl.Array,null,"(",")","c"],bmatrix:[Jl.Array,null,"[","]","c"],Bmatrix:[Jl.Array,null,"\\{","\\}","c"],vmatrix:[Jl.Array,null,"\\vert","\\vert","c"],Vmatrix:[Jl.Array,null,"\\Vert","\\Vert","c"],cases:[Jl.Array,null,"\\{",".","ll",null,".2em","T"]}),new Ha("AMSmath-delimiter",Ol.delimiter,{"\\lvert":["|",{texClass:fr.OPEN}],"\\rvert":["|",{texClass:fr.CLOSE}],"\\lVert":["\u2016",{texClass:fr.OPEN}],"\\rVert":["\u2016",{texClass:fr.CLOSE}]}),new Ua("AMSsymbols-mathchar0mi",Ol.mathchar0mi,{digamma:"\u03dd",varkappa:"\u03f0",varGamma:["\u0393",{mathvariant:$o.Variant.ITALIC}],varDelta:["\u0394",{mathvariant:$o.Variant.ITALIC}],varTheta:["\u0398",{mathvariant:$o.Variant.ITALIC}],varLambda:["\u039b",{mathvariant:$o.Variant.ITALIC}],varXi:["\u039e",{mathvariant:$o.Variant.ITALIC}],varPi:["\u03a0",{mathvariant:$o.Variant.ITALIC}],varSigma:["\u03a3",{mathvariant:$o.Variant.ITALIC}],varUpsilon:["\u03a5",{mathvariant:$o.Variant.ITALIC}],varPhi:["\u03a6",{mathvariant:$o.Variant.ITALIC}],varPsi:["\u03a8",{mathvariant:$o.Variant.ITALIC}],varOmega:["\u03a9",{mathvariant:$o.Variant.ITALIC}],beth:"\u2136",gimel:"\u2137",daleth:"\u2138",backprime:["\u2035",{variantForm:!0}],hslash:"\u210f",varnothing:["\u2205",{variantForm:!0}],blacktriangle:"\u25b4",triangledown:["\u25bd",{variantForm:!0}],blacktriangledown:"\u25be",square:"\u25fb",Box:"\u25fb",blacksquare:"\u25fc",lozenge:"\u25ca",Diamond:"\u25ca",blacklozenge:"\u29eb",circledS:["\u24c8",{mathvariant:$o.Variant.NORMAL}],bigstar:"\u2605",sphericalangle:"\u2222",measuredangle:"\u2221",nexists:"\u2204",complement:"\u2201",mho:"\u2127",eth:["\xf0",{mathvariant:$o.Variant.NORMAL}],Finv:"\u2132",diagup:"\u2571",Game:"\u2141",diagdown:"\u2572",Bbbk:["k",{mathvariant:$o.Variant.DOUBLESTRUCK}],yen:"\xa5",circledR:"\xae",checkmark:"\u2713",maltese:"\u2720"}),new Ua("AMSsymbols-mathchar0mo",Ol.mathchar0mo,{dotplus:"\u2214",ltimes:"\u22c9",smallsetminus:["\u2216",{variantForm:!0}],rtimes:"\u22ca",Cap:"\u22d2",doublecap:"\u22d2",leftthreetimes:"\u22cb",Cup:"\u22d3",doublecup:"\u22d3",rightthreetimes:"\u22cc",barwedge:"\u22bc",curlywedge:"\u22cf",veebar:"\u22bb",curlyvee:"\u22ce",doublebarwedge:"\u2a5e",boxminus:"\u229f",circleddash:"\u229d",boxtimes:"\u22a0",circledast:"\u229b",boxdot:"\u22a1",circledcirc:"\u229a",boxplus:"\u229e",centerdot:["\u22c5",{variantForm:!0}],divideontimes:"\u22c7",intercal:"\u22ba",leqq:"\u2266",geqq:"\u2267",leqslant:"\u2a7d",geqslant:"\u2a7e",eqslantless:"\u2a95",eqslantgtr:"\u2a96",lesssim:"\u2272",gtrsim:"\u2273",lessapprox:"\u2a85",gtrapprox:"\u2a86",approxeq:"\u224a",lessdot:"\u22d6",gtrdot:"\u22d7",lll:"\u22d8",llless:"\u22d8",ggg:"\u22d9",gggtr:"\u22d9",lessgtr:"\u2276",gtrless:"\u2277",lesseqgtr:"\u22da",gtreqless:"\u22db",lesseqqgtr:"\u2a8b",gtreqqless:"\u2a8c",doteqdot:"\u2251",Doteq:"\u2251",eqcirc:"\u2256",risingdotseq:"\u2253",circeq:"\u2257",fallingdotseq:"\u2252",triangleq:"\u225c",backsim:"\u223d",thicksim:["\u223c",{variantForm:!0}],backsimeq:"\u22cd",thickapprox:["\u2248",{variantForm:!0}],subseteqq:"\u2ac5",supseteqq:"\u2ac6",Subset:"\u22d0",Supset:"\u22d1",sqsubset:"\u228f",sqsupset:"\u2290",preccurlyeq:"\u227c",succcurlyeq:"\u227d",curlyeqprec:"\u22de",curlyeqsucc:"\u22df",precsim:"\u227e",succsim:"\u227f",precapprox:"\u2ab7",succapprox:"\u2ab8",vartriangleleft:"\u22b2",lhd:"\u22b2",vartriangleright:"\u22b3",rhd:"\u22b3",trianglelefteq:"\u22b4",unlhd:"\u22b4",trianglerighteq:"\u22b5",unrhd:"\u22b5",vDash:"\u22a8",Vdash:"\u22a9",Vvdash:"\u22aa",smallsmile:["\u2323",{variantForm:!0}],shortmid:["\u2223",{variantForm:!0}],smallfrown:["\u2322",{variantForm:!0}],shortparallel:["\u2225",{variantForm:!0}],bumpeq:"\u224f",between:"\u226c",Bumpeq:"\u224e",pitchfork:"\u22d4",varpropto:["\u221d",{variantForm:!0}],backepsilon:"\u220d",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",therefore:"\u2234",because:"\u2235",eqsim:"\u2242",vartriangle:["\u25b3",{variantForm:!0}],Join:"\u22c8",nless:"\u226e",ngtr:"\u226f",nleq:"\u2270",ngeq:"\u2271",nleqslant:["\u2a87",{variantForm:!0}],ngeqslant:["\u2a88",{variantForm:!0}],nleqq:["\u2270",{variantForm:!0}],ngeqq:["\u2271",{variantForm:!0}],lneq:"\u2a87",gneq:"\u2a88",lneqq:"\u2268",gneqq:"\u2269",lvertneqq:["\u2268",{variantForm:!0}],gvertneqq:["\u2269",{variantForm:!0}],lnsim:"\u22e6",gnsim:"\u22e7",lnapprox:"\u2a89",gnapprox:"\u2a8a",nprec:"\u2280",nsucc:"\u2281",npreceq:["\u22e0",{variantForm:!0}],nsucceq:["\u22e1",{variantForm:!0}],precneqq:"\u2ab5",succneqq:"\u2ab6",precnsim:"\u22e8",succnsim:"\u22e9",precnapprox:"\u2ab9",succnapprox:"\u2aba",nsim:"\u2241",ncong:"\u2247",nshortmid:["\u2224",{variantForm:!0}],nshortparallel:["\u2226",{variantForm:!0}],nmid:"\u2224",nparallel:"\u2226",nvdash:"\u22ac",nvDash:"\u22ad",nVdash:"\u22ae",nVDash:"\u22af",ntriangleleft:"\u22ea",ntriangleright:"\u22eb",ntrianglelefteq:"\u22ec",ntrianglerighteq:"\u22ed",nsubseteq:"\u2288",nsupseteq:"\u2289",nsubseteqq:["\u2288",{variantForm:!0}],nsupseteqq:["\u2289",{variantForm:!0}],subsetneq:"\u228a",supsetneq:"\u228b",varsubsetneq:["\u228a",{variantForm:!0}],varsupsetneq:["\u228b",{variantForm:!0}],subsetneqq:"\u2acb",supsetneqq:"\u2acc",varsubsetneqq:["\u2acb",{variantForm:!0}],varsupsetneqq:["\u2acc",{variantForm:!0}],leftleftarrows:"\u21c7",rightrightarrows:"\u21c9",leftrightarrows:"\u21c6",rightleftarrows:"\u21c4",Lleftarrow:"\u21da",Rrightarrow:"\u21db",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",leftarrowtail:"\u21a2",rightarrowtail:"\u21a3",looparrowleft:"\u21ab",looparrowright:"\u21ac",leftrightharpoons:"\u21cb",rightleftharpoons:["\u21cc",{variantForm:!0}],curvearrowleft:"\u21b6",curvearrowright:"\u21b7",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",Lsh:"\u21b0",Rsh:"\u21b1",upuparrows:"\u21c8",downdownarrows:"\u21ca",upharpoonleft:"\u21bf",upharpoonright:"\u21be",downharpoonleft:"\u21c3",restriction:"\u21be",multimap:"\u22b8",downharpoonright:"\u21c2",leftrightsquigarrow:"\u21ad",rightsquigarrow:"\u21dd",leadsto:"\u21dd",dashrightarrow:"\u21e2",dashleftarrow:"\u21e0",nleftarrow:"\u219a",nrightarrow:"\u219b",nLeftarrow:"\u21cd",nRightarrow:"\u21cf",nleftrightarrow:"\u21ae",nLeftrightarrow:"\u21ce"}),new Ha("AMSsymbols-delimiter",Ol.delimiter,{"\\ulcorner":"\u231c","\\urcorner":"\u231d","\\llcorner":"\u231e","\\lrcorner":"\u231f"}),new za("AMSsymbols-macros",{implies:[Jl.Macro,"\\;\\Longrightarrow\\;"],impliedby:[Jl.Macro,"\\;\\Longleftarrow\\;"]});class Kl extends da{get kind(){return"beginEnv"}get isOpen(){return!0}checkItem(t){if(t.isKind("end")){if(t.getName()!==this.getName())throw new ca("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 ca("EnvMissingEnd","Missing \\end{%1}",this.getName());return super.checkItem(t)}}const $l={NewCommand(t,e){const s=Vl.GetCsNameArgument(t,e),i=Vl.GetArgCount(t,e),r=t.GetBrackets(e),n=t.GetArgument(e);Vl.addMacro(t,s,$l.Macro,[n,i,r]),t.Push(t.itemFactory.create("null"))},NewEnvironment(t,e){const s=oa.trimSpaces(t.GetArgument(e)),i=Vl.GetArgCount(t,e),r=t.GetBrackets(e),n=t.GetArgument(e),o=t.GetArgument(e);Vl.addEnvironment(t,s,$l.BeginEnv,[!0,n,o,i,r]),t.Push(t.itemFactory.create("null"))},MacroDef(t,e){const s=Vl.GetCSname(t,e),i=Vl.GetTemplate(t,e,"\\"+s),r=t.GetArgument(e);i instanceof Array?Vl.addMacro(t,s,$l.MacroWithTemplate,[r].concat(i)):Vl.addMacro(t,s,$l.Macro,[r,i]),t.Push(t.itemFactory.create("null"))},Let(t,e){const s=Vl.GetCSname(t,e);let i=t.GetNext();"="===i&&(t.i++,i=t.GetNext());const r=t.configuration.handlers;if(t.Push(t.itemFactory.create("null")),"\\"===i){if(s===(e=Vl.GetCSname(t,e)))return;const i=r.get(ra.MACRO).applicable(e);if(i instanceof Wa){const r=i.lookup(e);return void Vl.addMacro(t,s,r.func,r.args,r.token)}if(i instanceof Ua&&!(i instanceof Ha)){const r=i.lookup(e),n=t=>i.parser(t,r);return void Vl.addMacro(t,s,n,[s,r.char])}const n=r.get(ra.DELIMITER).lookup("\\"+e);return n?void Vl.addDelimiter(t,"\\"+s,n.char,n.attributes):(Vl.checkProtectedMacros(t,s),Vl.undefineMacro(t,s),void Vl.undefineDelimiter(t,"\\"+s))}t.i++;const n=r.get(ra.DELIMITER).lookup(i);n?Vl.addDelimiter(t,"\\"+s,n.char,n.attributes):Vl.addMacro(t,s,$l.Macro,[i])},MacroWithTemplate(t,e,s,i,...r){const n=parseInt(i,10);if(r.length){const i=[];if(t.GetNext(),r[0]&&!Vl.MatchParam(t,r[0]))throw new ca("MismatchUseDef","Use of %1 doesn't match its definition",e);if(n){for(let s=0;src(t,e,r))):rc(t,e,r)}}function rc(t,e,s){const i=Ya.get(s);if(i){let r=sc[e]||{};i.options&&1===Object.keys(i.options).length&&i.options[s]&&(r={[s]:r}),t.configuration.add(s,t,r);const n=t.parseOptions.packageData.get("require").configured;i.preprocessors.length&&!n.has(s)&&(n.set(s,!0),to.retryAfter(Promise.resolve()))}}function nc(t,e){var s,i;const r=t.options.require,n=r.allow,o=("["===e.substring(0,1)?"":r.prefix)+e;if(!(Object.hasOwn(n,o)?n[o]:Object.hasOwn(n,e)?n[e]:r.defaultAllow))throw new ca("BadRequire",'Extension "%1" is not allowed to be loaded',o);const a=fi.packages.get(o);if(a||to.retryAfter(vi.load(o).catch(t=>{})),a.hasFailed)throw new ca("RequireFail",'Extension "%1" failed to load',e);const l=null===(s=Ci[o])||void 0===s?void 0:s.rendererExtensions,c=null===(i=qi.startup.document)||void 0===i?void 0:i.menu;l&&c&&c.addRequiredExtensions(l),ic(t.configuration.packageData.get("require").jax,o)}const oc={Require(t,e){const s=t.GetArgument(e);if(s.match(/[^_a-zA-Z0-9]/)||""===s)throw new ca("BadPackageName","Argument for %1 is not a valid package name",e);nc(t,s),t.Push(t.itemFactory.create("null"))}},ac={require:{allow:wi({base:!1,autoload:!1,configmacros:!1,tagformat:!1,setoptions:!1,texhtml:!1}),defaultAllow:!0,prefix:"tex"}};new za("require",{require:oc.Require});const lc=Ka.create("require",{[ia.HANDLER]:{[ra.MACRO]:["require"]},[ia.CONFIG]:function(t,e){e.parseOptions.packageData.set("require",{jax:e,required:[...e.options.packages],configured:new Map});const s=e.parseOptions.options.require,i=s.prefix;if(i.match(/[^_a-zA-Z0-9]/))throw Error("Illegal characters used in \\require prefix");Ci.paths[i]||(Ci.paths[i]="[mathjax]/input/tex/extensions"),s.prefix="["+i+"]/"},[ia.OPTIONS]:ac});function cc(t,e,s,i){if(fi.packages.has(t.options.require.prefix+s)){const r=t.options.autoload[s],[n,o]=2===r.length&&Array.isArray(r[0])?r:[r,[]];for(const t of n)hc.remove(t);for(const t of o)dc.remove(t);t.string=(i?e+" ":"\\begin{"+e.slice(1)+"}")+t.string.slice(t.i),t.i=0}nc(t,s)}const hc=new za("autoload-macros",{}),dc=new za("autoload-environments",{}),uc=Ka.create("autoload",{[ia.HANDLER]:{[ra.MACRO]:["autoload-macros"],[ra.ENVIRONMENT]:["autoload-environments"]},[ia.OPTIONS]:{autoload:wi({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:["data","href","class","style","cssId"],mhchem:["ce","pu"],newcommand:["newcommand","renewcommand","newenvironment","renewenvironment","def","let"],unicode:["unicode","U","char"],verb:["verb"]})},[ia.CONFIG]:function(t,e){const s=e.parseOptions,i=s.handlers.get(ra.MACRO),r=s.handlers.get(ra.ENVIRONMENT),n=s.options.autoload;s.packageData.set("autoload",{Autoload:cc});for(const t of Object.keys(n)){const e=n[t],[s,o]=2===e.length&&Array.isArray(e[0])?e:[e,[]];for(const e of s)i.lookup(e)&&"color"!==e||hc.add(e,new Pa(e,cc,[t,!0]));for(const e of o)r.lookup(e)||dc.add(e,new Pa(e,cc,[t,!1]))}s.packageData.get("require")||lc.config(t,e)},[ia.INIT]:function(t){t.options.require||Bi(t.options,lc.options)},[ia.PRIORITY]:10}),pc="configmacros-map",mc="configmacros-active-map",fc="configmacros-env-map";function gc(t,e,s){const i=s.parseOptions.handlers.retrieve(e),r=s.parseOptions.options[t];for(const t of Object.keys(r)){const e="string"==typeof r[t]?[r[t]]:r[t],s=Array.isArray(e[2])?new Pa(t,Yl.MacroWithTemplate,e.slice(0,2).concat(e[2])):new Pa(t,Yl.Macro,e);i.add(t,s)}}const bc=Ka.create("configmacros",{[ia.INIT]:function(t){new Wa(mc,{}),new za(pc,{}),new qa(fc,Ol.environment,{}),t.append(Ka.local({handler:{[ra.CHARACTER]:[mc],[ra.MACRO]:[pc],[ra.ENVIRONMENT]:[fc]},priority:3}))},[ia.CONFIG]:function(t,e){!function(t){gc("active",mc,t)}(e),function(t){gc("macros",pc,t)}(e),function(t){const e=t.parseOptions.handlers.retrieve(fc),s=t.parseOptions.options.environments;for(const t of Object.keys(s))e.add(t,new Pa(t,Yl.BeginEnv,[!0].concat(s[t])))}(e)},[ia.ITEMS]:{[Kl.prototype.kind]:Kl},[ia.OPTIONS]:{active:wi({}),macros:wi({}),environments:wi({})}});const Ec=Ka.create("noundefined",{[ia.FALLBACK]:{[ra.MACRO]:function(t,e){const s=t.create("text","\\"+e),i=t.options.noundefined,r={};for(const t of["color","background","size"])i[t]&&(r["math"+t]=i[t]);t.Push(t.create("node","mtext",[],r,s))}},[ia.OPTIONS]:{noundefined:{color:"red",background:"",size:""}},[ia.PRIORITY]:3});class xc extends ua{get texParser(){return this.configuration.packageData.get("textmacros").texParser}get tags(){return this.texParser.tags}constructor(t,e,s,i){super(t,e,s),this.level=i}mml(){return this.copyLists(),this.configuration.popParser(),null!=this.level?this.create("node","mstyle",this.nodes,{displaystyle:!1,scriptlevel:this.level}):1===this.nodes.length?this.nodes[0]:this.create("node","mrow",this.nodes)}copyLists(){const t=this.texParser.configuration;for(const[e,s]of Object.entries(this.configuration.nodeLists))for(const i of s)t.addNode(e,i);this.configuration.nodeLists={}}Parse(){this.text="",this.nodes=[],this.envStack=[],super.Parse()}saveText(){if(this.text){const t=this.stack.env.mathvariant,e=Na.internalText(this,this.text,t?{mathvariant:t}:{});this.text="",this.Push(e)}}Push(t){if(this.text&&this.saveText(),t instanceof tl)return super.Push(t);t instanceof pl?this.stack.env.mathcolor=this.stack.env.color:t instanceof Nr&&(this.addAttributes(t),this.nodes.push(t))}PushMath(t){const e=this.stack.env;for(const s of["mathsize","mathcolor"])e[s]&&!t.attributes.hasExplicit(s)&&(t.isToken||t.isKind("mstyle")||(t=this.create("node","mstyle",[t])),Ko.setAttribute(t,s,e[s]));t.isInferred&&(t=this.create("node","mrow",t.childNodes)),t.isKind("TeXAtom")||(t=this.create("node","TeXAtom",[t])),this.nodes.push(t)}addAttributes(t){const e=this.stack.env;if(t.isToken)for(const s of["mathsize","mathcolor","mathvariant"])e[s]&&!t.attributes.hasExplicit(s)&&Ko.setAttribute(t,s,e[s])}ParseTextArg(t,e){const s=this.GetArgument(t);return e=Object.assign(Object.assign({},this.stack.env),e),new xc(s,e,this.configuration).mml()}ParseArg(t){return new xc(this.GetArgument(t),this.stack.env,this.configuration).mml()}Error(t,e,...s){throw new ca(t,e,...s)}}const yc={Comment(t,e){for(;t.i":[yc.Spacer,bo.mediummathspace],";":[yc.Spacer,bo.thickmathspace],"!":[yc.Spacer,bo.negativethinmathspace],enspace:[yc.Spacer,.5],quad:[yc.Spacer,1],qquad:[yc.Spacer,2],thinspace:[yc.Spacer,bo.thinmathspace],negthinspace:[yc.Spacer,bo.negativethinmathspace],hskip:yc.Hskip,hspace:yc.Hskip,kern:yc.Hskip,mskip:yc.Hskip,mspace:yc.Hskip,mkern:yc.Hskip,rule:yc.rule,Rule:[yc.Rule],Space:[yc.Rule,"blank"],color:yc.CheckAutoload,textcolor:yc.CheckAutoload,colorbox:yc.CheckAutoload,fcolorbox:yc.CheckAutoload,href:yc.CheckAutoload,style:yc.CheckAutoload,class:yc.CheckAutoload,data:yc.CheckAutoload,cssId:yc.CheckAutoload,unicode:yc.CheckAutoload,U:yc.CheckAutoload,char:yc.CheckAutoload,ref:[yc.HandleRef,!1],eqref:[yc.HandleRef,!0],underline:[yc.UnderOver,"2015"],llap:yc.Lap,rlap:yc.Lap,phantom:yc.Phantom,vphantom:[yc.Phantom,1,0],hphantom:[yc.Phantom,0,1],smash:yc.Smash,mmlToken:yc.MmlToken});const vc=Ka.create("text-base",{[ia.PARSER]:"text",[ia.PRIORITY]:1,[ia.HANDLER]:{[ra.CHARACTER]:["command","text-special"],[ra.MACRO]:["text-macros"]},[ia.FALLBACK]:{[ra.CHARACTER]:(t,e)=>{t.text+=e},[ra.MACRO]:(t,e)=>{const s=t.texParser,i=s.lookup(ra.MACRO,e);i&&i._func!==yc.Macro&&t.Error("MathMacro","%1 is only supported in math mode","\\"+e),s.parse(ra.MACRO,[t,e])}},[ia.ITEMS]:{[Za.prototype.kind]:Za,[tl.prototype.kind]:tl,[gl.prototype.kind]:gl,[pl.prototype.kind]:pl}});function Tc(t,e,s,i){const r=t.configuration.packageData.get("textmacros");return t instanceof xc||(r.texParser=t),r.parseOptions.clear(),[new xc(e,i?{mathvariant:i}:{},r.parseOptions,s).mml()]}const Cc=Ka.create("textmacros",{[ia.PRIORITY]:1,[ia.CONFIG]:(t,e)=>{const s=new Qa(e.parseOptions.options.textmacros.packages,["tex","text"]);s.init();const i=new Aa(s,[]);i.options=e.parseOptions.options,s.config(e),Oa.addTags(s.tags),i.tags=Oa.getDefault(),i.tags.configuration=i,i.packageData=e.parseOptions.packageData,i.packageData.set("textmacros",{textConf:s,parseOptions:i,jax:e,texParser:null}),i.options.internalMath=Tc},[ia.PREPROCESSORS]:[t=>{const e=t.data.packageData.get("textmacros");e.parseOptions.nodeFactory.setMmlFactory(e.jax.mmlFactory)}],[ia.OPTIONS]:{textmacros:{packages:["text-base"]}}});MathJax.loader&&MathJax.loader.checkVersion("input/tex",ri,"input"),hi({_:{input:{tex_ts:ee,tex:{ColumnParser:qt,Configuration:$t,FilterUtil:Dt,FindTeX:wt,HandlerTypes:Pt,MapHandler:Kt,NodeFactory:Wt,NodeUtil:kt,ParseMethods:Zt,ParseOptions:Vt,ParseUtil:zt,Stack:Ft,StackItem:_t,StackItemFactory:Ht,Tags:Xt,TexConstants:Ot,TexError:jt,TexParser:Ut,Token:Gt,TokenMap:Jt,UnitUtil:Bt,ams:{AmsConfiguration:le,AmsItems:se,AmsMethods:re},autoload:{AutoloadConfiguration:he},base:{BaseConfiguration:te,BaseItems:Yt,BaseMethods:Qt},configmacros:{ConfigMacrosConfiguration:de},newcommand:{NewcommandConfiguration:ae,NewcommandItems:ne,NewcommandMethods:oe,NewcommandUtil:ie},noundefined:{NoUndefinedConfiguration:ue},require:{RequireConfiguration:ce},textmacros:{TextMacrosConfiguration:fe,TextMacrosMethods:me,TextParser:pe}}}}}),vi.preLoaded("input/tex-base","[tex]/ams","[tex]/newcommand","[tex]/textmacros","[tex]/noundefined","[tex]/require","[tex]/autoload","[tex]/configmacros"),function(t=[],e=!0){if(MathJax.startup){e&&(MathJax.startup.registerConstructor("tex",MathJax._.input.tex_ts.TeX),MathJax.startup.useInput("tex")),MathJax.config.tex||(MathJax.config.tex={});let s=MathJax.config.tex.packages;MathJax.config.tex.packages=t,s&&(Array.isArray(s)&&(s={"[+]":s.filter(e=>!t.includes(e))}),Pi(MathJax.config.tex,{packages:s}))}}(["base","ams","newcommand","textmacros","noundefined","require","autoload","configmacros"]);const Ac="http://www.w3.org/1998/Math/MathML";class Lc extends Qi{findMath(t){const e=new Set;this.findMathNodes(t,e),this.findMathPrefixed(t,e);const s=this.adaptor.root(this.adaptor.document);return"html"===this.adaptor.kind(s)&&0===e.size&&this.findMathNS(t,e),this.processMath(e)}findMathNodes(t,e){for(const s of this.adaptor.tags(t,"math"))e.add(s)}findMathPrefixed(t,e){const s=this.adaptor.root(this.adaptor.document);for(const i of this.adaptor.allAttributes(s))if("xmlns:"===i.name.substring(0,6)&&i.value===Ac){const s=i.name.substring(6);for(const i of this.adaptor.tags(t,s+":math"))e.add(i)}}findMathNS(t,e){for(const s of this.adaptor.tags(t,"math",Ac))e.add(s)}processMath(t){const e=this.adaptor,s=[];for(const i of t.values()){if("mjx-assistive-mml"===e.kind(e.parent(i)))continue;const t="block"===e.getAttribute(i,"display")||"display"===e.getAttribute(i,"mode"),r={node:i,n:0,delim:""},n={node:i,n:0,delim:""};s.push({math:e.outerHTML(i),start:r,end:n,display:t})}return s}}Lc.OPTIONS={};class Sc{constructor(t={}){const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t)}setMmlFactory(t){this.factory=t}compile(t){const e=this.makeNode(t);return e.verifyTree(this.options.verify),e.setInheritedAttributes({},!1,0,!1),e.walkTree(this.markMrows),e}makeNode(t){const e=this.adaptor;let s=!1;const i=e.kind(t).replace(/^.*:/,"");let r=e.getAttribute(t,"data-mjx-texclass")||"";r&&(r=this.filterAttribute("data-mjx-texclass",r)||"");let n=r&&"mrow"===i?"TeXAtom":i;for(const o of this.filterClassList(e.allClasses(t)))o.match(/^MJX-TeXAtom-/)&&"mrow"===i?(r=o.substring(12),n="TeXAtom"):"MJX-fixedlimits"===o&&(s=!0);return this.factory.getNodeClass(n)?this.createMml(n,t,r,s):this.unknownNode(n,t)}createMml(t,e,s,i){const r=this.factory.create(t);return"TeXAtom"!==t||"OP"!==s||i||(r.setProperty("movesupsub",!0),r.attributes.setInherited("movablelimits",!0)),s&&(r.texClass=fr[s],r.setProperty("texClass",r.texClass)),this.addAttributes(r,e),this.checkClass(r,e),this.addChildren(r,e),r}unknownNode(t,e){return this.factory.getNodeClass("html")&&this.options.allowHtmlInTokenNodes?this.factory.create("html").setHTML(e,this.adaptor):(this.error('Unknown node type "'+t+'"'),null)}addAttributes(t,e){let s=!1;for(const i of this.adaptor.allAttributes(e)){const e=i.name,r=this.filterAttribute(e,i.value);if(null!==r&&"xmlns"!==e)if("data-mjx-"===e.substring(0,9))switch(e.substring(9)){case"alternate":t.setProperty("variantForm",!0);break;case"variant":t.attributes.set("mathvariant",r),t.setProperty("ignore-variant",!0),s=!0;break;case"smallmatrix":t.setProperty("smallmatrix",!0),t.setProperty("useHeight",!1);break;case"mathaccent":t.setProperty("mathaccent","true"===r);break;case"auto-op":t.setProperty("autoOP","true"===r);break;case"script-align":t.setProperty("scriptalign",r);break;case"vbox":t.setProperty("vbox",r);break;default:t.attributes.set(e,r)}else if("class"!==e){const i=r.toLowerCase();"true"===i||"false"===i?t.attributes.set(e,"true"===i):s&&"mathvariant"===e||t.attributes.set(e,r)}}}filterAttribute(t,e){return e}filterClassList(t){return t}addChildren(t,e){if(0===t.arity)return;const s=this.adaptor;for(const i of s.childNodes(e)){const e=s.kind(i);if("#comment"!==e)if("#text"===e)this.addText(t,i);else if(t.isKind("annotation-xml"))t.appendChild(this.factory.create("XML").setXML(i,s));else{const e=t.appendChild(this.makeNode(i));0===e.arity&&s.childNodes(i).length&&!e.isKind("html")&&(this.options.fixMisplacedChildren?this.addChildren(t,i):e.mError("There should not be children for "+e.kind+" nodes",this.options.verify,!0))}}t.isToken&&this.trimSpace(t)}addText(t,e){let s=this.adaptor.value(e);(t.isToken||t.getProperty("isChars"))&&t.arity?(t.isToken&&(s=Ro(s),s=this.normalizeSpace(s)),t.appendChild(this.factory.create("text").setText(s))):s.match(/\S/)&&this.error('Unexpected text node "'+s+'"')}checkClass(t,e){const s=[];for(const i of this.filterClassList(this.adaptor.allClasses(e)))"MJX-"===i.substring(0,4)?"MJX-variant"===i?t.setProperty("variantForm",!0):"MJX-TeXAtom"!==i.substring(0,11)&&t.attributes.set("mathvariant",this.fixCalligraphic(i.substring(3))):s.push(i);s.length&&t.attributes.set("class",s.join(" "))}fixCalligraphic(t){return t.replace(/caligraphic/,"calligraphic")}markMrows(t){if(t.isKind("mrow")&&!t.isInferred&&t.childNodes.length>=2){const e=t.childNodes[0],s=t.childNodes[t.childNodes.length-1];e.isKind("mo")&&e.attributes.get("fence")&&e.attributes.get("stretchy")&&s.isKind("mo")&&s.attributes.get("fence")&&s.attributes.get("stretchy")&&(e.childNodes.length&&t.setProperty("open",e.getText()),s.childNodes.length&&t.setProperty("close",s.getText()))}}normalizeSpace(t){return t.replace(/[\t\n\r]/g," ").replace(/ +/g," ")}trimSpace(t){let e=t.childNodes[0];e&&(e.isKind("text")&&e.setText(e.getText().replace(/^ +/,"")),e=t.childNodes[t.childNodes.length-1],e.isKind("text")&&e.setText(e.getText().replace(/ +$/,"")))}error(t){throw new Error(t)}}Sc.OPTIONS={MmlFactory:null,allowHtmlInTokenNodes:!1,fixMisplacedChildren:!0,verify:Object.assign({},Nr.verifyDefaults),translateEntities:!0};class Rc extends Zi{constructor(t={}){const[e,s,i]=Ui(t,Lc.OPTIONS,Sc.OPTIONS);super(e),this.findMathML=this.options.FindMathML||new Lc(s),this.mathml=this.options.MathMLCompile||new Sc(i),this.mmlFilters=new bi(this.options.mmlFilters)}setAdaptor(t){super.setAdaptor(t),this.findMathML.adaptor=t,this.mathml.adaptor=t}setMmlFactory(t){super.setMmlFactory(t),this.mathml.setMmlFactory(t)}get processStrings(){return!1}compile(t,e){let s=t.start.node;if(!s||!t.end.node||this.options.forceReparse||"#text"===this.adaptor.kind(s)){let i=this.executeFilters(this.preFilters,t,e,(t.math||"").trim());"html"===this.options.parseAs&&(i=`${i}`);const r=this.checkForErrors(this.adaptor.parse(i,"text/"+this.options.parseAs)),n=this.adaptor.body(r);1!==this.adaptor.childNodes(n).length&&this.error("MathML must consist of a single element"),s=this.adaptor.remove(this.adaptor.firstChild(n)),"math"!==this.adaptor.kind(s).replace(/^[a-z]+:/,"")&&this.error("MathML must be formed by a element, not <"+this.adaptor.kind(s)+">")}s=this.executeFilters(this.mmlFilters,t,e,s);let i=this.mathml.compile(s);return i=this.executeFilters(this.postFilters,t,e,i),t.display="block"===i.attributes.get("display"),i}checkForErrors(t){const e=this.adaptor.tags(this.adaptor.body(t),"parsererror")[0];return e&&(""===this.adaptor.textContent(e)&&this.error("Error processing MathML"),this.options.parseError.call(this,e)),t}error(t){throw new Error(t)}findMath(t){return this.findMathML.findMath(t)}}Rc.NAME="MathML",Rc.OPTIONS=Bi({parseAs:"html",forceReparse:!1,mmlFilters:[],FindMathML:null,MathMLCompile:null,parseError:function(t){this.error(this.adaptor.textContent(t).replace(/\n.*/g,""))}},Zi.OPTIONS),MathJax.loader&&MathJax.loader.checkVersion("input/mml",ri,"input"),hi({_:{input:{mathml_ts:Ee,mathml:{FindMathML:ge,MathMLCompile:be}}}}),MathJax.loader&&MathJax.loader.pathFilters.add(t=>(t.name=t.name.replace(/\/util\/entities\/.*?\.js/,"/input/mml/entities.js"),!0)),MathJax.startup&&(MathJax.startup.registerConstructor("mml",Rc),MathJax.startup.useInput("mml"));const Mc={None:"",Vertical:"v",Horizontal:"h"},Ic=Mc.Vertical,wc=Mc.Horizontal;var kc=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const Oc=.07,Dc=.07,Pc={dir:Mc.None};function Bc(t,e,s){return s?Bi(t,{[e]:s})[e]:t[e]}class Fc{get CLASS(){return this.constructor}static charOptions(t,e){const s=t[e];if(!Array.isArray(s))throw Error(`Character data hasn't been loaded for 0x${e.toString(16).toUpperCase()}`);return 3===s.length&&(s[3]={}),s[3]}static defineDynamicFiles(t,e=""){const s={};return(t||[]).forEach(([t,i,r])=>{s[t]={extension:e,file:t,variants:i,delimiters:r||[],promise:null,failed:!1,setup:e=>{s[t].failed=!0}}}),s}static dynamicSetup(t,e,s,i={},r=null){const n=t?this.dynamicExtensions.get(t):null;(t?n.files:this.dynamicFiles)[e].setup=e=>{Object.keys(s).forEach(t=>e.defineChars(t,s[t])),e.defineDelimiters(i),t&&this.adjustDelimiters(e.delimiters,Object.keys(i),n.sizeN,n.stretchN),r&&e.addDynamicFontCss(r)}}static adjustDelimiters(t,e,s,i){e.forEach(e=>{const r=t[parseInt(e)];"dir"in r&&(r.variants&&(r.variants=this.adjustArrayIndices(r.variants,s)),r.stretchv&&(r.stretchv=this.adjustArrayIndices(r.stretchv,i)))})}static adjustArrayIndices(t,e){return t.map(t=>t<0?e-1-t:t)}static addExtension(t,e=""){const s={name:t.name,prefix:e||`[${t.name}-extension]/${this.JAX.toLowerCase()}/dynamic`,files:this.defineDynamicFiles(t.ranges,t.name),sizeN:this.defaultSizeVariants.length,stretchN:this.defaultStretchVariants.length};this.dynamicExtensions.set(t.name,s);for(const[e,s]of[["options","OPTIONS"],["variants","defaultVariants"],["variantSmp","VariantSmp"],["cssFonts","defaultCssFonts"],["accentMap","defaultAccentMap"],["moMap","defaultMoMap"],["mnMap","defaultMnMap"],["parameters","defaultParams"],["chars","defaultChars"],["sizeVariants","defaultSizeVariants"],["stretchVariants","defaultStretchVariants"]])Bc(this,s,t[e]);t.delimiters&&(Object.assign(this.defaultDelimiters,t.delimiters),this.adjustDelimiters(this.defaultDelimiters,Object.keys(t.delimiters),s.sizeN,s.stretchN))}constructor(t=null){this.variant={},this.delimiters={},this.cssFontMap={},this.cssFontPrefix="",this.remapChars={},this.skewIcFactor=.75;const e=this.CLASS;this.options=Fi(Bi({},e.OPTIONS),t),this.params=Object.assign({},e.defaultParams),this.sizeVariants=[...e.defaultSizeVariants],this.stretchVariants=[...e.defaultStretchVariants],this.defineCssFonts(e.defaultCssFonts),this.cssFamilyPrefix=e.defaultCssFamilyPrefix,this.createVariants(e.defaultVariants),this.defineDelimiters(e.defaultDelimiters),Object.keys(e.defaultChars).forEach(t=>this.defineChars(t,e.defaultChars[t])),this.defineRemap("accent",e.defaultAccentMap),this.defineRemap("mo",e.defaultMoMap),this.defineRemap("mn",e.defaultMnMap),this.defineDynamicCharacters(e.dynamicFiles),e.dynamicExtensions.forEach(t=>this.defineDynamicCharacters(t.files))}setOptions(t){Bi(this.options,t)}addExtension(t,e=""){const s=this.constructor.JAX.toLowerCase(),i={name:t.name,prefix:e||`[${t.name}-extension]/${s}/dynamic`,files:this.CLASS.defineDynamicFiles(t.ranges,e),sizeN:this.sizeVariants.length,stretchN:this.stretchVariants.length};this.CLASS.dynamicExtensions.set(t.name,i),Bi(this.options,t.options||{}),Bi(this.params,t.parameters||{}),Bc(this,"sizeVariants",t.sizeVariants),Bc(this,"stretchVariants",t.stretchVariants),Bc(this.constructor,"VariantSmp",t.variantSmp),this.defineCssFonts(Bc({cssFonts:{}},"cssFonts",t.cssFonts)),this.createVariants(Bc({variants:[]},"variants",t.variants)),t.delimiters&&(this.defineDelimiters(Bc({delimiters:{}},"delimiters",t.delimiters)),this.CLASS.adjustDelimiters(this.delimiters,Object.keys(t.delimiters),i.sizeN,i.stretchN));for(const e of Object.keys(t.chars||{}))this.defineChars(e,t.chars[e]);return this.defineRemap("accent",t.accentMap),this.defineRemap("mo",t.moMap),this.defineRemap("mn",t.mnMap),t.ranges&&this.defineDynamicCharacters(i.files),[]}get styles(){return this._styles}set styles(t){this._styles=t}createVariant(t,e=null,s=null){const i={linked:[],chars:Object.create(e?this.variant[e].chars:{})};this.variant[s]&&(Object.assign(i.chars,this.variant[s].chars),this.variant[s].linked.push(i.chars),i.chars=Object.create(i.chars)),this.remapSmpChars(i.chars,t),this.variant[t]=i}remapSmpChars(t,e){const s=this.CLASS;let i=s.VariantSmp[e];if("string"==typeof i&&(i=s.VariantSmp[i]),!i)return;const r=s.SmpRemap,n=[null,null,s.SmpRemapGreekU,s.SmpRemapGreekL];for(const[e,o,a]of s.SmpRanges){const s=i[e];if(s){for(let e=o;e<=a;e++){if(930===e)continue;const i=s+e-o;t[e]=this.smpChar(r[i]||i)}if(n[e])for(const i of Object.keys(n[e]).map(t=>parseInt(t)))t[i]=this.smpChar(s+n[e][i])}}const o=i[5]||{};for(const e of Object.keys(o))t[e]=this.smpChar(i[5][e])}smpChar(t){return[,,,{smp:t}]}createVariants(t){for(const e of t)this.createVariant(e[0],e[1],e[2])}defineChars(t,e){const s=this.variant[t];Object.assign(s.chars,e);for(const t of s.linked)Object.assign(t,e)}defineCssFonts(t){Object.assign(this.cssFontMap,t);for(const e of Object.keys(t))"unknown"===this.cssFontMap[e][0]&&(this.cssFontMap[e][0]=this.options.unknownFamily)}defineDelimiters(t){Object.assign(this.delimiters,t)}defineRemap(t,e){e&&(Object.hasOwn(this.remapChars,t)||(this.remapChars[t]={}),Object.assign(this.remapChars[t],e))}defineDynamicCharacters(t){for(const e of Object.keys(t)){const s=t[e];for(const t of Object.keys(s.variants))this.defineChars(t,this.flattenRanges(s.variants[t],s));this.defineDelimiters(this.flattenRanges(s.delimiters,s))}}flattenRanges(t,e){const s={};for(const i of t)if(Array.isArray(i))for(let t=i[0];t<=i[1];t++)s[t]=e;else s[i]=e;return s}dynamicFileName(t){const e=t.extension?this.CLASS.dynamicExtensions.get(t.extension).prefix:this.options.dynamicPrefix;return t.file.match(/^(?:[/[]|[a-z]+:\/\/|[a-z]:)/i)?t.file:e+"/"+t.file.replace(/(\.js)?$/,".js")}loadDynamicFile(t){return kc(this,void 0,void 0,function*(){return t.failed?Promise.reject(new Error(`dynamic file '${t.file}' failed to load`)):(t.promise||(t.promise=po(this.dynamicFileName(t)).catch(e=>{t.failed=!0,console.warn(e)})),t.promise.then(()=>t.setup(this)))})}loadDynamicFiles(){const t=this.CLASS.dynamicFiles,e=Object.keys(t).map(e=>this.loadDynamicFile(t[e]));for(const t of this.CLASS.dynamicExtensions.values())e.push(...Object.keys(t.files).map(e=>this.loadDynamicFile(t.files[e])));return Promise.all(e)}loadDynamicFilesSync(){if(!to.asyncIsSynchronous)throw Error("MathJax(loadDynamicFilesSync): mathjax.asyncLoad must be specified and synchronous\n Try importing #js/../components/require.mjs and #js/util/asyncLoad/node.js");const t=this.CLASS.dynamicFiles;Object.keys(t).forEach(e=>this.loadDynamicFileSync(t[e]));for(const t of this.CLASS.dynamicExtensions.values())Object.keys(t.files).forEach(e=>this.loadDynamicFileSync(t.files[e]))}loadDynamicFileSync(t){if(!t.promise){t.promise=Promise.resolve();try{to.asyncLoad(this.dynamicFileName(t))}catch(e){t.failed=!0,console.warn(e)}t.setup(this)}}addDynamicFontCss(t,e){}getDelimiter(t){const e=this.delimiters[t];return e&&!("dir"in e)?(this.delimiters[t]=null,Pn(this.loadDynamicFile(e)),null):e}getSizeVariant(t,e){const s=this.getDelimiter(t);return s&&s.variants&&(e=s.variants[e]),this.sizeVariants[e]}getStretchVariant(t,e){const s=this.getDelimiter(t);return this.stretchVariants[s.stretchv?s.stretchv[e]:0]}getStretchVariants(t){return[0,1,2,3].map(e=>this.getStretchVariant(t,e))}getChar(t,e){const s=this.variant[t].chars[e];if(s&&!Array.isArray(s)){const i=this.variant[t];return delete i.chars[e],i.linked.forEach(t=>delete t[e]),Pn(this.loadDynamicFile(s)),null}return s}getVariant(t){return this.variant[t]}getCssFont(t){return this.cssFontMap[t]||["serif",!1,!1]}getFamily(t){return this.cssFamilyPrefix?this.cssFamilyPrefix+", "+t:t}getRemappedChar(t,e){return(this.remapChars[t]||{})[e]}}Fc.OPTIONS={unknownFamily:"serif",dynamicPrefix:"."},Fc.JAX="common",Fc.NAME="",Fc.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"],["-smallop","normal"],["-largeop","normal"],["-tex-calligraphic","italic"],["-tex-bold-calligraphic","bold-italic"],["-tex-oldstyle","normal"],["-tex-bold-oldstyle","bold"],["-tex-mathit","italic"],["-tex-variant","normal"]],Fc.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],"-smallop":["unknown",!1,!1],"-largeop":["unknown",!1,!1],"-tex-calligraphic":["cursive",!0,!1],"-tex-bold-calligraphic":["cursive",!0,!0],"-tex-oldstyle":["unknown",!1,!1],"-tex-bold-oldstyle":["unknown",!1,!0],"-tex-mathit":["unknown",!0,!1],"-tex-variant":["unknown",!1,!1]},Fc.defaultCssFamilyPrefix="",Fc.VariantSmp={bold:[119808,119834,120488,120514,120782,{988:120778,989:120779}],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]},Fc.SmpRanges=[[0,65,90],[1,97,122],[2,913,937],[3,945,969],[4,48,57]],Fc.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},Fc.SmpRemapGreekU={8711:25,1012:17},Fc.SmpRemapGreekL={977:27,981:29,982:31,1008:28,1009:30,1013:26,8706:25},Fc.defaultAccentMap={94:"\u02c6",126:"\u02dc",768:"\u02cb",769:"\u02ca",770:"\u02c6",771:"\u02dc",772:"\u02c9",774:"\u02d8",775:"\u02d9",776:"\xa8",778:"\u02da",780:"\u02c7",8594:"\u20d7"},Fc.defaultMoMap={45:"\u2212"},Fc.defaultMnMap={45:"\u2212"},Fc.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:.06,scriptspace:.05,nulldelimiterspace:.12,delimiterfactor:901,delimitershortfall:.3,rule_factor:1.25,min_rule_thickness:1.25,separation_factor:1.75,extra_ic:.033,extender_factor:.333},Fc.defaultDelimiters={},Fc.defaultChars={},Fc.defaultSizeVariants=[],Fc.defaultStretchVariants=[],Fc.dynamicFiles={},Fc.dynamicExtensions=new Map;class jc extends vo{static from(t,e,s=null){const i=new this;return Object.assign(i,t),i.lineLeading=e,s&&(i.indentData=s),i}constructor(t,e=null){super(t),this.indentData=null,this.isFirst=!1,this.originalL=this.L,e&&(this.start=e)}append(t){this.isFirst&&(t.originalL+=t.L,t.L=0),t.indentData&&(this.indentData=t.indentData),this.lineLeading=t.lineLeading,super.append(t),this.isFirst=t.isFirst}copy(){const t=jc.from(this,this.lineLeading);return t.indentData=this.indentData,t.lineLeading=this.lineLeading,t}getIndentData(t){let{indentalign:e,indentshift:s,indentalignfirst:i,indentshiftfirst:r,indentalignlast:n,indentshiftlast:o}=t.attributes.getAllAttributes();"indentalign"===i&&(i=t.attributes.getInherited("indentalign")),"indentshift"===r&&(r=t.attributes.getInherited("indentshift")),"indentalign"===n&&(n=e),"indentshift"===o&&(o=s),this.indentData=[[i,r],[e,s],[n,o]]}copyIndentData(t){return t.indentData.map(([t,e])=>[t,e])}}const _c=1e6;class Uc extends Gn{breakToWidth(t,e){}}class Hc extends Uc{constructor(){super(...arguments),this.PENALTY={newline:t=>0,nobreak:t=>_c,goodbreak:t=>t-200*this.state.depth,badbreak:t=>t+200*this.state.depth,auto:t=>t},this.FACTORS={depth:t=>t+800*this.state.depth,width:t=>t+Math.floor((this.state.width-this.state.w)/this.state.width*2500),tail:t=>t+Math.floor(this.state.width/Math.max(1e-4,this.state.mathLeft-this.state.w)*500),open:(t,e)=>{const s=e.node.prevClass;if(s===fr.BIN||s===fr.REL||s===fr.OP)return t+5e3;const i=this.getPrevious(e);if(i&&("postfix"!==i.attributes.get("form")||"nobreak"===i.attributes.get("linebreak")))return t+5e3;const r=e.node.Parent;if((null==r?void 0:r.isKind("mmultiscripts"))&&e.node===this.getFirstToken(r)){if(!!r.childNodes.filter(t=>t.isKind("mprescripts")).length)return _c}return t-500},close:(t,e)=>{var s;const i=e.node.Parent;return!(null==i?void 0:i.isKind("msubsup"))||i.isKind("mmultiscripts")&&(null===(s=i.childNodes[1])||void 0===s?void 0:s.isKind("mprescripts"))||e.node!==this.getLastToken(i.childNodes[0])?t+500:_c},space:(t,e)=>{const s=e;if(!s.canBreak)return _c;const i=s.getBBox().w;return i<0?_c:i<1?t:t-100*(i+4)},separator:t=>t+500,fuzz:t=>.99*t},this.TEXCLASS={[fr.BIN]:t=>t-250,[fr.REL]:t=>t-500}}breakToWidth(t,e){const s=this.state;this.state=this.createState(t),this.state.width=e;const i=t.breakCount;for(let s=0;s<=i;s++){(t.lineBBox[s]||t.getLineBBox(s)).w>e&&this.breakLineToWidth(t,s)}for(const[t,e]of this.state.breaks){if(null===e){const e=t.coreMO();e.setBreakStyle(e.node.attributes.get("linebreakstyle")||"before")}else t.setBreakAt(e);t.invalidateBBox()}this.state=s}createState(t){const e=t.getBBox().w;return{breaks:new Set,potential:[],width:0,w:0,prevWidth:0,prevBreak:null,depth:0,mathWidth:e,mathLeft:e}}breakLineToWidth(t,e){const s=this.state;s.potential=[],s.w=0,s.prevWidth=0,s.prevBreak=null,s.depth=0,this.visitNode(t,e)}addWidth(t,e=null){null===e&&(e=t.L+t.w+t.R),e&&(e*=t.rscale,this.state.w+=e,this.state.potential.length&&(this.state.potential[0][4]+=e),this.processBreak())}processBreak(){const t=this.state;for(;t.potential.length&&t.w>this.state.width;){const e=t.potential.pop(),[s,,i,r,n]=e;t.breaks.add(s),t.w=t.potential.reduce((t,e)=>t+e[4],r+n),t.prevBreak&&t.prevWidth+i<=t.width?(t.breaks.delete(t.prevBreak[0]),t.prevWidth+=i):t.prevWidth=i+r,t.potential.forEach(t=>t[2]-=i),t.prevBreak=e,t.mathLeft-=i}}pushBreak(t,e,s,i){var r;const n=this.state;if(!(e>=_c||0===n.w&&0===n.prevWidth)){for(;n.potential.length&&n.potential[0][1]>this.FACTORS.fuzz(e);){const t=n.potential.shift();n.potential.length&&(n.potential[0][4]+=t[4])}n.potential.unshift([[t,i],e,n.w-((null===(r=n.prevBreak)||void 0===r?void 0:r[3])||0),s,0])}}getBorderLR(t){var e;const s=t.styleData;if(!s)return[0,0];const i=(null===(e=null==s?void 0:s.border)||void 0===e?void 0:e.width)||[0,0,0,0],r=(null==s?void 0:s.padding)||[0,0,0,0];return[i[3]+r[3],i[1]+r[1]]}getFirstToken(t){return t.isToken?t:this.getFirstToken(t.childNodes[0])}getLastToken(t){return t.isToken?t:this.getLastToken(t.childNodes[t.childNodes.length-1])}visitNode(t,e){t&&(this.state.depth++,t.node.isEmbellished&&!t.node.isKind("mo")?this.visitEmbellishedOperator(t,e):super.visitNode(t,e),this.state.depth--)}visitDefault(t,e){var s;const i=t.getLineBBox(e);if(t.node.isToken||t.node.linebreakContainer||!(null===(s=t.childNodes)||void 0===s?void 0:s[0]))this.addWidth(i);else{const[s,r]=this.getBorderLR(t);0===e&&this.addWidth(i,i.L+s),this.visitNode(t.childNodes[0],e),e===t.breakCount&&this.addWidth(i,i.R+r)}}visitEmbellishedOperator(t,e){const s=t.coreMO(),i=jc.from(t.getOuterBBox(),t.linebreakOptions.lineleading);i.getIndentData(s.node);const r=s.getBreakStyle(s.node.attributes.get("linebreakstyle")),n=s.processIndent("",i.indentData[1][1],"",i.indentData[0][1],this.state.width)[1],o=this.moPenalty(s);if("before"===r)this.pushBreak(t,o,n-i.L,null),this.addWidth(i);else{this.addWidth(i);const e=("after"===r?0:s.multChar?s.multChar.getBBox().w:i.w)+n;this.pushBreak(t,o,e,null)}}visitMoNode(t,e){const s=t,i=jc.from(s.getOuterBBox(),s.linebreakOptions.lineleading);i.getIndentData(s.node);const r=s.getBreakStyle(s.node.attributes.get("linebreakstyle")),n=s.processIndent("",i.indentData[1][1],"",i.indentData[0][1],this.state.width)[1],o=this.moPenalty(s);if("before"===r)this.pushBreak(t,o,n-i.L,null),this.addWidth(i);else{this.addWidth(i);const e=("after"===r?0:s.multChar?s.multChar.getBBox().w:i.w)+n;this.pushBreak(t,o,e,null)}}moPenalty(t){const{linebreak:e,fence:s,form:i}=t.node.attributes.getList("linebreak","fence","form"),r=this.FACTORS;let n=r.tail(r.width(0));const o=s&&"prefix"===i||t.node.texClass===fr.OPEN,a=s&&"postfix"===i||t.node.texClass===fr.CLOSE;return o&&(n=r.open(n,t),this.state.depth++),a&&(n=r.close(n,t),this.state.depth--),n=(this.TEXCLASS[t.node.texClass]||(t=>t))(n),(this.PENALTY[e]||(t=>t))(r.depth(n))}getPrevious(t){let e=t.node,s=e.parent,i=s.childIndex(e);for(;s&&(s.notParent||s.isKind("mrow"))&&0===i;)e=s,s=e.parent,i=s.childIndex(e);if(!s||!i)return null;const r=s.childNodes[i-1];return r.isEmbellished?r.coreMO():null}visitMspaceNode(t,e){const s=t.getLineBBox(e),i=t;if(i.canBreak){const e=this.mspacePenalty(i);s.getIndentData(t.node);const r=t.processIndent("",s.indentData[1][1],"",s.indentData[0][1],this.state.width)[1];this.pushBreak(t,e,r-s.w,null)}this.addWidth(s)}mspacePenalty(t){const e=t.node.attributes.get("linebreak"),s=this.FACTORS,i=s.space(s.tail(s.width(0)),t);return(this.PENALTY[e]||(t=>t))(s.depth(i))}visitMtextNode(t,e){if(!t.getText().match(/ /))return void this.visitDefault(t,e);const s=t;s.clearBreakPoints();const i=s.textWidth(" "),r=t.getBBox(),[n,o]=this.getBorderLR(t);this.addWidth(r,r.L+n);const a=s.childNodes;for(const e of a.keys()){const n=a[e];if(n.node.isKind("text")){const o=n.node.getText().split(/ /),a=o.pop();for(const n of o.keys())this.addWidth(r,s.textWidth(o[n])),this.pushBreak(t,this.mtextPenalty(),-i,[e,n+1]),this.addWidth(r,i);this.addWidth(r,s.textWidth(a))}else this.addWidth(n.getBBox())}this.addWidth(r,r.R+o)}mtextPenalty(){const t=this.FACTORS;return t.depth(t.tail(t.width(0)))}visitMrowNode(t,e){const s=t.lineBBox[e]||t.getLineBBox(e),[i,r]=s.start||[0,0],[n,o]=s.end||[t.childNodes.length-1,0],[a,l]=this.getBorderLR(t);this.addWidth(s,s.L+a);for(let e=i;e<=n;e++)this.visitNode(t.childNodes[e],e===i?r:e===n?o:0);this.addWidth(s,s.R+l)}visitInferredMrowNode(t,e){this.state.depth--,this.visitMrowNode(t,e),this.state.depth++}visitMfracNode(t,e){const s=t;!s.node.attributes.get("bevelled")&&s.getOuterBBox().w>this.state.width&&(this.breakToWidth(s.childNodes[0],this.state.width),this.breakToWidth(s.childNodes[1],this.state.width)),this.visitDefault(t,e)}visitMsqrtNode(t,e){if(t.getOuterBBox().w>this.state.width){const e=t,s=e.childNodes[e.base];this.breakToWidth(s,this.state.width-e.rootWidth()),e.getStretchedSurd()}this.visitDefault(t,e)}visitMrootNode(t,e){this.visitMsqrtNode(t,e)}visitMsubNode(t,e){this.visitDefault(t,e);const s=t,i=s.getOffset()[0],r=s.scriptChild.getOuterBBox(),[n,o]=this.getBorderLR(t);this.addWidth(s.getLineBBox(e),i+n+r.rscale*r.w+s.font.params.scriptspace+o)}visitMsupNode(t,e){this.visitDefault(t,e);const s=t,i=s.getOffset()[0],r=s.scriptChild.getOuterBBox(),[n,o]=this.getBorderLR(t);this.addWidth(s.getLineBBox(e),i+n+r.rscale*r.w+s.font.params.scriptspace+o)}visitMsubsupNode(t,e){this.visitDefault(t,e);const s=t,i=s.subChild.getOuterBBox(),r=s.supChild.getOuterBBox(),n=s.getAdjustedIc(),o=Math.max(i.rscale*i.w,n+r.rscale*r.w)+s.font.params.scriptspace,[a,l]=this.getBorderLR(t);this.addWidth(t.getLineBBox(e),a+o+l)}visitMmultiscriptsNode(t,e){const s=t,i=s.scriptData;if(i.numPrescripts){const r=Math.max(i.psup.rscale*i.psup.w,i.psub.rscale*i.psub.w);this.addWidth(t.getLineBBox(e),r+s.font.params.scriptspace)}if(this.visitDefault(t,e),i.numScripts){const r=Math.max(i.sup.rscale*i.sup.w,i.sub.rscale*i.sub.w);this.addWidth(t.getLineBBox(e),r+s.font.params.scriptspace)}}visitMfencedNode(t,e){const s=t,i=t.getLineBBox(e),[r,n]=this.getBorderLR(t);0===e&&this.addWidth(i,i.L+r),this.visitNode(s.mrow,e),e===t.breakCount&&this.addWidth(i,i.R+n)}visitMactionNode(t,e){const s=t,i=t.getLineBBox(e),[r,n]=this.getBorderLR(t);0===e&&this.addWidth(i,i.L+r),this.visitNode(s.selected,e),e===t.breakCount&&this.addWidth(i,i.R+n)}}!function(){for(const t of Object.keys(Br.postfix)){const e=Br.postfix[t][3];e&&e.fence&&(e.linebreakstyle="after")}Br.infix["\u2061"]=[...Br.infix["\u2061"]],Br.infix["\u2061"][3]={linebreak:"nobreak"}}();const Wc="@mathjax/%%FONT%%-font";class zc extends tr{get forceInlineBreaks(){return!1}constructor(t={},e=null,s=null){const[i,r]=t.fontData instanceof Fc?[t.fontData.constructor,t.fontData]:[t.fontData||s,null],[n,o]=Ui(t,i.OPTIONS);super(n),this.factory=this.options.wrapperFactory||new e,this.factory.jax=this,this.styleJson=this.options.styleJson||new ao,this.font=r||new i(o),this.font.setOptions({mathmlSpacing:this.options.mathmlSpacing}),this.constructor.genericFont=i,this.unknownCache=new Map;const a=this.options.linebreaks.LinebreakVisitor||Hc;this.linebreaks=new a(this.factory)}setAdaptor(t){super.setAdaptor(t),"auto"===this.options.htmlHDW&&(this.options.htmlHDW=t.canMeasureNodes?"ignore":"force")}addExtension(t,e=""){return this.font.addExtension(t,e)}typeset(t,e){const s=this.constructor,i=s.genericFont;s.genericFont=this.font.constructor,this.setDocument(e);const r=this.createNode();try{this.toDOM(t,r,e)}finally{s.genericFont=i}return r}createNode(){const t=this.constructor.NAME;return this.html("mjx-container",{class:"MathJax",jax:t})}setScale(t,e){let s=this.getInitialScale()*this.options.scale;if("scale"===e.node.attributes.get("overflow")&&this.math.display){const t=e.getOuterBBox().w,i=Math.max(0,this.math.metrics.containerWidth-4)/this.pxPerEm;t>i&&t&&(s*=i/t)}1!==s&&this.adaptor.setStyle(t,"fontSize",xo(s))}getInitialScale(){return this.math.metrics.scale}toDOM(t,e,s=null){var i;this.setDocument(s),this.math=t,this.container=e,this.pxPerEm=t.metrics.ex/this.font.params.x_height,this.executeFilters(this.preFilters,t,s,e),this.nodeMap=new Map,t.root.attributes.getAllInherited().overflow=this.options.displayOverflow;const r=t.root.attributes.get("overflow");this.adaptor.setAttribute(e,"overflow",r);"linebreak"===r&&this.getLinebreakWidth();const n=this.options.linebreaks.inline&&!t.display;let o=!!t.root.getProperty("inlineMarked");!o||n&&this.forceInlineBreaks===t.root.getProperty("inlineForced")||(this.unmarkInlineBreaks(t.root),t.root.removeProperty("inlineMarked"),t.root.removeProperty("inlineForced"),o=!1),n&&!o&&(this.markInlineBreaks(null===(i=t.root.childNodes)||void 0===i?void 0:i[0]),t.root.setProperty("inlineMarked",!0),t.root.setProperty("inlineForced",this.forceInlineBreaks)),t.root.setTeXclass(null);const a=this.factory.wrap(t.root);this.setScale(e,a),this.processMath(a,e),this.nodeMap=null,this.executeFilters(this.postFilters,t,s,e)}getBBox(t,e){this.setDocument(e),this.math=t,t.root.setTeXclass(null),this.nodeMap=new Map;const s=this.factory.wrap(t.root).getOuterBBox();return this.nodeMap=null,s}getLinebreakWidth(){const t=this.math.metrics.containerWidth/this.pxPerEm,e=this.math.root.attributes.get("maxwidth")||this.options.linebreaks.width;this.containerWidth=Eo(e,t,1,this.pxPerEm)}markInlineBreaks(t){if(!t)return;const e=this.forceInlineBreaks;let s=!1,i=!1,r="";for(const n of t.childNodes)if(r)i=this.markInlineBreak(i,e,r,t,n),r="",s=!1;else if(n.isEmbellished){if(n===t.childNodes[0])continue;const o=n.coreMO(),a=o.texClass,l=o.attributes.get("linebreak"),c=o.attributes.get("linebreakstyle");(a===fr.BIN||a===fr.REL||a===fr.ORD&&o.hasSpacingAttributes()||"auto"!==l)&&"nobreak"!==l&&("before"===c?s&&"auto"===l||(i=this.markInlineBreak(i,e,l,t,n,o)):r=l),s="newline"===l&&"after"===c}else if(n.isKind("mspace")){const r=n.attributes.get("linebreak");"nobreak"!==r&&n.canBreak&&(i=this.markInlineBreak(i,e,r,t,n)),s="newline"===r}else s=!1,n.isKind("mstyle")&&!n.attributes.get("style")&&!n.attributes.hasExplicit("mathbackground")||n.isKind("semantics")?(this.markInlineBreaks(n.childNodes[0]),n.getProperty("process-breaks")&&(n.setProperty("inline-breaks",!0),n.childNodes[0].setProperty("inline-breaks",!0),t.parent.setProperty("process-breaks","true"))):n.isKind("mrow")&&n.attributes.get("data-semantic-added")&&(this.markInlineBreaks(n),n.getProperty("process-breaks")&&(n.setProperty("inline-breaks",!0),t.parent.setProperty("process-breaks","true")))}markInlineBreak(t,e,s,i,r,n=null){return r.setProperty("breakable",!0),e&&"newline"!==s?(r.setProperty("forcebreak",!0),null==n||n.setProperty("forcebreak",!0)):(r.removeProperty("forcebreak"),null==n||n.removeProperty("forcebreak"),"newline"===s&&r.setProperty("newline",!0)),t||(i.setProperty("process-breaks",!0),i.parent.setProperty("process-breaks",!0),t=!0),t}unmarkInlineBreaks(t){if(t&&(t.removeProperty("forcebreak"),t.removeProperty("breakable"),t.coreMO().removeProperty("forcebreak"),t.getProperty("process-breaks"))){t.removeProperty("process-breaks");for(const e of t.childNodes)this.unmarkInlineBreaks(e)}}getMetrics(t){this.setDocument(t);const e=this.adaptor,s=this.getMetricMaps(t);for(const i of t.math){const t=e.parent(i.start.node);if(i.state(){const s=this.wrap(t);return s.bbox.pwidth&&(e.notParent||e.isKind("math"))&&(this.bbox.pwidth=vo.fullWidth),s})}wrap(t,e=null){const s=this.factory.wrap(t,e||this);return e&&e.childNodes.push(s),this.jax.nodeMap.set(t,s),s}getBBox(t=!0){if(this.bboxComputed)return this.bbox;const e=t?this.bbox:vo.zero();return this.computeBBox(e),this.bboxComputed=t,e}getOuterBBox(t=!0){var e;const s=this.getBBox(t);if(!this.styleData)return s;const i=this.styleData.padding,r=(null===(e=this.styleData.border)||void 0===e?void 0:e.width)||[0,0,0,0],n=this.styleData.margin||[0,0,0,0],o=s.copy();for(const[,t,e]of vo.boxSides)o[e]+=i[t]+r[t]+n[t];return o}getUnbrokenHD(){const t=this.breakCount+1;let e=0,s=0;for(let i=0;ie&&(e=t),r>s&&(s=r)}return[e,s]}computeBBox(t,e=!1){t.empty();for(const e of this.childNodes)t.append(e.getOuterBBox());t.clean(),this.fixesPWidth&&this.setChildPWidths(e)&&this.computeBBox(t,!0)}getLineBBox(t){if(!this.lineBBox[t]){const e=this.breakCount;if(e){const s=this.embellishedBBox(t)||this.computeLineBBox(t);this.lineBBox[t]=s,0===t&&(!this.node.isKind("mo")&&this.node.isEmbellished?s.originalL=this.getBBox().L:s.L=this.getBBox().L),t===e&&(s.R=this.getBBox().R)}else{const e=this.getOuterBBox();this.lineBBox[t]=jc.from(e,this.linebreakOptions.lineleading)}}return this.lineBBox[t]}embellishedBBox(t){if(!this.node.isEmbellished||this.node.isKind("mo"))return null;const e=this.coreMO();return e.moLineBBox(t,e.embellishedBreakStyle,this.getOuterBBox())}computeLineBBox(t){return this.getChildLineBBox(this.childNodes[0],t)}getBreakNode(t){var e,s;if(!t.start)return[this,null];const[i,r]=t.start;if(this.node.isEmbellished)return[this,this.coreMO()];const n=(null===(s=null===(e=this.childNodes[0])||void 0===e?void 0:e.node)||void 0===s?void 0:s.isInferred)||this.node.isKind("semantics")?this.childNodes[0].childNodes:this.childNodes;return this.node.isToken||!n[i]?[this,null]:n[i].getBreakNode(n[i].getLineBBox(r))}getChildLineBBox(t,e){const s=this.breakCount;let i=t.getLineBBox(e);return(this.styleData||this.bbox.L||this.bbox.R)&&(i=i.copy()),this.addMiddleBorders(i),0===e?(i.L+=this.bbox.L,this.addLeftBorders(i)):e===s&&(i.R+=this.bbox.R,this.addRightBorders(i)),i}sideStyleSize(t){var e;const s=this.styleData.border,i=this.styleData.padding,r=this.styleData.margin;return((null===(e=null==s?void 0:s.width)||void 0===e?void 0:e[t])||0)+((null==i?void 0:i[t])||0)+((null==r?void 0:r[t])||0)}addLeftBorders(t){this.styleData&&(t.w+=this.sideStyleSize(3))}addMiddleBorders(t){this.styleData&&(t.h+=this.sideStyleSize(0),t.d+=this.sideStyleSize(2))}addRightBorders(t){this.styleData&&(t.w+=this.sideStyleSize(1))}setChildPWidths(t,e=null,s=!0){if(t)return!1;s&&(this.bbox.pwidth="");let i=!1;for(const r of this.childNodes){const n=r.getBBox();n.pwidth&&r.setChildPWidths(t,null===e?n.w:e,s)&&(i=!0)}return i}breakToWidth(t){}invalidateBBox(t=!0){(this.bboxComputed||this._breakCount>=0)&&(this.bboxComputed=!1,this.lineBBox=[],this._breakCount=-1,this.parent&&t&&this.parent.invalidateBBox())}copySkewIC(t){var e,s,i;const r=this.childNodes[0];(null===(e=null==r?void 0:r.bbox)||void 0===e?void 0:e.sk)&&(t.sk=r.bbox.sk),(null===(s=null==r?void 0:r.bbox)||void 0===s?void 0:s.dx)&&(t.dx=r.bbox.dx);const n=this.childNodes[this.childNodes.length-1];(null===(i=null==n?void 0:n.bbox)||void 0===i?void 0:i.ic)&&(t.ic=n.bbox.ic,t.w+=t.ic)}getStyles(){const t=this.node.attributes.getExplicit("style");if(!t)return;const e=this.styles=new qo(t);for(let t=0,s=Kc.removeStyles.length;t600?"bold":"normal"),s.family?e=this.explicitVariant(s.family,s.weight,s.style):(this.node.getProperty("variantForm")&&(e="-tex-variant"),e=(Kc.BOLDVARIANTS[s.weight]||{})[e]||e,e=(Kc.ITALICVARIANTS[s.style]||{})[e]||e)}this.variant=e}explicitVariant(t,e,s){let i=this.styles;return i||(i=this.styles=new qo),i.set("fontFamily",t),e&&i.set("fontWeight",e),s&&i.set("fontStyle",s),"-explicitFont"}getScale(){let t=1;const e=this.parent,s=e?e.bbox.scale:1,i=this.node.attributes,r=Math.min(i.get("scriptlevel"),2);let n=i.get("fontsize"),o=this.node.isToken||this.node.isKind("mstyle")?i.get("mathsize"):i.getInherited("mathsize");if(0!==r&&(t=Math.pow(i.get("scriptsizemultiplier"),r)),this.removedStyles&&this.removedStyles.fontSize&&!n&&(n=this.removedStyles.fontSize),n&&!i.hasExplicit("mathsize")&&(o=n),"1"!==o&&(t*=this.length2em(o,1,1)),0!==r){const e=this.length2em(i.get("scriptminsize"),.4,1);t0;if(this.bbox.L=n.isSet("lspace")?Math.max(0,this.length2em(n.get("lspace"))):Gc(o,r,t.lspace),this.bbox.R=n.isSet("rspace")?Math.max(0,this.length2em(n.get("rspace"))):Gc(o,r,t.rspace),!i)return;const a=s.childNodes[i-1];if(!a.isEmbellished)return;const l=this.jax.nodeMap.get(a).getBBox();l.R&&(this.bbox.L=Math.max(0,this.bbox.L-l.R))}getTeXSpacing(t,e){if(!e){const t=this.node.texSpacing();t&&(this.bbox.L=this.length2em(t))}if(t||e){const t=this.node.coreMO().attributes;t.isSet("lspace")&&(this.bbox.L=Math.max(0,this.length2em(t.get("lspace")))),t.isSet("rspace")&&(this.bbox.R=Math.max(0,this.length2em(t.get("rspace"))))}}isTopEmbellished(){return this.node.isEmbellished&&!(this.node.parent&&this.node.parent.isEmbellished)}core(){return this.jax.nodeMap.get(this.node.core())}coreMO(){return this.jax.nodeMap.get(this.node.coreMO())}coreRScale(){let t=this.bbox.rscale,e=this.coreMO();for(;e!==this&&e;)t*=e.bbox.rscale,e=e.parent;return t}getRScale(){let t=1,e=this;for(;e;)t*=e.bbox.rscale,e=e.parent;return t}getText(){let t="";if(this.node.isToken)for(const e of this.node.childNodes)e instanceof Lr&&(t+=e.getText());return t}canStretch(t){if(this.stretch=Pc,this.node.isEmbellished){const e=this.core();e&&e.node!==this.node&&e.canStretch(t)&&(this.stretch=e.stretch)}return this.stretch.dir!==Mc.None}getAlignShift(){let{indentalign:t,indentshift:e,indentalignfirst:s,indentshiftfirst:i}=this.node.attributes.getAllAttributes();return"indentalign"!==s&&(t=s),"indentshift"!==i&&(e=i),this.processIndent(t,e)}processIndent(t,e,s="",i="",r=this.metrics.containerWidth){if(!this.jax.math.display)return["left",0];s&&"auto"!==s||(s=this.jax.math.root.getProperty("inlineMarked")?"left":this.jax.options.displayAlign),i&&"auto"!==i||(i=this.jax.math.root.getProperty("inlineMarked")?"0":this.jax.options.displayIndent),"auto"===t&&(t=s),"auto"===e&&(e=i,"right"!==t||e.match(/^\s*0[a-z]*\s*$/)||(e=("-"+e.trim()).replace(/^--/,"")));return[t,this.length2em(e,r)]}getAlignX(t,e,s){return"right"===s?t-(e.w+e.R)*e.rscale:"left"===s?e.L*e.rscale:(t-e.w*e.rscale)/2}getAlignY(t,e,s,i,r){return"top"===r?t-s:"bottom"===r?i-e:"center"===r?(t-s-(e-i))/2:0}getWrapWidth(t){return this.childNodes[t].getBBox().w}getChildAlign(t){return"left"}percent(t){return xo(t)}em(t){return yo(t)}px(t,e=-mo){return No(t,e,this.metrics.em)}length2em(t,e=1,s=null){null===s&&(s=this.bbox.scale);const i=this.font.params.rule_thickness,r=Hi(t,{medium:1,thin:2/3,thick:5/3},0);return r?r*i:Eo(t,e,s,this.jax.pxPerEm)}unicodeChars(t,e=this.variant){let s=_r(t);const i=this.font.getVariant(e);if(i&&i.chars){const t=i.chars;s=s.map(e=>{var s,i;return(null===(i=null===(s=t[e])||void 0===s?void 0:s[3])||void 0===i?void 0:i.smp)||e})}return s}remapChars(t){return t}mmlText(t){return this.node.factory.create("text").setText(t)}mmlNode(t,e={},s=[]){return this.node.factory.create(t,e,s)}createMo(t){const e=this.node.factory,s=e.create("text").setText(t),i=e.create("mo",{stretchy:!0},[s]);i.inheritAttributesFrom(this.node),i.parent=this.node.parent;const r=this.wrap(i);return r.parent=this,r}getVariantChar(t,e){const s=this.font.getChar(t,e)||[0,0,0,{unknown:!0}];return 3===s.length&&(s[3]={}),s}html(t,e={},s=[]){return this.jax.html(t,e,s)}}Kc.kind="unknown",Kc.styles={},Kc.removeStyles=["fontSize","fontFamily","fontWeight","fontStyle","fontVariant","font"],Kc.skipAttributes={fontfamily:!0,fontsize:!0,fontweight:!0,fontstyle:!0,color:!0,background:!0,class:!0,href:!0,style:!0,xmlns:!0},Kc.BOLDVARIANTS={bold:{normal:"bold",italic:"bold-italic",fraktur:"bold-fraktur",script:"bold-script","sans-serif":"bold-sans-serif","sans-serif-italic":"sans-serif-bold-italic"},normal:{bold:"normal","bold-italic":"italic","bold-fraktur":"fraktur","bold-script":"script","bold-sans-serif":"sans-serif","sans-serif-bold-italic":"sans-serif-italic"}},Kc.ITALICVARIANTS={italic:{normal:"italic",bold:"bold-italic","sans-serif":"sans-serif-italic","bold-sans-serif":"sans-serif-bold-italic"},normal:{italic:"normal","bold-italic":"bold","sans-serif-italic":"sans-serif","sans-serif-bold-italic":"bold-sans-serif"}};const $c={"70.7%":"s","70%":"s","50%":"ss","60%":"Tn","85%":"sm","120%":"lg","144%":"Lg","173%":"LG","207%":"hg","249%":"HG"};class Yc extends Kc{toCHTML(t){this.toEmbellishedCHTML(t)||this.addChildren(this.standardChtmlNodes(t))}toEmbellishedCHTML(t){if(t.length<=1||!this.node.isEmbellished)return!1;const e=this.adaptor;t.forEach(t=>e.append(t,this.html("mjx-linestrut")));const s=this.coreMO().embellishedBreakStyle,i=[];for(const[r,n]of[[t[0],"before"],[t[1],"after"]])s!==n?(this.toCHTML([r]),i.push(this.dom[0]),"after"===n&&e.removeAttribute(this.dom[0],"space")):i.push(this.createChtmlNodes([r])[0]);return this.dom=i,!0}addChildren(t){for(const e of this.childNodes)e.toCHTML(t)}standardChtmlNodes(t){this.markUsed();const e=this.createChtmlNodes(t);return this.handleStyles(),this.handleScale(),this.handleBorders(),this.handleColor(),this.handleSpace(),this.handleAttributes(),this.handlePWidth(),e}markUsed(){this.jax.wrapperUsage.add(this.kind)}createChtmlNodes(t){this.dom=t.map(t=>this.html("mjx-"+this.node.kind)),t=this.handleHref(t);for(const e of t.keys())this.adaptor.append(t[e],this.dom[e]);return this.dom}handleHref(t){const e=this.node.attributes.get("href");return e?t.map(t=>this.adaptor.append(t,this.html("a",{href:e}))):t}handleStyles(){if(!this.styles)return;const t=this.styles.cssText;if(t){const e=this.adaptor;this.dom.forEach(s=>e.setAttribute(s,"style",t));const s=this.styles.get("font-family");s&&this.dom.forEach(t=>e.setStyle(t,"font-family",this.font.cssFamilyPrefix+", "+s))}}handleScale(){this.dom.forEach(t=>this.setScale(t,this.bbox.rscale))}setScale(t,e){const s=Math.abs(e-1)<.001?1:e;if(t&&1!==s){const e=this.percent(s);$c[e]?this.adaptor.setAttribute(t,"size",$c[e]):this.adaptor.setStyle(t,"fontSize",e)}return t}handleSpace(){const t=this.adaptor,e=!!this.node.getProperty("breakable")&&!this.node.getProperty("newline"),s=this.dom.length-1;for(const i of[[this.getLineBBox(0).L,"space","marginLeft",0],[this.getLineBBox(s).R,"rspace","marginRight",s]]){const[s,r,n,o]=i,a=this.em(s);if(e&&"space"===r){const e=t.node("mjx-break",Jc[a]?{size:Jc[a]}:{style:`letter-spacing: ${this.em(s-1)}`},[t.text(" ")]);t.insert(e,this.dom[o])}else s&&(Jc[a]?t.setAttribute(this.dom[o],r,Jc[a]):t.setStyle(this.dom[o],n,a))}}handleBorders(){var t,e;const s=null===(t=this.styleData)||void 0===t?void 0:t.border,i=null===(e=this.styleData)||void 0===e?void 0:e.padding,r=this.dom.length-1;if(!s||!r)return;const n=this.adaptor;for(const t of this.dom.keys()){const e=this.dom[t];t&&(s.width[3]&&n.setStyle(e,"border-left"," none"),i[3]&&n.setStyle(e,"padding-left","0")),t!==r&&(s.width[1]&&n.setStyle(e,"border-right","none"),i[1]&&n.setStyle(e,"padding-right","0"))}}handleColor(){var t;const e=this.adaptor,s=this.node.attributes,i=s.getExplicit("mathcolor")||s.getExplicit("color"),r=s.getExplicit("mathbackground")||s.getExplicit("background")||(null===(t=this.styles)||void 0===t?void 0:t.get("background-color"));i&&this.dom.forEach(t=>e.setStyle(t,"color",i)),r&&this.dom.forEach(t=>e.setStyle(t,"backgroundColor",r))}handleAttributes(){const t=this.adaptor,e=this.node.attributes,s=e.getAllDefaults(),i=Yc.skipAttributes;for(const r of e.getExplicitNames())if(!1===i[r]||!(r in s)&&!i[r]&&!t.hasAttribute(this.dom[0],r)){const s=e.getExplicit(r);this.dom.forEach(e=>t.setAttribute(e,r,s))}if(e.get("class")){const s=e.get("class").trim().split(/ +/);for(const e of s)this.dom.forEach(s=>t.addClass(s,e))}this.node.getProperty("inline-breaks")&&this.dom.forEach(e=>t.setAttribute(e,"inline-breaks","true"))}handlePWidth(){if(this.bbox.pwidth){const t=this.adaptor;this.bbox.pwidth===vo.fullWidth?this.dom.forEach(e=>t.setAttribute(e,"width","full")):this.dom.forEach(e=>t.setStyle(e,"width",this.bbox.pwidth))}}setIndent(t,e,s){const i=this.adaptor;if("center"===e||"left"===e){const e=this.getBBox().L;s+e&&i.setStyle(t,"margin-left",this.em(s+e))}if("center"===e||"right"===e){const e=this.getBBox().R;s+e&&i.setStyle(t,"margin-right",this.em(-s+e))}}drawBBox(){const{w:t,h:e,d:s,R:i}=this.getOuterBBox(),r=this.html("mjx-box",{style:{opacity:.25,"margin-left":this.em(-t-i)}},[this.html("mjx-box",{style:{height:this.em(e),width:this.em(t),"background-color":"red"}}),this.html("mjx-box",{style:{height:this.em(s),width:this.em(t),"margin-left":this.em(-t),"vertical-align":this.em(-s),"background-color":"green"}})]),n=this.dom[0]||this.parent.dom[0],o=this.adaptor.getAttribute(n,"size");o&&this.adaptor.setAttribute(r,"size",o);const a=this.adaptor.getStyle(n,"fontSize");a&&this.adaptor.setStyle(r,"fontSize",a),this.adaptor.append(this.adaptor.parent(n),r),this.adaptor.setStyle(n,"backgroundColor","#FFEE00")}html(t,e={},s=[]){return this.jax.html(t,e,s)}text(t){return this.jax.text(t)}char(t){return this.font.charSelector(t).substring(1)}}function Qc(t){return class extends t{getWrapWidth(t){return this.parent?this.getBBox().w:this.metrics.containerWidth/this.jax.pxPerEm}computeBBox(t,e=!1){super.computeBBox(t,e);const s=this.node.attributes;if(!this.parent&&this.jax.math.display&&"linebreak"===s.get("overflow")){const e=this.containerWidth;t.w>e&&this.childNodes[0].breakToWidth(e),t.updateFrom(this.childNodes[0].getBBox())}}}}Yc.kind="unknown",Yc.autoStyle=!0;const Zc=function(){var t;const e=Qc(Yc);return(t=class extends e{handleDisplay(t){const e=this.adaptor,[s,i]=this.getAlignShift();if("center"!==s&&e.setAttribute(t,"justify",s),this.bbox.pwidth===vo.fullWidth){if(e.setAttribute(t,"width","full"),this.jax.table){let{L:r,w:n,R:o}=this.jax.table.getOuterBBox();"right"===s?o=Math.max(o||-i,-i):"left"===s?r=Math.max(r||i,i):"center"===s&&(n+=2*Math.abs(i));const a=this.em(Math.max(0,r+n+o));e.setStyle(t,"min-width",a),e.setStyle(this.jax.table.dom[0],"min-width",a)}}else this.setIndent(this.dom[0],s,i)}handleInline(t){const e=this.adaptor,s=e.getStyle(this.dom[0],"margin-right");s&&(e.setStyle(this.dom[0],"margin-right",""),e.setStyle(t,"margin-right",s),e.setStyle(t,"width","0"))}toCHTML(t){super.toCHTML(t);const e=this.adaptor;"block"===this.node.attributes.get("display")?(e.setAttribute(this.dom[0],"display","true"),e.setAttribute(t[0],"display","true"),this.handleDisplay(t[0])):this.handleInline(t[0]),e.addClass(this.dom[0],`${this.font.cssFontPrefix}-N`)}setChildPWidths(t,e=null,s=!0){return!!this.parent&&super.setChildPWidths(t,e,s)}handleAttributes(){super.handleAttributes();const t=this.adaptor;this.node.getProperty("process-breaks")&&this.dom.forEach(e=>t.setAttribute(e,"breakable","true"))}}).kind=Rr.prototype.kind,t.styles={"mjx-math":{"line-height":0,"text-align":"left","text-indent":0,"font-style":"normal","font-weight":"normal","font-size":"100%","font-size-adjust":"none","letter-spacing":"normal","word-wrap":"normal","word-spacing":"normal",direction:"ltr",padding:"1px 0"},'mjx-container[jax="CHTML"][display="true"] mjx-math':{padding:0},"mjx-math[breakable]":{display:"inline"},'mjx-container[jax="CHTML"] mjx-break':{"white-space":"normal","line-height":"0","clip-path":"rect(0 0 0 0)","font-family":"MJX-BRK !important"},'mjx-break[size="0"]':{"letter-spacing":"-0.999em"},'mjx-break[size="1"]':{"letter-spacing":"-0.889em"},'mjx-break[size="2"]':{"letter-spacing":"-0.833em"},'mjx-break[size="3"]':{"letter-spacing":"-0.778em"},'mjx-break[size="4"]':{"letter-spacing":"-0.722em"},'mjx-break[size="5"]':{"letter-spacing":"-0.667em"}},t}();function th(t){return class extends t{computeBBox(t,e=!1){super.computeBBox(t),this.copySkewIC(t)}}}const eh=function(){var t;const e=th(Yc);return(t=class extends e{}).kind=Mr.prototype.kind,t}();class sh{constructor(){this.used=new Set,this.needsUpdate=[]}add(t){const e=JSON.stringify(t);this.used.has(e)||this.needsUpdate.push(t),this.used.add(e)}has(t){return this.used.has(JSON.stringify(t))}clear(){this.used.clear(),this.needsUpdate=[]}update(){const t=this.needsUpdate;return this.needsUpdate=[],t}}class ih extends Fc{constructor(){super(...arguments),this.charUsage=new sh,this.delimUsage=new sh,this.fontUsage={},this.newFonts=0}static charOptions(t,e){return super.charOptions(t,e)}static addFontURLs(t,e,s){for(const i of Object.keys(e)){const r=Object.assign({},e[i]);r.src=r.src.replace(/%%URL%%/,s),t[i]=r}}static addDynamicFontCss(t,e,s){const i={};for(const s of e){const e=s.slice(4);i[`@font-face /* ${e} */`]={"font-family":s,src:`url("%%URL%%/${s.toLowerCase()}.woff2") format("woff2")`},t[`.${e}`]={"font-family":`${this.defaultCssFamilyPrefix}, ${s}`}}this.addFontURLs(t,i,s)}static addExtension(t,e=""){super.addExtension(t,e),t.fonts&&this.addDynamicFontCss(this.defaultStyles,t.fonts,t.fontURL)}addExtension(t,e=""){if(super.addExtension(t,e),!t.fonts||!this.options.adaptiveCSS)return[];const s={},i=new ao;return this.constructor.addDynamicFontCss(s,t.fonts,t.fontURL),i.addStyles(s),i.getStyleRules()}adaptiveCSS(t){this.options.adaptiveCSS=t}clearCache(){this.options.adaptiveCSS&&(this.charUsage.clear(),this.delimUsage.clear())}createVariant(t,e=null,s=null){super.createVariant(t,e,s),this.variant[t].letter=this.constructor.defaultVariantLetters[t]}defineChars(t,e){super.defineChars(t,e);const s=this.variant[t].letter,i=this.constructor;for(const t of Object.keys(e)){const r=parseInt(t);if(!Array.isArray(e[r]))continue;const n=i.charOptions(e,r);void 0===n.f&&(n.f=s);for(const[t,e]of i.combiningChars)if(r>=t&&r<=e){n.cmb=!0;break}}}addDynamicFontCss(t,e=this.options.fontURL){this.constructor.addDynamicFontCss(this.fontUsage,t,e)}updateDynamicStyles(){const t=this.fontUsage;return this.fontUsage={},this.options.adaptiveCSS||this.updateStyles(t),t}get styles(){const t=this.constructor,e=Object.assign(Object.assign({},t.defaultStyles),this.fontUsage);return this.fontUsage={},t.addFontURLs(e,t.defaultFonts,this.options.fontURL),this.options.adaptiveCSS?this.updateStyles(e):this.allStyles(e),e}updateStyles(t){for(const e of this.delimUsage.update())this.addDelimiterStyles(t,e,this.getDelimiter(e));for(const[e,s]of this.charUsage.update()){const i=this.variant[e];this.addCharStyles(t,i.letter,s,i.chars[s])}return t}allStyles(t){var e;for(const e of Object.keys(this.delimiters)){const s=parseInt(e);this.addDelimiterStyles(t,s,this.delimiters[s])}for(const s of Object.keys(this.variant)){const i=this.variant[s],r=i.letter;for(const s of Object.keys(i.chars)){const n=parseInt(s),o=i.chars[n];!(null===(e=null==o?void 0:o[3])||void 0===e?void 0:e.smp)&&Array.isArray(o)&&(o.length<4&&(o[3]={}),this.addCharStyles(t,r,n,o))}}}addDelimiterStyles(t,e,s){if(!s.stretch)return;const i=s.c&&s.c!==e?this.charSelector(s.c):this.charSelector(e);s.dir===Mc.Vertical?this.addDelimiterVStyles(t,e,i,s):this.addDelimiterHStyles(t,e,i,s)}addDelimiterVStyles(t,e,s,i){const r=i.HDW,[n,o,a,l]=i.stretch,[c,h,d,u]=this.getStretchVariants(e),p=this.addDelimiterVPart(t,s,"beg",n,c,r);this.addDelimiterVPart(t,s,"ext",o,h,r);const m=this.addDelimiterVPart(t,s,"end",a,d,r);if(l){const e=this.addDelimiterVPart(t,s,"mid",l,u,r),i=this.em(e/2-.03);t[`mjx-stretchy-v${s} > mjx-ext:first-of-type`]={height:"50%","border-width":`${this.em1(p-.03)} 0 ${i}`},t[`mjx-stretchy-v${s} > mjx-ext:last-of-type`]={height:"50%","border-width":`${i} 0 ${this.em1(m-.03)}`}}else(m||p)&&(t[`mjx-stretchy-v${s} > mjx-ext`]["border-width"]=`${this.em1(p-.03)} 0 ${this.em1(m-.03)}`)}addDelimiterVPart(t,e,s,i,r,n){if(!i)return 0;let o=0;const[a,l,c]=this.getChar(r,i),h={width:this.em0(c)};if("ext"!==s){const t=c>n[2]?this.em((n[2]-c)/2):"auto",e="beg"===s?a:"end"===s?-l:(a-l)/2;h.margin=`${this.em(e)} ${t} ${this.em(-e)}`}else{o=Oc;const s=Math.max(Oc,a+l-Oc);h["line-height"]=this.em0(s);const i=a-s/2-Oc;i&&(t[`mjx-stretchy-v${e} > mjx-ext > mjx-spacer`]={"margin-top":this.em(i)})}return t[`mjx-stretchy-v${e} > mjx-${s}`]=h,Math.max(0,a+l-o)}addDelimiterHStyles(t,e,s,i){const r=[...i.HDW],[n,o,a,l]=i.stretch,[c,h,d,u]=this.getStretchVariants(e);if(i.hd&&!this.options.mathmlSpacing){const t=this.params.extender_factor;r[0]=r[0]*(1-t)+i.hd[0]*t,r[1]=r[1]*(1-t)+i.hd[1]*t}const p=this.addDelimiterHPart(t,s,"beg",n,c,r);this.addDelimiterHPart(t,s,"ext",o,h,r);const m=this.addDelimiterHPart(t,s,"end",a,d,r);if(l){const e=this.addDelimiterHPart(t,s,"mid",l,u,r),i=this.em0(e/2-.03);t[`mjx-stretchy-h${s} > mjx-ext:first-of-type`]={width:"50%","border-width":`0 ${i} 0 ${this.em0(p-.03)}`},t[`mjx-stretchy-h${s} > mjx-ext:last-of-type`]={width:"50%","border-width":`0 ${this.em0(m-.03)} 0 ${i}`}}else(p||m)&&(t[`mjx-stretchy-h${s} > mjx-ext`]["border-width"]=`0 ${this.em0(m-.06)} 0 ${this.em0(p-.06)}`);i.ext&&(t[`mjx-stretchy-h${s} > mjx-ext > mjx-spacer`]["letter-spacing"]=this.em(-i.ext-Dc))}addDelimiterHPart(t,e,s,i,r,n){if(!i)return 0;let[,,o,a]=this.getChar(r,i);const l={padding:this.padding(n,o-n[2])};if("ext"===s){const i=l.padding.split(/ /);i[1]=i[3]="0",l.padding=i.join(" "),!o&&a.dx&&(o=2*a.dx-.06),t[`mjx-stretchy-h${e} > mjx-${s} > mjx-spacer`]={"margin-left":this.em(-o/2)},a.cmb&&(t[`mjx-stretchy-h${e} > mjx-${s} > mjx-c`]={width:this.em(o),"text-align":"right"})}else"mid"===s?l.margin=`0 ${this.em(-o/2)}`:l["end"==s?"margin-left":"margin-right"]=this.em(-o),this.checkCombiningChar(a,l);return t[`mjx-stretchy-h${e} > mjx-${s}`]=l,o}addCharStyles(t,e,s,i){const r=i[3],n=void 0!==r.f?r.f:e,o=r.ff||(n?`${this.cssFontPrefix}-${n}`:""),a="mjx-c"+this.charSelector(s)+(o?"."+o:""),l=r.oc||r.ic||0,c={padding:this.padding(i,l)};r.oc&&(t[a+"[noic]"]={"padding-right":this.em(i[2])}),this.checkCombiningChar(r,c),t[a+(c["margin-left"]&&!o?`:not([class*="${this.cssFontPrefix}-"])`:"")]=c}checkCombiningChar(t,e){if(!t.cmb)return;const s=e.padding.split(/ /);e.width=s[1],s[1]="0",s[3]||s.pop(),e.padding=s.join(" "),"0"===e.width&&t.dx&&(e.width=this.em(2*t.dx),e["margin-left"]="-"+e.width)}em(t){return yo(t)}em0(t){return yo(Math.max(0,t))}em1(t){const e=yo(Math.max(0,t));return"0"===e?".1px":e}padding([t,e,s],i=0){return[t,s+i,e,0].map(this.em0).join(" ")}charSelector(t){return".mjx-c"+t.toString(16).toUpperCase()}}function rh(t,e){for(const s of Object.keys(e)){const i=parseInt(s),r=e[i];r.c&&(r.c=r.c.replace(/\\[0-9A-F]+/gi,t=>String.fromCodePoint(parseInt(t.substring(1),16)))),Object.assign(Fc.charOptions(t,i),r)}return t}function nh(t){return class extends t{get breakCount(){return this.breakStyle?1:0}get embellishedBreakCount(){return this.embellishedBreakStyle?1:0}get embellishedBreakStyle(){return this.breakStyle||this.getBreakStyle()}protoBBox(t){const e=this.stretch.dir!==Mc.None;e&&null===this.size&&this.getStretchedVariant([0]),e&&this.size<0||(super.computeBBox(t),0!==t.w||!this.node.attributes.hasExplicit("fence")||""!==this.node.getText()||this.node.texClass!==fr.OPEN&&this.node.texClass!==fr.CLOSE||this.jax.options.mathmlSpacing||(t.R=this.font.params.nulldelimiterspace),this.copySkewIC(t))}getAccentOffset(){const t=vo.empty();return this.protoBBox(t),-t.w/2}getCenterOffset(t=null){return t||(t=vo.empty(),super.computeBBox(t)),(t.h+t.d)/2+this.font.params.axis_height-t.h}getStretchedVariant(t,e=!1){if(this.stretch.dir===Mc.None)return;let s=this.getWH(t);const i=this.getSize("minsize",0),r=this.getSize("maxsize",1/0),n=this.node.getProperty("mathaccent");s=Math.max(i,Math.min(r,s));const o=this.font.params.delimiterfactor/1e3,a=this.font.params.delimitershortfall,l=i||e?s:n?Math.min(s/o,s+a):Math.max(s*o,s-a),c=this.getText().codePointAt(0);let h=this.stretch;this.size&&(this.stretch=h=this.font.getDelimiter(c),this.size=null);const d=h.c||c;let u=0;if(h.sizes)for(const t of h.sizes){if(t>=l)return n&&u&&u--,void this.setDelimSize(d,u);u++}h.stretch?(this.size=-1,this.invalidateBBox(),this.getStretchBBox(t,this.checkExtendedHeight(s,h),h)):this.setDelimSize(d,u-1)}setDelimSize(t,e){const s=this.stretch;this.variant=this.font.getSizeVariant(t,e),this.size=e;const i=s.schar&&s.schar[Math.min(e,s.schar.length-1)]||t;this.stretch=Object.assign(Object.assign({},s),{c:i}),this.childNodes[0].invalidateBBox()}getSize(t,e){const s=this.node.attributes;return s.isSet(t)&&(e=this.length2em(s.get(t),1,1)),e}getWH(t){if(0===t.length)return 0;if(1===t.length)return t[0];const[e,s]=t,i=this.font.params.axis_height;return this.node.attributes.get("symmetric")?2*Math.max(e-i,s+i):e+s}getStretchBBox(t,e,s){Object.hasOwn(s,"min")&&s.min>e&&(e=s.min);let[i,r,n]=s.HDW;if(this.stretch.dir===Mc.Vertical)[i,r]=this.getBaseline(t,e,s);else if(n=e,this.stretch.hd&&!this.jax.options.mathmlSpacing){const t=this.font.params.extender_factor;i=i*(1-t)+this.stretch.hd[0]*t,r=r*(1-t)+this.stretch.hd[1]*t}this.bbox.h=i,this.bbox.d=r,this.bbox.w=n}getBaseline(t,e,s){const i=2===t.length&&t[0]+t[1]===e,r=this.node.attributes.get("symmetric"),[n,o]=i?t:[e,0];let[a,l]=[n+o,0];if(r){const t=this.font.params.axis_height;i&&(a=2*Math.max(n-t,o+t)),l=a/2-t}else if(i)l=o;else{const[t,e]=s.HDW||[.75,.25];l=e*(a/(t+e))}return[a-l,l]}checkExtendedHeight(t,e){if(e.fullExt){const[s,i]=e.fullExt;t=i+Math.ceil(Math.max(0,t-i)/s)*s}return t}setBreakStyle(t=""){var e;if(this.breakStyle=(null===(e=this.node.parent)||void 0===e?void 0:e.isEmbellished)&&!t?"":this.getBreakStyle(t),this.breakCount&&this.multChar){const t=this.parent.node.childIndex(this.node),e=this.parent.node.childNodes[t+1];e&&e.setTeXclass(this.multChar.node)}}getBreakStyle(t=""){const e=this.node.attributes;let s=t||("newline"===e.get("linebreak")||this.node.getProperty("forcebreak")?e.get("linebreakstyle"):"");return"infixlinebreakstyle"===s&&(s=e.get(s)),s}getMultChar(){const t=this.node.attributes.get("linebreakmultchar");t&&"\u2062"===this.getText()&&"\u2062"!==t&&(this.multChar=this.createMo(t))}constructor(t,e,s=null){super(t,e,s),this.size=null,this.isAccent=this.node.isAccent,this.getMultChar(),this.setBreakStyle()}computeBBox(t,e=!1){if(this.protoBBox(t),this.node.attributes.get("symmetric")&&this.stretch.dir!==Mc.Horizontal){const e=this.getCenterOffset(t);t.h+=e,t.d-=e}this.node.getProperty("mathaccent")&&(this.stretch.dir===Mc.None||this.size>=0)&&(t.w=0)}computeLineBBox(t){return this.moLineBBox(t,this.breakStyle)}moLineBBox(t,e,s=null){const i=this.node.attributes.get("lineleading"),r=this.length2em(i,this.linebreakOptions.lineleading);if(0===t&&"before"===e){const t=jc.from(vo.zero(),r);return t.originalL=this.bbox.L,this.bbox.L=0,t}let n=jc.from(s||this.getOuterBBox(),r);return 1===t&&("after"===e?(n.w=n.h=n.d=0,n.isFirst=!0,this.bbox.R=0):"duplicate"===e?n.L=0:this.multChar&&(n=jc.from(this.multChar.getOuterBBox(),r)),n.getIndentData(this.node)),n}canStretch(t){if(this.stretch.dir!==Mc.None)return this.stretch.dir===t;if(!this.node.attributes.get("stretchy"))return!1;const e=this.getText();if(1!==Array.from(e).length)return!1;const s=this.font.getDelimiter(e.codePointAt(0));return this.stretch=s&&s.dir===t?s:Pc,this.stretch.dir!==Mc.None}getVariant(){this.node.attributes.get("largeop")?this.variant=this.node.attributes.get("displaystyle")?"-largeop":"-smallop":this.node.attributes.hasExplicit("mathvariant")||!1!==this.node.getProperty("pseudoscript")?super.getVariant():this.variant="-tex-variant"}remapChars(t){const e=this.node.getProperty("primes");if(e)return _r(e);if(1===t.length){const e=this.node.coreParent().parent,s=this.isAccent&&!e.isKind("mrow")?"accent":"mo",i=this.font.getRemappedChar(s,t[0]);i&&(t=this.unicodeChars(i,this.variant))}return t}}}ih.OPTIONS=Object.assign(Object.assign({},Fc.OPTIONS),{dynamicPrefix:"./chtml/dynamic",fontURL:"./chtml/woff2"}),ih.JAX="CHTML",ih.defaultVariantLetters={},ih.defaultStyles={},ih.defaultFonts={},ih.combiningChars=[[768,879],[8400,8447]];const oh=function(){var t;const e=nh(Yc);return t=class extends e{toCHTML(t){const e=this.adaptor,s=this.node.attributes,i=s.get("symmetric")&&this.stretch.dir!==Mc.Horizontal,r=this.stretch.dir!==Mc.None;r&&null===this.size&&this.getStretchedVariant([]),t.length>1&&t.forEach(t=>e.append(t,this.html("mjx-linestrut")));const n=this.standardChtmlNodes(t);if(n.length>1&&"duplicate"!==this.breakStyle){const t="after"===this.breakStyle?1:0;e.remove(n[t]),n[t]=null}if(r&&this.size<0)this.stretchHTML(n);else{if(i||s.get("largeop")){const t=this.em(this.getCenterOffset());"0"!==t&&n.forEach(s=>s&&e.setStyle(s,"verticalAlign",t))}this.node.getProperty("mathaccent")&&n.forEach(t=>{e.setStyle(t,"width","0"),e.setStyle(t,"margin-left",this.em(this.getAccentOffset()))}),n[0]&&this.addChildren([n[0]]),n[1]&&(this.multChar||this).addChildren([n[1]])}}stretchHTML(t){const e=this.getText().codePointAt(0);this.font.delimUsage.add(e),this.childNodes[0].markUsed();const s=this.stretch,i=s.stretch,r=this.font.getStretchVariants(e),n=[],o=[];for(let t=0;tt?o?t[0]+t[1]:t[2]:0);l=Math.max(0,l-n);const[d,u]=t[3]?[(r-h)/2-a,(r-h)/2-c]:[r-a-c,0];this.createPart("mjx-beg",t[0],e[0],s[0],i),this.createPart("mjx-ext",t[1],e[1],s[1],i,d,l,o,a,h/2||c),t[3]&&(this.createPart("mjx-mid",t[3],e[3],s[3],i),this.createPart("mjx-ext",t[1],e[1],s[1],i,u,l,o,h/2,c)),this.createPart("mjx-end",t[2],e[2],s[2],i)}createPart(t,e,s,i,r,n=0,o=0,a="",l=0,c=0){if(s){const h=e[3],d=h.f||("normal"===i?"":this.font.getVariant(i).letter),u=h.ff||(d?`${this.font.cssFontPrefix}-${d}`:""),p=h.c||String.fromCodePoint(s);let m=[];if("mjx-ext"===t&&(o||h.dx)){if(n<0&&a)return void r.push(this.html(t,Object.assign(Object.assign({},u?{class:u}:{}),{style:{"border-width":`${this.em(l+n/2)} 0 ${this.em(c+n/2)}`,"clip-path":"none"}})));o||(o=Math.max(Dc,2*h.dx-Dc));const e=Math.min(Math.ceil(n/o)+1,500);if(h.cmb){m.push(this.html("mjx-spacer"));for(let t=0;t`mjx-stretchy-h > mjx-${t}`).join(", ")]:{display:"inline-block",width:0,"text-align":"right"},"mjx-stretchy-h > mjx-ext":{"clip-path":"padding-box polygon(0 -1em, 100% -1em, 100% calc(100% + 1em), 0 calc(100% + 1em))",width:"100%",border:"0px solid transparent","box-sizing":"border-box","text-align":"left"},"mjx-stretchy-v":{display:"inline-block","text-align":"center"},[["beg","ext","end","mid"].map(t=>`mjx-stretchy-v > mjx-${t}`).join(", ")]:{display:"block",height:0,margin:"0 auto"},"mjx-stretchy-v > mjx-ext > mjx-spacer":{display:"block"},"mjx-stretchy-v > mjx-ext":{"clip-path":"padding-box polygon(-1em 0, calc(100% + 1em) 0, calc(100% + 1em) 100%, -1em 100%)",height:"100%",border:"0.1px solid transparent","box-sizing":"border-box","white-space":"pre"},"mjx-mark":{display:"inline-block",height:0}},t}();function ah(t){return class extends t{remapChars(t){if(t.length){const e=this.font.getRemappedChar("mn",t[0]);if(e){const s=this.unicodeChars(e,this.variant);1===s.length?t[0]=s[0]:t=s.concat(t.slice(1))}}return t}}}const lh=function(){var t;const e=ah(Yc);return(t=class extends e{}).kind=Ir.prototype.kind,t}();function ch(t){return class extends t{createText(t){const e=this.wrap(this.mmlText(t));return e.parent=this,e}constructor(t,e,s=null){super(t,e,s);const i=this.node.attributes,r=i.getList("lquote","rquote");"monospace"!==this.variant&&(i.isSet("lquote")||'"'!==r.lquote||(r.lquote="\u201c"),i.isSet("rquote")||'"'!==r.rquote||(r.rquote="\u201d")),this.childNodes.unshift(this.createText(r.lquote)),this.childNodes.push(this.createText(r.rquote))}}}const hh=function(){var t;const e=ch(Yc);return(t=class extends e{}).kind=Jr.prototype.kind,t}();function dh(t){var e;return e=class extends t{constructor(){super(...arguments),this.breakPoints=[]}textWidth(t){let e=this.textNode;if(!e){const t=this.node.factory.create("text");t.parent=this.node,e=this.textNode=this.factory.wrap(t),e.parent=this}return e.node.setText(t),e.invalidateBBox(!1),e.getBBox().w}get breakCount(){return this.breakPoints.length}getVariant(){const t=this.jax.options,e=this.jax.math.outputData,s=(!!e.merrorFamily||!!t.merrorFont)&&this.node.Parent.isKind("merror");if(e.mtextFamily||t.mtextFont||s){const i=this.node.attributes.get("mathvariant"),r=this.constructor.INHERITFONTS[i]||this.jax.font.getCssFont(i),n=r[0]||(s?e.merrorFamily||t.merrorFont:e.mtextFamily||t.mtextFont);return void(this.variant=this.explicitVariant(n,r[2]?"bold":"",r[1]?"italic":""))}super.getVariant()}setBreakAt(t){this.breakPoints.push(t)}clearBreakPoints(){this.breakPoints=[]}computeLineBBox(t){const e=jc.from(this.getOuterBBox(),this.linebreakOptions.lineleading);return this.breakCount?(e.w=this.getBreakWidth(t),0===t?(e.R=0,this.addLeftBorders(e)):(e.L=0,e.indentData=[["left","0"],["left","0"],["left","0"]],t===this.breakCount&&this.addRightBorders(e)),e):e}getBreakWidth(t){const e=this.childNodes;let[s,i]=this.breakPoints[t-1]||[0,0];const[r,n]=this.breakPoints[t]||[e.length,0];let o=e[s].node.getText().split(/ /);if(s===r)return this.textWidth(o.slice(i,n).join(" "));let a=this.textWidth(o.slice(i).join(" "));for(;++s1&&t.forEach(t=>this.adaptor.append(t,this.html("mjx-linestrut")));const e=this.standardChtmlNodes(t);let{w:s,h:i,d:r}=this.getBBox();s<0&&(this.adaptor.setStyle(e[0],"marginRight",this.em(s)),s=0),s&&!this.breakCount&&this.adaptor.setStyle(e[0],"width",this.em(s)),i=Math.max(0,i+r),i&&this.adaptor.setStyle(e[0],"height",this.em(Math.max(0,i))),r&&this.adaptor.setStyle(e[0],"verticalAlign",this.em(-r))}}).kind=Gr.prototype.kind,t}();function fh(t){return class extends t{get containerWidth(){const t=this.node.attributes,e=t.get("width").toString();return e.match(/^[-+]|%$/)||"linebreak"!==t.get("data-overflow")?this.parent.containerWidth:this.length2em(e)}getDimens(){const t=this.node.attributes.getList("width","height","depth","lspace","voffset"),e=this.childNodes[0].getOuterBBox();let{w:s,h:i,d:r}=e;const n=s,o=i,a=r;let l=0,c=0,h=0;""!==t.width&&(s=this.dimen(t.width,e,"w",0)),""!==t.height&&(i=this.dimen(t.height,e,"h",0)),""!==t.depth&&(r=this.dimen(t.depth,e,"d",0)),""!==t.voffset&&(c=this.dimen(t.voffset,e)),""!==t.lspace&&(l=this.dimen(t.lspace,e));const d=this.node.attributes.get("data-align");return d&&(h=this.getAlignX(s,e,d)),[o,a,n,i-o,r-a,s-n,l,c,h]}dimen(t,e,s="",i=null){const r=(t=String(t)).match(/width|height|depth/),n=r?e[r[0].charAt(0)]:s?e[s]:0;let o=this.length2em(t,n)||0;return t.match(/^[-+]/)&&s&&(o+=n),null!=i&&(o=Math.max(i,o)),o}setBBoxDimens(t){const[e,s,i,r,n,o]=this.getDimens();t.w=i+o,t.h=e+r,t.d=s+n}computeBBox(t,e=!1){this.setBBoxDimens(t);if(this.childNodes[0].getOuterBBox().w>t.w){const e=this.node.attributes.get("data-overflow");("linebreak"===e||"auto"===e&&"linebreak"===this.jax.math.root.attributes.get("overflow"))&&(this.childNodes[0].breakToWidth(t.w),this.setBBoxDimens(t))}this.setChildPWidths(e,t.w)}getWrapWidth(t){return this.getBBox().w}getChildAlign(t){return this.node.attributes.get("data-align")||"left"}}}const gh=function(){var t;const e=fh(Yc);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;let e=this.standardChtmlNodes(t);const s=[],i={},[,,r,n,o,a,l,c,h]=this.getDimens();if((a||this.childNodes[0].getBBox().pwidth)&&(i.width=this.em(r+a)),(n||o)&&(i.margin=this.em(n)+" 0 "+this.em(o)),l+h||c){i.position="relative";const t=this.html("mjx-rbox",{style:{left:this.em(l+h),top:this.em(-c),"max-width":i.width}});l+h&&this.childNodes[0].getBBox().pwidth&&(this.adaptor.setAttribute(t,"width","full"),this.adaptor.setStyle(t,"left",this.em(l))),s.push(t)}e=[this.adaptor.append(e[0],this.html("mjx-block",{style:i},s))],this.childNodes[0].childNodes.length?this.childNodes[0].toCHTML([s[0]||e[0]]):(n||o)&&this.adaptor.append(s[0]||e[0],this.html("mjx-box"))}}).kind=sn.prototype.kind,t.styles={"mjx-mpadded":{display:"inline-block"},"mjx-rbox":{display:"inline-block",position:"relative"}},t}(),bh=4,Eh=1,xh=2,yh=.067,Nh=.2,vh=yh+"em solid",Th={top:0,right:1,bottom:2,left:3},Ch=Object.keys(Th),Ah=t=>new Array(4).fill(t.thickness+t.padding),Lh=t=>new Array(4).fill(t.padding),Sh=t=>new Array(4).fill(t.thickness),Rh=t=>Math.max(t.padding,t.thickness*(t.arrowhead.x+t.arrowhead.dx+1)),Mh=(t,e)=>{if(t.childNodes[0]){const{h:s,d:i}=t.childNodes[0].getBBox();e[0]=e[2]=Math.max(0,t.thickness*t.arrowhead.y-(s+i)/2)}return e},Ih=(t,e)=>{if(t.childNodes[0]){const{w:s}=t.childNodes[0].getBBox();e[1]=e[3]=Math.max(0,t.thickness*t.arrowhead.y-s/2)}return e},wh={up:[-Math.PI/2,!1,!0,"verticalstrike"],down:[Math.PI/2,!1,!0,"verticakstrike"],right:[0,!1,!1,"horizontalstrike"],left:[Math.PI,!1,!1,"horizontalstrike"],updown:[Math.PI/2,!0,!0,"verticalstrike uparrow downarrow"],leftright:[0,!0,!1,"horizontalstrike leftarrow rightarrow"]},kh={updiagonal:[-1,0,!1,"updiagonalstrike northeastarrow"],northeast:[-1,0,!1,"updiagonalstrike updiagonalarrow"],southeast:[1,0,!1,"downdiagonalstrike"],northwest:[1,Math.PI,!1,"downdiagonalstrike"],southwest:[-1,Math.PI,!1,"updiagonalstrike"],northeastsouthwest:[-1,0,!0,"updiagonalstrike northeastarrow updiagonalarrow southwestarrow"],northwestsoutheast:[1,0,!0,"downdiagonalstrike northwestarrow southeastarrow"]},Oh={up:t=>Ih(t,[Rh(t),0,t.padding,0]),down:t=>Ih(t,[t.padding,0,Rh(t),0]),right:t=>Mh(t,[0,Rh(t),0,t.padding]),left:t=>Mh(t,[0,t.padding,0,Rh(t)]),updown:t=>Ih(t,[Rh(t),0,Rh(t),0]),leftright:t=>Mh(t,[0,Rh(t),0,Rh(t)])},Dh=function(t){return e=>{const s=Th[e];return[e,{renderer:t,bbox:t=>{const e=[0,0,0,0];return e[s]=t.thickness+t.padding,e},border:t=>{const e=[0,0,0,0];return e[s]=t.thickness,e}}]}},Ph=function(t){return(e,s,i)=>{const r=Th[s],n=Th[i];return[e,{renderer:t,bbox:t=>{const e=t.thickness+t.padding,s=[0,0,0,0];return s[r]=s[n]=e,s},border:t=>{const e=[0,0,0,0];return e[r]=e[n]=t.thickness,e},remove:s+" "+i}]}},Bh=function(t){return e=>{const s="mjx-"+e.charAt(0)+"strike";return[e+"diagonalstrike",{renderer:t(s),bbox:Ah}]}},Fh=function(t){return e=>{const[s,i,r,n]=kh[e];return[e+"arrow",{renderer:(e,n)=>{const[o,a]=e.arrowAW(),l=e.arrow(a,s*(o-i),r);t(e,l)},bbox:t=>{const{a:e,x:s,y:i}=t.arrowData(),[r,n,o]=[t.arrowhead.x,t.arrowhead.y,t.arrowhead.dx],[a,l]=t.getArgMod(r+o,n),c=i+(a>e?t.thickness*l*Math.sin(a-e):0),h=s+(a>Math.PI/2-e?t.thickness*l*Math.sin(a+e-Math.PI/2):0);return[c,h,c,h]},remove:n}]}},jh=function(t){return e=>{const[s,i,r,n]=wh[e];return[e+"arrow",{renderer:(e,n)=>{const{w:o,h:a,d:l}=e.getBBox(),[c,h]=r?[a+l,"X"]:[o,"Y"],d=e.getOffset(h),u=e.arrow(c,s,i,h,d);t(e,u)},bbox:Oh[e],remove:n}]}};function _h(t){return class extends t{getParameters(){const t=this.node.attributes,e=t.get("data-padding");void 0!==e&&(this.padding=this.length2em(e,Nh));const s=t.get("data-thickness");void 0!==s&&(this.thickness=this.length2em(s,yh));const i=t.get("data-arrowhead");if(void 0!==i){const[t,e,s]=Wr(i);this.arrowhead={x:t?parseFloat(t):bh,y:e?parseFloat(e):xh,dx:s?parseFloat(s):Eh}}}getNotations(){const t=this.constructor.notations;for(const e of Wr(this.node.attributes.get("notation"))){const s=t.get(e);s&&(this.notations[e]=s,s.renderChild&&(this.renderChild=s.renderer))}}removeRedundantNotations(){for(const t of Object.keys(this.notations))if(this.notations[t]){const e=this.notations[t].remove||"";for(const t of e.split(/ /))delete this.notations[t]}}initializeNotations(){for(const t of Object.keys(this.notations)){const e=this.notations[t].init;e&&e(this)}}getBBoxExtenders(){const t=[0,0,0,0];for(const e of Object.keys(this.notations))this.maximizeEntries(t,this.notations[e].bbox(this));return t}getPadding(){const t=[0,0,0,0];for(const e of Object.keys(this.notations)){const s=this.notations[e].border;s&&this.maximizeEntries(t,s(this))}return[0,1,2,3].map(e=>this.TRBL[e]-t[e])}maximizeEntries(t,e){for(let s=0;s.001?n:0}getArgMod(t,e){return[Math.atan2(e,t),Math.sqrt(t*t+e*e)]}arrow(t,e,s,i="",r=0){return null}arrowData(){const[t,e]=[this.padding,this.thickness],s=e*(this.arrowhead.x+Math.max(1,this.arrowhead.dx)),{h:i,d:r,w:n}=this.childNodes[0].getBBox(),o=i+r,a=Math.sqrt(o*o+n*n),l=Math.max(t,s*n/a),c=Math.max(t,s*o/a),[h,d]=this.getArgMod(n+2*l,o+2*c);return{a:h,W:d,x:l,y:c}}arrowAW(){const{h:t,d:e,w:s}=this.childNodes[0].getBBox(),[i,r,n,o]=this.TRBL;return this.getArgMod(o+s+r,i+t+e+n)}createMsqrt(t){const e=this.node.factory.create("msqrt");e.inheritAttributesFrom(this.node),e.childNodes[0]=t.node;const s=this.wrap(e);return s.parent=this,s}sqrtTRBL(){const t=this.msqrt.getBBox(),e=this.msqrt.childNodes[0].getBBox();return[t.h-e.h,0,t.d-e.d,t.w-e.w]}constructor(t,e,s=null){super(t,e,s),this.notations={},this.renderChild=null,this.msqrt=null,this.padding=Nh,this.thickness=yh,this.arrowhead={x:bh,y:xh,dx:Eh},this.TRBL=[0,0,0,0],this.getParameters(),this.getNotations(),this.removeRedundantNotations(),this.initializeNotations(),this.TRBL=this.getBBoxExtenders()}computeBBox(t,e=!1){const[s,i,r,n]=this.TRBL,o=this.childNodes[0].getBBox();t.combine(o,n,0),t.h+=s,t.d+=r,t.w+=i,this.setChildPWidths(e)}}}const Uh=function(t,e=""){return(s,i)=>{const r=s.adjustBorder(s.html("mjx-"+t));if(e){const t=s.getOffset(e);if(s.thickness!==yh||t){const i=`translate${e}(${s.Em(s.thickness/2-t)})`;s.adaptor.setStyle(r,"transform",i)}}s.adaptor.append(s.dom[0],r)}},Hh=function(t){return Dh((e,s)=>{e.adaptor.setStyle(s,"border-"+t,e.Em(e.thickness)+" solid")})(t)},Wh=function(t,e,s){return Ph((t,i)=>{const r=t.Em(t.thickness)+" solid";t.adaptor.setStyle(i,"border-"+e,r),t.adaptor.setStyle(i,"border-"+s,r)})(t,e,s)},zh=function(t,e){return Bh(t=>(s,i)=>{const{w:r,h:n,d:o}=s.getBBox(),[a,l]=s.getArgMod(r,n+o),c=e*s.thickness/2,h=s.adjustBorder(s.html(t,{style:{width:s.Em(l),transform:"rotate("+s.fixed(-e*a)+"rad) translateY("+c+"em)"}}));s.adaptor.append(s.dom[0],h)})(t)},qh=function(t){return Fh((t,e)=>{t.adaptor.append(t.dom[0],e)})(t)},Vh=function(t){return jh((t,e)=>{t.adaptor.append(t.dom[0],e)})(t)};function Xh(t,e){return Math.atan2(t,e).toFixed(3).replace(/\.?0+$/,"")}const Gh=Xh(Eh,xh),Jh=function(){var t;const e=_h(Yc);return(t=class extends e{adjustArrow(t,e){const s=this.thickness,i=this.arrowhead;if(i.x===bh&&i.y===xh&&i.dx===Eh&&s===yh)return;const[r,n]=[s*i.x,s*i.y].map(t=>this.em(t)),o=Xh(i.dx,i.y),[a,l,c,h,d]=this.adaptor.childNodes(t);this.adjustHead(l,[n,"0","1px",r],o),this.adjustHead(c,["1px","0",n,r],"-"+o),this.adjustHead(h,[n,r,"1px","0"],"-"+o),this.adjustHead(d,["1px",r,n,"0"],o),this.adjustLine(a,s,i.x,e)}adjustHead(t,e,s){t&&(this.adaptor.setStyle(t,"border-width",e.join(" ")),this.adaptor.setStyle(t,"transform","skewX("+s+"rad)"))}adjustLine(t,e,s,i){this.adaptor.setStyle(t,"borderTop",this.em(e)+" solid"),this.adaptor.setStyle(t,"top",this.em(-e/2)),this.adaptor.setStyle(t,"right",this.em(e*(s-1))),i&&this.adaptor.setStyle(t,"left",this.em(e*(s-1)))}moveArrow(t,e,s){if(!s)return;const i=this.adaptor.getStyle(t,"transform");this.adaptor.setStyle(t,"transform",`translate${e}(${this.em(-s)})${i?" "+i:""}`)}adjustBorder(t){return this.thickness!==yh&&this.adaptor.setStyle(t,"borderWidth",this.em(this.thickness)),t}adjustThickness(t){return this.thickness!==yh&&this.adaptor.setStyle(t,"strokeWidth",this.fixed(this.thickness)),t}fixed(t,e=3){return Math.abs(t)<6e-4?"0":t.toFixed(e).replace(/\.?0+$/,"")}Em(t){return super.em(t)}toCHTML(t){const e=this.adaptor,s=this.standardChtmlNodes(t),i=e.append(s[0],this.html("mjx-box"));this.renderChild?this.renderChild(this,i):this.childNodes[0].toCHTML([i]);for(const t of Object.keys(this.notations)){const e=this.notations[t];e.renderChild||e.renderer(this,i)}const r=this.getPadding();for(const t of Ch){const s=Th[t];r[s]>0&&e.setStyle(i,"padding-"+t,this.em(r[s]))}}arrow(t,e,s,i="",r=0){const n=this.getBBox().w,o={width:this.em(t)};n!==t&&(o.left=this.em((n-t)/2)),e&&(o.transform="rotate("+this.fixed(e)+"rad)");const a=this.html("mjx-arrow",{style:o},[this.html("mjx-aline"),this.html("mjx-rthead"),this.html("mjx-rbhead")]);return s&&(this.adaptor.append(a,this.html("mjx-lthead")),this.adaptor.append(a,this.html("mjx-lbhead")),this.adaptor.setAttribute(a,"double","true")),this.adjustArrow(a,s),this.moveArrow(a,i,r),a}}).kind=on.prototype.kind,t.styles={"mjx-menclose":{position:"relative"},"mjx-menclose > mjx-dstrike":{display:"inline-block",left:0,top:0,position:"absolute","border-top":vh,"transform-origin":"top left"},"mjx-menclose > mjx-ustrike":{display:"inline-block",left:0,bottom:0,position:"absolute","border-top":vh,"transform-origin":"bottom left"},"mjx-menclose > mjx-hstrike":{"border-top":vh,position:"absolute",left:0,right:0,bottom:"50%",transform:"translateY("+yo(yh/2)+")"},"mjx-menclose > mjx-vstrike":{"border-left":vh,position:"absolute",top:0,bottom:0,right:"50%",transform:"translateX("+yo(yh/2)+")"},"mjx-menclose > mjx-rbox":{position:"absolute",top:0,bottom:0,right:0,left:0,border:vh,"border-radius":yo(yh+Nh)},"mjx-menclose > mjx-cbox":{position:"absolute",top:0,bottom:0,right:0,left:0,border:vh,"border-radius":"50%"},"mjx-menclose > mjx-arrow":{position:"absolute",left:0,bottom:"50%",height:0,width:0},"mjx-menclose > mjx-arrow > mjx-aline":{display:"block",position:"absolute","box-sizing":"border-box","transform-origin":"bottom",left:0,top:yo(-yh/2),right:yo(yh*(bh-1)),height:0,"border-top":yo(yh)+" solid","border-left":0,"border-right":0},"mjx-menclose > mjx-arrow[double] > mjx-aline":{display:"block",position:"absolute","box-sizing":"border-box","transform-origin":"bottom",left:yo(yh*(bh-1)),height:0,"border-left":yo(yh*bh)+" solid","border-right":0},"mjx-menclose > mjx-arrow > mjx-rthead":{display:"block",position:"absolute","box-sizing":"border-box","transform-origin":"bottom",transform:"skewX("+Gh+"rad)",right:0,bottom:"-1px","border-left":yo(yh*bh)+" solid","border-right":0,"border-bottom":"1px solid transparent","border-top":yo(yh*xh)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-rbhead":{display:"block",position:"absolute","box-sizing":"border-box",transform:"skewX(-"+Gh+"rad)","transform-origin":"top",right:0,top:"-1px","border-left":yo(yh*bh)+" solid","border-right":0,"border-top":"1px solid transparent","border-bottom":yo(yh*xh)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-lthead":{display:"block",position:"absolute","box-sizing":"border-box",transform:"skewX(-"+Gh+"rad)","transform-origin":"bottom",left:0,bottom:"-1px","border-left":0,"border-right":yo(yh*bh)+" solid","border-bottom":"1px solid transparent","border-top":yo(yh*xh)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-lbhead":{display:"block",position:"absolute","box-sizing":"border-box",transform:"skewX("+Gh+"rad)","transform-origin":"top",left:0,top:"-1px","border-left":0,"border-right":yo(yh*bh)+" solid","border-top":"1px solid transparent","border-bottom":yo(yh*xh)+" solid transparent"},"mjx-menclose > mjx-dbox-top":{position:"absolute",top:0,bottom:"50%",left:0,width:yo(1.5*Nh),"border-width":yo(yh),"border-style":"solid solid none none","border-radius":"0 100% 0 0","box-sizing":"border-box"},"mjx-menclose > mjx-dbox-bot":{position:"absolute",top:"50%",bottom:0,left:0,width:yo(1.5*Nh),"border-width":yo(yh),"border-style":"none solid solid none","border-radius":"0 0 100% 0","box-sizing":"border-box"}},t.notations=new Map([Hh("top"),Hh("right"),Hh("bottom"),Hh("left"),Wh("actuarial","top","right"),Wh("madruwb","bottom","right"),zh("up",1),zh("down",-1),["horizontalstrike",{renderer:Uh("hstrike","Y"),bbox:t=>[0,t.padding,0,t.padding]}],["verticalstrike",{renderer:Uh("vstrike","X"),bbox:t=>[t.padding,0,t.padding,0]}],["box",{renderer:(t,e)=>{t.adaptor.setStyle(e,"border",t.Em(t.thickness)+" solid")},bbox:Ah,border:Sh,remove:"left right top bottom"}],["roundedbox",{renderer:Uh("rbox"),bbox:Ah}],["circle",{renderer:Uh("cbox"),bbox:Ah}],["phasorangle",{renderer:(t,e)=>{const{h:s,d:i}=t.getBBox(),[r,n]=t.getArgMod(1.75*t.padding,s+i),o=t.thickness*Math.sin(r)*.9;t.adaptor.setStyle(e,"border-bottom",t.Em(t.thickness)+" solid");const a=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.dom[0],a)},bbox:t=>{const e=t.padding/2,s=t.thickness;return[2*e,e,e+s,3*e+s]},border:t=>[0,0,t.thickness,0],remove:"bottom"}],Vh("up"),Vh("down"),Vh("left"),Vh("right"),Vh("updown"),Vh("leftright"),qh("updiagonal"),qh("northeast"),qh("southeast"),qh("northwest"),qh("southwest"),qh("northeastsouthwest"),qh("northwestsoutheast"),["longdiv",{renderer:(t,e)=>{const s=t.adaptor;s.setStyle(e,"border-top",t.Em(t.thickness)+" solid");const i=s.append(t.dom[0],t.html("mjx-dbox-top")),r=s.append(t.dom[0],t.html("mjx-dbox-bot")),n=t.thickness,o=t.padding;n!==yh&&(s.setStyle(i,"border-width",t.Em(n)),s.setStyle(r,"border-width",t.Em(n))),o!==Nh&&(s.setStyle(i,"width",t.Em(1.5*o)),s.setStyle(r,"width",t.Em(1.5*o)))},bbox:t=>{const e=t.padding,s=t.thickness;return[e+s,e,e,2*e+s/2]}}],["radical",{renderer:(t,e)=>{t.msqrt.toCHTML([e]);const s=t.sqrtTRBL();t.adaptor.setStyle(t.msqrt.dom[0],"margin",s.map(e=>t.Em(-e)).join(" "))},init:t=>{t.msqrt=t.createMsqrt(t.childNodes[0])},bbox:t=>t.sqrtTRBL(),renderChild:!0}]]),t}();function Kh(t){return class extends t{stretchChildren(){const t=[];for(const e of this.childNodes)e.canStretch(Mc.Vertical)&&t.push(e);const e=t.length,s=this.childNodes.length;if(e&&s>1){let i=0,r=0;const n=e>1&&e===s;for(const t of this.childNodes){const e=t.stretch.dir===Mc.None;if(n||e){const e=t.getBBox().rscale;let[s,n]=t.getUnbrokenHD();s*=e,n*=e,s>i&&(i=s),n>r&&(r=n)}}for(const e of t){const t=e.coreRScale();e.coreMO().getStretchedVariant([i/t,r/t])}}}get fixesPWidth(){return!1}get breakCount(){return this._breakCount<0&&(this._breakCount=this.childNodes.length?this.childNodes.reduce((t,e)=>t+e.breakCount,0):0),this._breakCount}breakTop(t,e){const s=this;return this.isStack?this.parent.breakTop(s,s):s}constructor(t,e,s=null){super(t,e,s),this.dh=0;const i=this;this.isStack=!this.parent||this.parent.node.isInferred||this.parent.breakTop(i,i)!==i,this.stretchChildren();for(const t of this.childNodes)if(t.bbox.pwidth){this.bbox.pwidth=vo.fullWidth;break}}computeBBox(t,e=!1){const s=this.breakCount;this.lineBBox=s?[new jc({h:.75,d:.25,w:0},[0,0])]:[],t.empty();for(const e of this.childNodes.keys()){const i=this.childNodes[e];t.append(i.getOuterBBox()),s&&this.computeChildLineBBox(i,e)}t.clean(),s&&!this.coreMO().node.isEmbellished&&this.computeLinebreakBBox(t),this.fixesPWidth&&this.setChildPWidths(e)&&this.computeBBox(t,!0),this.vboxAdjust(t)}computeLinebreakBBox(t){var e;t.empty();const s=this.isStack,i=this.lineBBox,r=i.length-1;if(s)for(const t of i.keys()){const e=i[t];this.addMiddleBorders(e),0===t&&this.addLeftBorders(e),t===r&&this.addRightBorders(e)}let n=0;for(const s of i.keys()){const r=i[s];t.combine(r,0,n),n-=Math.max(.25,r.d)+r.lineLeading+Math.max(.75,(null===(e=i[s+1])||void 0===e?void 0:e.h)||0)}s?(i[0].L=this.bbox.L,i[r].R=this.bbox.R):(t.w=Math.max(...this.lineBBox.map(t=>t.w)),this.shiftLines(t),this.jax.math.display||this.linebreakOptions.inline||(t.pwidth=vo.fullWidth,this.node.isInferred&&(this.parent.bbox.pwidth=vo.fullWidth))),t.clean()}vboxAdjust(t){if(!this.parent)return;const e=this.breakCount,s=this.parent.node.attributes.get("data-vertical-align");if(e&&"bottom"===s)this.dh=e?t.d-this.lineBBox[e-1].d:0;else{if(!("center"===s||e&&"middle"===s))return void(this.dh=0);{const{h:e,d:s}=t,i=this.font.params.axis_height;this.dh=(e+s)/2+i-e}}t.h+=this.dh,t.d-=this.dh}computeChildLineBBox(t,e){const s=this.lineBBox[this.lineBBox.length-1];s.end=[e,0],s.append(t.getLineBBox(0));const i=t.breakCount+1;if(1!==i)for(let s=1;st.w&&(t.w=p)}}setChildPWidths(t,e=null,s=!0){return this.breakCount?!t&&(null!==e&&this.bbox.w!==e&&(this.bbox.w=e,this.shiftLines(this.bbox)),!0):super.setChildPWidths(t,e,s)}breakToWidth(t){this.linebreaks.breakToWidth(this,t)}}}function $h(t){return class extends t{getScale(){this.bbox.scale=this.parent.bbox.scale,this.bbox.rscale=1}}}const Yh=function(){var t;const e=Kh(Yc);return t=class extends e{constructor(){super(...arguments),this.linebreakCount=0}toCHTML(t){const e=this.linebreakCount=this.isStack?0:this.breakCount;e||!this.node.isInferred?t=this.standardChtmlNodes(t):this.dom=t,this.addChildren(t),e?this.placeLines(t,e):(this.handleVerticalAlign(t[0]),this.handleNegativeWidth(t[0]))}placeLines(t,e){var s,i;this.getBBox();const r=this.lineBBox,n=this.adaptor,[o,a]=(null===(s=r[1].indentData)||void 0===s?void 0:s[0])||["left","0"];for(const s of t.keys()){const l=r[s],[c,h]=0===s?[o,a]:(null===(i=l.indentData)||void 0===i?void 0:i[s===e?2:1])||["left","0"],[d,u]=this.processIndent(c,h,o,a);n.setAttribute(t[s],"align",d),u&&n.setStyle(t[s],"margin-left",this.em(u)),s mjx-linebox":{display:"inline"},"mjx-linestack[breakable] > mjx-linebox::before":{"white-space":"pre",content:'"\\A"'},"mjx-linestack[breakable] > mjx-linebox::after":{"white-space":"normal",content:'" "',"letter-spacing":"-.999em","font-family":"MJX-BRK"},"mjx-linestack[breakable] > mjx-linebox:first-of-type::before":{display:"none"},"mjx-linestack[breakable] > mjx-linebox:last-of-type::after":{display:"none"},"mjx-linebox":{display:"block"},'mjx-linebox[align="left"]':{"text-align":"left"},'mjx-linebox[align="center"]':{"text-align":"center"},'mjx-linebox[align="right"]':{"text-align":"right"},"mjx-linestrut":{display:"inline-block",height:"1em","vertical-align":"-.25em"}},t}(),Qh=function(){var t;const e=$h(Yh);return(t=class extends e{}).kind=$r.prototype.kind,t}();function Zh(t){return class extends t{createMrow(){const t=this.node.factory.create("inferredMrow");t.inheritAttributesFrom(this.node),this.mrow=this.wrap(t),this.mrow.parent=this}addMrowChildren(){const t=this.node,e=this.mrow;this.addMo(t.open),this.childNodes.length&&e.childNodes.push(this.childNodes[0]);let s=0;for(const i of this.childNodes.slice(1))this.addMo(t.separators[s++]),e.childNodes.push(i);this.addMo(t.close),e.stretchChildren()}addMo(t){if(!t)return;const e=this.wrap(t);this.mrow.childNodes.push(e),e.parent=this.mrow}constructor(t,e,s=null){super(t,e,s),this.mrow=null,this.createMrow(),this.addMrowChildren()}computeBBox(t,e=!1){t.updateFrom(this.mrow.getOuterBBox()),this.setChildPWidths(e)}get breakCount(){return this.mrow.breakCount}computeLineBBox(t){return this.mrow.getLineBBox(t)}}}const td=function(){var t;const e=Zh(Yc);return(t=class extends e{toCHTML(t){const e=this.standardChtmlNodes(t);this.mrow.toCHTML(e)}}).kind=nn.prototype.kind,t}();function ed(t){return class extends t{getFractionBBox(t,e,s){const i=this.childNodes[0].getOuterBBox(),r=this.childNodes[1].getOuterBBox(),n=this.font.params.axis_height,{T:o,u:a,v:l}=this.getTUV(e,s);t.combine(i,0,n+o+Math.max(i.d*i.rscale,a)),t.combine(r,0,n-o-Math.max(r.h*r.rscale,l)),t.w+=2*this.pad+.2}getTUV(t,e){const s=this.font.params,i=s.axis_height,r=(t?3.5:1.5)*e;return{T:(t?3.5:1.5)*e,u:(t?s.num1:s.num2)-i-r,v:(t?s.denom1:s.denom2)+i-r}}getAtopBBox(t,e){const{u:s,v:i,nbox:r,dbox:n}=this.getUVQ(e);t.combine(r,0,s),t.combine(n,0,-i),t.w+=2*this.pad}getUVQ(t){const e=this.childNodes[0].getOuterBBox(),s=this.childNodes[1].getOuterBBox(),i=this.font.params;let[r,n]=t?[i.num1,i.denom1]:[i.num3,i.denom2];const o=(t?7:3)*i.rule_thickness;let a=r-e.d*e.scale-(s.h*s.scale-n);return a mjx-line, mjx-dtable > mjx-row":{"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":".075em solid",margin:".06em -.1em",overflow:"hidden"},'mjx-line[type="d"]':{margin:".18em -.1em"}},t}();function id(t){return class extends t{get base(){return 0}get root(){return null}combineRootBBox(t,e,s){}getPQ(t){const e=this.font.params.rule_thickness,s=this.font.params.surd_height,i=this.node.attributes.get("displaystyle")?this.font.params.x_height:e;return[i,t.h+t.d>this.surdH?(t.h+t.d-(this.surdH-e-s-i/2))/2:s+i/4]}getRootDimens(t,e){return[0,0,0,0]}rootWidth(){return 1.25}getStretchedSurd(){const t=this.font.params.rule_thickness,e=this.font.params.surd_height,s=this.node.attributes.get("displaystyle")?this.font.params.x_height:t,{h:i,d:r}=this.childNodes[this.base].getOuterBBox();this.surdH=i+r+t+e+s/4,this.surd.getStretchedVariant([this.surdH-r,r],!0)}constructor(t,e,s=null){super(t,e,s),this.surd=this.createMo("\u221a"),this.surd.canStretch(Mc.Vertical),this.getStretchedSurd()}computeBBox(t,e=!1){t.empty();const s=this.surd.getBBox(),i=new vo(this.childNodes[this.base].getOuterBBox()),r=this.getPQ(s)[1],n=this.font.params.rule_thickness,o=this.font.params.surd_height,a=i.h+r+n,[l]=this.getRootDimens(s,a);t.h=a+o,this.combineRootBBox(t,s,a),t.combine(s,l,a-s.h),t.combine(i,l+s.w,0),t.clean(),this.setChildPWidths(e)}invalidateBBox(){super.invalidateBBox(),this.surd.childNodes[0].invalidateBBox()}}}const rd=function(){var t;const e=id(Yc);return t=class extends e{toCHTML(t){const e=this.surd,s=this.childNodes[this.base],i=e.getBBox(),r=s.getOuterBBox(),[,n]=this.getPQ(i),o=this.font.params.surd_height,a=r.h+n+o,l=this.adaptor,c=this.standardChtmlNodes(t);let h,d,u,p;null!=this.root&&(u=l.append(c[0],this.html("mjx-root")),p=this.childNodes[this.root]);const m=l.append(c[0],this.html("mjx-sqrt",{},[h=this.html("mjx-surd"),d=this.html("mjx-box",{style:{paddingTop:this.em(n)}})]));.06!==o&&l.setStyle(d,"border-top-width",this.em(o*this.font.params.rule_factor)),this.addRoot(u,p,i,a),e.toCHTML([h]),s.toCHTML([d]),e.size<0&&l.addClass(m,"mjx-tall")}addRoot(t,e,s,i){}},t.kind=Qr.prototype.kind,t.styles={"mjx-root":{display:"inline-block","white-space":"nowrap"},"mjx-surd":{display:"inline-block","vertical-align":"top"},"mjx-sqrt":{display:"inline-block","padding-top":".075em"},"mjx-sqrt > mjx-box":{"border-top":".075em solid","padding-left":".03em","margin-left":"-.03em"},"mjx-sqrt.mjx-tall > mjx-box":{"padding-left":".3em","margin-left":"-.3em"}},t}();function nd(t){return class extends t{get root(){return 1}combineRootBBox(t,e,s){const i=this.childNodes[this.root].getOuterBBox(),r=this.getRootDimens(e,s)[1];t.combine(i,0,r)}getRootDimens(t,e){const s=this.surd,i=this.childNodes[this.root].getOuterBBox(),r=(s.size<0?.5:.6)*t.w,{w:n,rscale:o}=i,a=Math.max(n,r/o),l=Math.max(0,a-n);return[a*o-r,this.rootHeight(i,t,s.size,e),l]}rootHeight(t,e,s,i){const r=e.h+e.d;return(s<0?1.9:.55*r)-(r-i)+Math.max(0,t.d*t.rscale)}rootWidth(){const t=this.childNodes[this.root].getOuterBBox();return.4+t.w*t.rscale}}}const od=function(){var t;const e=nd(rd);return t=class extends e{addRoot(t,e,s,i){e.toCHTML([t]);const r=this.adaptor,[n,o,a]=this.getRootDimens(s,i);r.setStyle(t,"verticalAlign",this.em(o)),r.setStyle(t,"width",this.em(n)),a&&r.setStyle(r.firstChild(t),"paddingLeft",this.em(a))}},t.kind=Zr.prototype.kind,t}();function ad(t){var e;return(e=class extends t{get scriptChild(){return this.childNodes[this.node.sub]}getOffset(){return[this.baseIsChar?0:this.getAdjustedIc(),-this.getV()]}}).useIC=!1,e}function ld(t){return class extends t{get scriptChild(){return this.childNodes[this.node.sup]}getOffset(){return[this.getAdjustedIc()-(this.baseRemoveIc?0:this.baseIc),this.getU()]}}}function cd(t){var e;return e=class extends t{constructor(){super(...arguments),this.UVQ=null}get subChild(){return this.childNodes[this.node.sub]}get supChild(){return this.childNodes[this.node.sup]}get scriptChild(){return this.supChild}getUVQ(t=this.subChild.getOuterBBox(),e=this.supChild.getOuterBBox()){const s=this.baseCore,i=s.getLineBBox(s.breakCount);if(this.UVQ)return this.UVQ;const r=this.font.params,n=3*r.rule_thickness,o=this.length2em(this.node.attributes.get("subscriptshift"),r.sub2),a=this.baseCharZero(i.d*this.baseScale+r.sub_drop*t.rscale),l=e.d*e.rscale,c=t.h*t.rscale;let[h,d]=[this.getU(),Math.max(a,o)],u=h-l-(c-d);if(u0&&(h+=t,d-=t)}return h=Math.max(this.length2em(this.node.attributes.get("superscriptshift"),h),h),d=Math.max(this.length2em(this.node.attributes.get("subscriptshift"),d),d),u=h-l-(c-d),this.UVQ=[h,-d,u],this.UVQ}appendScripts(t){const[e,s]=[this.subChild.getOuterBBox(),this.supChild.getOuterBBox()],i=this.getBaseWidth(),r=this.getAdjustedIc(),[n,o]=this.getUVQ(),a=t.d-this.baseChild.getLineBBox(this.baseChild.breakCount).d;return t.combine(e,i+(this.baseIsChar?0:r),o-a),t.combine(s,i+r,n-a),t.w+=this.font.params.scriptspace,t}},e.useIC=!1,e}function hd(t){var e;return e=class extends t{get baseChild(){return this.childNodes[this.node.base]}get scriptChild(){return this.childNodes[1]}getBaseCore(){let t=this.getSemanticBase()||this.childNodes[0],e=null==t?void 0:t.node;for(;t&&(1===t.childNodes.length&&(e.isKind("mrow")||e.isKind("TeXAtom")||e.isKind("mstyle")||e.isKind("mpadded")&&!e.getProperty("vbox")||e.isKind("mphantom")||e.isKind("semantics"))||e.isKind("munderover")&&t.isMathAccent);)this.setBaseAccentsFor(t),t=t.childNodes[0],e=null==t?void 0:t.node;return t||(this.baseHasAccentOver=this.baseHasAccentUnder=!1),t||this.childNodes[0]}setBaseAccentsFor(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")))}getSemanticBase(){const t=this.node.attributes.getExplicit("data-semantic-fencepointer");return this.getBaseFence(this.baseChild,t)}getBaseFence(t,e){if(!t||!t.node.attributes||!e)return null;if(t.node.attributes.getExplicit("data-semantic-id")===e)return t;for(const s of t.childNodes){const t=this.getBaseFence(s,e);if(t)return t}return null}getBaseScale(){let t=this.baseCore,e=1;for(;t&&t!==this;){e*=t.getOuterBBox().rscale,t=t.parent}return e}getBaseIc(){return this.baseCore.getOuterBBox().ic*this.baseScale}getAdjustedIc(){return this.baseIc?1.05*this.baseIc+.05:0}isCharBase(){const 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}checkLineAccents(){if(this.node.isKind("munderover"))if(this.node.isKind("mover"))this.isLineAbove=this.isLineAccent(this.scriptChild);else if(this.node.isKind("munder"))this.isLineBelow=this.isLineAccent(this.scriptChild);else{const t=this;this.isLineAbove=this.isLineAccent(t.overChild),this.isLineBelow=this.isLineAccent(t.underChild)}}isLineAccent(t){const e=t.coreMO().node;return e.isToken&&"\u2015"===e.getText()}getBaseWidth(){const t=this.baseChild.getLineBBox(this.baseChild.breakCount);return t.w*t.rscale-(this.baseRemoveIc?this.baseIc:0)+this.font.params.extra_ic}getOffset(){return[0,0]}baseCharZero(t){const e=!!this.baseCore.node.attributes.get("largeop"),s=!(!this.baseCore.node.isKind("mo")||!this.baseCore.size),i=this.baseScale;return!this.baseIsChar||e||s||1!==i?t:0}getV(){const t=this.baseCore,e=t.getLineBBox(t.breakCount),s=this.scriptChild.getOuterBBox(),i=this.font.params,r=this.length2em(this.node.attributes.get("subscriptshift"),i.sub1);return Math.max(this.baseCharZero(e.d*this.baseScale+i.sub_drop*s.rscale),r,s.h*s.rscale-.8*i.x_height)}getU(){const t=this.baseCore,e=t.getLineBBox(t.breakCount),s=this.scriptChild.getOuterBBox(),i=this.font.params,r=this.node.attributes.getList("displaystyle","superscriptshift"),n=this.node.getProperty("texprimestyle")?i.sup3:r.displaystyle?i.sup1:i.sup2,o=this.length2em(r.superscriptshift,n);return Math.max(this.baseCharZero(e.h*this.baseScale-i.sup_drop*s.rscale),o,s.d*s.rscale+1/4*i.x_height)}hasMovableLimits(){const t=this.node.attributes.get("displaystyle"),e=this.baseChild.coreMO().node;return!t&&!!e.attributes.get("movablelimits")}getOverKU(t,e){const s=this.node.attributes.get("accent"),i=this.font.params,r=e.d*e.rscale,n=i.rule_thickness*i.separation_factor,o=this.baseHasAccentOver?n:0,a=this.isLineAbove?3*i.rule_thickness:n,l=(s?a:Math.max(i.big_op_spacing1,i.big_op_spacing3-Math.max(0,r)))-o;return[l,t.h*t.rscale+l+r]}getUnderKV(t,e){const s=this.node.attributes.get("accentunder"),i=this.font.params,r=e.h*e.rscale,n=i.rule_thickness*i.separation_factor,o=this.baseHasAccentUnder?n:0,a=this.isLineBelow?3*i.rule_thickness:n,l=(s?a:Math.max(i.big_op_spacing2,i.big_op_spacing4-r))-o;return[l,-(t.d*t.rscale+l+r)]}getDeltaW(t,e=[0,0,0]){const s=this.node.attributes.get("align"),i=t.map(t=>t.w*t.rscale);i[0]-=this.baseRemoveIc&&!this.baseCore.node.attributes.get("largeop")?this.baseIc:0;const r=Math.max(...i),n=[];let o=0;for(const t of i.keys())n[t]=("center"===s?(r-i[t])/2:"right"===s?r-i[t]:0)+e[t],n[t]n[e]+=t[e]?t[e].dx*t[0].rscale:0),n}getDelta(t,e=!1){const s=this.node.attributes.get("accent");let{sk:i,ic:r}=this.baseCore.getOuterBBox();return s&&(i-=t.getOuterBBox().sk),((s&&!e?i:0)+this.font.skewIcFactor*r)*this.baseScale}stretchChildren(){const t=[];for(const e of this.childNodes)e.canStretch(Mc.Horizontal)&&t.push(e);const e=t.length,s=this.childNodes.length;if(e&&s>1){let i=0;const r=e>1&&e===s;for(const t of this.childNodes){const e=t.stretch.dir===Mc.None;if(r||e){const{w:s,rscale:r}=t.getOuterBBox(e);s*r>i&&(i=s*r)}}for(const e of t){const t=e.coreMO();null===t.size&&t.getStretchedVariant([i/e.coreRScale()])}}}constructor(t,e,s=null){super(t,e,s),this.baseScale=1,this.baseIc=0,this.baseRemoveIc=!1,this.baseIsChar=!1,this.baseHasAccentOver=null,this.baseHasAccentUnder=null,this.isLineAbove=!1,this.isLineBelow=!1,this.isMathAccent=!1;const i=this.baseCore=this.getBaseCore();i&&(this.setBaseAccentsFor(i),this.baseScale=this.getBaseScale(),this.baseIc=this.getBaseIc(),this.baseIsChar=this.isCharBase(),this.isMathAccent=this.baseIsChar&&this.scriptChild&&void 0!==this.scriptChild.coreMO().node.getProperty("mathaccent"),this.checkLineAccents(),this.baseRemoveIc=!this.isLineAbove&&!this.isLineBelow&&(!this.constructor.useIC||this.isMathAccent))}computeBBox(t,e=!1){t.empty(),t.append(this.baseChild.getOuterBBox()),this.appendScripts(t),t.clean(),this.setChildPWidths(e)}appendScripts(t){const e=this.getBaseWidth(),[s,i]=this.getOffset();return t.combine(this.scriptChild.getOuterBBox(),e+s,i),t.w+=this.font.params.scriptspace,t}get breakCount(){return this._breakCount<0&&(this._breakCount=this.node.isEmbellished?this.coreMO().embellishedBreakCount:this.node.linebreakContainer?0:this.childNodes[0].breakCount),this._breakCount}breakTop(t,e){return this.node.linebreakContainer||!this.parent||this.node.childIndex(e.node)?t:this.parent.breakTop(t,this)}computeLineBBox(t){const e=this.breakCount;if(!e)return jc.from(this.getOuterBBox(),this.linebreakOptions.lineleading);const s=this.baseChild.getLineBBox(t).copy();return t=0||this.adaptor.setStyle(t,"marginBottom",this.em(e.d*e.rscale))}adjustUnderDepth(t,e){if(e.d>=0)return;const s=this.adaptor,i=this.em(e.d),r=this.html("mjx-box",{style:{"margin-bottom":i,"vertical-align":i}});for(const e of s.childNodes(s.firstChild(t)))s.append(r,e);s.append(s.firstChild(t),r)}adjustBaseHeight(t,e){if(this.node.attributes.get("accent")){const s=this.font.params.x_height*this.baseScale;e.h mjx-spacer":{display:"block"}},t}();function fd(t){return class extends t{get scriptChild(){return this.childNodes[this.node.under]}constructor(...t){super(...t),this.stretchChildren()}computeBBox(t,e=!1){if(this.hasMovableLimits())return void super.computeBBox(t,e);t.empty();const s=this.baseChild.getOuterBBox(),i=this.scriptChild.getOuterBBox(),r=this.getUnderKV(s,i)[1],n=this.isLineBelow?0:this.getDelta(this.scriptChild,!0),[o,a]=this.getDeltaW([s,i],[0,-n]);t.combine(s,o,0),t.combine(i,a,r),t.d+=this.font.params.big_op_spacing5,t.clean(),this.setChildPWidths(e)}}}function gd(t){return class extends t{get scriptChild(){return this.childNodes[this.node.over]}constructor(...t){super(...t),this.stretchChildren()}computeBBox(t){if(this.hasMovableLimits())return void super.computeBBox(t);t.empty();const e=this.baseChild.getOuterBBox(),s=this.scriptChild.getOuterBBox();this.node.attributes.get("accent")&&(e.h=Math.max(e.h,this.font.params.x_height*this.baseScale));const i=this.getOverKU(e,s)[1],r=this.isLineAbove?0:this.getDelta(this.scriptChild),[n,o]=this.getDeltaW([e,s],[0,r]);t.combine(e,n,0),t.combine(s,o,i),t.h+=this.font.params.big_op_spacing5,t.clean()}}}function bd(t){return class extends t{get underChild(){return this.childNodes[this.node.under]}get overChild(){return this.childNodes[this.node.over]}get subChild(){return this.underChild}get supChild(){return this.overChild}constructor(...t){super(...t),this.stretchChildren()}computeBBox(t){if(this.hasMovableLimits())return void super.computeBBox(t);t.empty();const e=this.overChild.getOuterBBox(),s=this.baseChild.getOuterBBox(),i=this.underChild.getOuterBBox();this.node.attributes.get("accent")&&(s.h=Math.max(s.h,this.font.params.x_height*this.baseScale));const r=this.getOverKU(s,e)[1],n=this.getUnderKV(s,i)[1],o=this.getDelta(this.overChild),a=this.getDelta(this.underChild,!0),[l,c,h]=this.getDeltaW([s,i,e],[0,this.isLineBelow?0:-a,this.isLineAbove?0:o]);t.combine(s,l,0),t.combine(e,h,r),t.combine(i,c,n);const d=this.font.params.big_op_spacing5;t.h+=d,t.d+=d,t.clean()}}}const Ed=function(){var t;const e=fd(ud);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;if(this.hasMovableLimits())return super.toCHTML(t),void this.adaptor.setAttribute(this.dom[0],"limits","false");this.dom=this.standardChtmlNodes(t);const e=this.adaptor.append(this.adaptor.append(this.dom[0],this.html("mjx-row")),this.html("mjx-base")),s=this.adaptor.append(this.adaptor.append(this.dom[0],this.html("mjx-row")),this.html("mjx-under"));this.baseChild.toCHTML([e]),this.scriptChild.toCHTML([s]);const i=this.baseChild.getOuterBBox(),r=this.scriptChild.getOuterBBox(),n=this.getUnderKV(i,r)[0],o=this.isLineBelow?0:this.getDelta(this.scriptChild,!0);this.adaptor.setStyle(s,"paddingTop",this.em(n)),this.setDeltaW([e,s],this.getDeltaW([i,r],[0,-o])),this.adjustUnderDepth(s,r)}}).kind=un.prototype.kind,t.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"}},t}(),xd=function(){var t;const e=gd(pd);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;if(this.hasMovableLimits())return super.toCHTML(t),void this.adaptor.setAttribute(this.dom[0],"limits","false");this.dom=this.standardChtmlNodes(t);const e=this.adaptor.append(this.dom[0],this.html("mjx-over")),s=this.adaptor.append(this.dom[0],this.html("mjx-base"));this.scriptChild.toCHTML([e]),this.baseChild.toCHTML([s]);const i=this.scriptChild.getOuterBBox(),r=this.baseChild.getOuterBBox();this.adjustBaseHeight(s,r);const n=this.getOverKU(r,i)[0],o=this.isLineAbove?0:this.getDelta(this.scriptChild);this.adaptor.setStyle(e,"paddingBottom",this.em(n)),this.setDeltaW([s,e],this.getDeltaW([r,i],[0,o])),this.adjustOverDepth(e,i)}}).kind=pn.prototype.kind,t.styles={'mjx-mover:not([limits="false"])':{"padding-top":".1em"},[["base","over"].map(t=>`mjx-mover:not([limits="false"]) > mjx-${t}`).join(", ")]:{display:"block","text-align":"left"}},t}(),yd=function(){var t;const e=bd(md);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;if(this.hasMovableLimits())return super.toCHTML(t),void this.adaptor.setAttribute(this.dom[0],"limits","false");this.dom=this.standardChtmlNodes(t);const e=this.adaptor.append(this.dom[0],this.html("mjx-over")),s=this.adaptor.append(this.adaptor.append(this.dom[0],this.html("mjx-box")),this.html("mjx-munder")),i=this.adaptor.append(this.adaptor.append(s,this.html("mjx-row")),this.html("mjx-base")),r=this.adaptor.append(this.adaptor.append(s,this.html("mjx-row")),this.html("mjx-under"));this.overChild.toCHTML([e]),this.baseChild.toCHTML([i]),this.underChild.toCHTML([r]);const n=this.overChild.getOuterBBox(),o=this.baseChild.getOuterBBox(),a=this.underChild.getOuterBBox();this.adjustBaseHeight(i,o);const l=this.getOverKU(o,n)[0],c=this.getUnderKV(o,a)[0],h=this.getDelta(this.overChild),d=this.getDelta(this.underChild,!0);this.adaptor.setStyle(e,"paddingBottom",this.em(l)),this.adaptor.setStyle(r,"paddingTop",this.em(c)),this.setDeltaW([i,r,e],this.getDeltaW([o,a,n],[0,this.isLineBelow?0:-d,this.isLineAbove?0:h])),this.adjustOverDepth(e,n),this.adjustUnderDepth(r,a)}}).kind=dn.prototype.kind,t.styles={'mjx-munderover:not([limits="false"])':{"padding-top":".1em"},[["over","box"].map(t=>`mjx-munderover:not([limits="false"]) > mjx-${t}`).join(", ")]:{display:"block"}},t}(),Nd={base:"subList",subList:"supList",supList:"subList",psubList:"psupList",psupList:"psubList"},vd=["sup","sup","psup","psub"];function Td(t){return class extends t{combinePrePost(t,e){const s=new vo(t);return s.combine(e,0,0),s}getScriptData(){const t=this.scriptData={base:null,sub:vo.empty(),sup:vo.empty(),psub:vo.empty(),psup:vo.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}getScriptBBoxLists(){const t={base:[],subList:[],supList:[],psubList:[],psupList:[]};let e="base";for(const s of this.childNodes)s.node.isKind("mprescripts")?e="psubList":(t[e].push(s.getOuterBBox()),e=Nd[e]);return this.firstPrescript=t.subList.length+t.supList.length+2,this.padLists(t.subList,t.supList),this.padLists(t.psubList,t.psupList),t}padLists(t,e){t.length>e.length&&e.push(vo.empty())}combineBBoxLists(t,e,s,i){for(let r=0;rt.h&&(t.h=o),a>t.d&&(t.d=a),c>e.h&&(e.h=c),h>e.d&&(e.d=h)}}getScaledWHD(t){const{w:e,h:s,d:i,rscale:r}=t;return[e*r,s*r,i*r]}getCombinedUV(){const t=this.scriptData,e=this.combinePrePost(t.sub,t.psub),s=this.combinePrePost(t.sup,t.psup);return this.getUVQ(e,s)}addPrescripts(t,e,s){const i=this.scriptData;if(i.numPrescripts){const r=this.font.params.scriptspace;t.combine(i.psup,r,e),t.combine(i.psub,r,s)}return t}addPostscripts(t,e,s){const i=this.scriptData;if(i.numScripts){const r=t.w;t.combine(i.sup,r,e),t.combine(i.sub,r,s),t.w+=this.font.params.scriptspace}return t}constructor(...t){super(...t),this.scriptData=null,this.firstPrescript=0,this.getScriptData()}appendScripts(t){t.empty();const[e,s]=this.getCombinedUV();return this.addPrescripts(t,e,s),t.append(this.scriptData.base),this.addPostscripts(t,e,s),t.clean(),t}computeLineBBox(t){const e=this.baseChild.breakCount,s=this.baseChild.getLineBBox(t).copy();let i=s;const[r,n]=this.getCombinedUV();return 0===t?(i=jc.from(this.addPrescripts(vo.zero(),r,n),this.linebreakOptions.lineleading),i.append(s),this.addLeftBorders(i),i.L=this.bbox.L):t===e&&(i=this.addPostscripts(i,r,n),this.addRightBorders(i),i.R=this.bbox.R),this.addMiddleBorders(i),i}getUVQ(t,e){if(!this.UVQ){let[s,i,r]=[0,0,0];0===t.w?s=this.getU():0===e.w?s=-this.getV():[s,i,r]=super.getUVQ(t,e),this.UVQ=[s,i,r]}return this.UVQ}}}const Cd=function(){var t;const e=Td(md);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;const e=this.standardChtmlNodes(t),s=this.scriptData,i=this.node.getProperty("scriptalign")||"right left",[r,n]=Wr(i+" "+i),[o,a]=this.getCombinedUV();if(s.numPrescripts){const t=this.addScripts(this.dom[0],o,-a,!0,s.psub,s.psup,this.firstPrescript,s.numPrescripts);"right"!==r&&this.adaptor.setAttribute(t,"script-align",r)}if(this.childNodes[0].toCHTML(e),s.numScripts){const t=this.addScripts(this.dom[this.dom.length-1],o,-a,!1,s.sub,s.sup,1,s.numScripts);"left"!==n&&this.adaptor.setAttribute(t,"script-align",n)}}addScripts(t,e,s,i,r,n,o,a){const l=this.adaptor,c=e-n.d+(s-r.h),h=e<0&&0===s?r.h+e:e,d=c>0?{style:{height:this.em(c)}}:{},u=h?{style:{"vertical-align":this.em(h)}}:{},p=this.html("mjx-row"),m=this.html("mjx-row",d),f=this.html("mjx-row"),g="mjx-"+(i?"pre":"")+"scripts",b=o+2*a;for(;o 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"},"mjx-none":{display:"inline-block",height:"1px"}},t}(),Ad=.333;function Ld(t){return class extends t{get tableRows(){return this.childNodes}findContainer(){let t=this,e=t.parent;for(;e&&(e.node.notParent||e.node.isKind("mrow"));)t=e,e=e.parent;this.container=e,this.containerI=t.node.childPosition()}getPercentageWidth(){if(this.hasLabels)this.bbox.pwidth=vo.fullWidth;else{const t=this.node.attributes.get("width");Hr(t)&&(this.bbox.pwidth=t)}}stretchRows(){const t=this.node.attributes.get("equalrows"),e=t?this.getEqualRowHeight():0,{H:s,D:i}=t?this.getTableData():{H:[0],D:[0]},r=this.tableRows;for(let n=0;ne&&(e=s)}}}}if(null!==e){const i=this.getTableData().W;for(const r of s){let s=r.getBBox().w;r.coreMO().getStretchedVariant([Math.max(e,s)/r.coreRScale()]),s=r.getBBox().w,s>i[t]&&(i[t]=s)}}}breakColumn(t,e,s){if("linebreak"!==this.jax.math.root.attributes.get("overflow")||!this.jax.math.display)return;const{H:i,D:r}=this.getTableData();let n=0,o=0;for(const s of this.tableRows){const a=s.getChild(t);if(a){const l=s.getBBox().rscale,c=a.getBBox();if(a&&c.w*l>e){a.childNodes[0].breakToWidth(e);const o=s.node.attributes.get("rowalign");this.updateHDW(a,t,n,o,i,r)}c.w*l>o&&(o=c.w*l)}const l=s.getBBox();l.h=i[n],l.d=r[n],n++}("fit"===s||"auto"===s||Hr(s)||o>this.cWidths[t])&&(this.cWidths[t]=o)}getTableData(){if(this.data)return this.data;const t=new Array(this.numRows).fill(0),e=new Array(this.numRows).fill(0),s=new Array(this.numCols).fill(0),i=new Array(this.numRows),r=new Array(this.numRows),n=[0],o=this.tableRows;for(let a=0;ao[e]&&(o[e]=c)}recordPWidthCell(t,e){t.childNodes[0]&&t.childNodes[0].getBBox().pwidth&&this.pwidthCells.push([t,e])}setColumnPWidths(){const t=this.cWidths;for(const[e,s]of this.pwidthCells)e.setChildPWidths(!1,t[s])&&(e.invalidateBBox(),e.getBBox())}getBBoxHD(t){const[e,s]=this.getAlignmentRow();if(null===s){const s=this.font.params.axis_height,i=t/2;return{top:[0,t],center:[i,i],bottom:[t,0],baseline:[i,i],axis:[i+s,i-s]}[e]||[i,i]}{const i=this.getVerticalPosition(s,e);return[i,t-i]}}getBBoxLR(){var t;if(this.hasLabels){const t=this.node.attributes,e=t.get("side");let[s,i]=this.getPadAlignShift(e);const r=this.hasLabels&&!!t.get("data-width-includes-label");return r&&this.frame&&this.fSpace[0]&&(s-=this.fSpace[0]),"center"!==i||r?"left"===e?[s,0]:[0,s]:[s,s]}return[(null===(t=this.bbox)||void 0===t?void 0:t.L)||0,0]}getPadAlignShift(t){const{L:e}=this.getTableData();let s=e+this.length2em(this.node.attributes.get("minlabelspacing"));const[i,r]=null==this.styles?["",""]:[this.styles.get("padding-left"),this.styles.get("padding-right")];(i||r)&&(s=Math.max(s,this.length2em(i||"0"),this.length2em(r||"0")));let[n,o]=this.getAlignShift();return n===t&&(o="left"===t?Math.max(s,o)-s:Math.min(-s,o)+s),[s,n,o]}getWidth(){return this.pWidth||this.getBBox().w}adjustWideTable(){const t=this.node.attributes;if("auto"!==t.get("width"))return;const[e,s]=this.getPadAlignShift(t.get("side")),i=Math.max(this.containerWidth/10,this.containerWidth-e-("center"===s?e:0));this.naturalWidth()>i&&this.adjustColumnWidths(i)}naturalWidth(){return Vo(this.getComputedWidths().concat(this.cLines,this.cSpace))+2*this.fLine+this.fSpace[0]+this.fSpace[2]}getEqualRowHeight(){const{H:t,D:e}=this.getTableData(),s=Array.from(t.keys()).map(s=>t[s]+e[s]);return Math.max(...s)}getComputedWidths(){const t=this.getTableData().W;let e=Array.from(t.keys()).map(e=>"number"==typeof this.cWidths[e]?this.cWidths[e]:t[e]);return this.node.attributes.get("equalcolumns")&&(e=Array(e.length).fill(Xo(e))),e}getColumnWidths(){const t=this.node.attributes.get("width");if(this.node.attributes.get("equalcolumns"))return this.getEqualColumns(t);const e=this.getColumnAttributes("columnwidth",0);return"auto"===t?this.getColumnWidthsAuto(e):Hr(t)?this.getColumnWidthsPercent(e):this.getColumnWidthsFixed(e,this.length2em(t))}getEqualColumns(t){const e=Math.max(1,this.numCols);let s;if("auto"===t){const{W:t}=this.getTableData();s=Xo(t)}else if(Hr(t))s=this.percent(1/e);else{const i=Vo([].concat(this.cLines,this.cSpace))+this.fSpace[0]+this.fSpace[2];s=Math.max(0,this.length2em(t)-i)/e}return Array(this.numCols).fill(s)}getColumnWidthsAuto(t){return t.map(t=>"auto"===t||"fit"===t?null:Hr(t)?t:this.length2em(t))}getColumnWidthsPercent(t){const e=t.includes("fit"),{W:s}=e?this.getTableData():{W:null};return Array.from(t.keys()).map(i=>{const r=t[i];return"fit"===r?null:"auto"===r?e?s[i]:null:Hr(r)?r:this.length2em(r)})}getColumnWidthsFixed(t,e){const s=Array.from(t.keys()),i=s.filter(e=>"fit"===t[e]),r=s.filter(e=>"auto"===t[e]),n=i.length||r.length,{W:o}=n?this.getTableData():{W:null},a=e-Vo([].concat(this.cLines,this.cSpace))-this.fSpace[0]-this.fSpace[2];let l=a;s.forEach(e=>{const s=t[e];l-="fit"===s||"auto"===s?o[e]:this.length2em(s,a)});const c=n&&l>0?l/n:0;return s.map(e=>{const s=t[e];return"fit"===s?o[e]+c:"auto"===s?o[e]+(0===i.length?c:0):this.length2em(s,a)})}adjustColumnWidths(t){const{W:e}=this.getTableData(),s=this.getColumnAttributes("columnwidth",0),i=Array.from(s.keys()),r=[...i.filter(t=>"fit"===s[t]).sort((t,s)=>e[s]-e[t]),...i.filter(t=>"auto"===s[t]).sort((t,s)=>e[s]-e[t]),...i.filter(t=>Hr(s[t])).sort((t,s)=>e[s]-e[t]),...i.filter(t=>"fit"!==s[t]&&"auto"!==s[t]&&!Hr(s[t])).sort((t,s)=>e[s]-e[t])];if(!r.length)return;this.cWidths=i.map(t=>"number"==typeof this.cWidths[t]?this.cWidths[t]:e[t]);const n=t-Vo([].concat(this.cLines,this.cSpace))-this.fSpace[0]-this.fSpace[2];let o=Vo(this.cWidths)-n,a=0,l=0;for(;lthis.cWidths[t]*=o)}getVerticalPosition(t,e){const s=this.node.attributes.get("equalrows"),{H:i,D:r}=this.getTableData(),n=s?this.getEqualRowHeight():0,o=this.getRowHalfSpacing();let a=this.fLine;for(let e=0;et/2);return t.unshift(this.fSpace[1]),t.push(this.fSpace[1]),t}getColumnHalfSpacing(){const t=this.cSpace.map(t=>t/2);return t.unshift(this.fSpace[0]),t.push(this.fSpace[2]),t}getAlignmentRow(){const[t,e]=Wr(this.node.attributes.get("align"));if(null==e)return[t,null];let s=parseInt(e);return s<0&&(s+=this.numRows+1),[t,s<1||s>this.numRows?null:s-1]}getColumnAttributes(t,e=1){const s=this.numCols-e,i=this.getAttributeArray(t);if(0===i.length)return null;for(;i.lengths&&i.splice(s),i}getRowAttributes(t,e=1){const s=this.numRows-e,i=this.getAttributeArray(t);if(0===i.length)return null;for(;i.lengths&&i.splice(s),i}getAttributeArray(t){const e=this.node.attributes.get(t);return e?Wr(e):[this.node.attributes.getDefault(t)]}addEm(t,e=1){return t?t.map(t=>this.em(t/e)):null}convertLengths(t){return t?t.map(t=>this.length2em(t)):null}constructor(t,e,s=null){super(t,e,s),this.numCols=0,this.numRows=0,this.data=null,this.pwidthCells=[],this.pWidth=0,this.adjustHD={top:(t,e,s,i,r)=>{t>s[r]&&(i[r]-=t-s[r],s[r]=t),t+e>s[r]+i[r]&&(i[r]=t+e-s[r])},bottom:(t,e,s,i,r)=>{e>i[r]&&(s[r]-=e-i[r],i[r]=e),t+e>s[r]+i[r]&&(s[r]=t+e-i[r])},center:(t,e,s,i,r)=>{t+e>s[r]+i[r]&&(s[r]=i[r]=(t+e)/2)},other:(t,e,s,i,r)=>{t>s[r]&&(s[r]=t),e>i[r]&&(i[r]=e)}},this.numCols=Xo(this.tableRows.map(t=>t.numCells)),this.numRows=this.childNodes.length,this.hasLabels=this.childNodes.reduce((t,e)=>t||e.node.isKind("mlabeledtr"),!1),this.findContainer(),this.isTop=!this.container||this.container.node.isKind("math")&&!this.container.parent,this.isTop&&(this.jax.table=this),this.getPercentageWidth();const i=this.node.attributes,r=i.get("frame");this.frame="none"!==r,this.fframe=this.frame||void 0!==i.get("data-frame-styles"),this.fLine=this.frame?.07:0,this.fSpace=this.getFrameSpacing(),this.cSpace=this.convertLengths(this.getColumnAttributes("columnspacing")),this.rSpace=this.convertLengths(this.getRowAttributes("rowspacing")),this.cLines=this.getColumnAttributes("columnlines").map(t=>"none"===t?0:.07),this.rLines=this.getRowAttributes("rowlines").map(t=>"none"===t?0:.07),this.cWidths=this.getColumnWidths(),this.adjustWideTable(),this.stretchColumns(),this.stretchRows()}getStyles(){super.getStyles();const t=this.node.attributes.get("data-frame-styles");if(!t)return;this.styles||(this.styles=new qo(""));const e=t.split(/ /);for(const t of wo.keys()){const s=e[t];"none"!==s&&this.styles.set(`border-${wo[t]}`,`.07em ${s}`)}}computeBBox(t,e=!1){const{H:s,D:i}=this.getTableData();let r,n;if(this.node.attributes.get("equalrows")){const t=this.getEqualRowHeight();r=Vo([].concat(this.rLines,this.rSpace))+t*this.numRows}else r=Vo(s.concat(i,this.rLines,this.rSpace));r+=2*(this.fLine+this.fSpace[1]),n=this.naturalWidth();const o=this.node.attributes.get("width");"auto"!==o&&(n=Math.max(this.length2em(o,0)+2*this.fLine,n));const[a,l]=this.getBBoxHD(r);t.h=a,t.d=l,t.w=n;const[c,h]=this.getBBoxLR();t.L=c,t.R=h,Hr(o)||this.setColumnPWidths()}setChildPWidths(t,e,s){const i=this.node.attributes.get("width");if(!Hr(i))return!1;this.hasLabels||(this.bbox.pwidth="",this.container.bbox.pwidth="");const{w:r,L:n,R:o}=this.bbox,a=this.node.attributes.get("data-width-includes-label"),l=Math.max(r,this.length2em(i,Math.max(e,n+r+o)))-(a?n+o:0),c=this.node.attributes.get("equalcolumns")?Array(this.numCols).fill(this.percent(1/Math.max(1,this.numCols))):this.getColumnAttributes("columnwidth",0);return this.cWidths=this.getColumnWidthsFixed(c,l),this.pWidth=this.naturalWidth(),this.isTop&&(this.bbox.w=this.pWidth),this.setColumnPWidths(),this.pWidth!==r&&this.parent.invalidateBBox(),this.pWidth!==r}getAlignShift(){return this.isTop?super.getAlignShift():[this.container.getChildAlign(this.containerI),0]}}}const Sd=function(){var t;const e=Ld(Yc);return t=class extends e{constructor(t,e,s=null){super(t,e,s),this.itable=this.html("mjx-itable"),this.labels=this.html("mjx-itable")}getAlignShift(){const t=super.getAlignShift();return this.isTop||(t[1]=0),t}toCHTML(t){const e=this.standardChtmlNodes(t);this.adaptor.append(e[0],this.html("mjx-table",{},[this.itable]));for(const t of this.childNodes)t.toCHTML([this.itable]);this.padRows(),this.handleColumnSpacing(),this.handleColumnLines(),this.handleColumnWidths(),this.handleRowSpacing(),this.handleRowLines(),this.handleRowHeights(),this.handleFrame(),this.handleWidth(),this.handleLabels(),this.handleAlign(),this.handleJustify(),this.shiftColor()}shiftColor(){const t=this.adaptor,e=t.getStyle(this.dom[0],"backgroundColor");e&&(t.setStyle(this.dom[0],"backgroundColor",""),t.setStyle(this.itable,"backgroundColor",e))}padRows(){const t=this.adaptor;for(const e of t.childNodes(this.itable))for(;t.childNodes(e).length1&&"0.4em"!==r||"0"!==r&&1===s)&&this.adaptor.setStyle(o,"paddingLeft",r),(s1&&"0.215em"!==r||s&&1===i)&&this.adaptor.setStyle(e.dom[0],"paddingTop",r),(i 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%"}},t}();function Rd(t){return class extends t{get numCells(){return this.childNodes.length}get labeled(){return!1}get tableCells(){return this.childNodes}getChild(t){return this.childNodes[t]}getChildBBoxes(){return this.childNodes.map(t=>t.getBBox())}stretchChildren(t=null){const e=[],s=this.labeled?this.childNodes.slice(1):this.childNodes;for(const t of s){const s=t.childNodes[0];s.canStretch(Mc.Vertical)&&e.push(s)}const i=e.length,r=this.childNodes.length;if(i&&r>1&&!t){let e=0,n=0;const o=i>1&&i===r;for(const t of s){const s=t.childNodes[0],i=s.stretch.dir===Mc.None;if(o||i){const{h:t,d:r}=s.getBBox(i);t>e&&(e=t),r>n&&(n=r)}}t=[e,n]}if(t)for(const s of e){const e=s.coreRScale();s.coreMO().getStretchedVariant(t.map(t=>t*e))}}get fixesPWidth(){return!1}}}function Md(t){return class extends t{get numCells(){return Math.max(0,this.childNodes.length-1)}get labeled(){return!0}get tableCells(){return this.childNodes.slice(1)}getChild(t){return this.childNodes[t+1]}getChildBBoxes(){return this.childNodes.slice(1).map(t=>t.getBBox())}}}const Id=function(){var t;const e=Rd(Yc);return(t=class extends e{toCHTML(t){super.toCHTML(t);const e=this.node.attributes.get("rowalign");"baseline"!==e&&this.adaptor.setAttribute(this.dom[0],"rowalign",e);const{h:s,d:i}=this.getBBox();this.adaptor.setStyle(this.dom[0],"height",this.em(s+i))}}).kind=En.prototype.kind,t.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"}},t}(),wd=function(){var t;const e=Md(Id);return(t=class extends e{toCHTML(t){super.toCHTML(t);const e=this.adaptor.firstChild(this.dom[0]);if(e){this.adaptor.remove(e);const t=this.node.attributes.get("rowalign"),s="baseline"!==t&&"axis"!==t?{rowalign:t}:{},i=this.html("mjx-mtr",s,[e]);this.adaptor.append(this.parent.labels,i)}}markUsed(){super.markUsed(),this.jax.wrapperUsage.add(Id.kind)}}).kind=xn.prototype.kind,t.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"}},t}();function kd(t){return class extends t{get fixesPWidth(){return!1}invalidateBBox(){this.bboxComputed=!1,this.lineBBox=[]}getWrapWidth(t){const e=this.parent.parent,s=this.parent,i=this.node.childPosition()-(s.labeled?1:0);return"number"==typeof e.cWidths[i]?e.cWidths[i]:e.getTableData().W[i]}getChildAlign(t){return this.node.attributes.get("columnalign")}}}const Od=function(){var t;const e=kd(Yc);return(t=class extends e{toCHTML(t){super.toCHTML(t);const e=this.node.attributes.get("rowalign"),s=this.node.attributes.get("columnalign");e!==this.parent.node.attributes.get("rowalign")&&this.adaptor.setAttribute(this.dom[0],"rowalign",e),"center"===s||"mlabeledtr"===this.parent.kind&&this===this.parent.childNodes[0]&&s===this.parent.parent.node.attributes.get("side")||this.adaptor.setStyle(this.dom[0],"textAlign",s),this.parent.parent.node.getProperty("useHeight")&&this.adaptor.append(this.dom[0],this.html("mjx-tstrut"))}}).kind=yn.prototype.kind,t.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"}},t}(),Dd={dx:".2em",dy:".1em",postDelay:600,clearDelay:100,hoverTimer:new Map,clearTimer:new Map,stopTimers:(t,e)=>{e.clearTimer.has(t)&&(clearTimeout(e.clearTimer.get(t)),e.clearTimer.delete(t)),e.hoverTimer.has(t)&&(clearTimeout(e.hoverTimer.get(t)),e.hoverTimer.delete(t))}};function Pd(t){return class extends t{get selected(){const t=this.node.attributes.get("selection"),e=Math.max(1,Math.min(this.childNodes.length,t))-1;return this.childNodes[e]||this.wrap(this.node.selected)}getParameters(){const t=this.node.attributes.get("data-offsets"),[e,s]=Wr(t||"");this.tipDx=this.length2em(e||Dd.dx),this.tipDy=this.length2em(s||Dd.dy)}constructor(t,e,s=null){super(t,e,s);const i=this.constructor.actions,r=this.node.attributes.get("actiontype"),[n,o]=i.get(r)||[(t,e)=>{},{}];this.action=n,this.data=o,this.getParameters()}computeBBox(t,e=!1){t.updateFrom(this.selected.getOuterBBox()),this.selected.setChildPWidths(e)}get breakCount(){return this.node.isEmbellished?this.selected.coreMO().embellishedBreakCount:this.selected.breakCount}computeLineBBox(t){return this.getChildLineBBox(this.selected,t)}}}const Bd=function(){var t;const e=Pd(Yc);return(t=class extends e{setEventHandler(t,e,s=null){(s?[s]:this.dom).forEach(s=>s.addEventListener(t,e))}Em(t){return this.em(t)}toCHTML(t){if(this.toEmbellishedCHTML(t))return;const e=this.standardChtmlNodes(t);this.selected.toCHTML(e),this.action(this,this.data)}}).kind=an.prototype.kind,t.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","line-height":0,padding:".2em",border:"1px solid #888","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"},"mjx-container [data-mjx-collapsed]":{color:"#55F"},"@media (prefers-color-scheme: dark) /* chtml maction */":{"mjx-tool > mjx-tip":{border:"1px solid #888","background-color":"#303030",color:"#E0E0E0","box-shadow":"2px 2px 5px #000"},"mjx-status":{"background-color":"#303030",color:"#E0E0E0"},"mjx-container [data-mjx-collapsed]":{color:"#88F"}}},t.actions=new Map([["toggle",[(t,e)=>{t.dom.forEach(e=>{t.adaptor.setAttribute(e,"toggle",t.node.attributes.get("selection"))});const s=t.factory.jax.math,i=t.factory.jax.document,r=t.node;t.setEventHandler("click",t=>{s.end.node||(s.start.node=s.end.node=s.typesetRoot,s.start.n=s.end.n=0),r.nextToggleSelection(),s.rerender(i,r.attributes.get("data-maction-id")?ar.ENRICHED:ar.RERENDER),t.stopPropagation()})},{}]],["tooltip",[(t,e)=>{const s=t.childNodes[1];if(s)if(s.node.isKind("mtext")){const e=s.node.getText();t.dom.forEach(s=>t.adaptor.setAttribute(s,"title",e))}else{const i=t.adaptor;for(const r of t.dom){const n=i.append(r,t.html("mjx-tool",{style:{bottom:t.Em(-t.tipDy),right:t.Em(-t.tipDx)}},[t.html("mjx-tip")]));s.toCHTML([i.firstChild(n)]),t.setEventHandler("mouseover",t=>{e.stopTimers(r,e);const s=setTimeout(()=>i.setStyle(n,"display","block"),e.postDelay);e.hoverTimer.set(r,s),t.stopPropagation()},r),t.setEventHandler("mouseout",t=>{e.stopTimers(r,e);const s=setTimeout(()=>i.setStyle(n,"display",""),e.clearDelay);e.clearTimer.set(r,s),t.stopPropagation()},r)}}},Dd]],["statusline",[(t,e)=>{const s=t.childNodes[1];if(s&&s.node.isKind("mtext")){const i=t.adaptor,r=s.node.getText();t.dom.forEach(t=>i.setAttribute(t,"statusline",r)),t.setEventHandler("mouseover",s=>{if(null===e.status){const s=i.body(i.document);e.status=i.append(s,t.html("mjx-status",{},[t.text(r)]))}s.stopPropagation()}),t.setEventHandler("mouseout",t=>{e.status&&(i.remove(e.status),e.status=null),t.stopPropagation()})}},{status:null}]]]),t}();function Fd(t){return class extends t{constructor(t,e,s=null){super(t,e,s),this.getParameters()}getParameters(){const{width:t,height:e,valign:s,src:i,index:r}=this.node.attributes.getList("width","height","valign","src","index");if(i)this.width="auto"===t?1:this.length2em(t),this.height="auto"===e?1:this.length2em(e),this.valign=this.length2em(s||"0");else{const t=String.fromCodePoint(parseInt(r)),e=this.node.factory;this.charWrapper=this.wrap(e.create("text").setText(t)),this.charWrapper.parent=this}}computeBBox(t,e=!1){this.charWrapper?t.updateFrom(this.charWrapper.getBBox()):(t.w=this.width,t.h=this.height+this.valign,t.d=-this.valign)}}}const jd=function(){var t;const e=Fd(Yc);return(t=class extends e{toCHTML(t){const e=this.standardChtmlNodes(t);if(this.charWrapper)return void this.charWrapper.toCHTML(e);const{src:s,alt:i}=this.node.attributes.getList("src","alt"),r={width:this.em(this.width),height:this.em(this.height)};this.valign&&(r.verticalAlign=this.em(this.valign));const n=this.html("img",{src:s,style:r,alt:i,title:i});this.adaptor.append(e[0],n)}}).kind=Tn.prototype.kind,t.styles={"mjx-mglyph > img":{display:"inline-block",border:0,padding:0}},t}();function _d(t){return class extends t{computeBBox(t,e=!1){if(this.childNodes.length){const{w:e,h:s,d:i}=this.childNodes[0].getBBox();t.w=e,t.h=s,t.d=i}}get breakCount(){return this.node.isEmbellished?this.coreMO().embellishedBreakCount:this.childNodes[0].breakCount}}}function Ud(t){class e extends t{constructor(t,e,s=null){super(t,e,s),this.rscale=this.getRScale()}computeBBox(t,e=!1){const s=this.node.getXML(),i=this.getHDW(s,"use","force"),{h:r,d:n,w:o}=i?this.splitHDW(i):this.measureXmlNode(s);t.w=o,t.h=r,t.d=n}getHTML(){let t=this.adaptor.clone(this.node.getXML());const e=this.getFontStyles();return(this.getHDW(t,"force")||1!==this.jax.options.scale)&&(t=this.addHDW(t,e)),this.html("mjx-html",{variant:this.parent.variant,style:e},[t])}getHDW(t,e,s=e){const i=this.jax.options.htmlHDW,r=this.adaptor.getAttribute(t,"data-mjx-hdw");return!r||i!==e&&i!==s?null:r}splitHDW(t){const e=1/this.metrics.scale,[s,i,r]=Wr(t).map(t=>this.length2em(t||"0")*e);return{h:s,d:i,w:r}}getFontStyles(){var t;const e=this.adaptor,s=this.metrics;return{"font-family":(null===(t=this.parent.styles)||void 0===t?void 0:t.get("font-family"))||s.family||e.fontFamily(e.parent(this.jax.math.start.node))||"initial","font-size":this.jax.fixed(s.em*this.rscale)+"px"}}measureXmlNode(t){const e=this.adaptor,s=this.html("mjx-xml-block",{style:{display:"inline-block"}},[e.clone(t)]),i=this.html("mjx-baseline",{style:{display:"inline-block",width:0,height:0}}),r=this.getFontStyles(),n=this.html("mjx-measure-xml",{style:r},[i,s]),o=this.jax.container;e.append(e.parent(this.jax.math.start.node),o),e.append(o,n);const a=this.metrics,l=a.em*a.scale*this.rscale,{left:c,right:h,bottom:d,top:u}=e.nodeBBox(s),p=(h-c)/l,m=(e.nodeBBox(i).top-u)/l,f=(d-u)/l-m;return e.remove(o),e.remove(n),{w:p,h:m,d:f}}getStyles(){}getScale(){}getVariant(){}}return e.autoStyle=!1,e.styles={"mjx-measure-xml":{position:"absolute",left:0,top:0,display:"inline-block","line-height":"normal","white-space":"normal"},"mjx-html":{display:"inline-block","line-height":"normal","text-align":"initial","white-space":"initial"},"mjx-html-holder":{display:"block",position:"absolute",top:0,left:0,bottom:0,right:0}},e}const Hd=function(){var t;const e=_d(Yc);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;const e=this.standardChtmlNodes(t);this.childNodes.length&&this.childNodes[0].toCHTML(e)}}).kind=Cn.prototype.kind,t}(),Wd=function(){var t;return(t=class extends Yc{toCHTML(t){super.toCHTML(t)}computeBBox(){return this.bbox}}).kind=Ln.prototype.kind,t}(),zd=function(){var t;return(t=class extends Yc{}).kind=An.prototype.kind,t.styles={"mjx-annotation-xml":{"font-family":"initial","line-height":"normal"}},t}(),qd=function(){var t;const e=Ud(Yc);return(t=class extends e{toCHTML(t){this.markUsed(),this.dom=[this.adaptor.append(t[0],this.getHTML())]}addHDW(t,e){const s=this.jax.options.scale,{h:i,d:r,w:n}=this.bbox,o=s*this.metrics.scale;return e.width=this.em(n*o),e.height=this.em((i+r)*o),e["vertical-align"]=this.em(-r*o),e.position="relative",this.html("mjx-html-holder",{style:{transform:`scale(${this.jax.fixed(s)})`,"transform-origin":"top left"}},[t])}}).kind=Sr.prototype.kind,t}();function Vd(t){return class extends t{computeBBox(t,e=!1){super.computeBBox(t,e),this.childNodes[0]&&this.childNodes[0].bbox.ic&&(t.ic=this.childNodes[0].bbox.ic)}}}const Xd=function(){var t;const e=Vd(Yc);return(t=class extends e{toCHTML(t){super.toCHTML(t),this.dom.forEach(t=>this.adaptor.setAttribute(t,"texclass",gr[this.node.texClass]))}}).kind=Sn.prototype.kind,t}();function Gd(t){return class extends t{remappedText(t,e){const s=this.parent.stretch.c;return s?[s]:this.parent.remapChars(this.unicodeChars(t,e))}computeBBox(t,e=!1){const s=this.parent.variant,i=this.node.getText();if("-explicitFont"===s){const e=this.jax.getFontData(this.parent.styles),{w:r,h:n,d:o}=this.jax.measureText(i,s,e);t.h=n,t.d=o,t.w=r}else{const e=this.remappedText(i,s);let r="";t.empty();for(let i=0;i1&&(t.sk=0),t.clean()}}addUtextBBox(t,e,s){if(e){const{h:i,d:r,w:n}=this.jax.measureText(e,s);this.updateBBox(t,i,r,n)}return""}updateBBox(t,e,s,i){t.w+=i,e>t.h&&(t.h=e),s>t.d&&(t.d=s)}getStyles(){}getVariant(){}getScale(){}getSpace(){}}}const Jd=function(){var t;const e=Gd(Yc);return t=class extends e{toCHTML(t){this.markUsed();const e=t[0],s=this.adaptor,i=this.parent.variant,r=this.node.getText();if(0===r.length)return;const n=this.getBBox();if("-explicitFont"===i)s.append(e,this.jax.unknownText(r,i,n.w));else{let t="";const o=this.remappedText(r,i),a=o.length>1?this.em(this.parent.getBBox().h):"",l=o.length;for(let r=0;r mjx-math.NCM-N[breakable] > *':{"font-family":"MJX-NCM-ZERO, MJX-NCM-N"},".NCM-N":{"font-family":"MJX-NCM-ZERO, MJX-NCM-N"},".NCM-B":{"font-family":"MJX-NCM-ZERO, MJX-NCM-B"},".NCM-I":{"font-family":"MJX-NCM-ZERO, MJX-NCM-I"},".NCM-BI":{"font-family":"MJX-NCM-ZERO, MJX-NCM-BI"},".NCM-DS":{"font-family":"MJX-NCM-ZERO, MJX-NCM-DS"},".NCM-F":{"font-family":"MJX-NCM-ZERO, MJX-NCM-F"},".NCM-FB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-FB"},".NCM-SS":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SS"},".NCM-SSB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SSB"},".NCM-SSI":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SSI"},".NCM-SSBI":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SSBI"},".NCM-M":{"font-family":"MJX-NCM-ZERO, MJX-NCM-M"},".NCM-SO":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SO"},".NCM-LO":{"font-family":"MJX-NCM-ZERO, MJX-NCM-LO"},".NCM-S3":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S3"},".NCM-S4":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S4"},".NCM-S5":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S5"},".NCM-S6":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S6"},".NCM-S7":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S7"},".NCM-MI":{"font-family":"MJX-NCM-ZERO, MJX-NCM-MI"},".NCM-C":{"font-family":"MJX-NCM-ZERO, MJX-NCM-C"},".NCM-CB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-CB"},".NCM-OS":{"font-family":"MJX-NCM-ZERO, MJX-NCM-OS"},".NCM-OB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-OB"},".NCM-V":{"font-family":"MJX-NCM-ZERO, MJX-NCM-V"},".NCM-LT":{"font-family":"MJX-NCM-ZERO, MJX-NCM-LT"},".NCM-RB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-RB"},".NCM-EM":{"font-family":"MJX-NCM-ZERO, MJX-NCM-EM"},".NCM-B-a":{"font-family":"MJX-NCM-ZERO, MJX-NCM-B-a"},".NCM-U":{"font-family":"MJX-NCM-ZERO, MJX-NCM-U"},".NCM-U-a":{"font-family":"MJX-NCM-ZERO, MJX-NCM-U-a"},".NCM-S":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S"},".NCM-SB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SB"}}),tu.defaultFonts=Object.assign(Object.assign({},ih.defaultFonts),{"@font-face /* MJX-NCM-ZERO */":{"font-family":"MJX-NCM-ZERO",src:'url("%%URL%%/mjx-ncm-zero.woff2") format("woff2")'},"@font-face /* MJX-BRK */":{"font-family":"MJX-BRK",src:'url("%%URL%%/mjx-ncm-brk.woff2") format("woff2")'},"@font-face /* MJX-NCM-N */":{"font-family":"MJX-NCM-N",src:'url("%%URL%%/mjx-ncm-n.woff2") format("woff2")'},"@font-face /* MJX-NCM-B */":{"font-family":"MJX-NCM-B",src:'url("%%URL%%/mjx-ncm-b.woff2") format("woff2")'},"@font-face /* MJX-NCM-I */":{"font-family":"MJX-NCM-I",src:'url("%%URL%%/mjx-ncm-i.woff2") format("woff2")'},"@font-face /* MJX-NCM-BI */":{"font-family":"MJX-NCM-BI",src:'url("%%URL%%/mjx-ncm-bi.woff2") format("woff2")'},"@font-face /* MJX-NCM-DS */":{"font-family":"MJX-NCM-DS",src:'url("%%URL%%/mjx-ncm-ds.woff2") format("woff2")'},"@font-face /* MJX-NCM-F */":{"font-family":"MJX-NCM-F",src:'url("%%URL%%/mjx-ncm-f.woff2") format("woff2")'},"@font-face /* MJX-NCM-FB */":{"font-family":"MJX-NCM-FB",src:'url("%%URL%%/mjx-ncm-fb.woff2") format("woff2")'},"@font-face /* MJX-NCM-SS */":{"font-family":"MJX-NCM-SS",src:'url("%%URL%%/mjx-ncm-ss.woff2") format("woff2")'},"@font-face /* MJX-NCM-SSB */":{"font-family":"MJX-NCM-SSB",src:'url("%%URL%%/mjx-ncm-ssb.woff2") format("woff2")'},"@font-face /* MJX-NCM-SSI */":{"font-family":"MJX-NCM-SSI",src:'url("%%URL%%/mjx-ncm-ssi.woff2") format("woff2")'},"@font-face /* MJX-NCM-SSBI */":{"font-family":"MJX-NCM-SSBI",src:'url("%%URL%%/mjx-ncm-ssbi.woff2") format("woff2")'},"@font-face /* MJX-NCM-M */":{"font-family":"MJX-NCM-M",src:'url("%%URL%%/mjx-ncm-m.woff2") format("woff2")'},"@font-face /* MJX-NCM-SO */":{"font-family":"MJX-NCM-SO",src:'url("%%URL%%/mjx-ncm-so.woff2") format("woff2")'},"@font-face /* MJX-NCM-LO */":{"font-family":"MJX-NCM-LO",src:'url("%%URL%%/mjx-ncm-lo.woff2") format("woff2")'},"@font-face /* MJX-NCM-S3 */":{"font-family":"MJX-NCM-S3",src:'url("%%URL%%/mjx-ncm-s3.woff2") format("woff2")'},"@font-face /* MJX-NCM-S4 */":{"font-family":"MJX-NCM-S4",src:'url("%%URL%%/mjx-ncm-s4.woff2") format("woff2")'},"@font-face /* MJX-NCM-S5 */":{"font-family":"MJX-NCM-S5",src:'url("%%URL%%/mjx-ncm-s5.woff2") format("woff2")'},"@font-face /* MJX-NCM-S6 */":{"font-family":"MJX-NCM-S6",src:'url("%%URL%%/mjx-ncm-s6.woff2") format("woff2")'},"@font-face /* MJX-NCM-S7 */":{"font-family":"MJX-NCM-S7",src:'url("%%URL%%/mjx-ncm-s7.woff2") format("woff2")'},"@font-face /* MJX-NCM-MI */":{"font-family":"MJX-NCM-MI",src:'url("%%URL%%/mjx-ncm-mi.woff2") format("woff2")'},"@font-face /* MJX-NCM-C */":{"font-family":"MJX-NCM-C",src:'url("%%URL%%/mjx-ncm-c.woff2") format("woff2")'},"@font-face /* MJX-NCM-CB */":{"font-family":"MJX-NCM-CB",src:'url("%%URL%%/mjx-ncm-cb.woff2") format("woff2")'},"@font-face /* MJX-NCM-OS */":{"font-family":"MJX-NCM-OS",src:'url("%%URL%%/mjx-ncm-os.woff2") format("woff2")'},"@font-face /* MJX-NCM-OB */":{"font-family":"MJX-NCM-OB",src:'url("%%URL%%/mjx-ncm-ob.woff2") format("woff2")'},"@font-face /* MJX-NCM-V */":{"font-family":"MJX-NCM-V",src:'url("%%URL%%/mjx-ncm-v.woff2") format("woff2")'},"@font-face /* MJX-NCM-LT */":{"font-family":"MJX-NCM-LT",src:'url("%%URL%%/mjx-ncm-lt.woff2") format("woff2")'},"@font-face /* MJX-NCM-RB */":{"font-family":"MJX-NCM-RB",src:'url("%%URL%%/mjx-ncm-rb.woff2") format("woff2")'},"@font-face /* MJX-NCM-EM */":{"font-family":"MJX-NCM-EM",src:'url("%%URL%%/mjx-ncm-em.woff2") format("woff2")'},"@font-face /* MJX-NCM-B-a */":{"font-family":"MJX-NCM-B-a",src:'url("%%URL%%/mjx-ncm-b-a.woff2") format("woff2")'},"@font-face /* MJX-NCM-U */":{"font-family":"MJX-NCM-U",src:'url("%%URL%%/mjx-ncm-u.woff2") format("woff2")'},"@font-face /* MJX-NCM-U-a */":{"font-family":"MJX-NCM-U-a",src:'url("%%URL%%/mjx-ncm-u-a.woff2") format("woff2")'},"@font-face /* MJX-NCM-S */":{"font-family":"MJX-NCM-S",src:'url("%%URL%%/mjx-ncm-s.woff2") format("woff2")'},"@font-face /* MJX-NCM-SB */":{"font-family":"MJX-NCM-SB",src:'url("%%URL%%/mjx-ncm-sb.woff2") format("woff2")'}}),tu.dynamicFiles=ih.defineDynamicFiles([["latin",{normal:[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7835],7838,[7840,7929],11377]}],["latin-b",{bold:[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["latin-i",{italic:[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929]]}],["latin-bi",{"bold-italic":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929]]}],["double-struck",{normal:[8450,8461,8469,8473,8474,8477,8484,[8508,8512],[8517,8521],120120,120121,[120123,120126],[120128,120132],120134,[120138,120144],[120146,120171],[120792,120801]],"double-struck":[305,567]}],["fraktur",{normal:[8460,8465,8476,8488,8493,120068,120069,[120071,120074],[120077,120084],[120086,120092],[120094,120119],[120172,120223]],fraktur:[305,567],"bold-fraktur":[305,567]}],["script",{normal:[8458,8459,8464,8466,8467,8472,8475,8492,[8495,8497],8499,8500,119964,119966,119967,119970,119973,119974,[119977,119980],[119982,119993],119995,[119997,120003],[120005,120067]],script:[],"bold-script":[]}],["sans-serif",{normal:[[8513,8516],[120224,120431],[120662,120777],[120802,120821]],"sans-serif":[[32,47],[58,64],[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[713,715],[728,730],732,[768,776],778,780,[913,929],[931,937],[945,969],977,978,981,982,1008,1009,[1012,1014],[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734],"bold-sans-serif":[32,33,[35,47],58,59,61,63,64,[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[713,715],[728,730],732,[768,776],778,780,978,1014,[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734],"sans-serif-italic":[[32,64],[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[713,715],[728,730],732,[768,776],778,780,[913,929],[931,937],[945,969],977,978,981,982,1008,1009,[1012,1014],[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734],"sans-serif-bold-italic":[32,33,[35,59],61,63,64,[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[713,715],[728,730],732,[768,776],778,780,978,1014,[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734]}],["sans-serif-r",{"sans-serif":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["sans-serif-b",{"bold-sans-serif":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["sans-serif-i",{"sans-serif-italic":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["sans-serif-bi",{"sans-serif-bold-italic":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["sans-serif-ex",{"sans-serif":[161,162,164,166,[169,171],173,174,184,[186,191],[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879],3647,7620,7621,7624,7625,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9474,9553,9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59959,59962,59966,59970,59973,60163,60164,60168,60175,60177,60178,60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64260],65126],"bold-sans-serif":[161,162,164,166,[169,171],173,174,184,[186,191],[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879],3647,7620,7621,7624,7625,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9474,9553,9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64260],65126],"sans-serif-italic":[161,162,164,166,[169,171],173,174,184,[186,191],[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879],3647,7620,7621,7624,7625,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9474,9553,9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64260],65126],"sans-serif-bold-italic":[161,162,164,166,[169,171],173,174,184,[186,191],[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,879],3647,7620,7621,7624,7625,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9474,9553,9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64260],65126]}],["monospace",{normal:[[120432,120483],[120822,120831]],monospace:[[32,47],[58,64],[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[728,730],732,[768,776],778,780,[913,929],[931,937],[945,969],977,978,981,982,1008,1009,[1012,1014],[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734]}],["monospace-l",{monospace:[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["monospace-ex",{monospace:[161,162,164,166,[169,171],173,174,184,[186,191],[592,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,995],1010,1011,[1015,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309],3647,7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575,7620,7621,7624,7625,[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,[9552,9579],9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64262],65126]}],["calligraphic",{"-tex-calligraphic":[[65,90]],"-tex-bold-calligraphic":[[65,90]]}],["math",{normal:[8714,8717,8731,8732,8762,8763,8782,8783,[8785,8787],[8790,8796],8798,8844,[8886,8889],[8891,8895],8903,[8912,8929],[8932,8937],[8946,8959],[10176,10199],[10202,10204],[10207,10213],[10625,10646],[10649,10740],10742,[10746,10751],10762,10763,[10781,10798],[10800,10814],[10816,10876],[10879,10884],[10893,10900],[10903,10926],[10939,10948],[10951,10954],[10957,10973],[10988,10993],[10998,11003],[11005,11007]]}],["symbols",{normal:[127,161,162,164,166,[169,171],173,174,178,179,[185,191],3647,8215,8218,8219,8222,8223,[8226,8229],8233,8240,8241,[8248,8259],[8261,8278],[8280,8286],8319,8320,8353,8358,[8361,8363],8369,8370,8448,8449,[8451,8454],8456,8457,8468,8470,8471,[8478,8483],8485,8489,8494,[8505,8507],[8522,8527],[8960,8966],[8977,8984],8986,8987,[8996,9e3],[9003,9114],9142,[9146,9165],9167,[9169,9179],[9186,9203],[9208,9215],9250,9251,11159,11193,11209,[11216,11241],[11248,11263],11800,12306,12310,12311,12336,[64256,64262],65126,65279]},[8215]],["symbols-b-i",{bold:[161,162,164,166,[169,171],173,174,[186,191],3647,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,[8361,8363],8369,8370,8451,8470,8471,8478,8480,8482,8494,8960,9250,9251,11800,[64256,64262],65126],italic:[[161,167],[169,174],177,[181,183],[186,191],215,240,247,3647,8218,8219,[8222,8226],8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,8960,9250,9251,11800,[64256,64262],65126],"bold-italic":[[161,167],[169,174],177,[181,183],[186,191],215,240,247,3647,8218,8219,[8222,8226],8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8320,8353,8358,[8361,8363],8369,8370,8451,8470,8471,8478,8480,8482,8494,8960,9250,9251,11800,[64256,64262],65126]}],["greek",{normal:[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[11392,11507],[11513,11519]],bold:[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,987],[990,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[11392,11507],[11513,11519]],italic:[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[11392,11507],[11513,11519]],"bold-italic":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[11392,11507],[11513,11519]]}],["greek-ss",{"sans-serif":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190]],"bold-sans-serif":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8121],[8123,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190]],"sans-serif-italic":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190]],"sans-serif-bold-italic":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8121],[8123,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190]]}],["cyrillic",{normal:[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],bold:[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],italic:[[1024,1143],[1146,1158],[1160,1225],[1227,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],"bold-italic":[[1024,1143],[1146,1158],[1160,1225],[1227,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]]}],["cyrillic-ss",{"sans-serif":[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],"bold-sans-serif":[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],"sans-serif-italic":[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],"sans-serif-bold-italic":[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]]}],["phonetics",{normal:[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],bold:[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],italic:[[592,685],687],"bold-italic":[[592,687]]}],["phonetics-ss",{"sans-serif":[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],"bold-sans-serif":[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],"sans-serif-italic":[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],"sans-serif-bold-italic":[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575]}],["hebrew",{normal:[[1425,1479],[1488,1514],[1519,1525],1527,[64285,64335]],bold:[[1425,1479],[1488,1515],[1519,1525],1527,[64285,64335]],italic:[[1425,1479],[1488,1514],[1519,1525],1527,[64285,64335]],"bold-italic":[[1425,1479],[1488,1515],[1519,1525],1527,[64285,64335]]}],["devanagari",{normal:[[2304,2431]],bold:[],italic:[],"bold-italic":[]}],["cherokee",{normal:[[5024,5109],[5112,5117]],bold:[[5024,5109],[5112,5117]],italic:[[5024,5115]],"bold-italic":[[5024,5115]]}],["arabic",{normal:[[126464,126498],126500,126503,[126505,126514],[126516,126519],126521,126523,126530,126535,126537,126539,[126541,126543],126545,126546,126548,126551,126553,126555,126557,126559,126561,126562,126564,[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],126704,126705],bold:[],italic:[],"bold-italic":[]}],["braille-d",{normal:[[10240,10495]]}],["braille",{"sans-serif":[[10240,10495]]}],["arrows",{normal:[8604,8605,8607,8609,8613,8615,8616,8621,[8623,8629],8632,8633,[8662,8665],[8668,8671],[8678,8692],[8695,8703],9166,10145,[10224,10228],10239,[10496,10505],[10508,10569],10572,10573,10575,10577,10580,10581,10584,10585,10588,10589,[10592,10601],[10608,10619],[11008,11026],[11056,11087],[11098,11123],[11126,11157],[11160,11192],[11244,11247]],"-largeop":[8593,8595,[8597,8603],[8606,8611],8613,8615,[8617,8622],[8624,8627],8630,8631,[8636,8655],8657,8659,[8661,8667],[8678,8681],8691,8693,8694,[11012,11015],11020,11021,11057],"-lf-tp":[[8678,8681],10503,11013,11014],"-rt-bt":[[8678,8681],10502,11015,11020],"-ex-md":[8678,8679,11013,11014]},[8607,8609,8613,8615,8621,8622,[8624,8627],[8662,8665],8668,8669,[8678,8681],8691,10145,10237,10238,10502,10503,10572,10573,10575,10577,10588,10589,10592,10593,[11012,11015],11020,11021,11057]],["marrows",{normal:[[129024,129035],[129040,129095],[129104,129113],[129120,129159],[129168,129197],129200,129201]}],["accents",{normal:[184,[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,879],7620,7621,7624,7625,[8403,8405],8408,[8413,8415],[8420,8427],8432],"-smallop":[785,[812,816],818,819,831,845],"-largeop":[785,[812,816]],"-size3":[785,[812,816]],"-size4":[785,[812,816]],"-size5":[785,[812,816]],"-size6":[785,[812,816]],"-size7":[785,[812,816]],"-ex-md":[818,819,831,845]},[785,[812,816],818,819,831,845,8425]],["accents-b-i",{bold:[184,[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879],7620,7621,7624,7625],italic:[184,[688,700],[702,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879]],"bold-italic":[184,[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879]]}],["shapes",{normal:[8962,[8998,9e3],9003,[9211,9214],[9472,9631],[9634,9641],[9644,9649],9672,9673,[9676,9678],[9680,9701],[9703,9710],[9712,9719],9728,9733,9734,9737,9761,9773,[9785,9790],9792,9794,[9824,9831],[9833,9835],[9837,9839],9854,[9856,9865],9893,[9898,9902],9906,10003,10013,10016,10026,10038,10045,10098,10099,10139,10145,[11026,11055],[11088,11097],[11194,11208],[11210,11215],11242,11243],bold:[9474,9553,9773,9792,9834,9901,9902,9906,10013],italic:[9773,9834,9901,9902,10013],"bold-italic":[9773,9834,9901,9902,10013]}],["mshapes",{normal:[[128896,128984],[128992,129003]]}],["variants",{"-tex-variant":[34,39,42,96,126,170,176,178,179,185,186,8212,8289,8304,8305,[8308,8334]]}],["PUA",{normal:[[57344,57395],[57409,57458],[59264,59274],59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198],bold:[59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198],italic:[59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,61867,61868,[61873,61877],62082,62083,62110,62113,62116,62119,62120,[62560,62568],[62570,62578],63166,63172,[63174,63176],[63187,63190],63198],"bold-italic":[59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,61867,61868,[61873,61877],62082,62083,62110,62113,62116,62119,62120,[62560,62568],[62570,62578],63166,63172,[63174,63176],[63187,63190],63198]}]]);const eu={fontName:"mathjax-newcm",DefaultFont:tu},su=eu.fontName,iu=eu.DefaultFont;class ru extends zc{constructor(t={}){super(t,Yd,iu),this.chtmlStyles=null,this.font.adaptiveCSS(this.options.adaptiveCSS),this.wrapperUsage=new sh}addExtension(t,e=""){const s=super.addExtension(t,e);return s.length&&this.options.adaptiveCSS&&this.chtmlStyles&&this.adaptor.insertRules(this.chtmlStyles,s),[]}escaped(t,e){return this.setDocument(e),this.html("span",{},[this.text(t.math)])}styleSheet(t){if(this.chtmlStyles){const t=new ao;return this.options.adaptiveCSS&&(this.addWrapperStyles(t),this.updateFontStyles(t)),t.addStyles(this.font.updateDynamicStyles()),this.adaptor.insertRules(this.chtmlStyles,t.getStyleRules()),this.chtmlStyles}const e=this.chtmlStyles=super.styleSheet(t);return this.adaptor.setAttribute(e,"id",ru.STYLESHEETID),this.wrapperUsage.update(),e}updateFontStyles(t){t.addStyles(this.font.updateStyles({}))}addWrapperStyles(t){if(this.options.adaptiveCSS)for(const e of this.wrapperUsage.update()){const s=this.factory.getNodeClass(e);s&&this.addClassStyles(s,t)}else super.addWrapperStyles(t)}addClassStyles(t,e){const s=t;s.autoStyle&&"unknown"!==s.kind&&e.addStyles({["mjx-"+s.kind]:{display:"inline-block","text-align":"left"}}),this.wrapperUsage.add(s.kind),super.addClassStyles(t,e)}insertStyles(t){this.chtmlStyles&&this.adaptor.insertRules(this.chtmlStyles,new ao(t).getStyleRules())}processMath(t,e){t.toCHTML([e])}clearCache(){this.styleJson.clear(),this.font.clearCache(),this.wrapperUsage.clear(),this.chtmlStyles=null}reset(){this.clearCache()}unknownText(t,e,s=null){const i={},r=100/this.math.metrics.scale;if(100!==r&&(i["font-size"]=this.fixed(r,1)+"%",i.padding=yo(75/r)+" 0 "+yo(20/r)+" 0"),"-explicitFont"!==e){const s=_r(t);(1!==s.length||s[0]<119808||s[0]>120831)&&this.cssFontStyles(this.font.getCssFont(e),i)}return null!==s&&(i.width=this.fixed(s*this.math.metrics.scale)+"em"),this.html("mjx-utext",{variant:e,style:i},[this.text(t)])}measureTextNode(t){const e=this.adaptor,s=e.clone(t);e.setStyle(s,"font-family",e.getStyle(s,"font-family").replace(/MJXZERO, /g,""));const i=this.math.metrics.em,r={position:"absolute",top:0,left:0,"white-space":"nowrap","font-size":this.fixed(i,3)+"px"},n=this.html("mjx-measure-text",{style:r},[s]);e.append(e.parent(this.math.start.node),this.container),e.append(this.container,n);const o=e.nodeSize(s,i)[0];return e.remove(this.container),e.remove(n),{w:o,h:.75,d:.2}}}function nu(t,e){const s={};for(const i of Object.keys(t)){const r=t[i];for(const t of Object.keys(r)){s[t]||(s[t]={});const n=r[t];if(i)for(const t of Object.keys(n)){const s=n[parseInt(t)];s[3]||(s[3]={}),e?s[3].ff=e+"-"+i:s[3].f=i}Object.assign(s[t],n)}}return s}function ou(t,e,s,i=""){const r="https://cdn.jsdelivr.net"===(MathJax.config.loader?.paths?.fonts||"").substring(0,24)?"@%%VERSION%%":"",n=s.fontPath||`[fonts]/%%FONT%%-font${i}${r}`,o=t.match(/^[a-z]+:/)?(t.match(/[^/:\\]*$/)||[e])[0]:t;return ci(MathJax.config.loader,"paths",{[o+i]:o===t?n.replace(/%%FONT%%/g,t).replace(/%%VERSION%%/g,to.version):t}),`[${o}${i}]`}ru.NAME="CHTML",ru.OPTIONS=Object.assign(Object.assign({},zc.OPTIONS),{adaptiveCSS:!0,matchFontHeight:!0}),ru.commonStyles=Object.assign(Object.assign({},zc.commonStyles),{'mjx-container[jax="CHTML"]':{"white-space":"nowrap"},[["mjx-mo > mjx-c","mjx-mi > mjx-c","mjx-mn > mjx-c","mjx-ms > mjx-c","mjx-mtext > mjx-c"].join(", ")]:{"clip-path":"padding-box polygon("+["-1em -2px","calc(100% + 1em) -2px","calc(100% + 1em) calc(100% + 2px)","-1em calc(100% + 2px)"].join(", ")+")"},"mjx-stretchy-h":{"clip-path":"padding-box polygon(0 -2px, 100% -2px, 100% calc(100% + 2px), 0 calc(100% + 2px))"},"mjx-stretchy-v":{"clip-path":"padding-box polygon(-2px 0, calc(100% + 2px) 0, calc(100% + 2px) 100%, -2px 100%)"},'mjx-container [space="1"]':{"margin-left":".111em"},'mjx-container [space="2"]':{"margin-left":".167em"},'mjx-container [space="3"]':{"margin-left":".222em"},'mjx-container [space="4"]':{"margin-left":".278em"},'mjx-container [space="5"]':{"margin-left":".333em"},'mjx-container [rspace="1"]':{"margin-right":".111em"},'mjx-container [rspace="2"]':{"margin-right":".167em"},'mjx-container [rspace="3"]':{"margin-right":".222em"},'mjx-container [rspace="4"]':{"margin-right":".278em"},'mjx-container [rspace="5"]':{"margin-right":".333em"},'mjx-container [size="s"]':{"font-size":"70.7%"},'mjx-container [size="ss"]':{"font-size":"50%"},'mjx-container [size="Tn"]':{"font-size":"60%"},'mjx-container [size="sm"]':{"font-size":"85%"},'mjx-container [size="lg"]':{"font-size":"120%"},'mjx-container [size="Lg"]':{"font-size":"144%"},'mjx-container [size="LG"]':{"font-size":"173%"},'mjx-container [size="hg"]':{"font-size":"207%"},'mjx-container [size="HG"]':{"font-size":"249%"},'mjx-container [width="full"]':{width:"100%"},"mjx-box":{display:"inline-block"},"mjx-block":{display:"block"},"mjx-itable":{display:"inline-table"},"mjx-row":{display:"table-row"},[["cell","base","under","over","den"].map(t=>`mjx-row > mjx-${t}`).join(", ")]:{display:"table-cell"},"mjx-container [inline-breaks]":{display:"inline"},"mjx-container .mjx-selected":{outline:"2px solid black"},"@media (prefers-color-scheme: dark)":{"mjx-container .mjx-selected":{outline:"2px solid #C8C8C8"}},"mjx-mtext":{display:"inline-block"},"mjx-mstyle":{display:"inline-block"},"mjx-merror":{display:"inline-block",color:"red","background-color":"yellow"},"mjx-mphantom":{visibility:"hidden"}}),ru.STYLESHEETID="MJX-CHTML-styles",MathJax.loader&&MathJax.loader.checkVersion("output/chtml",ri,"output"),hi({_:{output:{chtml_ts:Ds,chtml:{DefaultFont:Os,DynamicFonts:Ps,FontData:ke,Notation:Ge,Usage:we,Wrapper:Le,WrapperFactory:ks,Wrappers_ts:ws,Wrappers:{HtmlNode:Is,TeXAtom:Ss,TextNode:Ms,maction:ys,math:Re,menclose:Je,mfenced:Qe,mfrac:ts,mglyph:vs,mi:Ie,mmultiscripts:us,mn:Be,mo:De,mpadded:qe,mroot:rs,mrow:$e,ms:je,mspace:We,msqrt:ss,msubsup:ls,mtable:ms,mtd:Es,mtext:Ue,mtr:gs,munderover:hs,scriptbase:as,semantics:As}},common_ts:Te,common:{Direction:xe,FontData:ye,LineBBox:Ne,LinebreakVisitor:ve,Notation:Ve,Wrapper:Ae,WrapperFactory:Ce,Wrappers:{TeXAtom:Ls,TextNode:Rs,XmlNode:Cs,maction:xs,math:Se,menclose:Xe,mfenced:Ye,mfrac:Ze,mglyph:Ns,mi:Me,mmultiscripts:ds,mn:Pe,mo:Oe,mpadded:ze,mroot:is,mrow:Ke,ms:Fe,mspace:He,msqrt:es,msubsup:ns,mtable:ps,mtd:bs,mtext:_e,mtr:fs,munderover:cs,scriptbase:os,semantics:Ts}}}}});const au={config(t,e,s,i){if(MathJax.loader){ci(MathJax.config,t,MathJax.config.output||{});let e=MathJax.config[t],r=e.font||e.fontData||s;"string"!=typeof r&&(e.fontData=r,e.font=r=r.NAME),"["!==r.charAt(0)&&(r=ou(r,t,e));const n=r.substring(1,r.length-1),o=function(t,e){const s=[];for(const i of e.fontExtensions||[]){const r=`${ou(i,t,e,"-extension")}/${t}`;s.push(r)}return s}(t,e);if(o.length&&MathJax.loader.addPackageData(`${r}/${t}`,{extraLoads:o}),n===s&&i){const e=MathJax.config.loader[`${r}/${t}`]?.extraLoads;e&&MathJax.loader.addPackageData(`output/${t}`,{extraLoads:e}),hi({_:{output:{fonts:{[n]:{[t+"_ts"]:{[i.NAME+"Font"]:i}}}}}}),ci(MathJax,"config",{output:{font:r},[t]:{fontData:i,dynamicPrefix:`${r}/${t}/dynamic`}}),"chtml"===t&&ci(MathJax.config,t,{fontURL:fi.resolvePath(`${r}/${t}/woff2`,!1)})}else MathJax.loader.addPackageData(`output/${t}`,{extraLoads:[`${r}/${t}`]})}MathJax.startup&&(MathJax.startup.registerConstructor(t,e),MathJax.startup.useOutput(t))},loadFont:(t,e,s,i)=>MathJax.loader?(i&&MathJax.loader.preLoaded(`[${s}]/${e}`),fi.loadPromise(`output/${e}`).then(t)):t};var lu;au.config("chtml",ru,su,iu),function(t){t[t.RETURN=13]="RETURN",t[t.ESCAPE=27]="ESCAPE",t[t.SPACE=32]="SPACE",t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN"}(lu||(lu={}));const cu="click",hu="dblclick",du="mousedown",uu="mouseup",pu="mouseover",mu="mouseout",fu="selectstart";class gu{constructor(){this.bubble=!1}bubbleKey(){this.bubble=!0}keydown(t){switch(t.keyCode){case lu.ESCAPE:this.escape(t);break;case lu.RIGHT:this.right(t);break;case lu.LEFT:this.left(t);break;case lu.UP:this.up(t);break;case lu.DOWN:this.down(t);break;case lu.RETURN:case lu.SPACE:this.space(t);break;default:return}this.bubble?this.bubble=!1:this.stop(t)}escape(t){}space(t){}left(t){}right(t){}up(t){}down(t){}stop(t){t&&(t.stopPropagation(),t.preventDefault(),t.cancelBubble=!0)}mousedown(t){return this.stop(t)}mouseup(t){return this.stop(t)}mouseover(t){return this.stop(t)}mouseout(t){return this.stop(t)}click(t){return this.stop(t)}addEvents(t){t.addEventListener(du,this.mousedown.bind(this)),t.addEventListener(uu,this.mouseup.bind(this)),t.addEventListener(pu,this.mouseover.bind(this)),t.addEventListener(mu,this.mouseout.bind(this)),t.addEventListener(cu,this.click.bind(this)),t.addEventListener("keydown",this.keydown.bind(this)),t.addEventListener("dragstart",this.stop.bind(this)),t.addEventListener(fu,this.stop.bind(this)),t.addEventListener("contextmenu",this.stop.bind(this)),t.addEventListener(hu,this.stop.bind(this))}}class bu extends gu{addAttributes(t){for(const e in t)this.html.setAttribute(e,t[e])}get html(){return this._html||this.generateHtml(),this._html}set html(t){this._html=t,this.addEvents(t)}generateHtml(){const t=document.createElement("div");t.classList.add(this.className),t.setAttribute("role",this.role),this.html=t}focus(){const t=this.html;t.setAttribute("tabindex","0"),setTimeout(()=>t.focus(),50)}unfocus(){const t=this.html;t.hasAttribute("tabindex")&&t.setAttribute("tabindex","-1");try{t.blur()}catch(t){}t.blur()}}class Eu extends bu{constructor(){super(...arguments),this.posted=!1}isPosted(){return this.posted}post(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)}unpost(){if(!this.posted)return;const t=this.html;t.parentNode&&t.parentNode.removeChild(t),this.posted=!1}}function xu(t){return"CtxtMenu_"+t}function yu(t){return xu(t)}function Nu(t){return xu(t)}const vu={ATTACHED:yu("Attached"),CONTEXTMENU:yu("ContextMenu"),MENU:yu("Menu"),MENUARROW:yu("MenuArrow"),MENUACTIVE:yu("MenuActive"),MENUCHECK:yu("MenuCheck"),MENUCLOSE:yu("MenuClose"),MENUCOMBOBOX:yu("MenuComboBox"),MENUDISABLED:yu("MenuDisabled"),MENUFRAME:yu("MenuFrame"),MENUITEM:yu("MenuItem"),MENULABEL:yu("MenuLabel"),MENURADIOCHECK:yu("MenuRadioCheck"),MENUINPUTBOX:yu("MenuInputBox"),MENURULE:yu("MenuRule"),MENUSLIDER:yu("MenuSlider"),MOUSEPOST:yu("MousePost"),RTL:yu("RTL"),INFO:yu("Info"),INFOCLOSE:yu("InfoClose"),INFOCONTENT:yu("InfoContent"),INFOSIGNATURE:yu("InfoSignature"),INFOTITLE:yu("InfoTitle"),SLIDERVALUE:yu("SliderValue"),SLIDERBAR:yu("SliderBar"),SELECTION:yu("Selection"),SELECTIONBOX:yu("SelectionBox"),SELECTIONMENU:yu("SelectionMenu"),SELECTIONDIVIDER:yu("SelectionDivider"),SELECTIONITEM:yu("SelectionItem")},Tu={COUNTER:Nu("Counter"),KEYDOWNFUNC:Nu("keydownFunc"),CONTEXTMENUFUNC:Nu("contextmenuFunc"),OLDTAB:Nu("Oldtabindex"),TOUCHFUNC:Nu("TouchFunc")};class Cu extends bu{constructor(t,e){super(),this._menu=t,this._type=e,this.className=vu.MENUITEM,this.role="menuitem",this.hidden=!1}get menu(){return this._menu}set menu(t){this._menu=t}get type(){return this._type}hide(){this.hidden=!0,this.menu.generateMenu()}show(){this.hidden=!1,this.menu.generateMenu()}isHidden(){return this.hidden}}function Au(t){const e=t.menu;e.baseMenu?e.baseMenu.unpost():e.unpost()}function Lu(t){const e=t.menu;return(e.baseMenu?e.baseMenu:e).store.active}function Su(t,e){console.error("ContextMenu Error: "+e)}function Ru(){return Mu++}let Mu=0;class Iu extends Cu{constructor(t,e,s,i){super(t,e),this._content=s,this.disabled=!1,this.callbacks=[],this._id=i||s}get content(){return this._content}set content(t){this._content=t,this.generateHtml(),this.menu&&this.menu.generateHtml()}get id(){return this._id}press(){this.disabled||(this.executeAction(),this.executeCallbacks_())}executeAction(){}registerCallback(t){-1===this.callbacks.indexOf(t)&&this.callbacks.push(t)}unregisterCallback(t){const e=this.callbacks.indexOf(t);-1!==e&&this.callbacks.splice(e,1)}mousedown(t){this.press(),this.stop(t)}mouseover(t){this.focus(),this.stop(t)}mouseout(t){this.deactivate(),this.stop(t)}generateHtml(){super.generateHtml();const t=this.html;t.setAttribute("aria-disabled","false"),t.textContent=this.content}activate(){this.disabled||this.html.classList.add(vu.MENUACTIVE)}deactivate(){this.html.classList.remove(vu.MENUACTIVE)}focus(){this.menu.focused=this,super.focus(),this.activate()}unfocus(){this.deactivate(),super.unfocus()}escape(t){Au(this)}up(t){this.menu.up(t)}down(t){this.menu.down(t)}left(t){this.menu.left(t)}right(t){this.menu.right(t)}space(t){this.press()}disable(){this.disabled=!0;const t=this.html;t.classList.add(vu.MENUDISABLED),t.setAttribute("aria-disabled","true")}enable(){this.disabled=!1;const t=this.html;t.classList.remove(vu.MENUDISABLED),t.removeAttribute("aria-disabled")}executeCallbacks_(){for(const t of this.callbacks)try{t(this)}catch(t){Su(0,"Callback for menu entry "+this.id+" failed.")}}}class wu extends Iu{static fromJson(t,{content:e,menu:s,id:i},r){const n=new this(r,e,i),o=t.get("subMenu")(t,s,n);return n.submenu=o,n}constructor(t,e,s){super(t,"submenu",e,s),this._submenu=null}set submenu(t){this._submenu=t}get submenu(){return this._submenu}mouseover(t){this.focus(),this.stop(t)}mouseout(t){this.stop(t)}unfocus(){if(this.submenu.isPosted()){if(this.menu.focused!==this)return super.unfocus(),void this.menu.unpostSubmenus();this.html.setAttribute("tabindex","-1"),this.html.blur()}else super.unfocus()}focus(){super.focus(),this.submenu.isPosted()||this.disabled||this.submenu.post()}executeAction(){this.submenu.isPosted()?this.submenu.unpost():this.submenu.post()}generateHtml(){super.generateHtml();const t=this.html;this.span=document.createElement("span"),this.span.textContent="\u25ba",this.span.classList.add(vu.MENUARROW),this.span.setAttribute("aria-hidden","true"),t.appendChild(this.span),t.setAttribute("aria-haspopup","true")}left(t){this.submenu.isPosted()?this.submenu.unpost():super.left(t)}right(t){this.submenu.isPosted()?this.submenu.down(t):this.submenu.post()}toJson(){return{type:""}}}class ku extends Eu{constructor(){super(...arguments),this.className=vu.CONTEXTMENU,this.role="menu",this._items=[],this._baseMenu=null}set baseMenu(t){this._baseMenu=t}get baseMenu(){return this._baseMenu}get items(){return this._items}set items(t){this._items=t}get pool(){return this.variablePool}get focused(){return this._focused}set focused(t){if(this._focused===t)return;this._focused||this.unfocus();const e=this._focused;this._focused=t,e&&e.unfocus()}up(t){const e=this.items.filter(t=>t instanceof Iu&&!t.isHidden());if(0===e.length)return;if(!this.focused)return void e[e.length-1].focus();let s=e.indexOf(this.focused);-1!==s&&(s=s?--s:e.length-1,e[s].focus())}down(t){const e=this.items.filter(t=>t instanceof Iu&&!t.isHidden());if(0===e.length)return;if(!this.focused)return void e[0].focus();let s=e.indexOf(this.focused);-1!==s&&(s++,s=s===e.length?0:s,e[s].focus())}generateHtml(){super.generateHtml(),this.generateMenu()}generateMenu(){const t=this.html;t.classList.add(vu.MENU);for(const e of this.items){if(!e.isHidden()){t.appendChild(e.html);continue}const s=e.html;s.parentNode&&s.parentNode.removeChild(s)}}post(t,e){this.variablePool.update(),super.post(t,e)}unpostSubmenus(){const t=this.items.filter(t=>t instanceof wu);for(const e of t)e.submenu.unpost(),e!==this.focused&&e.unfocus()}unpost(){super.unpost(),this.unpostSubmenus(),this.focused=null}find(t){for(const e of this.items)if("rule"!==e.type){if(e.id===t)return e;if("submenu"===e.type){const s=e.submenu.find(t);if(s)return s}}return null}}class Ou{constructor(t){this.menu=t,this.store=[],this._active=null,this.counter=0,this.attachedClass=vu.ATTACHED+"_"+Ru(),this.taborder=!0,this.attrMap={}}set active(t){do{if(-1!==this.store.indexOf(t)){this._active=t;break}t=t.parentNode}while(t)}get active(){return this._active}next(){const t=this.store.length;if(0===t)return this.active=null,null;let e=this.store.indexOf(this.active);return e=-1===e?0:et.setAttribute("tabindex","0"))}removeTaborder_(){this.store.forEach(t=>t.setAttribute("tabindex","-1"))}addTabindex(t){t.hasAttribute("tabindex")&&t.setAttribute(Tu.OLDTAB,t.getAttribute("tabindex")),t.setAttribute("tabindex","0")}removeTabindex(t){t.hasAttribute(Tu.OLDTAB)?(t.setAttribute("tabindex",t.getAttribute(Tu.OLDTAB)),t.removeAttribute(Tu.OLDTAB)):t.removeAttribute("tabindex")}addEvents(t){t.hasAttribute(Tu.COUNTER)||(this.addEvent(t,"contextmenu",this.menu.post.bind(this.menu)),this.addEvent(t,"keydown",this.keydown.bind(this)),t.setAttribute(Tu.COUNTER,this.counter.toString()),this.counter++)}addEvent(t,e,s){const i=Tu[e.toUpperCase()+"FUNC"];this.attrMap[i+this.counter]=s,t.addEventListener(e,s)}removeEvents(t){if(!t.hasAttribute(Tu.COUNTER))return;const e=t.getAttribute(Tu.COUNTER);this.removeEvent(t,"contextmenu",e),this.removeEvent(t,"keydown",e),t.removeAttribute(Tu.COUNTER)}removeEvent(t,e,s){const i=Tu[e.toUpperCase()+"FUNC"],r=this.attrMap[i+s];t.removeEventListener(e,r)}keydown(t){t.keyCode===lu.SPACE&&(this.menu.post(t),t.preventDefault(),t.stopImmediatePropagation())}}class Du{constructor(){this.pool={}}insert(t){this.pool[t.name]=t}lookup(t){return this.pool[t]}remove(t){delete this.pool[t]}update(){for(const t in this.pool)this.pool[t].update()}}class Pu extends ku{static fromJson(t,{pool:e,items:s,id:i=""}){const r=new this(t);r.id=i;const n=t.get("variable");e.forEach(e=>n(t,e,r.pool));const o=t.get("items")(t,s,r);return r.items=o,r}constructor(t){super(),this.factory=t,this.id="",this.moving=!1,this._store=new Ou(this),this.widgets=[],this.variablePool=new Du}generateHtml(){this.isPosted()&&this.unpost(),super.generateHtml(),this._frame=document.createElement("div"),this._frame.classList.add(vu.MENUFRAME);const t="left: 0px; top: 0px; z-index: 200; width: 100%; height: 100%; border: 0px; padding: 0px; margin: 0px;";this._frame.setAttribute("style","position: absolute; "+t);const e=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))}display(){document.body.appendChild(this.frame),this.frame.appendChild(this.html),this.focus()}escape(t){this.unpost(),this.unpostWidgets()}unpost(){if(super.unpost(),this.widgets.length>0)return;this.frame.parentNode.removeChild(this.frame);const t=this.store;this.moving||t.insertTaborder(),t.active.focus()}left(t){this.move_(this.store.previous())}right(t){this.move_(this.store.next())}get frame(){return this._frame}get store(){return this._store}post(t,e){if(void 0!==e)return this.moving||this.store.removeTaborder(),void super.post(t,e);const s=t;let i,r,n;if(s instanceof Event?(i=s.target,this.stop(s)):i=s,s instanceof MouseEvent&&(r=s.pageX,n=s.pageY,r||n||!s.clientX||(r=s.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,n=s.clientY+document.body.scrollTop+document.documentElement.scrollTop)),!r&&!n&&i){const t=window.pageXOffset||document.documentElement.scrollLeft,e=window.pageYOffset||document.documentElement.scrollTop,s=i.getBoundingClientRect();r=(s.right+s.left)/2+t,n=(s.bottom+s.top)/2+e}this.store.active=i,this.anchor=this.store.active;const o=this.html;r+o.offsetWidth>document.body.offsetWidth-5&&(r=document.body.offsetWidth-o.offsetWidth-5),this.post(r,n)}registerWidget(t){this.widgets.push(t)}unregisterWidget(t){const e=this.widgets.indexOf(t);e>-1&&this.widgets.splice(e,1),0===this.widgets.length&&this.unpost()}unpostWidgets(){this.widgets.forEach(t=>t.unpost())}toJson(){return{type:""}}move_(t){this.anchor&&t!==this.anchor&&(this.moving=!0,this.unpost(),this.post(t),this.moving=!1)}}class Bu extends ku{static fromJson(t,{items:e},s){const i=new this(s),r=t.get("items")(t,e,i);return i.items=r,i}constructor(t){super(),this._anchor=t,this.variablePool=this.anchor.menu.pool,this.setBaseMenu()}get anchor(){return this._anchor}post(){if(!this.anchor.menu.isPosted())return;let t=this.anchor.html;const e=this.html,s=this.baseMenu.frame,i=t.offsetWidth;let r=i-2,n=0;for(;t&&t!==s;)r+=t.offsetLeft,n+=t.offsetTop,t=t.parentNode;r+e.offsetWidth>document.body.offsetWidth-5&&(r=Math.max(5,r-i-e.offsetWidth+6)),super.post(r,n)}display(){this.baseMenu.frame.appendChild(this.html)}setBaseMenu(){let t=this;do{t=t.anchor.menu}while(t instanceof Bu);this.baseMenu=t}left(t){this.focused=null,this.anchor.focus()}toJson(){return{type:""}}}class Fu extends Iu{generateHtml(){super.generateHtml();const t=this.html;this.span||this.generateSpan(),t.appendChild(this.span),this.update()}register(){this.variable.register(this)}unregister(){this.variable.unregister(this)}update(){this.updateAria(),this.span&&this.updateSpan()}}class ju extends Fu{static fromJson(t,{content:e,variable:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"radio",e,i),this.role="menuitemradio",this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.id),Au(this)}generateSpan(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(vu.MENURADIOCHECK),this.span.setAttribute("aria-hidden","true")}updateAria(){this.html.setAttribute("aria-checked",this.variable.getValue()===this.id?"true":"false")}updateSpan(){this.span.style.display=this.variable.getValue()===this.id?"":"none"}toJson(){return{type:""}}}class _u extends Cu{static fromJson(t,e,s){return new this(s)}constructor(t){super(t,"rule"),this.className=vu.MENUITEM,this.role="separator"}generateHtml(){super.generateHtml();const t=this.html;t.classList.add(vu.MENURULE),t.setAttribute("aria-orientation","vertical")}addEvents(t){}toJson(){return{type:"rule"}}}class Uu extends Iu{static fromJson(t,{content:e,action:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"command",e,i),this.command=s}mousedown(t){this.stop(t)}mouseup(t){this.press(),this.stop(t)}executeAction(){try{this.command(Lu(this))}catch(t){Su(0,"Illegal command callback.")}Au(this)}toJson(){return{type:""}}}class Hu{static fromJson(t,{name:e,getter:s,setter:i},r){const n=new this(e,s,i);r.insert(n)}constructor(t,e,s){this._name=t,this.getter=e,this.setter=s,this.items=[]}get name(){return this._name}getValue(t){try{return this.getter(t)}catch(t){return Su(0,"Command of variable "+this.name+" failed."),null}}setValue(t,e){try{this.setter(t,e)}catch(t){Su(0,"Command of variable "+this.name+" failed.")}this.update()}register(t){-1===this.items.indexOf(t)&&this.items.push(t)}unregister(t){const e=this.items.indexOf(t);-1!==e&&this.items.splice(e,1)}update(){this.items.forEach(t=>t.update())}registerCallback(t){this.items.forEach(e=>e.registerCallback(t))}unregisterCallback(t){this.items.forEach(e=>e.unregisterCallback(t))}toJson(){return{type:"variable",name:this.name,getter:this.getter.toString(),setter:this.setter.toString()}}}class Wu extends Fu{static fromJson(t,{content:e,variable:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"checkbox",e,i),this.role="menuitemcheckbox",this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(!this.variable.getValue()),Au(this)}generateSpan(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(vu.MENUCHECK),this.span.setAttribute("aria-hidden","true")}updateAria(){this.html.setAttribute("aria-checked",this.variable.getValue()?"true":"false")}updateSpan(){this.span.style.display=this.variable.getValue()?"":"none"}toJson(){return{type:""}}}class zu extends Fu{static fromJson(t,{content:e,variable:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"combobox",e,i),this.role="combobox",this.inputEvent=!1,this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.input.value,Lu(this))}space(t){super.space(t),Au(this)}focus(){super.focus(),this.input.focus()}unfocus(){super.unfocus(),this.updateSpan()}generateHtml(){super.generateHtml();this.html.classList.add(vu.MENUCOMBOBOX)}generateSpan(){this.span=document.createElement("span"),this.span.classList.add(vu.MENUINPUTBOX),this.input=document.createElement("input"),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.setAttribute("size","10em"),this.input.setAttribute("type","text"),this.input.setAttribute("tabindex","-1"),this.span.appendChild(this.input)}inputKey(t){this.bubbleKey(),this.inputEvent=!0}keydown(t){if(this.inputEvent&&t.keyCode!==lu.ESCAPE&&t.keyCode!==lu.RETURN)return this.inputEvent=!1,void t.stopPropagation();super.keydown(t),t.stopPropagation()}updateAria(){}updateSpan(){let t;try{t=this.variable.getValue(Lu(this))}catch(e){t=""}this.input.value=t}toJson(){return{type:""}}}class qu extends Iu{static fromJson(t,{content:e,id:s},i){return new this(i,e,s)}constructor(t,e,s){super(t,"label",e,s)}generateHtml(){super.generateHtml();this.html.classList.add(vu.MENULABEL)}toJson(){return{type:""}}}class Vu extends Fu{static fromJson(t,{content:e,variable:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"slider",e,i),this.role="slider",this.labelId="ctx_slideLabel"+Ru(),this.valueId="ctx_slideValue"+Ru(),this.inputEvent=!1,this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.input.value,Lu(this)),this.update()}space(t){super.space(t),Au(this)}focus(){super.focus(),this.input.focus()}unfocus(){super.unfocus(),this.updateSpan()}generateHtml(){super.generateHtml();this.html.classList.add(vu.MENUSLIDER),this.valueSpan=document.createElement("span"),this.valueSpan.setAttribute("id",this.valueId),this.valueSpan.classList.add(vu.SLIDERVALUE),this.html.appendChild(this.valueSpan)}generateSpan(){this.span=document.createElement("span"),this.labelSpan=document.createElement("span"),this.labelSpan.setAttribute("id",this.labelId),this.labelSpan.appendChild(this.html.childNodes[0]),this.html.appendChild(this.labelSpan),this.input=document.createElement("input"),this.input.setAttribute("type","range"),this.input.setAttribute("min","0"),this.input.setAttribute("max","100"),this.input.setAttribute("aria-valuemin","0"),this.input.setAttribute("aria-valuemax","100"),this.input.setAttribute("aria-labelledby",this.labelId),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.addEventListener("input",this.executeAction.bind(this)),this.input.classList.add(vu.SLIDERBAR),this.span.appendChild(this.input)}inputKey(t){this.inputEvent=!0}mousedown(t){t.stopPropagation()}mouseup(t){Au(this),t.stopPropagation()}keydown(t){const e=t.keyCode;return e===lu.UP||e===lu.DOWN?(t.preventDefault(),void super.keydown(t)):this.inputEvent&&e!==lu.ESCAPE&&e!==lu.RETURN?(this.inputEvent=!1,void t.stopPropagation()):(super.keydown(t),void t.stopPropagation())}updateAria(){const t=this.variable.getValue();t&&this.input&&(this.input.setAttribute("aria-valuenow",t),this.input.setAttribute("aria-valuetext",t+"%"))}updateSpan(){let t;try{t=this.variable.getValue(Lu(this)),this.valueSpan.innerHTML=t+"%"}catch(e){t=""}this.input.value=t}toJson(){return{type:""}}}class Xu extends Eu{constructor(t){super(),this.element=t,this.className=vu.MENUCLOSE,this.role="button"}generateHtml(){const t=document.createElement("span");t.classList.add(this.className),t.setAttribute("role",this.role),t.setAttribute("tabindex","0");const e=document.createElement("span");e.textContent="\xd7",t.appendChild(e),this.html=t}display(){}unpost(){super.unpost(),this.element.unpost()}keydown(t){this.bubbleKey(),super.keydown(t)}space(t){this.unpost(),this.stop(t)}mousedown(t){this.unpost(),this.stop(t)}}class Gu extends Eu{constructor(t,e,s){super(),this.title=t,this.signature=s,this.className=vu.INFO,this.role="dialog",this.contentDiv=this.generateContent(),this.close=this.generateClose(),this.content=e||function(){return""}}attachMenu(t){this.menu=t}generateHtml(){super.generateHtml();const t=this.html;t.appendChild(this.generateTitle()),t.appendChild(this.contentDiv),t.appendChild(this.generateSignature()),t.appendChild(this.close.html),t.setAttribute("tabindex","0")}post(){super.post();const t=document.documentElement,e=this.html,s=window.innerHeight||t.clientHeight||t.scrollHeight||0,i=Math.floor(-e.offsetWidth/2),r=Math.floor((s-e.offsetHeight)/3);e.setAttribute("style","margin-left: "+i+"px; top: "+r+"px;"),window.event instanceof MouseEvent&&e.classList.add(vu.MOUSEPOST),e.focus()}display(){this.menu.registerWidget(this),this.contentDiv.innerHTML=this.content();const t=this.menu.html;t.parentNode&&t.parentNode.removeChild(t),this.menu.frame.appendChild(this.html)}click(t){}keydown(t){this.bubbleKey(),super.keydown(t)}escape(t){this.unpost()}unpost(){super.unpost(),this.html.classList.remove(vu.MOUSEPOST),this.menu.unregisterWidget(this)}generateClose(){const t=new Xu(this),e=t.html;return e.classList.add(vu.INFOCLOSE),e.setAttribute("aria-label","Close Dialog Box"),t}generateTitle(){const t=document.createElement("span");return t.innerHTML=this.title,t.classList.add(vu.INFOTITLE),t}generateContent(){const t=document.createElement("div");return t.classList.add(vu.INFOCONTENT),t.setAttribute("tabindex","0"),t}generateSignature(){const t=document.createElement("span");return t.innerHTML=this.signature,t.classList.add(vu.INFOSIGNATURE),t}toJson(){return{type:""}}}class Ju extends ku{static fromJson(t,{title:e,values:s,variable:i},r){const n=new this(r),o=t.get("label")(t,{content:e||"",id:e||"id"},n),a=t.get("rule")(t,{},n),l=s.map(e=>t.get("radio")(t,{content:e,variable:i,id:e},n)),c=[o,a].concat(l);return n.items=c,n}constructor(t){super(),this.anchor=t,this.className=vu.SELECTIONMENU,this.variablePool=this.anchor.menu.pool,this.baseMenu=this.anchor.menu}generateHtml(){super.generateHtml(),this.items.forEach(t=>t.html.classList.add(vu.SELECTIONITEM))}display(){}right(t){this.anchor.right(t)}left(t){this.anchor.left(t)}}class Ku extends Gu{static fromJson(t,{title:e,signature:s,selections:i,order:r,grid:n},o){const a=new this(e,s,r,n);a.attachMenu(o);const l=i.map(e=>t.get("selectionMenu")(t,e,a));return a.selections=l,a}constructor(t,e,s="none",i="vertical"){super(t,null,e),this.style=s,this.grid=i,this._selections=[],this.prefix="ctxt-selection",this._balanced=!0}attachMenu(t){this.menu=t}get selections(){return this._selections}set selections(t){this._selections=[],t.forEach(t=>this.addSelection(t))}addSelection(t){t.anchor=this,this._selections.push(t)}rowDiv(t){const e=document.createElement("div");this.contentDiv.appendChild(e);const s=t.map(t=>(e.appendChild(t.html),t.html.id||(t.html.id=this.prefix+Ru()),t.html.getBoundingClientRect())),i=s.map(t=>t.width),r=i.reduce((t,e)=>t+e,0),n=s.reduce((t,e)=>Math.max(t,e.height),0);return e.classList.add(vu.SELECTIONDIVIDER),e.setAttribute("style","height: "+n+"px;"),[e,r,n,i]}display(){if(super.display(),this.order(),!this.selections.length)return;const t=[];let e=0,s=[];const i=this.getChunkSize(this.selections.length);for(let r=0;rt.html.style.height=l+"px"),s=this.combineColumn(s,c)}this._balanced&&(this.balanceColumn(t,s),e=s.reduce((t,e)=>t+e,20)),t.forEach(t=>t.style.width=e+"px")}getChunkSize(t){switch(this.grid){case"square":return Math.floor(Math.sqrt(t));case"horizontal":return Math.floor(t/Ku.chunkSize);default:return Ku.chunkSize}}balanceColumn(t,e){t.forEach(t=>{const s=Array.from(t.children);for(let t,i=0;t=s[i];i++)t.style.width=e[i]+"px"})}combineColumn(t,e){let s=[],i=0;for(;t[i]||e[i];){if(!t[i]){s=s.concat(e.slice(i));break}if(!e[i]){s=s.concat(t.slice(i));break}s.push(Math.max(t[i],e[i])),i++}return s}left(t){this.move(t,t=>(0===t?this.selections.length:t)-1)}right(t){this.move(t,t=>t===this.selections.length-1?0:t+1)}generateHtml(){super.generateHtml(),this.html.classList.add(vu.SELECTION)}generateContent(){const t=super.generateContent();return t.classList.add(vu.SELECTIONBOX),t.removeAttribute("tabindex"),t}findSelection(t){const e=t.target;let s=null;if(e.id&&(s=this.selections.find(t=>t.html.id===e.id)),!s){const t=e.parentElement.id;s=this.selections.find(e=>e.html.id===t)}return s}move(t,e){const s=this.findSelection(t);s.focused&&s.focused.unfocus();const i=e(this.selections.indexOf(s));this.selections[i].focus()}order(){this.selections.sort(Ku.orderMethod.get(this.style))}toJson(){return{type:""}}}Ku.chunkSize=4,Ku.orderMethod=new Map([["alphabetical",(t,e)=>t.items[0].content.localeCompare(e.items[0].content)],["none",(t,e)=>1],["decreasing",(t,e)=>{const s=t.items.length,i=e.items.length;return s{const s=t.items.length,i=e.items.length;return sthis.factory.add(t,e))}get factory(){return this._factory}items(t,e,s){const i=[];for(const t of e){const e=this.parse(t,s);e&&(s.items.push(e),t.disabled&&e.disable(),t.hidden&&i.push(e))}return i.forEach(t=>t.hide()),s.items}parse(t,...e){var{type:s}=t,i=Yu(t,["type"]);const r=this.factory.get(s);return r?r(this.factory,i,...e):null}}function Zu(t){return"."+(vu[t]||t)}function tp(t,e=";"){return"{\n "+t.join(e+"\n ")+";\n}"}const ep={};ep[Zu("MENU")]=tp(["position: absolute","background-color: white","color: black","width: auto","padding: 5px 0px","border: 1px solid #CCCCCC","margin: 0","cursor: default","font: menu","text-align: left","text-indent: 0","text-transform: none","line-height: normal","letter-spacing: normal","word-spacing: normal","word-wrap: normal","white-space: nowrap","float: none","z-index: 1001","border-radius: 5px","box-shadow: 0px 10px 20px #808080"]),ep[Zu("MENUITEM")]=tp(["padding: 1px 2em","background: transparent"]),ep[Zu("MENUARROW")]=tp(["position: absolute","right: 0.5em","padding-top: 0.25em","color: #666666","font-family: null","font-size: 0.75em"]),ep[Zu("MENUACTIVE")+" "+Zu("MENUARROW")]=tp(["color: white"]),ep[Zu("MENUARROW")+Zu("RTL")]=tp(["left: 0.5em","right: auto"]),ep[Zu("MENUCHECK")]=tp(["position: absolute","left: 0.7em","font-family: null"]),ep[Zu("MENUCHECK")+Zu("RTL")]=tp(["right: 0.7em","left: auto"]),ep[Zu("MENURADIOCHECK")]=tp(["position: absolute","left: 0.7em"]),ep[Zu("MENURADIOCHECK")+Zu("RTL")]=tp(["right: 0.7em","left: auto"]),ep[Zu("MENUINPUTBOX")]=tp(["padding-left: 1em","right: 0.5em","color: #666666","font-family: null"]),ep[Zu("MENUINPUTBOX")+Zu("RTL")]=tp(["left: 0.1em"]),ep[Zu("MENUCOMBOBOX")]=tp(["left: 0.1em","padding-bottom: 0.5em"]),ep[Zu("MENUSLIDER")]=tp(["left: 0.1em"]),ep[Zu("SLIDERVALUE")]=tp(["position: absolute","right: 0.1em","padding-top: 0.25em","color: #333333","font-size: 0.75em"]),ep[Zu("MENUACTIVE")+" "+Zu("SLIDERVALUE")]=tp(["color: #DDDDDD"]),ep[Zu("SLIDERBAR")]=tp(["outline: none","background: #D3D3D3"]),ep[Zu("MENULABEL")]=tp(["padding: 1px 2em 3px 1.33em","font-style: italic"]),ep[Zu("MENURULE")]=tp(["border-top: 1px solid #DDDDDD","margin: 4px 3px"]),ep[Zu("MENUDISABLED")]=tp(["color: #999"]),ep[Zu("MENUACTIVE")]=tp(["background-color: #606872","color: white"]),ep[Zu("MENUDISABLED")+":focus"]=tp(["background-color: #E8E8E8"]),ep[Zu("MENULABEL")+":focus"]=tp(["background-color: #E8E8E8"]),ep[Zu("CONTEXTMENU")+":focus"]=tp(["outline: none"]),ep[Zu("CONTEXTMENU")+" "+Zu("MENUITEM")+":focus"]=tp(["outline: none"]),ep[Zu("SELECTIONMENU")]=tp(["position: relative","float: left","border-bottom: none","box-shadow: none ! important","border-radius: 0px !important"]),ep[Zu("SELECTIONITEM")]=tp(["padding-right: 1em"]),ep[Zu("SELECTION")]=tp(["right: 40%","width: 50%"]),ep[Zu("SELECTIONBOX")]=tp(["padding: 0em","max-height: 20em","max-width: none","background-color: #FFFFFF"]),ep[Zu("SELECTIONDIVIDER")]=tp(["clear: both","border-top: 2px solid #000000"]),ep[Zu("MENU")+" "+Zu("MENUCLOSE")]=tp(["top: -10px","left: -10px"]),ep["@media (prefers-color-scheme: dark) /* menu */"]=tp([Zu("MENU")+" "+tp(["color: #E0E0E0","background-color: #242436","box-shadow: 0px 10px 20px #000","border: 1px solid #808080"]),Zu("SLIDERVALUE")+" "+tp(["color: #D0D0D0"]),Zu("MENUDISABLED")+":focus "+tp(["background-color: #383838"]),Zu("MENULABEL")+":focus "+tp(["background-color: #585858"]),Zu("MENURULE")+" "+tp(["border-top: 1px solid #808080"]),Zu("SELECTIONDIVIDER")+" "+tp(["border-top: 2px solid #808080"])],"");const sp={};sp[Zu("MENUCLOSE")]=tp(["position: absolute","cursor: pointer","display: inline-block","border: 2px solid #AAA","border-radius: 18px",'font-family: "Courier New", Courier',"font-size: 24px","color: #F0F0F0"]),sp[Zu("MENUCLOSE")+" span"]=tp(["display: block","background-color: #AAA","border: 1.5px solid","border-radius: 18px","line-height: 0","padding: 8px 0 6px"]),sp[Zu("MENUCLOSE")+":hover"]=tp(["color: white !important","border: 2px solid #CCC !important"]),sp[Zu("MENUCLOSE")+":hover span"]=tp(["background-color: #CCC !important"]),sp[Zu("MENUCLOSE")+":hover:focus"]=tp(["outline: none"]);function ip(t,e=document,s="MJX-Menu-styles"){if(e.head.querySelector("#"+s))return;const i=e.createElement("style");i.id=s;const r=[];for(const e in t)r.push(`${e} ${t[e]}`);i.textContent=r.join("\n"),e.head.appendChild(i)}class rp extends Pu{constructor(){super(...arguments),this.mathItem=null,this.nofocus=!1,this.errorMsg=""}post(t,e){var s,i;if(this.mathItem){const r=null===(i=null===(s=this.mathItem)||void 0===s?void 0:s.explorers)||void 0===i?void 0:i.speech;(null==r?void 0:r.active)&&(r.restarted=r.semanticFocus()),void 0!==e&&(this.getOriginalMenu(),this.getSemanticsMenu(),this.getSpeechMenu(),this.getBrailleMenu(),this.getSvgMenu(),this.getErrorMessage(),this.dynamicSubmenus()),super.post(t,e)}}unpost(){this.posted&&super.unpost(),this.mathItem&&(this.mathItem.outputData.nofocus=this.nofocus),this.mathItem=null,this.nofocus=!1}findID(...t){let e=this,s=null;for(const i of t){if(!e)return null;for(s of e.items){if(s.id===i){e=s instanceof wu?s.submenu:null;break}e=s=null}}return s}setJax(t){this.jax=t}getOriginalMenu(){const t=this.mathItem.inputJax.name,e=this.findID("Show","Original");e.content="MathML"===t?"Original MathML":t+" Commands";this.findID("Copy","Original").content=e.content}getSemanticsMenu(){const t=this.findID("Settings","MathmlIncludes","semantics");"MathML"===this.mathItem.inputJax.name?t.disable():t.enable()}getSpeechMenu(){const t=this.mathItem.outputData.speech;this.findID("Show","Speech")[t?"enable":"disable"](),this.findID("Copy","Speech")[t?"enable":"disable"]()}getBrailleMenu(){const t=this.mathItem.outputData.braille;this.findID("Show","Braille")[t?"enable":"disable"](),this.findID("Copy","Braille")[t?"enable":"disable"]()}getSvgMenu(){const t=this.jax.SVG;this.findID("Show","SVG")[t?"enable":"disable"](),this.findID("Copy","SVG")[t?"enable":"disable"]()}getErrorMessage(){const t=this.mathItem.root.childNodes[0].childNodes;let e=!0;if(this.errorMsg="",1===t.length&&t[0].isKind("merror")){const s=t[0].attributes;this.errorMsg=s.get("data-mjx-error")||s.get("data-mjx-message")||"",e=!this.errorMsg}this.findID("Show","Error")[e?"disable":"enable"](),this.findID("Copy","Error")[e?"disable":"enable"]()}dynamicSubmenus(){for(const[t,[e,s]]of rp.DynamicSubmenus){const i=this.find(t);i&&e(this,i,t=>{var e;i.submenu=t,!(null===(e=null==t?void 0:t.items)||void 0===e?void 0:e.length)||s&&!this.settings[s]?i.disable():i.enable()})}}}rp.DynamicSubmenus=new Map;class np extends Ku{constructor(t,e,s,i,r,n){super(t,e,i,r),this.attachMenu(n);const o=n.factory;this.selections=s.map(t=>o.get("selectionMenu")(o,t,this))}post(){const t=Array.from(Object.values(this.menu.jax)).filter(t=>!!t)[0],e=new uo({title:this.title,message:"",adaptor:t.adaptor,styles:{"mjx-dialog > div":{padding:0}}});e.attach(),this.contentDiv=e.content,this.display()}display(){const t=this;if(t.order(),!this.selections.length)return;const e=[];let s=0,i=[];const r=t.getChunkSize(this.selections.length);for(let n=0;nt.html.style.height=c+"px"),i=t.combineColumn(i,h)}t._balanced&&(t.balanceColumn(e,i),s=i.reduce((t,e)=>t+e-2,20)),e.forEach(t=>t.style.width=s+"px")}}var op,ap,lp;!function(t){t.DOMAIN="domain",t.STYLE="style",t.LOCALE="locale",t.TOPIC="topic",t.MODALITY="modality"}(op||(op={}));class cp{static createProp(...t){const e=hp.DEFAULT_ORDER,s={};for(let i=0,r=t.length,n=e.length;it.push(this.getProperty(e).slice())),t}toString(){const t=[];return this.order.forEach(e=>t.push(e+": "+this.getProperty(e).toString())),t.join("\n")}}class hp extends cp{static createCstr(...t){const e=hp.DEFAULT_ORDER,s={};for(let i=0,r=t.length,n=e.length;i{const s=e.indexOf(t);return-1!==s&&e.splice(s,1)})}constructor(t,e){const s={};for(const[e,i]of Object.entries(t))s[e]=[i];super(s,e),this.components=t}getComponents(){return this.components}getValue(t){return this.components[t]}getValues(){return this.order.map(t=>this.getValue(t))}allProperties(){const t=super.allProperties();for(let e,s,i=0;e=t[i],s=this.order[i];i++){const t=this.getValue(s);-1===e.indexOf(t)&&e.unshift(t)}return t}toString(){return this.getValues().join(".")}equal(t){const e=t.getAxes();if(this.order.length!==e.length)return!1;for(let s,i=0;s=e[i];i++){const e=this.getValue(s);if(!e||t.getValue(s)!==e)return!1}return!0}}hp.DEFAULT_ORDER=[op.LOCALE,op.MODALITY,op.DOMAIN,op.STYLE,op.TOPIC],hp.BASE_LOCALE="base",hp.DEFAULT_VALUE="default",hp.DEFAULT_VALUES={[op.LOCALE]:"en",[op.DOMAIN]:hp.DEFAULT_VALUE,[op.STYLE]:hp.DEFAULT_VALUE,[op.TOPIC]:hp.DEFAULT_VALUE,[op.MODALITY]:"speech"};class dp{constructor(t){this.order=t}parse(t){const e=t.split("."),s={};if(e.length>this.order.length)throw new Error("Invalid dynamic constraint: "+s);let i=0;for(let t,r=0;t=this.order[r],e.length;r++,i++){const i=e.shift();s[t]=i}return new hp(s,this.order.slice(0,i))}}class up{constructor(t,e=new cp(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 cp(t.getProperties(),t.getOrder()),this.order=this.reference.getOrder()}match(t){const e=t.getAxes();return e.length===this.reference.getAxes().length&&e.every(e=>{const s=t.getValue(e);return s===this.reference.getValue(e)||-1!==this.fallback.getProperty(e).indexOf(s)})}compare(t,e){let s=!1;for(let i,r=0;i=this.order[r];r++){const r=t.getValue(i),n=e.getValue(i);if(!s){const t=this.reference.getValue(i);if(t===r&&t!==n)return-1;if(t===n&&t!==r)return 1;if(t===r&&t===n)continue;t!==r&&t!==n&&(s=!0)}const o=this.fallback.getProperty(i),a=o.indexOf(r),l=o.indexOf(n);if(a{var t;return"undefined"!=typeof require||"undefined"!=typeof process&&null!=(null===(t=process.versions)||void 0===t?void 0:t.node)&&"undefined"!=typeof require?require:t=>null},Mp={extRequire:t=>"undefined"!=typeof process&&"undefined"!=typeof require?Rp()(t):null,windowSupported:Ap,documentSupported:Lp,webworker:Sp,xmldom:yp,document:Np,fs:Lp||Sp?null:Rp()("fs"),url:fp.url,jsonPath:function(){if(Lp||Sp)return fp.url;if(process.env.SRE_JSON_PATH||r.g.SRE_JSON_PATH)return process.env.SRE_JSON_PATH||r.g.SRE_JSON_PATH;try{return Rp().resolve("speech-rule-engine").replace(/sre\.js$/,"")+"mathmaps"}catch(t){}try{return Rp().resolve(".").replace(/sre\.js$/,"")+"mathmaps"}catch(t){}return"undefined"!=typeof __dirname?__dirname+(__dirname.match(/lib?$/)?"/mathmaps":"/lib/mathmaps"):process.cwd()+"/lib/mathmaps"}(),xpath:Cp};function Ip(t){return t.match("/$")?t:t+"/"}class wp{static getInstance(){return wp.instance=wp.instance||new wp,wp.instance}init(t){return t&&this.startDebugFile_(t),this.isActive_=!0,this.fileHandle}output(...t){this.isActive_&&this.output_(t)}generate(t){this.isActive_&&this.output_(t.apply(t,[]))}exit(t=()=>{}){this.stream_&&this.fileHandle.then(()=>{this.isActive_&&this.stream_&&(this.stream_.end("","",t),this.stream_=null)}),this.isActive_=!1}constructor(){this.isActive_=!1,this.fileHandle=Promise.resolve(),this.stream_=null}startDebugFile_(t){this.fileHandle=Mp.fs.promises.open(t,"w"),this.fileHandle=this.fileHandle.then(e=>{this.stream_=e.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.stream_?this.fileHandle.then(()=>this.outputFunction.apply(this.outputFunction,["Speech Rule Engine Debugger:"].concat(t))):console.info(...["Speech Rule Engine Debugger:"].concat(t))}}class kp{constructor(t={}){this.delay=!1,this.domain="clearspeak",this.style=hp.DEFAULT_VALUES[op.STYLE],this.locale=hp.DEFAULT_VALUES[op.LOCALE],this.subiso="",this.modality=hp.DEFAULT_VALUES[op.MODALITY],this.speech=pp.NONE,this.markup=mp.NONE,this.mark=!0,this.automark=!1,this.character=!0,this.cleanpause=!0,this.cayleyshort=!0,this.linebreaks=!1,this.rate="100",this.walker="Table",this.structure=!1,this.aria=!1,this.tree=!1,this.strict=!1,this.pprint=!1,this.rules="",this.prune="",this.set(t)}set(t){this.ensureDomain(t);for(const[e,s]of Object.entries(t))(kp.BINARY_FEATURES.includes(e)||kp.STRING_FEATURES.includes(e))&&(this[e]=s)}json(){const t={};return[].concat(kp.STRING_FEATURES,kp.BINARY_FEATURES).forEach(e=>t[e]=this[e]),t}ensureDomain(t){if(t.modality&&"speech"!==t.modality||!t.modality&&"speech"!==this.modality)return;if(!t.domain&&!t.locale)return;if("default"===t.domain)return void(t.domain="mathspeak");const e=t.locale||this.locale,s=t.domain||this.domain;-1===Op.indexOf(e)||"mathspeak"===s?"en"!==e?"mathspeak"!==s&&"clearspeak"!==s&&(t.domain="mathspeak"):-1===Dp.indexOf(s)&&(t.domain="mathspeak"):t.domain="mathspeak"}}kp.BINARY_FEATURES=["automark","mark","character","cleanpause","strict","structure","aria","pprint","cayleyshort","linebreaks","tree"],kp.STRING_FEATURES=["markup","style","domain","speech","walker","locale","delay","modality","rate","rules","subiso","prune"];const Op=["ca","da","es"],Dp=["chromevox","clearspeak","mathspeak","emacspeak","html"];class Pp extends Error{constructor(t=""){super(),this.message=t,this.name="SRE Error"}}class Bp{set defaultLocale(t){this._defaultLocale=fp.ensureLocale(t,this._defaultLocale)}get defaultLocale(){return this._defaultLocale}static getInstance(){return Bp.instance=Bp.instance||new Bp,Bp.instance}static defaultEvaluator(t,e){return t}static evaluateNode(t){return Bp.nodeEvaluator(t)}getRate(){const t=parseInt(this.options.rate,10);return isNaN(t)?100:t}setDynamicCstr(t){if(this.defaultLocale&&(hp.DEFAULT_VALUES[op.LOCALE]=this.defaultLocale),t){const e=Object.keys(t);for(let s=0;s[ \f\n\r\t\v\u200b]+<").trim()}(t),i=!!s.match(/&(?!lt|gt|amp|quot|apos)\w+;/g);if(!s)throw new Pp("Empty input!");try{const t=e.parseFromString(s,i?"text/html":"text/xml");return Bp.getInstance().mode===ap.HTTP?(jp.currentDocument=t,i?t.body.childNodes[0]:t.documentElement):t.documentElement}catch(t){throw new Pp("Illegal input: "+t.message)}}function Xp(t,e){t.parentNode&&(t.parentNode.insertBefore(e,t),t.parentNode.removeChild(t))}function Gp(t){return Mp.document.createElement(t)}function Jp(t){let e="",s=/(>)(<)(\/*)/g,i=0,r=(t=t.replace(s,"$1\r\n$2$3")).split("\r\n");for(s=/(\.)*(<)(\/*)/g,r=r.map(t=>t.replace(s,"$1\r\n$2$3").split("\r\n")).reduce((t,e)=>t.concat(e),[]);r.length;){let t=r.shift();if(!t)continue;let s=0;if(t.match(/^<\w[^>/]*>[^>]+$/)){const e=Kp(t,r[0]);e[0]?e[1]?(t+=r.shift().slice(0,-e[1].length),e[1].trim()&&r.unshift(e[1])):t+=r.shift():s=1}else if(t.match(/^<\/\w/))0!==i&&(i-=1);else if(t.match(/^<\w[^>]*[^/]>.*$/))s=1;else if(t.match(/^<\w[^>]*\/>.+$/)){const e=t.indexOf(">")+1,s=t.slice(e);s.trim()&&r.unshift(),t=t.slice(0,e)+s}else s=0;e+=new Array(i+1).join(" ")+t+"\r\n",i+=s}return e}function Kp(t,e){if(!e)return[!1,""];const s=t.match(/^<([^> ]+).*>/),i=e.match(/^<\/([^>]+)>(.*)/);return s&&i&&s[1]===i[1]?[!0,i[2]]:[!1,""]}function $p(t){return t.tagName.toUpperCase()}function Yp(t){return(new Mp.xmldom.XMLSerializer).serializeToString(t)}!function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",t[t.NOTATION_NODE=12]="NOTATION_NODE"}(zp||(zp={}));class Qp{constructor(t,e,s){this.domain=t,this.name=e,this.func=s,this.active=!1}annotate(t){t.childNodes.forEach(this.annotate.bind(this)),t.contentNodes.forEach(this.annotate.bind(this)),t.addAnnotation(this.domain,this.func(t))}}class Zp{constructor(t,e,s,i={}){this.domain=t,this.name=e,this.func=s,this.def=i,this.active=!1}visit(t,e){let s=this.func(t,e);t.addAnnotation(this.domain,s[0]);for(let e,i=0;e=t.childNodes[i];i++)s=this.visit(e,s[1]);for(let e,i=0;e=t.contentNodes[i];i++)s=this.visit(e,s[1]);return s}}const tm=new Map,em=new Map;function sm(t){const e=t.domain+":"+t.name;t instanceof Qp?tm.set(e,t):em.set(e,t)}function im(t,e){const s=t+":"+e,i=tm.get(s)||em.get(s);i&&(i.active=!0)}var rm,nm,om;function am(t){const e=t.toString(16).toUpperCase();return e.length>3?e:("000"+e).slice(-4)}function lm([t,e],s){const i=parseInt(t,16),r=parseInt(e,16),n=[];for(let t=i;t<=r;t++){let e=am(t);!1!==s[e]&&(e=s[e]||e,n.push(e))}return n}function cm(t,e={}){return lm(t,e).map(t=>String.fromCodePoint(parseInt(t,16)))}!function(t){t.BOLD="bold",t.BOLDFRAKTUR="bold-fraktur",t.BOLDITALIC="bold-italic",t.BOLDSCRIPT="bold-script",t.DOUBLESTRUCK="double-struck",t.DOUBLESTRUCKITALIC="double-struck-italic",t.FULLWIDTH="fullwidth",t.FRAKTUR="fraktur",t.ITALIC="italic",t.MONOSPACE="monospace",t.NORMAL="normal",t.SCRIPT="script",t.SANSSERIF="sans-serif",t.SANSSERIFITALIC="sans-serif-italic",t.SANSSERIFBOLD="sans-serif-bold",t.SANSSERIFBOLDITALIC="sans-serif-bold-italic"}(rm||(rm={})),function(t){t.SUPER="super",t.SUB="sub",t.CIRCLED="circled",t.PARENTHESIZED="parenthesized",t.PERIOD="period",t.NEGATIVECIRCLED="negative-circled",t.DOUBLECIRCLED="double-circled",t.CIRCLEDSANSSERIF="circled-sans-serif",t.NEGATIVECIRCLEDSANSSERIF="negative-circled-sans-serif",t.COMMA="comma",t.SQUARED="squared",t.NEGATIVESQUARED="negative-squared"}(nm||(nm={})),function(t){t.LATINCAP="latinCap",t.LATINSMALL="latinSmall",t.GREEKCAP="greekCap",t.GREEKSMALL="greekSmall",t.DIGIT="digit"}(om||(om={}));const hm=[{interval:["1D400","1D419"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLD},{interval:["1D41A","1D433"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLD},{interval:["1D56C","1D585"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLDFRAKTUR},{interval:["1D586","1D59F"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLDFRAKTUR},{interval:["1D468","1D481"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLDITALIC},{interval:["1D482","1D49B"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLDITALIC},{interval:["1D4D0","1D4E9"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLDSCRIPT},{interval:["1D4EA","1D503"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLDSCRIPT},{interval:["1D538","1D551"],base:om.LATINCAP,subst:{"1D53A":"2102","1D53F":"210D","1D545":"2115","1D547":"2119","1D548":"211A","1D549":"211D","1D551":"2124"},capital:!0,category:"Lu",font:rm.DOUBLESTRUCK},{interval:["1D552","1D56B"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.DOUBLESTRUCK},{interval:["1D504","1D51D"],base:om.LATINCAP,subst:{"1D506":"212D","1D50B":"210C","1D50C":"2111","1D515":"211C","1D51D":"2128"},capital:!0,category:"Lu",font:rm.FRAKTUR},{interval:["1D51E","1D537"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.FRAKTUR},{interval:["FF21","FF3A"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.FULLWIDTH},{interval:["FF41","FF5A"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.FULLWIDTH},{interval:["1D434","1D44D"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.ITALIC},{interval:["1D44E","1D467"],base:om.LATINSMALL,subst:{"1D455":"210E"},capital:!1,category:"Ll",font:rm.ITALIC},{interval:["1D670","1D689"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.MONOSPACE},{interval:["1D68A","1D6A3"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.MONOSPACE},{interval:["0041","005A"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.NORMAL},{interval:["0061","007A"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.NORMAL},{interval:["1D49C","1D4B5"],base:om.LATINCAP,subst:{"1D49D":"212C","1D4A0":"2130","1D4A1":"2131","1D4A3":"210B","1D4A4":"2110","1D4A7":"2112","1D4A8":"2133","1D4AD":"211B"},capital:!0,category:"Lu",font:rm.SCRIPT},{interval:["1D4B6","1D4CF"],base:om.LATINSMALL,subst:{"1D4BA":"212F","1D4BC":"210A","1D4C4":"2134"},capital:!1,category:"Ll",font:rm.SCRIPT},{interval:["1D5A0","1D5B9"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIF},{interval:["1D5BA","1D5D3"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIF},{interval:["1D608","1D621"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFITALIC},{interval:["1D622","1D63B"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFITALIC},{interval:["1D5D4","1D5ED"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFBOLD},{interval:["1D5EE","1D607"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFBOLD},{interval:["1D63C","1D655"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFBOLDITALIC},{interval:["1D656","1D66F"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFBOLDITALIC},{interval:["0391","03A9"],base:om.GREEKCAP,subst:{"03A2":"03F4"},capital:!0,category:"Lu",font:rm.NORMAL},{interval:["03B0","03D0"],base:om.GREEKSMALL,subst:{"03B0":"2207","03CA":"2202","03CB":"03F5","03CC":"03D1","03CD":"03F0","03CE":"03D5","03CF":"03F1","03D0":"03D6"},capital:!1,category:"Ll",font:rm.NORMAL},{interval:["1D6A8","1D6C0"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLD},{interval:["1D6C1","1D6E1"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLD},{interval:["1D6E2","1D6FA"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.ITALIC},{interval:["1D6FB","1D71B"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.ITALIC},{interval:["1D71C","1D734"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLDITALIC},{interval:["1D735","1D755"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLDITALIC},{interval:["1D756","1D76E"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFBOLD},{interval:["1D76F","1D78F"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFBOLD},{interval:["1D790","1D7A8"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFBOLDITALIC},{interval:["1D7A9","1D7C9"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFBOLDITALIC},{interval:["0030","0039"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.NORMAL},{interval:["2070","2079"],base:om.DIGIT,subst:{2071:"00B9",2072:"00B2",2073:"00B3"},offset:0,category:"No",font:nm.SUPER},{interval:["2080","2089"],base:om.DIGIT,subst:{},offset:0,category:"No",font:nm.SUB},{interval:["245F","2473"],base:om.DIGIT,subst:{"245F":"24EA"},offset:0,category:"No",font:nm.CIRCLED},{interval:["3251","325F"],base:om.DIGIT,subst:{},offset:21,category:"No",font:nm.CIRCLED},{interval:["32B1","32BF"],base:om.DIGIT,subst:{},offset:36,category:"No",font:nm.CIRCLED},{interval:["2474","2487"],base:om.DIGIT,subst:{},offset:1,category:"No",font:nm.PARENTHESIZED},{interval:["2487","249B"],base:om.DIGIT,subst:{2487:"1F100"},offset:0,category:"No",font:nm.PERIOD},{interval:["2775","277F"],base:om.DIGIT,subst:{2775:"24FF"},offset:0,category:"No",font:nm.NEGATIVECIRCLED},{interval:["24EB","24F4"],base:om.DIGIT,subst:{},offset:11,category:"No",font:nm.NEGATIVECIRCLED},{interval:["24F5","24FE"],base:om.DIGIT,subst:{},offset:1,category:"No",font:nm.DOUBLECIRCLED},{interval:["277F","2789"],base:om.DIGIT,subst:{"277F":"1F10B"},offset:0,category:"No",font:nm.CIRCLEDSANSSERIF},{interval:["2789","2793"],base:om.DIGIT,subst:{2789:"1F10C"},offset:0,category:"No",font:nm.NEGATIVECIRCLEDSANSSERIF},{interval:["FF10","FF19"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.FULLWIDTH},{interval:["1D7CE","1D7D7"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.BOLD},{interval:["1D7D8","1D7E1"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.DOUBLESTRUCK},{interval:["1D7E2","1D7EB"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.SANSSERIF},{interval:["1D7EC","1D7F5"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.SANSSERIFBOLD},{interval:["1D7F6","1D7FF"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.MONOSPACE},{interval:["1F101","1F10A"],base:om.DIGIT,subst:{},offset:0,category:"No",font:nm.COMMA},{interval:["24B6","24CF"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.CIRCLED},{interval:["24D0","24E9"],base:om.LATINSMALL,subst:{},capital:!1,category:"So",font:nm.CIRCLED},{interval:["1F110","1F129"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.PARENTHESIZED},{interval:["249C","24B5"],base:om.LATINSMALL,subst:{},capital:!1,category:"So",font:nm.PARENTHESIZED},{interval:["1F130","1F149"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.SQUARED},{interval:["1F170","1F189"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.NEGATIVESQUARED},{interval:["1F150","1F169"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.NEGATIVECIRCLED}],dm=new Map;function um(t,e){return t+e.split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}for(const t of hm){const e=um(t.base,t.font),s=cm(t.interval,t.subst);let i=dm.get(e);i?i.unicode=i.unicode.concat(s):(i=t,i.unicode=s,dm.set(e,i))}var pm;!function(t){t.PUNCTUATION="punctuation",t.FENCE="fence",t.NUMBER="number",t.IDENTIFIER="identifier",t.TEXT="text",t.OPERATOR="operator",t.RELATION="relation",t.LARGEOP="largeop",t.FUNCTION="function",t.ACCENT="accent",t.FENCED="fenced",t.FRACTION="fraction",t.PUNCTUATED="punctuated",t.RELSEQ="relseq",t.MULTIREL="multirel",t.INFIXOP="infixop",t.PREFIXOP="prefixop",t.POSTFIXOP="postfixop",t.APPL="appl",t.INTEGRAL="integral",t.BIGOP="bigop",t.SQRT="sqrt",t.ROOT="root",t.LIMUPPER="limupper",t.LIMLOWER="limlower",t.LIMBOTH="limboth",t.SUBSCRIPT="subscript",t.SUPERSCRIPT="superscript",t.UNDERSCORE="underscore",t.OVERSCORE="overscore",t.TENSOR="tensor",t.TABLE="table",t.MULTILINE="multiline",t.MATRIX="matrix",t.VECTOR="vector",t.CASES="cases",t.ROW="row",t.LINE="line",t.CELL="cell",t.ENCLOSE="enclose",t.INFERENCE="inference",t.RULELABEL="rulelabel",t.CONCLUSION="conclusion",t.PREMISES="premises",t.UNKNOWN="unknown",t.EMPTY="empty"}(pm||(pm={}));const mm=Object.assign({},pm);var fm;!function(t){t.COMMA="comma",t.SEMICOLON="semicolon",t.ELLIPSIS="ellipsis",t.FULLSTOP="fullstop",t.QUESTION="question",t.EXCLAMATION="exclamation",t.QUOTES="quotes",t.DASH="dash",t.TILDE="tilde",t.PRIME="prime",t.DEGREE="degree",t.VBAR="vbar",t.COLON="colon",t.OPENFENCE="openfence",t.CLOSEFENCE="closefence",t.APPLICATION="application",t.DUMMY="dummy",t.UNIT="unit",t.LABEL="label",t.OPEN="open",t.CLOSE="close",t.TOP="top",t.BOTTOM="bottom",t.NEUTRAL="neutral",t.METRIC="metric",t.LATINLETTER="latinletter",t.GREEKLETTER="greekletter",t.OTHERLETTER="otherletter",t.NUMBERSET="numbersetletter",t.INTEGER="integer",t.FLOAT="float",t.OTHERNUMBER="othernumber",t.INFTY="infty",t.MIXED="mixed",t.MULTIACCENT="multiaccent",t.OVERACCENT="overaccent",t.UNDERACCENT="underaccent",t.UNDEROVER="underover",t.SUBSUP="subsup",t.LEFTSUB="leftsub",t.LEFTSUPER="leftsuper",t.RIGHTSUB="rightsub",t.RIGHTSUPER="rightsuper",t.LEFTRIGHT="leftright",t.ABOVEBELOW="abovebelow",t.INTERVAL="interval",t.SETEMPTY="set empty",t.SETEXT="set extended",t.SETSINGLE="set singleton",t.SETCOLLECT="set collection",t.STRING="string",t.SPACE="space",t.ANNOTATION="annotation",t.TEXT="text",t.SEQUENCE="sequence",t.ENDPUNCT="endpunct",t.STARTPUNCT="startpunct",t.NEGATIVE="negative",t.POSITIVE="positive",t.NEGATION="negation",t.MULTIOP="multiop",t.PREFIXOP="prefix operator",t.POSTFIXOP="postfix operator",t.LIMFUNC="limit function",t.INFIXFUNC="infix function",t.PREFIXFUNC="prefix function",t.POSTFIXFUNC="postfix function",t.SIMPLEFUNC="simple function",t.COMPFUNC="composed function",t.SUM="sum",t.INTEGRAL="integral",t.GEOMETRY="geometry",t.BOX="box",t.BLOCK="block",t.ADDITION="addition",t.MULTIPLICATION="multiplication",t.SUBTRACTION="subtraction",t.IMPLICIT="implicit",t.DIVISION="division",t.VULGAR="vulgar",t.EQUALITY="equality",t.INEQUALITY="inequality",t.ARROW="arrow",t.ELEMENT="element",t.NONELEMENT="nonelement",t.REELEMENT="reelement",t.RENONELEMENT="renonelement",t.SET="set",t.DETERMINANT="determinant",t.ROWVECTOR="rowvector",t.BINOMIAL="binomial",t.SQUAREMATRIX="squarematrix",t.CYCLE="cycle",t.MULTILINE="multiline",t.MATRIX="matrix",t.VECTOR="vector",t.CASES="cases",t.TABLE="table",t.CAYLEY="cayley",t.PROOF="proof",t.LEFT="left",t.RIGHT="right",t.UP="up",t.DOWN="down",t.FINAL="final",t.SINGLE="single",t.HYP="hyp",t.AXIOM="axiom",t.LOGIC="logic",t.UNKNOWN="unknown",t.MGLYPH="mglyph"}(fm||(fm={}));const gm=Object.assign({},fm);var bm;!function(t){t.CALIGRAPHIC="caligraphic",t.CALIGRAPHICBOLD="caligraphic-bold",t.OLDSTYLE="oldstyle",t.OLDSTYLEBOLD="oldstyle-bold",t.UNKNOWN="unknown"}(bm||(bm={}));const Em=Object.assign(Object.assign(Object.assign({},rm),bm),nm);var xm;!function(t){t.ALLLETTERS="allLetters",t.D="d",t.BAR="bar",t.TILDE="tilde",t.CURLY="curly",t.PAREN="paren",t.BRACKET="bracket",t.FLOOR="floor",t.CEIL="ceil"}(xm||(xm={}));const ym=Object.assign(Object.assign({},om),xm);var Nm=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);rparseInt(t,16))):e.push(parseInt(s,16));return e}(e);for(const e of r)i[e]||(t.set(String.fromCodePoint(e),String.fromCodePoint(e+s)),i[e]=!0,i[e+s]=!0)}const Rm=["0028","0029","207D","207E","208D","208E","2768","2769","276A","276B","27EE","27EF","FE59","FE5A","FF08","FF09"],Mm=["005B","005D","2045","2046","298B","298C","298D","298E","298F","2990","FF3B","FF3D"],Im=["007B","007D","2774","2775","FE5B","FE5C","FF5B","FF5D"],wm=["2308","2309","2E22","2E23","300C","300E","FF62"],km=["230A","230B","2E24","2E25","300D","300F","FF63"];function Om(t,e){for(const s of t){const t=String.fromCodePoint(parseInt(s,16));Am.Secondary.set(t,e),Am.FencesSecondary.set(t,e)}}const Dm=["cos","cot","csc","sec","sin","tan","arccos","arccot","arccsc","arcsec","arcsin","arctan"].concat(["cosh","coth","csch","sech","sinh","tanh","arcosh","arcoth","arcsch","arsech","arsinh","artanh"],["deg","det","dim","hom","ker","Tr"],["log","ln","lg","exp","gcd","lcm","arg","im","re","Pr"]);function Pm(t,e,s,i,r,n=[],o={},a={}){const l=dm.get(um(t,i));l&&(l.unicode.forEach(t=>{Am.Meaning.set(t,{type:e,role:s,font:r}),n.forEach(e=>Am.Secondary.set(t,e))}),function(t,e){for(const[s,i]of Object.entries(e)){const e=t[s];void 0!==e&&Am.Meaning.set(e,i)}}(l.unicode,o),function(t,e){for(const[s,i]of Object.entries(e)){const e=t[s];void 0!==e&&Am.Secondary.set(e,i)}}(l.unicode,a))}[{set:["23","26","40","5c","a1","a7","b6","bf","2017",["2022","2025"],"2027","203b","203c",["2041","2043"],["2047","2049"],["204b","204d"],"2050","2055","2056",["2058","205e"],"2234","2235","fe45","fe46","fe5f","fe60","fe68","fe6b","ff03","ff06","ff0f","ff20","ff3c"],type:mm.PUNCTUATION,role:gm.UNKNOWN},{set:["22","ab","bb","2dd",["2018","201f"],"2039","203a",["301d","301f"],"fe10","ff02","ff07"],type:mm.PUNCTUATION,role:gm.QUOTES},{set:["3b","204f","2a1f","2a3e","fe14","fe54","ff1b"],type:mm.PUNCTUATION,role:gm.SEMICOLON},{set:["3f","203d","fe16","fe56","ff1f"],type:mm.PUNCTUATION,role:gm.QUESTION},{set:["21","fe15","fe57","ff01"],type:mm.PUNCTUATION,role:gm.EXCLAMATION},{set:["5e","60","a8","aa","b4","ba","2c7",["2d8","2da"],"2040","207a","207d","207e","ff3e","ff40"],type:mm.PUNCTUATION,role:gm.OVERACCENT},{set:["b8","2db","2038","203f","2054","208a","208d","208e"],type:mm.PUNCTUATION,role:gm.UNDERACCENT},{set:["3a","2982","fe13","fe30","fe55","ff1a"],type:mm.PUNCTUATION,role:gm.COLON},{set:["2c","2063","fe50","ff0c"],type:mm.PUNCTUATION,role:gm.COMMA},{set:["2026",["22ee","22f1"],"fe19"],type:mm.PUNCTUATION,role:gm.ELLIPSIS},{set:["2e","fe52","ff0e"],type:mm.PUNCTUATION,role:gm.FULLSTOP},{set:["2d","207b","208b","2212","2796","fe63","ff0d"],type:mm.OPERATOR,role:gm.DASH,secondary:ym.BAR},{set:["5f","af",["2010","2015"],"203e","208b",["fe49","fe4f"],"fe58","ff3f","ffe3"],type:mm.PUNCTUATION,role:gm.DASH,secondary:ym.BAR},{set:["7e","2dc","2f7","303","330","334","2053","223c","223d","301c","ff5e"],type:mm.OPERATOR,role:gm.TILDE,secondary:ym.TILDE},{set:["27","2b9","2ba",["2032","2037"],"2057"],type:mm.PUNCTUATION,role:gm.PRIME},{set:["b0"],type:mm.PUNCTUATION,role:gm.DEGREE},{set:["2b","b1","2064","2213","2214","2228","222a",["228c","228e"],"2294","2295","229d","229e","22bb","22bd","22c4","22ce","22d3","2304","271b","271c","2795","27cf","29fa","29fb","29fe",["2a22","2a28"],"2a2d","2a2e","2a39","2a42","2a45","2a46","2a48","2a4a","2a4c","2a4f","2a50","2a52","2a54","2a56","2a57","2a59","2a5b","2a5d",["2a61","2a63"],"2adc","2add","fe62","ff0b"],type:mm.OPERATOR,role:gm.ADDITION},{set:["2a","b7","d7","2020","2021","204e","2051","2062",["2217","2219"],"2227","2229","2240","2293","2297",["2299","229b"],"22a0","22a1","22b9","22bc",["22c5","22cc"],"22cf","22d2","22d4","2303","2305","2306","25cb","2715","2716","27ce","27d1",["29d1","29d7"],"29e2","2a1d",["2a2f","2a37"],["2a3b","2a3d"],"2a40","2a43","2a44","2a47","2a49","2a4b","2a4d","2a4e","2a51","2a53","2a55","2a58","2a5a","2a5c",["2a5e","2a60"],"2ada","2adb","fe61","ff0a"],type:mm.OPERATOR,role:gm.MULTIPLICATION},{set:["2d","af","2010","2011","2052","207b","208b","2212","2216","2238","2242","2296","229f","2796","29ff",["2a29","2a2c"],"2a3a","2a41","fe63","ff0d"],type:mm.OPERATOR,role:gm.SUBTRACTION},{set:["2f","f7","2044","2215","2298","2797","27cc","29bc",["29f5","29f9"],"2a38"],type:mm.OPERATOR,role:gm.DIVISION},{set:["25","2030","2031","ff05","fe6a"],type:mm.OPERATOR,role:gm.POSTFIXOP},{set:["ac","2200","2201","2203","2204","2206",["221a","221c"],"2310","ffe2"],type:mm.OPERATOR,role:gm.PREFIXOP},{set:["2320","2321","23aa","23ae","23af","23b2","23b3","23b6","23b7"],type:mm.OPERATOR,role:gm.PREFIXOP},{set:["1d7ca","1d7cb"],type:mm.OPERATOR,role:gm.PREFIXOP,font:Em.BOLD},{set:["3d","7e","207c","208c","221d","2237",["223a","223f"],"2243","2245","2248",["224a","224e"],["2251","225f"],"2261","2263","229c","22cd","22d5","29e4","29e6","2a66","2a67",["2a6a","2a6c"],["2a6c","2a78"],"fe66","ff1d"],type:mm.RELATION,role:gm.EQUALITY},{set:["3c","3e","2241","2242","2244","2246","2247","2249","224f","2250","2260","2262",["2264","2281"],"22b0","22b1",["22d6","22e1"],["22e6","22e9"],["2976","2978"],"29c0","29c1","29e1","29e3","29e5",["2a79","2abc"],["2af7","2afa"],"fe64","fe65","ff1c","ff1e"],type:mm.RELATION,role:gm.INEQUALITY},{set:[["2282","228b"],["228f","2292"],["22b2","22b8"],"22d0","22d1",["22e2","22e5"],["22ea","22ed"],"27c3","27c4",["27c7","27c9"],["27d5","27d7"],"27dc",["2979","297b"],"29df",["2abd","2ad8"]],type:mm.RELATION,role:gm.SET},{set:["2236",["27e0","27e5"],"292b","292c",["29b5","29bb"],"29be","29bf",["29c2","29d0"]],type:mm.RELATION,role:gm.UNKNOWN},{set:["2205",["29b0","29b4"]],type:mm.IDENTIFIER,role:gm.SETEMPTY},{set:["1ab2","221e",["29dc","29de"]],type:mm.IDENTIFIER,role:gm.INFTY},{set:["22a2","22a3",["22a6","22af"],"27da","27db","27dd","27de","2ade",["2ae2","2ae6"],"2aec","2aed"],type:mm.RELATION,role:gm.LOGIC},{set:["22a4","22a5","22ba","27d8","27d9","27df","2adf","2ae0",["2ae7","2aeb"],"2af1"],type:mm.IDENTIFIER,role:gm.LOGIC},{set:[["2190","21ff"],"2301","2324","238b","2794",["2798","27af"],["27b1","27be"],["27f0","27ff"],["2900","292a"],["292d","2975"],["297c","297f"],["2b00","2b11"],["2b30","2b4c"],["ffe9","ffec"]],type:mm.RELATION,role:gm.ARROW},{set:["2208","220a",["22f2","22f9"],"22ff","27d2","2ad9"],type:mm.OPERATOR,role:gm.ELEMENT},{set:["2209"],type:mm.OPERATOR,role:gm.NONELEMENT},{set:["220b","220d",["22fa","22fe"]],type:mm.OPERATOR,role:gm.REELEMENT},{set:["220c"],type:mm.OPERATOR,role:gm.RENONELEMENT},{set:[["220f","2211"],["22c0","22c3"],["2a00","2a0b"],"2a3f","2afc","2aff"],type:mm.LARGEOP,role:gm.SUM},{set:["2140"],type:mm.LARGEOP,role:gm.SUM,font:Em.DOUBLESTRUCK},{set:[["222b","2233"],["2a0c","2a17"],["2a17","2a1c"]],type:mm.LARGEOP,role:gm.INTEGRAL},{set:[["2500","257F"]],type:mm.RELATION,role:gm.BOX},{set:[["2580","259F"]],type:mm.IDENTIFIER,role:gm.BLOCK},{set:[["25A0","25FF"],["2B12","2B2F"],["2B50","2B59"]],type:mm.RELATION,role:gm.GEOMETRY},{set:["220e","2300","2302","2311","29bd","29e0",["29e8","29f3"],"2a1e","2afe","ffed","ffee"],type:mm.OPERATOR,role:gm.GEOMETRY},{set:[["221f","2222"],"22be","22bf",["2312","2314"],"237c","27c0",["299b","29af"]],type:mm.OPERATOR,role:gm.GEOMETRY},{set:["24",["a2","a5"],"b5","2123",["2125","2127"],"212a","212b","fe69","ff04","ffe0","ffe1","ffe5","ffe6"],type:mm.IDENTIFIER,role:gm.UNKNOWN},{set:["a9","ae","210f","2114","2116","2117",["211e","2122"],"212e","2132",["2139","213b"],["2141","2144"],"214d","214e",["1f12a","1f12c"],"1f18a"],type:mm.IDENTIFIER,role:gm.OTHERLETTER},{set:["2224","2226","2239","2307","27b0","27bf","27c1","27c2","27ca","27cb","27cd","27d0","27d3","27d4","2981","2999","299a","29e7","29f4","2a20","2a21","2a64","2a65","2a68","2a69","2ae1",["2aee","2af0"],"2af2","2af3","2af5","2af6","2afb","2afd"],type:mm.OPERATOR,role:gm.UNKNOWN},{set:["2605","2606","26aa","26ab",["2720","274d"]],type:mm.OPERATOR,role:gm.UNKNOWN},{set:[["2145","2149"]],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.DOUBLESTRUCKITALIC,secondary:ym.ALLLETTERS},{set:[["213c","213f"]],type:mm.IDENTIFIER,role:gm.GREEKLETTER,font:Em.DOUBLESTRUCK,secondary:ym.ALLLETTERS},{set:["3d0","3d7","3f6",["1d26","1d2a"],"1d5e","1d60",["1d66","1d6a"]],type:mm.IDENTIFIER,role:gm.GREEKLETTER,font:Em.NORMAL,secondary:ym.ALLLETTERS},{set:[["2135","2138"]],type:mm.IDENTIFIER,role:gm.OTHERLETTER,font:Em.NORMAL,secondary:ym.ALLLETTERS},{set:["131","237"],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.NORMAL},{set:["1d6a4","1d6a5"],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.ITALIC},{set:["2113","2118"],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.SCRIPT},{set:[["c0","d6"],["d8","f6"],["f8","1bf"],["1c4","2af"],["1d00","1d25"],["1d6b","1d9a"],["1e00","1ef9"],["363","36f"],["1dd3","1de6"],["1d62","1d65"],"1dca","2071","207f",["2090","209c"],"2c7c"],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.NORMAL},{set:[["00bc","00be"],["2150","215f"],"2189"],type:mm.NUMBER,role:gm.FLOAT},{set:["23E8",["3248","324f"]],type:mm.NUMBER,role:gm.INTEGER},{set:[["214A","214C"],"2705","2713","2714","2717","2718"],type:mm.IDENTIFIER,role:gm.UNKNOWN},{set:["20","a0","ad",["2000","200f"],["2028","202f"],["205f","2060"],"206a","206b","206e","206f","feff",["fff9","fffb"]],type:mm.TEXT,role:gm.SPACE},{set:["7c","a6","2223","23b8","23b9","23d0","2758",["fe31","fe34"],"ff5c","ffe4","ffe8"],type:mm.FENCE,role:gm.NEUTRAL},{set:["2016","2225","2980","2af4"],type:mm.FENCE,role:gm.METRIC}].forEach(t=>{var{set:e}=t,s=Nm(t,["set"]);return Lm(function(t){let e=[];for(const s of t)Array.isArray(s)?e=e.concat(cm(s)):e.push(String.fromCodePoint(parseInt(s,16)));return e}(e),s)}),Sm(Am.FencesVert,["23b4",["23dc","23e1"],["fe35","fe44"],"fe47"]),Sm(Am.FencesHoriz,["28","2045","207D","208D",["2308","230f"],["231c","231f"],"2329","23b0",["2768","2775"],"27c5",["27e6","27ef"],["2983","2998"],["29d8","29db"],"29fc",["2e22","2e29"],["3008","3011"],["3014","301b"],"fd3e","fe17",["fe59","fe5e"],"ff08","ff5f","ff62"]),Sm(Am.FencesHoriz,["5b","7b","ff3b","ff5b"],2),Sm(Am.FencesHoriz,[["239b","23a6"]],3),Sm(Am.FencesHoriz,[["23a7","23a9"]],4),Lm([...Am.FencesHoriz.keys()],{type:mm.FENCE,role:gm.OPEN}),Lm([...Am.FencesHoriz.values()],{type:mm.FENCE,role:gm.CLOSE}),Lm([...Am.FencesVert.keys()],{type:mm.FENCE,role:gm.TOP}),Lm([...Am.FencesVert.values()],{type:mm.FENCE,role:gm.BOTTOM}),Om(Rm,ym.PAREN),Om(Im,ym.CURLY),Om(Mm,ym.BRACKET),Om(wm,ym.CEIL),Om(km,ym.FLOOR),function(){for(const[t,e]of Object.entries(Em)){const s=!!nm[t]?Em.UNKNOWN:e===Em.FULLWIDTH?Em.NORMAL:e;Pm(om.LATINCAP,mm.IDENTIFIER,gm.LATINLETTER,e,s,[ym.ALLLETTERS]),Pm(om.LATINSMALL,mm.IDENTIFIER,gm.LATINLETTER,e,s,[ym.ALLLETTERS],{},{3:ym.D}),Pm(om.GREEKCAP,mm.IDENTIFIER,gm.GREEKLETTER,e,s,[ym.ALLLETTERS]),Pm(om.GREEKSMALL,mm.IDENTIFIER,gm.GREEKLETTER,e,s,[ym.ALLLETTERS],{0:{type:mm.OPERATOR,role:gm.PREFIXOP,font:s},26:{type:mm.OPERATOR,role:gm.PREFIXOP,font:s}}),Pm(om.DIGIT,mm.NUMBER,gm.INTEGER,e,s)}}(),Lm(["inf","lim","liminf","limsup","max","min","sup","injlim","projlim"],{type:mm.FUNCTION,role:gm.LIMFUNC}),Lm(Dm,{type:mm.FUNCTION,role:gm.PREFIXFUNC}),Lm(["mod","rem"],{type:mm.OPERATOR,role:gm.PREFIXFUNC});const Bm=[];function Fm(t,e){for(let s,i=0;s=Bm[i];i++){const i=s.compare(t,e);if(0!==i)return i}return 0}function jm(t){if(t.length<=1)return t;const e=t.slice();!function(t){t.sort(Fm)}(e);const s=[];let i;do{i=e.pop(),s.push(i)}while(i&&e.length&&0===Fm(e[e.length-1],i));return s}function _m(t,e){return t.match(/^.+:.+$/)||!e?t:t+":"+e}new class{constructor(t,e=null){this.comparator=t,this.type=e,function(t){Bm.push(t)}(this)}compare(t,e){return this.type&&this.type===t.type&&this.type===e.type?this.comparator(t,e):0}}(function(t,e){return t.role===gm.SIMPLEFUNC?1:e.role===gm.SIMPLEFUNC?-1:0},mm.IDENTIFIER);class Um extends Map{set(t,e){return super.set(_m(t,e.font),e),this}setNode(t){this.set(t.textContent,t.meaning())}get(t,e=null){return super.get(_m(t,e))}getNode(t){return this.get(t.textContent,t.font)}}class Hm extends Map{add(t,e){const s=this.get(t);s?s.push(e):super.set(t,[e])}get(t,e=null){return super.get(_m(t,e))}getNode(t){return this.get(t.textContent,t.font)}minimize(){for(const[t,e]of this)1===e.length&&this.delete(t)}isMultiValued(){for(const t of this.values())if(t.length>1)return!0;return!1}}class Wm extends Hm{add(t,e){super.add(_m(t,e.font),e)}addNode(t){this.add(t.textContent,t)}toString(){const t=[];for(const[e,s]of this){const i=Array(e.length+3).join(" "),r=s.map(t=>t.toString()).join("\n"+i);t.push(e+": "+r)}return t.join("\n")}collateMeaning(){const t=new zm;for(const[e,s]of this)t.set(e,s.map(t=>t.meaning()));return t}}class zm extends Hm{add(t,e){const s=this.get(t,e.font);s&&s.find(function(t){return i=e,(s=t).type===i.type&&s.role===i.role&&s.font===i.font;var s,i})||super.add(_m(t,e.font),e)}addNode(t){this.add(t.textContent,t.meaning())}toString(){const t=[];for(const[e,s]of this){const i=Array(e.length+3).join(" "),r=s.map(t=>`{type: ${t.type}, role: ${t.role}, font: ${t.font}}`).join("\n"+i);t.push(e+": "+r)}return t.join("\n")}reduce(){for(const[t,e]of this)1!==e.length&&this.set(t,jm(e))}default(){const t=new Um;for(const[e,s]of this)1===s.length&&t.set(e,s[0]);return t}newDefault(){const t=this.default();this.reduce();const e=this.default();return t.size!==e.size?e:null}}var qm;!function(t){t.ANNOTATION="ANNOTATION",t.ANNOTATIONXML="ANNOTATION-XML",t.MACTION="MACTION",t.MALIGNGROUP="MALIGNGROUP",t.MALIGNMARK="MALIGNMARK",t.MATH="MATH",t.MENCLOSE="MENCLOSE",t.MERROR="MERROR",t.MFENCED="MFENCED",t.MFRAC="MFRAC",t.MGLYPH="MGLYPH",t.MI="MI",t.MLABELEDTR="MLABELEDTR",t.MMULTISCRIPTS="MMULTISCRIPTS",t.MN="MN",t.MO="MO",t.MOVER="MOVER",t.MPADDED="MPADDED",t.MPHANTOM="MPHANTOM",t.MPRESCRIPTS="MPRESCRIPTS",t.MROOT="MROOT",t.MROW="MROW",t.MS="MS",t.MSPACE="MSPACE",t.MSQRT="MSQRT",t.MSTYLE="MSTYLE",t.MSUB="MSUB",t.MSUBSUP="MSUBSUP",t.MSUP="MSUP",t.MTABLE="MTABLE",t.MTD="MTD",t.MTEXT="MTEXT",t.MTR="MTR",t.MUNDER="MUNDER",t.MUNDEROVER="MUNDEROVER",t.NONE="NONE",t.SEMANTICS="SEMANTICS"}(qm||(qm={}));const Vm=Object.values(qm),Xm=[qm.MO,qm.MI,qm.MN,qm.MTEXT,qm.MS,qm.MSPACE],Gm=[qm.MERROR,qm.MPHANTOM,qm.MALIGNGROUP,qm.MALIGNMARK,qm.MPRESCRIPTS,qm.ANNOTATION,qm.ANNOTATIONXML],Jm=[qm.MATH,qm.MROW,qm.MPADDED,qm.MACTION,qm.NONE,qm.MSTYLE,qm.SEMANTICS],Km=[qm.MROOT,qm.MSQRT],$m=["aria-label","exact-speech","alt"];function Ym(t){return!!t&&$p(t)===qm.MATH}function Qm(t){return!!t&&(Gm.includes($p(t))||!Vm.includes($p(t)))}function Zm(t){return!!t&&Jm.includes($p(t))}function tf(t){return!!t&&$p(t)===qm.MGLYPH&&!function(t){return!!t&&Xm.includes($p(t))}(t.parentNode)}function ef(t){const e=[];for(let s,i=0;s=t[i];i++){if(s.nodeType!==zp.ELEMENT_NODE)continue;const t=$p(s);Gm.includes(t)||(Jm.includes(t)&&0===s.childNodes.length||e.push(s))}return e}function sf(t,e){var s;if(null===(s=e.attributes)||void 0===s?void 0:s.length){const s=e.attributes;for(let e=s.length-1;e>=0;e--){const i=s[e].name;i.match(/^ext/)&&(t.attributes[i]=s[e].value,t.nobreaking=!0),$m.includes(i)&&(t.attributes["ext-speech"]=s[e].value,t.nobreaking=!0),"href"===i&&(t.attributes.href=s[e].value,t.nobreaking=!0),"data-latex"!==i.toLowerCase()&&"latex"!==i.toLowerCase()||(t.attributes.latex=s[e].value),i.match(/texclass$/)&&(t.attributes.texclass=s[e].value),"color"!==i&&"mathcolor"!==i||(t.attributes.color=s[e].value)}}}function rf(t){return t&&t.embellished&&t.childNodes.length>0?rf(t.childNodes[0]):t}function nf(t,e,s){s&&t.reverse();const i=[];for(let r,n=0;r=t[n];n++){if(e(r))return s?{head:t.slice(n+1).reverse(),div:r,tail:i.reverse()}:{head:i,div:r,tail:t.slice(n+1)};i.push(r)}return s?{head:[],div:null,tail:i.reverse()}:{head:i,div:null,tail:[]}}function of(t,e){let s=t;const i=[],r=[];let n=null;do{n=nf(s,e),r.push(n.head),i.push(n.div),s=n.tail}while(n.div);return i.pop(),{rel:i,comp:r}}function af(t,e){if(t.mathmlTree)return;const s=new Set;if(e.forEach(t=>{var e;return s.add((null===(e=t.mathmlTree)||void 0===e?void 0:e.parentElement)||null)}),1===s.size&&!s.has(null)){const i=[...s][0];return Zm(i)&&i.childNodes.length===e.length?void(t.mathmlTree=i):void 0}if(s.has(null)&&s.size<=2&&(s.delete(null),t.mathml.forEach(e=>{e.parentElement&&!t.mathml.includes(e)&&s.add(e.parentElement)})),1===s.size&&!s.has(null)){const e=[...s][0];if(Zm(e)&&qp(e.childNodes).every(e=>t.mathml.includes(e)))return void(t.mathmlTree=e)}}var lf;!function(t){t.EMBELLISHED="embellished",t.FENCEPOINTER="fencepointer",t.FONT="font",t.ID="id",t.ANNOTATION="annotation",t.ROLE="role",t.TYPE="type",t.CHILDREN="children",t.CONTENT="content",t.TEXT="$t"}(lf||(lf={}));class cf{static fromXml(t){const e=parseInt(t.getAttribute("id"),10),s=new cf(e);return s.type=t.tagName,cf.setAttribute(s,t,"role"),cf.setAttribute(s,t,"font"),cf.setAttribute(s,t,"embellished"),cf.setAttribute(s,t,"fencepointer","fencePointer"),t.getAttribute("annotation")&&s.parseAnnotation(t.getAttribute("annotation")),sf(s,t),cf.processChildren(s,t),s}static setAttribute(t,e,s,i){i=i||s;const r=e.getAttribute(s);r&&(t[i]=r)}static processChildren(t,e){for(const s of qp(e.childNodes)){if(s.nodeType===zp.TEXT_NODE){t.textContent=s.textContent;continue}const e=qp(s.childNodes).map(cf.fromXml);e.forEach(e=>e.parent=t),"CONTENT"===$p(s)?t.contentNodes=e:t.childNodes=e}}constructor(t){this.id=t,this.mathml=[],this.parent=null,this.type=mm.UNKNOWN,this.role=gm.UNKNOWN,this.font=Em.UNKNOWN,this.embellished=null,this.fencePointer="",this.childNodes=[],this.textContent="",this.mathmlTree=null,this.contentNodes=[],this.annotation={},this.attributes={},this.nobreaking=!1,this.noupdate=!1}querySelectorAll(t){let e=[];for(let s,i=0;s=this.childNodes[i];i++)e=e.concat(s.querySelectorAll(t));for(let s,i=0;s=this.contentNodes[i];i++)e=e.concat(s.querySelectorAll(t));return t(this)&&e.unshift(this),e}xml(t,e){const s=function(s,i){const r=i.map(function(s){return s.xml(t,e)}),n=t.createElementNS("",s);for(let t,e=0;t=r[e];e++)n.appendChild(t);return n},i=t.createElementNS("",this.type);return e||this.xmlAttributes(i),i.textContent=this.textContent,this.contentNodes.length>0&&i.appendChild(s(lf.CONTENT,this.contentNodes)),this.childNodes.length>0&&i.appendChild(s(lf.CHILDREN,this.childNodes)),i}toString(t=!1){const e=Vp("");return Yp(this.xml(e.ownerDocument,t))}allAttributes(){const t=[];return t.push([lf.ROLE,this.role]),this.font!==Em.UNKNOWN&&t.push([lf.FONT,this.font]),Object.keys(this.annotation).length&&t.push([lf.ANNOTATION,this.annotationXml()]),this.embellished&&t.push([lf.EMBELLISHED,this.embellished]),this.fencePointer&&t.push([lf.FENCEPOINTER,this.fencePointer]),t.push([lf.ID,this.id.toString()]),t}annotationXml(){const t=[];for(const[e,s]of Object.entries(this.annotation))s.forEach(s=>t.push(e+":"+s));return t.join(";")}attributesXml(){const t=[];for(const[e,s]of Object.entries(this.attributes))t.push(e+":"+cf.escapeValue(s));return t.join(";")}toJson(){const t={};t[lf.TYPE]=this.type;const e=this.allAttributes();for(let s,i=0;s=e[i];i++)t[s[0]]=s[1].toString();return this.textContent&&(t[lf.TEXT]=this.textContent),this.childNodes.length&&(t[lf.CHILDREN]=this.childNodes.map(function(t){return t.toJson()})),this.contentNodes.length&&(t[lf.CONTENT]=this.contentNodes.map(function(t){return t.toJson()})),t}updateContent(t,e){const s=e?t.replace(/^[ \f\n\r\t\v\u200b]*/,"").replace(/[ \f\n\r\t\v\u200b]*$/,""):t.trim();if(t=t&&!s?t:s,this.textContent===t)return;const i=Am.Meaning.get(t.replace(/\s/g," "));this.textContent=t,this.role=i.role,this.type=i.type,this.font=i.font}addMathmlNodes(t){for(let e,s=0;e=t[s];s++)-1===this.mathml.indexOf(e)&&this.mathml.push(e)}appendChild(t){this.childNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this}replaceChild(t,e){const s=this.childNodes.indexOf(t);if(-1===s)return;t.parent=null,e.parent=this,this.childNodes[s]=e;const i=t.mathml.filter(function(t){return-1===e.mathml.indexOf(t)}),r=e.mathml.filter(function(e){return-1===t.mathml.indexOf(e)});this.removeMathmlNodes(i),this.addMathmlNodes(r)}appendContentNode(t){t&&(this.contentNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this)}removeContentNode(t){if(t){const e=this.contentNodes.indexOf(t);-1!==e&&this.contentNodes.slice(e,1)}}equals(t){if(!t)return!1;if(this.type!==t.type||this.role!==t.role||this.textContent!==t.textContent||this.childNodes.length!==t.childNodes.length||this.contentNodes.length!==t.contentNodes.length)return!1;for(let e,s,i=0;e=this.childNodes[i],s=t.childNodes[i];i++)if(!e.equals(s))return!1;for(let e,s,i=0;e=this.contentNodes[i],s=t.contentNodes[i];i++)if(!e.equals(s))return!1;return!0}displayTree(){console.info(this.displayTree_(0))}addAnnotation(t,e){e&&this.addAnnotation_(t,e)}getAnnotation(t){const e=this.annotation[t];return e||[]}hasAnnotation(t,e){const s=this.annotation[t];return!!s&&-1!==s.indexOf(e)}parseAnnotation(t){const e=t.split(";");for(let t=0,s=e.length;t0&&mf(e[e.length-1],gm.OPENFENCE)}function kf(t){return t.childNodes.every(function(t){return t.childNodes.length<=1})}function Of(t){return uf(t,mm.LINE)&&t.contentNodes.length&&mf(t.contentNodes[0],gm.LABEL)}function Df(t){return uf(t,mm.LARGEOP)||uf(t,mm.LIMBOTH)||uf(t,mm.LIMLOWER)||uf(t,mm.LIMUPPER)||uf(t,mm.FUNCTION)&&mf(t,gm.LIMFUNC)||(uf(t,mm.OVERSCORE)||uf(t,mm.UNDERSCORE))&&Df(t.childNodes[0])}function Pf(t,e,s){return 1===e.length&&(t[s].type===mm.PUNCTUATION||t[s].embellished===mm.PUNCTUATION)&&t[s]===e[0]}function Bf(t){return uf(t,mm.IDENTIFIER)&&mf(t,gm.SIMPLEFUNC)}const Ff=[mm.PUNCTUATION,mm.PUNCTUATED,mm.RELSEQ,mm.MULTIREL,mm.TABLE,mm.MULTILINE,mm.CASES,mm.INFERENCE],jf=[mm.LIMUPPER,mm.LIMLOWER,mm.LIMBOTH,mm.SUBSCRIPT,mm.SUPERSCRIPT,mm.UNDERSCORE,mm.OVERSCORE,mm.TENSOR];function _f(t){const e=t.type;return-1===Ff.indexOf(e)&&(e!==mm.INFIXOP||t.role===gm.IMPLICIT)&&(e===mm.FENCED?t.role!==gm.LEFTRIGHT||_f(t.childNodes[0]):-1===jf.indexOf(e)||_f(t.childNodes[0]))}function Uf(t){return function(t){return t.type===mm.NUMBER&&(t.role===gm.INTEGER||t.role===gm.FLOAT)}(t)||t.role===gm.VULGAR||t.role===gm.MIXED}function Hf(t){const e=t.childNodes;return t.role===gm.UNIT&&(!e.length||e[0].role===gm.UNIT)}function Wf(t){const e=t.childNodes;return t.type===mm.INFIXOP&&(t.role===gm.MULTIPLICATION||t.role===gm.IMPLICIT)&&e.length&&(Hf(e[0])||Uf(e[0]))&&t.childNodes.slice(1).every(Hf)}function zf(t){return t.type===mm.INFIXOP&&(t.role===gm.IMPLICIT||t.role===gm.UNIT&&!!t.contentNodes.length&&t.contentNodes[0].textContent===vm.invisibleTimes)}function qf(t){return t.type===mm.INFIXOP&&t.role===gm.IMPLICIT}function Vf(t){return t.role===gm.NEUTRAL||t.role===gm.METRIC}function Xf(t,e){return Vf(t)&&Vf(e)&&rf(t).textContent===rf(e).textContent}function Gf(t){return!!Vf(t)&&(!t.embellished||t.type!==mm.SUPERSCRIPT&&t.type!==mm.SUBSCRIPT&&(t.type!==mm.TENSOR||t.childNodes[3].type===mm.EMPTY&&t.childNodes[4].type===mm.EMPTY))}function Jf(t){return!!Vf(t)&&(!t.embellished||(t.type!==mm.TENSOR||t.childNodes[1].type===mm.EMPTY&&t.childNodes[2].type===mm.EMPTY))}function Kf(t){return[gm.ELEMENT,gm.NONELEMENT,gm.REELEMENT,gm.RENONELEMENT].includes(t.role)}const $f={factory:null,options:new kp,updateFactory:function(t){$f.factory=t},heuristics:new Map,flags:{combine_juxtaposition:!0,convert_juxtaposition:!0,multioperator:!0},blacklist:{},add:function(t){const e=t.name;$f.heuristics.set(e,t),$f.flags[e]||($f.flags[e]=!1)},run:function(t,e,s){const i=$f.heuristics.get(t);return i&&!$f.blacklist[t]&&($f.flags[t]||i.applicable(e))?i.apply(e):s?s(e):e}};class Yf{static getInstance(){return Yf.instance=Yf.instance||new Yf,Yf.instance}static tableToMultiline(t){if(!kf(t))return $f.run("rewrite_subcases",t,Yf.classifyTable);t.type=mm.MULTILINE;for(let e,s=0;e=t.childNodes[s];s++)Yf.rowToLine_(e,gm.MULTILINE);return 1===t.childNodes.length&&!Of(t.childNodes[0])&&If(t.childNodes[0].childNodes[0])&&Yf.tableToMatrixOrVector_(Yf.rewriteFencedLine_(t)),Yf.classifyMultiline(t)}static number(t){t.type!==mm.UNKNOWN&&t.type!==mm.IDENTIFIER||(t.type=mm.NUMBER),Yf.meaningFromContent(t,Yf.numberRole_),Yf.exprFont_(t)}static classifyMultiline(t){return Yf.binomialForm_(t),Yf.classifyMultiline_(t),t}static classifyMultiline_(t){let e=0;const s=t.childNodes.length;let i;for(;e=s)return;const r=i.childNodes[0].role;r!==gm.UNKNOWN&&t.childNodes.every(function(t){const e=t.childNodes[0];return!e||e.role===r&&(uf(e,mm.RELATION)||uf(e,mm.RELSEQ))})&&(t.role=r)}static classifyTable(t){const e=Yf.computeColumns_(t);return Yf.classifyByColumns_(t,e,gm.EQUALITY)||Yf.classifyByColumns_(t,e,gm.INEQUALITY,[gm.EQUALITY])||Yf.classifyByColumns_(t,e,gm.ARROW)||Yf.detectCaleyTable(t),t}static detectCaleyTable(t){if(!t.mathmlTree)return!1;const e=t.mathmlTree,s=e.getAttribute("columnlines"),i=e.getAttribute("rowlines");return!(!s||!i)&&(!(!Yf.cayleySpacing(s)||!Yf.cayleySpacing(i))&&(t.role=gm.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,s){const i=Yf.separateSemantics(e);return Yf.getInstance().proof(t,i,s)}static findSemantics(t,e,s){const i=null==s?null:s,r=Yf.getSemantics(t);return!!r&&(!!r[e]&&(null==i||r[e]===i))}static getSemantics(t){const e=t.getAttribute("semantics");return e?Yf.separateSemantics(e):null}static removePrefix(t){const[,...e]=t.split("_");return e.join("_")}static separateSemantics(t){const e={};return t.split(";").forEach(function(t){const[s,i]=t.split(":");e[Yf.removePrefix(s)]=i}),e}static matchSpaces_(t,e){for(let s,i=0;s=e[i];i++){const e=t[i].mathmlTree,r=t[i+1].mathmlTree;if(!e||!r)continue;const n=e.nextSibling;if(!n||n===r)continue;const o=Yf.getSpacer_(n);o&&o!==r&&(s.addMathmlNodes([o]),s.mathmlTree=o,s.role=gm.SPACE)}}static getSpacer_(t){if($p(t)===qm.MSPACE)return t;for(;Zm(t)&&1===t.childNodes.length;)if($p(t=t.childNodes[0])===qm.MSPACE)return t;return null}static fenceToPunct_(t){const e=Yf.FENCE_TO_PUNCT_[t.role];if(e){for(;t.embellished;)t.embellished=mm.PUNCTUATION,mf(t,gm.SUBSUP)||mf(t,gm.UNDEROVER)||(t.role=e),t=t.childNodes[0];t.type=mm.PUNCTUATION,t.role=e}}static classifyFunction_(t,e){if(t.type===mm.APPL||t.type===mm.BIGOP||t.type===mm.INTEGRAL)return"";if(e[0]&&e[0].textContent===vm.functionApplication){Yf.getInstance().funcAppls[t.id]=e.shift();let s=gm.SIMPLEFUNC;return $f.run("simple2prefix",t),t.role!==gm.PREFIXFUNC&&t.role!==gm.LIMFUNC||(s=t.role),Yf.propagateFunctionRole_(t,s),"prefix"}const s=Yf.CLASSIFY_FUNCTION_[t.role];return s||((i=t).type===mm.IDENTIFIER||i.role===gm.LATINLETTER||i.role===gm.GREEKLETTER||i.role===gm.OTHERLETTER?"simple":"");var i}static propagateFunctionRole_(t,e){if(t){if(t.type===mm.INFIXOP)return;mf(t,gm.SUBSUP)||mf(t,gm.UNDEROVER)||(t.role=e),Yf.propagateFunctionRole_(t.childNodes[0],e)}}static getFunctionOp_(t,e){if(e(t))return t;for(let s,i=0;s=t.childNodes[i];i++){const t=Yf.getFunctionOp_(s,e);if(t)return t}return null}static tableToMatrixOrVector_(t){const e=t.childNodes[0];uf(e,mm.MULTILINE)?Yf.tableToVector_(t):Yf.tableToMatrix_(t),t.contentNodes.forEach(e.appendContentNode.bind(e));for(let t,s=0;t=e.childNodes[s];s++)Yf.assignRoleToRow_(t,Yf.getComponentRoles_(e));return e.parent=null,e}static tableToVector_(t){const e=t.childNodes[0];e.type=mm.VECTOR,1!==e.childNodes.length?Yf.binomialForm_(e):Yf.tableToSquare_(t)}static binomialForm_(t){mf(t,gm.UNKNOWN)&&(2===t.childNodes.length&&(t.role=gm.BINOMIAL,t.childNodes[0].role=gm.BINOMIAL,t.childNodes[1].role=gm.BINOMIAL))}static tableToMatrix_(t){const e=t.childNodes[0];e.type=mm.MATRIX,e.childNodes&&e.childNodes.length>0&&e.childNodes[0].childNodes&&e.childNodes.length===e.childNodes[0].childNodes.length?Yf.tableToSquare_(t):e.childNodes&&1===e.childNodes.length&&(e.role=gm.ROWVECTOR)}static tableToSquare_(t){const e=t.childNodes[0];mf(e,gm.UNKNOWN)&&(Vf(t)?e.role=gm.DETERMINANT:e.role=gm.SQUAREMATRIX)}static getComponentRoles_(t){const e=t.role;return e&&e!==gm.UNKNOWN?e:t.type.toLowerCase()||gm.UNKNOWN}static tableToCases_(t,e){for(let e,s=0;e=t.childNodes[s];s++)Yf.assignRoleToRow_(e,gm.CASES);return t.type=mm.CASES,t.appendContentNode(e),kf(t)&&Yf.binomialForm_(t),t}static rewriteFencedLine_(t){const e=t.childNodes[0],s=t.childNodes[0].childNodes[0],i=t.childNodes[0].childNodes[0].childNodes[0];return s.parent=t.parent,t.parent=s,i.parent=e,s.childNodes=[t],e.childNodes=[i],s}static rowToLine_(t,e){const s=e||gm.UNKNOWN;uf(t,mm.ROW)&&(t.type=mm.LINE,t.role=s,1===t.childNodes.length&&uf(t.childNodes[0],mm.CELL)&&(t.childNodes=t.childNodes[0].childNodes,t.childNodes.forEach(function(e){e.parent=t})))}static assignRoleToRow_(t,e){uf(t,mm.LINE)?t.role=e:uf(t,mm.ROW)&&(t.role=e,t.childNodes.forEach(function(t){uf(t,mm.CELL)&&(t.role=e)}))}static nextSeparatorFunction_(t){let e;if(t){if(t.match(/^\s+$/))return null;e=t.replace(/\s/g,"").split("").filter(function(t){return t})}else e=[","];return function(){return e.length>1?e.shift():e[0]}}static meaningFromContent(t,e){const s=[...t.textContent].filter(t=>t.match(/[^\s]/)),i=s.map(t=>Am.Meaning.get(t));e(t,s,i)}static numberRole_(t,e,s){if(t.role===gm.UNKNOWN)return s.every(function(t){return t.type===mm.NUMBER&&t.role===gm.INTEGER||t.type===mm.PUNCTUATION&&t.role===gm.COMMA})?(t.role=gm.INTEGER,void("0"===e[0]&&t.addAnnotation("general","basenumber"))):void(s.every(function(t){return t.type===mm.NUMBER&&t.role===gm.INTEGER||t.type===mm.PUNCTUATION})?t.role=gm.FLOAT:t.role=gm.OTHERNUMBER)}static exprFont_(t){t.font===Em.UNKNOWN&&Yf.compSemantics(t,"font",Em)}static compSemantics(t,e,s){const i=[...t.textContent].map(t=>Am.Meaning.get(t)).reduce(function(t,i){return t&&i[e]&&i[e]!==s.UNKNOWN&&i[e]!==t?t===s.UNKNOWN?i[e]:null:t},s.UNKNOWN);i&&(t[e]=i)}static purgeFences_(t){const e=t.rel,s=t.comp,i=[],r=[];for(;e.length>0;){const t=e.shift();let n=s.shift();Lf(t)?(i.push(t),r.push(n)):(Yf.fenceToPunct_(t),n.push(t),n=n.concat(s.shift()),s.unshift(n))}return r.push(s.shift()),{rel:i,comp:r}}static rewriteFencedNode_(t){const e=t.contentNodes[0],s=t.contentNodes[1];let i=Yf.rewriteFence_(t,e);return t.contentNodes[0]=i.fence,i=Yf.rewriteFence_(i.node,s),t.contentNodes[1]=i.fence,t.contentNodes[0].parent=t,t.contentNodes[1].parent=t,function(t){const e=Am.FencesSecondary.get(t.contentNodes[0].textContent),s=Am.FencesSecondary.get(t.contentNodes[1].textContent);e===s&&t.addAnnotation("fences",e)}(t),i.node.parent=null,i.node}static rewriteFence_(t,e){if(!e.embellished)return{node:t,fence:e};const s=e.childNodes[0],i=Yf.rewriteFence_(t,s);return uf(e,mm.SUPERSCRIPT)||uf(e,mm.SUBSCRIPT)||uf(e,mm.TENSOR)?(mf(e,gm.SUBSUP)||(e.role=t.role),s!==i.node&&(e.replaceChild(s,i.node),s.parent=t),Yf.propagateFencePointer_(e,s),{node:e,fence:i.fence}):(e.replaceChild(s,i.fence),e.mathmlTree&&-1===e.mathml.indexOf(e.mathmlTree)&&e.addMathmlNodes([e.mathmlTree]),{node:i.node,fence:e})}static propagateFencePointer_(t,e){t.fencePointer=e.fencePointer||e.id.toString(),t.embellished=null}static classifyByColumns_(t,e,s,i=[]){const r=[s].concat(i);return!!(3===e.length&&Yf.testColumns_(e,1,t=>Yf.isPureRelation_(t,r))||2===e.length&&(Yf.testColumns_(e,1,t=>Yf.isEndRelation_(t,r)||Yf.isPureRelation_(t,r))||Yf.testColumns_(e,0,t=>Yf.isEndRelation_(t,r,!0)||Yf.isPureRelation_(t,r))))&&(t.role=s,!0)}static isEndRelation_(t,e,s){const i=s?t.childNodes.length-1:0;return uf(t,mm.RELSEQ)&&e.some(e=>mf(t,e))&&uf(t.childNodes[i],mm.EMPTY)}static isPureRelation_(t,e){return uf(t,mm.RELATION)&&e.some(e=>mf(t,e))}static computeColumns_(t){const e=[];for(let s,i=0;s=t.childNodes[i];i++)for(let t,i=0;t=s.childNodes[i];i++){e[i]?e[i].push(t):e[i]=[t]}return e}static testColumns_(t,e,s){const i=t[e];return!!i&&(i.some(function(t){return t.childNodes.length&&s(t.childNodes[0])})&&i.every(function(t){return!t.childNodes.length||s(t.childNodes[0])}))}setNodeFactory(t){Yf.getInstance().factory_=t,$f.updateFactory(Yf.getInstance().factory_)}getNodeFactory(){return Yf.getInstance().factory_}identifierNode(t,e,s){if("MathML-Unit"!==s||(i=t,[gm.DEGREE].includes(i.role)||[].includes(i.type))){if(!e&&1===t.textContent.length&&(t.role===gm.INTEGER||t.role===gm.LATINLETTER||t.role===gm.GREEKLETTER)&&t.font===Em.NORMAL)return t.font=Em.ITALIC,$f.run("simpleNamedFunction",t)}else t.type=mm.IDENTIFIER,t.role=gm.UNIT;var i;return t.type===mm.UNKNOWN&&(t.type=mm.IDENTIFIER),Yf.exprFont_(t),$f.run("simpleNamedFunction",t)}implicitNode(t){if(t=Yf.getInstance().getMixedNumbers_(t),t=Yf.getInstance().combineUnits_(t),1===(t=Yf.getInstance().combineScripts_(t)).length)return t[0];const e=Yf.getInstance().implicitNode_(t);return $f.run("combine_juxtaposition",e)}text(t,e){if(Yf.exprFont_(t),t.type=mm.TEXT,e===qm.ANNOTATIONXML)return t.role=gm.ANNOTATION,t;if(e===qm.MS)return t.role=gm.STRING,t;if(e===qm.MSPACE||t.textContent.match(/^\s*$/))return t.role=gm.SPACE,t;if(/\s/.exec(t.textContent))return t.role=gm.TEXT,t;const s=[...t.textContent];if(1!==s.length)return t.role=gm.UNKNOWN,t;const i=Am.Meaning.get(s[0]);return i.type===mm.UNKNOWN||i.type===mm.IDENTIFIER||(t.type=i.type,t.role=i.role,t.font=i.font,t.addAnnotation("general","text")),t}row(t){return 0===(t=t.filter(function(t){return!uf(t,mm.EMPTY)||t.hasAnnotation("empty","MFENCED")})).length?Yf.getInstance().factory_.makeEmptyNode():(t=Yf.getInstance().getFencesInRow_(t),t=Yf.getInstance().tablesInRow(t),t=Yf.getInstance().getPunctuationInRow_(t),t=Yf.getInstance().getTextInRow_(t),t=Yf.getInstance().getFunctionsInRow_(t),Yf.getInstance().relationsInRow_(t))}limitNode(t,e){if(!e.length)return Yf.getInstance().factory_.makeEmptyNode();let s=e[0],{length:i}=Yf.MML_TO_LIMIT_[t];if(e=e.slice(0,i+1),[t,e]=Yf.getInstance().cleanLimitNode(t,e,i),!e[1])return s;let{type:r,length:n}=Yf.MML_TO_LIMIT_[t];if(1===n&&e[1].role===gm.DEGREE)return Yf.getInstance().row([e[0],e[1]]);if($f.run("op_with_limits",e),Df(s)){if(1===n&&ff(e[1])||2===n&&ff(e[1])&&ff(e[2])){let i=Yf.MML_TO_BOUNDS_[t];return Yf.getInstance().accentNode_(s,e,i.type,i.length,i.accent)}if(2===n){if(ff(e[1]))return s=Yf.getInstance().accentNode_(s,[s,e[1]],{MSUBSUP:mm.SUBSCRIPT,MUNDEROVER:mm.UNDERSCORE}[t],1,!0),e[2]?Yf.getInstance().makeLimitNode_(s,[s,e[2]],null,mm.LIMUPPER):s;if(e[2]&&ff(e[2]))return s=Yf.getInstance().accentNode_(s,[s,e[2]],{MSUBSUP:mm.SUPERSCRIPT,MUNDEROVER:mm.OVERSCORE}[t],1,!0),Yf.getInstance().makeLimitNode_(s,[s,e[1]],null,mm.LIMLOWER);e[n]||(r=mm.LIMLOWER)}return Yf.getInstance().makeLimitNode_(s,e,null,r)}const o=Yf.MML_TO_BOUNDS_[t];return Yf.getInstance().accentNode_(s,e,o.type,o.length,o.accent)}cleanLimitNode(t,e,s){const i=t=>(t=>!t||uf(t,mm.EMPTY))(t)||(t=>t&&uf(t,mm.TEXT)&&mf(t,gm.SPACE))(t);if(1===s)return i(e[1])?(e[0].noupdate=!0,[t,[Zf([t],e[0])]]):[t,e];const r=e[1],n=e[2];return i(r)&&i(n)?(e[0].noupdate=!0,[t,[Zf([t],e[0])]]):i(r)?[t===qm.MSUBSUP?qm.MSUP:qm.MOVER,[e[0],n]]:i(n)?[t===qm.MSUBSUP?qm.MSUB:qm.MUNDER,[e[0],r]]:[t,e]}tablesInRow(t){let e=of(t,Mf),s=[];for(let t,i=0;t=e.rel[i];i++)s=s.concat(e.comp.shift()),s.push(Yf.tableToMatrixOrVector_(t));s=s.concat(e.comp.shift()),e=of(s,Rf),s=[];for(let t,i=0;t=e.rel[i];i++){const i=e.comp.shift();wf(0,i)&&Yf.tableToCases_(t,i.pop()),s=s.concat(i),(s.length||e.comp[0].length)&&(t=Yf.rewriteTrivialTable(t)),s.push(t)}return s.concat(e.comp.shift())}mfenced(t,e,s,i){if(s&&i.length>0){const t=Yf.nextSeparatorFunction_(s),e=[i.shift()];i.forEach(s=>{e.push(Yf.getInstance().factory_.makeContentNode(t())),e.push(s)}),i=e}return t&&e?Yf.getInstance().horizontalFencedNode_(Yf.getInstance().factory_.makeContentNode(t),Yf.getInstance().factory_.makeContentNode(e),i):(t&&i.unshift(Yf.getInstance().factory_.makeContentNode(t)),e&&i.push(Yf.getInstance().factory_.makeContentNode(e)),Yf.getInstance().row(i))}fractionLikeNode(t,e,s,i){let r;if(!i&&function(t){if(!t)return!1;if(["negativeveryverythinmathspace","negativeverythinmathspace","negativethinmathspace","negativemediummathspace","negativethickmathspace","negativeverythickmathspace","negativeveryverythickmathspace"].includes(t))return!0;const e=t.match(/[0-9.]+/);return!!e&&0===parseFloat(e[0])}(s)){const s=Yf.getInstance().factory_.makeBranchNode(mm.LINE,[t],[]),i=Yf.getInstance().factory_.makeBranchNode(mm.LINE,[e],[]);return r=Yf.getInstance().factory_.makeBranchNode(mm.MULTILINE,[s,i],[]),Yf.classifyMultiline(r)}return r=Yf.getInstance().fractionNode_(t,e),i&&r.addAnnotation("general","bevelled"),r}tensor(t,e,s,i,r){const n=Yf.getInstance().factory_.makeBranchNode(mm.TENSOR,[t,Yf.getInstance().scriptNode_(e,gm.LEFTSUB),Yf.getInstance().scriptNode_(s,gm.LEFTSUPER),Yf.getInstance().scriptNode_(i,gm.RIGHTSUB),Yf.getInstance().scriptNode_(r,gm.RIGHTSUPER)],[]);return n.role=t.role,n.embellished=Nf(t),n}pseudoTensor(t,e,s){const i=t=>!uf(t,mm.EMPTY),r=e.filter(i).length,n=s.filter(i).length;if(!r&&!n)return t;const o=r?n?qm.MSUBSUP:qm.MSUB:qm.MSUP,a=[t];return r&&a.push(Yf.getInstance().scriptNode_(e,gm.RIGHTSUB,!0)),n&&a.push(Yf.getInstance().scriptNode_(s,gm.RIGHTSUPER,!0)),Yf.getInstance().limitNode(o,a)}font(t){const e=Yf.MATHJAX_FONTS[t];return e||t}proof(t,e,s){if(e.inference||e.axiom||console.log("Noise"),e.axiom){const e=Yf.getInstance().cleanInference(t.childNodes),i=e.length?Yf.getInstance().factory_.makeBranchNode(mm.INFERENCE,s(e),[]):Yf.getInstance().factory_.makeEmptyNode();return i.role=gm.AXIOM,i.mathmlTree=t,i}const i=Yf.getInstance().inference(t,e,s);return e.proof&&(i.role=gm.PROOF,i.childNodes[0].role=gm.FINAL),i}inference(t,e,s){if(e.inferenceRule){const e=Yf.getInstance().getFormulas(t,[],s);return Yf.getInstance().factory_.makeBranchNode(mm.INFERENCE,[e.conclusion,e.premises],[])}const i=e.labelledRule,r=qp(t.childNodes),n=[];"left"!==i&&"both"!==i||n.push(Yf.getInstance().getLabel(t,r,s,gm.LEFT)),"right"!==i&&"both"!==i||n.push(Yf.getInstance().getLabel(t,r,s,gm.RIGHT));const o=Yf.getInstance().getFormulas(t,r,s),a=Yf.getInstance().factory_.makeBranchNode(mm.INFERENCE,[o.conclusion,o.premises],n);return a.mathmlTree=t,a}getLabel(t,e,s,i){const r=Yf.getInstance().findNestedRow(e,"prooflabel",i),n=Yf.getInstance().factory_.makeBranchNode(mm.RULELABEL,s(qp(r.childNodes)),[]);return n.role=i,n.mathmlTree=r,n}getFormulas(t,e,s){const i=e.length?Yf.getInstance().findNestedRow(e,"inferenceRule"):t,r="up"===Yf.getSemantics(i).inferenceRule,n=r?i.childNodes[1]:i.childNodes[0],o=r?i.childNodes[0]:i.childNodes[1],a=n.childNodes[0].childNodes[0],l=qp(a.childNodes[0].childNodes),c=[];let h=1;for(const t of l)h%2&&c.push(t.childNodes[0]),h++;const d=s(c),u=s(qp(o.childNodes[0].childNodes))[0],p=Yf.getInstance().factory_.makeBranchNode(mm.PREMISES,d,[]);p.mathmlTree=a;const m=Yf.getInstance().factory_.makeBranchNode(mm.CONCLUSION,[u],[]);return m.mathmlTree=o.childNodes[0].childNodes[0],{conclusion:m,premises:p}}findNestedRow(t,e,s){return Yf.getInstance().findNestedRow_(t,e,0,s)}cleanInference(t){return qp(t).filter(function(t){return"MSPACE"!==$p(t)})}operatorNode(t){return t.type===mm.UNKNOWN&&(t.type=mm.OPERATOR),$f.run("multioperator",t)}static rewriteTrivialTable(t){return uf(e=t,mm.MULTILINE)&&1===e.childNodes.length&&e.childNodes[0].childNodes.length&&!Of(e.childNodes[0])?Yf.getInstance().unwrapTrivialTable(t):t;var e}unwrapTrivialTable(t){if(!t.childNodes[0].childNodes.length)return Yf.getInstance().factory_.makeEmptyNode();const e=t.childNodes[0].childNodes[0];return e.parent=null,Zf([qm.MTD,qm.MTR,qm.MTABLE],e),e}constructor(){this.funcAppls={},this.splitRoles=new Map([[gm.SUBTRACTION,gm.NEGATIVE],[gm.ADDITION,gm.POSITIVE]]),this.splitOps=["\u2212","-","\u2010","\u2011","+"],this.factory_=new hf,$f.updateFactory(this.factory_)}implicitNode_(t){const e=Yf.getInstance().factory_.makeMultipleContentNodes(t.length-1,vm.invisibleTimes);Yf.matchSpaces_(t,e);const s=Yf.getInstance().infixNode_(t,e[0]);return s.role=gm.IMPLICIT,e.forEach(function(t){t.parent=s}),s.contentNodes=e,s}infixNode_(t,e){let s=Yf.getInstance().factory_.makeBranchNode(mm.INFIXOP,t,[e],rf(e).textContent);return s.role=e.role,s=$f.run("propagateInterval",s),$f.run("propagateSimpleFunction",s)}explicitMixed_(t){const e=of(t,function(t){return t.textContent===vm.invisiblePlus});if(!e.rel.length)return t;let s=[];for(let t,i=0;t=e.rel[i];i++){const r=e.comp[i],n=e.comp[i+1],o=r.length-1;if(r[o]&&n[0]&&uf(r[o],mm.NUMBER)&&!mf(r[o],gm.MIXED)&&uf(n[0],mm.FRACTION)){const t=Yf.getInstance().factory_.makeBranchNode(mm.NUMBER,[r[o],n[0]],[]);t.role=gm.MIXED,s=s.concat(r.slice(0,o)),s.push(t),n.shift()}else s=s.concat(r),s.push(t)}return s.concat(e.comp[e.comp.length-1])}concatNode_(t,e,s){if(0===e.length)return t;const i=e.map(function(t){return rf(t).textContent}).join(" "),r=Yf.getInstance().factory_.makeBranchNode(s,[t],e,i);return e.length>1&&(r.role=gm.MULTIOP),af(r,[t,...e]),r}multiopNode_(t){const e=Yf.getInstance().factory_.makeBranchNode(mm.OPERATOR,t,[]);return e.role=gm.MULTIOP,af(e,t),e}prefixNode_(t,e){const s=this.splitSingles(e);let i=t;for(;s.length>0;){const t=s.pop();i=Yf.getInstance().concatNode_(i,t,mm.PREFIXOP),1===t.length&&-1!==this.splitOps.indexOf(t[0].textContent)&&(i.role=this.splitRoles.get(t[0].role))}return i}splitSingles(t){let e=0;const s=[];let i=0;for(;iuf(t,mm.SUPERSCRIPT)&&uf(t.childNodes[0],mm.EMPTY)||uf(t,mm.SUBSCRIPT)&&uf(t.childNodes[0],mm.EMPTY));if(!e.rel.length)return t;let s=[];do{const t=e.comp.shift(),i=e.rel.shift();if(!t.length){s.push(i);continue}const r=t.pop();uf(r,mm.NUMBER)||uf(r,mm.IDENTIFIER)?(i.childNodes[0]=r,r.parent=i,i.role=r.type.toLowerCase(),i.addAnnotation("collapsed",r.type.toLowerCase()),s=s.concat(t),s.push(i)):uf(r,mm.SUBSCRIPT)&&uf(i,mm.SUPERSCRIPT)?(i.childNodes[0]=r,r.parent=i,i.role=r.type.toLowerCase(),i.addAnnotation("collapsed",r.type.toLowerCase()),r.role=gm.SUBSUP,s=s.concat(t),s.push(i)):(s=s.concat(t),s.push(r),s.push(i))}while(e.rel.length);return s=s.concat(e.comp.pop()),s}combineUnits_(t){const e=of(t,function(t){return!mf(t,gm.UNIT)});if(t.length===e.rel.length)return e.rel;const s=[];let i,r;do{const t=e.comp.shift();i=e.rel.shift();let n=null;r=s.pop(),r&&(t.length&&Uf(r)?t.unshift(r):s.push(r)),1===t.length&&(n=t.pop()),t.length>1&&(n=Yf.getInstance().implicitNode_(t),n.role=gm.UNIT),n&&s.push(n),i&&s.push(i)}while(i);return s}getMixedNumbers_(t){const e=of(t,function(t){return uf(t,mm.FRACTION)&&mf(t,gm.VULGAR)});if(!e.rel.length)return t;let s=[];for(let t,i=0;t=e.rel[i];i++){const r=e.comp[i],n=r.length-1;if(r[n]&&uf(r[n],mm.NUMBER)&&(mf(r[n],gm.INTEGER)||mf(r[n],gm.FLOAT))){const e=Yf.getInstance().factory_.makeBranchNode(mm.NUMBER,[r[n],t],[]);e.role=gm.MIXED,s=s.concat(r.slice(0,n)),s.push(e)}else s=s.concat(r),s.push(t)}return s.concat(e.comp[e.comp.length-1])}getTextInRow_(t){if(0===t.length)return t;if(1===t.length)return t[0].type===mm.TEXT&&t[0].role===gm.UNKNOWN&&(t[0].role=gm.ANNOTATION),t;const{rel:e,comp:s}=of(t,t=>uf(t,mm.TEXT)&&!t.annotation.factor);if(0===e.length)return t;const i=[];let r=s.shift();for(;e.length>0;){let t=e.shift(),n=s.shift();const o=[];for(;!n.length&&e.length&&t.role!==gm.SPACE&&e[0].role!==gm.SPACE;)o.push(t),t=e.shift(),n=s.shift();if(o.length&&(o.push(t),t=Yf.getInstance().dummyNode_(o)),t.role!==gm.UNKNOWN){const e=Qf(r,t,n);if(e){r=e;continue}r.length&&i.push(Yf.getInstance().row(r)),i.push(t),r=n;continue}const a=Am.Meaning.get(t.textContent);if(a.type!==mm.UNKNOWN){t.type=a.type,t.role=a.role,t.font=a.font,t.addAnnotation("general","text"),r.push(t),r=r.concat(n);continue}if(Yf.meaningFromContent(t,(t,e,s)=>{if(t.role===gm.UNKNOWN){if(Yf.numberRole_(t,e,s),t.role===gm.OTHERNUMBER)return s.some(t=>t.type!==mm.NUMBER&&t.type!==mm.IDENTIFIER)?(t.type=mm.TEXT,void(t.role=gm.ANNOTATION)):void(t.role=gm.UNKNOWN);t.type=mm.NUMBER}}),t.role===gm.UNKNOWN&&(e.length||n.length?n.length&&n[0].type===mm.FENCED?(t.type=mm.FUNCTION,t.role=gm.PREFIXFUNC):t.role=gm.TEXT:(t.type=mm.IDENTIFIER,t.role=gm.UNIT)),t.type!==mm.TEXT){r.push(t),r=r.concat(n);continue}const l=Qf(r,t,n);l?r=l:(r.length&&i.push(Yf.getInstance().row(r)),i.push(t),r=n)}return r.length>0&&i.push(Yf.getInstance().row(r)),i.length>1?[Yf.getInstance().dummyNode_(i)]:i}relationsInRow_(t){const e=of(t,Tf),s=e.rel[0];if(!s)return Yf.getInstance().operationsInRow_(t);if(1===t.length)return t[0];const i=e.comp.map(Yf.getInstance().operationsInRow_);let r;return e.rel.some(function(t){return!t.equals(s)})?(r=Yf.getInstance().factory_.makeBranchNode(mm.MULTIREL,i,e.rel),e.rel.every(function(t){return t.role===s.role})&&(r.role=s.role),r):(r=Yf.getInstance().factory_.makeBranchNode(mm.RELSEQ,i,e.rel,rf(s).textContent),r.role=s.role,r)}operationsInRow_(t){if(0===t.length)return Yf.getInstance().factory_.makeEmptyNode();if(1===(t=Yf.getInstance().explicitMixed_(t)).length)return t[0];const e=[];for(;t.length>0&&vf(t[0]);)e.push(t.shift());if(0===t.length)return Yf.getInstance().multiopNode_(e);if(1===t.length)return Yf.getInstance().prefixNode_(t[0],e);const s=nf(t=$f.run("convert_juxtaposition",t),vf),i=Yf.getInstance().wrapFactor(e,s);return Yf.getInstance().addFactor(i,s)}wrapPostfix(t){var e;(null===(e=t.div)||void 0===e?void 0:e.role)===gm.POSTFIXOP&&(t.tail.length&&t.tail[0].type!==mm.OPERATOR?t.div.role=gm.DIVISION:(t.head=[Yf.getInstance().postfixNode_(Yf.getInstance().implicitNode(t.head),[t.div])],t.div=t.tail.shift(),Yf.getInstance().wrapPostfix(t)))}wrapFactor(t,e){return Yf.getInstance().wrapPostfix(e),Yf.getInstance().prefixNode_(Yf.getInstance().implicitNode(e.head),t)}addFactor(t,e){return e.div?Yf.getInstance().operationsTree_(e.tail,t,e.div):(Wf(t)&&(t.role=gm.UNIT),t)}operationsTree_(t,e,s,i=[]){if(0===t.length){if(i.unshift(s),e.type===mm.INFIXOP){const t=Yf.getInstance().postfixNode_(e.childNodes.pop(),i);return e.appendChild(t),e}return Yf.getInstance().postfixNode_(e,i)}const r=nf(t,vf);if(0===r.head.length)return i.push(r.div),Yf.getInstance().operationsTree_(r.tail,e,s,i);const n=Yf.getInstance().wrapFactor(i,r),o=Yf.getInstance().appendOperand_(e,s,n);return Yf.getInstance().addFactor(o,r)}appendOperand_(t,e,s){if(t.type!==mm.INFIXOP)return Yf.getInstance().infixNode_([t,s],e);const i=Yf.getInstance().appendDivisionOp_(t,e,s);return i||(Yf.getInstance().appendExistingOperator_(t,e,s)?t:e.role===gm.MULTIPLICATION?Yf.getInstance().appendMultiplicativeOp_(t,e,s):Yf.getInstance().appendAdditiveOp_(t,e,s))}appendDivisionOp_(t,e,s){return e.role===gm.DIVISION?zf(t)?Yf.getInstance().infixNode_([t,s],e):Yf.getInstance().appendLastOperand_(t,e,s):t.role===gm.DIVISION?Yf.getInstance().infixNode_([t,s],e):null}appendLastOperand_(t,e,s){let i=t,r=t.childNodes[t.childNodes.length-1];for(;r&&r.type===mm.INFIXOP&&!zf(r);)i=r,r=i.childNodes[t.childNodes.length-1];const n=Yf.getInstance().infixNode_([i.childNodes.pop(),s],e);return i.appendChild(n),t}appendMultiplicativeOp_(t,e,s){if(zf(t))return Yf.getInstance().infixNode_([t,s],e);let i=t,r=t.childNodes[t.childNodes.length-1];for(;r&&r.type===mm.INFIXOP&&!zf(r);)i=r,r=i.childNodes[t.childNodes.length-1];const n=Yf.getInstance().infixNode_([i.childNodes.pop(),s],e);return i.appendChild(n),t}appendAdditiveOp_(t,e,s){return Yf.getInstance().infixNode_([t,s],e)}appendExistingOperator_(t,e,s){return!(!t||t.type!==mm.INFIXOP||zf(t))&&(t.contentNodes[0].equals(e)?(t.appendContentNode(e),t.appendChild(s),!0):Yf.getInstance().appendExistingOperator_(t.childNodes[t.childNodes.length-1],e,s))}getFencesInRow_(t){let e=of(t,Af);e=Yf.purgeFences_(e);const s=e.comp.shift();return Yf.getInstance().fences_(e.rel,e.comp,[],[s])}fences_(t,e,s,i){if(0===t.length&&0===s.length)return i[0];const r=$f.run("bracketed_interval",[t[0],t[1],...e[0]||[]],()=>null);if(r){t.shift(),t.shift(),e.shift();const n=i.pop()||[];return i.push([...n,r,...e.shift()]),Yf.getInstance().fences_(t,e,s,i)}const n=t=>mf(t,gm.OPEN);if(0===t.length){const t=i.shift();for(;s.length>0;){if(n(s[0])){const e=s.shift();Yf.fenceToPunct_(e),t.push(e)}else{const e=nf(s,n),r=e.head.length-1,o=Yf.getInstance().neutralFences_(e.head,i.slice(0,r));i=i.slice(r),t.push(...o),e.div&&e.tail.unshift(e.div),s=e.tail}t.push(...i.shift())}return t}const o=s[s.length-1],a=t[0].role;if(a===gm.OPEN||Vf(t[0])&&(!o||!Xf(t[0],o))){s.push(t.shift());const r=e.shift();return r&&i.push(r),Yf.getInstance().fences_(t,e,s,i)}if(o&&a===gm.CLOSE&&o.role===gm.OPEN){const r=Yf.getInstance().horizontalFencedNode_(s.pop(),t.shift(),i.pop());return i.push(i.pop().concat([r],e.shift())),Yf.getInstance().fences_(t,e,s,i)}if(o&&Xf(t[0],o)){if(!Gf(o)||!Jf(t[0])){s.push(t.shift());const r=e.shift();return r&&i.push(r),Yf.getInstance().fences_(t,e,s,i)}const r=Yf.getInstance().horizontalFencedNode_(s.pop(),t.shift(),i.pop());return i.push(i.pop().concat([r],e.shift())),Yf.getInstance().fences_(t,e,s,i)}if(o&&a===gm.CLOSE&&Vf(o)&&s.some(n)){const r=nf(s,n,!0),o=i.pop(),a=i.length-r.tail.length+1,l=Yf.getInstance().neutralFences_(r.tail,i.slice(a));i=i.slice(0,a);const c=Yf.getInstance().horizontalFencedNode_(r.div,t.shift(),i.pop().concat(l,o));return i.push(i.pop().concat([c],e.shift())),Yf.getInstance().fences_(t,e,r.head,i)}const l=t.shift();return Yf.fenceToPunct_(l),i.push(i.pop().concat([l],e.shift())),Yf.getInstance().fences_(t,e,s,i)}neutralFences_(t,e){if(0===t.length)return t;if(1===t.length)return Yf.fenceToPunct_(t[0]),t;const s=t.shift();if(!Gf(s)){Yf.fenceToPunct_(s);const i=e.shift();return i.unshift(s),i.concat(Yf.getInstance().neutralFences_(t,e))}const i=nf(t,function(t){return Xf(t,s)});if(!i.div){Yf.fenceToPunct_(s);const i=e.shift();return i.unshift(s),i.concat(Yf.getInstance().neutralFences_(t,e))}if(!Jf(i.div))return Yf.fenceToPunct_(i.div),t.unshift(s),Yf.getInstance().neutralFences_(t,e);const r=Yf.getInstance().combineFencedContent_(s,i.div,i.head,e);if(i.tail.length>0){const t=r.shift(),e=Yf.getInstance().neutralFences_(i.tail,r);return t.concat(e)}return r[0]}combineFencedContent_(t,e,s,i){if(0===s.length){const s=Yf.getInstance().horizontalFencedNode_(t,e,i.shift());return i.length>0?i[0].unshift(s):i=[[s]],i}const r=i.shift(),n=s.length-1,o=i.slice(0,n),a=(i=i.slice(n)).shift(),l=Yf.getInstance().neutralFences_(s,o);r.push(...l),r.push(...a);const c=Yf.getInstance().horizontalFencedNode_(t,e,r);return i.length>0?i[0].unshift(c):i=[[c]],i}horizontalFencedNode_(t,e,s){const i=Yf.getInstance().row(s);uf(i,mm.EMPTY)&&!i.mathmlTree&&t.mathmlTree&&t.mathmlTree.nextSibling!==e.mathmlTree&&(i.mathmlTree=t.mathmlTree.nextSibling,i.addMathmlNodes([t.mathmlTree.nextSibling]));let r=Yf.getInstance().factory_.makeBranchNode(mm.FENCED,[i],[t,e]);return t.role===gm.OPEN?(Yf.getInstance().classifyHorizontalFence_(r),r=$f.run("propagateComposedFunction",r)):r.role=t.role,r=$f.run("detect_cycle",r),Yf.rewriteFencedNode_(r)}classifyHorizontalFence_(t){if($f.run("interval_heuristic",t),t.role===gm.INTERVAL)return;t.role=gm.LEFTRIGHT;const e=t.childNodes;if(!function(t){return function(t){return!!t&&-1!==["{","\ufe5b","\uff5b"].indexOf(t.textContent)}(t.contentNodes[0])&&function(t){return!!t&&-1!==["}","\ufe5c","\uff5d"].indexOf(t.textContent)}(t.contentNodes[1])}(t)||e.length>1)return;if(0===e.length||e[0].type===mm.EMPTY)return void(t.role=gm.SETEMPTY);const s=e[0].type;if(1===e.length&&_f(e[0]))return void(t.role=gm.SETSINGLE);const i=e[0].role;if(s===mm.PUNCTUATED&&i===gm.SEQUENCE){if(e[0].contentNodes[0].role!==gm.COMMA)return 1!==e[0].contentNodes.length||e[0].contentNodes[0].role!==gm.VBAR&&e[0].contentNodes[0].role!==gm.COLON?void 0:(t.role=gm.SETEXT,void Yf.getInstance().setExtension_(t));t.role=gm.SETCOLLECT}}setExtension_(t){const e=t.childNodes[0].childNodes[0];e&&e.type===mm.INFIXOP&&1===e.contentNodes.length&&Kf(e.contentNodes[0])&&(e.addAnnotation("set","intensional"),e.contentNodes[0].addAnnotation("set","intensional"))}getPunctuationInRow_(t){if(t.length<=1)return t;const e=t=>{const e=t.type;return"punctuation"===e||"text"===e||"operator"===e||"relation"===e},s=of(t,function(s){if(!Cf(s))return!1;if(Cf(s)&&!mf(s,gm.ELLIPSIS))return!0;const i=t.indexOf(s);if(0===i)return!t[1]||!e(t[1]);const r=t[i-1];if(i===t.length-1)return!e(r);const n=t[i+1];return!e(r)||!e(n)});if(0===s.rel.length)return t;let i=[],r=s.comp.shift();r.length>0&&i.push(Yf.getInstance().row(r));let n=0;for(;s.comp.length>0;){let t=[];const e=n;do{t.push(s.rel[n++]),r=s.comp.shift()}while(s.rel[n]&&r&&0===r.length);t=$f.run("ellipses",t),s.rel.splice(e,n-e,...t),n=e+t.length,i=i.concat(t),r&&r.length>0&&i.push(Yf.getInstance().row(r))}return 1===i.length&&1===s.rel.length?i:[Yf.getInstance().punctuatedNode_(i,s.rel)]}punctuatedNode_(t,e){const s=Yf.getInstance().factory_.makeBranchNode(mm.PUNCTUATED,t,e);if(e.length===t.length){const t=e[0].role;if(t!==gm.UNKNOWN&&e.every(function(e){return e.role===t}))return s.role=t,s}const i=e[0];return Pf(t,e,0)?s.role=i.childNodes.length&&!i.embellished?i.role:gm.STARTPUNCT:Pf(t,e,t.length-1)?s.role=i.childNodes.length&&!i.embellished?i.role:gm.ENDPUNCT:e.every(t=>mf(t,gm.DUMMY))?s.role=gm.TEXT:e.every(t=>mf(t,gm.SPACE))?s.role=gm.SPACE:s.role=gm.SEQUENCE,s}dummyNode_(t){const e=Yf.getInstance().factory_.makeMultipleContentNodes(t.length-1,vm.invisibleComma);return e.forEach(function(t){t.role=gm.DUMMY}),Yf.getInstance().punctuatedNode_(t,e)}accentRole_(t,e){if(!ff(t))return!1;const s=t.textContent,i=Am.Secondary.get(s,ym.BAR)||Am.Secondary.get(s,ym.TILDE)||t.role;return t.role=e===mm.UNDERSCORE?gm.UNDERACCENT:gm.OVERACCENT,t.addAnnotation("accent",i),!0}accentNode_(t,e,s,i,r){const n=(e=e.slice(0,i+1))[1],o=e[2];let a;if(!r&&o&&(a=Yf.getInstance().factory_.makeBranchNode(mm.SUBSCRIPT,[t,n],[]),a.role=gm.SUBSUP,e=[a,o],s=mm.SUPERSCRIPT),r){const i=Yf.getInstance().accentRole_(n,s);if(o){Yf.getInstance().accentRole_(o,mm.OVERSCORE)&&!i?(a=Yf.getInstance().factory_.makeBranchNode(mm.OVERSCORE,[t,o],[]),e=[a,n],s=mm.UNDERSCORE):(a=Yf.getInstance().factory_.makeBranchNode(mm.UNDERSCORE,[t,n],[]),e=[a,o],s=mm.OVERSCORE),a.role=gm.UNDEROVER}}return Yf.getInstance().makeLimitNode_(t,e,a,s)}makeLimitNode_(t,e,s,i){if(i===mm.LIMUPPER&&t.type===mm.LIMLOWER)return t.childNodes.push(e[1]),e[1].parent=t,t.type=mm.LIMBOTH,t;if(i===mm.LIMLOWER&&t.type===mm.LIMUPPER)return t.childNodes.splice(1,-1,e[1]),e[1].parent=t,t.type=mm.LIMBOTH,t;const r=Yf.getInstance().factory_.makeBranchNode(i,e,[]),n=Nf(t);return s&&(s.embellished=n),r.embellished=n,r.role=t.role,r}getFunctionsInRow_(t,e){const s=e||[];if(0===t.length)return s;const i=t.shift(),r=Yf.classifyFunction_(i,t);if(!r)return s.push(i),Yf.getInstance().getFunctionsInRow_(t,s);const n=Yf.getInstance().getFunctionsInRow_(t,[]),o=Yf.getInstance().getFunctionArgs_(i,n,r);return s.concat(o)}getFunctionArgs_(t,e,s){let i,r,n;switch(s){case"integral":{const s=Yf.getInstance().getIntegralArgs_(e);if(!s.intvar&&!s.integrand.length)return s.rest.unshift(t),s.rest;const i=Yf.getInstance().row(s.integrand);return n=Yf.getInstance().integralNode_(t,i,s.intvar),$f.run("intvar_from_fraction",n),s.rest.unshift(n),s.rest}case"prefix":if(e[0]&&e[0].type===mm.FENCED){const s=e.shift();return Vf(s)||(s.role=gm.LEFTRIGHT),n=Yf.getInstance().functionNode_(t,s),e.unshift(n),e}if(i=nf(e,gf),i.head.length)r=Yf.getInstance().row(i.head),i.div&&i.tail.unshift(i.div);else{if(!i.div||!uf(i.div,mm.APPL))return e.unshift(t),e;r=i.div}return n=Yf.getInstance().functionNode_(t,r),i.tail.unshift(n),i.tail;case"bigop":return i=nf(e,bf),i.head.length?(r=Yf.getInstance().row(i.head),n=Yf.getInstance().bigOpNode_(t,r),i.div&&i.tail.unshift(i.div),i.tail.unshift(n),i.tail):(e.unshift(t),e);default:{if(0===e.length)return[t];const s=e[0];return s.type===mm.FENCED&&!Vf(s)&&function(t){const e=t.childNodes;if(0===e.length)return!0;if(e.length>1)return!1;const s=e[0];if(s.type===mm.INFIXOP){if(s.role!==gm.IMPLICIT)return!1;if(s.childNodes.some(t=>uf(t,mm.INFIXOP)))return!1}return!0}(s)?(s.role=gm.LEFTRIGHT,Yf.propagateFunctionRole_(t,gm.SIMPLEFUNC),n=Yf.getInstance().functionNode_(t,e.shift()),e.unshift(n),e):(e.unshift(t),e)}}}getIntegralArgs_(t,e=[]){if(0===t.length){const t=nf(e,bf);return t.div&&t.tail.unshift(t.div),{integrand:t.head,intvar:null,rest:t.tail}}$f.run("intvar_from_implicit",t);const s=t[0];if(yf(s)){const{integrand:s,rest:i}=Yf.getInstance().getIntegralArgs_(e);return{integrand:s,intvar:null,rest:i.concat(t)}}if(xf(s))return s.role=gm.INTEGRAL,{integrand:e,intvar:s,rest:t.slice(1)};if(t[1]&&Ef(s,t[1])){const i=Yf.getInstance().prefixNode_(t[1],[s]);return i.role=gm.INTEGRAL,{integrand:e,intvar:i,rest:t.slice(2)}}return e.push(t.shift()),Yf.getInstance().getIntegralArgs_(t,e)}functionNode_(t,e){const s=Yf.getInstance().factory_.makeContentNode(vm.functionApplication),i=Yf.getInstance().funcAppls[t.id];i&&(s.mathmlTree=i.mathmlTree,s.addMathmlNodes(i.mathml),s.annotation=i.annotation,s.attributes=i.attributes,delete Yf.getInstance().funcAppls[t.id]),s.type=mm.PUNCTUATION,s.role=gm.APPLICATION;const r=Yf.getFunctionOp_(t,function(t){return uf(t,mm.FUNCTION)||uf(t,mm.IDENTIFIER)&&mf(t,gm.SIMPLEFUNC)});return Yf.getInstance().functionalNode_(mm.APPL,[t,e],r,[s])}bigOpNode_(t,e){const s=Yf.getFunctionOp_(t,t=>uf(t,mm.LARGEOP));return Yf.getInstance().functionalNode_(mm.BIGOP,[t,e],s,[])}integralNode_(t,e,s){e=e||Yf.getInstance().factory_.makeEmptyNode(),s=s||Yf.getInstance().factory_.makeEmptyNode();const i=Yf.getFunctionOp_(t,t=>uf(t,mm.LARGEOP));return Yf.getInstance().functionalNode_(mm.INTEGRAL,[t,e,s],i,[])}functionalNode_(t,e,s,i){const r=e[0];let n;s&&(n=s.parent,i.push(s));const o=Yf.getInstance().factory_.makeBranchNode(t,e,i);return o.role=r.role,n&&(s.parent=n),o}fractionNode_(t,e){const s=Yf.getInstance().factory_.makeBranchNode(mm.FRACTION,[t,e],[]);return s.role=s.childNodes.every(function(t){return uf(t,mm.NUMBER)&&mf(t,gm.INTEGER)})?gm.VULGAR:s.childNodes.every(Hf)?gm.UNIT:gm.DIVISION,$f.run("propagateSimpleFunction",s)}scriptNode_(t,e,s){let i;switch(t.length){case 0:i=Yf.getInstance().factory_.makeEmptyNode();break;case 1:if(i=t[0],s)return i;break;default:i=Yf.getInstance().dummyNode_(t),i.addAnnotation("general","script")}return i.role=e,i}findNestedRow_(t,e,s,i){if(s>3)return null;for(let r,n=0;r=t[n];n++){const t=$p(r);if(t!==qm.MSPACE){if(t===qm.MROW)return Yf.getInstance().findNestedRow_(qp(r.childNodes),e,s+1,i);if(Yf.findSemantics(r,e,i))return r}}return null}}function Qf(t,e,s){const i=t[t.length-1];if(i&&(i.type===mm.RELATION||i.type===mm.OPERATOR))return e.addAnnotation("factor",i.type),[...t,e,...s];const r=s[0];return!r||r.type!==mm.RELATION&&r.type!==mm.OPERATOR?null:(e.addAnnotation("factor",r.type),[...t,e,...s])}function Zf(t,e){return t.forEach(t=>e.addAnnotation("empty",t)),e}Yf.FENCE_TO_PUNCT_={[gm.METRIC]:gm.METRIC,[gm.NEUTRAL]:gm.VBAR,[gm.OPEN]:gm.OPENFENCE,[gm.CLOSE]:gm.CLOSEFENCE},Yf.MML_TO_LIMIT_={[qm.MSUB]:{type:mm.LIMLOWER,length:1},[qm.MUNDER]:{type:mm.LIMLOWER,length:1},[qm.MSUP]:{type:mm.LIMUPPER,length:1},[qm.MOVER]:{type:mm.LIMUPPER,length:1},[qm.MSUBSUP]:{type:mm.LIMBOTH,length:2},[qm.MUNDEROVER]:{type:mm.LIMBOTH,length:2}},Yf.MML_TO_BOUNDS_={[qm.MSUB]:{type:mm.SUBSCRIPT,length:1,accent:!1},[qm.MSUP]:{type:mm.SUPERSCRIPT,length:1,accent:!1},[qm.MSUBSUP]:{type:mm.SUBSCRIPT,length:2,accent:!1},[qm.MUNDER]:{type:mm.UNDERSCORE,length:1,accent:!0},[qm.MOVER]:{type:mm.OVERSCORE,length:1,accent:!0},[qm.MUNDEROVER]:{type:mm.UNDERSCORE,length:2,accent:!0}},Yf.CLASSIFY_FUNCTION_={[gm.INTEGRAL]:"integral",[gm.SUM]:"bigop",[gm.PREFIXFUNC]:"prefix",[gm.LIMFUNC]:"prefix",[gm.SIMPLEFUNC]:"prefix",[gm.COMPFUNC]:"prefix"},Yf.MATHJAX_FONTS={"-tex-caligraphic":Em.CALIGRAPHIC,"-tex-caligraphic-bold":Em.CALIGRAPHICBOLD,"-tex-calligraphic":Em.CALIGRAPHIC,"-tex-calligraphic-bold":Em.CALIGRAPHICBOLD,"-tex-oldstyle":Em.OLDSTYLE,"-tex-oldstyle-bold":Em.OLDSTYLEBOLD,"-tex-mathit":Em.ITALIC};class tg extends df{static getAttribute_(t,e,s){if(!t.hasAttribute(e))return s;const i=t.getAttribute(e);return i.match(/^\s*$/)?null:i}constructor(t){super("MathML"),this.options=t,$f.options=t,this.parseMap_=new Map([[qm.SEMANTICS,this.semantics_.bind(this)],[qm.MATH,this.rows_.bind(this)],[qm.MROW,this.rows_.bind(this)],[qm.MPADDED,this.rows_.bind(this)],[qm.MSTYLE,this.rows_.bind(this)],[qm.MFRAC,this.fraction_.bind(this)],[qm.MSUB,this.limits_.bind(this)],[qm.MSUP,this.limits_.bind(this)],[qm.MSUBSUP,this.limits_.bind(this)],[qm.MOVER,this.limits_.bind(this)],[qm.MUNDER,this.limits_.bind(this)],[qm.MUNDEROVER,this.limits_.bind(this)],[qm.MROOT,this.root_.bind(this)],[qm.MSQRT,this.sqrt_.bind(this)],[qm.MTABLE,this.table_.bind(this)],[qm.MLABELEDTR,this.tableLabeledRow_.bind(this)],[qm.MTR,this.tableRow_.bind(this)],[qm.MTD,this.tableCell_.bind(this)],[qm.MS,this.text_.bind(this)],[qm.MTEXT,this.text_.bind(this)],[qm.MSPACE,this.space_.bind(this)],[qm.ANNOTATIONXML,this.text_.bind(this)],[qm.MI,this.identifier_.bind(this)],[qm.MN,this.number_.bind(this)],[qm.MO,this.operator_.bind(this)],[qm.MFENCED,this.fenced_.bind(this)],[qm.MENCLOSE,this.enclosed_.bind(this)],[qm.MMULTISCRIPTS,this.multiscripts_.bind(this)],[qm.ANNOTATION,this.empty_.bind(this)],[qm.NONE,this.empty_.bind(this)],[qm.MACTION,this.action_.bind(this)],[qm.MPHANTOM,this.phantom_.bind(this)]]);const e={type:mm.IDENTIFIER,role:gm.NUMBERSET,font:Em.DOUBLESTRUCK};["C","H","N","P","Q","R","Z","\u2102","\u210d","\u2115","\u2119","\u211a","\u211d","\u2124"].forEach((t=>this.getFactory().defaultMap.set(t,e)).bind(this))}parse(t){Yf.getInstance().setNodeFactory(this.getFactory());const e=qp(t.childNodes),s=$p(t),i=this.parseMap_.get(s),r=(i||this.dummy_.bind(this))(t,e);return r.noupdate?r:(sf(r,t),-1!==[qm.MATH,qm.MROW,qm.MPADDED,qm.MSTYLE,qm.SEMANTICS,qm.MACTION].indexOf(s)||(r.mathml.unshift(t),r.mathmlTree=t),r)}semantics_(t,e){return e.length?this.parse(e[0]):this.getFactory().makeEmptyNode()}rows_(t,e){const s=t.getAttribute("semantics");if(s&&s.match("bspr_"))return Yf.proof(t,s,this.parseList.bind(this));let i;if(1===(e=ef(e)).length)i=this.parse(e[0]),i.type!==mm.EMPTY||i.mathmlTree||(i.mathmlTree=t);else{const s=$f.run("function_from_identifiers",t);i=s&&s!==t?s:Yf.getInstance().row(this.parseList(e))}return i.mathml.unshift(t),i}fraction_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();const s=this.parse(e[0]),i=e[1]?this.parse(e[1]):this.getFactory().makeEmptyNode();return Yf.getInstance().fractionLikeNode(s,i,t.getAttribute("linethickness"),"true"===t.getAttribute("bevelled"))}limits_(t,e){return Yf.getInstance().limitNode($p(t),this.parseList(e))}root_(t,e){return e[1]?this.getFactory().makeBranchNode(mm.ROOT,[this.parse(e[1]),this.parse(e[0])],[]):this.sqrt_(t,e)}sqrt_(t,e){const s=this.parseList(ef(e));return this.getFactory().makeBranchNode(mm.SQRT,[Yf.getInstance().row(s)],[])}table_(t,e){const s=t.getAttribute("semantics");if(s&&s.match("bspr_"))return Yf.proof(t,s,this.parseList.bind(this));const i=this.getFactory().makeBranchNode(mm.TABLE,this.parseList(e),[]);return i.mathmlTree=t,Yf.tableToMultiline(i)}tableRow_(t,e){const s=this.getFactory().makeBranchNode(mm.ROW,this.parseList(e),[]);return s.role=gm.TABLE,s}tableLabeledRow_(t,e){var s;if(!e.length)return this.tableRow_(t,e);const i=this.parse(e[0]);i.role=gm.LABEL,(null===(s=i.childNodes[0])||void 0===s?void 0:s.type)===mm.TEXT&&(i.childNodes[0].role=gm.LABEL);const r=this.getFactory().makeBranchNode(mm.ROW,this.parseList(e.slice(1)),[i]);return r.role=gm.TABLE,r}tableCell_(t,e){const s=this.parseList(ef(e));let i;i=s.length?1===s.length&&uf(s[0],mm.EMPTY)?s:[Yf.getInstance().row(s)]:[];const r=this.getFactory().makeBranchNode(mm.CELL,i,[]);return r.role=gm.TABLE,r}phantom_(t,e){let s;return e.length?(s=this.getFactory().makeUnprocessed(t),s.type=mm.TEXT,s.role=gm.SPACE):s=this.empty_(t,e),s}space_(t,e){const s=t.getAttribute("width"),i=s&&s.match(/[a-z]*$/);if(!i)return this.empty_(t,e);const r=i[0],n=parseFloat(s.slice(0,i.index)),o={cm:.4,pc:.5,em:.5,ex:1,in:.15,pt:5,mm:5}[r];if(!o||isNaN(n)||n{uf(t,mm.EMPTY)&&t.addAnnotation("empty","MFENCED")});const i=tg.getAttribute_(t,"separators",","),r=tg.getAttribute_(t,"open","("),n=tg.getAttribute_(t,"close",")"),o=Yf.getInstance().mfenced(r,n,i,s);o.mathmlTree=t,o.addMathmlNodes([t]);return Yf.getInstance().tablesInRow([o])[0]}enclosed_(t,e){const s=this.parseList(ef(e)),i=this.getFactory().makeBranchNode(mm.ENCLOSE,[Yf.getInstance().row(s)],[]);return i.role=t.getAttribute("notation")||gm.UNKNOWN,i}multiscripts_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();const s=this.parse(e.shift());if(!e.length)return s;const i=[],r=[],n=[],o=[];let a=!1,l=0;for(let t,s=0;t=e[s];s++)$p(t)!==qm.MPRESCRIPTS?(a?1&l?i.push(t):r.push(t):1&l?n.push(t):o.push(t),l++):(a=!0,l=0);return ef(i).length||ef(r).length?Yf.getInstance().tensor(s,this.parseList(r),this.parseList(i),this.parseList(o),this.parseList(n)):Yf.getInstance().pseudoTensor(s,this.parseList(o),this.parseList(n))}empty_(t,e){const s=this.getFactory().makeEmptyNode();return s.addMathmlNodes([t]),s.mathmlTree=t,s}action_(t,e){const s=e[t.hasAttribute("selection")?parseInt(t.getAttribute("selection"),10)-1:0],i=this.parse(s);return i.mathmlTree=s,i}dummy_(t,e){const s=this.getFactory().makeUnprocessed(t);return s.role=t.tagName,s.textContent=t.textContent,s}leaf_(t,e){if(1===e.length&&e[0].nodeType!==zp.TEXT_NODE){const s=this.getFactory().makeUnprocessed(t);return s.role=e[0].tagName,sf(s,e[0]),s}const s=this.getFactory().makeLeafNode(t.textContent,Yf.getInstance().font(t.getAttribute("mathvariant")));return t.hasAttribute("data-latex")&&Am.LatexCommands.set(t.getAttribute("data-latex"),t.textContent),s}}class eg{constructor(t,e,s=t=>!1){this.name=t,this.apply=e,this.applicable=s}}class sg extends eg{}class ig extends eg{}function rg(t,e){const s=[];for(;t.length||e.length;)t.length&&s.push(t.shift()),e.length&&s.push(e.shift());return s}const ng="data-semantic-";var og;!function(t){t.ADDED="data-semantic-added",t.ALTERNATIVE="data-semantic-alternative",t.CHILDREN="data-semantic-children",t.COLLAPSED="data-semantic-collapsed",t.CONTENT="data-semantic-content",t.EMBELLISHED="data-semantic-embellished",t.FENCEPOINTER="data-semantic-fencepointer",t.FONT="data-semantic-font",t.ID="data-semantic-id",t.ANNOTATION="data-semantic-annotation",t.ATTRIBUTES="data-semantic-attributes",t.OPERATOR="data-semantic-operator",t.OWNS="data-semantic-owns",t.PARENT="data-semantic-parent",t.POSTFIX="data-semantic-postfix",t.PREFIX="data-semantic-prefix",t.ROLE="data-semantic-role",t.SPEECH="data-semantic-speech",t.STRUCTURE="data-semantic-structure",t.SUMMARY="data-semantic-summary",t.TYPE="data-semantic-type"}(og||(og={}));const ag=[og.ADDED,og.ALTERNATIVE,og.CHILDREN,og.COLLAPSED,og.CONTENT,og.EMBELLISHED,og.FENCEPOINTER,og.FONT,og.ID,og.ANNOTATION,og.ATTRIBUTES,og.OPERATOR,og.OWNS,og.PARENT,og.POSTFIX,og.PREFIX,og.ROLE,og.SPEECH,og.STRUCTURE,og.SUMMARY,og.TYPE];function lg(t){return t.map(function(t){return t.id}).join(",")}function cg(t,e){t.setAttribute(og.TYPE,e.type);const s=e.allAttributes();for(let e,i=0;e=s[i];i++)t.setAttribute(ng+e[0].toLowerCase(),e[1]);e.childNodes.length&&t.setAttribute(og.CHILDREN,lg(e.childNodes)),e.contentNodes.length&&t.setAttribute(og.CONTENT,lg(e.contentNodes)),e.parent&&t.setAttribute(og.PARENT,e.parent.id.toString());const i=e.attributesXml();i&&t.setAttribute(og.ATTRIBUTES,i),function(t,e){const s=[];e.role===gm.MGLYPH&&s.push("image");e.attributes.href&&s.push("link");s.length&&t.setAttribute(og.POSTFIX,s.join(" "))}(t,e)}function hg(){const t=Gp("mrow");return t.setAttribute(og.ADDED,"true"),t}class dg{static fromTree(t){return dg.fromNode(t.root)}static fromNode(t){return new dg(dg.fromNode_(t))}static fromString(t){return new dg(dg.fromString_(t))}static simpleCollapseStructure(t){return"number"==typeof t}static contentCollapseStructure(t){return!!t&&!dg.simpleCollapseStructure(t)&&"c"===t[0]}static interleaveIds(t,e){return rg(dg.collapsedLeafs(t),dg.collapsedLeafs(e))}static collapsedLeafs(...t){return t.reduce((t,e)=>{return t.concat((s=e,dg.simpleCollapseStructure(s)?[s]:dg.contentCollapseStructure(s[1])?s.slice(2):s.slice(1)));var s},[])}static fromStructure(t,e,s){return new dg(dg.tree_(t,e.root,s))}static combineContentChildren(t,e,s,i){switch(t){case mm.RELSEQ:case mm.INFIXOP:case mm.MULTIREL:return rg(i,s);case mm.PREFIXOP:return s.concat(i);case mm.POSTFIXOP:return i.concat(s);case mm.MATRIX:case mm.VECTOR:case mm.FENCED:return i.unshift(s[0]),i.push(s[1]),i;case mm.CASES:return i.unshift(s[0]),i;case mm.APPL:return[i[0],s[0],i[1]];case mm.ROOT:return[i[0],i[1]];case mm.ROW:case mm.LINE:return s.length&&i.push(s[0]),i;default:return i}}static makeSexp_(t){return dg.simpleCollapseStructure(t)?t.toString():dg.contentCollapseStructure(t)?"(c "+t.slice(1).map(dg.makeSexp_).join(" ")+")":"("+t.map(dg.makeSexp_).join(" ")+")"}static fromString_(t){let e=t.replace(/\(/g,"[");return e=e.replace(/\)/g,"]"),e=e.replace(/ /g,","),e=e.replace(/c/g,'"c"'),JSON.parse(e)}static fromNode_(t){if(!t)return[];const e=t.contentNodes;let s;e.length&&(s=e.map(dg.fromNode_),s.unshift("c"));const i=t.childNodes;if(!i.length)return e.length?[t.id,s]:t.id;const r=i.map(dg.fromNode_);return e.length&&r.unshift(s),r.unshift(t.id),r}static tree_(t,e,s,i=0,r=1,n=1){if(!e)return[];const o=e.id,a=[o];!function(t){if(Bp.getInstance().mode!==ap.HTTP)return;let e=t;for(;e&&!e.evaluate;)e=e.parentNode;e&&e.evaluate?jp.currentDocument=e:t.ownerDocument&&(jp.currentDocument=t.ownerDocument)}(t);const l=function(t,e){let s;try{s=Wp(t,e,jp.result.ORDERED_NODE_ITERATOR_TYPE)}catch(t){return[]}const i=[];for(let t=s.iterateNext();t;t=s.iterateNext())i.push(t);return i}(`.//self::*[@${og.ID}=${o}]`,t)[0];if(!e.childNodes.length)return dg.addAria(l,i,r,n,s),e.id;const c=dg.combineContentChildren(e.type,e.role,e.contentNodes.map(function(t){return t}),e.childNodes.map(function(t){return t}));l&&dg.addOwns_(l,c);for(let e,r=0,n=c.length;e=c[r];r++)a.push(dg.tree_(t,e,s,i+1,r+1,n));return dg.addAria(l,i,r,n,s),a}static addAria(t,e,s,i,r){const n=r.tree?e?"treeitem":"tree":"treeitem";r.aria&&t&&(t.setAttribute("aria-level",e.toString()),t.setAttribute("aria-posinset",s.toString()),t.setAttribute("aria-setsize",i.toString()),t.setAttribute("role",n),t.hasAttribute(og.OWNS)&&t.setAttribute("aria-owns",t.getAttribute(og.OWNS)))}static addOwns_(t,e){const s=t.getAttribute(og.COLLAPSED),i=s?dg.realLeafs_(dg.fromString(s).array):e.map(t=>t.id);t.setAttribute(og.OWNS,i.join(" "))}static realLeafs_(t){if(dg.simpleCollapseStructure(t))return[t];if(dg.contentCollapseStructure(t))return[];let e=[];for(let s=1;sdg.simpleCollapseStructure(t)?t:dg.contentCollapseStructure(t)?t[1]:t[0])}subtreeNodes(t){if(!this.isRoot(t))return[];const e=(t,s)=>{dg.simpleCollapseStructure(t)?s.push(t):(dg.contentCollapseStructure(t)&&(t=t.slice(1)),t.forEach(t=>e(t,s)))},s=this.levelsMap[t],i=[];return e(s.slice(1),i),i}}function ug(t,e,s){let i=null;if(!t.length)return i;const r=s[s.length-1],n=r&&r.length,o=e&&e.length,a=Yf.getInstance();if(n&&o){if(e[0].type===mm.INFIXOP&&e[0].role===gm.IMPLICIT)return i=t.pop(),r.push(a.postfixNode_(r.pop(),t)),i;i=t.shift();const s=a.prefixNode_(e.shift(),t);return e.unshift(s),i}return n?(r.push(a.postfixNode_(r.pop(),t)),i):(o&&e.unshift(a.prefixNode_(e.shift(),t)),i)}function pg(t,e,s){if(!e.length)return t;const i=t.pop(),r=e.shift(),n=s.shift();if(r.type===mm.INFIXOP&&(r.role===gm.IMPLICIT||r.role===gm.UNIT)){wp.getInstance().output("Juxta Heuristic Case 2");const o=(i?[i,r]:[r]).concat(n);return pg(t.concat(o),e,s)}if(!i)return wp.getInstance().output("Juxta Heuristic Case 3"),pg([r].concat(n),e,s);const o=n.shift();if(!o){wp.getInstance().output("Juxta Heuristic Case 9");const n=$f.factory.makeBranchNode(mm.INFIXOP,[i,e.shift()],[r],r.textContent);return n.role=gm.IMPLICIT,$f.run("combine_juxtaposition",n),e.unshift(n),pg(t,e,s)}if(vf(i)||vf(o))return wp.getInstance().output("Juxta Heuristic Case 4"),pg(t.concat([i,r,o]).concat(n),e,s);let a=null;return qf(i)&&qf(o)?(wp.getInstance().output("Juxta Heuristic Case 5"),i.contentNodes.push(r),i.contentNodes=i.contentNodes.concat(o.contentNodes),i.childNodes.push(o),i.childNodes=i.childNodes.concat(o.childNodes),o.childNodes.forEach(t=>t.parent=i),r.parent=i,i.addMathmlNodes(r.mathml),i.addMathmlNodes(o.mathml),a=i):qf(i)?(wp.getInstance().output("Juxta Heuristic Case 6"),i.contentNodes.push(r),i.childNodes.push(o),o.parent=i,r.parent=i,i.addMathmlNodes(r.mathml),i.addMathmlNodes(o.mathml),a=i):qf(o)?(wp.getInstance().output("Juxta Heuristic Case 7"),o.contentNodes.unshift(r),o.childNodes.unshift(i),i.parent=o,r.parent=o,o.addMathmlNodes(r.mathml),o.addMathmlNodes(i.mathml),a=o):(wp.getInstance().output("Juxta Heuristic Case 8"),a=$f.factory.makeBranchNode(mm.INFIXOP,[i,o],[r],r.textContent),a.role=gm.IMPLICIT),t.push(a),pg(t.concat(n),e,s)}function mg(t){return t.childNodes[0]&&t.childNodes[0].childNodes[0]&&$p(t.childNodes[0])===qm.MPADDED&&$p(t.childNodes[0].childNodes[0])===qm.MPADDED&&$p(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1])===qm.MPHANTOM}$f.add(new sg("combine_juxtaposition",function(t){for(let e,s=t.childNodes.length-1;e=t.childNodes[s];s--)qf(e)&&!e.nobreaking&&(t.childNodes.splice(s,1,...e.childNodes),t.contentNodes.splice(s,0,...e.contentNodes),e.childNodes.concat(e.contentNodes).forEach(function(e){e.parent=t}),t.addMathmlNodes(e.mathml));return t})),$f.add(new sg("propagateSimpleFunction",t=>(t.type!==mm.INFIXOP&&t.type!==mm.FRACTION||!t.childNodes.every(Bf)||(t.role=gm.COMPFUNC),t),t=>"clearspeak"===$f.options.domain)),$f.add(new sg("simpleNamedFunction",t=>(t.role!==gm.UNIT&&-1!==["f","g","h","F","G","H"].indexOf(t.textContent)&&(t.role=gm.SIMPLEFUNC),t),t=>"clearspeak"===$f.options.domain)),$f.add(new sg("propagateComposedFunction",t=>(t.type===mm.FENCED&&t.childNodes[0].role===gm.COMPFUNC&&(t.role=gm.COMPFUNC),t),t=>"clearspeak"===$f.options.domain)),$f.add(new sg("multioperator",t=>{t.role!==gm.UNKNOWN||t.textContent.length<=1||(Yf.compSemantics(t,"role",gm),Yf.compSemantics(t,"type",mm))})),$f.add(new ig("convert_juxtaposition",t=>{let e=of(t,function(t){return t.textContent===vm.invisibleTimes&&t.type===mm.OPERATOR});e=e.rel.length?function(t){const e=[],s=[];let i=t.comp.shift(),r=null,n=[];for(;t.comp.length;)if(n=[],i.length)r&&e.push(r),s.push(i),r=t.rel.shift(),i=t.comp.shift();else{for(r&&n.push(r);!i.length&&t.comp.length;)i=t.comp.shift(),n.push(t.rel.shift());r=ug(n,i,s)}n.length||i.length?(e.push(r),s.push(i)):(n.push(r),ug(n,i,s));return{rel:e,comp:s}}(e):e,t=e.comp[0];for(let s,i,r=1;s=e.comp[r],i=e.rel[r-1];r++)t.push(i),t=t.concat(s);return e=of(t,function(t){return t.textContent===vm.invisibleTimes&&(t.type===mm.OPERATOR||t.type===mm.INFIXOP)}),e.rel.length?pg(e.comp.shift(),e.rel,e.comp):t})),$f.add(new sg("simple2prefix",t=>(t.textContent.length>1&&!t.textContent[0].match(/[A-Z]/)&&(t.role=gm.PREFIXFUNC),t),t=>"braille"===$f.options.modality&&t.type===mm.IDENTIFIER)),$f.add(new sg("detect_cycle",t=>{t.type=mm.MATRIX,t.role=gm.CYCLE;const e=t.childNodes[0];return e.type=mm.ROW,e.role=gm.CYCLE,e.textContent="",e.contentNodes=[],t},t=>t.type===mm.FENCED&&t.childNodes[0].type===mm.INFIXOP&&t.childNodes[0].role===gm.IMPLICIT&&t.childNodes[0].childNodes.every(function(t){return t.type===mm.NUMBER})&&t.childNodes[0].contentNodes.every(function(t){return t.role===gm.SPACE}))),$f.add(new ig("intvar_from_implicit",function(t){const e=t[0].childNodes;t.splice(0,1,...e),t.forEach(t=>t.parent=null)},t=>t[0]&&zf(t[0]))),$f.add(new sg("intvar_from_fraction",function(t){const e=t.childNodes[1],s=e.childNodes[0];if(xf(s))return void(s.role=gm.INTEGRAL);if(!zf(s))return;const i=s.childNodes.length,r=s.childNodes[i-2],n=s.childNodes[i-1];if(xf(n))return void(n.role=gm.INTEGRAL);if(Ef(r,n)){const t=Yf.getInstance().prefixNode_(n,[r]);t.role=gm.INTEGRAL,2===i?e.childNodes[0]=t:(s.childNodes.pop(),s.contentNodes.pop(),s.childNodes[i-2]=t,t.parent=s)}},t=>{if(t.type!==mm.INTEGRAL)return!1;const[,e,s]=t.childNodes;return s.type===mm.EMPTY&&e.type===mm.FRACTION})),$f.add(new sg("rewrite_subcases",function(t){t.addAnnotation("Emph","top");let e=[];if(t.hasAnnotation("Emph","left")){const s=gg(t.childNodes[0].childNodes[0].childNodes[0],!0);s.forEach(t=>t.addAnnotation("Emph","left")),e=e.concat(s);for(let e,s=0;e=t.childNodes[s];s++)e.childNodes.shift()}if(e.push(t),t.hasAnnotation("Emph","right")){const s=gg(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1].childNodes[0]);s.forEach(t=>t.addAnnotation("Emph","left")),e=e.concat(s),t.childNodes[0].childNodes.pop()}Yf.tableToMultiline(t);const s=Yf.getInstance().row(e),i=t.annotation.Emph;return t.annotation.Emph=["table"],i.forEach(t=>s.addAnnotation("Emph",t)),s},t=>{let e=!0,s=!0;const i=t.childNodes[0].childNodes[0];if(!i)return!1;if(mg(i.mathmlTree)){for(let s,i=1;s=t.childNodes[i];i++)if(s.childNodes[0].childNodes.length){e=!1;break}}else e=!1;e&&t.addAnnotation("Emph","left");if(mg(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1].mathmlTree)){const e=t.childNodes[0].childNodes.length;for(let i,r=1;i=t.childNodes[r];r++)if(i.childNodes.length>=e){s=!1;break}}else s=!1;return s&&t.addAnnotation("Emph","right"),e||s}));const fg=[mm.PUNCTUATED,mm.RELSEQ,mm.MULTIREL,mm.INFIXOP,mm.PREFIXOP,mm.POSTFIXOP];function gg(t,e){if(!t.childNodes.length)return Eg(t),[t];let s=null;if(t.type===mm.PUNCTUATED&&(e?t.role===gm.ENDPUNCT:t.role===gm.STARTPUNCT)){const i=t.childNodes;Eg(i[e?i.length-1:0])&&(t=i[e?0:i.length-1],s=i[e?i.length-1:0])}if(-1!==fg.indexOf(t.type)){const i=t.childNodes;Eg(i[e?i.length-1:0]);const r=dg.combineContentChildren(t.type,t.role,t.contentNodes,t.childNodes);return s&&(e?r.push(s):r.unshift(s)),r}return s?e?[t,s]:[s,t]:[t]}const bg={[gm.METRIC]:gm.METRIC,[gm.VBAR]:gm.NEUTRAL,[gm.OPENFENCE]:gm.OPEN,[gm.CLOSEFENCE]:gm.CLOSE};function Eg(t){if(t.type!==mm.PUNCTUATION)return!1;const e=bg[t.role];return!!e&&(t.role=e,t.type=mm.FENCE,t.addAnnotation("Emph","fence"),!0)}function xg(t,e,s,i=s){const r=[];for(;t&&t.role===s;)r.push(t),t=e.shift();return r.length?(t&&e.unshift(t),[1===r.length?r[0]:yg(r,i),e]):[t,e]}function yg(t,e){const s=$f.factory.makeBranchNode(mm.PUNCTUATION,t,[]);return s.role=e,s}function Ng(t){return["[","\uff3b"].includes(t)}function vg(t){return["]","\uff3d"].includes(t)}function Tg(t){return["(","\u207d","\u208d"].includes(t)}function Cg(t){return[")","\u207e","\u208e"].includes(t)}function Ag(t){return t.role===gm.INFTY||t.type===mm.PREFIXOP&&t.childNodes[0].role===gm.INFTY}function Lg(t){const e=t.childNodes[0];if(t.type!==mm.FENCED||(null==e?void 0:e.type)!==mm.PUNCTUATED||3!==(null==e?void 0:e.childNodes.length)||1!==(null==e?void 0:e.contentNodes.length)||(null==e?void 0:e.childNodes[1].role)!==gm.COMMA)return!1;const s=t.childNodes[0].childNodes[0],i=t.childNodes[0].childNodes[2],r=t.contentNodes[0].textContent,n=t.contentNodes[1].textContent;return!!(Ng(r)&&Cg(n)||Tg(r)&&vg(n))||!(!Tg(r)||!Cg(n)||!Ag(s)&&!Ag(i))}function Sg(t){return wg(t)||function(t){return Mg(t)||t.type===mm.INFIXOP&&t.role===gm.IMPLICIT&&(2===t.childNodes.length&&(Mg(t.childNodes[0])||wg(t.childNodes[0]))&&Mg(t.childNodes[1])||3===t.childNodes.length&&wg(t.childNodes[0])&&Mg(t.childNodes[1])&&Mg(t.childNodes[2]))}(t)||function(t){return t.type===mm.PUNCTUATED&&t.role===gm.ENDPUNCT&&2===t.childNodes.length&&t.childNodes[1].role===gm.DEGREE&&(Mg(t.childNodes[0])||Ig(t.childNodes[0])||t.childNodes[0].type===mm.PREFIXOP&&t.childNodes[0].role===gm.NEGATIVE&&(Mg(t.childNodes[0].childNodes[0])||Ig(t.childNodes[0].childNodes[0])))}(t)||function(t){return t.type===mm.PREFIXOP&&t.role===gm.NEGATIVE&&Rg(t.childNodes[0])&&t.childNodes[0].type!==mm.PREFIXOP&&t.childNodes[0].type!==mm.APPL&&t.childNodes[0].type!==mm.PUNCTUATED}(t)||function(t){return t.type===mm.APPL&&(t.childNodes[0].role===gm.PREFIXFUNC||t.childNodes[0].role===gm.SIMPLEFUNC)&&(Rg(t.childNodes[1])||t.childNodes[1].type===mm.FENCED&&Rg(t.childNodes[1].childNodes[0]))}(t)}function Rg(t){return t.hasAnnotation("clearspeak","simple")}function Mg(t){return t.type===mm.IDENTIFIER&&(t.role===gm.LATINLETTER||t.role===gm.GREEKLETTER||t.role===gm.OTHERLETTER||t.role===gm.SIMPLEFUNC)}function Ig(t){return t.type===mm.NUMBER&&(t.role===gm.INTEGER||t.role===gm.FLOAT)}function wg(t){return Ig(t)||function(t){if(kg("Fraction_Over")||kg("Fraction_FracOver"))return!1;if(t.type!==mm.FRACTION||t.role!==gm.VULGAR)return!1;if(kg("Fraction_Ordinal"))return!0;const e=parseInt(t.childNodes[0].textContent,10),s=parseInt(t.childNodes[1].textContent,10);return e>0&&e<20&&s>0&&s<11}(t)}function kg(t){return Bp.getInstance().options.style===t}function Og(t){return t.type===mm.TEXT&&t.role!==gm.LABEL||t.type===mm.PUNCTUATED&&t.role===gm.TEXT&&Ig(t.childNodes[0])&&function(t){for(let e=0;e{const e=[];let s=t.shift();for(;s;)[s,t]=xg(s,t,gm.FULLSTOP,gm.ELLIPSIS),[s,t]=xg(s,t,gm.DASH),e.push(s),s=t.shift();return e},t=>t.length>1)),$f.add(new ig("op_with_limits",t=>{const e=t[0];return e.type=mm.LARGEOP,e.role=gm.SUM,t},t=>(t[0].type===mm.OPERATOR||t[0].type===mm.IDENTIFIER&&"OP"===t[0].attributes.texclass)&&t.slice(1).some(t=>t.type===mm.RELSEQ||t.type===mm.MULTIREL||t.type===mm.INFIXOP&&t.role===gm.ELEMENT||t.type===mm.PUNCTUATED&&t.role===gm.SEQUENCE))),$f.add(new class extends eg{}("function_from_identifiers",t=>{const e=qp(t.childNodes).map(t=>t.textContent.trim()).join("");if(Am.Meaning.get(e).type===mm.UNKNOWN)return t;const s=$f.factory.makeLeafNode(e,Yf.getInstance().font(t.getAttribute("mathvariant")));return s.mathmlTree=t,s},t=>{const e=qp(t.childNodes);return!(e.length<2)&&e.every(t=>$p(t)===qm.MI&&Am.Meaning.get(t.textContent.trim()).role===gm.LATINLETTER)})),$f.add(new ig("bracketed_interval",t=>{const e=t[0],s=t[1],i=t.slice(2),r=Yf.getInstance().row(i),n=$f.factory.makeBranchNode(mm.FENCED,[r],[e,s]);return n.role=gm.INTERVAL,n},t=>{const e=t[0],s=t[1],i=t.slice(2);if(!(e&&s&&(vg(e.textContent)&&(Ng(s.textContent)||vg(s.textContent))||Ng(s.textContent)&&(Ng(e.textContent)||vg(e.textContent)))))return!1;if(1===i.length&&i[0].type===mm.PUNCTUATED&&1===i[0].contentNodes.length)return!0;const r=of(i,Cf);return!(1!==r.rel.length||!r.comp[0].length||!r.comp[1].length)})),$f.add(new sg("interval_heuristic",t=>(t.role=gm.INTERVAL,t),t=>Lg(t))),$f.add(new sg("propagateInterval",t=>(t.childNodes.forEach(t=>{Lg(t)&&(t.role=gm.INTERVAL)}),t),t=>Kf(t))),sm(new Qp("clearspeak","simple",function(t){return Sg(t)?"simple":""})),im("clearspeak","simple"),sm(new Qp("clearspeak","unit",function(t){return Og(t)?"unit":""})),im("clearspeak","unit");const Dg=[mm.MULTIREL,mm.RELSEQ,mm.APPL,mm.ROW,mm.LINE],Pg=[mm.SUBSCRIPT,mm.SUPERSCRIPT,mm.OVERSCORE,mm.UNDERSCORE];function Bg(t,e){const s=t.parent;if(!s)return!1;const i=s.type;return-1!==Dg.indexOf(i)||i===mm.PREFIXOP&&s.role===gm.NEGATIVE&&!e.script&&!e.enclosed||i===mm.PREFIXOP&&s.role===gm.GEOMETRY||!(i!==mm.PUNCTUATED||e.enclosed&&s.role!==gm.TEXT)}sm(new Zp("nemeth","number",function(t,e){return t.childNodes.length?(-1!==Pg.indexOf(t.type)&&(e.script=!0),t.type===mm.FENCED?(e.number=!1,e.enclosed=!0,["",e]):t.type===mm.PREFIXOP&&t.role!==gm.GEOMETRY&&t.role!==gm.NEGATIVE?(e.number=!1,["",e]):(Bg(t,e)&&(e.number=!0,e.enclosed=!1),["",e])):(Bg(t,e)&&(e.number=!0,e.script=!1,e.enclosed=!1),[e.number?"number":"",{number:!1,enclosed:e.enclosed,script:e.script}])},{number:!0})),im("nemeth","number"),sm(new Zp("depth","depth",function(t){return t.parent?[parseInt(t.parent.annotation.depth[0])+1]:[1]})),im("depth","depth");class Fg{static empty(){const t=Vp(""),e=new Fg(t,new kp);return e.mathml=t,e}static fromNode(t,e){const s=Fg.empty();return s.root=t,e&&(s.mathml=e),s}static fromRoot(t,e){let s=t;for(;s.parent;)s=s.parent;const i=Fg.fromNode(s);return e&&(i.mathml=e),i}static fromXml(t){const e=Fg.empty();return t.childNodes[0]&&(e.root=cf.fromXml(t.childNodes[0])),e}constructor(t,e){this.mathml=t,this.options=e,this.parser=new tg(e),this.root=this.parser.parse(t),this.root=Yf.rewriteTrivialTable(this.root),this.collator=this.parser.getFactory().leafMap.collateMeaning();const s=this.collator.newDefault();s&&(this.parser=new tg(e),this.parser.getFactory().defaultMap=s,this.root=this.parser.parse(t)),jg.visit(this.root,{}),function(t){for(const e of tm.values())e.active&&e.annotate(t);for(const e of em.values())e.active&&e.visit(t,Object.assign({},e.def))}(this.root)}xml(t){const e=Vp(""),s=this.root.xml(e.ownerDocument,t);return e.appendChild(s),e}toString(t){return Yp(this.xml(t))}formatXml(t){return Jp(this.toString(t))}displayTree(){this.root.displayTree()}replaceNode(t,e){const s=t.parent;s?s.replaceChild(t,e):this.root=e}toJson(){const t={};return t.stree=this.root.toJson(),t}}const jg=new Zp("general","unit",(t,e)=>(Wf(t)&&(t.role=gm.UNIT),!1));function _g(t,e){return new Fg(t,e)}const Ug=[],Hg=!0,Wg=new Map;function zg(t){wp.getInstance().generate(()=>["WALKING START: ",t.toString()]);const e=function(t){for(let e,s=0;e=Ug[s];s++)if(e.test(t))return e.constr(t);return null}(t);let s;if(e)return s=e.getMathml(),wp.getInstance().generate(()=>["WALKING END: ",t.toString()]),sb(s);if(1===t.mathml.length){if(wp.getInstance().output("Walktree Case 0"),!t.childNodes.length)return wp.getInstance().output("Walktree Case 0.1"),s=t.mathml[0],cg(s,t),wp.getInstance().generate(()=>["WALKING END: ",t.toString()]),sb(s);const e=t.childNodes[0];if(1===t.childNodes.length&&e.type===mm.EMPTY)return wp.getInstance().output("Walktree Case 0.2"),s=t.mathml[0],cg(s,t),s.appendChild(zg(e)),wp.getInstance().generate(()=>["WALKING END: ",t.toString()]),sb(s);t.childNodes.forEach(t=>{t.mathml.length||t.addMathmlNodes([hb(t)])})}const i=t.contentNodes.map(lb);db(t,i);const r=t.childNodes.map(zg),n=dg.combineContentChildren(t.type,t.role,i,r);if(s=t.mathmlTree,null===s)wp.getInstance().output("Walktree Case 1"),s=qg(n,t);else{s=cb(s);const t=Zg(n);wp.getInstance().output("Walktree Case 2"),t?(wp.getInstance().output("Walktree Case 2.1"),s=ob(t)):(wp.getInstance().output("Walktree Case 2.2"),s=ub(s))}return function(t,e,s){if(!e.length)return;if(1===e.length&&t===e[0])return;const i=s.role===gm.IMPLICIT&&$f.flags.combine_juxtaposition?function(t,e,s){const i=[];let r=qp(t.childNodes),n=!1;for(;r.length;){const t=r.shift();if(t.hasAttribute(og.TYPE)){i.push(t);continue}const s=Xg(t,e);0!==s.length&&(1!==s.length?(n?t.setAttribute("AuxiliaryImplicit",!0):n=!0,r=s.concat(r)):i.push(t))}const o=[],a=s.childNodes.map(function(t){return t.mathmlTree});for(;a.length;){const t=a.pop();if(t){if(-1!==i.indexOf(t))break;-1!==e.indexOf(t)&&o.unshift(t)}}return i.concat(o)}(t,e,s):qp(t.childNodes);if(!i.length)return void e.forEach(function(e){t.appendChild(e)});let r=0;for(;e.length;){const s=e[0];if(i[r]===s||Yg(i[r],s)){e.shift(),r++;continue}if(i[r]&&-1===e.indexOf(i[r])){r++;continue}if($g(s,t)){e.shift();continue}const n=i[r];if(!n){if(s.parentNode){t=ob(s),e.shift();continue}const i=e[1];if(i&&i.parentNode){Jg(t=ob(i),s,i),e.shift(),e.shift();continue}Jg(t,s,null),e.shift();continue}Gg(t,n,s),e.shift()}}(s,n,t),Wg.has(t.id)||(Wg.set(t.id,!0),cg(s,t)),wp.getInstance().generate(()=>["WALKING END: ",t.toString()]),sb(s,t)}function qg(t,e){const s=function(t){const e=Zg(t);if(!e)return{type:Qg.INVALID,node:null};const s=Zg(t.slice().reverse());if(e===s)return{type:Qg.VALID,node:e};const i=tb(e),r=function(t,e){let s=0;for(;t[s]&&-1===e.indexOf(t[s]);)s++;return t.slice(0,s+1)}(i,t),n=tb(s,function(t){return-1!==r.indexOf(t)}),o=n[0],a=r.indexOf(o);if(-1===a)return{type:Qg.INVALID,node:null};return{type:r.length!==i.length?Qg.PRUNED:eb(r[a+1],n[1])?Qg.VALID:Qg.INVALID,node:o}}(t);let i=s.node;const r=s.type;if(r!==Qg.VALID||!Zm(i)||!i.parentNode&&e.parent)if(wp.getInstance().output("Walktree Case 1.1"),i=hg(),r===Qg.PRUNED)wp.getInstance().output("Walktree Case 1.1.0"),i=function(t,e,s){let i=ib(e);if(Ym(i)){wp.getInstance().output("Walktree Case 1.1.0.0"),Vg(i,t),qp(i.childNodes).forEach(function(e){t.appendChild(e)});const e=t;t=i,i=e}const r=s.indexOf(e);return s[r]=i,Xp(i,t),t.appendChild(i),s.forEach(function(e){t.appendChild(e)}),t}(i,s.node,t);else if(t[0]){wp.getInstance().output("Walktree Case 1.1.1");const e=Zg(t);if(e){const s=function(t,e){const s=qp(t.childNodes);let i=1/0,r=-1/0;return e.forEach(function(t){const e=s.indexOf(t);-1!==e&&(i=Math.min(i,e),r=Math.max(r,e))}),s.slice(i,r+1)}(ob(e),t);Xp(e,i),s.forEach(function(t){i.appendChild(t)})}else Vg(i,t[0]),i=t[0]}return e.mathmlTree||(e.mathmlTree=i),i}function Vg(t,e){for(const s of ag)t.hasAttribute(s)&&(e.setAttribute(s,t.getAttribute(s)),t.removeAttribute(s))}function Xg(t,e){const s=[];let i=qp(t.childNodes);for(;i.length;){const t=i.shift();t.nodeType===zp.ELEMENT_NODE&&(t.hasAttribute(og.TYPE)||-1!==e.indexOf(t)?s.push(t):i=qp(t.childNodes).concat(i))}return s}function Gg(t,e,s){let i=e,r=ob(i);for(;r&&Kg(r,i)&&!i.hasAttribute("AuxiliaryImplicit")&&r!==t;)i=r,r=ob(i);r&&(Jg(r,s,i),i.removeAttribute("AuxiliaryImplicit"))}function Jg(t,e,s){$p(t)===qm.MACTION?Jg(ob(t),e,t):t.insertBefore(e,s)}function Kg(t,e){if($p(t)!==qm.MACTION)return t.firstChild===e;const s=parseInt(t.getAttribute("selection"))||1;return t.childNodes[s-1]===e}function $g(t,e){if(!t)return!1;do{if((t=ob(t))===e)return!0}while(t);return!1}function Yg(t,e){const s=vm.functionApplication;if(t&&e&&t.textContent&&e.textContent&&t.textContent===s&&e.textContent===s&&"true"===e.getAttribute(og.ADDED)){for(let s,i=0;s=t.attributes[i];i++)e.hasAttribute(s.nodeName)||e.setAttribute(s.nodeName,s.nodeValue);return Xp(t,e),!0}return!1}var Qg;function Zg(t){let e=0,s=null;for(;!s&&e!1),i=[t];for(;!s(t)&&!Ym(t)&&t.parentNode;)t=ob(t),i.unshift(t);return i}function eb(t,e){return!(!t||!e||t.previousSibling||e.nextSibling)}function sb(t,e){var s;let i=e&&!e.hasAnnotation("empty","MFENCED")&&e.getAnnotation("empty");for(;!Ym(t)&&(rb(t)||i&&t.parentNode&&i.includes(null===(s=ob(t).tagName)||void 0===s?void 0:s.toUpperCase()));)t=ob(t);return t}function ib(t){const e=qp(t.childNodes);if(!e)return t;const s=e.filter(function(t){return t.nodeType===zp.ELEMENT_NODE&&!Qm(t)});return 1===s.length&&Zm(s[0])&&!s[0].hasAttribute(og.TYPE)?ib(s[0]):t}function rb(t){const e=ob(t);return!(!e||!Zm(e))&&qp(e.childNodes).every(function(e){return e===t||nb(e)})}function nb(t){if(t.nodeType!==zp.ELEMENT_NODE)return!0;if(!t||Qm(t))return!0;const e=qp(t.childNodes);return!(!Zm(t)&&e.length||function(t){return!!t&&Km.includes($p(t))}(t)||t.hasAttribute(og.TYPE)||tf(t))&&qp(t.childNodes).every(nb)}function ob(t){return t.parentNode}function ab(t,e){const s=new dg(e);t.setAttribute(og.COLLAPSED,s.toString())}function lb(t){if(t.mathml.length)return zg(t);const e=Hg?hb(t):hg();return t.addMathmlNodes([e]),e}function cb(t){if($p(t)!==qm.MFENCED)return t;const e=hg();for(let s,i=0;s=t.attributes[i];i++)-1===["open","close","separators"].indexOf(s.name)&&e.setAttribute(s.name,s.value);return qp(t.childNodes).forEach(function(t){e.appendChild(t)}),Xp(t,e),e}function hb(t){const e=Gp("mo"),s=(i=t.textContent,Mp.document.createTextNode(i));var i;return e.appendChild(s),cg(e,t),e.setAttribute(og.ADDED,"true"),e}function db(t,e){const s=t.type+(t.textContent?","+t.textContent:"");e.forEach(function(t){ub(t).setAttribute(og.OPERATOR,s)})}function ub(t){if(Qm(t))return t;const e=qp(t.childNodes);if(!e)return t;const s=e.filter(function(t){return!nb(t)}),i=[];for(let t,e=0;t=s[e];e++)if(Zm(t)&&t.getAttribute(og.TYPE)!==mm.PUNCTUATION){const e=ub(t);e&&e!==t&&i.push(e)}else i.push(t);return 1===i.length?i[0]:t}function pb(t){return Jp(t.toString()).toString().replace(new RegExp(ng,"g"),"")}function mb(t,e){const s=!!e,i=e||[],r=t.parent,n=t.contentNodes.map(function(t){return t.id});n.unshift("c");const o=[t.id,n];for(let e,n=0;e=t.childNodes[n];n++){const t=zg(e);i.push(t);const n=ub(t);r&&!s&&n.setAttribute(og.PARENT,r.id.toString()),o.push(e.id)}return o}!function(t){t.VALID="valid",t.INVALID="invalid",t.PRUNED="pruned"}(Qg||(Qg={}));class fb{constructor(t){this.semantic=t}}class gb extends fb{static test(t){return!t.mathmlTree&&t.type===mm.LINE&&t.role===gm.BINOMIAL}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){if(!this.semantic.childNodes.length)return this.mml;const t=this.semantic.childNodes[0];if(this.mml=zg(t),this.mml.hasAttribute(og.TYPE)){const t=hg();Xp(this.mml,t),t.appendChild(this.mml),this.mml=t}return cg(this.mml,this.semantic),this.mml}}class bb extends fb{static test(t){var e,s;return!!t.getAnnotation("collapsed").length&&(null===(s=null===(e=t.mathmlTree)||void 0===e?void 0:e.parentNode)||void 0===s?void 0:s.childNodes.length)>2}getMathml(){zg(this.semantic.childNodes[0]),zg(this.semantic.childNodes[1]);const t=this.semantic.mathmlTree,e=qg([this.semantic.childNodes[0].mathmlTree,t],this.semantic);return cg(e,this.semantic),e}}class Eb extends fb{static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;const e=$p(t.mathmlTree),s=t.childNodes[0].role;return e===qm.MSUBSUP&&s===gm.SUBSUP||e===qm.MUNDEROVER&&s===gm.UNDEROVER}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=this.semantic.childNodes[0],e=t.childNodes[0],s=this.semantic.childNodes[1],i=t.childNodes[1],r=zg(s),n=zg(e),o=zg(i);return cg(this.mml,this.semantic),this.mml.setAttribute(og.CHILDREN,lg([e,i,s])),[n,o,r].forEach(t=>ub(t).setAttribute(og.PARENT,this.mml.getAttribute(og.ID))),this.mml.setAttribute(og.TYPE,t.role),ab(this.mml,[this.semantic.id,[t.id,e.id,i.id],s.id]),this.mml}}class xb extends fb{static multiscriptIndex(t){return t.type===mm.PUNCTUATED&&t.contentNodes[0].role===gm.DUMMY&&t.hasAnnotation("general","script")?mb(t):(zg(t),t.id)}static createNone_(t){const e=Gp("none");return t&&cg(e,t),e.setAttribute(og.ADDED,"true"),e}constructor(t){super(t),this.mml=t.mathmlTree}completeMultiscript(t,e){const s=qp(this.mml.childNodes).slice(1);let i=0;const r=t=>{for(const e of t){const t=s[i];if(t&&e===parseInt(t.getAttribute(og.ID)))t.setAttribute(og.PARENT,this.semantic.id.toString()),i++;else if(t&&e===parseInt(ub(t).getAttribute(og.ID)))ub(t).setAttribute(og.PARENT,this.semantic.id.toString()),i++;else{const s=this.semantic.querySelectorAll(t=>t.id===e);this.mml.insertBefore(xb.createNone_(s[0]),t||null)}}};r(t),s[i]&&$p(s[i])!==qm.MPRESCRIPTS?this.mml.insertBefore(s[i],Gp("mprescripts")):i++,r(e)}}class yb extends xb{static test(t){if(!t.mathmlTree)return!1;return $p(t.mathmlTree)===qm.MMULTISCRIPTS&&(t.type===mm.SUPERSCRIPT||t.type===mm.SUBSCRIPT)}constructor(t){super(t)}getMathml(){let t,e,s;if(cg(this.mml,this.semantic),this.semantic.childNodes[0]&&this.semantic.childNodes[0].role===gm.SUBSUP){const i=this.semantic.childNodes[0];t=i.childNodes[0],e=xb.multiscriptIndex(this.semantic.childNodes[1]),s=xb.multiscriptIndex(i.childNodes[1]);const r=[this.semantic.id,[i.id,t.id,s],e];ab(this.mml,r),this.mml.setAttribute(og.TYPE,i.role),this.completeMultiscript(dg.interleaveIds(s,e),[])}else{t=this.semantic.childNodes[0],e=xb.multiscriptIndex(this.semantic.childNodes[1]);const s=[this.semantic.id,t.id,e];ab(this.mml,s)}const i=dg.collapsedLeafs(s||[],e);return ub(zg(t)).setAttribute(og.PARENT,this.semantic.id.toString()),i.unshift(t.id),this.mml.setAttribute(og.CHILDREN,i.join(",")),this.mml}}class Nb extends xb{static test(t){return!!t.mathmlTree&&t.type===mm.TENSOR}constructor(t){super(t)}getMathml(){zg(this.semantic.childNodes[0]);const t=xb.multiscriptIndex(this.semantic.childNodes[1]),e=xb.multiscriptIndex(this.semantic.childNodes[2]),s=xb.multiscriptIndex(this.semantic.childNodes[3]),i=xb.multiscriptIndex(this.semantic.childNodes[4]);cg(this.mml,this.semantic);const r=[this.semantic.id,this.semantic.childNodes[0].id,t,e,s,i];ab(this.mml,r);const n=dg.collapsedLeafs(t,e,s,i);return n.unshift(this.semantic.childNodes[0].id),this.mml.setAttribute(og.CHILDREN,n.join(",")),this.completeMultiscript(dg.interleaveIds(s,i),dg.interleaveIds(t,e)),this.mml}}class vb extends fb{static test(t){return!(!t.mathmlTree||!t.fencePointer||t.mathmlTree.getAttribute("data-semantic-type"))}static makeEmptyNode_(t){const e=hg(),s=new cf(t);return s.type=mm.EMPTY,s.mathmlTree=e,s}static fencedMap_(t,e){e[t.id]=t.mathmlTree,t.embellished&&vb.fencedMap_(t.childNodes[0],e)}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=[]}getMathml(){this.getFenced_(),this.fencedMml=zg(this.fenced),this.getFencesMml_(),this.fenced.type!==mm.EMPTY||this.fencedMml.parentNode||(this.fencedMml.setAttribute(og.ADDED,"true"),this.cfenceMml.parentNode.insertBefore(this.fencedMml,this.cfenceMml)),this.getFencedMml_();return this.rewrite_()}fencedElement(t){return t.type===mm.FENCED||t.type===mm.MATRIX||t.type===mm.VECTOR}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],vb.fencedMap_(this.ofence,this.ofenceMap),vb.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),s=Object.keys(this.cfenceMap);for(;!(this.ofenceMml&&this.cfenceMml||t===this.fenced);)-1===e.indexOf(t.fencePointer)||this.ofenceMml||(this.ofenceMml=t.mathmlTree),-1===s.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=sb(this.ofenceMml)),this.cfenceMml&&(this.cfenceMml=sb(this.cfenceMml))}rewrite_(){let t=this.semantic,e=null;const s=this.introduceNewLayer_();for(cg(s,this.fenced.parent);!this.fencedElement(t);){const i=t.mathmlTree,r=this.specialCase_(t,i);if(r)t=r;else{cg(i,t);const e=[];for(let s,i=1;s=t.childNodes[i];i++)e.push(zg(s));t=t.childNodes[0]}const n=Gp("dummy"),o=i.childNodes[0];Xp(i,n),Xp(s,i),Xp(i.childNodes[0],s),Xp(n,o),e||(e=i)}return zg(this.ofence),zg(this.cfence),this.cleanupParents_(),e||s}specialCase_(t,e){const s=$p(e);let i,r=null;if(s===qm.MSUBSUP?(r=t.childNodes[0],i=Eb):s===qm.MMULTISCRIPTS&&(t.type===mm.SUPERSCRIPT||t.type===mm.SUBSCRIPT?i=yb:t.type===mm.TENSOR&&(i=Nb),r=i&&t.childNodes[0]&&t.childNodes[0].role===gm.SUBSUP?t.childNodes[0]:t),!r)return null;const n=r.childNodes[0],o=vb.makeEmptyNode_(n.id);return r.childNodes[0]=o,e=new i(t).getMathml(),r.childNodes[0]=n,this.parentCleanup.push(e),r.childNodes[0]}introduceNewLayer_(){const t=this.fullFence(this.ofenceMml),e=this.fullFence(this.cfenceMml);let s=hg();if(Xp(this.fencedMml,s),this.fencedMmlNodes.forEach(t=>s.appendChild(t)),s.insertBefore(t,this.fencedMml),s.appendChild(e),!s.parentNode){const t=hg();for(;s.childNodes.length>0;)t.appendChild(s.childNodes[0]);s.appendChild(t),s=t}return s}fullFence(t){const e=this.fencedMml.parentNode;let s=t;for(;s.parentNode&&s.parentNode!==e;)s=s.parentNode;return s}cleanupParents_(){this.parentCleanup.forEach(function(t){const e=t.childNodes[1].getAttribute(og.PARENT);t.childNodes[0].setAttribute(og.PARENT,e)})}}class Tb extends fb{static test(t){return!!t.mathmlTree&&t.hasAnnotation("Emph","top")}constructor(t){super(t),this.mrows=[],this.mml=t.mathmlTree}getMathml(){if(this.recurseToTable(this.semantic),this.mrows.length){const t=hg();this.mml.parentNode.insertBefore(t,this.mml);for(const e of this.mrows)t.appendChild(e);t.appendChild(this.mml)}return this.mml}recurseToTable(t){var e,s;if(t.hasAnnotation("Emph","top")||t.hasAnnotation("Emph","fence")||!t.hasAnnotation("Emph","left")&&!t.hasAnnotation("Emph","right")){if(!t.mathmlTree||$p(t.mathmlTree)===qm.MTABLE&&(null===(e=t.annotation.Emph)||void 0===e?void 0:e.length)&&"table"!==t.annotation.Emph[0]){const e=hg();cg(e,t),this.mrows.unshift(e)}else{if($p(t.mathmlTree)===qm.MTABLE&&(null===(s=t.annotation.Emph)||void 0===s?void 0:s.length)&&"table"===t.annotation.Emph[0])return void this.finalizeTable(t);cg(t.mathmlTree,t)}if(t.childNodes.forEach(this.recurseToTable.bind(this)),t.textContent||"punctuated"===t.type){const e=t.contentNodes.map(t=>{const e=lb(t);return e.hasAttribute("data-semantic-added")?this.mrows.unshift(e):this.recurseToTable(t),e});return void db(t,e)}t.contentNodes.forEach(this.recurseToTable.bind(this))}else zg(t)}finalizeTable(t){cg(t.mathmlTree,t),t.contentNodes.forEach(t=>{zg(t)}),t.childNodes.forEach(t=>{zg(t)})}}class Cb extends fb{static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;const e=$p(t.mathmlTree),s=t.type;return(s===mm.LIMUPPER||s===mm.LIMLOWER)&&(e===qm.MSUBSUP||e===qm.MUNDEROVER)||s===mm.LIMBOTH&&(e===qm.MSUB||e===qm.MUNDER||e===qm.MSUP||e===qm.MOVER)}static walkTree_(t){t&&zg(t)}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=this.semantic.childNodes;return this.semantic.type!==mm.LIMBOTH&&this.mml.childNodes.length>=3&&(this.mml=qg([this.mml],this.semantic)),cg(this.mml,this.semantic),t[0].mathmlTree||(t[0].mathmlTree=this.semantic.mathmlTree),t.forEach(Cb.walkTree_),this.mml}}class Ab extends fb{static test(t){return!!t.mathmlTree&&t.type===mm.LINE}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){return this.semantic.contentNodes.length&&zg(this.semantic.contentNodes[0]),this.semantic.childNodes.length&&zg(this.semantic.childNodes[0]),cg(this.mml,this.semantic),this.mml}}class Lb extends fb{static test(t){return!!t.mathmlTree&&(t.type===mm.INFERENCE||t.type===mm.PREMISES)}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){return this.semantic.childNodes.length?(this.semantic.contentNodes.forEach(function(t){zg(t),cg(t.mathmlTree,t)}),this.semantic.childNodes.forEach(function(t){zg(t)}),cg(this.mml,this.semantic),this.mml.getAttribute("data-semantic-id")===this.mml.getAttribute("data-semantic-parent")&&this.mml.removeAttribute("data-semantic-parent"),this.mml):this.mml}}class Sb extends fb{static test(t){return t.type===mm.MATRIX||t.type===mm.VECTOR||t.type===mm.CASES}constructor(t){super(t),this.inner=[],this.mml=t.mathmlTree}getMathml(){const t=lb(this.semantic.contentNodes[0]),e=this.semantic.contentNodes[1]?lb(this.semantic.contentNodes[1]):null;if(this.inner=this.semantic.childNodes.map(zg),this.mml)if($p(this.mml)===qm.MFENCED){const s=this.mml.childNodes;this.mml.insertBefore(t,s[0]||null),e&&this.mml.appendChild(e),this.mml=cb(this.mml)}else{const s=[t,this.mml];e&&s.push(e),this.mml=qg(s,this.semantic)}else this.mml=qg([t].concat(this.inner,[e]),this.semantic);return cg(this.mml,this.semantic),this.mml}}class Rb extends fb{static test(t){return t.type===mm.PUNCTUATED&&(t.role===gm.TEXT||t.contentNodes.every(t=>t.role===gm.DUMMY))}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=[],e=mb(this.semantic,t);return this.mml=qg(t,this.semantic),cg(this.mml,this.semantic),this.mml.removeAttribute(og.CONTENT),ab(this.mml,e),this.mml}}function Mb(t,e){const s=function(t){return t.cloneNode(!0)}(t),i=function(t,e,s){return wp.getInstance().generate(()=>["Original MathML",pb(t)]),Wg.clear(),zg(e.root),s.structure&&t.setAttribute(og.STRUCTURE,dg.fromStructure(t,e,s).toString()),wp.getInstance().generate(()=>["Semantic Tree\n",pb(e),"Semantically enriched MathML\n",pb(t)]),t}(s,_g(s,e),e);return i}Ug.push({test:Cb.test,constr:t=>new Cb(t)},{test:vb.test,constr:t=>new vb(t)},{test:bb.test,constr:t=>new bb(t)},{test:Eb.test,constr:t=>new Eb(t)},{test:Nb.test,constr:t=>new Nb(t)},{test:yb.test,constr:t=>new yb(t)},{test:Ab.test,constr:t=>new Ab(t)},{test:gb.test,constr:t=>new gb(t)},{test:Lb.test,constr:t=>new Lb(t)},{test:Tb.test,constr:t=>new Tb(t)},{test:Sb.test,constr:t=>new Sb(t)},{test:Rb.test,constr:t=>new Rb(t)});const Ib=new cp({AbsoluteValue:["Auto","AbsEnd","Cardinality","Determinant"],Bar:["Auto","Conjugate"],Caps:["Auto","SayCaps"],CombinationPermutation:["Auto","ChoosePermute"],Currency:["Auto","Position","Prefix"],Ellipses:["Auto","AndSoOn"],Enclosed:["Auto","EndEnclose"],Exponent:["Auto","AfterPower","Ordinal","OrdinalPower","Exponent"],Fraction:["Auto","EndFrac","FracOver","General","GeneralEndFrac","Ordinal","Over","OverEndFrac","Per"],Functions:["Auto","None","Reciprocal"],Inference:["Auto","Long"],ImpliedTimes:["Auto","MoreImpliedTimes","None"],Log:["Auto","LnAsNaturalLog"],Matrix:["Auto","Combinatoric","EndMatrix","EndVector","SilentColNum","SpeakColNum","Vector"],MultiLineLabel:["Auto","Case","Constraint","Equation","Line","None","Row","Step"],MultiLineOverview:["Auto","None"],MultiLinePausesBetweenColumns:["Auto","Long","Short"],MultsymbolDot:["Auto","Dot"],MultsymbolX:["Auto","By","Cross"],Paren:["Auto","CoordPoint","Interval","Silent","Speak","SpeakNestingLevel"],Prime:["Auto","Angle","Length"],Roots:["Auto","PosNegSqRoot","PosNegSqRootEnd","RootEnd"],SetMemberSymbol:["Auto","Belongs","Element","Member","In"],Sets:["Auto","SilentBracket","woAll"],TriangleSymbol:["Auto","Delta"],Trig:["Auto","ArcTrig","TrigInverse","Reciprocal"],VerticalLine:["Auto","Divides","Given","SuchThat"]}),wb="Auto";function kb(t){const e=t.split(":"),s={},i=Ib.getProperties(),r=Object.keys(i);for(let t,n=0;t=e[n];n++){const e=t.split("_");if(-1===r.indexOf(e[0]))continue;const n=e[1];n&&n!==wb&&-1!==i[e[0]].indexOf(n)&&(s[e[0]]=e[1])}return s}function Ob(t){const e=Object.keys(t),s=[];for(let i=0;iBp.getInstance().setup(t),Bb=()=>Bp.getInstance().json(),Fb=t=>function(t,e){const s=Vp(t);try{return Mb(s,e)}catch(t){return console.error(t),s}}(t,Bp.getInstance().options),jb=Vp,_b=function(t,e,s){if("default"===t)return e+"_"+s;const i=kb(t);return i[e]=s,Ob(i)},Ub=kb,Hb=Ob;var Wb=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};let zb={},qb=null;function Vb(t){var e,s;const i=null==t?void 0:t.match(/^clearspeak-(.*)/);return qb=null!==(s=null!==(e=i&&i[1])&&void 0!==e?e:qb)&&void 0!==s?s:"default",qb}const Xb=new Map;const Gb=new Map;let Jb=0;function Kb(t,e){const s=Xb.get(e);!function(t,e){const s=t.pool.lookup("speechRules"),i=Vb(t.settings.speechRules);zb=Ub(i);for(const i of e)t.factory.get("variable")(t.factory,{name:"csprf_"+i,setter:t=>{zb[i]=t,s.setValue("clearspeak-"+Hb(zb))},getter:()=>zb[i]||"Auto"},t.pool)}(t,Object.keys(s));const i=[];for(const t of Object.getOwnPropertyNames(s))i.push({title:t,values:s[t].map(e=>e.replace(RegExp("^"+t+"_"),"")),variable:"csprf_"+t});const r=new np("Clearspeak Preferences","",i,"alphabetical","square",t);return{type:"command",id:"ClearspeakPreferences",content:"Select Preferences",action:()=>r.post()}}function $b(t,e,s){return Wb(this,void 0,void 0,function*(){var i,r;const n=i=>{s(t.factory.get("subMenu")(t.factory,{items:i,id:"Clearspeak"},e))};if(!t.settings.speech||!t.settings.enrich)return void n([]);const o=t.pool.lookup("locale").getValue();if(yield function(t,e){return Wb(this,void 0,void 0,function*(){Xb.has(e)||(yield t.mathItem.generatorPool.getLocalePreferences(Xb))})}(t,o),!Xb.get(o))return void n([]);const a=Kb(t,o);let l=[];if(t.settings.speech){const e=t.mathItem,s=null===(i=null==e?void 0:e.explorers)||void 0===i?void 0:i.speech,n=Vb(t.settings.speechRules);l=l.concat(function(t){return[{type:"radio",content:"No Preferences",id:"clearspeak-default",variable:"speechRules"},{type:"radio",content:"Current Preferences",id:"clearspeak-"+t,variable:"speechRules"},{type:"rule"}]}(n));const a=null==s?void 0:s.refocus,c=null!==(r=null==a?void 0:a.getAttribute("data-semantic-id"))&&void 0!==r?r:null,h=Jb++;yield e.generatorPool.getRelevantPreferences(e,c,Gb,h);const d=Gb.get(h);if(Gb.delete(h),d){const t=function(t,e,s){const i=Xb.get(s);return[{type:"label",content:"Preferences for "+e},{type:"rule"}].concat(i[e].map(function(e){const[s,i]=e.split("_");return{type:"radioCompare",content:i,id:"clearspeak-"+_b(t,s,i),variable:"speechRules",comparator:(t,e)=>{if(t===e)return!0;if("Auto"!==i)return!1;const[r,n]=t.split("-"),[o]=e.split("-");return r===o&&!Ub(n)[s]}}}))}(n,d,o);l=l.concat(t)}}l.splice(2,0,a),n(l)})}rp.DynamicSubmenus.set("Clearspeak",[$b,"speech"]);let Yb=null;function Qb(t,e,s){if(Yb)return void s(Yb);const i=[];for(const t of Db.keys())"nemeth"!==t&&"euro"!==t&&i.push({type:"radio",id:t,content:Db.get(t)||t,variable:"locale"});i.sort((t,e)=>t.content.localeCompare(e.content,"en")),Yb=t.factory.get("subMenu")(t.factory,{items:i,id:"Language"},e),s(Yb)}rp.DynamicSubmenus.set("A11yLanguage",[Qb,"speech"]);const Zb="MacOS"===pi.os;function tE(t){const e=pi.document,s=e.createElement("textarea");s.value=t,s.setAttribute("readonly",""),s.style.cssText="height: 1px; width: 1px; padding: 1px; position: absolute; left: -10px",e.body.appendChild(s),s.select();try{e.execCommand("copy")}catch(t){alert(`Can't copy to clipboard: ${t.message}`)}e.body.removeChild(s)}function eE(t,e,s){return(i,r,n)=>{!function(t,e,s){if(!t)return;for(const i of t.childNodes)if(i.isKind("annotation")){const t=iE(i,e);if(t){const e=i.childNodes.reduce((t,e)=>t+e.toString(),"");s.push([t,e])}}}(function(t){var e;let s=null===(e=t.mathItem)||void 0===e?void 0:e.root;for(;s&&!s.isKind("semantics");){if(s.isToken||1!==s.childNodes.length)return null;s=s.childNodes[0]}return s}(i),e,s),n(nE(i,r,s,t))}}function sE(t){return(e,s,i)=>{const r=t.slice();t.length=0,i(nE(e,s,r,()=>tE(rE.trim())))}}function iE(t,e){const s=t.attributes.get("encoding");for(const t of Object.keys(e))if(e[t].includes(s))return t;return null}let rE="";function nE(t,e,s,i){return t.factory.get("subMenu")(t.factory,{items:s.map(([t,e])=>({type:"command",id:t,content:t,action:()=>{rE=e,i()}})),id:"annotations"},e)}class oE extends uo{static post(t){return super.post(t)}html(t){var e;null!==(e=t.extraNodes)&&void 0!==e||(t.extraNodes=[]);const s=t.adaptor.node("input",{type:"button",value:"Copy to Clipboard","data-drag":"none"});return s.addEventListener("click",this.copyToClipboard.bind(this)),t.extraNodes.push(s),t.code&&(t.message="
"+this.formatSource(t.message)+"
"),super.html(t)}formatSource(t){return t.trim().replace(/&/g,"&").replace(//g,">")}}class aE extends ju{static fromJson(t,{content:e,variable:s,id:i,comparator:r},n){return new this(n,e,s,i,r)}constructor(t,e,s,i,r){super(t,e,s,i),this.comparator=r,this.role="menuitemradiocompare"}updateAria(){this.html.setAttribute("aria-checked",this.comparator(this.variable.getValue(),this.id)?"true":"false")}updateSpan(){this.span.style.display=this.comparator(this.variable.getValue(),this.id)?"":"none"}}class lE extends Yn{constructor(){super(...arguments),this.options={filterSRE:!0,filterTex:!0,texHints:!0,semantics:!1},this.mathItem=null}visitTree(t,e=null,s={}){return this.mathItem=e,Fi(this.options,s),this.visitNode(t,"")}visitTeXAtomNode(t,e){return this.options.texHints?super.visitDefault(t,e):t.childNodes[0]&&1===t.childNodes[0].childNodes.length?this.visitNode(t.childNodes[0],e):`${e}\n`+this.childNodeMml(t,e+" ","\n")+`${e}`}visitMathNode(t,e){if(!this.options.semantics||"TeX"!==this.mathItem.inputJax.name)return super.visitDefault(t,e);const s=t.childNodes.length&&t.childNodes[0].childNodes.length>1;return`${e}\n${e} \n`+(s?e+" \n":"")+this.childNodeMml(t,e+(s?" ":" "),"\n")+(s?e+" \n":"")+`${e} `+this.mathItem.math+`\n${e} \n${e}`}getAttributeList(t){const e=super.getAttributeList(t);if(this.options.filterTex&&(delete e["data-latex"],delete e["data-latex-item"]),this.options.filterSRE){const t=Object.keys(e).filter(t=>t.match(/^(?:data-semantic-.*?|data-speech-node|role|aria-(?:level|posinset|setsize|owns))$/));for(const s of t)delete e[s]}return e}}var cE=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const hE=di;class dE{get isLoading(){return dE.loading>0}get loadingPromise(){return this.isLoading?(dE._loadingPromise||(dE._loadingPromise=new Promise((t,e)=>{dE._loadingOK=t,dE._loadingFailed=e})),dE._loadingPromise):Promise.resolve()}about(){const t=[];if(t.push("Input Jax: "+this.document.inputJax.map(t=>t.name).join(", ")),t.push("Output Jax: "+this.document.outputJax.name),t.push("Document Type: "+this.document.kind),hE&&hE.loader){t.push("
Modules Loaded:");const e=hE._.components.package.Package,s=hE.loader.versions;for(const i of Array.from(e.packages.keys()).sort(this.sortPackages)){const r=s.get(e.resolvePath(i));r&&t.push(`    ${i} (${r})`)}}uo.post({title:"MathJax v"+to.version+"",message:t.join("
"),adaptor:this.document.adaptor,styles:{".mjx-dialog":{"max-height":"calc(min(20em, 85%))"},"mjx-dialog > div":{"white-space":"nowrap"},"dialog.mjx-dialog-help > mjx-dialog > div":{"white-space":"normal"},"mjx-v":{"font-size":"80%"}},extraNodes:[this.document.adaptor.node("a",{href:"https://www.mathjax.org","data-drag":"false",target:"_blank"},[this.document.adaptor.text("https://www.mathjax.org")])]})}sortPackages(t,e){const[s,i]=t.includes("/")?t.split(/\//):["",t],[r,n]=e.includes("/")?e.split(/\//):["",e];return s===r?iMathJax 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, the mechanism used to display equations,"," how to handle equations that are too wide, and the language to use for"," MathJax's menus and error messages (not yet implemented in v4).","

","

Accessibility: MathJax can work with screen"," readers to make mathematics accessible to the visually impaired."," Turn on speech or braille generation to enable creation of speech strings"," and the ability to investigate expressions interactively. You can control"," the style of the explorer in its menu.

","
","

Math Zoom: If you are having difficulty reading an"," equation, MathJax can enlarge it to help you see it better, or"," you can scale 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"),adaptor:this.document.adaptor,extraNodes:[this.document.adaptor.node("a",{href:"https://www.mathjax.org","data-drag":"none"},[this.document.adaptor.text("https://www.mathjax.org")])]})}mathMLCode(){oE.post({title:"MathJax MathML Expression",message:this.menu.mathItem?this.toMML(this.menu.mathItem):"",adaptor:this.document.adaptor,code:!0})}originalText(){var t,e;oE.post({title:"MathJax Original Source",message:null!==(e=null===(t=this.menu.mathItem)||void 0===t?void 0:t.math)&&void 0!==e?e:"",adaptor:this.document.adaptor,code:!0})}annotationBox(){oE.post({title:"MathJax Annotation Text",message:rE,adaptor:this.document.adaptor,code:!0})}svgImage(){return cE(this,void 0,void 0,function*(){oE.post({title:"MathJax SVG Image",message:yield this.toSVG(this.menu.mathItem),adaptor:this.document.adaptor,code:!0})})}speechText(){var t,e,s;oE.post({title:"MathJax Speech Text",message:null!==(s=null===(e=null===(t=this.menu.mathItem)||void 0===t?void 0:t.outputData)||void 0===e?void 0:e.speech)&&void 0!==s?s:"",adaptor:this.document.adaptor,code:!0})}brailleText(){var t,e,s;oE.post({title:"MathJax Braille Text",message:null!==(s=null===(e=null===(t=this.menu.mathItem)||void 0===t?void 0:t.outputData)||void 0===e?void 0:e.braille)&&void 0!==s?s:"",adaptor:this.document.adaptor,code:!0})}errorMessage(){oE.post({title:"MathJax Error Message",message:this.menu.mathItem?this.menu.errorMsg:"",adaptor:this.document.adaptor,code:!0})}zoomBox(){let t="";if(this.menu.mathItem){const e=this.menu.mathItem.typesetRoot,s=this.document.adaptor.fontSize(e),i=e.cloneNode(!0);i.style.margin="0";t=`
${i.outerHTML}
`}uo.post({title:"MathJax Zoomed Expression",message:t,adaptor:this.document.adaptor,styles:{"mjx-dialog > div":{padding:"1.8em"}}})}constructor(t,e={}){this.settings=null,this.defaultSettings=null,this.menu=null,this.current=null,this.MmlVisitor=new lE,this.jax={CHTML:null,SVG:null},this.rerenderStart=ar.LAST,this.requiredExtensions=[],this.document=t,this.options=Fi(Bi({},this.constructor.OPTIONS),e),this.initSettings(),this.mergeUserSettings(),this.initMenu(),this.applySettings()}initSettings(){var t;this.settings=this.options.settings,this.jax=this.options.jax;const e=this.document.outputJax;this.jax[e.name]=e,this.settings.renderer=e.name,this.settings.scale=e.options.scale,e.options.displayOverflow&&(this.settings.overflow=e.options.displayOverflow.substring(0,1).toUpperCase()+e.options.displayOverflow.substring(1).toLowerCase()),this.settings.breakInline=null===(t=e.options.linebreaks)||void 0===t?void 0:t.inline,this.defaultSettings=Object.assign({},this.document.options.a11y,this.settings),this.setA11y({roleDescription:this.settings.roleDescription})}initMenu(){const t=new Qu([["contextMenu",rp.fromJson.bind(rp)],["radioCompare",aE.fromJson.bind(aE)]]);this.menu=t.parse({type:"contextMenu",id:"MathJax_Menu",pool:[this.variable("showSRE"),this.variable("showTex"),this.variable("texHints"),this.variable("semantics"),this.variable("zoom"),this.variable("zscale"),this.variable("renderer",t=>this.setRenderer(t)),this.variable("overflow",t=>this.setOverflow(t)),this.variable("breakInline",t=>this.setInlineBreaks(t)),this.variable("alt"),this.variable("cmd"),this.variable("ctrl"),this.variable("shift"),this.variable("scale",t=>this.setScale(t)),this.a11yVar("speech",t=>this.setSpeech(t)),this.a11yVar("braille",t=>this.setBraille(t)),this.variable("brailleCode",t=>this.setBrailleCode(t)),this.a11yVar("brailleSpeech",t=>this.setBrailleSpeech(t)),this.a11yVar("brailleCombine",t=>this.setBrailleCombine(t)),this.a11yVar("highlight",t=>this.setHighlight(t)),this.a11yVar("backgroundColor",t=>this.setColor("bg",t)),this.a11yVar("backgroundOpacity",t=>this.setColor("bg",null,t)),this.a11yVar("foregroundColor",t=>this.setColor("fg",t)),this.a11yVar("foregroundOpacity",t=>this.setColor("fg",null,t)),this.a11yVar("subtitles"),this.a11yVar("viewBraille"),this.a11yVar("voicing"),this.a11yVar("roleDescription",()=>this.setRoleDescription()),this.a11yVar("help"),this.a11yVar("locale",t=>this.setLocale(t)),this.variable("speechRules",t=>{const[e,s]=t.split("-");this.document.options.sre.domain=e,this.document.options.sre.style=s,this.rerender(ar.COMPILED)}),this.a11yVar("magnification"),this.a11yVar("magnify"),this.a11yVar("treeColoring"),this.a11yVar("infoType"),this.a11yVar("infoRole"),this.a11yVar("infoPrefix"),this.variable("autocollapse"),this.variable("collapsible",t=>this.setCollapsible(t)),this.variable("enrich",t=>this.setEnrichment(t)),this.a11yVar("inTabOrder",t=>this.setTabOrder(t)),this.a11yVar("tabSelects"),this.variable("assistiveMml",t=>this.setAssistiveMml(t))],items:[this.submenu("Show","Show Math As",[this.command("MathMLcode","MathML Code",()=>this.mathMLCode()),this.command("Original","Original Form",()=>this.originalText()),this.rule(),this.command("Speech","Speech Text",()=>this.speechText(),{disabled:!0}),this.command("Braille","Braille Code",()=>this.brailleText(),{disabled:!0}),this.command("SVG","SVG Image",()=>this.svgImage(),{disabled:!0}),this.submenu("ShowAnnotation","Annotation"),this.rule(),this.command("Error","Error Message",()=>this.errorMessage(),{disabled:!0})]),this.submenu("Copy","Copy to Clipboard",[this.command("MathMLcode","MathML Code",()=>this.copyMathML()),this.command("Original","Original Form",()=>this.copyOriginal()),this.rule(),this.command("Speech","Speech Text",()=>this.copySpeechText(),{disabled:!0}),this.command("Braille","Braille Code",()=>this.copyBrailleText(),{disabled:!0}),this.command("SVG","SVG Image",()=>this.copySvgImage(),{disabled:!0}),this.submenu("CopyAnnotation","Annotation"),this.rule(),this.command("Error","Error Message",()=>this.copyErrorMessage(),{disabled:!0})]),this.rule(),this.submenu("Settings","Math Settings",[this.submenu("Renderer","Math Renderer",this.radioGroup("renderer",[["CHTML"],["SVG"]])),this.submenu("Overflow","Wide Expressions",[this.radioGroup("overflow",[["Overflow"],["Scroll"],["Linebreak"],["Scale"],["Truncate"],["Elide"]]),this.rule(),this.checkbox("BreakInline","Allow In-line Breaks","breakInline")]),this.rule(),this.submenu("MathmlIncludes","MathML/SVG has",[this.checkbox("showSRE","Semantic attributes","showSRE"),this.checkbox("showTex","LaTeX attributes","showTex"),this.checkbox("texHints","TeX hints","texHints"),this.checkbox("semantics","Original as annotation","semantics")]),this.submenu("Language","Language"),this.rule(),this.submenu("ZoomTrigger","Zoom Trigger",[this.command("ZoomNow","Zoom Once Now",()=>this.zoom(null,"")),this.rule(),this.radioGroup("zoom",[["Click"],["DoubleClick","Double-Click"],["NoZoom","No Zoom"]]),this.rule(),this.label("TriggerRequires","Trigger Requires:"),this.checkbox(Zb?"Option":"Alt",Zb?"Option":"Alt","alt"),this.checkbox("Command","Command","cmd",{hidden:!Zb}),this.checkbox("Control","Control","ctrl",{hidden:Zb}),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...",()=>this.scaleAllMath()),this.rule(),this.command("Reset","Reset to defaults",()=>this.resetDefaults())]),this.rule(),this.label("Accessibility","\xa0\xa0 Accessibility:"),this.submenu("Speech","\xa0 \xa0 Speech",[this.checkbox("Generate","Generate","speech"),this.checkbox("Subtitles","Show Subtitles","subtitles"),this.checkbox("Auto Voicing","Auto Voicing","voicing"),this.rule(),this.label("Rules","Rules:"),this.submenu("Mathspeak","Mathspeak",this.radioGroup("speechRules",[["mathspeak-default","Verbose"],["mathspeak-brief","Brief"],["mathspeak-sbrief","Superbrief"]])),this.submenu("Clearspeak","Clearspeak",this.radioGroup("speechRules",[["clearspeak-default","Auto"]])),this.rule(),this.submenu("A11yLanguage","Language")]),this.submenu("Braille","\xa0 \xa0 Braille",[this.checkbox("Generate","Generate","braille"),this.checkbox("Subtitles","Show Subtitles","viewBraille"),this.checkbox("BrailleSpeech","Replace Speech","brailleSpeech",{hidden:!0}),this.checkbox("BrailleCombine","Combine with Speech","brailleCombine"),this.rule(),this.label("Code","Code Format:"),this.radioGroup("brailleCode",[["nemeth","Nemeth"],["ueb","UEB"],["euro","Euro"]])]),this.submenu("Explorer","\xa0 \xa0 Explorer",[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")]),this.rule(),this.submenu("Role Description","Describe math as",[this.radioGroup("roleDescription",[["MathJax expression"],["MathJax"],["math"],["clickable math"],["explorable math"],["none"]])]),this.checkbox("Math Help","Help message on focus","help")]),this.submenu("Options","\xa0 \xa0 Options",[this.checkbox("Enrich","Semantic Enrichment","enrich"),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.submenu("TabSelects","Tabbing Focuses on",[this.radioGroup("tabSelects",[["all","Whole Expression"],["last","Last Explored Node"]])]),this.rule(),this.checkbox("AssistiveMml","Include Hidden MathML","assistiveMml")]),this.rule(),this.command("About","About MathJax",()=>this.about()),this.command("Help","MathJax Help",()=>this.help())]});const e=this.menu;e.settings=this.settings,e.findID("Settings","Overflow","Elide").disable(),e.findID("Braille","ueb").hide(),e.setJax(this.jax),this.checkLoadableItems();const s=[];rp.DynamicSubmenus.set("ShowAnnotation",[eE(()=>this.annotationBox(),this.options.annotationTypes,s),""]),rp.DynamicSubmenus.set("CopyAnnotation",[sE(s),""]),function(t){ip(Object.assign(Object.assign({},ep),sp),t)}(this.document.document)}checkLoadableItems(){var t,e,s,i,r,n;if(hE&&hE._&&hE.loader&&hE.startup){const o=this.settings,a=this.document.options;(o.enrich||o.speech&&a.enableSpeech||o.braille&&a.enableBraille)&&!(null===(e=null===(t=hE._)||void 0===t?void 0:t.a11y)||void 0===e?void 0:e.explorer)&&this.loadA11y("explorer"),o.collapsible&&!(null===(i=null===(s=hE._)||void 0===s?void 0:s.a11y)||void 0===i?void 0:i.complexity)&&this.loadA11y("complexity"),o.assistiveMml&&!(null===(n=null===(r=hE._)||void 0===r?void 0:r.a11y)||void 0===n?void 0:n["assistive-mml"])&&this.loadA11y("assistive-mml")}else{const t=this.menu;for(const e of Object.keys(this.jax))this.jax[e]||t.findID("Settings","Renderer",e).disable();t.findID("Speech").disable(),t.findID("Braille").disable(),t.findID("Explorer").disable(),t.findID("Options","AutoCollapse").disable(),t.findID("Options","Collapsible").disable(),t.findID("Options","Enrich").disable(),t.findID("Options","AssistiveMml").disable()}}enableAccessibilityItems(t,e){const s=this.menu.findID(t).submenu;for(const t of s.items.slice(1))t instanceof _u||(!e||t instanceof wu&&!t.submenu.items.length?t.disable():t.enable())}mergeUserSettings(){try{const t=localStorage.getItem(dE.MENU_STORAGE);if(!t)return;const e=JSON.parse(t);Object.assign(this.settings,e),this.setA11y(e)}catch(t){console.log("MathJax localStorage error: "+t.message)}}saveUserSettings(){const t={};for(const e of Object.keys(this.settings))this.settings[e]!==this.defaultSettings[e]&&(t[e]=this.settings[e]);try{Object.keys(t).length?localStorage.setItem(dE.MENU_STORAGE,JSON.stringify(t)):localStorage.removeItem(dE.MENU_STORAGE)}catch(t){console.log("MathJax localStorage error: "+t.message)}}setA11y(t){var e,s;(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)&&hE._.a11y.explorer_ts.setA11yOptions(this.document,t)}getA11y(t){var e,s;if(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)return void 0!==this.document.options.a11y[t]?this.document.options.a11y[t]:this.document.options.sre[t]}applySettings(){this.setTabOrder(this.settings.inTabOrder);this.document.options.enableAssistiveMml=this.settings.assistiveMml,this.enableAccessibilityItems("Speech",this.settings.speech),this.enableAccessibilityItems("Braille",this.settings.braille),this.setAccessibilityMenus();const t=this.settings.renderer.replace(/[^a-zA-Z0-9]/g,"")||"CHTML";(dE._loadingPromise||Promise.resolve()).then(()=>{const e=this.settings;if(this.applyRendererOptions(this.document.outputJax),!e.speechRules){const t=this.document.options.sre;e.speechRules=`${t.domain||"clearspeak"}-${t.style||"default"}`}t!==this.defaultSettings.renderer&&this.document.whenReady(()=>this.setRenderer(t,!1))})}setOverflow(t){this.document.outputJax.options.displayOverflow=t.toLowerCase(),dE.loading||this.document.rerenderPromise()}setInlineBreaks(t){this.document.outputJax.options.linebreaks.inline=t,dE.loading||this.document.rerenderPromise()}setScale(t){this.document.outputJax.options.scale=parseFloat(t),dE.loading||this.document.rerenderPromise()}setRenderer(t,e=!0){if(Object.hasOwn(this.jax,t)&&this.jax[t])return this.applyRendererOptions(this.jax[t]),this.setOutputJax(t,e);const s=t.toLowerCase();return new Promise((i,r)=>{this.loadComponent("output/"+s,()=>{const n=hE.startup;if(!(s in n.constructors))return r(new Error(`Component ${s} not loaded`));n.useOutput(s,!0),n.output=this.applyRendererOptions(n.getOutputJax()),n.output.setAdaptor(this.document.adaptor),n.output.initialize(),this.jax[t]=n.output,this.setOutputJax(t,e).then(()=>i()).catch(t=>r(t))})})}applyRendererOptions(t){const e=this.settings,s=t.options;return s.scale=parseFloat(e.scale),s.displayOverflow=e.overflow.toLowerCase(),s.linebreaks&&(s.linebreaks.inline=e.breakInline),t}setOutputJax(t,e=!0){this.jax[t].setAdaptor(this.document.adaptor),this.document.outputJax=this.jax[t];const s=this.loadRequiredExtensions();return e?s.then(()=>to.handleRetriesFor(()=>this.rerender())):s.then(()=>{})}loadRequiredExtensions(){const t=this.document.outputJax.name.toLowerCase(),e=[];for(const s of this.requiredExtensions)e.push(hE.loader.load(`[${s}]/${t}`));return this.requiredExtensions=[],Promise.all(e)}addRequiredExtensions(t){if(t){const e=new Set([...this.requiredExtensions,...t]);this.requiredExtensions=[...e]}}setTabOrder(t){const e=this.menu.findID("Options","TabSelects");t?e.enable():e.disable(),this.menu.store.inTaborder(t)}setAssistiveMml(t){var e,s;this.document.options.enableAssistiveMml=t,t&&this.noRerender(()=>{this.settings.speech&&this.menu.pool.lookup("speech").setValue(!1),this.settings.braille&&this.menu.pool.lookup("braille").setValue(!1)}),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s["assistive-mml"])?this.rerender():this.loadA11y("assistive-mml")}setAccessibilityMenus(){const t=this.settings.enrich,e=t?"enable":"disable";["Speech","Braille","Explorer"].forEach(t=>this.menu.findID(t)[e]());const s=this.document.options;s.enableSpeech=s.enableBraille=s.enableExplorer=t,t||(this.settings.collapsible=!1,this.document.options.enableCollapsible=!1)}setSpeech(t){var e,s;this.enableAccessibilityItems("Speech",t),this.document.options.enableSpeech=t,t&&(this.settings.assistiveMml&&this.noRerender(()=>this.menu.pool.lookup("assistiveMml").setValue(!1)),this.settings.brailleSpeech&&this.noRerender(()=>this.menu.pool.lookup("brailleSpeech").setValue(!1))),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)?this.rerender(ar.COMPILED):this.loadA11y("explorer")}setBraille(t){var e,s;this.enableAccessibilityItems("Braille",t),this.document.options.enableBraille=t,t&&this.settings.assistiveMml&&this.noRerender(()=>this.menu.pool.lookup("assistiveMml").setValue(!1)),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)?this.rerender(ar.COMPILED):this.loadA11y("explorer")}setBrailleCode(t){this.document.options.sre.braille=t,this.rerender(ar.COMPILED)}setBrailleSpeech(t){t&&this.settings.speech?this.noRerender(()=>this.menu.pool.lookup("speech").setValue(!1)):this.enableAccessibilityItems("Speech",!0),this.settings.brailleCombine=this.document.options.a11y.brailleCombine=!1,this.rerender(ar.COMPILED)}setBrailleCombine(t){this.settings.brailleSpeech&&this.menu.pool.lookup("brailleSpeech").setValue(!1),this.settings.brailleSpeech=this.document.options.a11y.brailleSpeech=!1,this.rerender(ar.COMPILED)}setLocale(t){this.document.options.sre.locale=t,this.rerender(ar.COMPILED)}setRoleDescription(){this.rerender(ar.COMPILED)}setEnrichment(t){var e,s;this.document.options.enableEnrichment=t,this.setAccessibilityMenus(),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)?this.rerender(ar.COMPILED):this.loadA11y("explorer")}setCollapsible(t){var e,s;this.document.options.enableComplexity=t,t&&!this.settings.enrich&&(this.settings.enrich=this.document.options.enableEnrichment=!0,this.setAccessibilityMenus()),t||this.menu.pool.lookup("highlight").setValue("None"),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.complexity)?this.rerender(ar.COMPILED):this.loadA11y("complexity")}setHighlight(t){var e,s;if("None"!==t){if(!this.settings.collapsible){const t=this.menu.pool.lookup("collapsible");t.setValue(!0),null===(s=null===(e=t.items[0])||void 0===e?void 0:e.executeCallbacks_)||void 0===s||s.call(e)}dE.loadingPromises.has("a11y/complexity")||this.rerender(ar.COMPILED)}}setColor(t,e,s){const i=this.document.options.a11y;e||(e=i["fg"===t?"foregroundColor":"backgroundColor"]),s||(s=i["fg"===t?"foregroundOpacity":"backgroundOpacity"]),hE._.a11y.explorer.Region.LiveRegion.setColor(t,1,e.toLowerCase(),parseInt(s)/100)}scaleAllMath(){const t=(100*parseFloat(this.settings.scale)).toFixed(1).replace(/.0$/,""),e=prompt("Scale all mathematics (compared to surrounding text) by",t+"%");if(this.current){const t=this.menu.mathItem.explorers.speech;t.refocus=this.current,t.focus()}if(e)if(e.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)){const t=parseFloat(e)/100;t?this.menu.pool.lookup("scale").setValue(String(t)):alert("The scale should not be zero")}else alert("The scale should be a percentage (e.g., 120%)")}resetDefaults(){this.noRerender(()=>{const t=this.menu.pool,e=this.defaultSettings;for(const s of Object.keys(e)){const i=t.lookup(s);if(i){if(i.getValue()!==e[s]){i.setValue(e[s]);const t=i.items[0];t&&t.executeCallbacks_()}}else Object.hasOwn(this.settings,s)&&(this.settings[s]=e[s])}}),this.rerender(ar.COMPILED)}checkComponent(t){const e=dE.loadingPromises.get(t);e&&to.retryAfter(e)}loadComponent(t,e){if(dE.loadingPromises.has(t))return;const s=hE.loader;if(!s)return;dE.loading++;const i=s.load(t).then(()=>{dE.loading--,dE.loadingPromises.delete(t),0===dE.loading&&dE._loadingPromise&&(dE._loadingPromise=null,dE._loadingOK()),e()}).catch(t=>{dE._loadingPromise?(dE._loadingPromise=null,dE._loadingFailed(t)):console.log(t)});dE.loadingPromises.set(t,i)}loadA11y(t){const e=!ar.ENRICHED;this.loadComponent("a11y/"+t,()=>{var s,i;const r=hE.startup;to.handlers.unregister(r.handler),r.handler=r.getHandler(),to.handlers.register(r.handler);const n=this.document;this.document=r.document=r.getDocument(),this.document.processed=n.processed,this.document.menu=this,n.webworker&&(this.document.webworker=n.webworker),this.setA11y(this.settings),this.defaultSettings=Object.assign({},this.document.options.a11y,(null===(i=null===(s=hE.config)||void 0===s?void 0:s.options)||void 0===i?void 0:i.a11y)||{},this.defaultSettings),this.document.outputJax.reset(),this.transferMathList(n),this.document.processed=n.processed,dE._loadingPromise||(this.document.outputJax.reset(),to.handleRetriesFor(()=>{this.rerender("complexity"===t||e?ar.COMPILED:ar.TYPESET)}))})}transferMathList(t){const e=this.document.options.MathItem;for(const s of t.math){const t=new e;Object.assign(t,s),this.document.math.push(t)}}toMML(t){return this.MmlVisitor.visitTree(t.root,t,{filterSRE:!this.settings.showSRE,filterTex:!this.settings.showTex,texHints:this.settings.texHints,semantics:this.settings.semantics&&"MathML"!==t.inputJax.name})}toSVG(t){return cE(this,void 0,void 0,function*(){const e=this.jax.SVG;if(!e)return"SVG can't be produced.
Try switching to SVG output first.";const s=e.adaptor,i=e.options.fontCache,r=!!t.root.getProperty("process-breaks");if("global"!==i&&(t.display||!r)&&"SVG"===s.getAttribute(t.typesetRoot,"jax"))for(const e of s.childNodes(t.typesetRoot))if("svg"===s.kind(e))return this.formatSvg(s.serializeXML(e));return this.typesetSVG(t,i,r)})}typesetSVG(t,e,s){return cE(this,void 0,void 0,function*(){const i=this.jax.SVG,r=i.html("div");"global"===e&&(i.options.fontCache="local");const n=t.root;return t.root=n.copy(!0),t.root.setInheritedAttributes({},t.display,0,!1),s&&(i.unmarkInlineBreaks(t.root),t.root.setProperty("inlineMarked",!1)),yield to.handleRetriesFor(()=>{i.toDOM(t,r,i.document)}),t.root=n,i.options.fontCache=e,this.formatSvg(i.adaptor.serializeXML(r))})}formatSvg(t){const e=this.constructor.SvgCss,s=(t=(t=t.match(/^/)?t.replace(//,``):t.replace(/^()/,`$1`)).replace(/ (?:role|focusable)=".*?"/g,"").replace(/"currentColor"/g,'"black"')).split(/(<\/?[a-zA-Z].*?>)/);for(let t=2,e="";t\n${t}`}zoom(t,e){t&&!this.isZoomEvent(t,e)||this.zoomBox()}isZoomEvent(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)}rerender(t=ar.TYPESET){this.rerenderStart=Math.min(t,this.rerenderStart),!dE.loading&&hE.startup.hasTypeset&&this.document.whenReady(()=>cE(this,void 0,void 0,function*(){this.rerenderStart<=ar.COMPILED&&this.document.reset({inputJax:[]}),yield this.document.rerenderPromise(this.rerenderStart),this.rerenderStart=ar.LAST}))}noRerender(t){dE.loading++;try{t(),dE.loading--}catch(t){throw dE.loading--,t}}copyMathML(){tE(this.toMML(this.menu.mathItem))}copyOriginal(){tE(this.menu.mathItem.math.trim())}copySvgImage(){this.toSVG(this.menu.mathItem).then(t=>{tE(t)})}copySpeechText(){tE(this.menu.mathItem.outputData.speech)}copyBrailleText(){tE(this.menu.mathItem.outputData.braille)}copyErrorMessage(){tE(this.menu.errorMsg.trim())}addMenu(t){this.addEvents(t),this.menu.store.insert(t.typesetRoot),t.typesetRoot.tabIndex=this.settings.inTabOrder?0:-1}addEvents(t){const e=t.typesetRoot;e.addEventListener("mousedown",()=>{var e,s;this.menu.mathItem=t,this.current=null===(s=null===(e=t.explorers)||void 0===e?void 0:e.speech)||void 0===s?void 0:s.current},!0),e.addEventListener("contextmenu",()=>{var e;this.menu.mathItem=t;const s=null===(e=t.explorers)||void 0===e?void 0:e.speech;s&&(t.outputData.nofocus=!this.current,s.refocus=this.current)},!0),e.addEventListener("keydown",()=>this.menu.mathItem=t,!0),e.addEventListener("click",t=>this.zoom(t,"Click"),!0),e.addEventListener("dblclick",t=>this.zoom(t,"DoubleClick"),!0)}clear(){this.menu.store.clear()}variable(t,e){return{name:t,getter:()=>this.settings[t],setter:s=>{this.settings[t]=s,e&&e(s),this.saveUserSettings()}}}a11yVar(t,e){return{name:t,getter:()=>this.getA11y(t),setter:s=>{this.settings[t]=s,this.setA11y({[t]:s}),e&&e(s),this.saveUserSettings()}}}submenu(t,e,s=[],i=!1){let r=[];for(const t of s)Array.isArray(t)?r=r.concat(t):r.push(t);return{type:"submenu",id:t,content:e,menu:{items:r},disabled:0===r.length||i}}command(t,e,s,i={}){return Object.assign({type:"command",id:t,content:e,action:s},i)}checkbox(t,e,s,i={}){return Object.assign({type:"checkbox",id:t,content:e,variable:s},i)}radioGroup(t,e){return e.map(e=>this.radio(e[0],e[1]||e[0],t))}radio(t,e,s,i={}){return Object.assign({type:"radio",id:t,content:e,variable:s},i)}label(t,e){return{type:"label",id:t,content:e}}rule(){return{type:"rule"}}}function uE(t){return class extends t{addMenu(t,e=!1){this.state()>=ar.CONTEXT_MENU||(this.isEscaped||!t.options.enableMenu&&!e||t.menu.addMenu(this),this.state(ar.CONTEXT_MENU))}getMenus(t){t.menu.menu.store.sort()}checkLoading(t){t.checkLoading()}}}function pE(t){var e;return e=class extends t{constructor(...t){super(...t),this.menu=new this.options.MenuClass(this,this.options.menuOptions);const e=this.constructor.ProcessBits;e.has("context-menu")||e.allocate("context-menu"),this.options.MathItem=uE(this.options.MathItem);const s=this.menu.settings,i=this.options,r=i.enableEnrichment=s.enrich;i.enableSpeech=s.speech&&r,i.enableBraille=s.braille&&r,i.enableComplexity=s.collapsible&&r,i.enableExplorer=r}addMenu(){if(!this.processed.isSet("context-menu")){for(const t of this.math)t.addMenu(this);this.processed.set("context-menu")}return this}getMenus(){this.menu.menu.store.sort()}checkLoading(){let t=!0;try{this._checkLoading(),t=!1}catch(t){if(!t.retry)throw t}return t}_checkLoading(){return this.menu.isLoading&&to.retryAfter(this.menu.loadingPromise.catch(t=>console.log(t))),this.options.enableComplexity&&this.menu.checkComponent("a11y/complexity"),this.options.enableExplorer&&this.menu.checkComponent("a11y/explorer"),this}state(t,e=!1){return super.state(t,e),tconsole.warn("Enrichment Error:",s)},t.OPTIONS),{MenuClass:dE,menuOptions:dE.OPTIONS,enableMenu:!0,sre:t.OPTIONS.sre||wi({}),a11y:t.OPTIONS.a11y||wi({}),renderActions:wi(Object.assign(Object.assign({},t.OPTIONS.renderActions),{addMenu:[ar.CONTEXT_MENU],getMenus:[ar.INSERTED+5,!1],checkLoading:[ar.UNPROCESSED+1,t=>t.checkLoading(),"",!1]}))}),e}function mE(t){return t.documentClass=pE(t.documentClass),t}dE.MENU_STORAGE="MathJax-Menu-Settings",dE.OPTIONS={settings:{showSRE:!1,showTex:!1,texHints:!0,semantics:!1,zoom:"NoZoom",zscale:"200%",renderer:"CHTML",alt:!0,cmd:!1,ctrl:!1,shift:!1,scale:1,overflow:"Scroll",breakInline:!0,autocollapse:!1,collapsible:!1,enrich:!0,assistiveMml:!1,speech:!0,braille:!0,brailleCode:"nemeth",brailleSpeech:!1,brailleCombine:!1,speechRules:"clearspeak-default",roleDescription:"math",inTabOrder:!0,tabSelects:"all",help:!0},jax:{CHTML:null,SVG:null},annotationTypes:wi({TeX:["TeX","LaTeX","application/x-tex"],StarMath:["StarMath 5.0"],Maple:["Maple"],ContentMathML:["MathML-Content","application/mathml-content+xml"],OpenMath:["OpenMath"]})},dE.SvgCss=["svg a{fill:blue;stroke:blue}",'[data-mml-node="merror"]>g{fill:red;stroke:red}','[data-mml-node="merror"]>rect[data-background]{fill:yellow;stroke:none}',"[data-frame],[data-line]{stroke-width:70px;fill:none}",".mjx-dashed{stroke-dasharray:140}",".mjx-dotted{stroke-linecap:round;stroke-dasharray:0,140}","use[data-c]{stroke-width:3px}"].join("\n"),dE.loading=0,dE.loadingPromises=new Map,dE._loadingPromise=null,dE._loadingOK=null,dE._loadingFailed=null,lr("CONTEXT_MENU",170),MathJax.loader&&MathJax.loader.checkVersion("ui/menu",ri,"ui"),hi({_:{a11y:{speech:{SpeechMenu:js}},ui:{menu:{AnnotationMenu:Us,MJContextMenu:Bs,Menu:zs,MenuHandler:qs,MenuUtil:_s,MmlVisitor:Ws,RadioCompare:Hs}}}}),MathJax.startup&&ui&&MathJax.startup.extendHandler(t=>mE(t),20),MathJax.loader&&MathJax.loader.checkVersion("a11y/sre",ri,"a11y"),hi({_:{a11y:{sre_ts:Fs}}}),lr("ENRICHED",ar.COMPILED+10);class fE extends Yn{visitTree(t,e){this.mactionId=0;const s=super.visitTree(t);return this.mactionId&&(e.inputData.hasMaction=!0),s}visitHtmlNode(t,e){return t.getSerializedXML()}visitMactionNode(t,e){const[s,i]=0===t.childNodes.length?["",""]:["\n",e],r=this.childNodeMml(t,e+" ",s);let n=this.getAttributes(t);if("toggle"===t.attributes.get("actiontype")){const e=++this.mactionId;t.setProperty("mactionId",e),n=` data-maction-id="${e}" selection="${t.attributes.get("selection")}"`+n.replace(/ selection="\d+"/,"").replace(/ data-maction-id="\d+"/,"")}return`${e}`+(r.match(/\S/)?s+r+i:"")+""}}function gE(t,e,s){return class extends t{constructor(){super(...arguments),this.toMathML=s}serializeMml(t){if("outerHTML"in t)return t.outerHTML;if("undefined"!=typeof Element&&"undefined"!=typeof window&&t instanceof Element){const e=window.document.createElement("div");return e.appendChild(t),e.innerHTML}return t.toString()}enrich(t,s=!1){if(!(this.state()>=ar.ENRICHED)){if(!this.isEscaped&&(t.options.enableEnrichment||s)){const s=new t.options.MathItem("",e);try{let e;e=this.inputData.originalMml?this.adjustSelections():this.inputData.originalMml=this.toMathML(this.root,this);const i=Fb(e);this.inputData.enrichedMml=s.math=this.serializeMml(i),s.math=s.math.replace(/ role="treeitem"/g,' data-speech-node="true"').replace(/ aria-level/g," data-semantic-level-number").replace(/ aria-(?:posinset|owns|setsize)=".*?"/g,""),s.display=this.display,s.compile(t),this.root=s.root}catch(e){t.options.enrichError(t,this,e)}}this.state(ar.ENRICHED)}}toEnriched(t){return this.serializeMml(Fb(t))}unEnrich(t){const s=this.inputData.originalMml;if(!s)return;const i=new t.options.MathItem("",e);i.math=s,i.display=this.display,i.compile(t),this.root=i.root}adjustSelections(){const t=this.inputData.originalMml;if(!this.inputData.hasMaction)return t;const e=[];return this.root.walkTree(t=>{t.isKind("maction")&&(e[t.attributes.get("data-maction-id")]=t)}),t.replace(/(data-maction-id="(\d+)" selection=)"\d+"/g,(t,s,i)=>`${s}"${e[i].attributes.get("selection")}"`)}}}function bE(t,e){var s;return(s=class extends t{constructor(...t){super(...t),e.setMmlFactory(this.mmlFactory);const s=this.constructor.ProcessBits;s.has("enriched")||s.allocate("enriched");const i=new fE(this.mmlFactory);this.options.MathItem=gE(this.options.MathItem,e,(t,e)=>i.visitTree(t,e))}enrich(){if(!this.processed.isSet("enriched")){if(this.options.enableEnrichment){Pb(this.options.sre);for(const t of this.math)t.enrich(this)}this.processed.set("enriched")}return this}enrichError(t,e,s){console.warn("Enrichment error:",s)}state(t,e=!1){if(super.state(t,e),t=ar.COMPILED))for(const t of this.math)t.unEnrich(this);return this}}).OPTIONS=Object.assign(Object.assign({},t.OPTIONS),{enableEnrichment:!0,enrichError:(t,e,s)=>t.enrichError(t,e,s),renderActions:wi(Object.assign(Object.assign({},t.OPTIONS.renderActions),{enrich:[ar.ENRICHED]})),sre:wi({speech:"none",locale:"en",domain:"clearspeak",style:"default",braille:"nemeth",structure:!0,aria:!0})}),s}function EE(t,e){return e.setAdaptor(t.adaptor),t.documentClass=bE(t.documentClass,e),t}MathJax.loader&&MathJax.loader.checkVersion("a11y/semantic-enrich",ri,"a11y"),hi({_:{a11y:{"semantic-enrich":Vs}}}),MathJax.startup&&MathJax.startup.extendHandler(t=>EE(t,new Rc({allowHtmlInTokenNodes:!0})));const xE=["pitch","rate","volume"];function yE(t){const e=jb(t),s=[],i=[];return NE(Array.from(e.childNodes),s,i),[i.join(" "),s]}function NE(t,e,s,i={}){for(const r of t){if(3===r.nodeType){const t=r.textContent.trim();t&&(s.push(t),e.push(Object.assign({text:t},i)));continue}if(1===r.nodeType){const t=r,n=t.tagName;if("speak"===n)continue;if("prosody"===n){NE(Array.from(r.childNodes),e,s,TE(t,i));continue}switch(n){case"break":e.push({pause:t.getAttribute("time")});break;case"mark":e.push({mark:t.getAttribute("name")});break;case"say-as":{const r=t.textContent;e.push(Object.assign({text:r,character:!0},i)),s.push(r);break}}}}}const vE={pitch:(t,e)=>t/100*1,volume:(t,e)=>t/100*.5,rate:(t,e)=>t/100*1};function TE(t,e){const s={};for(const i of xE)if(t.hasAttribute(i)){const[r,n]=AE(t.getAttribute(i));if(!r){s[i]="volume"===i?.5:1;continue}let o=e[i];o=o||("volume"===i?.5:1);const a=vE[i](parseInt(n,10),r);s[i]="-"===r?o-a:o+a}return s}const CE=/([+-]?)([0-9]+)%/;function AE(t){const e=t.match(CE);return e?[e[1],e[2]]:(console.warn("Something went wrong with the prosody matching."),["","100"])}function LE(t,e,s,i=" "){if(!t)return"";const r=[t];return e&&r.unshift(e),s&&r.push(s),r.join(i)}function SE(t,e="en",s="100"){return yE(`${t}`)}function RE(){const t=new AudioContext,e=t.createOscillator();e.frequency.value=300,e.connect(t.destination),e.start(t.currentTime),e.stop(t.currentTime+.05)}var ME,IE;!function(t){t[t.NONE=0]="NONE",t[t.DEPTH=1]="DEPTH",t[t.SUMMARY=2]="SUMMARY"}(ME||(ME={})),function(t){t.SPEECH="data-semantic-speech-none",t.SPEECH_SSML="data-semantic-speech",t.SUMMARY="data-semantic-summary-none",t.SUMMARY_SSML="data-semantic-summary",t.PREFIX="data-semantic-prefix-none",t.PREFIX_SSML="data-semantic-prefix",t.POSTFIX="data-semantic-postfix-none",t.POSTFIX_SSML="data-semantic-postfix",t.BRAILLE="data-semantic-braille"}(IE||(IE={}));class wE{constructor(){this.promise=Promise.resolve(),this.adaptor=null,this._options={},this._init=!1}set element(t){this._element=t}get element(){return this._element}set options(t){this._options=Object.assign({},(null==t?void 0:t.sre)||{},{enableSpeech:t.enableSpeech,enableBraille:t.enableBraille}),delete this._options.custom}get options(){return this._options}init(t,e,s){this.options=t,this._init||(this.adaptor=e,this.webworker=s,this._init=!0)}update(t){Object.assign(this.options,t)}Speech(t){const e=t.outputData.mml,s=Object.assign({},this.options,{modality:"speech"});return this.promise=this.webworker.Speech(e,s,t)}SpeechFor(t,e){const s=Object.assign({},this.options,{modality:"speech"});return this.webworker.speechFor(e,s,t)}cancel(t){var e;null===(e=this.webworker)||void 0===e||e.Cancel(t)}updateRegions(t,e,s){e.Update(this.getLabel(t)),s.Update(this.getBraille(t))}getOptions(t){var e,s,i,r;return{locale:null!==(e=this.adaptor.getAttribute(t,"data-semantic-locale"))&&void 0!==e?e:"",domain:null!==(s=this.adaptor.getAttribute(t,"data-semantic-domain"))&&void 0!==s?s:"",style:null!==(i=this.adaptor.getAttribute(t,"data-semantic-style"))&&void 0!==i?i:"",domain2style:null!==(r=this.adaptor.getAttribute(t,"data-semantic-domain2style"))&&void 0!==r?r:""}}nextRules(t){const e=this.getOptions(t.typesetRoot);return this.update(e),this.promise=this.webworker.nextRules(t.outputData.mml,Object.assign({},this.options,{modality:"speech"}),t)}nextStyle(t,e){const s=this.getOptions(e.typesetRoot);return this.update(s),this.promise=this.webworker.nextStyle(e.outputData.mml,Object.assign({},this.options,{modality:"speech"}),this.adaptor.getAttribute(t,"data-semantic-id"),e)}getLabel(t,e="",s=" "){const i=this.adaptor;return LE(i.getAttribute(t,IE.SPEECH_SSML),i.getAttribute(t,IE.PREFIX_SSML),i.getAttribute(t,IE.POSTFIX_SSML),s)||i.getAttribute(t,"aria-label")}getBraille(t){const e=this.adaptor;return e.getAttribute(t,"aria-braillelabel")||e.getAttribute(t,IE.BRAILLE)}getLocalePreferences(t){return this.promise=this.webworker.clearspeakLocalePreferences(this.options,t)}getRelevantPreferences(t,e,s,i){const r=t.outputData.mml;return this.promise=this.webworker.clearspeakRelevantPreferences(r,e,s,i)}}var kE=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};class OE{constructor(t,e,s,i){this.cmd=t,this.item=e,this.resolve=s,this.reject=i}}class DE{constructor(t,e){this.adaptor=t,this.options=e,this.ready=!1,this.tasks=[],this.Commands={Ready(t,e){t.ready=!0,t.postNext()},Finished(t,e){const s=t.tasks.shift();e.success?s.resolve(e.result):s.reject(e.error),t.postNext()},Log(t,e){t.options.debug&&console.log("Log:",e)}}}Start(){return kE(this,void 0,void 0,function*(){if(this.ready)throw Error("Worker already started");this.worker=yield this.adaptor.createWorker(this.Listener.bind(this),this.options)})}debug(t,...e){this.options.debug&&console.info(t,...e)}Listener(t){this.debug("Worker >>> Client:",t.data),Object.hasOwn(this.Commands,t.data.cmd)?this.Commands[t.data.cmd](this,t.data.data):this.debug("Invalid command from worker: "+t.data.cmd)}Post(t,e){const s=new Promise((s,i)=>{this.tasks.push(new OE(t,e,s,i))});return this.ready&&1===this.tasks.length&&this.postNext(),s}postNext(){if(this.tasks.length){const t=Object.assign({},this.tasks[0].cmd,{debug:this.options.debug});this.worker.postMessage(t)}}Cancel(t){const e=this.tasks.findIndex(e=>e.item===t);e>0&&(this.tasks[e].reject(`Task ${this.tasks[e].cmd.cmd} cancelled`),this.tasks.splice(e,1))}Setup(t){return this.Post({cmd:"setup",data:{domain:t.domain,style:t.style,locale:t.locale,modality:t.modality}})}Speech(t,e,s){return kE(this,void 0,void 0,function*(){this.Attach(s,e.enableSpeech,e.enableBraille,yield this.Post({cmd:"speech",data:{mml:t,options:e}},s))})}nextRules(t,e,s){return kE(this,void 0,void 0,function*(){this.Attach(s,e.enableSpeech,e.enableBraille,yield this.Post({cmd:"nextRules",data:{mml:t,options:e}},s))})}nextStyle(t,e,s,i){return kE(this,void 0,void 0,function*(){this.Attach(i,e.enableSpeech,e.enableBraille,yield this.Post({cmd:"nextStyle",data:{mml:t,options:e,nodeId:s}},i))})}speechFor(t,e,s){return kE(this,void 0,void 0,function*(){const i=yield this.Post({cmd:"speech",data:{mml:t,options:e}},s);return JSON.parse(i)})}Attach(t,e,s,i){const r=JSON.parse(i),n=t.typesetRoot;if(!n)return;this.setSpecialAttributes(n,r.options,"data-semantic-",["locale","domain","style","domain2style"]);const o=this.adaptor;this.setSpecialAttributes(n,r.translations,"data-semantic-");for(const[t,e]of Object.entries(r.mactions)){let s=o.getElement("#"+t,n);s&&o.childNodes(s)[0]&&(s=o.childNodes(s)[0],"rect"===o.kind(s)&&(s=o.next(s)),o.setAttribute(s,"data-semantic-type","dummy"),this.setSpecialAttributes(s,e,""))}for(const t of o.childNodes(n))"mjx-math"!==o.kind(t)&&"svg"!==o.kind(t)||this.setSpeechAttributes(t,"",r,e,s);e&&(r.label&&(o.setAttribute(n,IE.SPEECH,r.label),o.setAttribute(n,IE.SPEECH_SSML,r.ssml),t.outputData.speech=r.label),o.setAttribute(n,"data-speech-attached","true")),s&&(r.braillelabel&&(o.setAttribute(n,IE.BRAILLE,r.braillelabel),t.outputData.braille=r.braillelabel),r.braille&&o.setAttribute(n,"data-braille-attached","true"))}setSpeechAttribute(t,e,s,i){var r,n;const o=this.adaptor,a=o.getAttribute(t,"data-semantic-id");if(o.removeAttribute(t,"data-speech-node"),s&&e.speech[a]["speech-none"]){o.setAttribute(t,"data-speech-node","true");for(let[s,i]of Object.entries(e.speech[a]))s=s.replace(/-ssml$/,""),i&&o.setAttribute(t,`data-semantic-${s}`,i)}if(i&&(null===(n=null===(r=e.braille)||void 0===r?void 0:r[a])||void 0===n?void 0:n["braille-none"])){o.setAttribute(t,"data-speech-node","true");const s=e.braille[a]["braille-none"];o.setAttribute(t,IE.BRAILLE,s)}}setSpeechAttributes(t,e,s,i,r){const n=this.adaptor;if(!t||"#text"===n.kind(t)||"#comment"===n.kind(t))return e;n.hasAttribute(t,"data-semantic-id")&&(this.setSpeechAttribute(t,s,i,r),e||n.hasAttribute(t,"data-semantic-parent")||(e=n.getAttribute(t,"data-semantic-id")));for(const o of Array.from(n.childNodes(t)))e=this.setSpeechAttributes(o,e,s,i,r);return e}setSpecialAttributes(t,e,s,i){if(e){i=i||Object.keys(e);for(const r of i){const i=e[r];i&&this.adaptor.setAttribute(t,`${s}${r.toLowerCase()}`,i)}}}Detach(t){const e=t.typesetRoot;this.adaptor.removeAttribute(e,"data-speech-attached"),this.adaptor.removeAttribute(e,"data-braille-attached"),this.detachSpeech(e)}detachSpeech(t){const e=this.adaptor,s=e.childNodes(t);if(s){if("#text"!==e.kind(t))for(const s of["none","summary-none","speech","speech-none","summary","braille"])e.removeAttribute(t,`data-semantic-${s}`);for(const t of s)this.detachSpeech(t)}}Terminate(){this.debug("Terminating pending tasks");for(const t of this.tasks)t.reject(`${t.cmd.data.cmd} cancelled by WorkerHandler termination`);return this.tasks=[],this.debug("Terminating worker"),this.worker.terminate()}Stop(){return kE(this,void 0,void 0,function*(){if(!this.worker)throw Error("Worker has not been started");yield this.Terminate(),this.worker=null,this.ready=!1})}clearspeakLocalePreferences(t,e){return kE(this,void 0,void 0,function*(){yield this.Post({cmd:"localePreferences",data:{options:t}}).then(s=>{e.set(t.locale,JSON.parse(s))})})}clearspeakRelevantPreferences(t,e,s,i){return kE(this,void 0,void 0,function*(){yield this.Post({cmd:"relevantPreferences",data:{mml:t,id:e}}).then(t=>{s.set(i,t)})})}}const PE=di.config||{},BE=()=>(PE?.loader?.paths?.mathjax||PE?.__dirname||"/")+"/sre";var FE=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};function jE(t){return class extends t{constructor(){super(...arguments),this.generatorPool=new wE}attachSpeech(t){if(this.outputData.speechPromise=null,this.state()>=ar.ATTACHSPEECH)return;if(this.state(ar.ATTACHSPEECH),this.isEscaped||!t.options.enableSpeech&&!t.options.enableBraille||!t.options.enableEnrichment)return;t.getWebworker(),this.generatorPool.init(t.options,t.adaptor,t.webworker),this.outputData.mml=this.toMathML(this.root,this);const e=this.generatorPool.Speech(this).catch(e=>t.options.speechError(t,this,e));t.savePromise(e),this.outputData.speechPromise=e}detachSpeech(t){t.webworker.Detach(this)}speechFor(t){return FE(this,void 0,void 0,function*(){t=this.toEnriched(t);const e=yield this.generatorPool.SpeechFor(this,t);return[e.label,e.braillelabel]})}clear(){this.generatorPool.cancel(this)}}}function _E(t){var e;return e=class extends t{constructor(...t){super(...t),this.webworker=null;const e=this.constructor.ProcessBits;e.has("attach-speech")||e.allocate("attach-speech"),this.options.MathItem=jE(this.options.MathItem)}getWebworker(){this.webworker||(this.webworker=new DE(this.adaptor,this.options.worker),this.webworker.Start())}attachSpeech(){if(!this.processed.isSet("attach-speech")){const t=this.options;if(t.enableEnrichment&&(t.enableSpeech||t.enableBraille)){this.getWebworker();for(const t of this.math)t.attachSpeech(this)}this.processed.set("attach-speech")}return this}speechError(t,e,s){console.warn("Speech generation error:",s)}state(t,e=!1){if(super.state(t,e),t=ar.TYPESET))for(const t of this.math)t.detachSpeech(this);return this}done(){const t=Object.create(null,{done:{get:()=>super.done}});return FE(this,void 0,void 0,function*(){var e;return yield null===(e=this.webworker)||void 0===e?void 0:e.Stop(),t.done.call(this)})}},e.OPTIONS=Object.assign(Object.assign({},t.OPTIONS),{enableSpeech:!0,enableBraille:!0,speechError:(t,e,s)=>t.speechError(t,e,s),renderActions:wi(Object.assign(Object.assign({},t.OPTIONS.renderActions),{attachSpeech:[ar.ATTACHSPEECH]})),worker:{path:BE(),maps:BE().replace(/[cm]js\/a11y\/sre$/,"bundle/sre/mathmaps"),worker:"speech-worker.js",debug:!1},a11y:wi({speech:!0,braille:!0})}),e}function UE(t,e){return!t.documentClass.prototype.enrich&&e&&(t=EE(t,e)),t.documentClass=_E(t.documentClass),t}if(lr("ATTACHSPEECH",ar.INSERTED+10),MathJax.loader&&MathJax.loader.checkVersion("a11y/speech",ri,"a11y"),hi({_:{a11y:{speech_ts:Ks,speech:{GeneratorPool:Gs,SpeechUtil:Xs,WebWorker:Js}}}}),MathJax.loader){let t=fi.resolvePath("[sre]",!1),e=fi.resolvePath("[mathmaps]",!1);if(pi.window)t=new URL(t,location).href,e=new URL(e,location).href;else{const s="undefined"!=typeof require?require:MathJax.config.loader.require;s?.resolve?(t=pi.path(s.resolve(`${t}/require.mjs`)).replace(/\/[^\/]*$/,""),e=pi.path(s.resolve(`${e}/base.json`)).replace(/\/[^\/]*$/,"")):t=e=""}t&&ci(MathJax.config,"options",{worker:{path:t,maps:e}})}MathJax.startup&&MathJax.startup.extendHandler(t=>UE(t));class HE{constructor(t){this.document=t,this.CLASS=this.constructor,this.AddStyles()}static get sheetId(){return"MJX-"+this.name+"-styles"}static get styleSheet(){return document.head.querySelector("#"+this.sheetId)}AddStyles(){const t=this.CLASS.sheetId;if(!this.CLASS.style||this.document.adaptor.head().querySelector("#"+t))return;const e=this.document.adaptor.node("style",{id:t});e.innerHTML=this.CLASS.style.cssText,this.document.adaptor.head().appendChild(e)}AddElement(){if(this.div)return;const t=this.document.adaptor.node("div");t.classList.add(this.CLASS.className),this.div=t,this.inner=this.document.adaptor.node("div"),this.div.appendChild(this.inner),this.document.adaptor.body(this.document.adaptor.document).appendChild(this.div)}Show(t){this.AddElement(),this.position(t),this.div.classList.add(this.CLASS.className+"_Show")}Hide(){this.div&&(this.div.remove(),this.div=null,this.inner=null)}stackRegions(t){const e=t.getBoundingClientRect();let s=0,i=Number.POSITIVE_INFINITY;const r=this.document.adaptor.document.getElementsByClassName(this.CLASS.className+"_Show");for(let t,e=0;t=r[e];e++)t!==this.div&&(s=Math.max(t.getBoundingClientRect().bottom,s),i=Math.min(t.getBoundingClientRect().left,i));const n=(s||e.bottom+10)+window.scrollY,o=(i div`]:{"border-radius":"inherit",padding:"0 2px"},"@media (prefers-color-scheme: dark)":{["."+qE.className]:{"background-color":"#222025","box-shadow":"0px 5px 20px #000",border:"1px solid #7C7C7C"}}});class VE extends zE{static setColor(t,e,s,i){const r=this.styleSheet;if(r){const n=r.sheet.cssRules[0].style,o=`--mjx-${t}${e}-color`,a=`rgba(var(--mjx-${t}-${s}), ${1===i?1:`var(--mjx-${t}${e}-alpha)`})`;n.getPropertyValue(o)!==a&&n.setProperty(o,a);const l=`--mjx-${t}${e}-alpha`;n.getPropertyValue(l)!==String(i)&&(n.setProperty(l,i),r.sheet.cssRules[1].cssRules[0].style.setProperty(l,Math.pow(i,.7071)))}}}VE.className="MJX_LiveRegion",VE.priority={primary:1,secondary:2},VE.style=new ao({":root":{"--mjx-fg-red":"255, 0, 0","--mjx-fg-green":"0, 255, 0","--mjx-fg-blue":"0, 0, 255","--mjx-fg-yellow":"255, 255, 0","--mjx-fg-cyan":"0, 255, 255","--mjx-fg-magenta":"255, 0, 255","--mjx-fg-white":"255, 255, 255","--mjx-fg-black":"0, 0, 0","--mjx-bg-red":"255, 0, 0","--mjx-bg-green":"0, 255, 0","--mjx-bg-blue":"0, 0, 255","--mjx-bg-yellow":"255, 255, 0","--mjx-bg-cyan":"0, 255, 255","--mjx-bg-magenta":"255, 0, 255","--mjx-bg-white":"255, 255, 255","--mjx-bg-black":"0, 0, 0","--mjx-live-bg-color":"white","--mjx-live-shadow-color":"#888","--mjx-live-border-color":"#CCCCCC","--mjx-bg1-color":"rgba(var(--mjx-bg-blue), var(--mjx-bg1-alpha))","--mjx-fg1-color":"rgba(var(--mjx-fg-black), 1)","--mjx-bg2-color":"rgba(var(--mjx-bg-red), 1)","--mjx-fg2-color":"rgba(var(--mjx-fg-black), 1)","--mjx-bg1-alpha":.2,"--mjx-fg1-alpha":1,"--mjx-bg2-alpha":1,"--mjx-fg2-alpha":1},"@media (prefers-color-scheme: dark)":{":root":{"--mjx-bg-blue":"132, 132, 255","--mjx-bg-white":"0, 0, 0","--mjx-bg-black":"255, 255, 255","--mjx-fg-white":"0, 0, 0","--mjx-fg-black":"255, 255, 255","--mjx-live-bg-color":"#222025","--mjx-live-shadow-color":"black","--mjx-live-border-color":"#7C7C7C","--mjx-bg1-alpha":.3,"--mjx-fg1-alpha":1,"--mjx-bg2-alpha":1,"--mjx-fg2-alpha":1}},[`.${VE.className}`]:{position:"absolute",top:0,display:"none",width:"auto",height:"auto",padding:0,opacity:1,"z-index":"202",left:0,right:0,margin:"0 auto","background-color":"var(--mjx-live-bg-color)","box-shadow":"0px 5px 20px var(--mjx-live-shadow-color)",border:"2px solid var(--mjx-live-border-color)"},[`.${VE.className}_Show`]:{display:"block"},[`.${VE.className} > div`]:{color:"var(--mjx-fg1-color)","background-color":"var(--mjx-bg1-color)"},"mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect)":{color:"var(--mjx-fg1-color) ! important",fill:"var(--mjx-fg1-color) ! important"},[["mjx-container:not([data-mjx-clone-container])","[data-sre-highlight-1]:not([data-sre-enclosed], rect)"].join(" ")]:{"background-color":"var(--mjx-bg1-color) ! important"},"mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed])":{fill:"var(--mjx-bg1-color) ! important"},"mjx-container [data-sre-highlight-2]":{color:"var(--mjx-fg2-color) ! important","background-color":"var(--mjx-bg2-color) ! important",fill:"var(--mjx-fg2-color) ! important"},"mjx-container rect[data-sre-highlight-2]":{fill:"var(--mjx-bg2-color) ! important"}});class XE extends VE{constructor(){super(...arguments),this.active=!1,this.node=null,this.clear=!1,this.voiceRequest=!1,this.voiceCancelled=!1}Show(t){super.Update("\xa0"),this.node=t,super.Show(t)}Update(t){if(this.voiceRequest)return void this.makeVoice(t);speechSynthesis.onvoiceschanged=(()=>this.voiceRequest=!0).bind(this);new Promise(t=>{setTimeout(()=>{this.voiceRequest?t(!0):setTimeout(()=>{this.voiceRequest=!0,t(!0)},100)},100)}).then(()=>this.makeVoice(t))}makeVoice(t){this.active=this.document.options.a11y.voicing&&!!speechSynthesis.getVoices().length,speechSynthesis.cancel(),this.clear=!0;const[e,s]=SE(t,this.document.options.sre.locale,this.document.options.sre.rate);super.Update(e),this.active&&e&&this.makeUtterances(s,this.document.options.sre.locale)}makeUtterances(t,e){this.voiceCancelled=!1;let s=null;for(const i of t)if(i.mark){if(!s){this.highlightNode(i.mark,!0);continue}s.addEventListener("end",t=>{this.voiceCancelled||this.highlightNode(i.mark)})}else{if(i.pause){const t=parseInt(i.pause.match(/^[0-9]+/)[0]);if(isNaN(t)||!s)continue;s.addEventListener("end",e=>{speechSynthesis.pause(),setTimeout(()=>{speechSynthesis.resume()},t)});continue}s=new SpeechSynthesisUtterance(i.text),i.rate&&(s.rate=i.rate),i.pitch&&(s.pitch=i.pitch),s.lang=e,speechSynthesis.speak(s)}s&&s.addEventListener("end",t=>{this.highlighter.unhighlight()})}Hide(){this.cancelVoice(),super.Hide()}cancelVoice(){this.voiceCancelled=!0,speechSynthesis.cancel(),this.highlighter.unhighlight()}highlightNode(t,e=!1){this.highlighter.unhighlight();const s=Array.from(this.node.querySelectorAll(`[data-semantic-id="${t}"]`));this.clear&&!e||this.highlighter.highlight(s),this.clear=!1}}XE.style=null;class GE extends HE{position(t){const e=t.getBoundingClientRect(),s=this.div.getBoundingClientRect();let i,r=e.left+e.width/2-s.width/2;switch(r=r<0?0:r,r+=window.scrollX,this.document.options.a11y.align){case"top":i=e.top-s.height-10;break;case"bottom":i=e.bottom+10;break;default:i=e.top+e.height/2-s.height/2}i+=window.scrollY,i=i<0?0:i,this.div.style.top=i+"px",this.div.style.left=r+"px"}Show(t){this.AddElement(),this.div.style.fontSize=this.document.options.a11y.magnify,this.Update(t),super.Show(t)}Clear(){this.div&&(this.inner.textContent="",this.inner.style.top="",this.inner.style.backgroundColor="")}Update(t){if(!this.div)return;this.Clear();const e=this.cloneNode(t),s=e.querySelector("[data-mjx-clone]");this.inner.style.backgroundColor=t.style.backgroundColor,s.style.backgroundColor="",s.classList.remove("mjx-selected"),this.inner.appendChild(e),this.position(t)}cloneNode(t){let e=t.cloneNode(!0);if(e.setAttribute("data-mjx-clone","true"),"MJX-CONTAINER"!==e.nodeName){"g"!==e.nodeName&&(e.style.marginLeft=e.style.marginRight="0");const s=t.closest("mjx-container");if("MJX-MATH"!==e.nodeName&&"svg"!==e.nodeName){let i=s.firstChild;"MJX-BBOX"===i.nodeName&&(i=i.nextSibling),e=i.cloneNode(!1).appendChild(e).parentElement;const r=Array.from(s.querySelectorAll("[data-sre-enclosed]"));"svg"===i.nodeName?this.svgClone(t,r,e,s):this.chtmlClone(t,r,e)}e=s.cloneNode(!1).appendChild(e).parentElement,e.style.margin="0",e.style.minWidth=""}return e.setAttribute("data-mjx-clone-container","true"),e}chtmlClone(t,e,s){for(const i of e)if(i!==t){const t=i.getAttribute("data-semantic-id");t&&s.querySelector(`[data-semantic-id="${t}"]`)||s.appendChild(i.cloneNode(!0))}}svgClone(t,e,s,i){var r;let{x:n,y:o,width:a,height:l}=t.getBBox();if(e.length){s.firstChild.remove();const r=i.querySelector("g").cloneNode(!1);for(const s of e){const e=r.appendChild(s.cloneNode(!0));s===t&&e.setAttribute("data-mjx-clone","true");const[i,n]=this.xy(s);e.setAttribute("transform",`translate(${i}, ${n})`)}s.appendChild(r);const c=t.previousSibling,h=c.getBBox();a=h.width,l=h.height;const[d,u]=this.xy(c);n=d,o=u+h.y}const c=i.querySelector("g");if("full"===i.getAttribute("width")&&c.firstChild.lastChild===t)return s.innerHTML="",s.appendChild(i.cloneNode(!0).firstChild),s.querySelector(".mjx-selected").setAttribute("data-mjx-clone","true"),void(null===(r=s.querySelector("[data-sre-highlighter-added]"))||void 0===r||r.remove());s.firstChild.setAttribute("transform","scale(1, -1)");const h=parseFloat((s.getAttribute("viewBox")||s.getAttribute("data-mjx-viewBox")).split(/ /)[2]),d=parseFloat(s.style.minWidth||s.getAttribute("width"));s.setAttribute("viewBox",[n,-(o+l),a,l].join(" ")),s.removeAttribute("style"),s.setAttribute("width",d/h*a+"ex"),s.setAttribute("height",d/h*l+"ex")}xy(t){const e=DOMPoint.fromPoint({x:0,y:0}).matrixTransform(t.getCTM().inverse());return[-e.x,-e.y]}}GE.className="MJX_HoverRegion",GE.style=new ao({[`.${GE.className}`]:{display:"block",position:"absolute",width:"max-content",height:"auto",padding:0,opacity:1,"z-index":"202",margin:"0 auto","background-color":"white","line-height":0,"box-shadow":"0px 10px 20px #888",border:"2px solid #CCCCCC"},[`.${GE.className} > div`]:{overflow:"hidden",color:"var(--mjx-fg1-color)","background-color":"var(--mjx-bg1-color)"},"@media (prefers-color-scheme: dark)":{["."+GE.className]:{"background-color":"#222025","box-shadow":"0px 5px 20px #000",border:"1px solid #7C7C7C"}},"mjx-container[data-mjx-clone-container]":{padding:"2px ! important"},"mjx-math > mjx-mlabeledtr":{display:"inline-block","margin-right":".5em ! important"},"mjx-math > mjx-mtd":{float:"right"}});class JE{get highlighter(){return this.pool.highlighter}static stopEvent(t){t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopImmediatePropagation?t.stopImmediatePropagation():t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}static create(t,e,s,i,...r){return new this(t,e,s,i,...r)}constructor(t,e,s,i,...r){this.document=t,this.pool=e,this.region=s,this.node=i,this.stoppable=!0,this.events=[],this._active=!1}Events(){return this.events}get active(){return this._active}set active(t){this._active=t}Attach(){this.AddEvents()}Detach(){this.RemoveEvents()}Start(){this.active=!0}Stop(){this.active&&(this.region.Clear(),this.region.Hide(),this.active=!1)}AddEvents(){for(const[t,e]of this.events)this.node.addEventListener(t,e)}RemoveEvents(){for(const[t,e]of this.events)this.node.removeEventListener(t,e)}Update(t=!1){}stopEvent(t){this.stoppable&&JE.stopEvent(t)}}var KE=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const $E="Windows"===pi.os,YE=Array(40).fill("\u2800").join(""),QE="[data-speech-node]";function ZE(t){return t.matches("mjx-container")}function tx(t,e=!0){return t.shiftKey&&e||t.metaKey||t.altKey||t.ctrlKey}class ex extends JE{static helpMessage(t,e,s){return`\n

Exploring expressions ${t}

\n\n

The mathematics on this page is being rendered by MathJax, which\n generates both the text spoken by screen readers, as well as the\n visual layout for sighted users.

\n\n

Expressions typeset by MathJax can be explored interactively, and\n are focusable. You can use the Tab key to move to a typeset\n expression${e}. Initially, the expression will be read in full,\n but you can use the following keys to explore the expression\n further:

\n\n
    \n\n
  • Down Arrow moves one level deeper into the\n expression to allow you to explore the current subexpression term by\n term.
  • \n\n
  • Up Arrow moves back up a level within the\n expression.
  • \n\n
  • Right Arrow moves to the next term in the\n current subexpression.
  • \n\n
  • Left Arrow moves to the next term in the\n current subexpression.
  • \n\n
  • Shift+Arrow moves to a\n neighboring cell within a table.
  • \n\n
  • 0-9+0-9 jumps to a cell\n by its index in the table, where 0 = 10.
  • \n\n
  • Home takes you to the top of the\n expression.
  • \n\n
  • Enter or Return clicks a\n link or activates an active subexpression.
  • \n\n
  • Space opens the MathJax contextual menu\n where you can view or copy the source format of the expression, or\n modify MathJax's settings.
  • \n\n
  • Escape exits the expression\n explorer.
  • \n\n
  • x gives a summary of the current\n subexpression.
  • \n\n
  • z gives the full text of a collapsed\n expression.
  • \n\n
  • d gives the current depth within the\n expression.
  • \n\n
  • s starts or stops auto-voicing with\n synchronized highlighting.
  • \n\n
  • v marks the current position in the\n expression.
  • \n\n
  • p cycles through the marked positions in\n the expression.
  • \n\n
  • u clears all marked positions and returns\n to the starting position.
  • \n\n
  • > cycles through the available speech\n rule sets (MathSpeak, ClearSpeak).
  • \n\n
  • < cycles through the verbosity levels\n for the current rule set.
  • \n\n
  • b toggles whether Braille notation is combined\n with speech text for tactile Braille devices, as discussed\n below.\n\n
  • h produces this help listing.
  • \n
\n\n

The MathJax contextual menu allows you to enable or disable speech\n or Braille generation for mathematical expressions, the language to\n use for the spoken mathematics, and other features of MathJax. In\n particular, the Explorer submenu allows you to specify how the\n mathematics should be identified in the page (e.g., by saying "math"\n when the expression is spoken), and whether or not to include a\n message about the letter "h" bringing up this dialog box. Turning off\n speech and Braille will disable the expression explorer, its\n highlighting, and its help icon.

\n\n

Support for tactile Braille devices varies across screen readers,\n browsers, and operative systems. If you are using a Braille output\n device, you may need to select the "Combine with Speech" option in the\n contextual menu's Braille submenu in order to obtain Nemeth or Euro\n Braille output rather than the speech text on your Braille\n device. ${s}

\n\n

The contextual menu also provides options for viewing or copying a\n MathML version of the expression or its original source format,\n creating an SVG version of the expression, and viewing various other\n information.

\n\n

Finally, selecting the "Insert Hidden MathML" item from the options\n submenu will turn of MathJax's speech and Braille generation and\n instead use visually hidden MathML that some screen readers can voice,\n though support for this is not universal across all screen readers and\n operating systems. Selecting speech or Braille generation in their\n submenus will remove the hidden MathML again.

\n\n

For more help, see the MathJax accessibility documentation.

\n `}get generators(){var t;return null===(t=this.item)||void 0===t?void 0:t.generatorPool}get role(){return this.item.ariaRole}get description(){return this.item.roleDescription}get none(){return this.document.options.a11y.brailleSpeech?this.item.brailleNone:this.item.none}get brailleNone(){return this.item.brailleNone}FocusIn(t){t.target.closest("mjx-html")||(this.item.outputData.nofocus?this.item.outputData.nofocus=!1:(this.clicked||(this.Start(),this.backTab=t.target===this.img),this.clicked=null))}FocusOut(t){this.current&&!this.focusSpeech&&(this.document.options.keepRegions||(this.setCurrent(null),this.Stop()),document.hasFocus()||this.focusTop())}KeyDown(t){if(this.pendingIndex.shift(),this.region.cancelVoice(),tx(t,!1))return;const e=this.constructor,s=1===t.key.length?t.key.toLowerCase():t.key,[i,r]=e.keyMap.get(s)||[],n=i?void 0===r||this.active?i(this,t):r:this.undefinedKey(t);n||(this.stopEvent(t),!1===n&&this.sound&&this.NoMove())}MouseDown(t){var e;if(this.pendingIndex=[],this.region.cancelVoice(),tx(t)||2===t.buttons)return void(this.item.outputData.nofocus=!0);const s=this.findClicked(t.target,t.x,t.y);s!==this.document.infoIcon?(null===(e=document.getSelection())||void 0===e||e.removeAllRanges(),t.target.getAttribute("sre-highlighter-added")?this.refocus=s:this.clicked=s):this.stopEvent(t)}Click(t){if(tx(t)||2===t.buttons||"Range"===document.getSelection().type)return void this.FocusOut(null);const e=this.findClicked(t.target,t.x,t.y);if(e===this.document.infoIcon)return this.stopEvent(t),void this.help();this.clicked||e&&!this.node.contains(e)||(this.refocus=e,this.triggerLinkMouse()||this.Start())}DblClick(t){var e;const s=null!==(e=document.getSelection().direction)&&void 0!==e?e:"none";tx(t)||2===t.buttons||"none"!==s?this.FocusOut(null):(this.refocus=this.rootNode(),this.Start())}spaceKey(){return this.refocus=this.current,!0}hKey(){if(!this.document.options.enableExplorerHelp)return!0;this.refocus=this.current,this.help()}escapeKey(t){return t.target.closest("mjx-html")?(this.refocus=t.target.closest(QE),this.Start()):(this.Stop(),this.focusTop(),this.setCurrent(null)),!0}tabKey(t){var e;const s=null!==(e=this.current)&&void 0!==e?e:this.node.contains(document.activeElement)?document.activeElement:null;if(0===this.tabs.length||!s)return!0;if(this.backTab)return!t.shiftKey||void this.tabTo(this.tabs[this.tabs.length-1]);const[i,r,n]=t.shiftKey?[this.tabs.slice(0).reverse(),Node.DOCUMENT_POSITION_PRECEDING,this.current&&this.isLink()?this.getAnchor():s]:[this.tabs,Node.DOCUMENT_POSITION_FOLLOWING,s];for(const t of i)if(n.compareDocumentPosition(t)&r)return void this.tabTo(t);return t.shiftKey&&this.current===this.rootNode()&&this.tabOut(),!0}tabTo(t){t.getAttribute("data-mjx-href")?this.setCurrent(this.linkFor(t)):t.focus()}tabOut(){const t=Array.from(this.node.querySelectorAll("mjx-html"));t.length&&(t.forEach(t=>{t.style.display="none"}),setTimeout(()=>{t.forEach(t=>{t.style.display=""})},0))}enterKey(t){if(this.active)if(this.triggerLinkKeyboard(t))this.Stop();else{const t=this.actionable(this.current);if(t)return this.refocus=t,void t.dispatchEvent(new Event("click"));const e=this.getInternalTabs(this.current).filter(t=>!t.getAttribute("data-mjx-href"));if(e.length)return void e[0].focus()}else this.Start()}homeKey(){this.setCurrent(this.rootNode())}moveDown(t){return t?this.moveToNeighborCell(1,0):this.moveTo(this.firstNode(this.current))}moveUp(t){return t?this.moveToNeighborCell(-1,0):this.moveTo(this.getParent(this.current))}moveRight(t){return t?this.moveToNeighborCell(0,1):this.moveTo(this.nextSibling(this.current))}moveLeft(t){return t?this.moveToNeighborCell(0,-1):this.moveTo(this.prevSibling(this.current))}moveTo(t){if(!t)return!1;this.setCurrent(t)}moveToNeighborCell(t,e){const s=this.tableCell(this.current);if(!s)return!1;const[i,r]=this.cellPosition(s);if(null==i)return!1;const n=this.cellAt(this.cellTable(s),i+t,r+e);if(!n)return!1;this.setCurrent(n)}undefinedKey(t){return!this.active||tx(t)}addMark(){this.current===this.marks[this.marks.length-1]?this.setCurrent(this.current):(this.currentMark=this.marks.length-1,this.marks.push(this.current),this.speak("Position marked"))}prevMark(){if(this.currentMark<0){if(0===this.marks.length)return void this.setCurrent(this.lastMark||this.rootNode());this.currentMark=this.marks.length-1}const t=this.currentMark;this.setCurrent(this.marks[t]),this.currentMark=t-1}clearMarks(){this.marks=[],this.currentMark=-1,this.prevMark()}autoVoice(){const t=!this.document.options.a11y.voicing;this.document.menu?this.document.menu.menu.pool.lookup("voicing").setValue(t):this.document.options.a11y.voicing=t,this.Update()}toggleBraille(){const t=!this.document.options.a11y.brailleCombine;this.document.menu?this.document.menu.menu.pool.lookup("brailleCombine").setValue(t):this.document.options.a11y.brailleCombine=t}numberKey(t){if(!this.tableCell(this.current))return!1;if(0===t&&(t=10),this.pendingIndex.length){const e=this.cellTable(this.tableCell(this.current)),s=this.cellAt(e,this.pendingIndex[0]-1,t-1);if(this.pendingIndex=[],this.speak(String(t)),!s)return!1;setTimeout(()=>this.setCurrent(s),500)}else this.pendingIndex=[null,t],this.speak(`Jump to row ${t} and column`)}depth(){var t,e,s;if("d"===this.speechType)return void this.setCurrent(this.current);this.speechType="d";const i=[[null!==(t=this.node.getAttribute("data-semantic-level"))&&void 0!==t?t:"Level",null!==(e=this.current.getAttribute("data-semantic-level-number"))&&void 0!==e?e:"0"].join(" ").trim()],r=this.actionable(this.current);r&&i.unshift(null!==(s=this.node.getAttribute("1"===r.getAttribute("toggle")?"data-semantic-expandable":"data-semantic-collapsible"))&&void 0!==s?s:""),this.speak(i.join(" "),this.current.getAttribute(IE.BRAILLE))}summary(){if("x"===this.speechType)return void this.setCurrent(this.current);this.speechType="x";const t=this.current.getAttribute(IE.SUMMARY);this.speak(t,this.current.getAttribute(IE.BRAILLE),this.SsmlAttributes(this.current,IE.SUMMARY_SSML))}nextRules(){this.node.removeAttribute("data-speech-attached"),this.restartAfter(this.generators.nextRules(this.item))}nextStyle(){this.node.removeAttribute("data-speech-attached"),this.restartAfter(this.generators.nextStyle(this.current,this.item))}details(){const t=this.actionable(this.current);if(!t||!t.getAttribute("data-collapsible")||"1"!==t.getAttribute("toggle")||"z"===this.speechType)return void this.setCurrent(this.current);this.speechType="z";const e=this.nodeId(this.current);let s;this.item.root.walkTree(t=>{t.attributes.get("data-semantic-id")===e&&(s=t)});let i=this.item.toMathML(s,this.item);s.isKind("math")||(i=`${i}`),i=i.replace(/ (?:data-semantic-|aria-|data-speech-|data-latex).*?=".*?"/g,""),this.item.speechFor(i).then(([t,e])=>this.speak(t,e))}help(){if(!this.document.options.enableExplorerHelp)return;const t=this.constructor,[e,s,i]=t.helpData.get(pi.os);uo.post({title:"MathJax Expression Explorer Help",message:t.helpMessage(e,s,i),node:this.node,adaptor:this.document.adaptor,styles:{".mjx-dialog":{"max-height":"calc(min(35em, 90%))"},"mjx-dialog mjx-title":{"font-size":"133%",margin:".5em 1.75em"},"mjx-dialog h2":{"font-size":"20px",margin:".5em 0"},"mjx-dialog ul":{"list-style-type":"none"},"mjx-dialog li":{"margin-bottom":".5em"}}})}setCurrent(t,e=!1){if(this.backTab=!1,this.speechType="",document.hasFocus()||(this.refocus=this.current),this.node.setAttribute("aria-busy","true"),this.current){this.pool.unhighlight();for(const t of Array.from(this.node.querySelectorAll(".mjx-selected")))t.classList.remove("mjx-selected");"last"===this.document.options.a11y.tabSelects&&(this.refocus=this.current),t||(this.lastMark=this.current,this.removeSpeech()),this.current=null}if(this.current=t,this.currentMark=-1,this.current){const s=[...this.getSplitNodes(this.current)];this.highlighter.encloseNodes(s,this.node);for(const t of s)t.getAttribute("data-sre-enclosed")||t.classList.add("mjx-selected");this.pool.highlight(s),this.addSpeech(t,e),this.node.setAttribute("tabindex","-1"),this.Update()}this.node.removeAttribute("aria-busy")}getSplitNodes(t){const e=this.nodeId(t);if(!e)return[t];if(this.cacheParts.has(e))return this.cacheParts.get(e);const s=Array.from(this.node.querySelectorAll(`[data-semantic-id="${e}"]`)),i=this.subtree(e,s);return this.cacheParts.set(e,[...s,...i]),this.cacheParts.get(e)}subtree(t,e){const s=this.subtrees.get(t),i=new Set;for(const t of e)Array.from(t.querySelectorAll("[data-semantic-id]")).forEach(t=>i.add(this.nodeId(t)));return[...function(t,e){if(!t)return new Set;if(!e)return t;return new Set([...t].filter(t=>!e.has(t)))}(s,i)].map(t=>this.getNode(t)).filter(t=>null!==t)}addSpeech(t,e){var s;if(!this.document.options.enableSpeech&&!this.document.options.enableBraille)return;this.anchors.length?setTimeout(()=>{var t;return null===(t=this.img)||void 0===t?void 0:t.remove()},10):null===(s=this.img)||void 0===s||s.remove();let i=this.addComma([t.getAttribute(IE.PREFIX),t.getAttribute(IE.SPEECH),t.getAttribute(IE.POSTFIX)]).join(" ").trim();if(e){let t=this.description===this.none?"":", "+this.description;this.document.options.a11y.help&&this.document.options.enableExplorerHelp&&(t+=", press h for help"),i+=t}this.speak(i,t.getAttribute(IE.BRAILLE),this.SsmlAttributes(t,IE.SPEECH_SSML))}addComma(t){return t[2]&&(t[1]||t[0])&&(t[1]+=","),t}removeSpeech(){this.speech&&(this.unspeak(this.speech),this.speech=null,this.img&&this.node.append(this.img),this.node.setAttribute("tabindex",this.tabIndex))}speak(t,e="",s=null,i=this.none){const r=this.speech,n=this.speech=document.createElement("mjx-speech");if(n.setAttribute("role",this.role),n.setAttribute("aria-label",t||this.none),n.setAttribute("aria-roledescription",i||this.none),n.setAttribute(IE.SPEECH,t),s&&(n.setAttribute(IE.PREFIX_SSML,s[0]||""),n.setAttribute(IE.SPEECH_SSML,s[1]||""),n.setAttribute(IE.POSTFIX_SSML,s[2]||"")),e&&(this.document.options.a11y.brailleSpeech&&(n.setAttribute("aria-label",e),n.setAttribute("aria-roledescription",this.brailleNone)),n.setAttribute("aria-braillelabel",e),n.setAttribute("aria-brailleroledescription",this.brailleNone),this.document.options.a11y.brailleCombine&&n.setAttribute("aria-label",e+YE+t)),n.setAttribute("tabindex","0"),$E){const t=document.createElement("mjx-speech-container");t.setAttribute("role","application"),t.setAttribute("aria-roledescription",this.none),t.setAttribute("aria-brailleroledescription",this.brailleNone),t.append(n),this.node.append(t),n.setAttribute("role","img")}else this.node.append(n);this.focusSpeech=!0,n.focus(),this.focusSpeech=!1,this.Update(),r&&setTimeout(()=>this.unspeak(r),100)}unspeak(t){$E&&(t=t.parentElement),t.remove()}attachSpeech(){var t;const e=this.item,s=this.node;if(!s.hasAttribute("has-speech")){for(const t of Array.from(s.childNodes))t.setAttribute("aria-hidden","true");s.setAttribute("has-speech","true")}const i=e.roleDescription,r=(s.getAttribute(IE.SPEECH)||"")+(i?", "+i:"");null===(t=this.img)||void 0===t||t.remove(),this.img=this.document.adaptor.node("mjx-speech",{"aria-label":r,role:"img","aria-roledescription":e.none});const n=s.getAttribute(IE.BRAILLE);n&&(this.document.options.a11y.brailleSpeech&&(this.img.setAttribute("aria-label",n),this.img.setAttribute("aria-roledescription",this.brailleNone)),this.img.setAttribute("aria-braillelabel",n),this.img.setAttribute("aria-brailleroledescription",this.brailleNone),this.document.options.a11y.brailleCombine&&this.img.setAttribute("aria-label",n+YE+r)),s.appendChild(this.img),this.adjustAnchors(),this.getTabs()}detachSpeech(){var t;const e=this.node;null===(t=this.img)||void 0===t||t.remove(),e.removeAttribute("has-speech");for(const t of Array.from(e.childNodes))t.removeAttribute("aria-hidden");this.restoreAnchors()}adjustAnchors(){this.anchors=Array.from(this.node.querySelectorAll("a[href]"));for(const t of this.anchors){const e=t.getAttribute("href");t.setAttribute("data-mjx-href",e),t.removeAttribute("href")}this.anchors.length&&this.img.setAttribute("tabindex","0")}restoreAnchors(){for(const t of this.anchors)t.setAttribute("href",t.getAttribute("data-mjx-href")),t.removeAttribute("data-mjx-href");this.anchors=[]}getTabs(){this.tabs=this.getInternalTabs(this.node)}getInternalTabs(t){return Array.from(t.querySelectorAll('button, [data-mjx-href], input, select, textarea, [tabindex]:not([tabindex="-1"],mjx-speech)'))}focus(){this.node.focus()}nodeId(t){return t.getAttribute("data-semantic-id")}parentId(t){return t.getAttribute("data-semantic-parent")}getNode(t){return t?this.node.querySelector(`[data-semantic-id="${t}"]`):null}getParent(t){return this.getNode(this.parentId(t))}childArray(t){return t?t.getAttribute("data-semantic-children").split(/,/):[]}isCell(t){return!!t&&this.cellTypes.includes(t.getAttribute("data-semantic-type"))}isRow(t){return!!t&&"row"===t.getAttribute("data-semantic-type")}tableCell(t){for(;t&&t!==this.node;){if(this.isCell(t))return t;t=t.parentNode}return null}cellTable(t){const e=this.getParent(t);return this.isRow(e)?this.getParent(e):e}cellPosition(t){const e=this.getParent(t),s=this.childArray(e).indexOf(this.nodeId(t));if(!this.isRow(e))return[s,1];const i=this.getParent(e);return[this.childArray(i).indexOf(this.nodeId(e)),s]}cellAt(t,e,s){const i=this.getNode(this.childArray(t)[e]);if(!this.isRow(i))return 1===s?i:null;return this.getNode(this.childArray(i)[s])}firstNode(t){const e=t.getAttribute("data-semantic-owns");if(!e)return t.querySelector(QE);const s=e.split(/ /);for(const t of s){const e=this.getNode(t);if(null==e?void 0:e.hasAttribute("data-speech-node"))return e}return t.querySelector(QE)}rootNode(){const t=this.node.querySelector("[data-semantic-structure]");if(!t)return this.node.querySelector(QE);const e=t.getAttribute("data-semantic-structure").split(/ /)[0].replace("(","");return this.getNode(e)}nextSibling(t){var e;const s=this.parentId(t);if(!s)return null;const i=null===(e=this.getNode(s).getAttribute("data-semantic-owns"))||void 0===e?void 0:e.split(/ /);if(!i)return null;let r,n=i.indexOf(this.nodeId(t));do{r=this.getNode(i[++n])}while(r&&!r.hasAttribute("data-speech-node"));return r}prevSibling(t){var e;const s=this.parentId(t);if(!s)return null;const i=null===(e=this.getNode(s).getAttribute("data-semantic-owns"))||void 0===e?void 0:e.split(/ /);if(!i)return null;let r,n=i.indexOf(this.nodeId(t));do{r=this.getNode(i[--n])}while(r&&!r.hasAttribute("data-speech-node"));return r}findClicked(t,e,s){const i=this.document.infoIcon;if(i===t||i.contains(t))return i;if("SVG"!==this.node.getAttribute("jax"))return t.closest(QE);let r=null,n=this.node;for(;n;){n.matches(QE)&&(r=n);const t=Array.from(n.childNodes);n=null;for(const i of t)if(i!==this.speech&&i!==this.img&&i.tagName&&"rect"!==i.tagName.toLowerCase()){const{left:t,right:r,top:o,bottom:a}=i.getBoundingClientRect();if(t<=e&&e<=r&&o<=s&&s<=a){n=i;break}}}return r}isLink(t=this.current){var e;return!!(null===(e=null==t?void 0:t.getAttribute("data-semantic-attributes"))||void 0===e?void 0:e.includes("href:"))}getAnchor(t=this.current){const e=t.closest("a");return e&&this.node.contains(e)?e:null}linkFor(t){return null==t?void 0:t.querySelector('[data-semantic-attributes*="href:"]')}parentLink(t){const e=null==t?void 0:t.closest('[data-semantic-attributes*="href:"]');return e&&this.node.contains(e)?e:null}focusTop(){this.focusSpeech=!0,this.node.focus(),this.focusSpeech=!1}SsmlAttributes(t,e){return[t.getAttribute(IE.PREFIX_SSML),t.getAttribute(e),t.getAttribute(IE.POSTFIX_SSML)]}restartAfter(t){return KE(this,void 0,void 0,function*(){yield t,this.attachSpeech();const e=this.current;this.current=null,this.pool.unhighlight(),this.setCurrent(e)})}constructor(t,e,s,i,r,n,o,a){super(t,e,null,i),this.document=t,this.pool=e,this.region=s,this.node=i,this.brailleRegion=r,this.magnifyRegion=n,this.item=a,this.sound=!1,this.current=null,this.clicked=null,this.refocus=null,this.focusSpeech=!1,this.restarted=null,this.speech=null,this.speechType="",this.img=null,this.attached=!1,this.eventsAttached=!1,this.marks=[],this.currentMark=-1,this.lastMark=null,this.pendingIndex=[],this.cellTypes=["cell","line"],this.backTab=!1,this.events=super.Events().concat([["focusin",this.FocusIn.bind(this)],["focusout",this.FocusOut.bind(this)],["keydown",this.KeyDown.bind(this)],["mousedown",this.MouseDown.bind(this)],["click",this.Click.bind(this)],["dblclick",this.DblClick.bind(this)]]),this.subtrees=null,this.cacheParts=new Map}findStartNode(){let t=this.refocus||this.current;return!t&&this.restarted&&(t=this.node.querySelector(this.restarted)),this.refocus=this.restarted=null,t}Start(){const t=Object.create(null,{Start:{get:()=>super.Start}});return KE(this,void 0,void 0,function*(){if(this.subtrees||(this.subtrees=new Map,this.getSubtrees()),!this.attached||this.active)return;if(this.document.activeItem=this.item,this.item.state(){t.contains(document.activeElement)&&(e instanceof KeyboardEvent?(this.clicked=null,"Tab"!==e.key&&"Escape"!==e.key&&e.stopPropagation()):this.clicked=e.target)};t.addEventListener("mousedown",e),t.addEventListener("click",e),t.addEventListener("keydown",e),t.addEventListener("dblclick",e)}}actionable(t){const e=null==t?void 0:t.parentNode;return e&&this.highlighter.isMactionNode(e)?e:null}triggerLinkKeyboard(t){return this.current?this.triggerLink(this.current):t.target instanceof HTMLAnchorElement&&(t.target.dispatchEvent(new MouseEvent("click")),!0)}triggerLink(t){if(this.isLink(t)){const e=this.getAnchor(t);return e.classList.add("mjx-visited"),setTimeout(()=>this.FocusOut(null),50),window.location.href=e.getAttribute("data-mjx-href"),!0}return!1}triggerLinkMouse(){const t=this.parentLink(this.refocus);return!!this.triggerLink(t)}semanticFocus(){const t=[];let e="data-semantic-id",s=this.current||this.refocus||this.node;const i=this.actionable(s);i&&(e=i.hasAttribute("data-maction-id")?"data-maction-id":"id",s=i,t.push(QE));const r=s.getAttribute(e);return r&&t.unshift(`[${e}="${r}"]`),t.join(" ")}getSubtrees(){const t=this.node.querySelector("[data-semantic-structure]");if(!t)return;const e=t.getAttribute("data-semantic-structure");const s=function(t){const e=[[]];for(const s of t)if("("===s){const t=[];e[e.length-1].push(t),e.push(t)}else")"===s?e.pop():e[e.length-1].push(s);return e[0][0]}(e.replace(/\(/g," ( ").replace(/\)/g," ) ").trim().split(/\s+/));sx(s,this.subtrees)}}function sx(t,e){if("string"==typeof t)return e.has(t)||e.set(t,new Set),new Set;const[s,...i]=t,r=s,n=new Set;for(const t of i){const s="string"==typeof t?t:t[0],i=sx(t,e);n.add(s),i.forEach(t=>n.add(t))}return e.set(r,n),n}ex.helpData=new Map([["MacOS",["on MacOS and iOS using VoiceOver",", or the VoiceOver arrow keys to select an expression",""]],["Windows",["in Windows using NVDA or JAWS",". The screen reader should enter focus or forms mode automatically\n when the expression gets the browser focus, but if not, you can toggle\n focus mode using NVDA+space in NVDA; for JAWS, Enter should start\n forms mode while Numpad Plus leaves it. Also note that you can use\n the NVDA or JAWS key plus the arrow keys to explore the expression\n even in browse mode, and you can use NVDA+shift+arrow keys to\n navigate out of an expression that has the focus in NVDA","NVDA users need to select this option, while JAWS users should be able\n to get Braille output without changing this setting."]],["Unix",["in Unix using Orca",", and Orca should enter focus mode automatically. If not, use the\n Orca+a key to toggle focus mode on or off. Also note that you can use\n Orca+arrow keys to explore expressions even in browse mode",""]],["unknown",["with a Screen Reader.","",""]]]),ex.keyMap=new Map([["Tab",[(t,e)=>t.tabKey(e)]],["Escape",[(t,e)=>t.escapeKey(e)]],["Enter",[(t,e)=>t.enterKey(e)]],["Home",[t=>t.homeKey()]],["ArrowDown",[(t,e)=>t.moveDown(e.shiftKey),!0]],["ArrowUp",[(t,e)=>t.moveUp(e.shiftKey),!0]],["ArrowLeft",[(t,e)=>t.moveLeft(e.shiftKey),!0]],["ArrowRight",[(t,e)=>t.moveRight(e.shiftKey),!0]],[" ",[t=>t.spaceKey()]],["h",[t=>t.hKey()]],[">",[t=>t.nextRules(),!1]],["<",[t=>t.nextStyle(),!1]],["x",[t=>t.summary(),!1]],["z",[t=>t.details(),!1]],["d",[t=>t.depth(),!1]],["v",[t=>t.addMark(),!1]],["p",[t=>t.prevMark(),!1]],["u",[t=>t.clearMarks(),!1]],["s",[t=>t.autoVoice(),!1]],["b",[t=>t.toggleBraille(),!1]],...[..."0123456789"].map(t=>[t,[e=>e.numberKey(parseInt(t)),!1]])]);class ix extends JE{constructor(){super(...arguments),this.events=super.Events().concat([["mouseover",this.MouseOver.bind(this)],["mouseout",this.MouseOut.bind(this)]])}MouseOver(t){this.Start()}MouseOut(t){this.Stop()}}class rx extends ix{constructor(t,e,s,i,r,n){super(t,e,s,i),this.document=t,this.pool=e,this.region=s,this.node=i,this.nodeQuery=r,this.nodeAccess=n}MouseOut(t){this.highlighter.unhighlight(),this.region.Hide(),super.MouseOut(t)}MouseOver(t){super.MouseOver(t);const e=t.target,[s,i]=this.getNode(e);s&&(this.highlighter.unhighlight(),this.highlighter.highlight([s]),this.region.Update(i),this.region.Show(s))}getNode(t){const e=t;for(;t&&t!==this.node;){if(this.nodeQuery(t))return[t,this.nodeAccess(t)];t=t.parentNode}for(t=e;t;){if(this.nodeQuery(t))return[t,this.nodeAccess(t)];const e=t.childNodes[0];t=e&&"defs"===e.tagName?t.childNodes[1]:e}return[null,null]}}class nx extends rx{}class ox extends rx{}class ax extends rx{constructor(t,e,s,i){super(t,e,new WE(t),i,t=>this.highlighter.isMactionNode(t),()=>{}),this.document=t,this.pool=e,this.node=i}}class lx extends JE{constructor(t,e,s,i,r){super(t,e,null,i),this.document=t,this.pool=e,this.region=s,this.node=i,this.mml=r,this.stoppable=!1}Attach(){super.Attach(),this.Start()}Detach(){this.Stop(),super.Detach()}}class cx extends lx{Start(){this.active||(this.active=!0,this.highlighter.highlightAll(this.node))}Stop(){this.active&&this.highlighter.unhighlightAll(),this.active=!1}}class hx extends lx{constructor(){super(...arguments),this.contrast=new dx,this.leaves=[],this.modality="data-semantic-foreground"}Start(){this.active||(this.active=!0,this.node.hasAttribute("hasforegroundcolor")||(this.colorLeaves(),this.node.setAttribute("hasforegroundcolor","true")),this.leaves.forEach(t=>this.colorize(t)))}Stop(){this.active&&this.leaves.forEach(t=>this.uncolorize(t)),this.active=!1}colorLeaves(){this.leaves=Array.from(this.node.querySelectorAll("[data-semantic-id]:not([data-semantic-children])"));for(const t of this.leaves)t.setAttribute(this.modality,this.contrast.generate()),this.contrast.increment()}colorize(t){t.hasAttribute(this.modality)&&(t.setAttribute(this.modality+"-old",t.style.color),t.style.color=t.getAttribute(this.modality))}uncolorize(t){const e=this.modality+"-old";t.hasAttribute(e)&&(t.style.color=t.getAttribute(e))}}class dx{constructor(){this.hue=10,this.sat=100,this.light=50,this.incr=53}generate(){return dx.hsl2rgb(this.hue,this.sat,this.light)}increment(){this.hue=(this.hue+this.incr)%360}static hsl2rgb(t,e,s){e=e>1?e/100:e,s=s>1?s/100:s;const i=(1-Math.abs(2*s-1))*e,r=i*(1-Math.abs(t/60%2-1)),n=s-i/2;let o=0,a=0,l=0;return 0<=t&&t<60?[o,a,l]=[i,r,0]:60<=t&&t<120?[o,a,l]=[r,i,0]:120<=t&&t<180?[o,a,l]=[0,i,r]:180<=t&&t<240?[o,a,l]=[0,r,i]:240<=t&&t<300?[o,a,l]=[r,0,i]:300<=t&&t<360&&([o,a,l]=[i,0,r]),`rgb(${255*(o+n)}, ${255*(a+n)}, ${255*(l+n)})`}}const ux={color:"blue",alpha:.2},px={color:"black",alpha:1},mx={ENCLOSED:"data-sre-enclosed",BBOX:"data-sre-highlighter-bbox",ADDED:"data-sre-highlighter-added"};class fx{constructor(t){this.currentHighlights=[],this.priority=t,this.ATTR="data-sre-highlight-"+t}highlight(t){this.currentHighlights.push(t);for(const e of t)this.highlightNode(e),this.setHighlighted(e)}highlightAll(t){const e=this.getMactionNodes(t);for(const t of e)this.highlight([t])}unhighlight(){const t=this.currentHighlights.pop();t&&t.forEach(t=>{this.isHighlighted(t)&&(this.unhighlightNode(t),this.unsetHighlighted(t))})}unhighlightAll(){for(;this.currentHighlights.length>0;)this.unhighlight()}encloseNodes(t,e){if(1===t.length)return t;const s=this.constructor,i=s.lineSelector,r=s.lineAttr,n=new Map;for(const e of t){const t=e.closest(i),s=t?t.getAttribute(r):"";n.has(s)||n.set(s,[]),n.get(s).push(e)}for(const s of n.values())if(s.length>1){let[i,r,n,o]=[1/0,1/0,-1/0,-1/0];for(const t of s){t.setAttribute(mx.ENCLOSED,"true");const{left:e,top:s,right:a,bottom:l}=t.getBoundingClientRect();s===l&&e===a||(eo&&(o=l),a>n&&(n=a))}const a=this.createEnclosure(i,o,n-i,o-r,e,s[0]);t.push(a)}return t}setColorCSS(t,e,s){var i,r;const n=null!==(i=e.color)&&void 0!==i?i:s.color,o=null!==(r=e.alpha)&&void 0!==r?r:s.alpha;VE.setColor(t,this.priority,n,o)}setColor(t,e){this.setColorCSS("fg",e,px),this.setColorCSS("bg",t,ux)}isHighlighted(t){return t.hasAttribute(this.ATTR)}setHighlighted(t){t.setAttribute(this.ATTR,"true")}unsetHighlighted(t){t.removeAttribute(this.ATTR),t.removeAttribute(mx.ENCLOSED)}}class gx extends fx{highlightNode(t){if(this.isHighlighted(t)||"svg"===t.tagName||"MJX-CONTAINER"===t.tagName||t.hasAttribute(mx.BBOX)||t.hasAttribute(mx.ENCLOSED))return;const{x:e,y:s,width:i,height:r}=t.getBBox(),n=this.createRect(e,s,i,r,t.getAttribute("transform"));this.setHighlighted(n),t.parentNode.insertBefore(n,t)}unhighlightNode(t){if(t.hasAttribute(mx.BBOX))return void t.remove();const e=t.previousSibling;(null==e?void 0:e.hasAttribute(mx.ADDED))&&e.remove()}createEnclosure(t,e,s,i,r,n){const[o,a]=this.screen2svg(t,e,n),[l,c]=this.screen2svg(t+s,e-i,n),h=this.createRect(o,a,l-o,c-a,n.getAttribute("transform"));return h.setAttribute(mx.BBOX,"true"),n.parentNode.insertBefore(h,n),h}screen2svg(t,e,s){const i=s,r=DOMPoint.fromPoint({x:t,y:e}).matrixTransform(i.getScreenCTM().inverse());return[r.x,r.y]}createRect(t,e,s,i,r){const n=document.createElementNS("http://www.w3.org/2000/svg","rect");return n.setAttribute(mx.ADDED,"true"),n.setAttribute("x",String(t-40)),n.setAttribute("y",String(e-40)),n.setAttribute("width",String(s+80)),n.setAttribute("height",String(i+80)),r&&n.setAttribute("transform",r),n}isMactionNode(t){return"maction"===t.getAttribute("data-mml-node")}getMactionNodes(t){return Array.from(t.querySelectorAll('[data-mml-node="maction"]'))}}gx.lineSelector="[data-mjx-linebox]",gx.lineAttr="data-mjx-lineno";class bx extends fx{highlightNode(t){}unhighlightNode(t){"mjx-bbox"===t.tagName.toLowerCase()&&t.remove()}createEnclosure(t,e,s,i,r){const n=r.getBoundingClientRect(),o=document.createElement("mjx-bbox");return o.style.width=s+"px",o.style.height=i+"px",o.style.left=t-n.left+"px",o.style.top=e-i-n.top+"px",o.style.position="absolute",r.prepend(o),o}isMactionNode(t){var e;return"mjx-maction"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase())}getMactionNodes(t){return Array.from(t.querySelectorAll("mjx-maction"))}}function Ex(t,e,s,i){const r=new xx[i](t);return r.setColor(e,s),r}bx.lineSelector="mjx-linebox",bx.lineAttr="lineno";const xx={SVG:gx,CHTML:bx,generic:bx};class yx{constructor(t){this.document=t,this.speechRegion=new XE(this.document),this.brailleRegion=new VE(this.document),this.magnifier=new GE(this.document),this.tooltip1=new qE(this.document),this.tooltip2=new qE(this.document),this.tooltip3=new qE(this.document)}}const Nx={speech:(t,e,s,...i)=>{const r=ex.create(t,e,t.explorerRegions.speechRegion,s,t.explorerRegions.brailleRegion,t.explorerRegions.magnifier,i[0],i[1]);return r.sound=!0,r},mouseMagnifier:(t,e,s,...i)=>ox.create(t,e,t.explorerRegions.magnifier,s,t=>t.hasAttribute("data-semantic-type"),t=>t),hover:(t,e,s,...i)=>ax.create(t,e,null,s),infoType:(t,e,s,...i)=>nx.create(t,e,t.explorerRegions.tooltip1,s,t=>t.hasAttribute("data-semantic-type"),t=>t.getAttribute("data-semantic-type")),infoRole:(t,e,s,...i)=>nx.create(t,e,t.explorerRegions.tooltip2,s,t=>t.hasAttribute("data-semantic-role"),t=>t.getAttribute("data-semantic-role")),infoPrefix:(t,e,s,...i)=>nx.create(t,e,t.explorerRegions.tooltip3,s,t=>{var e;return null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-semantic-prefix-none")},t=>{var e;return null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"data-semantic-prefix-none")}),flame:(t,e,s,...i)=>cx.create(t,e,null,s),treeColoring:(t,e,s,...i)=>hx.create(t,e,null,s,...i)};class vx{constructor(){this.explorers={},this.attached=[],this._restart=[],this.speechExplorerKeys=["speech","braille","keyMagnifier"]}get highlighter(){if(this._renderer!==this.document.outputJax.name)return this._renderer=this.document.outputJax.name,this.setPrimaryHighlighter(),this._highlighter;const[t,e]=this.colorOptions();return this._highlighter.setColor(e,t),this._highlighter}init(t,e,s,i){this.document=t,this.mml=s,this.node=e,this.setPrimaryHighlighter();for(const t of Object.keys(Nx))this.explorers[t]=Nx[t](this.document,this,this.node,this.mml,i);this.setSecondaryHighlighter(),this.attach()}attach(){this.attached=[];const t=[],e=this.document.options.a11y;for(const[s,i]of Object.entries(this.explorers))i instanceof ex?(i.stoppable=!1,t.unshift(i),this.speechExplorerKeys.some(t=>this.document.options.a11y[t])?(i.Attach(),this.attached.push(s)):i.Detach()):e[s]||"speech"===s&&(e.braille||e.keyMagnifier)?(i.Attach(),this.attached.push(s)):i.Detach();for(const e of t)if(e.attached){e.stoppable=!0;break}}reattach(){for(const t of this.attached){const e=this.explorers[t];e.active&&(this._restart.push(t),e.Stop())}}restart(){this._restart.forEach(t=>{this.explorers[t].Start()}),this._restart=[]}setPrimaryHighlighter(){const[t,e]=this.colorOptions();this._highlighter=Ex(VE.priority.primary,e,t,this.document.outputJax.name)}setSecondaryHighlighter(){this.secondaryHighlighter=Ex(VE.priority.secondary,{color:"red",alpha:.8},{color:"black"},this.document.outputJax.name),this.speech.region.highlighter=this.secondaryHighlighter}highlight(t){this.highlighter.highlight(t)}unhighlight(){this.secondaryHighlighter.unhighlight(),this.highlighter.unhighlight()}get speech(){return this.explorers.speech}colorOptions(){const t=this.document.options.a11y;return[{color:t.foregroundColor.toLowerCase(),alpha:t.foregroundOpacity/100},{color:t.backgroundColor.toLowerCase(),alpha:t.backgroundOpacity/100}]}}const Tx="Unix"===pi.os;function Cx(t,e){var s;return s=class extends t{constructor(){super(...arguments),this.refocus=null}get ariaRole(){return this.constructor.ariaRole}get roleDescription(){const t=this.constructor;return"none"===t.roleDescription?t.none:t.roleDescription}get none(){return this.constructor.none}get brailleNone(){return this.constructor.brailleNone}attachSpeech(t){var e,s;super.attachSpeech(t),null===(s=null===(e=this.outputData.speechPromise)||void 0===e?void 0:e.then(()=>this.explorers.speech.attachSpeech()))||void 0===s||s.then(()=>{var t;(null===(t=this.explorers)||void 0===t?void 0:t.speech)&&(this.explorers.speech.restarted=this.refocus),this.refocus=null,this.explorers&&this.explorers.restart()})}detachSpeech(t){super.detachSpeech(t),this.explorers.speech.detachSpeech()}explorable(t,s=!1){if(!(this.state()>=ar.EXPLORER)){if(!this.isEscaped&&(t.options.enableExplorer||s)){const s=this.typesetRoot,i=e(this.root);this.explorers||(this.explorers=new vx),this.explorers.init(t,s,i,this)}this.state(ar.EXPLORER)}}state(t=null,e=!1){if(tsetTimeout(()=>t.remove(),100))}}},s.ariaRole=Tx?"tree":"application",s.roleDescription="math",s.none="\x91",s.brailleNone="\u2800",s}function Ax(t){var e;return e=class extends t{constructor(...t){super(...t),this.explorerRegions=null,this.activeItem=null;const e=this.constructor.ProcessBits;e.has("explorer")||e.allocate("explorer");const s=new Yn(this.mmlFactory),i=this.options;i.a11y.speechRules||(i.a11y.speechRules=`${i.sre.domain}-${i.sre.style}`);const r=i.MathItem=Cx(i.MathItem,t=>s.visitTree(t));r.roleDescription=i.roleDescription,this.explorerRegions=new yx(this),"addStyles"in this&&this.addStyles(this.constructor.speechStyles);const n=this.adaptor,o="http://www.w3.org/2000/svg";this.infoIcon=n.node("mjx-help",{},[n.node("svg",{viewBox:"0 0 18 18",xmlns:o,"aria-hidden":"true"},[n.node("circle",{stroke:"none"},[],o),n.node("circle",{},[],o),n.node("line",{x1:9,y1:9,x2:9,y2:13},[],o),n.node("line",{x1:9,y1:5.5,x2:9,y2:5.5},[],o)],o)]),this.tmpFocus=n.node("mjx-focus",{tabIndex:0,style:{outline:"none",display:"block",position:"absolute",top:0,left:"-10px",width:"1px",height:"1px",overflow:"hidden"},role:r.ariaRole,"aria-label":r.none,"aria-roledescription":r.none})}explorable(){if(!this.processed.isSet("explorer")){if(this.options.enableExplorer)for(const t of this.math)t.explorable(this);this.processed.set("explorer")}return this}rerender(t){const e=this.activeItem,s=null==e?void 0:e.setTemporaryFocus(this);return super.rerender(t),null==e||e.clearTemporaryFocus(s),this}state(t,e=!1){return super.state(t,e),t mjx-help":{display:"none",position:"absolute",top:"-.3em",right:"-.5em",width:".6em",height:".6em",cursor:"pointer"},'mjx-container[display="true"] > mjx-help':{position:"sticky",inset:"-100% 0 100% 0",margin:"-.3em -.5em 0 -.1em",right:0,top:"initial"},"mjx-help > svg":{stroke:"black",width:"100%",height:"100%"},"mjx-help > svg > circle":{"stroke-width":"1.5px",cx:"9px",cy:"9px",r:"9px",fill:"white"},"mjx-help > svg > circle:nth-child(2)":{fill:"var(--mjx-bg1-color)",r:"7px"},"mjx-help > svg > line":{"stroke-width":"2.5px","stroke-linecap":"round"},"mjx-help:hover > svg > circle:nth-child(2)":{fill:"white"},"mjx-container.mjx-explorer-active > mjx-help":{display:"inline-flex","align-items":"center"},"@media (prefers-color-scheme: dark) /* explorer */":{"mjx-help > svg":{stroke:"#E0E0E0"},"mjx-help > svg > circle":{fill:"#404040"},"mjx-help > svg > circle:nth-child(2)":{fill:"rgba(132, 132, 255, .3)"},"mjx-help:hover > svg > circle:nth-child(2)":{stroke:"#AAAAAA",fill:"#404040"}}},e}function Lx(t,e=null){return t.documentClass.prototype.attachSpeech||(t=UE(t,e)),t.documentClass=Ax(t.documentClass),t}function Sx(t,e){var s;const i=Bb();for(const s in e)void 0!==t.options.a11y[s]?Rx(t,s,e[s]):void 0!==i[s]&&(t.options.sre[s]=e[s]);e.roleDescription&&(t.options.MathItem.roleDescription=e.roleDescription);for(const e of t.math)null===(s=null==e?void 0:e.explorers)||void 0===s||s.attach()}function Rx(t,e,s){switch(e){case"speechRules":{const[e,i]=s.split("-");t.options.sre.domain=e,t.options.sre.style=i;break}case"magnification":switch(s){case"None":t.options.a11y.magnification=s,t.options.a11y.keyMagnifier=!1,t.options.a11y.mouseMagnifier=!1;break;case"Keyboard":t.options.a11y.magnification=s,t.options.a11y.keyMagnifier=!0,t.options.a11y.mouseMagnifier=!1;break;case"Mouse":t.options.a11y.magnification=s,t.options.a11y.keyMagnifier=!1,t.options.a11y.mouseMagnifier=!0}break;case"highlight":switch(s){case"None":t.options.a11y.highlight=s,t.options.a11y.hover=!1,t.options.a11y.flame=!1;break;case"Hover":t.options.a11y.highlight=s,t.options.a11y.hover=!0,t.options.a11y.flame=!1;break;case"Flame":t.options.a11y.highlight=s,t.options.a11y.hover=!1,t.options.a11y.flame=!0}break;case"locale":t.options.sre.locale=s;break;default:t.options.a11y[e]=s}}lr("EXPLORER",ar.INSERTED+30),MathJax.loader&&MathJax.loader.checkVersion("a11y/explorer",ri,"a11y"),hi({_:{a11y:{explorer_ts:ii,explorer:{Explorer:Ys,ExplorerPool:si,Highlighter:ei,KeyExplorer:Qs,MouseExplorer:Zs,Region:$s,TreeExplorer:ti}}}}),MathJax.startup&&ui&&MathJax.startup.extendHandler(t=>Lx(t)),vi.preLoaded("a11y/sre","a11y/semantic-enrich","a11y/speech","a11y/explorer","input/mml"),vi.preLoaded("loader","startup","core","input/tex","input/mml","output/chtml","ui/menu"),vi.saveVersion("tex-mml-chtml"),function(t,e){au.loadFont(t,"chtml",su,e)}(function(t){return vi.load(...Ci.load).then(()=>(t||function(){})()).then(()=>Ci.ready()).catch(t=>Ci.failed(t))},!0)})()})(); \ No newline at end of file +(()=>{var t,e,s={981(t,e){"use strict";function s(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.getOwnPropertyDescriptors&&(t=e.create(null,e.getOwnPropertyDescriptors(t))),e&&"function"==typeof e.freeze?e.freeze(t):t}function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var r=s({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});var n=s({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});var o=s({script:!1,style:!1,textarea:!0,title:!0});function a(t){return t===l.HTML}var l=s({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),c=Object.keys(l).map(function(t){return l[t]});var h=s({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});e.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var s in e)i(e,s)&&(t[s]=e[s]);return t},e.find=function(t,e,s){if(void 0===s&&(s=Array.prototype),t&&"function"==typeof s.find)return s.find.call(t,e);for(var r=0;r-1},e.MIME_TYPE=l,e.NAMESPACE=h},985(t,e,s){"use strict";var i=s(981),r=s(553),n=s(918),o=s(334),a=s(309),l=r.DOMImplementation,c=i.hasDefaultHTMLNamespace,h=i.isHTMLMimeType,d=i.isValidMimeType,u=i.MIME_TYPE,p=i.NAMESPACE,m=n.ParseError,f=a.XMLReader;function g(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function b(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||i.assign,this.domHandler=t.domHandler||E,this.onError=t.onError||t.errorHandler,t.errorHandler&&"function"!=typeof t.errorHandler)throw new TypeError("errorHandler object is no longer supported, switch to onError!");t.errorHandler&&t.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=t.normalizeLineEndings||g,this.locator=!!t.locator,this.xmlns=this.assign(Object.create(null),t.xmlns)}function E(t){var e=t||{};this.mimeType=e.mimeType||u.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}function x(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function y(t,e,s){return"string"==typeof t?t.substr(e,s):t.length>=e+s||e?new java.lang.String(t,e,s)+"":t}function N(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}b.prototype.parseFromString=function(t,e){if(!d(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var s=this.assign(Object.create(null),this.xmlns),r=o.XML_ENTITIES,n=s[""]||null;c(e)?(r=o.HTML_ENTITIES,n=p.HTML):e===u.XML_SVG_IMAGE&&(n=p.SVG),s[""]=n,s.xml=s.xml||p.XML;var a=new this.domHandler({mimeType:e,defaultNamespace:n,onError:this.onError}),l=this.locator?{}:void 0;this.locator&&a.setDocumentLocator(l);var h=new f;return h.errorHandler=a,h.domBuilder=a,!i.isHTMLMimeType(e)&&"string"!=typeof t&&h.errorHandler.fatalError("source is not a string"),h.parse(this.normalizeLineEndings(String(t)),s,r),a.doc.documentElement||h.errorHandler.fatalError("missing root element"),a.doc},E.prototype={startDocument:function(){var t=new l;this.doc=h(this.mimeType)?t.createHTMLDocument(!1):t.createDocument(this.defaultNamespace,"")},startElement:function(t,e,s,i){var r=this.doc,n=r.createElementNS(t,s||e),o=i.length;N(this,n),this.currentElement=n,this.locator&&x(this.locator,n);for(var a=0;a=0){var n=e.split(":");s=n[0],r=n[1]}if(null!==s&&null===t)throw new m(m.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===s&&t!==i.NAMESPACE.XML)throw new m(m.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===s||"xmlns"===e)&&t!==i.NAMESPACE.XMLNS)throw new m(m.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===i.NAMESPACE.XMLNS&&"xmlns"!==s&&"xmlns"!==e)throw new m(m.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,s,r]}function T(t,e){for(var s in t)o(t,s)&&(e[s]=t[s])}function C(t,e){var s=t.prototype;if(!(s instanceof e)){function i(){}i.prototype=e.prototype,T(s,i=new i),t.prototype=s=i}s.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),s.constructor=t)}var A={},L=A.ELEMENT_NODE=1,S=A.ATTRIBUTE_NODE=2,R=A.TEXT_NODE=3,M=A.CDATA_SECTION_NODE=4,I=A.ENTITY_REFERENCE_NODE=5,w=A.ENTITY_NODE=6,k=A.PROCESSING_INSTRUCTION_NODE=7,O=A.COMMENT_NODE=8,D=A.DOCUMENT_NODE=9,P=A.DOCUMENT_TYPE_NODE=10,B=A.DOCUMENT_FRAGMENT_NODE=11,F=A.NOTATION_NODE=12,j=i.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function _(t,e){if(e.length=0){for(var r=e.length-1;i<=r;)e[i]=e[++i];if(e.length=r,t){var n=t.ownerDocument;n&&tt(n,t,s),s.ownerElement=null}}}function J(){}function K(t){b(t)}function $(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function Y(t,e){Q(t,null,{enter:function(t){return!e(t)||Q.STOP}})}function Q(t,e,s){for(var i=[{node:t,context:e,phase:Q.ENTER}];i.length>0;){var r=i.pop();if(r.phase===Q.ENTER){var n=s.enter(r.node,r.context);if(n===Q.STOP)return Q.STOP;if(i.push({node:r.node,context:n,phase:Q.EXIT}),null==n)continue;for(var o=r.node.lastChild;o;)i.push({node:o,context:n,phase:Q.ENTER}),o=o.previousSibling}else s.exit&&s.exit(r.node,r.context)}}function Z(t,e){b(t);var s=e||{};this.ownerDocument=this,this.contentType=s.contentType||h.XML_APPLICATION,this.type=a(this.contentType)?"html":"xml"}function tt(t,e,s,i){t&&t._inc++,s.namespaceURI===d.XMLNS&&delete e._nsMap[s.prefix?s.localName:""]}function et(t,e,s){if(t&&t._inc){t._inc++;var i=e.childNodes;if(s&&!s.nextSibling)i[i.length++]=s;else{for(var r=e.firstChild,n=0;r;)i[n++]=r,r=r.nextSibling;i.length=n,delete i[i.length]}}}function st(t,e){if(t!==e.parentNode)throw new m(m.NOT_FOUND_ERR,"child's parent is not parent");var s=e.previousSibling,i=e.nextSibling;return s?s.nextSibling=i:t.firstChild=i,i?i.previousSibling=s:t.lastChild=s,et(t.ownerDocument,t),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function it(t){return t&&t.nodeType===K.DOCUMENT_TYPE_NODE}function rt(t){return t&&t.nodeType===K.ELEMENT_NODE}function nt(t){return t&&t.nodeType===K.TEXT_NODE}function ot(t,e){var s=t.childNodes||[];if(r(s,rt)||it(e))return!1;var i=r(s,it);return!(e&&i&&s.indexOf(i)>s.indexOf(e))}function at(t,e){var s=t.childNodes||[];if(r(s,function(t){return rt(t)&&t!==e}))return!1;var i=r(s,it);return!(e&&i&&s.indexOf(i)>s.indexOf(e))}function lt(t,e,s){if(!function(t){return t&&(t.nodeType===K.DOCUMENT_NODE||t.nodeType===K.DOCUMENT_FRAGMENT_NODE||t.nodeType===K.ELEMENT_NODE)}(t))throw new m(m.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+t.nodeType);if(s&&s.parentNode!==t)throw new m(m.NOT_FOUND_ERR,"child not in parent");if(!function(t){return t&&(t.nodeType===K.CDATA_SECTION_NODE||t.nodeType===K.COMMENT_NODE||t.nodeType===K.DOCUMENT_FRAGMENT_NODE||t.nodeType===K.DOCUMENT_TYPE_NODE||t.nodeType===K.ELEMENT_NODE||t.nodeType===K.PROCESSING_INSTRUCTION_NODE||t.nodeType===K.TEXT_NODE)}(e)||it(e)&&t.nodeType!==K.DOCUMENT_NODE)throw new m(m.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function ct(t,e,s){var i=t.childNodes||[],n=e.childNodes||[];if(e.nodeType===K.DOCUMENT_FRAGMENT_NODE){var o=n.filter(rt);if(o.length>1||r(n,nt))throw new m(m.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!ot(t,s))throw new m(m.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(rt(e)&&!ot(t,s))throw new m(m.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(it(e)){if(r(i,it))throw new m(m.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=r(i,rt);if(s&&i.indexOf(a)1||r(n,nt))throw new m(m.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!at(t,s))throw new m(m.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(rt(e)&&!at(t,s))throw new m(m.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(it(e)){function l(t){return it(t)&&t!==s}if(r(i,l))throw new m(m.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=r(i,rt);if(s&&i.indexOf(a)=0;N--){if(""===(v=h[N]).prefix&&v.namespace===t.namespaceURI){x=v.namespace;break}}if(x!==t.namespaceURI)for(N=h.length-1;N>=0;N--){var v;if((v=h[N]).namespace===t.namespaceURI){v.prefix&&(E=v.prefix+":"+b);break}}}e.push("<",E);for(var T=h.slice(),C=0;C"),null;if(e.push(">"),a&&l(b)){for(var H=t.firstChild;H;)H.data?e.push(H.data):Rt(H,e,T.slice(),i),H=H.nextSibling;return e.push(""),null}return{ns:T,tag:E};case D:case B:if(n&&t.nodeType===D&&null==t.documentElement)throw new m("The Document has no documentElement",f.InvalidStateError);return{ns:h};case S:return St(e,t.name,t.value),null;case R:if(n&&g.InvalidChar.test(t.data))throw new m("The Text node data contains characters outside the XML Char production",f.InvalidStateError);return e.push(t.data.replace(/[<&>]/g,$)),null;case M:if(n&&-1!==t.data.indexOf("]]>"))throw new m('The CDATASection data contains "]]>"',f.InvalidStateError);return o?e.push(g.CDATA_START,t.data.replace(/]]>/g,"]]]]>"),g.CDATA_END):e.push(g.CDATA_START,t.data,g.CDATA_END),null;case O:if(n){if(g.InvalidChar.test(t.data))throw new m("The comment node data contains characters outside the XML Char production",f.InvalidStateError);if(-1!==t.data.indexOf("--")||"-"===t.data[t.data.length-1])throw new m('The comment node data contains "--" or ends with "-"',f.InvalidStateError)}return e.push(g.COMMENT_START,t.data,g.COMMENT_END),null;case P:var W=t.publicId,z=t.systemId;if(n){if(W&&!g.PubidLiteral_match.test(W))throw new m("DocumentType publicId is not a valid PubidLiteral",f.InvalidStateError);if(z&&"."!==z&&!g.SystemLiteral_match.test(z))throw new m("DocumentType systemId is not a valid SystemLiteral",f.InvalidStateError);if(t.internalSubset&&-1!==t.internalSubset.indexOf("]>"))throw new m('DocumentType internalSubset contains "]>"',f.InvalidStateError)}return e.push(g.DOCTYPE_DECL_START," ",t.name),W?(e.push(" ",g.PUBLIC," ",W),z&&"."!==z&&e.push(" ",z)):z&&"."!==z&&e.push(" ",g.SYSTEM," ",z),t.internalSubset&&e.push(" [",t.internalSubset,"]"),e.push(">"),null;case k:if(n){if(-1!==t.target.indexOf(":")||"xml"===t.target.toLowerCase())throw new m("The ProcessingInstruction target is not well-formed",f.InvalidStateError);if(g.InvalidChar.test(t.data))throw new m("The ProcessingInstruction data contains characters outside the XML Char production",f.InvalidStateError);if(-1!==t.data.indexOf("?>"))throw new m('The ProcessingInstruction data contains "?>"',f.InvalidStateError)}return e.push(""),null;case I:return e.push("&",t.nodeName,";"),null;default:return e.push("??",t.nodeName),null}},exit:function(t,s){s&&s.tag&&e.push("")}})}function Mt(t,e,s){var i;return Q(e,null,{enter:function(e,r){var n=new e.constructor(u);for(var a in e)if(o(e,a)){var l=e[a];"object"!=typeof l&&l!=n[a]&&(n[a]=l)}e.childNodes&&(n.childNodes=new H),n.ownerDocument=t;var c=s;switch(n.nodeType){case L:var h=e.attributes,d=n.attributes=new q,p=h.length;d._ownerElement=n;for(var m=0;m=0&&t0;){var s=e.pop(),i=s.node,r=s.other;if(i.nodeType!==r.nodeType)return!1;switch(i.nodeType){case i.DOCUMENT_TYPE_NODE:if(i.name!==r.name)return!1;if(i.publicId!==r.publicId)return!1;if(i.systemId!==r.systemId)return!1;break;case i.ELEMENT_NODE:if(i.namespaceURI!==r.namespaceURI)return!1;if(i.prefix!==r.prefix)return!1;if(i.localName!==r.localName)return!1;if(i.attributes.length!==r.attributes.length)return!1;for(var n=0;n=0;n--)e.push({node:i.childNodes[n],other:r.childNodes[n]})}return!0},isSameNode:function(t){return this===t},insertBefore:function(t,e){return dt(this,t,e)},replaceChild:function(t,e){dt(this,t,e,ht),e&&this.removeChild(e)},removeChild:function(t){return st(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Mt(this.ownerDocument||this,this,t)},normalize:function(){Q(this,null,{enter:function(t){for(var e=t.firstChild;e;){var s=e.nextSibling;null!==s&&s.nodeType===R&&e.nodeType===R?(t.removeChild(s),e.appendData(s.data)):e=s}return!0}})},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},lookupPrefix:function(t){for(var e=this;e;){var s=e._nsMap;if(s)for(var i in s)if(o(s,i)&&s[i]===t)return i;e=e.nodeType==S?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var s=e._nsMap;if(s&&o(s,t))return s[t];e=e.nodeType==S?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)},compareDocumentPosition:function(t){if(this===t)return 0;var e=t,s=this,i=null,r=null;if(e instanceof pt&&(e=(i=e).ownerElement),s instanceof pt&&(s=(r=s).ownerElement,i&&e&&s===e))for(var n,o=0;n=s.attributes[o];o++){if(n===i)return j.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+j.DOCUMENT_POSITION_PRECEDING;if(n===r)return j.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+j.DOCUMENT_POSITION_FOLLOWING}if(!e||!s||s.ownerDocument!==e.ownerDocument)return j.DOCUMENT_POSITION_DISCONNECTED+j.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(U(s.ownerDocument)>U(e.ownerDocument)?j.DOCUMENT_POSITION_FOLLOWING:j.DOCUMENT_POSITION_PRECEDING);if(r&&e===s)return j.DOCUMENT_POSITION_CONTAINS+j.DOCUMENT_POSITION_PRECEDING;if(i&&e===s)return j.DOCUMENT_POSITION_CONTAINED_BY+j.DOCUMENT_POSITION_FOLLOWING;for(var a=[],l=e.parentNode;l;){if(!r&&l===s)return j.DOCUMENT_POSITION_CONTAINED_BY+j.DOCUMENT_POSITION_FOLLOWING;a.push(l),l=l.parentNode}a.reverse();for(var c=[],h=s.parentNode;h;){if(!i&&h===e)return j.DOCUMENT_POSITION_CONTAINS+j.DOCUMENT_POSITION_PRECEDING;c.push(h),h=h.parentNode}c.reverse();var d=_(a,c);for(var u in d.childNodes){var p=d.childNodes[u];if(p===s)return j.DOCUMENT_POSITION_FOLLOWING;if(p===e)return j.DOCUMENT_POSITION_PRECEDING;if(c.indexOf(p)>=0)return j.DOCUMENT_POSITION_FOLLOWING;if(a.indexOf(p)>=0)return j.DOCUMENT_POSITION_PRECEDING}return 0}},T(A,K),T(A,K.prototype),T(j,K),T(j,K.prototype),Q.STOP=Symbol("walkDOM.STOP"),Q.ENTER=0,Q.EXIT=1,Z.prototype={implementation:null,nodeName:"#document",nodeType:D,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType===B){for(var s=t.firstChild;s;){var i=s.nextSibling;this.insertBefore(s,e),s=i}return t}return dt(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===L&&(this.documentElement=t),t},removeChild:function(t){var e=st(this,t);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(t,e){dt(this,t,e,ht),t.ownerDocument=this,e&&this.removeChild(e),rt(t)&&(this.documentElement=t)},importNode:function(t,e){return function(t,e,s){var i;return Q(e,null,{enter:function(e,r){var n=e.cloneNode(!1);return n.ownerDocument=t,n.parentNode=null,null===r?i=n:r.appendChild(n),e.nodeType===S||s?n:null}}),i}(this,t,e)},getElementById:function(t){var e=null;return Y(this.documentElement,function(s){if(s.nodeType==L&&s.getAttribute("id")==t)return e=s,!0}),e},createElement:function(t){var e=new ut(u);return e.ownerDocument=this,"html"===this.type&&(t=t.toLowerCase()),n(this.contentType)&&(e.namespaceURI=d.HTML),e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new H,(e.attributes=new q)._ownerElement=e,e},createDocumentFragment:function(){var t=new vt(u);return t.ownerDocument=this,t.childNodes=new H,t},createTextNode:function(t){var e=new ft(u);return e.ownerDocument=this,e.childNodes=new H,e.appendData(t),e},createComment:function(t){var e=new gt(u);return e.ownerDocument=this,e.childNodes=new H,e.appendData(t),e},createCDATASection:function(t){if(-1!==t.indexOf("]]>"))throw new m(m.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new bt(u);return e.ownerDocument=this,e.childNodes=new H,e.appendData(t),e},createProcessingInstruction:function(t,e){var s=new Tt(u);return s.ownerDocument=this,s.childNodes=new H,s.nodeName=s.target=t,s.nodeValue=s.data=e,s},createAttribute:function(t){if(!g.QName_exact.test(t))throw new m(m.INVALID_CHARACTER_ERR,'invalid character in name "'+t+'"');return"html"===this.type&&(t=t.toLowerCase()),this._createAttribute(t)},_createAttribute:function(t){var e=new pt(u);return e.ownerDocument=this,e.childNodes=new H,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){if(!g.Name.test(t))throw new m(m.INVALID_CHARACTER_ERR,'not a valid xml name "'+t+'"');if("html"===this.type)throw new m("document is an html document",f.NotSupportedError);var e=new Nt(u);return e.ownerDocument=this,e.childNodes=new H,e.nodeName=t,e},createElementNS:function(t,e){var s=v(t,e),i=new ut(u),r=i.attributes=new q;return i.childNodes=new H,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=s[0],i.prefix=s[1],i.localName=s[2],r._ownerElement=i,i},createAttributeNS:function(t,e){var s=v(t,e),i=new pt(u);return i.ownerDocument=this,i.childNodes=new H,i.nodeName=e,i.name=e,i.specified=!0,i.namespaceURI=s[0],i.prefix=s[1],i.localName=s[2],i}},C(Z,K),ut.prototype={nodeType:L,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===d.HTML},hasAttributes:function(){return!(!this.attributes||!this.attributes.length)},hasAttribute:function(t){return!!this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e?e.value:null},getAttributeNode:function(t){return this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase()),this.attributes.getNamedItem(t)},setAttribute:function(t,e){this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());var s=this.getAttributeNode(t);s?s.value=s.nodeValue=""+e:((s=this.ownerDocument._createAttribute(t)).value=s.nodeValue=""+e,this.setAttributeNode(s))},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var s=this.getAttributeNodeNS(t,e);s&&this.removeAttributeNode(s)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var s=this.getAttributeNodeNS(t,e);return s?s.value:null},setAttributeNS:function(t,e,s){var i=v(t,e)[2],r=this.getAttributeNodeNS(t,i);r?r.value=r.nodeValue=""+s:((r=this.ownerDocument.createAttributeNS(t,e)).value=r.nodeValue=""+s,this.setAttributeNode(r))},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByClassName:function(t){var e=y(t);return new W(this,function(s){var i=[];return e.length>0&&Y(s,function(r){if(r!==s&&r.nodeType===L){var n=r.getAttribute("class");if(n){var o=t===n;if(!o){var a=y(n);o=e.every((l=a,function(t){return l&&-1!==l.indexOf(t)}))}o&&i.push(r)}}var l}),i})},getElementsByTagName:function(t){var e="html"===(this.nodeType===D?this:this.ownerDocument).type,s=t.toLowerCase();return new W(this,function(i){var r=[];return Y(i,function(n){n!==i&&n.nodeType===L&&(("*"===t||n.getQualifiedName()===(e&&n.namespaceURI===d.HTML?s:t))&&r.push(n))}),r})},getElementsByTagNameNS:function(t,e){return new W(this,function(s){var i=[];return Y(s,function(r){r===s||r.nodeType!==L||"*"!==t&&r.namespaceURI!==t||"*"!==e&&r.localName!=e||i.push(r)}),i})}},Z.prototype.getElementsByClassName=ut.prototype.getElementsByClassName,Z.prototype.getElementsByTagName=ut.prototype.getElementsByTagName,Z.prototype.getElementsByTagNameNS=ut.prototype.getElementsByTagNameNS,C(ut,K),pt.prototype.nodeType=S,C(pt,K),mt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,s){s=this.data.substring(0,t)+s+this.data.substring(t+e),this.nodeValue=this.data=s,this.length=s.length}},C(mt,K),ft.prototype={nodeName:"#text",nodeType:R,splitText:function(t){var e=this.data,s=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var i=this.ownerDocument.createTextNode(s);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},C(ft,mt),gt.prototype={nodeName:"#comment",nodeType:O},C(gt,mt),bt.prototype={nodeName:"#cdata-section",nodeType:M},C(bt,ft),Et.prototype.nodeType=P,C(Et,K),xt.prototype.nodeType=F,C(xt,K),yt.prototype.nodeType=w,C(yt,K),Nt.prototype.nodeType=I,C(Nt,K),vt.prototype.nodeName="#document-fragment",vt.prototype.nodeType=B,C(vt,K),Tt.prototype.nodeType=k,C(Tt,mt),Ct.prototype.serializeToString=function(t,e){return At.call(t,e)},K.prototype.toString=At;try{Object.defineProperty&&(Object.defineProperty(W.prototype,"length",{get:function(){return z(this),this.$$length}}),Object.defineProperty(K.prototype,"textContent",{get:function(){if(this.nodeType===L||this.nodeType===B){var t=[];return Q(this,null,{enter:function(e){return e.nodeType===L||e.nodeType===B||(e.nodeType===k||e.nodeType===O?null:void t.push(e.nodeValue))}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case L:case B:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Object.defineProperty(ut.prototype,"children",{get:function(){return new W(this,wt)}}),Object.defineProperty(Z.prototype,"children",{get:function(){return new W(this,wt)}}),Object.defineProperty(vt.prototype,"children",{get:function(){return new W(this,wt)}}),It=function(t,e,s){t["$$"+e]=s})}catch(t){}e._updateLiveList=z,e.Attr=pt,e.CDATASection=bt,e.CharacterData=mt,e.Comment=gt,e.Document=Z,e.DocumentFragment=vt,e.DocumentType=Et,e.DOMImplementation=J,e.Element=ut,e.Entity=yt,e.EntityReference=Nt,e.LiveNodeList=W,e.NamedNodeMap=q,e.Node=K,e.NodeList=H,e.Notation=xt,e.Text=ft,e.ProcessingInstruction=Tt,e.walkDOM=Q,e.XMLSerializer=Ct},334(t,e,s){"use strict";var i=s(981).freeze;e.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=i({Aacute:"\xc1",aacute:"\xe1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223e",acd:"\u223f",acE:"\u223e\u0333",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"\u0410",acy:"\u0430",AElig:"\xc6",aelig:"\xe6",af:"\u2061",Afr:"\u{1d504}",afr:"\u{1d51e}",Agrave:"\xc0",agrave:"\xe0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03b1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2a3f",AMP:"&",amp:"&",And:"\u2a53",and:"\u2227",andand:"\u2a55",andd:"\u2a5c",andslope:"\u2a58",andv:"\u2a5a",ang:"\u2220",ange:"\u29a4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29a8",angmsdab:"\u29a9",angmsdac:"\u29aa",angmsdad:"\u29ab",angmsdae:"\u29ac",angmsdaf:"\u29ad",angmsdag:"\u29ae",angmsdah:"\u29af",angrt:"\u221f",angrtvb:"\u22be",angrtvbd:"\u299d",angsph:"\u2222",angst:"\xc5",angzarr:"\u237c",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1d538}",aopf:"\u{1d552}",ap:"\u2248",apacir:"\u2a6f",apE:"\u2a70",ape:"\u224a",apid:"\u224b",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224a",Aring:"\xc5",aring:"\xe5",Ascr:"\u{1d49c}",ascr:"\u{1d4b6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224d",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",awconint:"\u2233",awint:"\u2a11",backcong:"\u224c",backepsilon:"\u03f6",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",Backslash:"\u2216",Barv:"\u2ae7",barvee:"\u22bd",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23b5",bbrktbrk:"\u23b6",bcong:"\u224c",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201e",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29b0",bepsi:"\u03f6",bernou:"\u212c",Bernoullis:"\u212c",Beta:"\u0392",beta:"\u03b2",beth:"\u2136",between:"\u226c",Bfr:"\u{1d505}",bfr:"\u{1d51f}",bigcap:"\u22c2",bigcirc:"\u25ef",bigcup:"\u22c3",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",bigvee:"\u22c1",bigwedge:"\u22c0",bkarow:"\u290d",blacklozenge:"\u29eb",blacksquare:"\u25aa",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20e5",bnequiv:"\u2261\u20e5",bNot:"\u2aed",bnot:"\u2310",Bopf:"\u{1d539}",bopf:"\u{1d553}",bot:"\u22a5",bottom:"\u22a5",bowtie:"\u22c8",boxbox:"\u29c9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250c",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252c",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxUL:"\u255d",boxUl:"\u255c",boxuL:"\u255b",boxul:"\u2518",boxUR:"\u255a",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256c",boxVh:"\u256b",boxvH:"\u256a",boxvh:"\u253c",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255f",boxvR:"\u255e",boxvr:"\u251c",bprime:"\u2035",Breve:"\u02d8",breve:"\u02d8",brvbar:"\xa6",Bscr:"\u212c",bscr:"\u{1d4b7}",bsemi:"\u204f",bsim:"\u223d",bsime:"\u22cd",bsol:"\\",bsolb:"\u29c5",bsolhsub:"\u27c8",bull:"\u2022",bullet:"\u2022",bump:"\u224e",bumpE:"\u2aae",bumpe:"\u224f",Bumpeq:"\u224e",bumpeq:"\u224f",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22d2",cap:"\u2229",capand:"\u2a44",capbrcup:"\u2a49",capcap:"\u2a4b",capcup:"\u2a47",capdot:"\u2a40",CapitalDifferentialD:"\u2145",caps:"\u2229\ufe00",caret:"\u2041",caron:"\u02c7",Cayleys:"\u212d",ccaps:"\u2a4d",Ccaron:"\u010c",ccaron:"\u010d",Ccedil:"\xc7",ccedil:"\xe7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2a4c",ccupssm:"\u2a50",Cdot:"\u010a",cdot:"\u010b",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"\u29b2",cent:"\xa2",CenterDot:"\xb7",centerdot:"\xb7",Cfr:"\u212d",cfr:"\u{1d520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03a7",chi:"\u03c7",cir:"\u25cb",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",CircleDot:"\u2299",circledR:"\xae",circledS:"\u24c8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29c3",cire:"\u2257",cirfnint:"\u2a10",cirmid:"\u2aef",cirscir:"\u29c2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201d",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2a74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2a6d",Congruent:"\u2261",Conint:"\u222f",conint:"\u222e",ContourIntegral:"\u222e",Copf:"\u2102",copf:"\u{1d554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xa9",copy:"\xa9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21b5",Cross:"\u2a2f",cross:"\u2717",Cscr:"\u{1d49e}",cscr:"\u{1d4b8}",csub:"\u2acf",csube:"\u2ad1",csup:"\u2ad0",csupe:"\u2ad2",ctdot:"\u22ef",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22de",cuesc:"\u22df",cularr:"\u21b6",cularrp:"\u293d",Cup:"\u22d3",cup:"\u222a",cupbrcap:"\u2a48",CupCap:"\u224d",cupcap:"\u2a46",cupcup:"\u2a4a",cupdot:"\u228d",cupor:"\u2a45",cups:"\u222a\ufe00",curarr:"\u21b7",curarrm:"\u293c",curlyeqprec:"\u22de",curlyeqsucc:"\u22df",curlyvee:"\u22ce",curlywedge:"\u22cf",curren:"\xa4",curvearrowleft:"\u21b6",curvearrowright:"\u21b7",cuvee:"\u22ce",cuwed:"\u22cf",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232d",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21a1",dArr:"\u21d3",darr:"\u2193",dash:"\u2010",Dashv:"\u2ae4",dashv:"\u22a3",dbkarow:"\u290f",dblac:"\u02dd",Dcaron:"\u010e",dcaron:"\u010f",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21ca",DDotrahd:"\u2911",ddotseq:"\u2a77",deg:"\xb0",Del:"\u2207",Delta:"\u0394",delta:"\u03b4",demptyv:"\u29b1",dfisht:"\u297f",Dfr:"\u{1d507}",dfr:"\u{1d521}",dHar:"\u2965",dharl:"\u21c3",dharr:"\u21c2",DiacriticalAcute:"\xb4",DiacriticalDot:"\u02d9",DiacriticalDoubleAcute:"\u02dd",DiacriticalGrave:"`",DiacriticalTilde:"\u02dc",diam:"\u22c4",Diamond:"\u22c4",diamond:"\u22c4",diamondsuit:"\u2666",diams:"\u2666",die:"\xa8",DifferentialD:"\u2146",digamma:"\u03dd",disin:"\u22f2",div:"\xf7",divide:"\xf7",divideontimes:"\u22c7",divonx:"\u22c7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231e",dlcrop:"\u230d",dollar:"$",Dopf:"\u{1d53b}",dopf:"\u{1d555}",Dot:"\xa8",dot:"\u02d9",DotDot:"\u20dc",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22a1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222f",DoubleDot:"\xa8",DoubleDownArrow:"\u21d3",DoubleLeftArrow:"\u21d0",DoubleLeftRightArrow:"\u21d4",DoubleLeftTee:"\u2ae4",DoubleLongLeftArrow:"\u27f8",DoubleLongLeftRightArrow:"\u27fa",DoubleLongRightArrow:"\u27f9",DoubleRightArrow:"\u21d2",DoubleRightTee:"\u22a8",DoubleUpArrow:"\u21d1",DoubleUpDownArrow:"\u21d5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21d3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21f5",DownBreve:"\u0311",downdownarrows:"\u21ca",downharpoonleft:"\u21c3",downharpoonright:"\u21c2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295e",DownLeftVector:"\u21bd",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295f",DownRightVector:"\u21c1",DownRightVectorBar:"\u2957",DownTee:"\u22a4",DownTeeArrow:"\u21a7",drbkarow:"\u2910",drcorn:"\u231f",drcrop:"\u230c",Dscr:"\u{1d49f}",dscr:"\u{1d4b9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29f6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22f1",dtri:"\u25bf",dtrif:"\u25be",duarr:"\u21f5",duhar:"\u296f",dwangle:"\u29a6",DZcy:"\u040f",dzcy:"\u045f",dzigrarr:"\u27ff",Eacute:"\xc9",eacute:"\xe9",easter:"\u2a6e",Ecaron:"\u011a",ecaron:"\u011b",ecir:"\u2256",Ecirc:"\xca",ecirc:"\xea",ecolon:"\u2255",Ecy:"\u042d",ecy:"\u044d",eDDot:"\u2a77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1d508}",efr:"\u{1d522}",eg:"\u2a9a",Egrave:"\xc8",egrave:"\xe8",egs:"\u2a96",egsdot:"\u2a98",el:"\u2a99",Element:"\u2208",elinters:"\u23e7",ell:"\u2113",els:"\u2a95",elsdot:"\u2a97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25fb",emptyv:"\u2205",EmptyVerySmallSquare:"\u25ab",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014a",eng:"\u014b",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1d53c}",eopf:"\u{1d556}",epar:"\u22d5",eparsl:"\u29e3",eplus:"\u2a71",epsi:"\u03b5",Epsilon:"\u0395",epsilon:"\u03b5",epsiv:"\u03f5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2a96",eqslantless:"\u2a95",Equal:"\u2a75",equals:"=",EqualTilde:"\u2242",equest:"\u225f",Equilibrium:"\u21cc",equiv:"\u2261",equivDD:"\u2a78",eqvparsl:"\u29e5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212f",esdot:"\u2250",Esim:"\u2a73",esim:"\u2242",Eta:"\u0397",eta:"\u03b7",ETH:"\xd0",eth:"\xf0",Euml:"\xcb",euml:"\xeb",euro:"\u20ac",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\ufb03",fflig:"\ufb00",ffllig:"\ufb04",Ffr:"\u{1d509}",ffr:"\u{1d523}",filig:"\ufb01",FilledSmallSquare:"\u25fc",FilledVerySmallSquare:"\u25aa",fjlig:"fj",flat:"\u266d",fllig:"\ufb02",fltns:"\u25b1",fnof:"\u0192",Fopf:"\u{1d53d}",fopf:"\u{1d557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22d4",forkv:"\u2ad9",Fouriertrf:"\u2131",fpartint:"\u2a0d",frac12:"\xbd",frac13:"\u2153",frac14:"\xbc",frac15:"\u2155",frac16:"\u2159",frac18:"\u215b",frac23:"\u2154",frac25:"\u2156",frac34:"\xbe",frac35:"\u2157",frac38:"\u215c",frac45:"\u2158",frac56:"\u215a",frac58:"\u215d",frac78:"\u215e",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1d4bb}",gacute:"\u01f5",Gamma:"\u0393",gamma:"\u03b3",Gammad:"\u03dc",gammad:"\u03dd",gap:"\u2a86",Gbreve:"\u011e",gbreve:"\u011f",Gcedil:"\u0122",Gcirc:"\u011c",gcirc:"\u011d",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2a8c",gel:"\u22db",geq:"\u2265",geqq:"\u2267",geqslant:"\u2a7e",ges:"\u2a7e",gescc:"\u2aa9",gesdot:"\u2a80",gesdoto:"\u2a82",gesdotol:"\u2a84",gesl:"\u22db\ufe00",gesles:"\u2a94",Gfr:"\u{1d50a}",gfr:"\u{1d524}",Gg:"\u22d9",gg:"\u226b",ggg:"\u22d9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2aa5",glE:"\u2a92",glj:"\u2aa4",gnap:"\u2a8a",gnapprox:"\u2a8a",gnE:"\u2269",gne:"\u2a88",gneq:"\u2a88",gneqq:"\u2269",gnsim:"\u22e7",Gopf:"\u{1d53e}",gopf:"\u{1d558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22db",GreaterFullEqual:"\u2267",GreaterGreater:"\u2aa2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2a7e",GreaterTilde:"\u2273",Gscr:"\u{1d4a2}",gscr:"\u210a",gsim:"\u2273",gsime:"\u2a8e",gsiml:"\u2a90",Gt:"\u226b",GT:">",gt:">",gtcc:"\u2aa7",gtcir:"\u2a7a",gtdot:"\u22d7",gtlPar:"\u2995",gtquest:"\u2a7c",gtrapprox:"\u2a86",gtrarr:"\u2978",gtrdot:"\u22d7",gtreqless:"\u22db",gtreqqless:"\u2a8c",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\ufe00",gvnE:"\u2269\ufe00",Hacek:"\u02c7",hairsp:"\u200a",half:"\xbd",hamilt:"\u210b",HARDcy:"\u042a",hardcy:"\u044a",hArr:"\u21d4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21ad",Hat:"^",hbar:"\u210f",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22b9",Hfr:"\u210c",hfr:"\u{1d525}",HilbertSpace:"\u210b",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21ff",homtht:"\u223b",hookleftarrow:"\u21a9",hookrightarrow:"\u21aa",Hopf:"\u210d",hopf:"\u{1d559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210b",hscr:"\u{1d4bd}",hslash:"\u210f",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224e",HumpEqual:"\u224f",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xcd",iacute:"\xed",ic:"\u2063",Icirc:"\xce",icirc:"\xee",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xa1",iff:"\u21d4",Ifr:"\u2111",ifr:"\u{1d526}",Igrave:"\xcc",igrave:"\xec",ii:"\u2148",iiiint:"\u2a0c",iiint:"\u222d",iinfin:"\u29dc",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012a",imacr:"\u012b",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22b7",imped:"\u01b5",Implies:"\u21d2",in:"\u2208",incare:"\u2105",infin:"\u221e",infintie:"\u29dd",inodot:"\u0131",Int:"\u222c",int:"\u222b",intcal:"\u22ba",integers:"\u2124",Integral:"\u222b",intercal:"\u22ba",Intersection:"\u22c2",intlarhk:"\u2a17",intprod:"\u2a3c",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012e",iogon:"\u012f",Iopf:"\u{1d540}",iopf:"\u{1d55a}",Iota:"\u0399",iota:"\u03b9",iprod:"\u2a3c",iquest:"\xbf",Iscr:"\u2110",iscr:"\u{1d4be}",isin:"\u2208",isindot:"\u22f5",isinE:"\u22f9",isins:"\u22f4",isinsv:"\u22f3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xcf",iuml:"\xef",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1d50d}",jfr:"\u{1d527}",jmath:"\u0237",Jopf:"\u{1d541}",jopf:"\u{1d55b}",Jscr:"\u{1d4a5}",jscr:"\u{1d4bf}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039a",kappa:"\u03ba",kappav:"\u03f0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041a",kcy:"\u043a",Kfr:"\u{1d50e}",kfr:"\u{1d528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040c",kjcy:"\u045c",Kopf:"\u{1d542}",kopf:"\u{1d55c}",Kscr:"\u{1d4a6}",kscr:"\u{1d4c0}",lAarr:"\u21da",Lacute:"\u0139",lacute:"\u013a",laemptyv:"\u29b4",lagran:"\u2112",Lambda:"\u039b",lambda:"\u03bb",Lang:"\u27ea",lang:"\u27e8",langd:"\u2991",langle:"\u27e8",lap:"\u2a85",Laplacetrf:"\u2112",laquo:"\xab",Larr:"\u219e",lArr:"\u21d0",larr:"\u2190",larrb:"\u21e4",larrbfs:"\u291f",larrfs:"\u291d",larrhk:"\u21a9",larrlp:"\u21ab",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21a2",lat:"\u2aab",lAtail:"\u291b",latail:"\u2919",late:"\u2aad",lates:"\u2aad\ufe00",lBarr:"\u290e",lbarr:"\u290c",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298b",lbrksld:"\u298f",lbrkslu:"\u298d",Lcaron:"\u013d",lcaron:"\u013e",Lcedil:"\u013b",lcedil:"\u013c",lceil:"\u2308",lcub:"{",Lcy:"\u041b",lcy:"\u043b",ldca:"\u2936",ldquo:"\u201c",ldquor:"\u201e",ldrdhar:"\u2967",ldrushar:"\u294b",ldsh:"\u21b2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27e8",LeftArrow:"\u2190",Leftarrow:"\u21d0",leftarrow:"\u2190",LeftArrowBar:"\u21e4",LeftArrowRightArrow:"\u21c6",leftarrowtail:"\u21a2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27e6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21c3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230a",leftharpoondown:"\u21bd",leftharpoonup:"\u21bc",leftleftarrows:"\u21c7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21d4",leftrightarrow:"\u2194",leftrightarrows:"\u21c6",leftrightharpoons:"\u21cb",leftrightsquigarrow:"\u21ad",LeftRightVector:"\u294e",LeftTee:"\u22a3",LeftTeeArrow:"\u21a4",LeftTeeVector:"\u295a",leftthreetimes:"\u22cb",LeftTriangle:"\u22b2",LeftTriangleBar:"\u29cf",LeftTriangleEqual:"\u22b4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21bf",LeftUpVectorBar:"\u2958",LeftVector:"\u21bc",LeftVectorBar:"\u2952",lEg:"\u2a8b",leg:"\u22da",leq:"\u2264",leqq:"\u2266",leqslant:"\u2a7d",les:"\u2a7d",lescc:"\u2aa8",lesdot:"\u2a7f",lesdoto:"\u2a81",lesdotor:"\u2a83",lesg:"\u22da\ufe00",lesges:"\u2a93",lessapprox:"\u2a85",lessdot:"\u22d6",lesseqgtr:"\u22da",lesseqqgtr:"\u2a8b",LessEqualGreater:"\u22da",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2aa1",lesssim:"\u2272",LessSlantEqual:"\u2a7d",LessTilde:"\u2272",lfisht:"\u297c",lfloor:"\u230a",Lfr:"\u{1d50f}",lfr:"\u{1d529}",lg:"\u2276",lgE:"\u2a91",lHar:"\u2962",lhard:"\u21bd",lharu:"\u21bc",lharul:"\u296a",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22d8",ll:"\u226a",llarr:"\u21c7",llcorner:"\u231e",Lleftarrow:"\u21da",llhard:"\u296b",lltri:"\u25fa",Lmidot:"\u013f",lmidot:"\u0140",lmoust:"\u23b0",lmoustache:"\u23b0",lnap:"\u2a89",lnapprox:"\u2a89",lnE:"\u2268",lne:"\u2a87",lneq:"\u2a87",lneqq:"\u2268",lnsim:"\u22e6",loang:"\u27ec",loarr:"\u21fd",lobrk:"\u27e6",LongLeftArrow:"\u27f5",Longleftarrow:"\u27f8",longleftarrow:"\u27f5",LongLeftRightArrow:"\u27f7",Longleftrightarrow:"\u27fa",longleftrightarrow:"\u27f7",longmapsto:"\u27fc",LongRightArrow:"\u27f6",Longrightarrow:"\u27f9",longrightarrow:"\u27f6",looparrowleft:"\u21ab",looparrowright:"\u21ac",lopar:"\u2985",Lopf:"\u{1d543}",lopf:"\u{1d55d}",loplus:"\u2a2d",lotimes:"\u2a34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25ca",lozenge:"\u25ca",lozf:"\u29eb",lpar:"(",lparlt:"\u2993",lrarr:"\u21c6",lrcorner:"\u231f",lrhar:"\u21cb",lrhard:"\u296d",lrm:"\u200e",lrtri:"\u22bf",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1d4c1}",Lsh:"\u21b0",lsh:"\u21b0",lsim:"\u2272",lsime:"\u2a8d",lsimg:"\u2a8f",lsqb:"[",lsquo:"\u2018",lsquor:"\u201a",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226a",LT:"<",lt:"<",ltcc:"\u2aa6",ltcir:"\u2a79",ltdot:"\u22d6",lthree:"\u22cb",ltimes:"\u22c9",ltlarr:"\u2976",ltquest:"\u2a7b",ltri:"\u25c3",ltrie:"\u22b4",ltrif:"\u25c2",ltrPar:"\u2996",lurdshar:"\u294a",luruhar:"\u2966",lvertneqq:"\u2268\ufe00",lvnE:"\u2268\ufe00",macr:"\xaf",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21a6",mapsto:"\u21a6",mapstodown:"\u21a7",mapstoleft:"\u21a4",mapstoup:"\u21a5",marker:"\u25ae",mcomma:"\u2a29",Mcy:"\u041c",mcy:"\u043c",mdash:"\u2014",mDDot:"\u223a",measuredangle:"\u2221",MediumSpace:"\u205f",Mellintrf:"\u2133",Mfr:"\u{1d510}",mfr:"\u{1d52a}",mho:"\u2127",micro:"\xb5",mid:"\u2223",midast:"*",midcir:"\u2af0",middot:"\xb7",minus:"\u2212",minusb:"\u229f",minusd:"\u2238",minusdu:"\u2a2a",MinusPlus:"\u2213",mlcp:"\u2adb",mldr:"\u2026",mnplus:"\u2213",models:"\u22a7",Mopf:"\u{1d544}",mopf:"\u{1d55e}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1d4c2}",mstpos:"\u223e",Mu:"\u039c",mu:"\u03bc",multimap:"\u22b8",mumap:"\u22b8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20d2",nap:"\u2249",napE:"\u2a70\u0338",napid:"\u224b\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266e",natural:"\u266e",naturals:"\u2115",nbsp:"\xa0",nbump:"\u224e\u0338",nbumpe:"\u224f\u0338",ncap:"\u2a43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2a6d\u0338",ncup:"\u2a42",Ncy:"\u041d",ncy:"\u043d",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21d7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200b",NegativeThickSpace:"\u200b",NegativeThinSpace:"\u200b",NegativeVeryThinSpace:"\u200b",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226b",NestedLessLess:"\u226a",NewLine:"\n",nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1d511}",nfr:"\u{1d52b}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2a7e\u0338",nges:"\u2a7e\u0338",nGg:"\u22d9\u0338",ngsim:"\u2275",nGt:"\u226b\u20d2",ngt:"\u226f",ngtr:"\u226f",nGtv:"\u226b\u0338",nhArr:"\u21ce",nharr:"\u21ae",nhpar:"\u2af2",ni:"\u220b",nis:"\u22fc",nisd:"\u22fa",niv:"\u220b",NJcy:"\u040a",njcy:"\u045a",nlArr:"\u21cd",nlarr:"\u219a",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21cd",nleftarrow:"\u219a",nLeftrightarrow:"\u21ce",nleftrightarrow:"\u21ae",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2a7d\u0338",nles:"\u2a7d\u0338",nless:"\u226e",nLl:"\u22d8\u0338",nlsim:"\u2274",nLt:"\u226a\u20d2",nlt:"\u226e",nltri:"\u22ea",nltrie:"\u22ec",nLtv:"\u226a\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xa0",Nopf:"\u2115",nopf:"\u{1d55f}",Not:"\u2aec",not:"\xac",NotCongruent:"\u2262",NotCupCap:"\u226d",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226f",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226b\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2a7e\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224e\u0338",NotHumpEqual:"\u224f\u0338",notin:"\u2209",notindot:"\u22f5\u0338",notinE:"\u22f9\u0338",notinva:"\u2209",notinvb:"\u22f7",notinvc:"\u22f6",NotLeftTriangle:"\u22ea",NotLeftTriangleBar:"\u29cf\u0338",NotLeftTriangleEqual:"\u22ec",NotLess:"\u226e",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226a\u0338",NotLessSlantEqual:"\u2a7d\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2aa2\u0338",NotNestedLessLess:"\u2aa1\u0338",notni:"\u220c",notniva:"\u220c",notnivb:"\u22fe",notnivc:"\u22fd",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2aaf\u0338",NotPrecedesSlantEqual:"\u22e0",NotReverseElement:"\u220c",NotRightTriangle:"\u22eb",NotRightTriangleBar:"\u29d0\u0338",NotRightTriangleEqual:"\u22ed",NotSquareSubset:"\u228f\u0338",NotSquareSubsetEqual:"\u22e2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22e3",NotSubset:"\u2282\u20d2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2ab0\u0338",NotSucceedsSlantEqual:"\u22e1",NotSucceedsTilde:"\u227f\u0338",NotSuperset:"\u2283\u20d2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2afd\u20e5",npart:"\u2202\u0338",npolint:"\u2a14",npr:"\u2280",nprcue:"\u22e0",npre:"\u2aaf\u0338",nprec:"\u2280",npreceq:"\u2aaf\u0338",nrArr:"\u21cf",nrarr:"\u219b",nrarrc:"\u2933\u0338",nrarrw:"\u219d\u0338",nRightarrow:"\u21cf",nrightarrow:"\u219b",nrtri:"\u22eb",nrtrie:"\u22ed",nsc:"\u2281",nsccue:"\u22e1",nsce:"\u2ab0\u0338",Nscr:"\u{1d4a9}",nscr:"\u{1d4c3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22e2",nsqsupe:"\u22e3",nsub:"\u2284",nsubE:"\u2ac5\u0338",nsube:"\u2288",nsubset:"\u2282\u20d2",nsubseteq:"\u2288",nsubseteqq:"\u2ac5\u0338",nsucc:"\u2281",nsucceq:"\u2ab0\u0338",nsup:"\u2285",nsupE:"\u2ac6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20d2",nsupseteq:"\u2289",nsupseteqq:"\u2ac6\u0338",ntgl:"\u2279",Ntilde:"\xd1",ntilde:"\xf1",ntlg:"\u2278",ntriangleleft:"\u22ea",ntrianglelefteq:"\u22ec",ntriangleright:"\u22eb",ntrianglerighteq:"\u22ed",Nu:"\u039d",nu:"\u03bd",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224d\u20d2",nVDash:"\u22af",nVdash:"\u22ae",nvDash:"\u22ad",nvdash:"\u22ac",nvge:"\u2265\u20d2",nvgt:">\u20d2",nvHarr:"\u2904",nvinfin:"\u29de",nvlArr:"\u2902",nvle:"\u2264\u20d2",nvlt:"<\u20d2",nvltrie:"\u22b4\u20d2",nvrArr:"\u2903",nvrtrie:"\u22b5\u20d2",nvsim:"\u223c\u20d2",nwarhk:"\u2923",nwArr:"\u21d6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xd3",oacute:"\xf3",oast:"\u229b",ocir:"\u229a",Ocirc:"\xd4",ocirc:"\xf4",Ocy:"\u041e",ocy:"\u043e",odash:"\u229d",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2a38",odot:"\u2299",odsold:"\u29bc",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29bf",Ofr:"\u{1d512}",ofr:"\u{1d52c}",ogon:"\u02db",Ograve:"\xd2",ograve:"\xf2",ogt:"\u29c1",ohbar:"\u29b5",ohm:"\u03a9",oint:"\u222e",olarr:"\u21ba",olcir:"\u29be",olcross:"\u29bb",oline:"\u203e",olt:"\u29c0",Omacr:"\u014c",omacr:"\u014d",Omega:"\u03a9",omega:"\u03c9",Omicron:"\u039f",omicron:"\u03bf",omid:"\u29b6",ominus:"\u2296",Oopf:"\u{1d546}",oopf:"\u{1d560}",opar:"\u29b7",OpenCurlyDoubleQuote:"\u201c",OpenCurlyQuote:"\u2018",operp:"\u29b9",oplus:"\u2295",Or:"\u2a54",or:"\u2228",orarr:"\u21bb",ord:"\u2a5d",order:"\u2134",orderof:"\u2134",ordf:"\xaa",ordm:"\xba",origof:"\u22b6",oror:"\u2a56",orslope:"\u2a57",orv:"\u2a5b",oS:"\u24c8",Oscr:"\u{1d4aa}",oscr:"\u2134",Oslash:"\xd8",oslash:"\xf8",osol:"\u2298",Otilde:"\xd5",otilde:"\xf5",Otimes:"\u2a37",otimes:"\u2297",otimesas:"\u2a36",Ouml:"\xd6",ouml:"\xf6",ovbar:"\u233d",OverBar:"\u203e",OverBrace:"\u23de",OverBracket:"\u23b4",OverParenthesis:"\u23dc",par:"\u2225",para:"\xb6",parallel:"\u2225",parsim:"\u2af3",parsl:"\u2afd",part:"\u2202",PartialD:"\u2202",Pcy:"\u041f",pcy:"\u043f",percnt:"%",period:".",permil:"\u2030",perp:"\u22a5",pertenk:"\u2031",Pfr:"\u{1d513}",pfr:"\u{1d52d}",Phi:"\u03a6",phi:"\u03c6",phiv:"\u03d5",phmmat:"\u2133",phone:"\u260e",Pi:"\u03a0",pi:"\u03c0",pitchfork:"\u22d4",piv:"\u03d6",planck:"\u210f",planckh:"\u210e",plankv:"\u210f",plus:"+",plusacir:"\u2a23",plusb:"\u229e",pluscir:"\u2a22",plusdo:"\u2214",plusdu:"\u2a25",pluse:"\u2a72",PlusMinus:"\xb1",plusmn:"\xb1",plussim:"\u2a26",plustwo:"\u2a27",pm:"\xb1",Poincareplane:"\u210c",pointint:"\u2a15",Popf:"\u2119",popf:"\u{1d561}",pound:"\xa3",Pr:"\u2abb",pr:"\u227a",prap:"\u2ab7",prcue:"\u227c",prE:"\u2ab3",pre:"\u2aaf",prec:"\u227a",precapprox:"\u2ab7",preccurlyeq:"\u227c",Precedes:"\u227a",PrecedesEqual:"\u2aaf",PrecedesSlantEqual:"\u227c",PrecedesTilde:"\u227e",preceq:"\u2aaf",precnapprox:"\u2ab9",precneqq:"\u2ab5",precnsim:"\u22e8",precsim:"\u227e",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2ab9",prnE:"\u2ab5",prnsim:"\u22e8",prod:"\u220f",Product:"\u220f",profalar:"\u232e",profline:"\u2312",profsurf:"\u2313",prop:"\u221d",Proportion:"\u2237",Proportional:"\u221d",propto:"\u221d",prsim:"\u227e",prurel:"\u22b0",Pscr:"\u{1d4ab}",pscr:"\u{1d4c5}",Psi:"\u03a8",psi:"\u03c8",puncsp:"\u2008",Qfr:"\u{1d514}",qfr:"\u{1d52e}",qint:"\u2a0c",Qopf:"\u211a",qopf:"\u{1d562}",qprime:"\u2057",Qscr:"\u{1d4ac}",qscr:"\u{1d4c6}",quaternions:"\u210d",quatint:"\u2a16",quest:"?",questeq:"\u225f",QUOT:'"',quot:'"',rAarr:"\u21db",race:"\u223d\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221a",raemptyv:"\u29b3",Rang:"\u27eb",rang:"\u27e9",rangd:"\u2992",range:"\u29a5",rangle:"\u27e9",raquo:"\xbb",Rarr:"\u21a0",rArr:"\u21d2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21e5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291e",rarrhk:"\u21aa",rarrlp:"\u21ac",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21a3",rarrw:"\u219d",rAtail:"\u291c",ratail:"\u291a",ratio:"\u2236",rationals:"\u211a",RBarr:"\u2910",rBarr:"\u290f",rbarr:"\u290d",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298c",rbrksld:"\u298e",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201d",rdquor:"\u201d",rdsh:"\u21b3",Re:"\u211c",real:"\u211c",realine:"\u211b",realpart:"\u211c",reals:"\u211d",rect:"\u25ad",REG:"\xae",reg:"\xae",ReverseElement:"\u220b",ReverseEquilibrium:"\u21cb",ReverseUpEquilibrium:"\u296f",rfisht:"\u297d",rfloor:"\u230b",Rfr:"\u211c",rfr:"\u{1d52f}",rHar:"\u2964",rhard:"\u21c1",rharu:"\u21c0",rharul:"\u296c",Rho:"\u03a1",rho:"\u03c1",rhov:"\u03f1",RightAngleBracket:"\u27e9",RightArrow:"\u2192",Rightarrow:"\u21d2",rightarrow:"\u2192",RightArrowBar:"\u21e5",RightArrowLeftArrow:"\u21c4",rightarrowtail:"\u21a3",RightCeiling:"\u2309",RightDoubleBracket:"\u27e7",RightDownTeeVector:"\u295d",RightDownVector:"\u21c2",RightDownVectorBar:"\u2955",RightFloor:"\u230b",rightharpoondown:"\u21c1",rightharpoonup:"\u21c0",rightleftarrows:"\u21c4",rightleftharpoons:"\u21cc",rightrightarrows:"\u21c9",rightsquigarrow:"\u219d",RightTee:"\u22a2",RightTeeArrow:"\u21a6",RightTeeVector:"\u295b",rightthreetimes:"\u22cc",RightTriangle:"\u22b3",RightTriangleBar:"\u29d0",RightTriangleEqual:"\u22b5",RightUpDownVector:"\u294f",RightUpTeeVector:"\u295c",RightUpVector:"\u21be",RightUpVectorBar:"\u2954",RightVector:"\u21c0",RightVectorBar:"\u2953",ring:"\u02da",risingdotseq:"\u2253",rlarr:"\u21c4",rlhar:"\u21cc",rlm:"\u200f",rmoust:"\u23b1",rmoustache:"\u23b1",rnmid:"\u2aee",roang:"\u27ed",roarr:"\u21fe",robrk:"\u27e7",ropar:"\u2986",Ropf:"\u211d",ropf:"\u{1d563}",roplus:"\u2a2e",rotimes:"\u2a35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2a12",rrarr:"\u21c9",Rrightarrow:"\u21db",rsaquo:"\u203a",Rscr:"\u211b",rscr:"\u{1d4c7}",Rsh:"\u21b1",rsh:"\u21b1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22cc",rtimes:"\u22ca",rtri:"\u25b9",rtrie:"\u22b5",rtrif:"\u25b8",rtriltri:"\u29ce",RuleDelayed:"\u29f4",ruluhar:"\u2968",rx:"\u211e",Sacute:"\u015a",sacute:"\u015b",sbquo:"\u201a",Sc:"\u2abc",sc:"\u227b",scap:"\u2ab8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227d",scE:"\u2ab4",sce:"\u2ab0",Scedil:"\u015e",scedil:"\u015f",Scirc:"\u015c",scirc:"\u015d",scnap:"\u2aba",scnE:"\u2ab6",scnsim:"\u22e9",scpolint:"\u2a13",scsim:"\u227f",Scy:"\u0421",scy:"\u0441",sdot:"\u22c5",sdotb:"\u22a1",sdote:"\u2a66",searhk:"\u2925",seArr:"\u21d8",searr:"\u2198",searrow:"\u2198",sect:"\xa7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1d516}",sfr:"\u{1d530}",sfrown:"\u2322",sharp:"\u266f",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xad",Sigma:"\u03a3",sigma:"\u03c3",sigmaf:"\u03c2",sigmav:"\u03c2",sim:"\u223c",simdot:"\u2a6a",sime:"\u2243",simeq:"\u2243",simg:"\u2a9e",simgE:"\u2aa0",siml:"\u2a9d",simlE:"\u2a9f",simne:"\u2246",simplus:"\u2a24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2a33",smeparsl:"\u29e4",smid:"\u2223",smile:"\u2323",smt:"\u2aaa",smte:"\u2aac",smtes:"\u2aac\ufe00",SOFTcy:"\u042c",softcy:"\u044c",sol:"/",solb:"\u29c4",solbar:"\u233f",Sopf:"\u{1d54a}",sopf:"\u{1d564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\ufe00",sqcup:"\u2294",sqcups:"\u2294\ufe00",Sqrt:"\u221a",sqsub:"\u228f",sqsube:"\u2291",sqsubset:"\u228f",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25a1",Square:"\u25a1",square:"\u25a1",SquareIntersection:"\u2293",SquareSubset:"\u228f",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25aa",squf:"\u25aa",srarr:"\u2192",Sscr:"\u{1d4ae}",sscr:"\u{1d4c8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22c6",Star:"\u22c6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03f5",straightphi:"\u03d5",strns:"\xaf",Sub:"\u22d0",sub:"\u2282",subdot:"\u2abd",subE:"\u2ac5",sube:"\u2286",subedot:"\u2ac3",submult:"\u2ac1",subnE:"\u2acb",subne:"\u228a",subplus:"\u2abf",subrarr:"\u2979",Subset:"\u22d0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2ac5",SubsetEqual:"\u2286",subsetneq:"\u228a",subsetneqq:"\u2acb",subsim:"\u2ac7",subsub:"\u2ad5",subsup:"\u2ad3",succ:"\u227b",succapprox:"\u2ab8",succcurlyeq:"\u227d",Succeeds:"\u227b",SucceedsEqual:"\u2ab0",SucceedsSlantEqual:"\u227d",SucceedsTilde:"\u227f",succeq:"\u2ab0",succnapprox:"\u2aba",succneqq:"\u2ab6",succnsim:"\u22e9",succsim:"\u227f",SuchThat:"\u220b",Sum:"\u2211",sum:"\u2211",sung:"\u266a",Sup:"\u22d1",sup:"\u2283",sup1:"\xb9",sup2:"\xb2",sup3:"\xb3",supdot:"\u2abe",supdsub:"\u2ad8",supE:"\u2ac6",supe:"\u2287",supedot:"\u2ac4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27c9",suphsub:"\u2ad7",suplarr:"\u297b",supmult:"\u2ac2",supnE:"\u2acc",supne:"\u228b",supplus:"\u2ac0",Supset:"\u22d1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2ac6",supsetneq:"\u228b",supsetneqq:"\u2acc",supsim:"\u2ac8",supsub:"\u2ad4",supsup:"\u2ad6",swarhk:"\u2926",swArr:"\u21d9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292a",szlig:"\xdf",Tab:"\t",target:"\u2316",Tau:"\u03a4",tau:"\u03c4",tbrk:"\u23b4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20db",telrec:"\u2315",Tfr:"\u{1d517}",tfr:"\u{1d531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03b8",thetasym:"\u03d1",thetav:"\u03d1",thickapprox:"\u2248",thicksim:"\u223c",ThickSpace:"\u205f\u200a",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223c",THORN:"\xde",thorn:"\xfe",Tilde:"\u223c",tilde:"\u02dc",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xd7",timesb:"\u22a0",timesbar:"\u2a31",timesd:"\u2a30",tint:"\u222d",toea:"\u2928",top:"\u22a4",topbot:"\u2336",topcir:"\u2af1",Topf:"\u{1d54b}",topf:"\u{1d565}",topfork:"\u2ada",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25b5",triangledown:"\u25bf",triangleleft:"\u25c3",trianglelefteq:"\u22b4",triangleq:"\u225c",triangleright:"\u25b9",trianglerighteq:"\u22b5",tridot:"\u25ec",trie:"\u225c",triminus:"\u2a3a",TripleDot:"\u20db",triplus:"\u2a39",trisb:"\u29cd",tritime:"\u2a3b",trpezium:"\u23e2",Tscr:"\u{1d4af}",tscr:"\u{1d4c9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040b",tshcy:"\u045b",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226c",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",Uacute:"\xda",uacute:"\xfa",Uarr:"\u219f",uArr:"\u21d1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040e",ubrcy:"\u045e",Ubreve:"\u016c",ubreve:"\u016d",Ucirc:"\xdb",ucirc:"\xfb",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21c5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296e",ufisht:"\u297e",Ufr:"\u{1d518}",ufr:"\u{1d532}",Ugrave:"\xd9",ugrave:"\xf9",uHar:"\u2963",uharl:"\u21bf",uharr:"\u21be",uhblk:"\u2580",ulcorn:"\u231c",ulcorner:"\u231c",ulcrop:"\u230f",ultri:"\u25f8",Umacr:"\u016a",umacr:"\u016b",uml:"\xa8",UnderBar:"_",UnderBrace:"\u23df",UnderBracket:"\u23b5",UnderParenthesis:"\u23dd",Union:"\u22c3",UnionPlus:"\u228e",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1d54c}",uopf:"\u{1d566}",UpArrow:"\u2191",Uparrow:"\u21d1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21c5",UpDownArrow:"\u2195",Updownarrow:"\u21d5",updownarrow:"\u2195",UpEquilibrium:"\u296e",upharpoonleft:"\u21bf",upharpoonright:"\u21be",uplus:"\u228e",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03d2",upsi:"\u03c5",upsih:"\u03d2",Upsilon:"\u03a5",upsilon:"\u03c5",UpTee:"\u22a5",UpTeeArrow:"\u21a5",upuparrows:"\u21c8",urcorn:"\u231d",urcorner:"\u231d",urcrop:"\u230e",Uring:"\u016e",uring:"\u016f",urtri:"\u25f9",Uscr:"\u{1d4b0}",uscr:"\u{1d4ca}",utdot:"\u22f0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25b5",utrif:"\u25b4",uuarr:"\u21c8",Uuml:"\xdc",uuml:"\xfc",uwangle:"\u29a7",vangrt:"\u299c",varepsilon:"\u03f5",varkappa:"\u03f0",varnothing:"\u2205",varphi:"\u03d5",varpi:"\u03d6",varpropto:"\u221d",vArr:"\u21d5",varr:"\u2195",varrho:"\u03f1",varsigma:"\u03c2",varsubsetneq:"\u228a\ufe00",varsubsetneqq:"\u2acb\ufe00",varsupsetneq:"\u228b\ufe00",varsupsetneqq:"\u2acc\ufe00",vartheta:"\u03d1",vartriangleleft:"\u22b2",vartriangleright:"\u22b3",Vbar:"\u2aeb",vBar:"\u2ae8",vBarv:"\u2ae9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22ab",Vdash:"\u22a9",vDash:"\u22a8",vdash:"\u22a2",Vdashl:"\u2ae6",Vee:"\u22c1",vee:"\u2228",veebar:"\u22bb",veeeq:"\u225a",vellip:"\u22ee",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200a",Vfr:"\u{1d519}",vfr:"\u{1d533}",vltri:"\u22b2",vnsub:"\u2282\u20d2",vnsup:"\u2283\u20d2",Vopf:"\u{1d54d}",vopf:"\u{1d567}",vprop:"\u221d",vrtri:"\u22b3",Vscr:"\u{1d4b1}",vscr:"\u{1d4cb}",vsubnE:"\u2acb\ufe00",vsubne:"\u228a\ufe00",vsupnE:"\u2acc\ufe00",vsupne:"\u228b\ufe00",Vvdash:"\u22aa",vzigzag:"\u299a",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2a5f",Wedge:"\u22c0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1d51a}",wfr:"\u{1d534}",Wopf:"\u{1d54e}",wopf:"\u{1d568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1d4b2}",wscr:"\u{1d4cc}",xcap:"\u22c2",xcirc:"\u25ef",xcup:"\u22c3",xdtri:"\u25bd",Xfr:"\u{1d51b}",xfr:"\u{1d535}",xhArr:"\u27fa",xharr:"\u27f7",Xi:"\u039e",xi:"\u03be",xlArr:"\u27f8",xlarr:"\u27f5",xmap:"\u27fc",xnis:"\u22fb",xodot:"\u2a00",Xopf:"\u{1d54f}",xopf:"\u{1d569}",xoplus:"\u2a01",xotime:"\u2a02",xrArr:"\u27f9",xrarr:"\u27f6",Xscr:"\u{1d4b3}",xscr:"\u{1d4cd}",xsqcup:"\u2a06",xuplus:"\u2a04",xutri:"\u25b3",xvee:"\u22c1",xwedge:"\u22c0",Yacute:"\xdd",yacute:"\xfd",YAcy:"\u042f",yacy:"\u044f",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042b",ycy:"\u044b",yen:"\xa5",Yfr:"\u{1d51c}",yfr:"\u{1d536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1d550}",yopf:"\u{1d56a}",Yscr:"\u{1d4b4}",yscr:"\u{1d4ce}",YUcy:"\u042e",yucy:"\u044e",Yuml:"\u0178",yuml:"\xff",Zacute:"\u0179",zacute:"\u017a",Zcaron:"\u017d",zcaron:"\u017e",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017b",zdot:"\u017c",zeetrf:"\u2128",ZeroWidthSpace:"\u200b",Zeta:"\u0396",zeta:"\u03b6",Zfr:"\u2128",zfr:"\u{1d537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21dd",Zopf:"\u2124",zopf:"\u{1d56b}",Zscr:"\u{1d4b5}",zscr:"\u{1d4cf}",zwj:"\u200d",zwnj:"\u200c"}),e.entityMap=e.HTML_ENTITIES},918(t,e,s){"use strict";function i(t,e){t.prototype=Object.create(Error.prototype,{constructor:{value:t},name:{value:t.name,enumerable:!0,writable:e}})}var r=s(981).freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),n=Object.keys(r);function o(t){return"number"==typeof t&&t>=1&&t<=25}function a(t,e){var s;o(t)?(this.name=n[t],this.message=e||""):(this.message=t,this.name="string"==typeof(s=e)&&s.substring(s.length-r.Error.length)===r.Error?e:r.Error),Error.captureStackTrace&&Error.captureStackTrace(this,a)}i(a,!0),Object.defineProperties(a.prototype,{code:{enumerable:!0,get:function(){var t=n.indexOf(this.name);return o(t)?t:0}}});for(var l={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},c=Object.entries(l),h=0;h/),I=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,w=a('"',I,'*"',"|","'",n(I,"'"),"*'"),k="\x3c!--",O=o(k,a(n(l,"-"),"|",o("-",n(l,"-"))),"*","--\x3e"),D="#PCDATA",P=a(o(/\(/,p,D,a(p,/\|/,p,A),"*",p,/\)\*/),"|",o(/\(/,p,D,p,/\)/)),B=a("EMPTY","|","ANY","|",P,"|",o(/\([^>]+\)/,/[?*+]?/)),F=o(""),j=o("NOTATION",u,/\(/,p,g,a(p,/\|/,p,g),"*",p,/\)/),_=o(/\(/,p,b,a(p,/\|/,p,b),"*",p,/\)/),U=a(j,"|",_),H=a(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",U),W=a(/#REQUIRED|#IMPLIED/,"|",a(a("#FIXED",u),"?",T)),z=o(""),q="about:legacy-compat",V=a('"'+q+'"',"|","'"+q+"'"),X="SYSTEM",G="PUBLIC",J=a(a(X,u,R),"|",a(G,u,w,u,R)),K=o("^",a(a(X,u,"(?",R,")"),"|",a(G,u,"(?",w,")",u,"(?",R,")"))),$=o("^",w,"$"),Y=o("^",R,"$"),Q=a(u,"NDATA",u,g),Z=""),et=a(v,"|",J),st=a(tt,"|",o(Z,u,"%",u,g,u,et,p,">")),it=o(G,u,w),rt=o(""),nt=o(p,"=",p),ot=/1[.]\d+/,at=o(u,"version",nt,a("'",ot,"'","|",'"',ot,'"')),lt=/[A-Za-z][-A-Za-z0-9._]*/,ct=o(/^<\?xml/,at,a(u,"encoding",nt,a('"',lt,'"',"|","'",lt,"'")),"?",a(u,"standalone",nt,a("'",a("yes","|","no"),"'","|",'"',a("yes","|","no"),'"')),"?",p,/\?>/),ht=o(l,"*?",/\]\]>/),dt=o(/",e.CDSect=dt,e.Char=l,e.Comment=O,e.COMMENT_START=k,e.COMMENT_END="--\x3e",e.DOCTYPE_DECL_START="=0&&o.warning("Unicode replacement character detected, source encoding issues?");function h(t){if(t>65535){var e=55296+((t-=65536)>>10),s=56320+(1023&t);return String.fromCharCode(e,s)}return String.fromCharCode(t)}function p(t){var e=";"===t[t.length-1]?t:t+";";if(!l&&e!==t)return o.error("EntityRef: expecting ;"),t;var i=r.Reference.exec(e);if(!i||i[0].length!==e.length)return o.error("entity not matching Reference production: "+t),t;var n=e.slice(1,-1);return c(s,n)?s[n]:"#"===n.charAt(0)?h(parseInt(n.substring(1).replace("x","0x"))):(o.error("entity not found:"+t),t)}function x(e){if(e>I){var s=t.substring(I,e).replace(m,p);L&&S(I),n.characters(s,0,e-I),I=e}}var y=0,C=0,A=/\r\n?|\n|$/g,L=n.locator;function S(e,s){for(;e>=C&&(s=A.exec(t));)y=C,C=s.index+s[0].length,L.lineNumber++;L.columnNumber=e-y+1}var R=[{currentNSMap:e}],M=[],I=0;for(;;){try{var w=t.indexOf("<",I);if(w<0){if(!l&&M.length>0)return o.fatalError("unclosed xml tag(s): "+M.join(", "));if(!t.substring(I).match(/^\s*$/)){var k=n.doc,O=k.createTextNode(t.substring(I));if(k.documentElement)return o.error("Extra content at the end of the document");k.appendChild(O),n.currentElement=O}return}if(w>I){var D=t.substring(I,w);l||0!==M.length||(D=D.replace(new RegExp(r.S_OPT.source,"g"),""))&&o.error("Unexpected content outside root element: '"+D+"'"),x(w)}switch(t.charAt(w+1)){case"/":var P=t.indexOf(">",w+2),B=t.substring(w+2,P>0?P:void 0);if(!B)return o.fatalError("end tag name missing");var F=P>0&&r.reg("^",r.QName_group,r.S_OPT,"$").exec(B);if(!F)return o.fatalError('end tag name contains invalid characters: "'+B+'"');if(!n.currentElement&&!n.doc.documentElement)return;var j=M[M.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(j!==F[1]){var _=F[1].toLowerCase();if(!l||j.toLowerCase()!==_)return o.fatalError('Opening and ending tag mismatch: "'+j+'" != "'+B+'"')}var U=R.pop();M.pop();var H=U.localNSMap;if(n.endElement(U.uri,U.localName,j),H)for(var W in H)c(H,W)&&n.endPrefixMapping(W);P++;break;case"?":L&&S(w),P=v(t,w,n,o);break;case"!":L&&S(w),P=N(t,w,n,o,l);break;default:L&&S(w);var z=new T,q=R[R.length-1].currentNSMap,V=(P=g(t,w,z,q,p,o,l),z.length);if(z.closed||(l&&i.isHTMLVoidElement(z.tagName)?z.closed=!0:M.push(z.tagName)),L&&V){for(var X=f(L,{}),G=0;GI?I=P:x(Math.max(w,I)+1)}}(t,e,s,n,this.errorHandler),n.endDocument()}};var m=/&#?\w+;?/g;function f(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function g(t,e,s,i,r,n,o){function a(t,e,i){return c(s.attributeNames,t)?n.fatalError("Attribute "+t+" redefined"):!o&&e.indexOf("<")>=0?n.fatalError("Unescaped '<' not allowed in attributes values"):void s.addValue(t,e.replace(/[\t\n\r]/g," ").replace(m,r),i)}for(var l,h=++e,d=0;;){var u=t.charAt(h);switch(u){case"=":if(1===d)l=t.slice(e,h),d=3;else{if(2!==d)throw new Error("attribute equal must after attrName");d=3}break;case"'":case'"':if(3===d||1===d){if(1===d&&(n.warning('attribute value must after "="'),l=t.slice(e,h)),e=h+1,!((h=t.indexOf(u,e))>0))throw new Error("attribute value no end '"+u+"' match");a(l,p=t.slice(e,h),e-1),d=5}else{if(4!=d)throw new Error('attribute value must after "="');a(l,p=t.slice(e,h),e),n.warning('attribute "'+l+'" missed start quot('+u+")!!"),e=h+1,d=5}break;case"/":switch(d){case 0:s.setTagName(t.slice(e,h));case 5:case 6:case 7:d=7,s.closed=!0;case 4:case 1:break;case 2:s.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),0==d&&s.setTagName(t.slice(e,h)),h;case">":switch(d){case 0:s.setTagName(t.slice(e,h));case 5:case 6:case 7:break;case 4:case 1:"/"===(p=t.slice(e,h)).slice(-1)&&(s.closed=!0,p=p.slice(0,-1));case 2:2===d&&(p=l),4==d?(n.warning('attribute "'+p+'" missed quot(")!'),a(l,p,e)):(o||n.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!'),a(p,p,e));break;case 3:if(!o)return n.fatalError("AttValue: ' or \" expected")}return h;case"\x80":u=" ";default:if(u<=" ")switch(d){case 0:s.setTagName(t.slice(e,h)),d=6;break;case 1:l=t.slice(e,h),d=2;break;case 4:var p=t.slice(e,h);n.warning('attribute "'+p+'" missed quot(")!!'),a(l,p,e);case 5:d=6}else switch(d){case 2:o||n.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=h,d=1;break;case 5:n.warning('attribute space is required"'+l+'"!!');case 6:d=1,e=h;break;case 3:d=4,e=h;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function b(t,e,s){for(var i=t.tagName,r=null,n=t.length;n--;){var o=t[n],a=o.qName,l=o.value;if((m=a.indexOf(":"))>0)var d=o.prefix=a.slice(0,m),u=a.slice(m+1),p="xmlns"===d&&u;else u=a,d=null,p="xmlns"===a&&"";o.localName=u,!1!==p&&(null==r&&(r=Object.create(null),x(s,s=Object.create(null))),s[p]=r[p]=l,o.uri=h.XMLNS,e.startPrefixMapping(p,l))}for(n=t.length;n--;)(o=t[n]).prefix&&("xml"===o.prefix&&(o.uri=h.XML),"xmlns"!==o.prefix&&(o.uri=s[o.prefix]));var m;(m=i.indexOf(":"))>0?(d=t.prefix=i.slice(0,m),u=t.localName=i.slice(m+1)):(d=null,u=t.localName=i);var f=t.uri=s[d||""];if(e.startElement(f,u,i,t),!t.closed)return t.currentNSMap=s,t.localNSMap=r,!0;if(e.endElement(f,u,i),r)for(d in r)c(r,d)&&e.endPrefixMapping(d)}function E(t,e,s,i,r){var n=o(s);if(n||l(s)){var a=t.indexOf("",e),c=t.substring(e+1,a);return n&&(c=c.replace(m,i)),r.characters(c,0,c.length),a}return e+1}function x(t,e){for(var s in t)c(t,s)&&(e[s]=t[s])}function y(t,e){var s=e;function i(e){return e=e||0,t.charAt(s+e)}function n(t){s+=t=t||1}function o(){return t.substring(s)}return{char:i,getIndex:function(){return s},getMatch:function(t){var e=r.reg("^",t).exec(o());return e?(n(e[0].length),e[0]):null},getSource:function(){return t},skip:n,skipBlanks:function(){for(var e=0;s"!==o.char()?i.fatalError("doctype not terminated with > at position "+o.getIndex()):(o.skip(1),s.startDTD(c.name,c.publicId,c.systemId,c.internalSubset),s.endDTD(),o.getIndex());default:return i.fatalError('Not well-formed XML starting with "0)return i.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!r.XMLDecl.test(t.substring(e)))return i.fatalError("xml declaration is not well-formed")}return s.processingInstruction(n[1],n[2]),e+n[0].length}function T(){this.attributeNames=Object.create(null)}T.prototype={setTagName:function(t){if(!r.QName_exact.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,s){if(!r.QName_exact.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:s}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},e.XMLReader=p,e.parseUtils=y,e.parseDoctypeCommentOrCData=N},999(t,e,s){(function(){"use strict";var e=this;function s(t){return"string"==typeof t}function i(t,e,s){return t.call.apply(t.bind,arguments)}function r(t,e,s){if(!t)throw Error();if(2e?1:0}var h,d=Array.prototype.indexOf?function(t,e,s){return Array.prototype.indexOf.call(t,e,s)}:function(t,e,i){if(i=null==i?0:0>i?Math.max(0,t.length+i):i,s(t))return s(e)&&1==e.length?t.indexOf(e,i):-1;for(;iparseFloat(L)){E=String(R);break t}}E=L}var M={};function I(t){if(!M[t]){for(var e=0,s=a(String(E)).split("."),i=a(String(t)).split("."),r=Math.max(s.length,i.length),n=0;0==e&&n",4,2,function(t,e,s){return mt(function(t,e){return t>e},t,e,s)}),bt("<=",4,2,function(t,e,s){return mt(function(t,e){return t<=e},t,e,s)}),bt(">=",4,2,function(t,e,s){return mt(function(t,e){return t>=e},t,e,s)});var Et=bt("=",3,2,function(t,e,s){return mt(function(t,e){return t==e},t,e,s,!0)});function xt(t,e,s){this.a=t,this.b=e||1,this.f=s||1}function yt(t,e){if(e.a.length&&4!=t.i)throw Error("Primary expression must evaluate to nodeset if filter has predicate(s).");ot.call(this,t.i),this.c=t,this.h=e,this.g=t.g,this.b=t.b}function Nt(t,e){if(e.lengtht.v)throw Error("Function "+t.j+" expects at most "+t.v+" arguments, "+e.length+" given");t.B&&u(e,function(e,s){if(4!=e.i)throw Error("Argument "+s+" to function "+t.j+" is not of type Nodeset: "+e)}),ot.call(this,t.i),this.h=t,this.c=e,lt(this,t.g||f(e,function(t){return t.g})),ct(this,t.D&&!e.length||t.C&&!!e.length||f(e,function(t){return t.b}))}function vt(t,e,s,i,r,n,o,a,l){this.j=t,this.i=e,this.g=s,this.D=i,this.C=r,this.m=n,this.A=o,this.v=void 0!==a?a:o,this.B=!!l}bt("!=",3,2,function(t,e,s){return mt(function(t,e){return t!=e},t,e,s,!0)}),bt("and",2,2,function(t,e,s){return ut(t,s)&&ut(e,s)}),bt("or",1,2,function(t,e,s){return ut(t,s)||ut(e,s)}),o(yt),yt.prototype.a=function(t){return t=this.c.a(t),Ht(this.h,t)},yt.prototype.toString=function(){return"Filter:"+at(this.c)+at(this.h)},o(Nt),Nt.prototype.a=function(t){return this.h.m.apply(null,function(t){return Array.prototype.concat.apply(Array.prototype,arguments)}(t,this.c))},Nt.prototype.toString=function(){var t="Function: "+this.h;if(this.c.length){var e=m(this.c,function(t,e){return t+at(e)},"Arguments:");t=t+at(e)}return t},vt.prototype.toString=function(){return this.j};var Tt={};function Ct(t,e,s,i,r,n,o,a){if(Tt.hasOwnProperty(t))throw Error("Function already created: "+t+".");Tt[t]=new vt(t,e,s,i,!1,r,n,o,a)}function At(t,e){switch(this.h=t,this.c=void 0!==e?e:null,this.b=null,t){case"comment":this.b=8;break;case"text":this.b=3;break;case"processing-instruction":this.b=7;break;case"node":break;default:throw Error("Unexpected argument")}}function Lt(t){return"comment"==t||"text"==t||"processing-instruction"==t||"node"==t}function St(t){this.b=t,this.a=0}Ct("boolean",2,!1,!1,function(t,e){return ut(e,t)},1),Ct("ceiling",1,!1,!1,function(t,e){return Math.ceil(ht(e,t))},1),Ct("concat",3,!1,!1,function(t,e){return m(function(t,e,s){return 2>=arguments.length?Array.prototype.slice.call(t,e):Array.prototype.slice.call(t,e,s)}(arguments,1),function(e,s){return e+dt(s,t)},"")},2,null),Ct("contains",2,!1,!1,function(t,e,s){return l(dt(e,t),dt(s,t))},2),Ct("count",1,!1,!1,function(t,e){return e.a(t).l},1,1,!0),Ct("false",2,!1,!1,function(){return!1},0),Ct("floor",1,!1,!1,function(t,e){return Math.floor(ht(e,t))},1),Ct("id",4,!1,!1,function(t,e){function i(t){if(O){var e=r.all[t];if(e){if(e.nodeType&&t==e.id)return e;if(e.length)return function(t,e){var i;t:{i=t.length;for(var r=s(t)?t.split(""):t,n=0;ni?null:s(t)?t.charAt(i):t[i]}(e,function(e){return t==e.id})}return null}return r.getElementById(t)}var r=9==(n=t.a).nodeType?n:n.ownerDocument,n=dt(e,t).split(/\s+/),o=[];u(n,function(t){!(t=i(t))||0<=d(o,t)||o.push(t)}),o.sort(G);var a=new $;return u(o,function(t){tt(a,t)}),a},1),Ct("lang",2,!1,!1,function(){return!1},1),Ct("last",1,!0,!1,function(t){if(1!=arguments.length)throw Error("Function last expects ()");return t.f},0),Ct("local-name",3,!1,!0,function(t,e){var s=e?et(e.a(t)):t.a;return s?s.localName||s.nodeName.toLowerCase():""},0,1,!0),Ct("name",3,!1,!0,function(t,e){var s=e?et(e.a(t)):t.a;return s?s.nodeName.toLowerCase():""},0,1,!0),Ct("namespace-uri",3,!0,!1,function(){return""},0,1,!0),Ct("normalize-space",3,!1,!0,function(t,e){return(e?dt(e,t):F(t.a)).replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},0,1),Ct("not",2,!1,!1,function(t,e){return!ut(e,t)},1),Ct("number",1,!1,!0,function(t,e){return e?ht(e,t):+F(t.a)},0,1),Ct("position",1,!0,!1,function(t){return t.b},0),Ct("round",1,!1,!1,function(t,e){return Math.round(ht(e,t))},1),Ct("starts-with",2,!1,!1,function(t,e,s){return e=dt(e,t),t=dt(s,t),0==e.lastIndexOf(t,0)},2),Ct("string",3,!1,!0,function(t,e){return e?dt(e,t):F(t.a)},0,1),Ct("string-length",1,!1,!0,function(t,e){return(e?dt(e,t):F(t.a)).length},0,1),Ct("substring",3,!1,!1,function(t,e,s,i){if(s=ht(s,t),isNaN(s)||1/0==s||-1/0==s)return"";if(i=i?ht(i,t):1/0,isNaN(i)||-1/0===i)return"";s=Math.round(s)-1;var r=Math.max(s,0);return t=dt(e,t),1/0==i?t.substring(r):t.substring(r,s+Math.round(i))},2,3),Ct("substring-after",3,!1,!1,function(t,e,s){return e=dt(e,t),t=dt(s,t),-1==(s=e.indexOf(t))?"":e.substring(s+t.length)},2),Ct("substring-before",3,!1,!1,function(t,e,s){return e=dt(e,t),t=dt(s,t),-1==(t=e.indexOf(t))?"":e.substring(0,t)},2),Ct("sum",1,!1,!1,function(t,e){for(var s=it(e.a(t)),i=0,r=nt(s);r;r=nt(s))i+=+F(r);return i},1,1,!0),Ct("translate",3,!1,!1,function(t,e,s,i){e=dt(e,t),s=dt(s,t);var r=dt(i,t);for(t={},i=0;i]=|\s+|./g,Mt=/^\s/;function It(t,e){return t.b[t.a+(e||0)]}function wt(t){return t.b[t.a++]}function kt(t){return t.b.length<=t.a}function Ot(t){ot.call(this,3),this.c=t.substring(1,t.length-1)}function Dt(t,e){var s;this.j=t.toLowerCase(),s="*"==this.j?"*":"http://www.w3.org/1999/xhtml",this.c=e?e.toLowerCase():s}function Pt(t,e){if(ot.call(this,t.i),this.h=t,this.c=e,this.g=t.g,this.b=t.b,1==this.c.length){var s=this.c[0];s.u||s.c!=Xt||"*"!=(s=s.o).f()&&(this.f={name:s.f(),s:null})}}function Bt(){ot.call(this,4)}function Ft(){ot.call(this,4)}function jt(t){return"/"==t||"//"==t}function _t(t){ot.call(this,4),this.c=t,lt(this,f(this.c,function(t){return t.g})),ct(this,f(this.c,function(t){return t.b}))}function Ut(t,e){this.a=t,this.b=!!e}function Ht(t,e,s){for(s=s||0;s(t=wt(t.a)).length)throw Error("Unclosed literal string");return new Ot(t)}function ae(t){var e,s,i=[];if(jt(It(t.a))){if(e=wt(t.a),s=It(t.a),"/"==e&&(kt(t.a)||"."!=s&&".."!=s&&"@"!=s&&"*"!=s&&!/(?![0-9])[\w]/.test(s)))return new Bt;s=new Bt,ie(t,"Missing next location step."),e=le(t,e),i.push(e)}else{t:{switch(s=(e=It(t.a)).charAt(0)){case"$":throw Error("Variable reference not allowed in HTML XPath");case"(":wt(t.a),e=se(t),ie(t,'unclosed "("'),re(t,")");break;case'"':case"'":e=oe(t);break;default:if(isNaN(+e)){if(Lt(e)||!/(?![0-9])[\w]/.test(s)||"("!=It(t.a,1)){e=null;break t}for(e=wt(t.a),e=Tt[e]||null,wt(t.a),s=[];")"!=It(t.a)&&(ie(t,"Missing function argument list."),s.push(se(t)),","==It(t.a));)wt(t.a);ie(t,"Unclosed function argument list."),ne(t),e=new Nt(e,s)}else e=new te(+wt(t.a))}"["==It(t.a)&&(e=new yt(e,s=new Ut(ce(t))))}if(e){if(!jt(It(t.a)))return e;s=e}else e=le(t,"/"),s=new Ft,i.push(e)}for(;jt(It(t.a));)e=wt(t.a),ie(t,"Missing next location step."),e=le(t,e),i.push(e);return new Pt(s,i)}function le(t,e){var s,i,r,n;if("/"!=e&&"//"!=e)throw Error('Step op should be "/" or "//"');if("."==It(t.a))return i=new Wt(Qt,new At("node")),wt(t.a),i;if(".."==It(t.a))return i=new Wt($t,new At("node")),wt(t.a),i;if("@"==It(t.a))n=Xt,wt(t.a),ie(t,"Missing attribute name");else if("::"==It(t.a,1)){if(!/(?![0-9])[\w]/.test(It(t.a).charAt(0)))throw Error("Bad token: "+wt(t.a));if(s=wt(t.a),!(n=qt[s]||null))throw Error("No axis with name: "+s);wt(t.a),ie(t,"Missing node name")}else n=Gt;if(s=It(t.a),!/(?![0-9])[\w\*]/.test(s.charAt(0)))throw Error("Bad token: "+wt(t.a));if("("==It(t.a,1)){if(!Lt(s))throw Error("Invalid node type: "+s);if(!Lt(s=wt(t.a)))throw Error("Invalid type name: "+s);re(t,"("),ie(t,"Bad nodetype");var o=null;'"'!=(r=It(t.a).charAt(0))&&"'"!=r||(o=oe(t)),ie(t,"Bad nodetype"),ne(t),s=new At(s,o)}else if(-1==(r=(s=wt(t.a)).indexOf(":")))s=new Dt(s);else{var a;if("*"==(o=s.substring(0,r)))a="*";else if(!(a=t.b(o)))throw Error("Namespace prefix not declared: "+o);s=new Dt(s=s.substr(r+1),a)}return r=new Ut(ce(t),n.a),i||new Wt(n,s,r,"//"==e)}function ce(t){for(var e=[];"["==It(t.a);){wt(t.a),ie(t,"Missing predicate expression.");var s=se(t);e.push(s),ie(t,"Unclosed predicate expression."),re(t,"]")}return e}function he(t){if("-"==It(t.a))return wt(t.a),new Zt(he(t));var e=ae(t);if("|"!=It(t.a))t=e;else{for(e=[e];"|"==wt(t.a);)ie(t,"Missing next union location path."),e.push(ae(t));t.a.a--,t=new _t(e)}return t}function de(t){switch(t.nodeType){case 1:return function(t,e){var s=Array.prototype.slice.call(arguments,1);return function(){var e=s.slice();return e.push.apply(e,arguments),t.apply(this,e)}}(pe,t);case 9:return de(t.documentElement);case 11:case 10:case 6:case 12:return ue;default:return t.parentNode?de(t.parentNode):ue}}function ue(){return null}function pe(t,e){if(t.prefix==e)return t.namespaceURI||"http://www.w3.org/1999/xhtml";var s=t.getAttributeNode("xmlns:"+e);return s&&s.specified?s.value||null:t.parentNode&&9!=t.parentNode.nodeType?pe(t.parentNode,e):null}function me(t,e){if(!t.length)throw Error("Empty XPath expression.");var s=function(t){t=t.match(Rt);for(var e=0;e=s.length?null:s[n++]},this.snapshotItem=function(t){if(6!=e&&7!=e)throw Error("snapshotItem called with wrong result type");return t>=s.length||0>t?null:s[t]}}function ge(t){this.lookupNamespaceURI=de(t)}function be(t,s){var i=t||e,r=i.Document&&i.Document.prototype||i.document;r.evaluate&&!s||(i.XPathResult=fe,r.evaluate=function(t,e,s,i){return new me(t,s).evaluate(e,i)},r.createExpression=function(t,e){return new me(t,e)},r.createNSResolver=function(t){return new ge(t)})}o(Zt),Zt.prototype.a=function(t){return-ht(this.c,t)},Zt.prototype.toString=function(){return"Unary Expression: -"+at(this.c)},o(te),te.prototype.a=function(){return this.c},te.prototype.toString=function(){return"Number: "+this.c},fe.ANY_TYPE=0,fe.NUMBER_TYPE=1,fe.STRING_TYPE=2,fe.BOOLEAN_TYPE=3,fe.UNORDERED_NODE_ITERATOR_TYPE=4,fe.ORDERED_NODE_ITERATOR_TYPE=5,fe.UNORDERED_NODE_SNAPSHOT_TYPE=6,fe.ORDERED_NODE_SNAPSHOT_TYPE=7,fe.ANY_UNORDERED_NODE_TYPE=8,fe.FIRST_ORDERED_NODE_TYPE=9;var Ee,xe=["wgxpath","install"],ye=e;xe[0]in ye||!ye.execScript||ye.execScript("var "+xe[0]);for(;xe.length&&(Ee=xe.shift());)xe.length||void 0===be?ye=ye[Ee]?ye[Ee]:ye[Ee]={}:ye[Ee]=be;t.exports.install=be,t.exports.XPathResultType={ANY_TYPE:0,NUMBER_TYPE:1,STRING_TYPE:2,BOOLEAN_TYPE:3,UNORDERED_NODE_ITERATOR_TYPE:4,ORDERED_NODE_ITERATOR_TYPE:5,UNORDERED_NODE_SNAPSHOT_TYPE:6,ORDERED_NODE_SNAPSHOT_TYPE:7,ANY_UNORDERED_NODE_TYPE:8,FIRST_ORDERED_NODE_TYPE:9}}).call(s.g)}},i={};function r(t){var e=i[t];if(void 0!==e)return e.exports;var n=i[t]={exports:{}};return s[t](n,n.exports,r),n.exports}e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,r.t=function(s,i){if(1&i&&(s=this(s)),8&i)return s;if("object"==typeof s&&s){if(4&i&&s.__esModule)return s;if(16&i&&"function"==typeof s.then)return s}var n=Object.create(null);r.r(n);var o={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&s;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(t=>o[t]=()=>s[t]);return o.default=()=>s,r.d(n,o),n},r.d=(t,e)=>{for(var s in e)r.o(e,s)&&!r.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};r.r(t),r.d(t,{GLOBAL:()=>oi,MathJax:()=>di,combineConfig:()=>li,combineDefaults:()=>ci,combineWithMathJax:()=>hi,isObject:()=>ai});var e={};r.r(e),r.d(e,{context:()=>pi,hasWindow:()=>ui});var s={};r.r(s),r.d(s,{Package:()=>fi,PackageError:()=>mi});var i={};r.r(i),r.d(i,{PrioritizedList:()=>gi});var n={};r.r(n),r.d(n,{FunctionList:()=>bi});var o={};r.r(o),r.d(o,{CONFIG:()=>Ci,Loader:()=>vi,MathJax:()=>Ti,PathFilters:()=>yi});var a={};r.r(a),r.d(a,{APPEND:()=>Si,Expandable:()=>Ii,OPTIONS:()=>Mi,REMOVE:()=>Ri,copy:()=>Di,defaultOptions:()=>Bi,expandable:()=>wi,insert:()=>Pi,isObject:()=>Li,keys:()=>Oi,lookup:()=>Hi,makeArray:()=>ki,selectOptions:()=>ji,selectOptionsFromKeys:()=>_i,separateOptions:()=>Ui,userOptions:()=>Fi});var l={};r.r(l),r.d(l,{CONFIG:()=>Vi,MathJax:()=>qi,Startup:()=>zi});var c={};r.r(c),r.d(c,{AbstractDOMAdaptor:()=>Gi});var h={};r.r(h),r.d(h,{HTMLAdaptor:()=>Ki});var d={};r.r(d),r.d(d,{browserAdaptor:()=>Yi});var u={};r.r(u),r.d(u,{AbstractFindMath:()=>Qi});var p={};r.r(p),r.d(p,{AbstractInputJax:()=>Zi});var m={};r.r(m),r.d(m,{AbstractOutputJax:()=>tr});var f={};r.r(f),r.d(f,{END:()=>er,LinkedList:()=>ir,ListItem:()=>sr});var g={};r.r(g),r.d(g,{AbstractMathList:()=>rr});var b={};r.r(b),r.d(b,{AbstractMathItem:()=>or,STATE:()=>ar,newState:()=>lr,protoItem:()=>nr});var E={};r.r(E),r.d(E,{AbstractFactory:()=>cr});var x={};r.r(x),r.d(x,{AbstractNodeFactory:()=>hr});var y={};r.r(y),r.d(y,{Attributes:()=>ur,INHERIT:()=>dr});var N={};r.r(N),r.d(N,{AbstractEmptyNode:()=>mr,AbstractNode:()=>pr});var v={};r.r(v),r.d(v,{AbstractMmlBaseNode:()=>Cr,AbstractMmlEmptyNode:()=>Ar,AbstractMmlLayoutNode:()=>Tr,AbstractMmlNode:()=>Nr,AbstractMmlTokenNode:()=>vr,MATHVARIANTS:()=>xr,TEXCLASS:()=>fr,TEXCLASSNAMES:()=>gr,TextNode:()=>Lr,XMLNode:()=>Sr,indentAttributes:()=>yr});var T={};r.r(T),r.d(T,{MmlMath:()=>Rr});var C={};r.r(C),r.d(C,{MmlMi:()=>Mr});var A={};r.r(A),r.d(A,{MmlMn:()=>Ir});var L={};r.r(L),r.d(L,{MMLSPACING:()=>Pr,MO:()=>kr,OPDEF:()=>wr,OPTABLE:()=>Br,RANGES:()=>Or,getRange:()=>Dr});var S={};r.r(S),r.d(S,{isPercent:()=>Hr,quotePattern:()=>jr,replaceUnicode:()=>zr,sortLength:()=>Fr,split:()=>Wr,toEntity:()=>qr,unicodeChars:()=>_r,unicodeString:()=>Ur});var R={};r.r(R),r.d(R,{MmlMo:()=>Vr});var M={};r.r(M),r.d(M,{MmlMtext:()=>Xr});var I={};r.r(I),r.d(I,{MmlMspace:()=>Gr});var w={};r.r(w),r.d(w,{MmlMs:()=>Jr});var k={};r.r(k),r.d(k,{MmlInferredMrow:()=>$r,MmlMrow:()=>Kr});var O={};r.r(O),r.d(O,{MmlMfrac:()=>Yr});var D={};r.r(D),r.d(D,{MmlMsqrt:()=>Qr});var P={};r.r(P),r.d(P,{MmlMroot:()=>Zr});var B={};r.r(B),r.d(B,{MmlMstyle:()=>tn});var F={};r.r(F),r.d(F,{MmlMerror:()=>en});var j={};r.r(j),r.d(j,{MmlMpadded:()=>sn});var _={};r.r(_),r.d(_,{MmlMphantom:()=>rn});var U={};r.r(U),r.d(U,{MmlMfenced:()=>nn});var H={};r.r(H),r.d(H,{MmlMenclose:()=>on});var W={};r.r(W),r.d(W,{MmlMaction:()=>an});var z={};r.r(z),r.d(z,{MmlMsub:()=>cn,MmlMsubsup:()=>ln,MmlMsup:()=>hn});var q={};r.r(q),r.d(q,{MmlMover:()=>pn,MmlMunder:()=>un,MmlMunderover:()=>dn});var V={};r.r(V),r.d(V,{MmlMmultiscripts:()=>mn,MmlMprescripts:()=>fn,MmlNone:()=>gn});var X={};r.r(X),r.d(X,{MmlMtable:()=>bn});var G={};r.r(G),r.d(G,{MmlMlabeledtr:()=>xn,MmlMtr:()=>En});var J={};r.r(J),r.d(J,{MmlMtd:()=>yn});var K={};r.r(K),r.d(K,{MmlMaligngroup:()=>Nn});var $={};r.r($),r.d($,{MmlMalignmark:()=>vn});var Y={};r.r(Y),r.d(Y,{MmlMglyph:()=>Tn});var Q={};r.r(Q),r.d(Q,{MmlAnnotation:()=>Ln,MmlAnnotationXML:()=>An,MmlSemantics:()=>Cn});var Z={};r.r(Z),r.d(Z,{TeXAtom:()=>Sn});var tt={};r.r(tt),r.d(tt,{MathChoice:()=>Rn});var et={};r.r(et),r.d(et,{HtmlNode:()=>Mn});var st={};r.r(st),r.d(st,{MML:()=>In});var it={};r.r(it),r.d(it,{MmlFactory:()=>wn});var rt={};r.r(rt),r.d(rt,{BitField:()=>kn,BitFieldClass:()=>On});var nt={};r.r(nt),r.d(nt,{handleRetriesFor:()=>Dn,retryAfter:()=>Pn});var ot={};r.r(ot),r.d(ot,{AbstractMathDocument:()=>zn,RenderList:()=>Fn,resetAllOptions:()=>_n,resetOptions:()=>jn});var at={};r.r(at),r.d(at,{AbstractHandler:()=>Vn});var lt={};r.r(lt),r.d(lt,{HandlerList:()=>Xn});var ct={};r.r(ct),r.d(ct,{AbstractVisitor:()=>Gn});var ht={};r.r(ht),r.d(ht,{DATAMJX:()=>Jn,MmlVisitor:()=>Kn});var dt={};r.r(dt),r.d(dt,{MathMLVisitor:()=>$n});var ut={};r.r(ut),r.d(ut,{SerializedMmlVisitor:()=>Yn});var pt={};r.r(pt),r.d(pt,{AbstractWrapper:()=>Qn});var mt={};r.r(mt),r.d(mt,{AbstractWrapperFactory:()=>Zn});var ft={};r.r(ft),r.d(ft,{mathjax:()=>to});var gt={};r.r(gt),r.d(gt,{HTMLMathItem:()=>eo});var bt={};r.r(bt),r.d(bt,{HTMLMathList:()=>so});var Et={};r.r(Et),r.d(Et,{HTMLDomStrings:()=>io});var xt={};r.r(xt),r.d(xt,{HTMLDocument:()=>ro});var yt={};r.r(yt),r.d(yt,{HTMLHandler:()=>no});var Nt={};r.r(Nt),r.d(Nt,{RegisterHTMLHandler:()=>oo});var vt={};r.r(vt),r.d(vt,{StyleJsonSheet:()=>ao});var Tt={};r.r(Tt),r.d(Tt,{DraggableDialog:()=>ho,isDialog:()=>co});var Ct={};r.r(Ct),r.d(Ct,{InfoDialog:()=>uo});var At={};r.r(At),r.d(At,{asyncLoad:()=>po});var Lt={};r.r(Lt),r.d(Lt,{BIGDIMEN:()=>mo,MATHSPACE:()=>bo,RELUNITS:()=>go,UNITS:()=>fo,em:()=>yo,length2em:()=>Eo,percent:()=>xo,px:()=>No});var St={};r.r(St),r.d(St,{BBox:()=>vo});var Rt={};r.r(Rt),r.d(Rt,{add:()=>Lo,entities:()=>Co,numeric:()=>Io,options:()=>To,remove:()=>So,translate:()=>Ro});var Mt={};r.r(Mt),r.d(Mt,{Styles:()=>qo,TRBL:()=>wo,WSC:()=>ko});var It={};r.r(It),r.d(It,{max:()=>Xo,sum:()=>Vo});var wt={};r.r(wt),r.d(wt,{FindTeX:()=>Go});var kt={};r.r(kt),r.d(kt,{default:()=>Ko});var Ot={};r.r(Ot),r.d(Ot,{TexConstant:()=>$o});var Dt={};r.r(Dt),r.d(Dt,{default:()=>sa});var Pt={};r.r(Pt),r.d(Pt,{ConfigurationType:()=>ia,HandlerType:()=>ra});var Bt={};r.r(Bt),r.d(Bt,{UnitUtil:()=>oa});var Ft={};r.r(Ft),r.d(Ft,{default:()=>aa});var jt={};r.r(jt),r.d(jt,{default:()=>ca});var _t={};r.r(_t),r.d(_t,{BaseItem:()=>da,MmlStack:()=>ha});var Ut={};r.r(Ut),r.d(Ut,{default:()=>ua});var Ht={};r.r(Ht),r.d(Ht,{default:()=>fa});var Wt={};r.r(Wt),r.d(Wt,{NodeFactory:()=>ga});var zt={};r.r(zt),r.d(zt,{KeyValueDef:()=>ba,KeyValueTypes:()=>Ea,ParseUtil:()=>Na});var qt={};r.r(qt),r.d(qt,{ColumnParser:()=>va});var Vt={};r.r(Vt),r.d(Vt,{default:()=>Aa});var Xt={};r.r(Xt),r.d(Xt,{AbstractTags:()=>Ra,AllTags:()=>Ia,Label:()=>La,NoTags:()=>Ma,TagInfo:()=>Sa,TagsFactory:()=>Oa});var Gt={};r.r(Gt),r.d(Gt,{Macro:()=>Pa,Token:()=>Da});var Jt={};r.r(Jt),r.d(Jt,{AbstractParseMap:()=>_a,AbstractTokenMap:()=>Fa,CharacterMap:()=>Ua,CommandMap:()=>za,DelimiterMap:()=>Ha,EnvironmentMap:()=>qa,MacroMap:()=>Wa,RegExpMap:()=>ja,parseResult:()=>Ba});var Kt={};r.r(Kt),r.d(Kt,{MapHandler:()=>Xa,SubHandler:()=>Ga,SubHandlers:()=>Ja});var $t={};r.r($t),r.d($t,{Configuration:()=>Ka,ConfigurationHandler:()=>Ya,ParserConfiguration:()=>Qa});var Yt={};r.r(Yt),r.d(Yt,{ArrayItem:()=>Nl,BeginItem:()=>dl,BreakItem:()=>hl,CellItem:()=>fl,CloseItem:()=>sl,DotsItem:()=>yl,EndItem:()=>ul,EqnArrayItem:()=>vl,EquationItem:()=>Cl,FnItem:()=>bl,LeftItem:()=>al,Middle:()=>ll,MmlItem:()=>gl,MstyleItem:()=>Tl,NonscriptItem:()=>xl,NotItem:()=>El,NullItem:()=>il,OpenItem:()=>el,OverItem:()=>ol,PositionItem:()=>ml,PrimeItem:()=>rl,RightItem:()=>cl,StartItem:()=>Za,StopItem:()=>tl,StyleItem:()=>pl,SubsupItem:()=>nl});var Qt={};r.r(Qt),r.d(Qt,{default:()=>Il,splitAlignArray:()=>Sl});var Zt={};r.r(Zt),r.d(Zt,{default:()=>Ol});var te={};r.r(te),r.d(te,{BaseConfiguration:()=>_l,BaseTags:()=>jl,Other:()=>Fl});var ee={};r.r(ee),r.d(ee,{TeX:()=>Ul});var se={};r.r(se),r.d(se,{FlalignItem:()=>Wl,MultlineItem:()=>Hl});var ie={};r.r(ie),r.d(ie,{NewcommandPriority:()=>ql,NewcommandTables:()=>zl,NewcommandUtil:()=>Vl});var re={};r.r(re),r.d(re,{AmsMethods:()=>Jl});var ne={};r.r(ne),r.d(ne,{BeginEnvItem:()=>Kl});var oe={};r.r(oe),r.d(oe,{default:()=>Yl});var ae={};r.r(ae),r.d(ae,{NewcommandConfig:()=>Ql,NewcommandConfiguration:()=>Zl});var le={};r.r(le),r.d(le,{AmsConfiguration:()=>ec,AmsTags:()=>tc});var ce={};r.r(ce),r.d(ce,{RequireConfiguration:()=>lc,RequireLoad:()=>nc,RequireMethods:()=>oc,options:()=>ac});var he={};r.r(he),r.d(he,{AutoloadConfiguration:()=>uc});var de={};r.r(de),r.d(de,{ConfigMacrosConfiguration:()=>bc});var ue={};r.r(ue),r.d(ue,{NoUndefinedConfiguration:()=>Ec});var pe={};r.r(pe),r.d(pe,{TextParser:()=>xc});var me={};r.r(me),r.d(me,{TextMacrosMethods:()=>yc});var fe={};r.r(fe),r.d(fe,{TextBaseConfiguration:()=>vc,TextMacrosConfiguration:()=>Cc});var ge={};r.r(ge),r.d(ge,{FindMathML:()=>Lc});var be={};r.r(be),r.d(be,{MathMLCompile:()=>Sc});var Ee={};r.r(Ee),r.d(Ee,{MathML:()=>Rc});var xe={};r.r(xe),r.d(xe,{DIRECTION:()=>Mc,H:()=>wc,V:()=>Ic});var ye={};r.r(ye),r.d(ye,{DIRECTION:()=>Mc,FontData:()=>Fc,HFUZZ:()=>Dc,NOSTRETCH:()=>Pc,VFUZZ:()=>Oc,mergeOptions:()=>Bc});var Ne={};r.r(Ne),r.d(Ne,{LineBBox:()=>jc});var ve={};r.r(ve),r.d(ve,{LinebreakVisitor:()=>Hc,Linebreaks:()=>Uc,NOBREAK:()=>_c});var Te={};r.r(Te),r.d(Te,{CommonOutputJax:()=>zc,FONTPATH:()=>Wc});var Ce={};r.r(Ce),r.d(Ce,{CommonWrapperFactory:()=>qc});var Ae={};r.r(Ae),r.d(Ae,{CommonWrapper:()=>Kc,SPACE:()=>Jc});var Le={};r.r(Le),r.d(Le,{ChtmlWrapper:()=>Yc,FONTSIZE:()=>$c});var Se={};r.r(Se),r.d(Se,{CommonMathMixin:()=>Qc});var Re={};r.r(Re),r.d(Re,{ChtmlMath:()=>Zc});var Me={};r.r(Me),r.d(Me,{CommonMiMixin:()=>th});var Ie={};r.r(Ie),r.d(Ie,{ChtmlMi:()=>eh});var we={};r.r(we),r.d(we,{Usage:()=>sh});var ke={};r.r(ke),r.d(ke,{AddCSS:()=>rh,ChtmlFontData:()=>ih,DIRECTION:()=>Mc,FontData:()=>Fc,HFUZZ:()=>Dc,NOSTRETCH:()=>Pc,VFUZZ:()=>Oc,mergeOptions:()=>Bc});var Oe={};r.r(Oe),r.d(Oe,{CommonMoMixin:()=>nh});var De={};r.r(De),r.d(De,{ChtmlMo:()=>oh});var Pe={};r.r(Pe),r.d(Pe,{CommonMnMixin:()=>ah});var Be={};r.r(Be),r.d(Be,{ChtmlMn:()=>lh});var Fe={};r.r(Fe),r.d(Fe,{CommonMsMixin:()=>ch});var je={};r.r(je),r.d(je,{ChtmlMs:()=>hh});var _e={};r.r(_e),r.d(_e,{CommonMtextMixin:()=>dh});var Ue={};r.r(Ue),r.d(Ue,{ChtmlMtext:()=>uh});var He={};r.r(He),r.d(He,{CommonMspaceMixin:()=>ph});var We={};r.r(We),r.d(We,{ChtmlMspace:()=>mh});var ze={};r.r(ze),r.d(ze,{CommonMpaddedMixin:()=>fh});var qe={};r.r(qe),r.d(qe,{ChtmlMpadded:()=>gh});var Ve={};r.r(Ve),r.d(Ve,{ARROWDX:()=>Eh,ARROWX:()=>bh,ARROWY:()=>xh,CommonArrow:()=>jh,CommonBorder:()=>Dh,CommonBorder2:()=>Ph,CommonDiagonalArrow:()=>Fh,CommonDiagonalStrike:()=>Bh,PADDING:()=>Nh,SOLID:()=>vh,THICKNESS:()=>yh,arrowBBox:()=>Oh,arrowBBoxHD:()=>Mh,arrowBBoxW:()=>Ih,arrowDef:()=>wh,arrowHead:()=>Rh,diagonalArrowDef:()=>kh,fullBBox:()=>Ah,fullBorder:()=>Sh,fullPadding:()=>Lh,sideIndex:()=>Th,sideNames:()=>Ch});var Xe={};r.r(Xe),r.d(Xe,{CommonMencloseMixin:()=>_h});var Ge={};r.r(Ge),r.d(Ge,{ARROWDX:()=>Eh,ARROWX:()=>bh,ARROWY:()=>xh,Arrow:()=>Vh,Border:()=>Hh,Border2:()=>Wh,CommonArrow:()=>jh,CommonBorder:()=>Dh,CommonBorder2:()=>Ph,CommonDiagonalArrow:()=>Fh,CommonDiagonalStrike:()=>Bh,DiagonalArrow:()=>qh,DiagonalStrike:()=>zh,PADDING:()=>Nh,RenderElement:()=>Uh,SOLID:()=>vh,THICKNESS:()=>yh,arrowBBox:()=>Oh,arrowBBoxHD:()=>Mh,arrowBBoxW:()=>Ih,arrowDef:()=>wh,arrowHead:()=>Rh,diagonalArrowDef:()=>kh,fullBBox:()=>Ah,fullBorder:()=>Sh,fullPadding:()=>Lh,sideIndex:()=>Th,sideNames:()=>Ch});var Je={};r.r(Je),r.d(Je,{ChtmlMenclose:()=>Jh});var Ke={};r.r(Ke),r.d(Ke,{CommonInferredMrowMixin:()=>$h,CommonMrowMixin:()=>Kh});var $e={};r.r($e),r.d($e,{ChtmlInferredMrow:()=>Qh,ChtmlMrow:()=>Yh});var Ye={};r.r(Ye),r.d(Ye,{CommonMfencedMixin:()=>Zh});var Qe={};r.r(Qe),r.d(Qe,{ChtmlMfenced:()=>td});var Ze={};r.r(Ze),r.d(Ze,{CommonMfracMixin:()=>ed});var ts={};r.r(ts),r.d(ts,{ChtmlMfrac:()=>sd});var es={};r.r(es),r.d(es,{CommonMsqrtMixin:()=>id});var ss={};r.r(ss),r.d(ss,{ChtmlMsqrt:()=>rd});var is={};r.r(is),r.d(is,{CommonMrootMixin:()=>nd});var rs={};r.r(rs),r.d(rs,{ChtmlMroot:()=>od});var ns={};r.r(ns),r.d(ns,{CommonMsubMixin:()=>ad,CommonMsubsupMixin:()=>cd,CommonMsupMixin:()=>ld});var os={};r.r(os),r.d(os,{CommonScriptbaseMixin:()=>hd});var as={};r.r(as),r.d(as,{ChtmlScriptbase:()=>dd});var ls={};r.r(ls),r.d(ls,{ChtmlMsub:()=>ud,ChtmlMsubsup:()=>md,ChtmlMsup:()=>pd});var cs={};r.r(cs),r.d(cs,{CommonMoverMixin:()=>gd,CommonMunderMixin:()=>fd,CommonMunderoverMixin:()=>bd});var hs={};r.r(hs),r.d(hs,{ChtmlMover:()=>xd,ChtmlMunder:()=>Ed,ChtmlMunderover:()=>yd});var ds={};r.r(ds),r.d(ds,{CommonMmultiscriptsMixin:()=>Td,NextScript:()=>Nd,ScriptNames:()=>vd});var us={};r.r(us),r.d(us,{ChtmlMmultiscripts:()=>Cd});var ps={};r.r(ps),r.d(ps,{BREAK_BELOW:()=>Ad,CommonMtableMixin:()=>Ld});var ms={};r.r(ms),r.d(ms,{ChtmlMtable:()=>Sd});var fs={};r.r(fs),r.d(fs,{CommonMlabeledtrMixin:()=>Md,CommonMtrMixin:()=>Rd});var gs={};r.r(gs),r.d(gs,{ChtmlMlabeledtr:()=>wd,ChtmlMtr:()=>Id});var bs={};r.r(bs),r.d(bs,{CommonMtdMixin:()=>kd});var Es={};r.r(Es),r.d(Es,{ChtmlMtd:()=>Od});var xs={};r.r(xs),r.d(xs,{CommonMactionMixin:()=>Pd,TooltipData:()=>Dd});var ys={};r.r(ys),r.d(ys,{ChtmlMaction:()=>Bd});var Ns={};r.r(Ns),r.d(Ns,{CommonMglyphMixin:()=>Fd});var vs={};r.r(vs),r.d(vs,{ChtmlMglyph:()=>jd});var Ts={};r.r(Ts),r.d(Ts,{CommonSemanticsMixin:()=>_d});var Cs={};r.r(Cs),r.d(Cs,{CommonXmlNodeMixin:()=>Ud});var As={};r.r(As),r.d(As,{ChtmlAnnotation:()=>Wd,ChtmlAnnotationXML:()=>zd,ChtmlSemantics:()=>Hd,ChtmlXmlNode:()=>qd});var Ls={};r.r(Ls),r.d(Ls,{CommonTeXAtomMixin:()=>Vd});var Ss={};r.r(Ss),r.d(Ss,{ChtmlTeXAtom:()=>Xd});var Rs={};r.r(Rs),r.d(Rs,{CommonTextNodeMixin:()=>Gd});var Ms={};r.r(Ms),r.d(Ms,{ChtmlTextNode:()=>Jd});var Is={};r.r(Is),r.d(Is,{ChtmlHtmlNode:()=>Kd});var ws={};r.r(ws),r.d(ws,{ChtmlWrappers:()=>$d});var ks={};r.r(ks),r.d(ks,{ChtmlWrapperFactory:()=>Yd});var Os={};r.r(Os),r.d(Os,{DefaultFont:()=>iu,fontName:()=>su});var Ds={};r.r(Ds),r.d(Ds,{CHTML:()=>ru});var Ps={};r.r(Ps),r.d(Ps,{AddFontIds:()=>nu});var Bs={};r.r(Bs),r.d(Bs,{MJContextMenu:()=>rp});var Fs={};r.r(Fs),r.d(Fs,{addPreference:()=>_b,engineSetup:()=>Bb,fromPreference:()=>Ub,locales:()=>Db,parseDOM:()=>jb,setupEngine:()=>Pb,toEnriched:()=>Fb,toPreference:()=>Hb});var js={};r.r(js),r.d(js,{clearspeakMenu:()=>$b,localeMenu:()=>Qb});var _s={};r.r(_s),r.d(_s,{copyToClipboard:()=>tE,isMac:()=>Zb});var Us={};r.r(Us),r.d(Us,{annotation:()=>rE,copyAnnotations:()=>sE,showAnnotations:()=>eE});var Hs={};r.r(Hs),r.d(Hs,{RadioCompare:()=>aE});var Ws={};r.r(Ws),r.d(Ws,{MmlVisitor:()=>lE});var zs={};r.r(zs),r.d(zs,{Menu:()=>dE});var qs={};r.r(qs),r.d(qs,{MenuHandler:()=>mE,MenuMathDocumentMixin:()=>pE,MenuMathItemMixin:()=>uE});var Vs={};r.r(Vs),r.d(Vs,{EnrichHandler:()=>EE,EnrichedMathDocumentMixin:()=>bE,EnrichedMathItemMixin:()=>gE,enrichVisitor:()=>fE});var Xs={};r.r(Xs),r.d(Xs,{InPlace:()=>ME,SemAttr:()=>IE,buildLabel:()=>LE,buildSpeech:()=>SE,honk:()=>RE,ssmlParsing:()=>yE});var Gs={};r.r(Gs),r.d(Gs,{GeneratorPool:()=>wE});var Js={};r.r(Js),r.d(Js,{WorkerHandler:()=>DE});var Ks={};r.r(Ks),r.d(Ks,{SpeechHandler:()=>UE,SpeechMathDocumentMixin:()=>_E,SpeechMathItemMixin:()=>jE});var $s={};r.r($s),r.d($s,{AbstractRegion:()=>HE,DummyRegion:()=>WE,HoverRegion:()=>GE,LiveRegion:()=>VE,SpeechRegion:()=>XE,StringRegion:()=>zE,ToolTip:()=>qE});var Ys={};r.r(Ys),r.d(Ys,{AbstractExplorer:()=>JE});var Qs={};r.r(Qs),r.d(Qs,{SpeechExplorer:()=>ex,hasModifiers:()=>tx,isContainer:()=>ZE});var Zs={};r.r(Zs),r.d(Zs,{AbstractMouseExplorer:()=>ix,ContentHoverer:()=>ox,FlameHoverer:()=>ax,Hoverer:()=>rx,ValueHoverer:()=>nx});var ti={};r.r(ti),r.d(ti,{AbstractTreeExplorer:()=>lx,ContrastPicker:()=>dx,FlameColorer:()=>cx,TreeColorer:()=>hx});var ei={};r.r(ei),r.d(ei,{ATTR:()=>mx,getHighlighter:()=>Ex});var si={};r.r(si),r.d(si,{ExplorerPool:()=>vx,RegionPool:()=>yx});var ii={};r.r(ii),r.d(ii,{ExplorerHandler:()=>Lx,ExplorerMathDocumentMixin:()=>Ax,ExplorerMathItemMixin:()=>Cx,setA11yOption:()=>Rx,setA11yOptions:()=>Sx});const ri="4.1.2",ni={},oi="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof globalThis?globalThis:ni;function ai(t){return"object"==typeof t&&null!==t}function li(t,e,s=!1){var i;for(const r of Object.keys(e))"__esModule"!==r&&t[r]!==e[r]&&null!==e[r]&&void 0!==e[r]&&(ai(t[r])&&ai(e[r])?li(t[r],e[r],s||"_"===r):s&&(null===(i=Object.getOwnPropertyDescriptor(t,r))||void 0===i?void 0:i.get)||(t[r]=e[r]));return t}function ci(t,e,s){t[e]||(t[e]={}),t=t[e];for(const e of Object.keys(s))ai(t[e])&&ai(s[e])?ci(t,e,s[e]):null==t[e]&&null!=s[e]&&(t[e]=s[e]);return t}function hi(t){return li(di,t)}void 0!==oi.MathJax&&oi.MathJax.constructor==={}.constructor||(oi.MathJax={}),oi.MathJax.version||(oi.MathJax={version:ri,_:{},config:oi.MathJax});const di=oi.MathJax;!Object.hasOwn&&di.config.startup.polyfillHasOwn&&(Object.hasOwn=function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)});const ui="undefined"!=typeof window,pi={window:ui?window:null,document:ui?window.document:null,os:(()=>{if(ui&&window.navigator){const t=window.navigator.appVersion,e=[["Win","Windows"],["Mac","MacOS"],["X11","Unix"],["Linux","Unix"]];for(const[s,i]of e)if(t.includes(s))return i;if(window.navigator.userAgent.includes("Android"))return"Unix"}else if("undefined"!=typeof process)return{linux:"Unix",android:"Unix",aix:"Unix",freebsd:"Unix",netbsd:"Unix",openbsd:"Unix",sunos:"Unix",darwin:"MacOS",win32:"Windows",cygwin:"Windows"}[process.platform]||process.platform;return"unknown"})(),path:t=>t};"Windows"===pi.os&&(pi.path=t=>t.match(/^[/\\]?[a-zA-Z]:[/\\]/)?"file://"+t.replace(/\\/g,"/").replace(/^\//,""):t.replace(/^\//,"file:///"));class mi extends Error{constructor(t,e){super(t),this.package=e}}class fi{get canLoad(){return 0===this.dependencyCount&&!this.noLoad&&!this.isLoading&&!this.hasFailed}static loadPromise(t){const e=Ci[t]||{},s=e.extraLoads?vi.load(...e.extraLoads):Promise.resolve(),i=e.checkReady||(()=>Promise.resolve());return s.then(()=>i())}static resolvePath(t,e=!0){const s={name:t,original:t,addExtension:e};return vi.pathFilters.execute(s),s.name}static loadAll(){for(const t of this.packages.values())t.canLoad&&t.load()}constructor(t,e=!1){this.isLoaded=!1,this.result={},this.isLoading=!1,this.hasFailed=!1,this.dependents=[],this.dependencies=[],this.dependencyCount=0,this.provided=[],this.name=t,this.noLoad=e,fi.packages.set(t,this),this.promise=this.makePromise(this.makeDependencies())}makeDependencies(){const t=[],e=fi.packages,s=this.noLoad,i=this.name,r=[];Object.hasOwn(Ci.dependencies,i)?r.push(...Ci.dependencies[i]):"core"!==i&&r.push("core");for(const i of r){const r=e.get(i)||new fi(i,s);this.dependencies.includes(r)||(r.addDependent(this,s),this.dependencies.push(r),r.isLoaded||(this.dependencyCount++,t.push(r.promise)))}return t}makePromise(t){let e=new Promise((t,e)=>{this.resolve=t,this.reject=e});const s=Ci[this.name]||{};return s.ready&&(e=e.then(t=>s.ready(this.name))),t.length&&(t.push(e),e=Promise.all(t).then(t=>t.join(", "))),s.failed&&e.catch(t=>s.failed(new mi(t,this.name))),e}load(){if(!this.isLoaded&&!this.isLoading&&!this.noLoad){this.isLoading=!0;const t=fi.resolvePath(this.name);Ci.require?this.loadCustom(t):this.loadScript(t)}}loadCustom(t){try{const e=Ci.require(t);e instanceof Promise?e.then(t=>this.result=t).then(()=>this.checkLoad()).catch(e=>this.failed("Can't load \""+t+'"\n'+e.message.trim())):(this.result=e,this.checkLoad())}catch(t){this.failed(t.message)}}loadScript(t){const e=pi.document.createElement("script");e.src=t,e.charset="UTF-8",e.onload=t=>this.checkLoad(),e.onerror=e=>this.failed("Can't load \""+t+'"'),pi.document.head.appendChild(e)}loaded(){this.isLoaded=!0,this.isLoading=!1;for(const t of this.dependents)t.requirementSatisfied();for(const t of this.provided)t.loaded();this.resolve(this.name)}failed(t){this.hasFailed=!0,this.isLoading=!1,this.reject(new mi(t,this.name))}checkLoad(){fi.loadPromise(this.name).then(()=>this.loaded()).catch(t=>this.failed(t))}requirementSatisfied(){this.dependencyCount&&(this.dependencyCount--,this.canLoad&&this.load())}provides(t=[]){for(const e of t){let t=fi.packages.get(e);t||(Ci.dependencies[e]||(Ci.dependencies[e]=[]),Ci.dependencies[e].push(e),t=new fi(e,!0),t.isLoading=!0),this.provided.push(t)}}addDependent(t,e){this.dependents.push(t),e||this.checkNoLoad()}checkNoLoad(){if(this.noLoad){this.noLoad=!1;for(const t of this.dependencies)t.checkNoLoad()}}}fi.packages=new Map;class gi{constructor(){this.items=[],this.items=[]}[Symbol.iterator](){let t=0;const e=this.items;return{next:()=>({value:e[t++],done:t>e.length})}}add(t,e=gi.DEFAULTPRIORITY){let s=this.items.length;do{s--}while(s>=0&&e=0&&this.items[e].item!==t);return e>=0&&this.items.splice(e,1),this}}gi.DEFAULTPRIORITY=5;class bi extends gi{constructor(t=null){super(),t&&this.addList(t)}addList(t){for(const e of t)Array.isArray(e)?this.add(e[0],e[1]):this.add(e)}execute(...t){for(const e of this){if(!1===e.item(...t))return!1}return!0}asyncExecute(...t){let e=-1;const s=this.items;return new Promise((i,r)=>{!function n(){for(;++er(t));if(!1===o)return void i(!1)}i(!0)}()})}}const Ei=di.config||{};var xi=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const yi={source:t=>(Object.hasOwn(Ci.source,t.name)&&(t.name=Ci.source[t.name]),!0),normalize:t=>{const e=t.name;return e.match(/^(?:[a-z]+:\/)?\/|[a-z]:[/\\]|\[/i)||(t.name="[mathjax]/"+e.replace(/^\.\//,"")),!0},prefix:t=>{let e;for(;(e=t.name.match(/^\[([^\]]*)\]/))&&Object.hasOwn(Ci.paths,e[1]);)t.name=Ci.paths[e[1]]+t.name.substring(e[0].length);return!0},addExtension:t=>(t.addExtension&&!t.name.match(/\.[^/]+$/)&&(t.name+=".js"),!0)},Ni=di.version,vi={versions:new Map,nestedLoads:[],ready(...t){0===t.length&&(t=Array.from(fi.packages.keys()));const e=[];for(const s of t){const t=fi.packages.get(s)||new fi(s,!0);e.push(t.promise)}return Promise.all(e)},load(...t){if(0===t.length)return Promise.resolve([]);let e=[];this.nestedLoads.unshift(e);const s=Promise.resolve().then(()=>xi(this,void 0,void 0,function*(){const s=[];for(const e of t){let t=fi.packages.get(e);t||(t=new fi(e),t.provides(Ci.provides[e])),t.checkNoLoad(),s.push(t.promise.then(()=>(Ci.versionWarnings&&t.isLoaded&&!vi.versions.has(fi.resolvePath(e))&&console.warn(`No version information available for component ${e}`),t.result)))}fi.loadAll();const i=yield Promise.all(s);for(;e.length;){const t=Promise.all(e);e=this.nestedLoads[this.nestedLoads.indexOf(e)]=[],yield t}return this.nestedLoads.splice(this.nestedLoads.indexOf(e),1),i}));return this.nestedLoads.slice(1).forEach(t=>t.push(s)),s},preLoaded(...t){for(const e of t){let t=fi.packages.get(e);t||(t=new fi(e,!0),t.provides(Ci.provides[e])),t.loaded()}},addPackageData(t,e){let s=Ci[t];s||(s=Ci[t]={});for(const[t,i]of Object.entries(e))if(Array.isArray(i)){s[t]||(s[t]=[]);const e=new Set([...s[t],...i]);s[t]=[...e]}else s[t]=i},defaultReady(){void 0!==Ti.startup&&Ti.config.startup.ready()},getRoot(){if(pi.document){const t=pi.document.currentScript||pi.document.getElementById("MathJax-script");if(t&&t instanceof HTMLScriptElement)return t.src.replace(/\/[^/]*$/,"")}return Ei?.loader?.paths?.mathjax||Ei?.__dirname||"/"},checkVersion(t,e,s){return this.saveVersion(t),!(!Ci.versionWarnings||e===Ni)&&(console.warn(`Component ${t} uses ${e} of MathJax; version in use is ${Ni}`),!0)},saveVersion(t){vi.versions.set(fi.resolvePath(t),Ni)},pathFilters:new bi};vi.pathFilters.add(yi.source,0),vi.pathFilters.add(yi.normalize,10),vi.pathFilters.add(yi.prefix,20),vi.pathFilters.add(yi.addExtension,30);const Ti=di;if(void 0===Ti.loader){ci(Ti.config,"loader",{paths:{mathjax:vi.getRoot(),fonts:pi.window?"https://cdn.jsdelivr.net/npm/@mathjax":"@mathjax"},source:{},dependencies:{},provides:{},load:[],ready:vi.defaultReady.bind(vi),failed:t=>console.log(`MathJax(${t.package||"?"}): ${t.message}`),require:null,pathFilters:[],versionWarnings:!0}),hi({loader:vi});for(const t of Ti.config.loader.pathFilters)Array.isArray(t)?vi.pathFilters.add(t[0],t[1]):vi.pathFilters.add(t)}const Ci=Ti.config.loader,Ai={}.constructor;function Li(t){return"object"==typeof t&&null!==t&&(t.constructor===Ai||t.constructor===Ii)}const Si="[+]",Ri="[-]",Mi={invalidOption:"warn",optionError:(t,e)=>{if("fatal"===Mi.invalidOption)throw new Error(t);console.warn("MathJax: "+t)}};class Ii{}function wi(t){return Object.assign(Object.create(Ii.prototype),t)}function ki(t){return Array.isArray(t)?t:[t]}function Oi(t){return t?Object.keys(t).concat(Object.getOwnPropertySymbols(t)):[]}function Di(t){const e={};for(const s of Oi(t)){const i=Object.getOwnPropertyDescriptor(t,s),r=i.value;Array.isArray(r)?i.value=Pi([],r,!1):Li(r)&&(i.value=Di(r)),i.enumerable&&(e[s]=i)}return Object.defineProperties(t.constructor===Ii?wi({}):{},e)}function Pi(t,e,s=!0){for(let i of Oi(e)){if(s&&void 0===t[i]&&t.constructor!==Ii){"symbol"==typeof i&&(i=i.toString()),Mi.optionError(`Invalid option "${i}" (no default value).`,i);continue}const r=e[i];let n=t[i];if(!Li(r)||null===n||"object"!=typeof n&&"function"!=typeof n)Array.isArray(r)?(t[i]=[],Pi(t[i],r,!1)):Li(r)?t[i]=Di(r):t[i]=r;else{const e=Oi(r);Array.isArray(n)&&(1===e.length&&(e[0]===Si||e[0]===Ri)&&Array.isArray(r[e[0]])||2===e.length&&e.sort().join(",")===Si+","+Ri&&Array.isArray(r[Si])&&Array.isArray(r[Ri]))?(r[Ri]&&(n=t[i]=n.filter(t=>r[Ri].indexOf(t)<0)),r[Si]&&(t[i]=[...n,...r[Si]])):Pi(n,r,s)}}return t}function Bi(t,...e){return e.forEach(e=>Pi(t,e,!1)),t}function Fi(t,...e){return e.forEach(e=>Pi(t,e,!0)),t}function ji(t,...e){const s={};for(const i of e)Object.hasOwn(t,i)&&(s[i]=t[i]);return s}function _i(t,e){return ji(t,...Object.keys(e))}function Ui(t,...e){const s=[];for(const i of e){const e={},r={};for(const s of Object.keys(t||{}))(void 0===i[s]?r:e)[s]=t[s];s.push(e),t=r}return s.unshift(t),s}function Hi(t,e,s=null){return Object.hasOwn(e,t)?e[t]:s}var Wi=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};class zi{static toMML(t){return zi.visitor.visitTree(t,this.document)}static registerConstructor(t,e){zi.constructors[t]=e}static useHandler(t,e=!1){Vi.handler&&!e||(Vi.handler=t)}static useAdaptor(t,e=!1){Vi.adaptor&&!e||(Vi.adaptor=t)}static useInput(t,e=!1){Xi&&!e||Vi.input.push(t)}static useOutput(t,e=!1){Vi.output&&!e||(Vi.output=t)}static extendHandler(t,e=10){zi.extensions.add(t,e)}static defaultReady(){zi.getComponents(),zi.makeMethods(),zi.pagePromise.then(()=>Vi.pageReady()).then(()=>zi.promiseResolve()).catch(t=>zi.promiseReject(t))}static defaultPageReady(){return(Vi.loadAllFontFiles&&zi.output.font?zi.output.font.loadDynamicFiles():Promise.resolve()).then(()=>{var t;return null===(t=zi.document.menu)||void 0===t?void 0:t.loadingPromise}).then(Vi.typeset&&qi.typesetPromise?()=>zi.typesetPromise(Vi.elements):Promise.resolve()).then(()=>zi.promiseResolve())}static typesetPromise(t){return this.hasTypeset=!0,zi.document.whenReady(()=>Wi(this,void 0,void 0,function*(){zi.document.options.elements=t,zi.document.reset(),yield zi.document.renderPromise()}))}static getComponents(){zi.visitor=new qi._.core.MmlTree.SerializedMmlVisitor.SerializedMmlVisitor,zi.mathjax=qi._.mathjax.mathjax,zi.input=zi.getInputJax(),zi.output=zi.getOutputJax(),zi.adaptor=zi.getAdaptor(),zi.handler&&zi.mathjax.handlers.unregister(zi.handler),zi.handler=zi.getHandler(),zi.handler&&(zi.mathjax.handlers.register(zi.handler),zi.document=zi.getDocument())}static makeMethods(){zi.input&&zi.output&&zi.makeTypesetMethods();const t=zi.output?zi.output.name.toLowerCase():"";for(const e of zi.input){const s=e.name.toLowerCase();zi.makeMmlMethods(s,e),zi.makeResetMethod(s,e),zi.output&&zi.makeOutputMethods(s,t,e)}qi.done=()=>zi.document.done(),qi.whenReady=t=>zi.document.whenReady(t)}static makeTypesetMethods(){qi.typeset=(t=null)=>{this.hasTypeset=!0,zi.document.options.elements=t,zi.document.reset(),zi.document.render()},qi.typesetPromise=(t=null)=>zi.typesetPromise(t),qi.typesetClear=(t=null)=>{t?zi.document.clearMathItemsWithin(t):zi.document.clear()}}static makeOutputMethods(t,e,s){const i=t+"2"+e;qi[i]=(t,e={})=>(e=Object.assign(Object.assign({},e),{format:s.name}),zi.document.convert(t,e)),qi[i+"Promise"]=(t,e={})=>(e=Object.assign(Object.assign({},e),{format:s.name}),zi.document.convertPromise(t,e)),qi[e+"Stylesheet"]=()=>zi.output.styleSheet(zi.document),"getMetricsFor"in zi.output&&(qi.getMetricsFor=(t,e)=>zi.output.getMetricsFor(t,e))}static makeMmlMethods(t,e){const s=qi._.core.MathItem.STATE;qi[t+"2mml"]=(t,i={})=>(i=Object.assign(Object.assign({},i),{end:s.CONVERT,format:e.name}),zi.toMML(zi.document.convert(t,i))),qi[t+"2mmlPromise"]=(t,...i)=>Wi(this,[t,...i],void 0,function*(t,i={}){i=Object.assign(Object.assign({},i),{end:s.CONVERT,format:e.name});const r=yield zi.document.convertPromise(t,i);return zi.toMML(r)})}static makeResetMethod(t,e){qi[t+"Reset"]=(...t)=>e.reset(...t)}static getInputJax(){const t=[];for(const e of Vi.input){const s=zi.constructors[e];if(!s)throw Error('Input Jax "'+e+'" is not defined (has it been loaded?)');t[e]=new s(qi.config[e]),t.push(t[e])}return t}static getOutputJax(){const t=Vi.output;if(!t)return null;const e=zi.constructors[t];if(!e)throw Error('Output Jax "'+t+'" is not defined (has it been loaded?)');return new e(qi.config[t])}static getAdaptor(){const t=Vi.adaptor;if(!t||"none"===t)return null;const e=zi.constructors[t];if(!e)throw Error('DOMAdaptor "'+t+'" is not defined (has it been loaded?)');return e(qi.config[t])}static getHandler(){const t=Vi.handler;if(!t||"none"===t||!zi.adaptor)return null;const e=zi.constructors[t];if(!e)throw Error('Handler "'+t+'" is not defined (has it been loaded?)');let s=new e(zi.adaptor,5);for(const t of zi.extensions)s=t.item(s);return s}static getDocument(t=null){return zi.mathjax.document(t||Vi.document,Object.assign(Object.assign({},qi.config.options),{InputJax:zi.input,OutputJax:zi.output}))}}zi.extensions=new gi,zi.constructors={},zi.input=[],zi.output=null,zi.handler=null,zi.adaptor=null,zi.elements=null,zi.document=null,zi.promise=new Promise((t,e)=>{zi.promiseResolve=t,zi.promiseReject=e}),zi.pagePromise=new Promise((t,e)=>{const s=oi.document;if(s&&s.readyState&&"complete"!==s.readyState&&"interactive"!==s.readyState){const e=()=>t();s.defaultView.addEventListener("load",e,!0),s.defaultView.addEventListener("DOMContentLoaded",e,!0)}else t()}),zi.hasTypeset=!1,zi.defaultOptionError=Mi.optionError;const qi=di;void 0===qi._.startup&&(ci(qi.config,"startup",{input:[],output:"",handler:null,adaptor:null,document:pi.document||"",elements:null,typeset:!0,ready:zi.defaultReady.bind(zi),pageReady:zi.defaultPageReady.bind(zi),polyfillHasOwn:!0}),hi({startup:zi,options:{}}),qi.config.startup.invalidOption&&(Mi.invalidOption=qi.config.startup.invalidOption),qi.config.startup.optionError&&(Mi.optionError=qi.config.startup.optionError));const Vi=qi.config.startup,Xi=0!==Vi.input.length;MathJax.loader&&MathJax.loader.checkVersion("startup",ri,"startup"),hi({_:{components:{loader:o,package:s,startup:l}}});vi.preLoaded("loader","startup"),ci(MathJax.config.loader,"dependencies",{"a11y/semantic-enrich":["input/mml","a11y/sre"],"a11y/speech":["a11y/semantic-enrich"],"a11y/complexity":["a11y/semantic-enrich"],"a11y/explorer":["a11y/speech"],"[mml]/mml3":["input/mml"],"[tex]/action":["input/tex-base"],"[tex]/ams":["input/tex-base","[tex]/newcommand"],"[tex]/amscd":["input/tex-base"],"[tex]/autoload":["input/tex-base","[tex]/require"],"[tex]/bbm":["input/tex-base"],"[tex]/bboldx":["input/tex-base","[tex]/textmacros"],"[tex]/bbox":["input/tex-base"],"[tex]/begingroup":["input/tex-base","[tex]/newcommand"],"[tex]/boldsymbol":["input/tex-base"],"[tex]/braket":["input/tex-base"],"[tex]/bussproofs":["input/tex-base"],"[tex]/cancel":["input/tex-base","[tex]/enclose"],"[tex]/cases":["[tex]/empheq"],"[tex]/centernot":["input/tex-base"],"[tex]/color":["input/tex-base"],"[tex]/colortbl":["input/tex-base","[tex]/color"],"[tex]/colorv2":["input/tex-base"],"[tex]/configmacros":["input/tex-base","[tex]/newcommand"],"[tex]/dsfont":["input/tex-base"],"[tex]/empheq":["input/tex-base","[tex]/ams"],"[tex]/enclose":["input/tex-base"],"[tex]/extpfeil":["input/tex-base","[tex]/newcommand","[tex]/ams"],"[tex]/gensymb":["input/tex-base"],"[tex]/html":["input/tex-base"],"[tex]/mathtools":["input/tex-base","[tex]/newcommand","[tex]/ams","[tex]/boldsymbol"],"[tex]/mhchem":["input/tex-base","[tex]/ams"],"[tex]/newcommand":["input/tex-base"],"[tex]/noerrors":["input/tex-base"],"[tex]/noundefined":["input/tex-base"],"[tex]/physics":["input/tex-base"],"[tex]/require":["input/tex-base"],"[tex]/setoptions":["input/tex-base"],"[tex]/tagformat":["input/tex-base"],"[tex]/texhtml":["input/tex-base"],"[tex]/textcomp":["input/tex-base","[tex]/textmacros"],"[tex]/textmacros":["input/tex-base"],"[tex]/unicode":["input/tex-base"],"[tex]/units":["input/tex-base"],"[tex]/upgreek":["input/tex-base"],"[tex]/verb":["input/tex-base"],"ui/menu":["a11y/sre"]}),ci(MathJax.config.loader,"paths",{tex:"[mathjax]/input/tex/extensions",mml:"[mathjax]/input/mml/extensions",sre:"[mathjax]/sre",mathmaps:"[sre]/mathmaps"}),ci(MathJax.config.loader,"provides",{startup:["loader"],"input/tex":["input/tex-base","[tex]/ams","[tex]/newcommand","[tex]/textmacros","[tex]/noundefined","[tex]/require","[tex]/autoload","[tex]/configmacros"]}),ci(MathJax.config.loader,"source",{"[tex]/amsCd":"[tex]/amscd","[tex]/colorV2":"[tex]/colorv2","[tex]/configMacros":"[tex]/configmacros","[tex]/tagFormat":"[tex]/tagformat"});class Gi{constructor(t=null){this.canMeasureNodes=!0,this.document=t}node(t,e={},s=[],i){const r=this.create(t,i);this.setAttributes(r,e);for(const t of s)this.append(r,t);return r}setProperty(t,e,s){t[e]=s}getProperty(t,e){return t[e]}setAttributes(t,e){if(e.style&&"string"!=typeof e.style)for(const s of Object.keys(e.style))this.setStyle(t,s.replace(/-([a-z])/g,(t,e)=>e.toUpperCase()),e.style[s]);if(e.properties)for(const s of Object.keys(e.properties))t[s]=e.properties[s];for(const s of Object.keys(e))"style"===s&&"string"!=typeof e.style||"properties"===s||this.setAttribute(t,s,e[s])}replace(t,e){return this.insert(t,e),this.remove(e),e}childNode(t,e){return this.childNodes(t)[e]}allClasses(t){const e=this.getAttribute(t,"class");return e?e.replace(/ +/g," ").replace(/^ /,"").replace(/ $/,"").split(/ /):[]}cssText(t){return"style"===this.kind(t)?this.textContent(t):""}}var Ji=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};class Ki extends Gi{constructor(t){super(t.document),this.canMeasureNodes=!0,this.window=t,this.parser=new t.DOMParser}parse(t,e="text/html"){return this.parser.parseFromString(t,e)}create(t,e){return e?this.document.createElementNS(e,t):this.document.createElement(t)}text(t){return this.document.createTextNode(t)}head(t=this.document){return t.head||t}body(t=this.document){return t.body||t}root(t=this.document){return t.documentElement||t}doctype(t=this.document){return t.doctype?``:""}tags(t,e,s=null){const i=s?t.getElementsByTagNameNS(s,e):t.getElementsByTagName(e);return Array.from(i)}getElements(t,e){let s=[];for(const e of t)"string"==typeof e?s=s.concat(Array.from(this.document.querySelectorAll(e))):Array.isArray(e)||e instanceof this.window.NodeList||e instanceof this.window.HTMLCollection?s=s.concat(Array.from(e)):s.push(e);return s}getElement(t,e=this.document){return e.querySelector(t)}contains(t,e){return t.contains(e)}parent(t){return t.parentNode}append(t,e){return t.appendChild(e)}insert(t,e){return this.parent(e).insertBefore(t,e)}remove(t){return this.parent(t).removeChild(t)}replace(t,e){return this.parent(e).replaceChild(t,e)}clone(t,e=!0){return t.cloneNode(e)}split(t,e){return t.splitText(e)}next(t){return t.nextSibling}previous(t){return t.previousSibling}firstChild(t){return t.firstChild}lastChild(t){return t.lastChild}childNodes(t){return Array.from(t.childNodes)}childNode(t,e){return t.childNodes[e]}kind(t){const e=t.nodeType;return 1===e||3===e||8===e?t.nodeName.toLowerCase():""}value(t){return t.nodeValue||""}textContent(t){return t.textContent}innerHTML(t){return t.innerHTML}outerHTML(t){return t.outerHTML}serializeXML(t){return(new this.window.XMLSerializer).serializeToString(t)}setAttribute(t,e,s,i=null){return i?(e=i.replace(/.*\//,"")+":"+e.replace(/^.*:/,""),t.setAttributeNS(i,e,s)):("style"===e&&(s=s.replace(/\n/g," ")),t.setAttribute(e,s))}getAttribute(t,e){return t.getAttribute(e)}removeAttribute(t,e){return t.removeAttribute(e)}hasAttribute(t,e){return t.hasAttribute(e)}allAttributes(t){return Array.from(t.attributes).map(t=>({name:t.name,value:t.value}))}addClass(t,e){t.classList?t.classList.add(e):t.className=(t.className+" "+e).trim()}removeClass(t,e){t.classList?t.classList.remove(e):t.className=t.className.split(/ /).filter(t=>t!==e).join(" ")}hasClass(t,e){return t.classList?t.classList.contains(e):t.className.split(/ /).includes(e)}setStyle(t,e,s){t.style[e]=String(s).replace(/\n/g," ")}getStyle(t,e){return t.style[e]}allStyles(t){return t.style.cssText}insertRules(t,e){for(const s of e)try{t.sheet.insertRule(s,t.sheet.cssRules.length)}catch(t){console.warn(`MathJax: can't insert css rule '${s}': ${t.message}`)}}cssText(t){return"style"!==this.kind(t)?"":Array.from(t.sheet.cssRules).map(t=>t.cssText).join("\n")}fontSize(t){const e=this.window.getComputedStyle(t);return parseFloat(e.fontSize||String(this.constructor.DEFAULT_FONT_SIZE))}fontFamily(t){return this.window.getComputedStyle(t).fontFamily||""}nodeSize(t,e=1,s=!1){if(s&&t.getBBox){const{width:s,height:i}=t.getBBox();return[s/e,i/e]}return[t.offsetWidth/e,t.offsetHeight/e]}nodeBBox(t){const{left:e,right:s,top:i,bottom:r}=t.getBoundingClientRect();return{left:e,right:s,top:i,bottom:r}}createWorker(t,e){return Ji(this,void 0,void 0,function*(){const{path:s,maps:i,worker:r}=e,n=`${s}/${r}`,o=`\n self.maps = '${$i(i)}';\n importScripts('${$i(n)}');\n `,a=URL.createObjectURL(new Blob([o],{type:"text/javascript"})),l=new Worker(a);return l.onmessage=t,URL.revokeObjectURL(a),l})}}function $i(t){return[...t].map(t=>("\\"===t||"'"===t?t="\\"+t:(t<" "||t>"~")&&(t=`\\u{${t.codePointAt(0).toString(16)}}`),t)).join("")}function Yi(){return new Ki(window)}Ki.DEFAULT_FONT_SIZE=16;class Qi{constructor(t){const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t)}}Qi.OPTIONS={};class Zi{constructor(t={}){this.adaptor=null,this.mmlFactory=null;const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t),this.preFilters=new bi(this.options.preFilters),this.postFilters=new bi(this.options.postFilters)}get name(){return this.constructor.NAME}setAdaptor(t){this.adaptor=t}setMmlFactory(t){this.mmlFactory=t}initialize(){}reset(...t){}get processStrings(){return!0}findMath(t,e){return[]}executeFilters(t,e,s,i){const r={math:e,document:s,data:i};return t.execute(r),r.data}}Zi.NAME="generic",Zi.OPTIONS={preFilters:[],postFilters:[]};class tr{constructor(t={}){this.adaptor=null;const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t),this.preFilters=new bi(this.options.preFilters),this.postFilters=new bi(this.options.postFilters)}get name(){return this.constructor.NAME}setAdaptor(t){this.adaptor=t}initialize(){}reset(...t){}getMetrics(t){}styleSheet(t){return null}pageElements(t){return null}executeFilters(t,e,s,i){const r={math:e,document:s,data:i};return t.execute(r),r.data}}tr.NAME="generic",tr.OPTIONS={preFilters:[],postFilters:[]};const er=Symbol();class sr{constructor(t=null){this.next=null,this.prev=null,this.data=t}}class ir{constructor(...t){this.list=new sr(er),this.list.next=this.list.prev=this.list,this.push(...t)}isBefore(t,e){return t1;){const s=e.shift(),i=e.shift();s.merge(i,t),e.push(s)}return e.length&&(this.list=e[0].list),this}merge(t,e=null){null===e&&(e=this.isBefore.bind(this));let s=this.list.next,i=t.list.next;for(;s.data!==er&&i.data!==er;)e(i.data,s.data)?([i.prev.next,s.prev.next]=[s,i],[i.prev,s.prev]=[s.prev,i.prev],[this.list.prev.next,t.list.prev.next]=[t.list,this.list],[this.list.prev,t.list.prev]=[t.list.prev,this.list.prev],[s,i]=[i.next,s]):s=s.next;return i.data!==er&&(this.list.prev.next=t.list.next,t.list.next.prev=this.list.prev,t.list.prev.next=this.list,this.list.prev=t.list.prev,t.list.next=t.list.prev=t.list),this}}class rr extends ir{isBefore(t,e){return t.start.i=e&&this.state(e-1),t.renderActions.renderMath(this,t,e)}convert(t,e=ar.LAST){t.renderActions.renderConvert(this,t,e)}compile(t){this.state()=ar.INSERTED&&this.removeFromDocument(e),t=ar.TYPESET&&(this.outputData={}),t=ar.COMPILED&&(this.inputData={}),this._state=t),this._state}reset(t=!1){this.state(ar.UNPROCESSED,t)}clear(){}}const ar={UNPROCESSED:0,FINDMATH:10,COMPILED:20,CONVERT:100,METRICS:110,RERENDER:125,TYPESET:150,INSERTED:200,LAST:1e4};function lr(t,e){if(t in ar)throw Error("State "+t+" already exists");ar[t]=e}class cr{constructor(t=null){this.defaultKind="unknown",this.nodeMap=new Map,this.node={},null===t&&(t=this.constructor.defaultNodes);for(const e of Object.keys(t))this.setNodeClass(e,t[e])}create(t,...e){return(this.node[t]||this.node[this.defaultKind])(...e)}setNodeClass(t,e){this.nodeMap.set(t,e);const s=this.nodeMap.get(t);this.node[t]=(...t)=>new s(this,...t)}getNodeClass(t){return this.nodeMap.get(t)}deleteNodeClass(t){this.nodeMap.delete(t),delete this.node[t]}nodeIsKind(t,e){return t instanceof this.getNodeClass(e)}getKinds(){return Array.from(this.nodeMap.keys())}}cr.defaultNodes={};class hr extends cr{create(t,e={},s=[]){return this.node[t](e,s)}}const dr="_inherit_";class ur{constructor(t,e){this.global=e,this.defaults=Object.create(e),this.inherited=Object.create(this.defaults),this.attributes=Object.create(this.inherited),Object.assign(this.defaults,t)}set(t,e){this.attributes[t]=e}setList(t){Object.assign(this.attributes,t)}unset(t){delete this.attributes[t]}get(t){let e=this.attributes[t];return e===dr&&(e=this.global[t]),e}getExplicit(t){return this.hasExplicit(t)?this.attributes[t]:void 0}hasExplicit(t){return Object.hasOwn(this.attributes,t)}hasOneOf(t){for(const e of t)if(this.hasExplicit(e))return!0;return!1}getList(...t){const e={};for(const s of t)e[s]=this.get(s);return e}setInherited(t,e){this.inherited[t]=e}getInherited(t){return this.inherited[t]}getDefault(t){return this.defaults[t]}isSet(t){return Object.hasOwn(this.attributes,t)||Object.hasOwn(this.inherited,t)}hasDefault(t){return t in this.defaults}getExplicitNames(){return Object.keys(this.attributes)}getInheritedNames(){return Object.keys(this.inherited)}getDefaultNames(){return Object.keys(this.defaults)}getGlobalNames(){return Object.keys(this.global)}getAllAttributes(){return this.attributes}getAllInherited(){return this.inherited}getAllDefaults(){return this.defaults}getAllGlobals(){return this.global}}class pr{constructor(t,e={},s=[]){this.factory=t,this.parent=null,this.properties={},this.childNodes=[];for(const t of Object.keys(e))this.setProperty(t,e[t]);s.length&&this.setChildren(s)}get kind(){return"unknown"}setProperty(t,e){this.properties[t]=e}getProperty(t){return this.properties[t]}getPropertyNames(){return Object.keys(this.properties)}getAllProperties(){return this.properties}removeProperty(...t){for(const e of t)delete this.properties[e]}isKind(t){return this.factory.nodeIsKind(this,t)}setChildren(t){this.childNodes=[];for(const e of t)this.appendChild(e)}appendChild(t){return this.childNodes.push(t),t.parent=this,t}replaceChild(t,e){const s=this.childIndex(e);return null!==s&&(this.childNodes[s]=t,t.parent=this,e.parent===this&&(e.parent=null)),t}removeChild(t){const e=this.childIndex(t);return null!==e&&(this.childNodes.splice(e,1),t.parent=null),t}childIndex(t){const e=this.childNodes.indexOf(t);return-1===e?null:e}copy(){const t=this.factory.create(this.kind);t.properties=Object.assign({},this.properties);for(const e of this.childNodes||[])e&&t.appendChild(e.copy());return t}findNodes(t){const e=[];return this.walkTree(s=>{s.isKind(t)&&e.push(s)}),e}walkTree(t,e){t(this,e);for(const s of this.childNodes)s&&s.walkTree(t,e);return e}toString(){return this.kind+"("+this.childNodes.join(",")+")"}}class mr extends pr{setChildren(t){}appendChild(t){return t}replaceChild(t,e){return e}childIndex(t){return null}walkTree(t,e){return t(this,e),e}toString(){return this.kind}}const fr={ORD:0,OP:1,BIN:2,REL:3,OPEN:4,CLOSE:5,PUNCT:6,INNER:7,NONE:-1},gr=["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER"],br=["","thinmathspace","mediummathspace","thickmathspace"],Er=[[0,-1,2,3,0,0,0,1],[-1,-1,0,3,0,0,0,1],[2,2,0,0,2,0,0,2],[3,3,0,0,3,0,0,3],[0,0,0,0,0,0,0,0],[0,-1,2,3,0,0,0,1],[1,1,0,1,1,1,1,1],[1,-1,2,3,1,0,1,1]],xr=new Set(["normal","bold","italic","bold-italic","double-struck","fraktur","bold-fraktur","script","bold-script","sans-serif","bold-sans-serif","sans-serif-italic","sans-serif-bold-italic","monospace","inital","tailed","looped","stretched"]),yr=["indentalign","indentalignfirst","indentshift","indentshiftfirst"];class Nr extends pr{constructor(t,e={},s=[]){super(t),this.prevClass=null,this.prevLevel=null,this.texclass=null,this.arity<0&&(this.childNodes=[t.create("inferredMrow")],this.childNodes[0].parent=this),this.setChildren(s),this.attributes=new ur(t.getNodeClass(this.kind).defaults,t.getNodeClass("math").defaults),this.attributes.setList(e)}copy(t=!1){const e=this.factory.create(this.kind);if(e.properties=Object.assign({},this.properties),this.attributes){const s=this.attributes.getAllAttributes();for(const i of Object.keys(s))("id"!==i||t)&&e.attributes.set(i,s[i])}if(this.childNodes&&this.childNodes.length){let t=this.childNodes;1===t.length&&t[0].isInferred&&(t=t[0].childNodes);for(const s of t)s?e.appendChild(s.copy()):e.childNodes.push(null)}return e}get texClass(){return this.texclass}set texClass(t){this.texclass=t}get isToken(){return!1}get isEmbellished(){return!1}get isSpacelike(){return!1}get linebreakContainer(){return!1}get linebreakAlign(){return"data-align"}get isEmpty(){for(const t of this.childNodes)if(t&&!t.isEmpty)return!1;return!0}get arity(){return 1/0}get isInferred(){return!1}get Parent(){let t=this.parent;for(;t&&t.notParent;)t=t.Parent;return t}get notParent(){return!1}setChildren(t){return this.arity<0?this.childNodes[0].setChildren(t):super.setChildren(t)}appendChild(t){if(this.arity<0)return this.childNodes[0].appendChild(t),t;if(t.isInferred){if(this.arity===1/0)return t.childNodes.forEach(t=>super.appendChild(t)),t;const e=t;(t=this.factory.create("mrow")).setChildren(e.childNodes),t.attributes=e.attributes;for(const s of e.getPropertyNames())t.setProperty(s,e.getProperty(s))}return super.appendChild(t)}replaceChild(t,e){return this.arity<0?(this.childNodes[0].replaceChild(t,e),t):super.replaceChild(t,e)}core(){return this}coreMO(){return this}coreIndex(){return 0}childPosition(){let t=null,e=this.parent;for(;e&&e.notParent;)t=e,e=e.parent;if(t=t||this,e){let s=0;for(const i of e.childNodes){if(i===t)return s;s++}}return null}setTeXclass(t){return this.getPrevClass(t),null!=this.texClass?this:t}updateTeXclass(t){t&&(this.prevClass=t.prevClass,this.prevLevel=t.prevLevel,t.prevClass=t.prevLevel=null,this.texClass=t.texClass)}getPrevClass(t){t&&(this.prevClass=t.texClass,this.prevLevel=t.attributes.get("scriptlevel"))}texSpacing(){const t=null!=this.prevClass?this.prevClass:fr.NONE,e=this.texClass||fr.ORD;if(t===fr.NONE||e===fr.NONE)return"";const s=Er[t][e];return(this.prevLevel>0||this.attributes.get("scriptlevel")>0)&&s>=0?"":br[Math.abs(s)]}hasSpacingAttributes(){return this.isEmbellished&&this.coreMO().hasSpacingAttributes()}setInheritedAttributes(t={},e=!1,s=0,i=!1){var r,n,o;const a=this.attributes.getAllDefaults();for(const e of Object.keys(t)){if(Object.hasOwn(a,e)||Object.hasOwn(Nr.alwaysInherit,e)){const[s,i]=t[e];(null===(n=null===(r=Nr.noInherit[s])||void 0===r?void 0:r[this.kind])||void 0===n?void 0:n[e])||this.attributes.setInherited(e,i)}(null===(o=Nr.stopInherit[this.kind])||void 0===o?void 0:o[e])&&delete(t=Object.assign({},t))[e]}void 0===this.attributes.getExplicit("displaystyle")&&this.attributes.setInherited("displaystyle",e);void 0===this.attributes.getExplicit("scriptlevel")&&this.attributes.setInherited("scriptlevel",s),i&&this.setProperty("texprimestyle",i);const l=this.arity;if(l>=0&&l!==1/0&&(1===l&&0===this.childNodes.length||1!==l&&this.childNodes.length!==l))if(l=0&&e!==1/0&&(1===e&&0===this.childNodes.length||1!==e&&this.childNodes.length!==e)&&this.mError('Wrong number of children for "'+this.kind+'" node',t,!0),this.verifyChildren(t)}verifyAttributes(t){if(t.checkAttributes){const e=this.attributes,s=[];for(const t of e.getExplicitNames())"data-"===t.substring(0,5)||void 0!==e.getDefault(t)||t.match(/^(?:class|style|id|(?:xlink:)?href)$/)||s.push(t);s.length&&this.mError("Unknown attributes for "+this.kind+" node: "+s.join(", "),t)}if(t.checkMathvariants){const e=this.attributes.getExplicit("mathvariant");!e||xr.has(e)||this.getProperty("ignore-variant")||this.mError(`Invalid mathvariant: ${e}`,t,!0)}}verifyChildren(t){for(const e of this.childNodes)e.verifyTree(t)}mError(t,e,s=!1){if(this.parent&&this.parent.isKind("merror"))return null;const i=this.factory.create("merror");if(i.attributes.set("data-mjx-message",t),e.fullErrors||s){const s=this.factory.create("mtext"),r=this.factory.create("text");r.setText(e.fullErrors?t:this.kind),s.appendChild(r),i.appendChild(s),this.parent.replaceChild(i,this),e.fullErrors||i.attributes.set("title",t)}else this.parent.replaceChild(i,this),i.appendChild(this);return i}}Nr.defaults={mathbackground:dr,mathcolor:dr,mathsize:dr,dir:dr},Nr.noInherit={mstyle:{mpadded:{width:!0,height:!0,depth:!0,lspace:!0,voffset:!0},mtable:{width:!0,height:!0,depth:!0,align:!0}},maligngroup:{mrow:{groupalign:!0},mtable:{groupalign:!0}},mtr:{msqrt:{"data-vertical-align":!0},mroot:{"data-vertical-align":!0}},mlabeledtr:{msqrt:{"data-vertical-align":!0},mroot:{"data-vertical-align":!0}}},Nr.stopInherit={mtd:{columnalign:!0,rowalign:!0,groupalign:!0}},Nr.alwaysInherit={scriptminsize:!0,scriptsizemultiplier:!0,infixlinebreakstyle:!0},Nr.verifyDefaults={checkArity:!0,checkAttributes:!1,checkMathvariants:!0,fullErrors:!1,fixMmultiscripts:!0,fixMtables:!0};class vr extends Nr{get isToken(){return!0}get isEmpty(){for(const t of this.childNodes)if(!(t instanceof Lr)||t.getText().length)return!1;return!0}getText(){let t="";for(const e of this.childNodes)e instanceof Lr?t+=e.getText():"textContent"in e&&(t+=e.textContent());return t}setChildInheritedAttributes(t,e,s,i){for(const r of this.childNodes)r instanceof Nr&&r.setInheritedAttributes(t,e,s,i)}walkTree(t,e){t(this,e);for(const s of this.childNodes)s instanceof Nr&&s.walkTree(t,e);return e}}vr.defaults=Object.assign(Object.assign({},Nr.defaults),{mathvariant:"normal",mathsize:dr});class Tr extends Nr{get isSpacelike(){return this.childNodes[0].isSpacelike}get isEmbellished(){return this.childNodes[0].isEmbellished}get arity(){return-1}core(){return this.childNodes[0]}coreMO(){return this.childNodes[0].coreMO()}setTeXclass(t){return t=this.childNodes[0].setTeXclass(t),this.updateTeXclass(this.childNodes[0]),t}}Tr.defaults=Nr.defaults;class Cr extends Nr{get isEmbellished(){return this.childNodes[0].isEmbellished}core(){return this.childNodes[0]}coreMO(){return this.childNodes[0].coreMO()}setTeXclass(t){this.getPrevClass(t),this.texClass=fr.ORD;const e=this.childNodes[0];let s=null;e&&(this.isEmbellished||e.isKind("mi")?(s=e.setTeXclass(t),this.updateTeXclass(this.core())):(e.setTeXclass(null),e.isKind("TeXAtom")&&(this.texClass=e.texClass)));for(const t of this.childNodes.slice(1))t&&t.setTeXclass(null);return s||this}}Cr.defaults=Nr.defaults;class Ar extends mr{get isToken(){return!1}get isEmpty(){return!0}get isEmbellished(){return!1}get isSpacelike(){return!1}get linebreakContainer(){return!1}get linebreakAlign(){return""}get arity(){return 0}get isInferred(){return!1}get notParent(){return!1}get Parent(){return this.parent}get texClass(){return fr.NONE}get prevClass(){return fr.NONE}get prevLevel(){return 0}hasSpacingAttributes(){return!1}get attributes(){return null}core(){return this}coreMO(){return this}coreIndex(){return 0}childPosition(){return 0}setTeXclass(t){return t}texSpacing(){return""}setInheritedAttributes(t,e,s,i){}inheritAttributesFrom(t){}verifyTree(t){}mError(t,e,s=!1){return null}}class Lr extends Ar{constructor(){super(...arguments),this.text=""}get kind(){return"text"}getText(){return this.text}setText(t){return this.text=t,this}copy(){return this.factory.create(this.kind).setText(this.getText())}toString(){return this.text}}class Sr extends Ar{constructor(){super(...arguments),this.xml=null,this.adaptor=null}get kind(){return"XML"}getXML(){return this.xml}setXML(t,e=null){return this.xml=t,this.adaptor=e,this}getSerializedXML(){return this.adaptor.serializeXML(this.xml)}copy(){return this.factory.create(this.kind).setXML(this.adaptor.clone(this.xml))}toString(){return"XML data"}}class Rr extends Tr{get kind(){return"math"}get linebreakContainer(){return!0}get linebreakAlign(){return""}setChildInheritedAttributes(t,e,s,i){"display"===this.attributes.get("mode")&&this.attributes.setInherited("display","block"),t=this.addInheritedAttributes(t,this.attributes.getAllAttributes()),e=!!this.attributes.get("displaystyle")||!this.attributes.get("displaystyle")&&"block"===this.attributes.get("display"),this.attributes.setInherited("displaystyle",e),s=this.attributes.get("scriptlevel")||this.constructor.defaults.scriptlevel,super.setChildInheritedAttributes(t,e,s,i)}verifyTree(t=null){super.verifyTree(t),this.parent&&this.mError("Improper nesting of math tags",t,!0)}}Rr.defaults=Object.assign(Object.assign({},Tr.defaults),{mathvariant:"normal",mathsize:"normal",mathcolor:"",mathbackground:"transparent",dir:"ltr",scriptlevel:0,displaystyle:!1,display:"inline",maxwidth:"",overflow:"linebreak",altimg:"","altimg-width":"","altimg-height":"","altimg-valign":"",alttext:"",cdgroup:"",scriptsizemultiplier:1/Math.sqrt(2),scriptminsize:".4em",infixlinebreakstyle:"before",lineleading:"100%",linebreakmultchar:"\u2062",indentshift:"auto",indentalign:"auto",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"});class Mr extends vr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mi"}setInheritedAttributes(t={},e=!1,s=0,i=!1){super.setInheritedAttributes(t,e,s,i);this.getText().match(Mr.singleCharacter)&&!t.mathvariant&&this.attributes.setInherited("mathvariant","italic")}setTeXclass(t){this.getPrevClass(t);const e=this.getText();return e.length>1&&e.match(Mr.operatorName)&&"normal"===this.attributes.get("mathvariant")&&void 0===this.getProperty("autoOP")&&void 0===this.getProperty("texClass")&&(this.texClass=fr.OP,this.setProperty("autoOP",!0)),this}}Mr.defaults=Object.assign({},vr.defaults),Mr.operatorName=/^[a-z][a-z0-9]*$/i,Mr.singleCharacter=/^[\uD800-\uDBFF]?.[\u0300-\u036F\u1AB0-\u1ABE\u1DC0-\u1DFF\u20D0-\u20EF]*$/;class Ir extends vr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mn"}}function wr(t,e,s=fr.BIN,i=null){return[t,e,s,i]}Ir.defaults=Object.assign({},vr.defaults);const kr={REL:wr(5,5,fr.REL),WIDEREL:wr(5,5,fr.REL,{accent:!0,stretchy:!0}),BIN4:wr(4,4,fr.BIN),RELSTRETCH:wr(5,5,fr.REL,{stretchy:!0}),ORD:wr(0,0,fr.ORD),BIN3:wr(3,3,fr.BIN),OPEN:wr(0,0,fr.OPEN,{fence:!0,stretchy:!0,symmetric:!0}),CLOSE:wr(0,0,fr.CLOSE,{fence:!0,stretchy:!0,symmetric:!0}),INTEGRAL:wr(3,3,fr.OP,{largeop:!0,symmetric:!0}),ACCENT:wr(0,0,fr.ORD,{accent:!0}),WIDEACCENT:wr(0,0,fr.ORD,{accent:!0,stretchy:!0}),OP:wr(3,3,fr.OP,{largeop:!0,movablelimits:!0,symmetric:!0}),RELACCENT:wr(5,5,fr.REL,{accent:!0}),BIN0:wr(0,0,fr.BIN),BIN5:wr(5,5,fr.BIN),FENCE:wr(0,0,fr.ORD,{fence:!0,stretchy:!0,symmetric:!0}),INNER:wr(1,1,fr.INNER),ORD30:wr(3,0,fr.ORD),NONE:wr(0,0,fr.NONE),ORDSTRETCH0:wr(0,0,fr.ORD,{stretchy:!0}),BINSTRETCH0:wr(0,0,fr.BIN,{stretchy:!0}),RELSTRETCH0:wr(0,0,fr.REL,{stretchy:!0}),CLOSE0:wr(0,0,fr.CLOSE,{fence:!0}),ORD3:wr(3,3,fr.ORD),PUNCT03:wr(0,3,fr.PUNCT,{linebreakstyle:"after"}),OPEN0:wr(0,0,fr.OPEN,{fence:!0}),STRETCH4:wr(4,4,fr.BIN,{stretchy:!0})},Or=[[32,127,fr.REL,"mo"],[160,191,fr.ORD,"mo"],[192,591,fr.ORD,"mi"],[688,879,fr.ORD,"mo"],[880,6688,fr.ORD,"mi"],[6832,6911,fr.ORD,"mo"],[6912,7615,fr.ORD,"mi"],[7616,7679,fr.ORD,"mo"],[7680,8191,fr.ORD,"mi"],[8192,8303,fr.ORD,"mo"],[8304,8351,fr.ORD,"mo"],[8448,8527,fr.ORD,"mi"],[8528,8591,fr.ORD,"mn"],[8592,8703,fr.REL,"mo"],[8704,8959,fr.BIN,"mo"],[8960,9215,fr.ORD,"mo"],[9312,9471,fr.ORD,"mn"],[9472,10223,fr.ORD,"mo"],[10224,10239,fr.REL,"mo"],[10240,10495,fr.ORD,"mtext"],[10496,10623,fr.REL,"mo"],[10624,10751,fr.ORD,"mo"],[10752,11007,fr.BIN,"mo"],[11008,11055,fr.ORD,"mo"],[11056,11087,fr.REL,"mo"],[11088,11263,fr.ORD,"mo"],[11264,11744,fr.ORD,"mi"],[11776,11903,fr.ORD,"mo"],[11904,12255,fr.ORD,"mi","normal"],[12272,12351,fr.ORD,"mo"],[12352,42143,fr.ORD,"mi","normal"],[42192,43055,fr.ORD,"mi"],[43056,43071,fr.ORD,"mn"],[43072,55295,fr.ORD,"mi"],[63744,64255,fr.ORD,"mi","normal"],[64256,65023,fr.ORD,"mi"],[65024,65135,fr.ORD,"mo"],[65136,65791,fr.ORD,"mi"],[65792,65935,fr.ORD,"mn"],[65936,74751,fr.ORD,"mi","normal"],[74752,74879,fr.ORD,"mn"],[74880,113823,fr.ORD,"mi","normal"],[113824,119391,fr.ORD,"mo"],[119648,119679,fr.ORD,"mn"],[119808,120781,fr.ORD,"mi"],[120782,120831,fr.ORD,"mn"],[122624,129023,fr.ORD,"mo"],[129024,129279,fr.REL,"mo"],[129280,129535,fr.ORD,"mo"],[131072,195103,fr.ORD,"mi","normal"]];function Dr(t){const e=Br.infix[t]||Br.prefix[t]||Br.postfix[t];if(e)return[0,0,e[2],"mo"];const s=t.codePointAt(0);for(const t of Or)if(s<=t[1]){if(s>=t[0])return t;break}return[0,0,fr.REL,"mo"]}const Pr=[[0,0],[1,2],[3,3],[4,4],[0,0],[0,0],[0,3],[1,1]],Br={prefix:{"!":kr.ORD,"(":kr.OPEN,"+":kr.BIN0,"-":kr.BIN0,"[":kr.OPEN,"{":kr.OPEN,"|":kr.OPEN,"||":kr.BIN0,"\xac":kr.ORD,"\xb1":kr.BIN0,"\u2016":kr.FENCE,"\u2018":kr.OPEN0,"\u201c":kr.OPEN0,\u2145:kr.ORD30,\u2146:kr.ORD30,"\u2200":kr.ORD,"\u2201":kr.ORD,"\u2202":kr.ORD30,"\u2203":kr.ORD,"\u2204":kr.ORD,"\u2207":kr.ORD,"\u220f":kr.OP,"\u2210":kr.OP,"\u2211":kr.OP,"\u2212":kr.BIN0,"\u2213":kr.BIN0,"\u221a":[3,0,fr.ORD,{stretchy:!0}],"\u221b":kr.ORD30,"\u221c":kr.ORD30,"\u221f":kr.ORD,"\u2220":kr.ORD,"\u2221":kr.ORD,"\u2222":kr.ORD,"\u222b":kr.INTEGRAL,"\u222c":kr.INTEGRAL,"\u222d":kr.INTEGRAL,"\u222e":kr.INTEGRAL,"\u222f":kr.INTEGRAL,"\u2230":kr.INTEGRAL,"\u2231":kr.INTEGRAL,"\u2232":kr.INTEGRAL,"\u2233":kr.INTEGRAL,"\u2234":kr.REL,"\u2235":kr.REL,"\u223c":[0,0,fr.REL,{}],"\u22be":kr.ORD,"\u22bf":kr.ORD,"\u22c0":kr.OP,"\u22c1":kr.OP,"\u22c2":kr.OP,"\u22c3":kr.OP,"\u2308":kr.OPEN,"\u230a":kr.OPEN,"\u2310":kr.ORD,"\u2319":kr.ORD,"\u2772":kr.OPEN,"\u2795":kr.ORD,"\u2796":kr.ORD,"\u27c0":kr.ORD,"\u27e6":kr.OPEN,"\u27e8":kr.OPEN,"\u27ea":kr.OPEN,"\u27ec":kr.OPEN,"\u27ee":kr.OPEN,"\u2980":kr.FENCE,"\u2983":kr.OPEN,"\u2985":kr.OPEN,"\u2987":kr.OPEN,"\u2989":kr.OPEN,"\u298b":kr.OPEN,"\u298d":kr.OPEN,"\u298f":kr.OPEN,"\u2991":kr.OPEN,"\u2993":kr.OPEN,"\u2995":kr.OPEN,"\u2997":kr.OPEN,"\u2999":kr.FENCE,"\u299b":kr.ORD,"\u299c":kr.ORD,"\u299d":kr.ORD,"\u299e":kr.ORD,"\u299f":kr.ORD,"\u29a0":kr.ORD,"\u29a1":kr.ORD,"\u29a2":kr.ORD,"\u29a3":kr.ORD,"\u29a4":kr.ORD,"\u29a5":kr.ORD,"\u29a6":kr.ORD,"\u29a7":kr.ORD,"\u29a8":kr.ORD,"\u29a9":kr.ORD,"\u29aa":kr.ORD,"\u29ab":kr.ORD,"\u29ac":kr.ORD,"\u29ad":kr.ORD,"\u29ae":kr.ORD,"\u29af":kr.ORD,"\u29d8":kr.OPEN,"\u29da":kr.OPEN,"\u29fc":kr.OPEN,"\u2a00":kr.OP,"\u2a01":kr.OP,"\u2a02":kr.OP,"\u2a03":kr.OP,"\u2a04":kr.OP,"\u2a05":kr.OP,"\u2a06":kr.OP,"\u2a07":kr.OP,"\u2a08":kr.OP,"\u2a09":kr.OP,"\u2a0a":kr.OP,"\u2a0b":kr.INTEGRAL,"\u2a0c":kr.INTEGRAL,"\u2a0d":kr.INTEGRAL,"\u2a0e":kr.INTEGRAL,"\u2a0f":kr.INTEGRAL,"\u2a10":kr.INTEGRAL,"\u2a11":kr.INTEGRAL,"\u2a12":kr.INTEGRAL,"\u2a13":kr.INTEGRAL,"\u2a14":kr.INTEGRAL,"\u2a15":kr.INTEGRAL,"\u2a16":kr.INTEGRAL,"\u2a17":kr.INTEGRAL,"\u2a18":kr.INTEGRAL,"\u2a19":kr.INTEGRAL,"\u2a1a":kr.INTEGRAL,"\u2a1b":kr.INTEGRAL,"\u2a1c":kr.INTEGRAL,"\u2a1d":kr.OP,"\u2a1e":kr.OP,"\u2aec":kr.ORD,"\u2aed":kr.ORD,"\u2afc":kr.OP,"\u2aff":kr.OP,"\u3008":kr.OPEN},postfix:{"!!":kr.BIN0,"!":kr.CLOSE0,'"':kr.ORD,"%":kr.ORD,"&":kr.ORD,"'":kr.ACCENT,")":kr.CLOSE,"++":kr.BIN0,"--":kr.BIN0,"]":kr.CLOSE,"^":kr.WIDEACCENT,_:kr.WIDEACCENT,"`":kr.ACCENT,"|":kr.CLOSE,"||":kr.BIN0,"}":kr.CLOSE,"~":kr.WIDEACCENT,"\xa8":kr.ACCENT,"\xaf":kr.WIDEACCENT,"\xb0":kr.ACCENT,"\xb2":kr.ORD,"\xb3":kr.ORD,"\xb4":kr.ACCENT,"\xb8":kr.ACCENT,"\xb9":kr.ORD,\u02c6:kr.WIDEACCENT,\u02c7:kr.WIDEACCENT,\u02c9:kr.WIDEACCENT,\u02ca:kr.ACCENT,\u02cb:kr.ACCENT,\u02cd:kr.WIDEACCENT,"\u02d8":kr.ACCENT,"\u02d9":kr.ACCENT,"\u02da":kr.ACCENT,"\u02dc":kr.WIDEACCENT,"\u02dd":kr.ACCENT,"\u02f7":kr.WIDEACCENT,"\u0302":kr.WIDEACCENT,"\u0311":kr.ACCENT,"\u2016":kr.FENCE,"\u2019":kr.CLOSE0,"\u201a":kr.ORD,"\u201b":kr.ORD,"\u201d":kr.CLOSE0,"\u201e":kr.ORD,"\u201f":kr.ORD,"\u2032":kr.ORD,"\u2033":kr.ORD,"\u2034":kr.ORD,"\u2035":kr.ORD,"\u2036":kr.ORD,"\u2037":kr.ORD,"\u203e":kr.WIDEACCENT,"\u2057":kr.ORD,"\u20db":kr.ACCENT,"\u20dc":kr.ACCENT,"\u2309":kr.CLOSE,"\u230b":kr.CLOSE,"\u2322":kr.RELSTRETCH0,"\u2323":kr.RELSTRETCH0,"\u23b4":kr.WIDEACCENT,"\u23b5":kr.WIDEACCENT,"\u23cd":kr.ORD,"\u23dc":kr.WIDEACCENT,"\u23dd":kr.WIDEACCENT,"\u23de":kr.WIDEACCENT,"\u23df":kr.WIDEACCENT,"\u23e0":kr.WIDEACCENT,"\u23e1":kr.WIDEACCENT,"\u2773":kr.CLOSE,"\u27e7":kr.CLOSE,"\u27e9":kr.CLOSE,"\u27eb":kr.CLOSE,"\u27ed":kr.CLOSE,"\u27ef":kr.CLOSE,"\u2980":kr.FENCE,"\u2984":kr.CLOSE,"\u2986":kr.CLOSE,"\u2988":kr.CLOSE,"\u298a":kr.CLOSE,"\u298c":kr.CLOSE,"\u298e":kr.CLOSE,"\u2990":kr.CLOSE,"\u2992":kr.CLOSE,"\u2994":kr.CLOSE,"\u2996":kr.CLOSE,"\u2998":kr.CLOSE,"\u2999":kr.FENCE,"\u29d9":kr.CLOSE,"\u29db":kr.CLOSE,"\u29fd":kr.CLOSE,"\u3009":kr.CLOSE,"\u{1eef0}":kr.BINSTRETCH0,"\u{1eef1}":kr.BINSTRETCH0},infix:{"!":kr.ORD,"!=":kr.BIN5,"#":kr.ORD,$:kr.ORD,"%":kr.ORD3,"&&":kr.BIN4,"**":kr.BIN3,"*":kr.BIN3,"*=":kr.BIN5,"+":kr.BIN4,"+=":kr.BIN5,",":kr.PUNCT03,"":kr.ORD,"-":kr.BIN4,"-=":kr.BIN5,"->":kr.BIN5,".":kr.ORD3,"..":kr.BIN3,"...":kr.INNER,"/":[4,4,fr.ORD,{}],"//":kr.BIN5,"/=":kr.BIN5,":":[0,3,fr.REL,{}],":=":kr.BIN5,";":kr.PUNCT03,"<":kr.REL,"<=":kr.REL,"<>":[3,3,fr.REL,{}],"=":kr.REL,"==":kr.REL,">":kr.REL,">=":kr.REL,"?":[3,3,fr.CLOSE,{fence:!0}],"@":kr.ORD3,"\\":kr.ORD,"^":[3,3,fr.ORD,{accent:!0,stretchy:!0}],_:kr.WIDEACCENT,"|":[5,5,fr.ORD,{}],"||":kr.BIN5,"\xb1":kr.BIN4,"\xb7":kr.BIN3,"\xd7":kr.BIN3,"\xf7":kr.BIN4,\u02b9:kr.ORD,"\u0300":kr.ACCENT,"\u0301":kr.ACCENT,"\u0303":kr.WIDEACCENT,"\u0304":kr.ACCENT,"\u0306":kr.ACCENT,"\u0307":kr.ACCENT,"\u0308":kr.ACCENT,"\u030c":kr.ACCENT,"\u0332":kr.WIDEACCENT,"\u0338":kr.REL,"\u03f6":kr.REL,"\u2015":kr.ORDSTRETCH0,"\u2017":kr.ORDSTRETCH0,"\u2020":kr.BIN3,"\u2021":kr.BIN3,"\u2022":kr.BIN3,"\u2026":kr.INNER,"\u2043":kr.BIN3,"\u2044":kr.STRETCH4,"\u2061":kr.NONE,"\u2062":kr.NONE,"\u2063":[0,0,fr.NONE,{linebreakstyle:"after"}],"\u2064":kr.NONE,"\u20d7":kr.ACCENT,\u2111:kr.ORD,\u2113:kr.ORD,\u2118:kr.ORD,\u211c:kr.ORD,"\u2190":kr.WIDEREL,"\u2191":kr.RELSTRETCH,"\u2192":kr.WIDEREL,"\u2193":kr.RELSTRETCH,"\u2194":kr.WIDEREL,"\u2195":kr.RELSTRETCH,"\u2196":kr.REL,"\u2197":kr.REL,"\u2198":kr.REL,"\u2199":kr.REL,"\u219a":kr.WIDEREL,"\u219b":kr.WIDEREL,"\u219c":kr.WIDEREL,"\u219d":kr.WIDEREL,"\u219e":kr.WIDEREL,"\u219f":kr.RELSTRETCH,"\u21a0":kr.WIDEREL,"\u21a1":kr.RELSTRETCH,"\u21a2":kr.WIDEREL,"\u21a3":kr.WIDEREL,"\u21a4":kr.WIDEREL,"\u21a5":kr.RELSTRETCH,"\u21a6":kr.WIDEREL,"\u21a7":kr.RELSTRETCH,"\u21a8":kr.RELSTRETCH,"\u21a9":kr.WIDEREL,"\u21aa":kr.WIDEREL,"\u21ab":kr.WIDEREL,"\u21ac":kr.WIDEREL,"\u21ad":kr.WIDEREL,"\u21ae":kr.WIDEREL,"\u21af":kr.REL,"\u21b0":kr.RELSTRETCH,"\u21b1":kr.RELSTRETCH,"\u21b2":kr.RELSTRETCH,"\u21b3":kr.RELSTRETCH,"\u21b4":kr.RELSTRETCH,"\u21b5":kr.RELSTRETCH,"\u21b6":kr.REL,"\u21b7":kr.REL,"\u21b8":kr.REL,"\u21b9":kr.WIDEREL,"\u21ba":kr.REL,"\u21bb":kr.REL,"\u21bc":kr.WIDEREL,"\u21bd":kr.WIDEREL,"\u21be":kr.RELSTRETCH,"\u21bf":kr.RELSTRETCH,"\u21c0":kr.WIDEREL,"\u21c1":kr.WIDEREL,"\u21c2":kr.RELSTRETCH,"\u21c3":kr.RELSTRETCH,"\u21c4":kr.WIDEREL,"\u21c5":kr.RELSTRETCH,"\u21c6":kr.WIDEREL,"\u21c7":kr.WIDEREL,"\u21c8":kr.RELSTRETCH,"\u21c9":kr.WIDEREL,"\u21ca":kr.RELSTRETCH,"\u21cb":kr.WIDEREL,"\u21cc":kr.WIDEREL,"\u21cd":kr.WIDEREL,"\u21ce":kr.WIDEREL,"\u21cf":kr.WIDEREL,"\u21d0":kr.WIDEREL,"\u21d1":kr.RELSTRETCH,"\u21d2":kr.WIDEREL,"\u21d3":kr.RELSTRETCH,"\u21d4":kr.WIDEREL,"\u21d5":kr.RELSTRETCH,"\u21d6":kr.REL,"\u21d7":kr.REL,"\u21d8":kr.REL,"\u21d9":kr.REL,"\u21da":kr.WIDEREL,"\u21db":kr.WIDEREL,"\u21dc":kr.WIDEREL,"\u21dd":kr.WIDEREL,"\u21de":kr.RELSTRETCH,"\u21df":kr.RELSTRETCH,"\u21e0":kr.WIDEREL,"\u21e1":kr.RELSTRETCH,"\u21e2":kr.WIDEREL,"\u21e3":kr.RELSTRETCH,"\u21e4":kr.WIDEREL,"\u21e5":kr.WIDEREL,"\u21e6":kr.WIDEREL,"\u21e7":kr.RELSTRETCH,"\u21e8":kr.WIDEREL,"\u21e9":kr.RELSTRETCH,"\u21ea":kr.RELSTRETCH,"\u21eb":kr.RELSTRETCH,"\u21ec":kr.RELSTRETCH,"\u21ed":kr.RELSTRETCH,"\u21ee":kr.RELSTRETCH,"\u21ef":kr.RELSTRETCH,"\u21f0":kr.WIDEREL,"\u21f1":kr.REL,"\u21f2":kr.REL,"\u21f3":kr.RELSTRETCH,"\u21f4":kr.WIDEREL,"\u21f5":kr.RELSTRETCH,"\u21f6":kr.WIDEREL,"\u21f7":kr.WIDEREL,"\u21f8":kr.WIDEREL,"\u21f9":kr.WIDEREL,"\u21fa":kr.WIDEREL,"\u21fb":kr.WIDEREL,"\u21fc":kr.WIDEREL,"\u21fd":kr.WIDEREL,"\u21fe":kr.WIDEREL,"\u21ff":kr.WIDEREL,"\u2205":kr.ORD,"\u2206":kr.ORD,"\u2208":kr.REL,"\u2209":kr.REL,"\u220a":kr.REL,"\u220b":kr.REL,"\u220c":kr.REL,"\u220d":kr.REL,"\u2212":kr.BIN4,"\u2213":kr.BIN4,"\u2214":kr.BIN4,"\u2215":kr.STRETCH4,"\u2216":kr.BIN4,"\u2217":kr.BIN3,"\u2218":kr.BIN3,"\u2219":kr.BIN3,"\u221d":kr.REL,"\u221e":kr.ORD,"\u2223":kr.REL,"\u2224":kr.REL,"\u2225":kr.REL,"\u2226":kr.REL,"\u2227":kr.BIN4,"\u2228":kr.BIN4,"\u2229":kr.BIN4,"\u222a":kr.BIN4,"\u2236":kr.BIN4,"\u2237":kr.REL,"\u2238":kr.BIN4,"\u2239":kr.REL,"\u223a":kr.REL,"\u223b":kr.REL,"\u223c":kr.REL,"\u223d":kr.REL,"\u223e":kr.REL,"\u2240":kr.BIN3,"\u2241":kr.REL,"\u2242":kr.REL,"\u2242\u0338":kr.REL,"\u2243":kr.REL,"\u2244":kr.REL,"\u2245":kr.REL,"\u2246":kr.REL,"\u2247":kr.REL,"\u2248":kr.REL,"\u2249":kr.REL,"\u224a":kr.REL,"\u224b":kr.REL,"\u224c":kr.REL,"\u224d":kr.REL,"\u224e":kr.REL,"\u224f":kr.REL,"\u2250":kr.REL,"\u2251":kr.REL,"\u2252":kr.REL,"\u2253":kr.REL,"\u2254":kr.REL,"\u2255":kr.REL,"\u2256":kr.REL,"\u2257":kr.REL,"\u2258":kr.REL,"\u2259":kr.REL,"\u225a":kr.REL,"\u225b":kr.REL,"\u225c":kr.REL,"\u225d":kr.REL,"\u225e":kr.REL,"\u225f":kr.REL,"\u2260":kr.REL,"\u2261":kr.REL,"\u2262":kr.REL,"\u2263":kr.REL,"\u2264":kr.REL,"\u2265":kr.REL,"\u2266":kr.REL,"\u2266\u0338":kr.REL,"\u2267":kr.REL,"\u2267\u0338":kr.REL,"\u2268":kr.REL,"\u2269":kr.REL,"\u226a":kr.REL,"\u226a\u0338":kr.REL,"\u226b":kr.REL,"\u226b\u0338":kr.REL,"\u226c":kr.REL,"\u226d":kr.REL,"\u226e":kr.REL,"\u226f":kr.REL,"\u2270":kr.REL,"\u2271":kr.REL,"\u2272":kr.REL,"\u2273":kr.REL,"\u2274":kr.REL,"\u2275":kr.REL,"\u2276":kr.REL,"\u2277":kr.REL,"\u2278":kr.REL,"\u2279":kr.REL,"\u227a":kr.REL,"\u227b":kr.REL,"\u227c":kr.REL,"\u227d":kr.REL,"\u227e":kr.REL,"\u227e\u0338":kr.REL,"\u227f":kr.REL,"\u227f\u0338":kr.REL,"\u2280":kr.REL,"\u2281":kr.REL,"\u2282":kr.REL,"\u2283":kr.REL,"\u2284":kr.REL,"\u2285":kr.REL,"\u2286":kr.REL,"\u2287":kr.REL,"\u2288":kr.REL,"\u2289":kr.REL,"\u228a":kr.REL,"\u228b":kr.REL,"\u228c":kr.BIN4,"\u228d":kr.BIN4,"\u228e":kr.BIN4,"\u228f":kr.REL,"\u228f\u0338":kr.REL,"\u2290":kr.REL,"\u2290\u0338":kr.REL,"\u2291":kr.REL,"\u2292":kr.REL,"\u2293":kr.BIN4,"\u2294":kr.BIN4,"\u2295":kr.BIN4,"\u2296":kr.BIN4,"\u2297":kr.BIN3,"\u2298":kr.BIN4,"\u2299":kr.BIN3,"\u229a":kr.BIN3,"\u229b":kr.BIN3,"\u229c":kr.REL,"\u229d":kr.BIN4,"\u229e":kr.BIN4,"\u229f":kr.BIN4,"\u22a0":kr.BIN3,"\u22a1":kr.BIN3,"\u22a2":kr.REL,"\u22a3":kr.REL,"\u22a4":kr.ORD,"\u22a5":kr.ORD,"\u22a6":kr.REL,"\u22a7":kr.REL,"\u22a8":kr.REL,"\u22a9":kr.REL,"\u22aa":kr.REL,"\u22ab":kr.REL,"\u22ac":kr.REL,"\u22ad":kr.REL,"\u22ae":kr.REL,"\u22af":kr.REL,"\u22b0":kr.REL,"\u22b1":kr.REL,"\u22b2":kr.REL,"\u22b3":kr.REL,"\u22b4":kr.REL,"\u22b5":kr.REL,"\u22b6":kr.REL,"\u22b7":kr.REL,"\u22b8":kr.REL,"\u22ba":kr.BIN3,"\u22bb":kr.BIN4,"\u22bc":kr.BIN4,"\u22bd":kr.BIN4,"\u22c4":kr.BIN3,"\u22c5":kr.BIN3,"\u22c6":kr.BIN3,"\u22c7":kr.BIN3,"\u22c8":kr.REL,"\u22c9":kr.BIN3,"\u22ca":kr.BIN3,"\u22cb":kr.BIN3,"\u22cc":kr.BIN3,"\u22cd":kr.REL,"\u22ce":kr.BIN4,"\u22cf":kr.BIN4,"\u22d0":kr.REL,"\u22d1":kr.REL,"\u22d2":kr.BIN4,"\u22d3":kr.BIN4,"\u22d4":kr.REL,"\u22d5":kr.REL,"\u22d6":kr.REL,"\u22d7":kr.REL,"\u22d8":kr.REL,"\u22d9":kr.REL,"\u22da":kr.REL,"\u22db":kr.REL,"\u22dc":kr.REL,"\u22dd":kr.REL,"\u22de":kr.REL,"\u22df":kr.REL,"\u22e0":kr.REL,"\u22e1":kr.REL,"\u22e2":kr.REL,"\u22e3":kr.REL,"\u22e4":kr.REL,"\u22e5":kr.REL,"\u22e6":kr.REL,"\u22e7":kr.REL,"\u22e8":kr.REL,"\u22e9":kr.REL,"\u22ea":kr.REL,"\u22eb":kr.REL,"\u22ec":kr.REL,"\u22ed":kr.REL,"\u22ee":kr.ORD,"\u22ef":kr.INNER,"\u22f0":kr.INNER,"\u22f1":kr.INNER,"\u22f2":kr.REL,"\u22f3":kr.REL,"\u22f4":kr.REL,"\u22f5":kr.REL,"\u22f6":kr.REL,"\u22f7":kr.REL,"\u22f8":kr.REL,"\u22f9":kr.REL,"\u22fa":kr.REL,"\u22fb":kr.REL,"\u22fc":kr.REL,"\u22fd":kr.REL,"\u22fe":kr.REL,"\u22ff":kr.REL,"\u2301":kr.REL,"\u2305":kr.BIN3,"\u2306":kr.BIN3,"\u2329":kr.OPEN,"\u232a":kr.CLOSE,"\u237c":kr.REL,"\u238b":kr.REL,"\u23aa":kr.ORD,"\u23af":kr.ORDSTRETCH0,"\u23b0":kr.OPEN,"\u23b1":kr.CLOSE,"\u2500":kr.ORD,"\u25b3":kr.BIN3,"\u25b5":kr.BIN3,"\u25b9":kr.BIN3,"\u25bd":kr.BIN3,"\u25bf":kr.BIN3,"\u25c3":kr.BIN3,"\u25ef":kr.BIN3,"\u2660":kr.ORD,"\u2661":kr.ORD,"\u2662":kr.ORD,"\u2663":kr.ORD,"\u266d":kr.ORD,"\u266e":kr.ORD,"\u266f":kr.ORD,"\u2758":[5,5,fr.REL,{stretchy:!0,symmetric:!0}],"\u2794":kr.WIDEREL,"\u2795":kr.BIN4,"\u2796":kr.BIN4,"\u2797":kr.BIN4,"\u2798":kr.REL,"\u2799":kr.WIDEREL,"\u279a":kr.REL,"\u279b":kr.WIDEREL,"\u279c":kr.WIDEREL,"\u279d":kr.WIDEREL,"\u279e":kr.WIDEREL,"\u279f":kr.WIDEREL,"\u27a0":kr.WIDEREL,"\u27a1":kr.WIDEREL,"\u27a5":kr.WIDEREL,"\u27a6":kr.WIDEREL,"\u27a7":kr.RELACCENT,"\u27a8":kr.WIDEREL,"\u27a9":kr.WIDEREL,"\u27aa":kr.WIDEREL,"\u27ab":kr.WIDEREL,"\u27ac":kr.WIDEREL,"\u27ad":kr.WIDEREL,"\u27ae":kr.WIDEREL,"\u27af":kr.WIDEREL,"\u27b1":kr.WIDEREL,"\u27b2":kr.RELACCENT,"\u27b3":kr.WIDEREL,"\u27b4":kr.REL,"\u27b5":kr.WIDEREL,"\u27b6":kr.REL,"\u27b7":kr.REL,"\u27b8":kr.WIDEREL,"\u27b9":kr.REL,"\u27ba":kr.WIDEREL,"\u27bb":kr.WIDEREL,"\u27bc":kr.WIDEREL,"\u27bd":kr.WIDEREL,"\u27be":kr.WIDEREL,"\u27c2":kr.REL,"\u27c2\u0338":kr.REL,"\u27cb":kr.BIN3,"\u27cd":kr.BIN3,"\u27f0":kr.RELSTRETCH,"\u27f1":kr.RELSTRETCH,"\u27f2":kr.REL,"\u27f3":kr.REL,"\u27f4":kr.RELSTRETCH,"\u27f5":kr.WIDEREL,"\u27f6":kr.WIDEREL,"\u27f7":kr.WIDEREL,"\u27f8":kr.WIDEREL,"\u27f9":kr.WIDEREL,"\u27fa":kr.WIDEREL,"\u27fb":kr.WIDEREL,"\u27fc":kr.WIDEREL,"\u27fd":kr.WIDEREL,"\u27fe":kr.WIDEREL,"\u27ff":kr.WIDEREL,"\u2900":kr.WIDEREL,"\u2901":kr.WIDEREL,"\u2902":kr.WIDEREL,"\u2903":kr.WIDEREL,"\u2904":kr.WIDEREL,"\u2905":kr.WIDEREL,"\u2906":kr.WIDEREL,"\u2907":kr.WIDEREL,"\u2908":kr.RELSTRETCH,"\u2909":kr.RELSTRETCH,"\u290a":kr.RELSTRETCH,"\u290b":kr.RELSTRETCH,"\u290c":kr.WIDEREL,"\u290d":kr.WIDEREL,"\u290e":kr.WIDEREL,"\u290f":kr.WIDEREL,"\u2910":kr.WIDEREL,"\u2911":kr.WIDEREL,"\u2912":kr.RELSTRETCH,"\u2913":kr.RELSTRETCH,"\u2914":kr.WIDEREL,"\u2915":kr.WIDEREL,"\u2916":kr.WIDEREL,"\u2917":kr.WIDEREL,"\u2918":kr.WIDEREL,"\u2919":kr.WIDEREL,"\u291a":kr.WIDEREL,"\u291b":kr.WIDEREL,"\u291c":kr.WIDEREL,"\u291d":kr.WIDEREL,"\u291e":kr.WIDEREL,"\u291f":kr.WIDEREL,"\u2920":kr.WIDEREL,"\u2921":kr.REL,"\u2922":kr.REL,"\u2923":kr.REL,"\u2924":kr.REL,"\u2925":kr.REL,"\u2926":kr.REL,"\u2927":kr.REL,"\u2928":kr.REL,"\u2929":kr.REL,"\u292a":kr.REL,"\u292b":kr.REL,"\u292c":kr.REL,"\u292d":kr.REL,"\u292e":kr.REL,"\u292f":kr.REL,"\u2930":kr.REL,"\u2931":kr.REL,"\u2932":kr.REL,"\u2933":kr.RELACCENT,"\u2934":kr.RELSTRETCH,"\u2935":kr.RELSTRETCH,"\u2936":kr.RELSTRETCH,"\u2937":kr.RELSTRETCH,"\u2938":kr.REL,"\u2939":kr.REL,"\u293a":kr.RELACCENT,"\u293b":kr.RELACCENT,"\u293c":kr.RELACCENT,"\u293d":kr.RELACCENT,"\u293e":kr.REL,"\u293f":kr.REL,"\u2940":kr.REL,"\u2941":kr.REL,"\u2942":kr.WIDEREL,"\u2943":kr.WIDEREL,"\u2944":kr.WIDEREL,"\u2945":kr.RELSTRETCH,"\u2946":kr.RELSTRETCH,"\u2947":kr.WIDEREL,"\u2948":kr.WIDEREL,"\u2949":kr.RELSTRETCH,"\u294a":kr.WIDEREL,"\u294b":kr.WIDEREL,"\u294c":kr.RELSTRETCH,"\u294d":kr.RELSTRETCH,"\u294e":kr.WIDEREL,"\u294f":kr.RELSTRETCH,"\u2950":kr.WIDEREL,"\u2951":kr.RELSTRETCH,"\u2952":kr.WIDEREL,"\u2953":kr.WIDEREL,"\u2954":kr.RELSTRETCH,"\u2955":kr.RELSTRETCH,"\u2956":kr.WIDEREL,"\u2957":kr.WIDEREL,"\u2958":kr.RELSTRETCH,"\u2959":kr.RELSTRETCH,"\u295a":kr.WIDEREL,"\u295b":kr.WIDEREL,"\u295c":kr.RELSTRETCH,"\u295d":kr.RELSTRETCH,"\u295e":kr.WIDEREL,"\u295f":kr.WIDEREL,"\u2960":kr.RELSTRETCH,"\u2961":kr.RELSTRETCH,"\u2962":kr.WIDEREL,"\u2963":kr.RELSTRETCH,"\u2964":kr.WIDEREL,"\u2965":kr.RELSTRETCH,"\u2966":kr.WIDEREL,"\u2967":kr.WIDEREL,"\u2968":kr.WIDEREL,"\u2969":kr.WIDEREL,"\u296a":kr.WIDEREL,"\u296b":kr.WIDEREL,"\u296c":kr.WIDEREL,"\u296d":kr.WIDEREL,"\u296e":kr.RELSTRETCH,"\u296f":kr.RELSTRETCH,"\u2970":kr.WIDEREL,"\u2971":kr.WIDEREL,"\u2972":kr.WIDEREL,"\u2973":kr.WIDEREL,"\u2974":kr.WIDEREL,"\u2975":kr.WIDEREL,"\u2976":kr.RELACCENT,"\u2977":kr.RELACCENT,"\u2978":kr.RELACCENT,"\u2979":kr.RELACCENT,"\u297a":kr.RELACCENT,"\u297b":kr.RELACCENT,"\u297c":kr.WIDEREL,"\u297d":kr.WIDEREL,"\u297e":kr.RELSTRETCH,"\u297f":kr.RELSTRETCH,"\u2981":kr.REL,"\u2982":kr.REL,"\u29b6":kr.REL,"\u29b7":kr.REL,"\u29b8":kr.BIN4,"\u29b9":kr.REL,"\u29bc":kr.BIN4,"\u29c0":kr.REL,"\u29c1":kr.REL,"\u29c4":kr.BIN4,"\u29c5":kr.BIN4,"\u29c6":kr.BIN3,"\u29c7":kr.BIN3,"\u29c8":kr.BIN3,"\u29ce":kr.REL,"\u29cf":kr.REL,"\u29d0":kr.REL,"\u29d1":kr.REL,"\u29d2":kr.REL,"\u29d3":kr.REL,"\u29d4":kr.BIN3,"\u29d5":kr.BIN3,"\u29d6":kr.BIN3,"\u29d7":kr.BIN3,"\u29df":kr.REL,"\u29e1":kr.REL,"\u29e2":kr.BIN3,"\u29e3":kr.REL,"\u29e4":kr.REL,"\u29e5":kr.REL,"\u29e6":kr.REL,"\u29f4":kr.REL,"\u29f5":kr.BIN4,"\u29f6":kr.BIN4,"\u29f7":kr.BIN4,"\u29f8":kr.BIN4,"\u29f9":kr.BIN4,"\u29fa":kr.BIN4,"\u29fb":kr.BIN4,"\u2a1d":kr.BIN3,"\u2a1e":kr.BIN3,"\u2a1f":kr.BIN4,"\u2a20":kr.BIN4,"\u2a21":kr.BIN4,"\u2a22":kr.BIN4,"\u2a23":kr.BIN4,"\u2a24":kr.BIN4,"\u2a25":kr.BIN4,"\u2a26":kr.BIN4,"\u2a27":kr.BIN4,"\u2a28":kr.BIN4,"\u2a29":kr.BIN4,"\u2a2a":kr.BIN4,"\u2a2b":kr.BIN4,"\u2a2c":kr.BIN4,"\u2a2d":kr.BIN4,"\u2a2e":kr.BIN4,"\u2a2f":kr.BIN3,"\u2a30":kr.BIN3,"\u2a31":kr.BIN3,"\u2a32":kr.BIN3,"\u2a33":kr.BIN3,"\u2a34":kr.BIN3,"\u2a35":kr.BIN3,"\u2a36":kr.BIN3,"\u2a37":kr.BIN3,"\u2a38":kr.BIN4,"\u2a39":kr.BIN4,"\u2a3a":kr.BIN4,"\u2a3b":kr.BIN3,"\u2a3c":kr.BIN3,"\u2a3d":kr.BIN3,"\u2a3e":kr.BIN4,"\u2a3f":kr.BIN3,"\u2a40":kr.BIN4,"\u2a41":kr.BIN4,"\u2a42":kr.BIN4,"\u2a43":kr.BIN4,"\u2a44":kr.BIN4,"\u2a45":kr.BIN4,"\u2a46":kr.BIN4,"\u2a47":kr.BIN4,"\u2a48":kr.BIN4,"\u2a49":kr.BIN4,"\u2a4a":kr.BIN4,"\u2a4b":kr.BIN4,"\u2a4c":kr.BIN4,"\u2a4d":kr.BIN4,"\u2a4e":kr.BIN4,"\u2a4f":kr.BIN4,"\u2a50":kr.BIN3,"\u2a51":kr.BIN4,"\u2a52":kr.BIN4,"\u2a53":kr.BIN4,"\u2a54":kr.BIN4,"\u2a55":kr.BIN4,"\u2a56":kr.BIN4,"\u2a57":kr.BIN4,"\u2a58":kr.BIN4,"\u2a59":kr.BIN4,"\u2a5a":kr.BIN4,"\u2a5b":kr.BIN4,"\u2a5c":kr.BIN4,"\u2a5d":kr.BIN4,"\u2a5e":kr.BIN4,"\u2a5f":kr.BIN4,"\u2a60":kr.BIN4,"\u2a61":kr.BIN4,"\u2a62":kr.BIN4,"\u2a63":kr.BIN4,"\u2a64":kr.BIN3,"\u2a65":kr.BIN3,"\u2a66":kr.REL,"\u2a67":kr.REL,"\u2a68":kr.REL,"\u2a69":kr.REL,"\u2a6a":kr.REL,"\u2a6b":kr.REL,"\u2a6c":kr.REL,"\u2a6d":kr.REL,"\u2a6e":kr.REL,"\u2a6f":kr.REL,"\u2a70":kr.REL,"\u2a71":kr.REL,"\u2a72":kr.REL,"\u2a73":kr.REL,"\u2a74":kr.REL,"\u2a75":kr.REL,"\u2a76":kr.REL,"\u2a77":kr.REL,"\u2a78":kr.REL,"\u2a79":kr.REL,"\u2a7a":kr.REL,"\u2a7b":kr.REL,"\u2a7c":kr.REL,"\u2a7d":kr.REL,"\u2a7d\u0338":kr.REL,"\u2a7e":kr.REL,"\u2a7e\u0338":kr.REL,"\u2a7f":kr.REL,"\u2a80":kr.REL,"\u2a81":kr.REL,"\u2a82":kr.REL,"\u2a83":kr.REL,"\u2a84":kr.REL,"\u2a85":kr.REL,"\u2a86":kr.REL,"\u2a87":kr.REL,"\u2a88":kr.REL,"\u2a89":kr.REL,"\u2a8a":kr.REL,"\u2a8b":kr.REL,"\u2a8c":kr.REL,"\u2a8d":kr.REL,"\u2a8e":kr.REL,"\u2a8f":kr.REL,"\u2a90":kr.REL,"\u2a91":kr.REL,"\u2a92":kr.REL,"\u2a93":kr.REL,"\u2a94":kr.REL,"\u2a95":kr.REL,"\u2a96":kr.REL,"\u2a97":kr.REL,"\u2a98":kr.REL,"\u2a99":kr.REL,"\u2a9a":kr.REL,"\u2a9b":kr.REL,"\u2a9c":kr.REL,"\u2a9d":kr.REL,"\u2a9e":kr.REL,"\u2a9f":kr.REL,"\u2aa0":kr.REL,"\u2aa1":kr.REL,"\u2aa2":kr.REL,"\u2aa3":kr.REL,"\u2aa4":kr.REL,"\u2aa5":kr.REL,"\u2aa6":kr.REL,"\u2aa7":kr.REL,"\u2aa8":kr.REL,"\u2aa9":kr.REL,"\u2aaa":kr.REL,"\u2aab":kr.REL,"\u2aac":kr.REL,"\u2aad":kr.REL,"\u2aae":kr.REL,"\u2aaf":kr.REL,"\u2aaf\u0338":kr.REL,"\u2ab0":kr.REL,"\u2ab0\u0338":kr.REL,"\u2ab1":kr.REL,"\u2ab2":kr.REL,"\u2ab3":kr.REL,"\u2ab4":kr.REL,"\u2ab5":kr.REL,"\u2ab6":kr.REL,"\u2ab7":kr.REL,"\u2ab8":kr.REL,"\u2ab9":kr.REL,"\u2aba":kr.REL,"\u2abb":kr.REL,"\u2abc":kr.REL,"\u2abd":kr.REL,"\u2abe":kr.REL,"\u2abf":kr.REL,"\u2ac0":kr.REL,"\u2ac1":kr.REL,"\u2ac2":kr.REL,"\u2ac3":kr.REL,"\u2ac4":kr.REL,"\u2ac5":kr.REL,"\u2ac6":kr.REL,"\u2ac7":kr.REL,"\u2ac8":kr.REL,"\u2ac9":kr.REL,"\u2aca":kr.REL,"\u2acb":kr.REL,"\u2acc":kr.REL,"\u2acd":kr.REL,"\u2ace":kr.REL,"\u2acf":kr.REL,"\u2ad0":kr.REL,"\u2ad1":kr.REL,"\u2ad2":kr.REL,"\u2ad3":kr.REL,"\u2ad4":kr.REL,"\u2ad5":kr.REL,"\u2ad6":kr.REL,"\u2ad7":kr.REL,"\u2ad8":kr.REL,"\u2ad9":kr.REL,"\u2ada":kr.REL,"\u2adb":kr.BIN4,"\u2add":kr.BIN3,"\u2add\u0338":kr.REL,"\u2ade":kr.REL,"\u2adf":kr.REL,"\u2ae0":kr.REL,"\u2ae1":kr.REL,"\u2ae2":kr.REL,"\u2ae3":kr.REL,"\u2ae4":kr.REL,"\u2ae5":kr.REL,"\u2ae6":kr.REL,"\u2ae7":kr.REL,"\u2ae8":kr.REL,"\u2ae9":kr.REL,"\u2aea":kr.REL,"\u2aeb":kr.REL,"\u2aee":kr.REL,"\u2af2":kr.REL,"\u2af3":kr.REL,"\u2af4":kr.REL,"\u2af5":kr.REL,"\u2af6":kr.BIN4,"\u2af7":kr.REL,"\u2af8":kr.REL,"\u2af9":kr.REL,"\u2afa":kr.REL,"\u2afb":kr.BIN4,"\u2afd":kr.BIN4,"\u2afe":kr.BIN3,"\u2b00":kr.REL,"\u2b01":kr.REL,"\u2b02":kr.REL,"\u2b03":kr.REL,"\u2b04":kr.WIDEREL,"\u2b05":kr.WIDEREL,"\u2b06":kr.RELSTRETCH,"\u2b07":kr.RELSTRETCH,"\u2b08":kr.REL,"\u2b09":kr.REL,"\u2b0a":kr.REL,"\u2b0b":kr.REL,"\u2b0c":kr.WIDEREL,"\u2b0d":kr.RELSTRETCH,"\u2b0e":kr.RELSTRETCH,"\u2b0f":kr.RELSTRETCH,"\u2b10":kr.RELSTRETCH,"\u2b11":kr.RELSTRETCH,"\u2b30":kr.WIDEREL,"\u2b31":kr.WIDEREL,"\u2b32":kr.RELSTRETCH,"\u2b33":kr.WIDEREL,"\u2b34":kr.WIDEREL,"\u2b35":kr.WIDEREL,"\u2b36":kr.WIDEREL,"\u2b37":kr.WIDEREL,"\u2b38":kr.WIDEREL,"\u2b39":kr.WIDEREL,"\u2b3a":kr.WIDEREL,"\u2b3b":kr.WIDEREL,"\u2b3c":kr.WIDEREL,"\u2b3d":kr.WIDEREL,"\u2b3e":kr.WIDEREL,"\u2b3f":kr.RELACCENT,"\u2b40":kr.WIDEREL,"\u2b41":kr.WIDEREL,"\u2b42":kr.WIDEREL,"\u2b43":kr.WIDEREL,"\u2b44":kr.WIDEREL,"\u2b45":kr.WIDEREL,"\u2b46":kr.WIDEREL,"\u2b47":kr.WIDEREL,"\u2b48":kr.WIDEREL,"\u2b49":kr.WIDEREL,"\u2b4a":kr.WIDEREL,"\u2b4b":kr.WIDEREL,"\u2b4c":kr.WIDEREL,"\u2b4d":kr.REL,"\u2b4e":kr.REL,"\u2b4f":kr.REL,"\u2b5a":kr.REL,"\u2b5b":kr.REL,"\u2b5c":kr.REL,"\u2b5d":kr.REL,"\u2b5e":kr.REL,"\u2b5f":kr.REL,"\u2b60":kr.WIDEREL,"\u2b61":kr.RELSTRETCH,"\u2b62":kr.WIDEREL,"\u2b63":kr.RELSTRETCH,"\u2b64":kr.WIDEREL,"\u2b65":kr.RELSTRETCH,"\u2b66":kr.REL,"\u2b67":kr.REL,"\u2b68":kr.REL,"\u2b69":kr.REL,"\u2b6a":kr.WIDEREL,"\u2b6b":kr.RELSTRETCH,"\u2b6c":kr.WIDEREL,"\u2b6d":kr.RELSTRETCH,"\u2b6e":kr.REL,"\u2b6f":kr.REL,"\u2b70":kr.WIDEREL,"\u2b71":kr.RELSTRETCH,"\u2b72":kr.WIDEREL,"\u2b73":kr.RELSTRETCH,"\u2b76":kr.REL,"\u2b77":kr.REL,"\u2b78":kr.REL,"\u2b79":kr.REL,"\u2b7a":kr.WIDEREL,"\u2b7b":kr.RELSTRETCH,"\u2b7c":kr.WIDEREL,"\u2b7d":kr.RELSTRETCH,"\u2b80":kr.WIDEREL,"\u2b81":kr.RELSTRETCH,"\u2b82":kr.WIDEREL,"\u2b83":kr.RELSTRETCH,"\u2b84":kr.WIDEREL,"\u2b85":kr.RELSTRETCH,"\u2b86":kr.WIDEREL,"\u2b87":kr.RELSTRETCH,"\u2b88":kr.RELACCENT,"\u2b89":kr.REL,"\u2b8a":kr.RELACCENT,"\u2b8b":kr.REL,"\u2b8c":kr.REL,"\u2b8d":kr.REL,"\u2b8e":kr.REL,"\u2b8f":kr.REL,"\u2b94":kr.REL,"\u2b95":kr.WIDEREL,"\u2ba0":kr.RELSTRETCH,"\u2ba1":kr.RELSTRETCH,"\u2ba2":kr.RELSTRETCH,"\u2ba3":kr.RELSTRETCH,"\u2ba4":kr.RELSTRETCH,"\u2ba5":kr.RELSTRETCH,"\u2ba6":kr.RELSTRETCH,"\u2ba7":kr.RELSTRETCH,"\u2ba8":kr.WIDEREL,"\u2ba9":kr.WIDEREL,"\u2baa":kr.WIDEREL,"\u2bab":kr.WIDEREL,"\u2bac":kr.RELSTRETCH,"\u2bad":kr.RELSTRETCH,"\u2bae":kr.RELSTRETCH,"\u2baf":kr.RELSTRETCH,"\u2bb0":kr.REL,"\u2bb1":kr.REL,"\u2bb2":kr.REL,"\u2bb3":kr.REL,"\u2bb4":kr.REL,"\u2bb5":kr.REL,"\u2bb6":kr.REL,"\u2bb7":kr.REL,"\u2bb8":kr.RELSTRETCH,"\u2bd1":kr.REL,\u3adc:kr.BIN3,"\ufe37":kr.WIDEACCENT,"\ufe38":kr.WIDEACCENT}};function Fr(t,e){return t.length!==e.length?e.length-t.length:t===e?0:tt.codePointAt(0))}function Ur(t){return String.fromCodePoint(...t)}function Hr(t){return!!t.match(/%\s*$/)}function Wr(t){return t.trim().split(/\s+/)}function zr(t){return t.replace(/\\U(?:([0-9A-Fa-f]{4})|\{\s*([0-9A-Fa-f]{1,6})\s*\})|\\./g,(t,e,s)=>"\\\\"===t?"\\":String.fromCodePoint(parseInt(e||s,16)))}function qr(t){return`&#x${t.codePointAt(0).toString(16).toUpperCase()};`}class Vr extends vr{constructor(){super(...arguments),this._texClass=null,this.lspace=5/18,this.rspace=5/18}get texClass(){return null===this._texClass?this.getOperatorDef(this.getText())[2]:this._texClass}set texClass(t){this._texClass=t}get kind(){return"mo"}get isEmbellished(){return!0}coreParent(){let t=null,e=this;const s=this.factory.getNodeClass("math");for(;e&&e.isEmbellished&&e.coreMO()===this&&!(e instanceof s);)t=e,e=e.parent;return t||this}coreText(t){if(!t)return"";if(t.isEmbellished)return t.coreMO().getText();for(;((t.isKind("mrow")||t.isKind("TeXAtom")||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():""}hasSpacingAttributes(){return this.attributes.isSet("lspace")||this.attributes.isSet("rspace")}get isAccent(){let t=!1;const e=this.coreParent().parent;if(e){const s=e.isKind("mover")?e.childNodes[e.over].coreMO()?"accent":"":e.isKind("munder")?e.childNodes[e.under].coreMO()?"accentunder":"":e.isKind("munderover")?this===e.childNodes[e.over].coreMO()?"accent":this===e.childNodes[e.under].coreMO()?"accentunder":"":"";if(s){t=void 0!==e.attributes.getExplicit(s)?t:this.attributes.get("accent")}}return t}setTeXclass(t){const{form:e,fence:s}=this.attributes.getList("form","fence");return void 0===this.getProperty("texClass")&&this.hasSpacingAttributes()?null:(s&&this.texClass===fr.REL&&("prefix"===e&&(this.texClass=fr.OPEN),"postfix"===e&&(this.texClass=fr.CLOSE)),this.adjustTeXclass(t))}adjustTeXclass(t){const e=this.texClass;let s=this.prevClass;if(e===fr.NONE)return t;if(t?(!t.getProperty("autoOP")||e!==fr.BIN&&e!==fr.REL||(s=t.texClass=fr.ORD),s=this.prevClass=t.texClass||fr.ORD,this.prevLevel=this.attributes.getInherited("scriptlevel")):s=this.prevClass=fr.NONE,e!==fr.BIN||s!==fr.NONE&&s!==fr.BIN&&s!==fr.OP&&s!==fr.REL&&s!==fr.OPEN&&s!==fr.PUNCT)if(s!==fr.BIN||e!==fr.REL&&e!==fr.CLOSE&&e!==fr.PUNCT){if(e===fr.BIN){let t=null,e=this.parent;for(;e&&e.parent&&e.isEmbellished&&(1===e.childNodes.length||!e.isKind("mrow")&&e.core()===t);)t=e,e=e.parent;t=t||this,e.childNodes[e.childNodes.length-1]===t&&(this.texClass=fr.ORD)}}else t.texClass=this.prevClass=fr.ORD;else this.texClass=fr.ORD;return this}setInheritedAttributes(t={},e=!1,s=0,i=!1){super.setInheritedAttributes(t,e,s,i);const r=this.getText();this.checkOperatorTable(r),this.checkPseudoScripts(r),this.checkPrimes(r),this.checkMathAccent(r)}getOperatorDef(t){const[e,s,i]=this.handleExplicitForm(this.getForms());this.attributes.setInherited("form",e);const r=this.constructor,n=r.OPTABLE,o=n[e][t]||n[s][t]||n[i][t];if(o)return o;this.setProperty("noDictDef",!0);const a=this.attributes.get("movablelimits");if((!!t.match(r.opPattern)||a)&&void 0===this.getProperty("texClass"))return wr(1,2,fr.OP);const l=Dr(t),[c,h]=r.MMLSPACING[l[2]];return wr(c,h,l[2])}checkOperatorTable(t){const e=this.getOperatorDef(t);void 0===this.getProperty("texClass")&&(this.texClass=e[2]);for(const t of Object.keys(e[3]||{}))this.attributes.setInherited(t,e[3][t]);this.lspace=e[0]/18,this.rspace=e[1]/18}getForms(){let t=null,e=this.parent,s=this.Parent;for(;s&&s.isEmbellished;)t=e,e=s.parent,s=s.Parent;if(t=t||this,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"]}handleExplicitForm(t){if(this.attributes.isSet("form")){const e=this.attributes.get("form");t=[e].concat(t.filter(t=>t!==e))}return t}checkPseudoScripts(t){const e=this.constructor.pseudoScripts;if(!t.match(e))return;const s=this.coreParent().Parent,i=!s||!(s.isKind("msubsup")&&!s.isKind("msub"));this.setProperty("pseudoscript",i),i&&(this.attributes.setInherited("lspace",0),this.attributes.setInherited("rspace",0))}checkPrimes(t){const e=this.constructor.primes;if(!t.match(e))return;const s=this.constructor.remapPrimes,i=Ur(_r(t).map(t=>s[t]));this.setProperty("primes",i)}checkMathAccent(t){const e=this.Parent;if(void 0!==this.getProperty("mathaccent")||!e||!e.isKind("munderover"))return;const[s,i,r]=e.childNodes;if(s.isEmbellished&&s.coreMO()===this)return;const n=!(!i||!i.isEmbellished||i.coreMO()!==this),o=!(!r||!r.isEmbellished||i.coreMO()!==this);(n||o)&&(this.isMathAccent(t)?this.setProperty("mathaccent",!0):this.isMathAccentWithWidth(t)&&this.setProperty("mathaccent",!1))}isMathAccent(t=this.getText()){const e=this.constructor.mathaccents;return!!t.match(e)}isMathAccentWithWidth(t=this.getText()){const e=this.constructor.mathaccentsWithWidth;return!!t.match(e)}}Vr.defaults=Object.assign(Object.assign({},vr.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:"100%",linebreakstyle:"before",indentalign:"auto",indentshift:"0",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),Vr.MMLSPACING=Pr,Vr.OPTABLE=Br,Vr.pseudoScripts=new RegExp(["^[\"'*`","\xaa","\xb0","\xb2-\xb4","\xb9","\xba","\u2018-\u201f","\u2032-\u2037\u2057","\u2070\u2071","\u2074-\u207f","\u2080-\u208e","]+$"].join("")),Vr.primes=new RegExp(["^[\"'","\u2018-\u201f","]+$"].join("")),Vr.opPattern=/^[a-zA-Z]{2,}$/,Vr.remapPrimes={34:8243,39:8242,8216:8245,8217:8242,8218:8242,8219:8245,8220:8246,8221:8243,8222:8243,8223:8246},Vr.mathaccents=new RegExp(["^[","\xb4\u0301\u02ca","`\u0300\u02cb","\xa8\u0308","~\u0303\u02dc","\xaf\u0304\u02c9","\u02d8\u0306","\u02c7\u030c","^\u0302\u02c6","\u20d0\u20d1","\u20d6\u20d7\u20e1","\u02d9\u0307","\u02da\u030a","\u20db","\u20dc","]$"].join("")),Vr.mathaccentsWithWidth=new RegExp(["^[","\u2190\u2192\u2194","\u23dc\u23dd","\u23de\u23df","]$"].join(""));class Xr extends vr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mtext"}get isSpacelike(){return!!this.getText().match(/^\s*$/)&&!this.attributes.hasOneOf(Xr.NONSPACELIKE)}}Xr.NONSPACELIKE=["style","mathbackground","background"],Xr.defaults=Object.assign({},vr.defaults);class Gr extends vr{constructor(){super(...arguments),this.texclass=fr.NONE}setTeXclass(t){return t}get kind(){return"mspace"}get arity(){return 0}get isSpacelike(){return!this.attributes.hasExplicit("linebreak")&&this.canBreak}get hasNewline(){const t=this.attributes.get("linebreak");return this.canBreak&&("newline"===t||"indentingnewline"===t)}get canBreak(){return!this.attributes.hasOneOf(Gr.NONSPACELIKE)&&"-"!==String(this.attributes.get("width")).trim().charAt(0)}}Gr.NONSPACELIKE=["height","depth","style","mathbackground","background"],Gr.defaults=Object.assign(Object.assign({},vr.defaults),{width:"0em",height:"0ex",depth:"0ex",linebreak:"auto",indentshift:"auto",indentalign:"auto",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"});class Jr extends vr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"ms"}}Jr.defaults=Object.assign(Object.assign({},vr.defaults),{lquote:'"',rquote:'"'});class Kr extends Nr{constructor(){super(...arguments),this._core=null}get kind(){return"mrow"}get isSpacelike(){for(const t of this.childNodes)if(!t.isSpacelike)return!1;return!0}get isEmbellished(){let t=!1,e=0;for(const s of this.childNodes){if(s)if(s.isEmbellished){if(t)return!1;t=!0,this._core=e}else if(!s.isSpacelike)return!1;e++}return t}core(){return this.isEmbellished&&null!=this._core?this.childNodes[this._core]:this}coreMO(){return this.isEmbellished&&null!=this._core?this.childNodes[this._core].coreMO():this}nonSpaceLength(){let t=0;for(const e of this.childNodes)e&&!e.isSpacelike&&t++;return t}firstNonSpace(){for(const t of this.childNodes)if(t&&!t.isSpacelike)return t;return null}lastNonSpace(){let t=this.childNodes.length;for(;--t>=0;){const e=this.childNodes[t];if(e&&!e.isSpacelike)return e}return null}setTeXclass(t){if(null!=this.getProperty("open")||null!=this.getProperty("close")){this.getPrevClass(t),t=null;for(const e of this.childNodes)t=e.setTeXclass(t);return null==this.texClass&&(this.texClass=fr.INNER),this}for(const e of this.childNodes)t=e.setTeXclass(t);return this.childNodes[0]&&this.updateTeXclass(this.childNodes[0]),t}}Kr.defaults=Object.assign({},Nr.defaults);class $r extends Kr{get kind(){return"inferredMrow"}get isInferred(){return!0}get notParent(){return!0}toString(){return"["+this.childNodes.join(",")+"]"}}$r.defaults=Kr.defaults;class Yr extends Cr{get kind(){return"mfrac"}get arity(){return 2}get linebreakContainer(){return!0}get linebreakAlign(){return""}setTeXclass(t){this.getPrevClass(t);for(const t of this.childNodes)t.setTeXclass(null);return this}setChildInheritedAttributes(t,e,s,i){(!e||s>0)&&s++;const r=this.attributes.get("numalign"),n=this.attributes.get("denomalign"),o=this.addInheritedAttributes(Object.assign({},t),{numalign:r,indentshift:"0",indentalignfirst:r,indentshiftfirst:"0",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),a=this.addInheritedAttributes(Object.assign({},t),{denalign:n,indentshift:"0",indentalignfirst:n,indentshiftfirst:"0",indentalignlast:"indentalign",indentshiftlast:"indentshift"});this.childNodes[0].setInheritedAttributes(o,!1,s,i),this.childNodes[1].setInheritedAttributes(a,!1,s,!0)}}Yr.defaults=Object.assign(Object.assign({},Cr.defaults),{linethickness:"medium",numalign:"center",denomalign:"center",bevelled:!1});class Qr extends Nr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"msqrt"}get arity(){return-1}get linebreakContainer(){return!0}setTeXclass(t){return this.getPrevClass(t),this.childNodes[0].setTeXclass(null),this}setChildInheritedAttributes(t,e,s,i){this.childNodes[0].setInheritedAttributes(t,e,s,!0)}}Qr.defaults=Object.assign(Object.assign({},Nr.defaults),{"data-vertical-align":"bottom"});class Zr extends Nr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mroot"}get arity(){return 2}get linebreakContainer(){return!0}setTeXclass(t){return this.getPrevClass(t),this.childNodes[0].setTeXclass(null),this.childNodes[1].setTeXclass(null),this}setChildInheritedAttributes(t,e,s,i){this.childNodes[0].setInheritedAttributes(t,e,s,!0),this.childNodes[1].setInheritedAttributes(t,!1,s+2,i)}}Zr.defaults=Object.assign(Object.assign({},Nr.defaults),{"data-vertical-align":"bottom"});class tn extends Tr{get kind(){return"mstyle"}get notParent(){return this.childNodes[0]&&1===this.childNodes[0].childNodes.length}setInheritedAttributes(t={},e=!1,s=0,i=!1){this.attributes.setInherited("displaystyle",e),this.attributes.setInherited("scriptlevel",s),super.setInheritedAttributes(t,e,s,i)}setChildInheritedAttributes(t,e,s,i){let r=this.attributes.getExplicit("scriptlevel");null!=r&&(r=r.toString(),r.match(/^\s*[-+]/)?s+=parseInt(r):s=parseInt(r),i=!1);const n=this.attributes.getExplicit("displaystyle");null!=n&&(e=!0===n,i=!1);const o=this.attributes.getExplicit("data-cramped");null!=o&&(i=o),t=this.addInheritedAttributes(t,this.attributes.getAllAttributes()),this.childNodes[0].setInheritedAttributes(t,e,s,i)}}tn.defaults=Object.assign(Object.assign({},Tr.defaults),{scriptlevel:dr,displaystyle:dr,scriptsizemultiplier:1/Math.sqrt(2),scriptminsize:".4em",mathbackground:dr,mathcolor:dr,dir:dr,infixlinebreakstyle:"before"});class en extends Nr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"merror"}get arity(){return-1}get linebreakContainer(){return!0}}en.defaults=Object.assign({},Nr.defaults);class sn extends Tr{get kind(){return"mpadded"}get linebreakContainer(){return!0}setTeXclass(t){return this.getProperty("vbox")?(this.getPrevClass(t),this.texClass=fr.ORD,this.childNodes[0].setTeXclass(null),this):super.setTeXclass(t)}}sn.defaults=Object.assign(Object.assign({},Tr.defaults),{width:"",height:"",depth:"",lspace:0,voffset:0});class rn extends Tr{constructor(){super(...arguments),this.texclass=fr.ORD}get kind(){return"mphantom"}}rn.defaults=Object.assign({},Tr.defaults);class nn extends Nr{constructor(){super(...arguments),this.texclass=fr.INNER,this.separators=[],this.open=null,this.close=null}get kind(){return"mfenced"}setTeXclass(t){this.getPrevClass(t),this.open&&(t=this.open.setTeXclass(t)),this.childNodes[0]&&(t=this.childNodes[0].setTeXclass(t));for(let e=1,s=this.childNodes.length;ethis.childNodes.length&&(t=1),this.attributes.set("selection",t)}setChildInheritedAttributes(t,e,s,i){var r,n;"tooltip"===this.attributes.get("actiontype").toLowerCase()?(null===(r=this.childNodes[0])||void 0===r||r.setInheritedAttributes(t,e,s,i),null===(n=this.childNodes[1])||void 0===n||n.setInheritedAttributes(t,!1,1,!1)):super.setChildInheritedAttributes(t,e,s,i)}}an.defaults=Object.assign(Object.assign({},Nr.defaults),{actiontype:"toggle",selection:1});class ln extends Cr{get kind(){return"msubsup"}get arity(){return 3}get base(){return 0}get sub(){return 1}get sup(){return 2}setChildInheritedAttributes(t,e,s,i){const r=this.childNodes;r[0].setInheritedAttributes(t,e,s,i),r[1].setInheritedAttributes(t,!1,s+1,i||1===this.sub),r[2]&&r[2].setInheritedAttributes(t,!1,s+1,i||2===this.sub)}}ln.defaults=Object.assign(Object.assign({},Cr.defaults),{subscriptshift:"",superscriptshift:""});class cn extends ln{get kind(){return"msub"}get arity(){return 2}}cn.defaults=Object.assign({},ln.defaults);class hn extends ln{get kind(){return"msup"}get arity(){return 2}get sup(){return 1}get sub(){return 2}}hn.defaults=Object.assign({},ln.defaults);class dn extends Cr{get kind(){return"munderover"}get arity(){return 3}get base(){return 0}get under(){return 1}get over(){return 2}get linebreakContainer(){return!0}setChildInheritedAttributes(t,e,s,i){const r=this.childNodes;r[0].setInheritedAttributes(t,e,s,i||!!r[this.over]);const n=!(e||!r[0].coreMO().attributes.get("movablelimits")),o=this.constructor.ACCENTS;r[1].setInheritedAttributes(t,!1,this.getScriptlevel(o[1],n,s),i||1===this.under),this.setInheritedAccent(1,o[1],e,s,i,n),r[2]&&(r[2].setInheritedAttributes(t,!1,this.getScriptlevel(o[2],n,s),i||2===this.under),this.setInheritedAccent(2,o[2],e,s,i,n))}getScriptlevel(t,e,s){return!e&&this.attributes.get(t)||s++,s}setInheritedAccent(t,e,s,i,r,n){const o=this.childNodes[t];if(!this.attributes.hasExplicit(e)&&o.isEmbellished){const t=o.coreMO().attributes.get("accent");this.attributes.setInherited(e,t),t!==this.attributes.getDefault(e)&&o.setInheritedAttributes({},s,this.getScriptlevel(e,n,i),r)}}}dn.defaults=Object.assign(Object.assign({},Cr.defaults),{accent:!1,accentunder:!1,align:"center"}),dn.ACCENTS=["","accentunder","accent"];class un extends dn{get kind(){return"munder"}get arity(){return 2}}un.defaults=Object.assign({},dn.defaults);class pn extends dn{get kind(){return"mover"}get arity(){return 2}get over(){return 1}get under(){return 2}}pn.defaults=Object.assign({},dn.defaults),pn.ACCENTS=["","accent","accentunder"];class mn extends ln{get kind(){return"mmultiscripts"}get arity(){return 1}setChildInheritedAttributes(t,e,s,i){this.childNodes[0].setInheritedAttributes(t,e,s,i);let r=!1;for(let e=1,n=0;e...`}verifyTree(t){!this.parent||this.parent.isToken||this.mError("HTML can only be a child of a token element",t,!0)}}const In={[Rr.prototype.kind]:Rr,[Mr.prototype.kind]:Mr,[Ir.prototype.kind]:Ir,[Vr.prototype.kind]:Vr,[Xr.prototype.kind]:Xr,[Gr.prototype.kind]:Gr,[Jr.prototype.kind]:Jr,[Kr.prototype.kind]:Kr,[$r.prototype.kind]:$r,[Yr.prototype.kind]:Yr,[Qr.prototype.kind]:Qr,[Zr.prototype.kind]:Zr,[tn.prototype.kind]:tn,[en.prototype.kind]:en,[sn.prototype.kind]:sn,[rn.prototype.kind]:rn,[nn.prototype.kind]:nn,[on.prototype.kind]:on,[an.prototype.kind]:an,[cn.prototype.kind]:cn,[hn.prototype.kind]:hn,[ln.prototype.kind]:ln,[un.prototype.kind]:un,[pn.prototype.kind]:pn,[dn.prototype.kind]:dn,[mn.prototype.kind]:mn,[fn.prototype.kind]:fn,[gn.prototype.kind]:gn,[bn.prototype.kind]:bn,[xn.prototype.kind]:xn,[En.prototype.kind]:En,[yn.prototype.kind]:yn,[Nn.prototype.kind]:Nn,[vn.prototype.kind]:vn,[Tn.prototype.kind]:Tn,[Cn.prototype.kind]:Cn,[Ln.prototype.kind]:Ln,[An.prototype.kind]:An,[Sn.prototype.kind]:Sn,[Rn.prototype.kind]:Rn,[Lr.prototype.kind]:Lr,[Sr.prototype.kind]:Sr,[Mn.prototype.kind]:Mn};class wn extends hr{get MML(){return this.node}}wn.defaultNodes=In;class kn{constructor(){this.bits=0}static allocate(...t){for(const e of t){if(this.has(e))throw new Error("Bit already allocated for "+e);if(this.next===kn.MAXBIT)throw new Error("Maximum number of bits already allocated");this.names.set(e,this.next),this.next<<=1}}static has(t){return this.names.has(t)}set(t){this.bits|=this.getBit(t)}clear(t){this.bits&=~this.getBit(t)}isSet(t){return!!(this.bits&this.getBit(t))}reset(){this.bits=0}getBit(t){const e=this.constructor.names.get(t);if(!e)throw new Error("Unknown bit-field name: "+t);return e}}function On(...t){const e=class extends kn{};return e.allocate(...t),e}function Dn(t){return new Promise(function e(s,i){const r=t=>{var r;t.retry instanceof Promise?t.retry.then(()=>e(s,i)).catch(t=>i(t)):(null===(r=t.restart)||void 0===r?void 0:r.isCallback)?MathJax.Callback.After(()=>e(s,i),t.restart):i(t)};try{const e=t();e instanceof Promise?e.then(t=>s(t)).catch(t=>r(t)):s(e)}catch(t){r(t)}})}function Pn(t){const e=new Error("MathJax retry -- an asynchronous action is required; try using one of the promise-based functions and await its resolution.");throw e.retry=t,e}kn.MAXBIT=1<<31,kn.next=1,kn.names=new Map;var Bn=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};class Fn extends gi{static create(t){const e=new this;for(const s of Object.keys(t)){const[i,r]=this.action(s,t[s]);r&&e.add(i,r)}return e}static action(t,e){let s,i,r=!0;const n=e[0];if(1===e.length||"boolean"==typeof e[1])2===e.length&&(r=e[1]),[s,i]=this.methodActions(t);else if("string"==typeof e[1])if("string"==typeof e[2]){4===e.length&&(r=e[3]);const[t,n]=e.slice(1);[s,i]=this.methodActions(t,n)}else 3===e.length&&(r=e[2]),[s,i]=this.methodActions(e[1]);else 4===e.length&&(r=e[3]),[s,i]=e.slice(1);return[{id:t,renderDoc:s,renderMath:i,convert:r},n]}static methodActions(t,e=t){return[e=>(t&&e[t](),!1),(t,s)=>(e&&t[e](s),!1)]}renderDoc(t,e=ar.UNPROCESSED){for(const s of this.items)if(s.priority>=e&&s.item.renderDoc(t))return}renderMath(t,e,s=ar.UNPROCESSED){for(const i of this.items)if(i.priority>=s&&i.item.renderMath(t,e))return}renderConvert(t,e,s=ar.LAST){for(const i of this.items){if(i.priority>s)return;if(i.item.convert&&i.item.renderMath(t,e))return}}findID(t){for(const e of this.items)if(e.item.id===t)return e.item;return null}}const jn={all:!1,processed:!1,inputJax:null,outputJax:null},_n={all:!0,processed:!0,inputJax:[],outputJax:[]};class Un extends Zi{compile(t){return null}}class Hn extends tr{typeset(t,e=null){return null}escaped(t,e){return null}}class Wn extends rr{}class zn{constructor(t,e,s){const i=this.constructor;this.document=t,this.options=Fi(Bi({},i.OPTIONS),s),this.math=new(this.options.MathList||Wn),this.renderActions=Fn.create(this.options.renderActions),this._actionPromises=[],this._readyPromise=Promise.resolve(),this.processed=new zn.ProcessBits,this.outputJax=this.options.OutputJax||new Hn;let r=this.options.InputJax||[new Un];Array.isArray(r)||(r=[r]),this.inputJax=r,this.adaptor=e,this.outputJax.setAdaptor(e),this.inputJax.map(t=>t.setAdaptor(e)),this.mmlFactory=this.options.MmlFactory||new wn,this.inputJax.map(t=>t.setMmlFactory(this.mmlFactory)),this.outputJax.initialize(),this.inputJax.map(t=>t.initialize())}get kind(){return this.constructor.KIND}addRenderAction(t,...e){const[s,i]=Fn.action(t,e);this.renderActions.add(s,i)}removeRenderAction(t){const e=this.renderActions.findID(t);e&&this.renderActions.remove(e)}render(){return this.clearPromises(),this.renderActions.renderDoc(this),this}renderPromise(){return this.whenReady(()=>Dn(()=>Bn(this,void 0,void 0,function*(){return this.render(),yield this.actionPromises(),this.clearPromises(),this})))}rerender(t=ar.RERENDER){return this.state(t-1),this.render(),this}rerenderPromise(t=ar.RERENDER){return this.whenReady(()=>Dn(()=>Bn(this,void 0,void 0,function*(){return this.rerender(t),yield this.actionPromises(),this.clearPromises(),this})))}convert(t,e={}){let{format:s,display:i,end:r,ex:n,em:o,containerWidth:a,scale:l,family:c}=Fi({format:this.inputJax[0].name,display:!0,end:ar.LAST,em:16,ex:8,containerWidth:null,scale:1,family:""},e);null===a&&(a=80*n);const h=this.inputJax.reduce((t,e)=>e.name===s?e:t,null),d=new this.options.MathItem(t,h,i);return d.start.node=this.adaptor.body(this.document),d.setMetrics(o,n,a,l),c&&this.outputJax.options.mtextInheritFont&&(d.outputData.mtextFamily=c),c&&this.outputJax.options.merrorInheritFont&&(d.outputData.merrorFamily=c),this.clearPromises(),d.convert(this,r),d.typesetRoot||d.root}convertPromise(t,e={}){return this.whenReady(()=>Dn(()=>Bn(this,void 0,void 0,function*(){const s=this.convert(t,e);return yield this.actionPromises(),this.clearPromises(),s})))}whenReady(t){return this._readyPromise=this._readyPromise.catch(t=>{}).then(()=>{const e=this._readyPromise;this._readyPromise=Promise.resolve();const s=t(),i=this._readyPromise.then(()=>s);return this._readyPromise=e,i})}actionPromises(){return Promise.all(this._actionPromises)}clearPromises(){this._actionPromises=[]}savePromise(t){this._actionPromises.push(t)}findMath(t=null){return this.processed.set("findMath"),this}compile(){if(!this.processed.isSet("compile")){const t=[];for(const e of this.math)this.compileMath(e),void 0!==e.inputData.recompile&&t.push(e);for(const e of t){const t=e.inputData.recompile;e.state(t.state),e.inputData.recompile=t,this.compileMath(e)}this.processed.set("compile")}return this}compileMath(t){try{t.compile(this)}catch(e){if(e.retry||e.restart)throw e;this.options.compileError(this,t,e),t.inputData.error=e}}compileError(t,e){t.root=this.mmlFactory.create("math",null,[this.mmlFactory.create("merror",{"data-mjx-error":e.message,title:e.message},[this.mmlFactory.create("mtext",null,[this.mmlFactory.create("text").setText("Math input error")])])]),t.display&&t.root.attributes.set("display","block"),t.inputData.error=e.message}typeset(){if(!this.processed.isSet("typeset")){for(const t of this.math)try{t.typeset(this)}catch(e){if(e.retry||e.restart)throw e;this.options.typesetError(this,t,e),t.outputData.error=e}this.processed.set("typeset")}return this}typesetError(t,e){t.typesetRoot=this.adaptor.node("mjx-container",{class:"MathJax mjx-output-error",jax:this.outputJax.name},[this.adaptor.node("span",{"data-mjx-error":e.message,title:e.message,style:{color:"red","background-color":"yellow","line-height":"normal"}},[this.adaptor.text("Math output error")])]),t.display&&this.adaptor.setAttributes(t.typesetRoot,{style:{display:"block",margin:"1em 0","text-align":"center"}}),t.outputData.error=e.message}getMetrics(){return this.processed.isSet("getMetrics")||(this.outputJax.getMetrics(this),this.processed.set("getMetrics")),this}updateDocument(){if(!this.processed.isSet("updateDocument")){for(const t of this.math.reversed())t.updateDocument(this);this.processed.set("updateDocument")}return this}removeFromDocument(t=!1){return this}state(t,e=!1){for(const s of this.math)s.state(t,e);return te.reset(...t.inputJax)),t.outputJax&&this.outputJax.reset(...t.outputJax),this}clear(){return this.reset(),this.math.clear(),this}done(){return Promise.resolve()}concat(t){return this.math.merge(t),this}clearMathItemsWithin(t){const e=this.getMathItemsWithin(t);for(const t of e.slice(0).reverse())t.clear();return this.math.remove(...e),e}getMathItemsWithin(t){Array.isArray(t)||(t=[t]);const e=this.adaptor,s=[],i=e.getElements(t,this.document);t:for(const t of this.math)for(const r of i)if(t.start.node&&e.contains(r,t.start.node)){s.push(t);continue t}return s}}zn.KIND="MathDocument",zn.OPTIONS={OutputJax:null,InputJax:null,MmlFactory:null,MathList:Wn,MathItem:class extends or{},compileError:(t,e,s)=>{t.compileError(e,s)},typesetError:(t,e,s)=>{t.typesetError(e,s)},renderActions:wi({find:[ar.FINDMATH,"findMath","",!1],compile:[ar.COMPILED],metrics:[ar.METRICS,"getMetrics","",!1],typeset:[ar.TYPESET],update:[ar.INSERTED,"updateDocument",!1]})},zn.ProcessBits=On("findMath","compile","getMetrics","typeset","updateDocument");class qn extends zn{}class Vn{constructor(t,e=5){this.documentClass=qn,this.adaptor=t,this.priority=e}get name(){return this.constructor.NAME}handlesDocument(t){return!1}create(t,e){return new this.documentClass(t,this.adaptor,e)}}Vn.NAME="generic";class Xn extends gi{register(t){return this.add(t,t.priority)}unregister(t){this.remove(t)}handlesDocument(t){for(const e of this){const s=e.item;if(s.handlesDocument(t))return s}throw new Error("Can't find handler for document")}document(t,e=null){return this.handlesDocument(t).create(t,e)}}class Gn{static methodName(t){return"visit"+(t.charAt(0).toUpperCase()+t.substring(1)).replace(/[^a-z0-9_]/gi,"_")+"Node"}constructor(t){this.nodeHandlers=new Map;for(const e of t.getKinds()){const t=this[Gn.methodName(e)];t&&this.nodeHandlers.set(e,t)}}visitTree(t,...e){return this.visitNode(t,...e)}visitNode(t,...e){return(this.nodeHandlers.get(t.kind)||this.visitDefault).call(this,t,...e)}visitDefault(t,...e){if("childNodes"in t)for(const s of t.childNodes)this.visitNode(s,...e)}setNodeHandler(t,e){this.nodeHandlers.set(t,e)}removeNodeHandler(t){this.nodeHandlers.delete(t)}}const Jn="data-mjx-";class Kn extends Gn{constructor(t=null){t||(t=new wn),super(t)}visitTextNode(t,...e){}visitXMLNode(t,...e){}visitHtmlNode(t,...e){}getKind(t){const e=t.kind;return Hi(e,this.constructor.rename,e)}getAttributeList(t){const e=this.constructor,s=Hi(t.kind,e.defaultAttributes,{}),i=Object.assign({},s,this.getDataAttributes(t),t.attributes.getAllAttributes()),r=e.variants;return Object.hasOwn(i,"mathvariant")&&(Object.hasOwn(r,i.mathvariant)?i.mathvariant=r[i.mathvariant]:t.getProperty("ignore-variant")&&delete i.mathvariant),i}getDataAttributes(t){const e={},s=t.attributes.getExplicit("mathvariant"),i=this.constructor.variants;s&&(t.getProperty("ignore-variant")||Object.hasOwn(i,s))&&this.setDataAttribute(e,"variant",s),t.getProperty("variantForm")&&this.setDataAttribute(e,"alternate","1"),t.getProperty("pseudoscript")&&this.setDataAttribute(e,"pseudoscript","true"),!1===t.getProperty("autoOP")&&this.setDataAttribute(e,"auto-op","false");const r=t.getProperty("vbox");r&&this.setDataAttribute(e,"vbox",r);const n=t.getProperty("scriptalign");n&&this.setDataAttribute(e,"script-align",n);const o=t.getProperty("mathaccent");void 0!==o&&(o&&!t.isMathAccent()||!o&&!t.isMathAccentWithWidth())&&this.setDataAttribute(e,"mathaccent",o.toString());const a=t.getProperty("texClass");if(void 0!==a){let s=!0;if(a===fr.OP&&t.isKind("mi")){const e=t.getText();s=!(e.length>1&&e.match(Mr.operatorName))}s&&this.setDataAttribute(e,"texclass",a<0?"NONE":gr[a])}return t.getProperty("smallmatrix")&&this.setDataAttribute(e,"smallmatrix","true"),e}setDataAttribute(t,e,s){t[Jn+e]=s}}Kn.rename={TeXAtom:"mrow"},Kn.variants={"-tex-calligraphic":"script","-tex-bold-calligraphic":"bold-script","-tex-oldstyle":"normal","-tex-bold-oldstyle":"bold","-tex-mathit":"italic"},Kn.defaultAttributes={math:{xmlns:"http://www.w3.org/1998/Math/MathML"}};class $n extends Kn{constructor(){super(...arguments),this.document=null}visitTree(t,e){this.document=e;const s=e.createElement("top");return this.visitNode(t,s),this.document=null,s.firstChild}visitTextNode(t,e){e.appendChild(this.document.createTextNode(t.getText()))}visitXMLNode(t,e){e.appendChild(t.getXML().cloneNode(!0))}visitHtmlNode(t,e){e.appendChild(t.getHTML().cloneNode(!0))}visitInferredMrowNode(t,e){for(const s of t.childNodes)this.visitNode(s,e)}visitDefault(t,e){const s=this.document.createElement(this.getKind(t));this.addAttributes(t,s);for(const e of t.childNodes)this.visitNode(e,s);e.appendChild(s)}addAttributes(t,e){const s=this.getAttributeList(t);for(const t of Object.keys(s))e.setAttribute(t,s[t].toString())}}class Yn extends Kn{visitTree(t){return this.visitNode(t,"")}visitTextNode(t,e){return this.quoteHTML(t.getText())}visitXMLNode(t,e){return e+t.getSerializedXML()}visitHtmlNode(t,e){return t.getSerializedHTML()}visitInferredMrowNode(t,e){const s=[];for(const i of t.childNodes)s.push(this.visitNode(i,e));return s.join("\n")}visitAnnotationNode(t,e){const s=this.childNodeMml(t,"","");return`${e}${s}`}visitDefault(t,e){const s=this.getKind(t),[i,r]=t.isToken||0===t.childNodes.length?["",""]:["\n",e],n=this.childNodeMml(t,e+" ",i),o=n.match(/\S/)?i+n+r:"";return`${e}<${s}${this.getAttributes(t)}>${o}`}childNodeMml(t,e,s){let i="";for(const r of t.childNodes)i+=this.visitNode(r,e)+s;return i}getAttributes(t){const e=[],s=this.getAttributeList(t);for(const t of Object.keys(s)){const i=String(s[t]);void 0!==i&&e.push(t+'="'+this.quoteHTML(i)+'"')}return e.length?" "+e.join(" "):""}quoteHTML(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/[\uD800-\uDBFF]./g,this.toEntity).replace(/[\u0080-\uD7FF\uE000-\uFFFF]/g,this.toEntity)}toEntity(t){return qr(t)}}class Qn{get kind(){return this.node.kind}constructor(t,e){this.factory=t,this.node=e}wrap(t){return this.factory.wrap(t)}walkTree(t,e){if(t(this,e),"childNodes"in this)for(const s of this.childNodes)s&&s.walkTree(t,e);return e}}class Zn extends cr{wrap(t,...e){return this.create(t.kind,t,...e)}}const to={version:ri,context:pi,handlers:new Xn,document:function(t,e){return to.handlers.document(t,e)},handleRetriesFor:Dn,retryAfter:Pn,asyncLoad:null,asyncIsSynchronous:!1};class eo extends or{get adaptor(){return this.inputJax.adaptor}constructor(t,e,s=!0,i={node:null,n:0,delim:""},r={node:null,n:0,delim:""}){super(t,e,s,i,r)}updateDocument(t){if(this.state()=ar.TYPESET){const e=this.adaptor,s=this.start.node;let i=e.text("");if(t){const t=this.start.delim+this.math+this.end.delim;if(this.inputJax.processStrings)i=e.text(t);else{const s=e.parse(t,"text/html");i=e.firstChild(e.body(s))}}e.parent(s)&&e.replace(i,s),this.start.node=this.end.node=i,this.start.n=this.end.n=0}}}class so extends rr{}class io{constructor(t=null){const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t),this.init(),this.getPatterns()}init(){this.strings=[],this.string="",this.snodes=[],this.nodes=[],this.stack=[]}getPatterns(){const t=ki(this.options.skipHtmlTags),e=ki(this.options.ignoreHtmlClass),s=ki(this.options.processHtmlClass);this.skipHtmlTags=new RegExp("^(?:"+t.join("|")+")$","i"),this.ignoreHtmlClass=new RegExp("(?:^| )(?:"+e.join("|")+")(?: |$)"),this.processHtmlClass=new RegExp("(?:^| )(?:"+s+")(?: |$)")}pushString(){this.string.match(/\S/)&&(this.strings.push(this.string),this.nodes.push(this.snodes)),this.string="",this.snodes=[]}extendString(t,e){this.snodes.push([t,e.length]),this.string+=e}handleText(t,e){return e||this.extendString(t,this.adaptor.value(t)),this.adaptor.next(t)}handleTag(t,e){if(!e){const e=this.options.includeHtmlTags[this.adaptor.kind(t)];e instanceof Function?this.extendString(t,e(t,this.adaptor)):this.extendString(t,e)}return this.adaptor.next(t)}handleContainer(t,e){this.pushString();const s=this.adaptor.getAttribute(t,"class")||"",i=this.adaptor.kind(t)||"",r=this.processHtmlClass.exec(s);let n=t;return!this.adaptor.firstChild(t)||this.adaptor.getAttribute(t,"data-MJX")||!r&&this.skipHtmlTags.exec(i)?n=this.adaptor.next(t):(this.adaptor.next(t)&&this.stack.push([this.adaptor.next(t),e]),n=this.adaptor.firstChild(t),e=(e||this.ignoreHtmlClass.exec(s))&&!r),[n,e]}handleOther(t,e){return this.pushString(),this.adaptor.next(t)}find(t){this.init();const e=this.adaptor.next(t);let s=!1;const i=this.options.includeHtmlTags;for(;t&&t!==e;){const e=this.adaptor.kind(t);"#text"===e?t=this.handleText(t,s):Object.hasOwn(i,e)?t=this.handleTag(t,s):e?[t,s]=this.handleContainer(t,s):t=this.handleOther(t,s),!t&&this.stack.length&&(this.pushString(),[t,s]=this.stack.pop())}this.pushString();const r=[this.strings,this.nodes];return this.init(),r}}io.OPTIONS={skipHtmlTags:["script","noscript","style","textarea","pre","code","math","select","option","mjx-container"],includeHtmlTags:wi({br:"\n",wbr:"","#comment":""}),ignoreHtmlClass:"mathjax_ignore",processHtmlClass:"mathjax_process"},lr("STYLES",ar.INSERTED+1);class ro extends zn{constructor(t,e,s){const[i,r]=Ui(s,io.OPTIONS);super(t,e,i),this.domStrings=this.options.DomStrings||new io(r),this.domStrings.adaptor=e,this.styles=[]}findPosition(t,e,s,i){const r=this.adaptor,n=1/(i[t].length||1);let o=t;for(const[a,l]of i[t]){if(e<=l&&"#text"===r.kind(a))return{i:o,node:a,n:Math.max(e,0),delim:s};e-=l,o+=n}return{node:null,n:0,delim:s}}mathItem(t,e,s){const i=t.math,r=this.findPosition(t.n,t.start.n,t.open,s),n=this.findPosition(t.n,t.end.n,t.close,s);return new this.options.MathItem(i,e,t.display,r,n)}findMath(t){if(!this.processed.isSet("findMath")){this.adaptor.document=this.document,t=Fi({elements:this.options.elements||[this.adaptor.body(this.document)]},t);const e=this.adaptor.getElements(t.elements,this.document);for(const t of this.inputJax){const s=t.processStrings?this.findMathFromStrings(t,e):this.findMathFromDOM(t,e);this.math.merge(s)}this.processed.set("findMath")}return this}findMathFromStrings(t,e){const s=[],i=[];for(const t of e){const[e,r]=this.domStrings.find(t);s.push(...e),i.push(...r)}const r=new this.options.MathList;for(const e of t.findMath(s))r.push(this.mathItem(e,t,i));return r}findMathFromDOM(t,e){const s=[];for(const i of e)for(const e of t.findMath(i))s.push(new this.options.MathItem(e.math,t,e.display,e.start,e.end));return new this.options.MathList(...s)}updateDocument(){return this.processed.isSet("updateDocument")||(this.addPageElements(),this.addStyleSheet(),super.updateDocument(),this.processed.set("updateDocument")),this}addPageElements(){const t=this.adaptor,e=t.body(this.document),s=this.documentPageElements();if(s){const i=t.firstChild(e);i?t.insert(s,i):t.append(e,s)}}addStyleSheet(){const t=this.documentStyleSheet(),e=this.adaptor;if(t&&!e.parent(t)){const s=e.head(this.document),i=this.findSheet(s,e.getAttribute(t,"id"));i?e.replace(t,i):e.append(s,t)}}findSheet(t,e){if(e)for(const s of this.adaptor.tags(t,"style"))if(this.adaptor.getAttribute(s,"id")===e)return s;return null}removeFromDocument(t=!1){if(this.processed.isSet("updateDocument"))for(const e of this.math)e.state()>=ar.INSERTED&&e.state(ar.TYPESET,t);return this.processed.clear("updateDocument"),this}documentStyleSheet(){return this.outputJax.styleSheet(this)}documentPageElements(){return this.outputJax.pageElements(this)}addStyles(t){this.styles.push(t),"insertStyles"in this.outputJax&&this.outputJax.insertStyles(t)}getStyles(){return this.styles}}ro.KIND="HTML",ro.OPTIONS=Object.assign(Object.assign({},zn.OPTIONS),{renderActions:wi(Object.assign(Object.assign({},zn.OPTIONS.renderActions),{styles:[ar.STYLES,"","updateStyleSheet",!1]})),MathList:so,MathItem:eo,DomStrings:null});class no extends Vn{constructor(){super(...arguments),this.documentClass=ro}handlesDocument(t){const e=this.adaptor;if("string"==typeof t)try{t=e.parse(t,"text/html")}catch(t){}return t instanceof e.window.Document||t instanceof e.window.HTMLElement||t instanceof e.window.DocumentFragment}create(t,e){const s=this.adaptor;if("string"==typeof t)t=s.parse(t,"text/html");else if(t instanceof s.window.HTMLElement||t instanceof s.window.DocumentFragment){const e=t;t=s.parse("","text/html"),s.append(s.body(t),e)}return super.create(t,e)}}function oo(t){const e=new no(t);return to.handlers.register(e),e}class ao{get cssText(){return this.getStyleString()}constructor(t=null){this.styles={},this.addStyles(t)}addStyles(t){if(t)for(const e of Object.keys(t))this.styles[e]||(this.styles[e]={}),Object.assign(this.styles[e],t[e])}removeStyles(...t){for(const e of t)delete this.styles[e]}clear(){this.styles={}}getStyleString(){return this.getStyleRules().join("\n\n")}getStyleRules(t=this.styles,e=""){const s=Object.keys(t),i=new Array(s.length);let r=0;for(const n of s){const s=t[n];i[r++]=`${e}${n} {\n${this.getStyleDefString(s,e)}\n${e}}`}return i}getStyleDefString(t,e){const s=Object.keys(t),i=new Array(s.length);let r=0;for(const n of s)i[r++]=t[n]instanceof Object?e+this.getStyleRules({[n]:t[n]},e+" ").join("\n"+e):" "+e+n+": "+t[n]+";";return i.join("\n"+e)}}var lo;const co=!!(null===(lo=pi.window)||void 0===lo?void 0:lo.HTMLDialogElement);class ho{constructor(t){this.minW=200,this.minH=80,this.tx=0,this.ty=0,this.dragging=!1,this.events=[["mousemove",this.MouseMove.bind(this)],["mouseup",this.MouseUp.bind(this)]],this.mode="",this.actions={down:{move:t=>{t.dialog.classList.add("mjx-moving")}},move:{move:(t,e)=>[e.x-t.x,e.y-t.y,0,0],top:(t,e)=>[0,(e.y-t.y)/2,0,t.y-e.y],bottom:(t,e)=>[0,(e.y-t.y)/2,0,e.y-t.y],left:(t,e)=>[(e.x-t.x)/2,0,t.x-e.x,0],right:(t,e)=>[(e.x-t.x)/2,0,e.x-t.x,0],topleft:(t,e)=>[(e.x-t.x)/2,(e.y-t.y)/2,t.x-e.x,t.y-e.y],topright:(t,e)=>[(e.x-t.x)/2,(e.y-t.y)/2,e.x-t.x,t.y-e.y],botleft:(t,e)=>[(e.x-t.x)/2,(e.y-t.y)/2,t.x-e.x,e.y-t.y],botright:(t,e)=>[(e.x-t.x)/2,(e.y-t.y)/2,e.x-t.x,e.y-t.y]},up:{move:t=>{t.dialog.classList.remove("mjx-moving")}},keymove:{left:()=>[-5,0,0,0],right:()=>[5,0,0,0],up:()=>[0,-5,0,0],down:()=>[0,5,0,0]},bigmove:{left:()=>[-20,0,0,0],right:()=>[20,0,0,0],up:()=>[0,-20,0,0],down:()=>[0,20,0,0]},keysize:{left:()=>[-3,0,-6,0],right:()=>[3,0,6,0],up:()=>[0,-3,0,-6],down:()=>[0,3,0,6]},bigsize:{left:()=>[-10,0,-20,0],right:()=>[10,0,20,0],up:()=>[0,-10,0,-20],down:()=>[0,10,0,20]}};const{adaptor:e,node:s=null}=t;this.init(e),this.node=s,this.background=co?null:e.node("mjx-dialog-background"),this.x=this.y=0,this.dragging=!1,this.action="",this.dialog=this.html(t),this.title=this.dialog.firstChild.firstChild.firstChild,this.content=this.dialog.firstChild.firstChild.nextSibling;const i=this.dialog.lastChild;i.addEventListener("click",this.closeDialog.bind(this)),i.addEventListener("keydown",this.actionKey.bind(this,this.closeDialog.bind(this)));const r=this.dialog.lastChild.previousSibling;r.addEventListener("click",this.helpDialog.bind(this,e)),r.addEventListener("keydown",this.actionKey.bind(this,this.helpDialog.bind(this,e))),this.noDrag=Array.from(this.dialog.querySelectorAll('[data-drag="none"]'))}init(t){const e=this.constructor;if(!t.document.head.querySelector("#"+e.styleId)){const s=t.node("style",{id:e.styleId});s.textContent=new ao(e.styles).cssText,t.document.head.append(s)}}html(t){const{title:e,message:s,adaptor:i,styles:r=null,extraNodes:n=[],className:o=ho.className}=t;if(r){const t=i.node("style");t.textContent=new ao(r).cssText,n.unshift(t)}const a="mjx-dialog-label-"+ho.id++,l=i.node("dialog",{closedby:"any",class:("mjx-dialog "+o).trim()},[i.node("mjx-dialog",{"aria-labeledby":a},[i.node("mjx-title",{},[i.node("h1",{id:a,tabIndex:0})]),i.node("div",{"data-drag":"none",tabIndex:0})]),...n,i.node("mjx-dialog-spacer",{"aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"top","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"bottom","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"left","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"right","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"topleft","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"topright","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"botleft","aria-hidden":!0}),i.node("mjx-dialog-drag",{"data-drag":"botright","aria-hidden":!0}),i.node("mjx-dialog-help",{class:"mjx-dialog-button","data-drag":"none",tabIndex:0,role:"button","aria-label":"Dialog Help"},[i.node("mjx-dialog-icon",{"aria-hidden":!0},[i.text("?")])]),i.node("mjx-dialog-close",{class:"mjx-dialog-button","data-drag":"none",tabIndex:0,role:"button","aria-label":"Close Dialog Box"},[i.node("mjx-dialog-icon",{"aria-hidden":!0},[i.text("\xd7")])])]);return l.firstChild.firstChild.firstChild.innerHTML=e,l.firstChild.childNodes[1].innerHTML=s,l}attach(){co?(this.dialog.addEventListener("mousedown",this.MouseDown.bind(this)),this.dialog.addEventListener("keydown",this.KeyDown.bind(this),!0),document.body.append(this.dialog),this.dialog.showModal()):(this.background.addEventListener("mousedown",this.MouseDown.bind(this)),this.background.addEventListener("keydown",this.KeyDown.bind(this),!0),this.dialog.setAttribute("tabindex","0"),this.dialog.addEventListener("click",this.stop),this.background.append(this.dialog),document.body.append(this.background)),pi.window.addEventListener("visibilitychange",this.Visibility.bind(this)),this.minW=Math.min(this.minW,this.dialog.clientWidth-8),this.minH=Math.min(this.minH,this.dialog.clientHeight-this.title.offsetHeight-8),this.title.focus()}dragAction(t,e=null){e&&this.stop(e);const s=this.actions[t][this.action],i=s?s(this,e):null;if(!i)return;let[r,n,o,a]=i;if(o){const t=this.w+o;t>=this.minW?(this.x=null==e?void 0:e.x,this.w=t,this.dialog.style.maxWidth=this.dialog.style.width=t+"px"):r=0}if(a){const t=this.h+a;t>=this.minH+this.title.offsetHeight?(this.y=null==e?void 0:e.y,this.h=t,this.dialog.style.maxHeight=this.dialog.style.height=t+"px"):n=0}(r||n)&&(r&&(this.x=null==e?void 0:e.x,this.tx+=r||0),n&&(this.y=null==e?void 0:e.y,this.ty+=n||0),this.dialog.style.transform=`translate(${this.tx}px, ${this.ty}px)`)}MouseDown(t){const e=t.target;if(!(1!==t.buttons||t.shiftKey||t.metaKey||t.altKey||t.ctrlKey))if(this.inDialog(t)){for(const t of this.noDrag)if(e===t||t.contains(e))return;this.action=e.getAttribute("data-drag")||"move",this.startDrag(t),this.dragAction("down",t)}else this.closeDialog(t)}MouseMove(t){1!==t.buttons&&this.endDrag(),this.dragging&&this.dragAction("move",t)}MouseUp(t){this.dragging&&(this.dragAction("up",t),this.endDrag())}Visibility(){pi.document.hidden&&this.closeDialog()}KeyDown(t){const e=this.constructor.keyActions.get(t.key);e&&e(this,t)}escKey(t){this.closeDialog(t)}aKey(t){(t.ctrlKey||t.metaKey)&&(this.selectAll(),this.stop(t))}mKey(t){this.mode="move"===this.mode?"":"move",this.stop(t)}sKey(t){this.mode="size"===this.mode?"":"size",this.stop(t)}arrowKey(t,e){t.ctrlKey||this.dragging||(this.action=e,this.getWH(),t.altKey||"move"===this.mode?(this.dragAction(t.shiftKey?"bigmove":"keymove"),this.stop(t)):(t.metaKey||"size"===this.mode)&&(this.dragAction(t.shiftKey?"bigsize":"keysize"),this.stop(t)),this.action="")}actionKey(t,e){"Enter"!==e.code&&"Space"!==e.code||t(e)}selectAll(){document.getSelection().selectAllChildren(this.content)}copyToClipboard(){this.selectAll();try{document.execCommand("copy")}catch(t){alert(`Can't copy to clipboard: ${t.message}`)}document.getSelection().removeAllRanges()}startDrag(t){this.x=t.x,this.y=t.y,this.getWH(),this.dragging=!0;const e=this.background||this.dialog;for(const[t,s]of this.events)e.addEventListener(t,s)}getWH(){this.w=this.dialog.clientWidth-8,this.h=this.dialog.clientHeight-8}endDrag(){this.action="",this.dragging=!1;const t=this.background||this.dialog;for(const[e,s]of this.events)t.removeEventListener(e,s)}closeDialog(t){var e;co?(this.dialog.close(),this.dialog.remove()):this.background.remove(),null===(e=this.node)||void 0===e||e.focus(),t&&this.stop(t)}helpDialog(t,e){new ho({title:"MathJax Dialog Help",message:this.constructor.helpMessage,adaptor:t,className:"mjx-dialog-help",styles:{".mjx-dialog-help":{"max-width":"calc(min(50em, 80%))"}}}).attach(),this.stop(e)}inDialog(t){if(!this.dialog.contains(t.target))return!1;const{x:e,y:s}=t,{left:i,right:r,top:n,bottom:o}=this.dialog.getBoundingClientRect();return e>=i&&e<=r&&s>=n&&s<=o}stop(t){t.preventDefault&&t.preventDefault(),t.stopImmediatePropagation?t.stopImmediatePropagation():t.stopPropagation&&t.stopPropagation()}}ho.keyActions=new Map([["Escape",(t,e)=>t.escKey(e)],["a",(t,e)=>t.aKey(e)],["m",(t,e)=>t.mKey(e)],["s",(t,e)=>t.sKey(e)],["ArrowRight",(t,e)=>t.arrowKey(e,"right")],["ArrowLeft",(t,e)=>t.arrowKey(e,"left")],["ArrowUp",(t,e)=>t.arrowKey(e,"up")],["ArrowDown",(t,e)=>t.arrowKey(e,"down")]]),ho.styleId="MJX-DIALOG-styles",ho.className="",ho.id=0,ho.styles={"mjx-dialog-background":{display:"flex","flex-direction":"column","justify-content":"center",position:"fixed",top:0,left:0,right:0,bottom:0,"z-index":1001},".mjx-dialog":{"max-width":"calc(min(60em, 90%))","max-height":"calc(min(50em, 85%))",border:"3px outset","border-radius":"15px",color:"black","background-color":"#DDDDDD","box-shadow":"0px 10px 20px #808080",padding:"4px 4px",cursor:"grab",overflow:"visible",display:"flex","flex-direction":"column","align-items":"center",position:"fixed",top:"-4%"},".mjx-dialog.mjx-moving":{cursor:"grabbing"},'.mjx-dialog > input[type="button"]':{width:"fit-content"},".mjx-dialog > mjx-dialog-spacer":{display:"block",height:".75em","flex-shrink":0},".mjx-dialog::backdrop":{opacity:0,cursor:"default"},"mjx-dialog":{all:"initial",cursor:"inherit",width:"100%",display:"flex","flex-direction":"column","flex-grow":1,"flex-shrink":1,overflow:"hidden"},"mjx-dialog > mjx-title":{display:"block","text-align":"center",margin:".25em 1.75em",overflow:"hidden","white-space":"nowrap","-webkit-user-select":"none","user-select":"none","flex-shrink":0},"mjx-dialog > mjx-title > h1":{"font-size":"125%",margin:0},"mjx-dialog > div":{margin:"0 1em .5em",padding:"8px 18px",overflow:"auto",border:"2px inset black","background-color":"white","text-align":"left",cursor:"default","flex-grow":1,"flex-shrink":1},"mjx-dialog > div > pre":{margin:0},".mjx-dialog-button":{position:"absolute",top:"6px",height:"17px",width:"17px",cursor:"default",display:"block",border:"2px solid #AAA","border-radius":"18px","font-family":'"Courier New", Courier',"text-align":"center",color:"#F0F0F0","-webkit-user-select":"none","user-select":"none"},".mjx-dialog-button:hover":{color:"white !important",border:"2px solid #CCC !important"},".mjx-dialog-button > mjx-dialog-icon":{display:"block","background-color":"#AAA",border:"1.5px solid","border-radius":"18px","line-height":0,padding:"8px 0 6px"},".mjx-dialog-button > mjx-dialog-icon:hover":{"background-color":"#CCC !important"},"mjx-dialog-close":{right:"6px","font-size":"20px;"},"mjx-dialog-help":{left:"6px","font-size":"14px;","font-weight":"bold"},".mjx-dialog-help mjx-dialog-help":{display:"none"},"mjx-dialog kbd":{display:"inline-block",padding:"3px 5px","font-size":"11px","line-height":"10px",color:"#444d56","vertical-align":"middle","background-color":"#fafbfc",border:"solid 1.5px #c6cbd1","border-bottom-color":"#959da5","border-radius":"3px","box-shadow":"inset -.5px -1px 0 #959da5"},'mjx-dialog-drag[data-drag="top"]':{height:"5px",position:"absolute",top:"-3px",left:"10px",right:"10px",cursor:"ns-resize"},'mjx-dialog-drag[data-drag="bottom"]':{height:"5px",position:"absolute",bottom:"-3px",left:"10px",right:"10px",cursor:"ns-resize"},'mjx-dialog-drag[data-drag="left"]':{width:"5px",position:"absolute",left:"-3px",top:"10px",bottom:"10px",cursor:"ew-resize"},'mjx-dialog-drag[data-drag="right"]':{width:"5px",position:"absolute",right:"-3px",top:"10px",bottom:"10px",cursor:"ew-resize"},'mjx-dialog-drag[data-drag="topleft"]':{width:"13px",height:"13px",position:"absolute",left:"-3px",top:"-3px",cursor:"nwse-resize"},'mjx-dialog-drag[data-drag="topright"]':{width:"13px",height:"13px",position:"absolute",right:"-3px",top:"-3px",cursor:"nesw-resize"},'mjx-dialog-drag[data-drag="botleft"]':{width:"13px",height:"13px",position:"absolute",left:"-3px",bottom:"-3px",cursor:"nesw-resize"},'mjx-dialog-drag[data-drag="botright"]':{width:"13px",height:"13px",position:"absolute",right:"-3px",bottom:"-3px",cursor:"nwse-resize"},"@media (prefers-color-scheme: dark)":{".mjx-dialog":{"background-color":"#303030","box-shadow":"0px 10px 20px #000",border:"3px outset #7C7C7C"},"mjx-dialog":{color:"#E0E0E0"},"mjx-dialog > div":{border:"2px inset #7C7C7C","background-color":"#222025"},".mjx-dialog a[href]":{color:"#86A7F5"},".mjx-dialog a[href]:visited":{color:"#DD98E2"},"mjx-dialog kbd":{color:"#F8F8F8","background-color":"#545454",border:"solid 1.5px #7A7C7E","border-bottom-color":"#707070","box-shadow":"inset -.5px -1px 0 #818589"},".mjx-dialog-button":{border:"2px solid #686868",color:"#A4A4A4"},".mjx-dialog-button:hover":{color:"#CBCBCB !important",border:"2px solid #888888 !important"},".mjx-dialog-button > mjx-dialog-icon":{"background-color":"#646464"},".mjx-dialog-button > mjx-dialog-icon:hover":{"background-color":"#888888 !important"}}},ho.helpMessage='\n

The dialog boxes in MathJax are movable and sizeable.

\n\n

For mouse users, dragging any of the edges will enlarge or shrink\n the dialog box by moving that side. Dragging any of the corners\n changes the two sides that meet at that corner. Dragging elsewhere on\n the dialog frame will move the dialog without changing its size.

\n\n

For keyboard users, there are two ways to adjust the position\n and size of the dialog box. The first is to hold the\n Alt or Option key and press any of the arrow\n keys to move the dialog box in the given direction. Hold the\n Win or Command key and press any of the\n arrow keys to enlarge or shrink the dialog box. Left and right\n move the right-hand edge of the dialog, while up and down move the\n bottom edge of the dialog.\n

\n\n

For some users, holding two keys down at once may be difficult,\n so the second way is to press the m to start "move"\n mode, then use the arrow keys to move the dialog box in the given\n direction. Press m again to stop moving the dialog.\n Similarly, press s to start and stop "sizing" mode,\n where the arrows will change the size of the dialog box.

\n\n

Holding a shift key along with the arrow key will\n make larger changes in the size or position, for either method\n described above.

\n\n

Use Tab to move among the text, buttons, and links\n within the dialog. The Enter or Space key\n activates the focused item. The Escape key closes the\n dialog, as does clicking outside the dialog box, or clicking the\n "\xd7" icon in the upper right-hand corner of the dialog.

\n ';class uo extends ho{static post(t){const e=new this(t);return e.attach(),e}}function po(t){return to.asyncLoad?new Promise((e,s)=>{const i=to.asyncLoad(t);i instanceof Promise?i.then(t=>e(t)).catch(t=>s(t)):e(i)}):Promise.reject(`Can't load '${t}': No mathjax.asyncLoad method specified`)}const mo=1e6,fo={px:1,in:96,cm:96/2.54,mm:96/25.4},go={em:1,ex:.431,pt:.1,pc:1.2,mu:1/18},bo={veryverythinmathspace:1/18,verythinmathspace:2/18,thinmathspace:3/18,mediummathspace:4/18,thickmathspace:5/18,verythickmathspace:6/18,veryverythickmathspace:7/18,negativeveryverythinmathspace:-1/18,negativeverythinmathspace:-2/18,negativethinmathspace:-3/18,negativemediummathspace:-4/18,negativethickmathspace:-5/18,negativeverythickmathspace:-6/18,negativeveryverythickmathspace:-7/18,thin:.04,medium:.06,thick:.1,normal:1,big:2,small:1/Math.sqrt(2),infinity:mo};function Eo(t,e=0,s=1,i=16){if("string"!=typeof t&&(t=String(t)),""===t||null==t)return e;if(bo[t])return bo[t];const r=t.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);if(!r||""===r[0])return e;const n=parseFloat(r[1]||"1"),o=r[2];return Object.hasOwn(fo,o)?n*fo[o]/i/s:Object.hasOwn(go,o)?n*go[o]:"%"===o?n/100*e:n*e}function xo(t){return(100*t).toFixed(1).replace(/\.?0+$/,"")+"%"}function yo(t){return Math.abs(t)<.001?"0":t.toFixed(3).replace(/\.?0+$/,"")+"em"}function No(t,e=-mo,s=16){return t*=s,e&&tthis.w&&(this.w=r),n>this.h&&(this.h=n),o>this.d&&(this.d=o)}append(t){const 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)}updateFrom(t){this.h=t.h,this.d=t.d,this.w=t.w,t.pwidth&&(this.pwidth=t.pwidth)}copy(){const t=new vo;return Object.assign(t,this),t}}vo.fullWidth="100%",vo.boxSides=[["Top",0,"h"],["Right",1,"w"],["Bottom",2,"d"],["Left",3,"w"]];const To={loadMissingEntities:!0},Co={ApplyFunction:"\u2061",Backslash:"\u2216",Because:"\u2235",Breve:"\u02d8",Cap:"\u22d2",CenterDot:"\xb7",CircleDot:"\u2299",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",Congruent:"\u2261",ContourIntegral:"\u222e",Coproduct:"\u2210",Cross:"\u2a2f",Cup:"\u22d3",CupCap:"\u224d",Dagger:"\u2021",Del:"\u2207",Delta:"\u0394",Diamond:"\u22c4",DifferentialD:"\u2146",DotEqual:"\u2250",DoubleDot:"\xa8",DoubleRightTee:"\u22a8",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",DownLeftVector:"\u21bd",DownRightVector:"\u21c1",DownTee:"\u22a4",Downarrow:"\u21d3",Element:"\u2208",EqualTilde:"\u2242",Equilibrium:"\u21cc",Exists:"\u2203",ExponentialE:"\u2147",FilledVerySmallSquare:"\u25aa",ForAll:"\u2200",Gamma:"\u0393",Gg:"\u22d9",GreaterEqual:"\u2265",GreaterEqualLess:"\u22db",GreaterFullEqual:"\u2267",GreaterLess:"\u2277",GreaterSlantEqual:"\u2a7e",GreaterTilde:"\u2273",Hacek:"\u02c7",Hat:"^",HumpDownHump:"\u224e",HumpEqual:"\u224f",Im:"\u2111",ImaginaryI:"\u2148",Integral:"\u222b",Intersection:"\u22c2",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",Lambda:"\u039b",Larr:"\u219e",LeftAngleBracket:"\u27e8",LeftArrow:"\u2190",LeftArrowRightArrow:"\u21c6",LeftCeiling:"\u2308",LeftDownVector:"\u21c3",LeftFloor:"\u230a",LeftRightArrow:"\u2194",LeftTee:"\u22a3",LeftTriangle:"\u22b2",LeftTriangleEqual:"\u22b4",LeftUpVector:"\u21bf",LeftVector:"\u21bc",Leftarrow:"\u21d0",Leftrightarrow:"\u21d4",LessEqualGreater:"\u22da",LessFullEqual:"\u2266",LessGreater:"\u2276",LessSlantEqual:"\u2a7d",LessTilde:"\u2272",Ll:"\u22d8",Lleftarrow:"\u21da",LongLeftArrow:"\u27f5",LongLeftRightArrow:"\u27f7",LongRightArrow:"\u27f6",Longleftarrow:"\u27f8",Longleftrightarrow:"\u27fa",Longrightarrow:"\u27f9",Lsh:"\u21b0",MinusPlus:"\u2213",NestedGreaterGreater:"\u226b",NestedLessLess:"\u226a",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotExists:"\u2204",NotGreater:"\u226f",NotGreaterEqual:"\u2271",NotLeftTriangle:"\u22ea",NotLeftTriangleEqual:"\u22ec",NotLess:"\u226e",NotLessEqual:"\u2270",NotPrecedes:"\u2280",NotPrecedesSlantEqual:"\u22e0",NotRightTriangle:"\u22eb",NotRightTriangleEqual:"\u22ed",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsSlantEqual:"\u22e1",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotVerticalBar:"\u2224",Omega:"\u03a9",OverBar:"\u203e",OverBrace:"\u23de",PartialD:"\u2202",Phi:"\u03a6",Pi:"\u03a0",PlusMinus:"\xb1",Precedes:"\u227a",PrecedesEqual:"\u2aaf",PrecedesSlantEqual:"\u227c",PrecedesTilde:"\u227e",Product:"\u220f",Proportional:"\u221d",Psi:"\u03a8",Rarr:"\u21a0",Re:"\u211c",ReverseEquilibrium:"\u21cb",RightAngleBracket:"\u27e9",RightArrow:"\u2192",RightArrowLeftArrow:"\u21c4",RightCeiling:"\u2309",RightDownVector:"\u21c2",RightFloor:"\u230b",RightTee:"\u22a2",RightTeeArrow:"\u21a6",RightTriangle:"\u22b3",RightTriangleEqual:"\u22b5",RightUpVector:"\u21be",RightVector:"\u21c0",Rightarrow:"\u21d2",Rrightarrow:"\u21db",Rsh:"\u21b1",Sigma:"\u03a3",SmallCircle:"\u2218",Sqrt:"\u221a",Square:"\u25a1",SquareIntersection:"\u2293",SquareSubset:"\u228f",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",Star:"\u22c6",Subset:"\u22d0",SubsetEqual:"\u2286",Succeeds:"\u227b",SucceedsEqual:"\u2ab0",SucceedsSlantEqual:"\u227d",SucceedsTilde:"\u227f",SuchThat:"\u220b",Sum:"\u2211",Superset:"\u2283",SupersetEqual:"\u2287",Supset:"\u22d1",Therefore:"\u2234",Theta:"\u0398",Tilde:"\u223c",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",UnderBar:"_",UnderBrace:"\u23df",Union:"\u22c3",UnionPlus:"\u228e",UpArrow:"\u2191",UpDownArrow:"\u2195",UpTee:"\u22a5",Uparrow:"\u21d1",Updownarrow:"\u21d5",Upsilon:"\u03a5",Vdash:"\u22a9",Vee:"\u22c1",VerticalBar:"\u2223",VerticalTilde:"\u2240",Vvdash:"\u22aa",Wedge:"\u22c0",Xi:"\u039e",amp:"&",acute:"\xb4",aleph:"\u2135",alpha:"\u03b1",amalg:"\u2a3f",and:"\u2227",ang:"\u2220",angmsd:"\u2221",angsph:"\u2222",ape:"\u224a",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",beta:"\u03b2",beth:"\u2136",between:"\u226c",bigcirc:"\u25ef",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",blacklozenge:"\u29eb",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",bowtie:"\u22c8",boxdl:"\u2510",boxdr:"\u250c",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxul:"\u2518",boxur:"\u2514",bsol:"\\",bull:"\u2022",cap:"\u2229",check:"\u2713",chi:"\u03c7",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledR:"\xae",circledS:"\u24c8",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",clubs:"\u2663",colon:":",comp:"\u2201",ctdot:"\u22ef",cuepr:"\u22de",cuesc:"\u22df",cularr:"\u21b6",cup:"\u222a",curarr:"\u21b7",curlyvee:"\u22ce",curlywedge:"\u22cf",dagger:"\u2020",daleth:"\u2138",ddarr:"\u21ca",deg:"\xb0",delta:"\u03b4",digamma:"\u03dd",div:"\xf7",divideontimes:"\u22c7",dot:"\u02d9",doteqdot:"\u2251",dotplus:"\u2214",dotsquare:"\u22a1",dtdot:"\u22f1",ecir:"\u2256",efDot:"\u2252",egs:"\u2a96",ell:"\u2113",els:"\u2a95",empty:"\u2205",epsi:"\u03b5",epsiv:"\u03f5",erDot:"\u2253",eta:"\u03b7",eth:"\xf0",flat:"\u266d",fork:"\u22d4",frown:"\u2322",gEl:"\u2a8c",gamma:"\u03b3",gap:"\u2a86",gimel:"\u2137",gnE:"\u2269",gnap:"\u2a8a",gne:"\u2a88",gnsim:"\u22e7",gt:">",gtdot:"\u22d7",harrw:"\u21ad",hbar:"\u210f",hellip:"\u2026",hookleftarrow:"\u21a9",hookrightarrow:"\u21aa",imath:"\u0131",infin:"\u221e",intcal:"\u22ba",iota:"\u03b9",jmath:"\u0237",kappa:"\u03ba",kappav:"\u03f0",lEg:"\u2a8b",lambda:"\u03bb",lap:"\u2a85",larrlp:"\u21ab",larrtl:"\u21a2",lbrace:"{",lbrack:"[",le:"\u2264",leftleftarrows:"\u21c7",leftthreetimes:"\u22cb",lessdot:"\u22d6",lmoust:"\u23b0",lnE:"\u2268",lnap:"\u2a89",lne:"\u2a87",lnsim:"\u22e6",longmapsto:"\u27fc",looparrowright:"\u21ac",lowast:"\u2217",loz:"\u25ca",lt:"<",ltimes:"\u22c9",ltri:"\u25c3",macr:"\xaf",malt:"\u2720",mho:"\u2127",mu:"\u03bc",multimap:"\u22b8",nLeftarrow:"\u21cd",nLeftrightarrow:"\u21ce",nRightarrow:"\u21cf",nVDash:"\u22af",nVdash:"\u22ae",natur:"\u266e",nearr:"\u2197",nharr:"\u21ae",nlarr:"\u219a",not:"\xac",nrarr:"\u219b",nu:"\u03bd",nvDash:"\u22ad",nvdash:"\u22ac",nwarr:"\u2196",omega:"\u03c9",omicron:"\u03bf",or:"\u2228",osol:"\u2298",period:".",phi:"\u03c6",phiv:"\u03d5",pi:"\u03c0",piv:"\u03d6",prap:"\u2ab7",precnapprox:"\u2ab9",precneqq:"\u2ab5",precnsim:"\u22e8",prime:"\u2032",psi:"\u03c8",quot:'"',rarrtl:"\u21a3",rbrace:"}",rbrack:"]",rho:"\u03c1",rhov:"\u03f1",rightrightarrows:"\u21c9",rightthreetimes:"\u22cc",ring:"\u02da",rmoust:"\u23b1",rtimes:"\u22ca",rtri:"\u25b9",scap:"\u2ab8",scnE:"\u2ab6",scnap:"\u2aba",scnsim:"\u22e9",sdot:"\u22c5",searr:"\u2198",sect:"\xa7",sharp:"\u266f",sigma:"\u03c3",sigmav:"\u03c2",simne:"\u2246",smile:"\u2323",spades:"\u2660",sub:"\u2282",subE:"\u2ac5",subnE:"\u2acb",subne:"\u228a",supE:"\u2ac6",supnE:"\u2acc",supne:"\u228b",swarr:"\u2199",tau:"\u03c4",theta:"\u03b8",thetav:"\u03d1",tilde:"\u02dc",times:"\xd7",triangle:"\u25b5",triangleq:"\u225c",upsi:"\u03c5",upuparrows:"\u21c8",veebar:"\u22bb",vellip:"\u22ee",weierp:"\u2118",xi:"\u03be",yen:"\xa5",zeta:"\u03b6",zigrarr:"\u21dd",nbsp:"\xa0",rsquo:"\u2019",lsquo:"\u2018"},Ao={};function Lo(t,e){Object.assign(Co,t),Ao[e]=!0}function So(t){delete Co[t]}function Ro(t){return t.replace(/&([a-z][a-z0-9]*|#(?:[0-9]+|x[0-9a-f]+));/gi,Mo)}function Mo(t,e){if("#"===e.charAt(0))return Io(e.slice(1));if(Co[e])return Co[e];if(To.loadMissingEntities){const t=e.match(/^[a-zA-Z](fr|scr|opf)$/)?RegExp.$1:e.charAt(0).toLowerCase();Ao[t]||(Ao[t]=!0,Pn(po("./util/entities/"+t+".js")))}return t}function Io(t){const e="x"===t.charAt(0)?parseInt(t.slice(1),16):parseInt(t);return String.fromCodePoint(e)}const wo=["top","right","bottom","left"],ko=["width","style","color"];function Oo(t){const e=t.split(/((?:'[^'\n]*'|"[^"\n]*"|,[\s\n]|[^\s\n])*)/g),s=[];for(;e.length>1;)e.shift(),s.push(e.shift());return s}function Do(t){const e=Oo(this.styles[t]);0===e.length&&e.push(""),1===e.length&&e.push(e[0]),2===e.length&&e.push(e[0]),3===e.length&&e.push(e[1]);for(const s of qo.connect[t].children)this.setStyle(this.childName(t,s),e.shift())}function Po(t){const e=qo.connect[t].children,s=[];for(const i of e){const e=this.styles[this.childName(t,i)];if(!e)return void delete this.styles[t];s.push(e)}s[3]===s[1]&&(s.pop(),s[2]===s[0]&&(s.pop(),s[1]===s[0]&&s.pop())),this.styles[t]=s.join(" ")}function Bo(t){Po.call(this,t),this.combineChildren(t),Fo.call(this,t),this.combineParent(t)}function Fo(t){if(!qo.connect[t])return;const e=[...qo.connect[t].children],s=this.styles[this.childName(t,e.shift())];for(const i of e)if(this.styles[this.childName(t,i)]!==s)return void delete this.styles[t];s&&(this.styles[t]=s)}const jo=/^(?:[\d.]+(?:[a-z]+)|thin|medium|thick|inherit|initial|unset)$/,_o=/^(?:none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|unset)$/;function Uo(t){const e={width:"",style:"",color:""};for(const s of Oo(this.styles[t]))s.match(jo)&&""===e.width?e.width=s:s.match(_o)&&""===e.style?e.style=s:e.color=s;for(const s of qo.connect[t].children)this.setStyle(this.childName(t,s),e[s])}function Ho(t){const e=[];for(const s of qo.connect[t].children){const i=this.styles[this.childName(t,s)];i&&e.push(i)}e.length>1?this.styles[t]=e.join(" "):delete this.styles[t]}const Wo={style:/^(?:normal|italic|oblique|inherit|initial|unset)$/,variant:new RegExp("^(?:"+["normal|none","inherit|initial|unset","common-ligatures|no-common-ligatures","discretionary-ligatures|no-discretionary-ligatures","historical-ligatures|no-historical-ligatures","contextual|no-contextual","(?:stylistic|character-variant|swash|ornaments|annotation)\\([^)]*\\)","small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","lining-nums|oldstyle-nums|proportional-nums|tabular-nums","diagonal-fractions|stacked-fractions","ordinal|slashed-zero","jis78|jis83|jis90|jis04|simplified|traditional","full-width|proportional-width","ruby"].join("|")+")$"),weight:/^(?:normal|bold|bolder|lighter|[1-9]00|inherit|initial|unset)$/,stretch:new RegExp("^(?:"+["normal","(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)","inherit|initial|unset"].join("|")+")$"),size:new RegExp("^(?:"+["xx-small|x-small|small|medium|large|x-large|xx-large|larger|smaller","[\\d.]+%|[\\d.]+[a-z]+","inherit|initial|unset"].join("|")+")(?:/(?:normal|[\\d.]+(?:%|[a-z]+)?))?$")};function zo(t,e){for(const s of qo.connect[t].children){const i=this.childName(t,s);if(Array.isArray(e[s])){const t=e[s];t.length&&(this.styles[i]=t.join(" "))}else""!==e[s]&&(this.styles[i]=e[s])}}class qo{constructor(t=""){this.parse(t)}sanitizeValue(t){const e=this.constructor.pattern;if(!t.match(e.sanitize))return t;const s=(t=t.replace(e.value,"$1")).replace(/\\./g,"").replace(/(['"]).*?\1/g,"").replace(/[^'"]/g,"");return s.length&&(t+=s.charAt(0)),t}get cssText(){var t,e;const s=[];for(const i of Object.keys(this.styles)){const r=this.parentName(i),n=i.replace(/.*-/,""),o=this.childName(this.parentName(r),n);!this.styles[i]||this.styles[o]||this.styles[r]&&(null===(e=null===(t=qo.connect[r])||void 0===t?void 0:t.children)||void 0===e?void 0:e.includes(n))||s.push(`${i}: ${this.styles[i]};`)}return s.join(" ")}get styleList(){return Object.assign({},this.styles)}set(t,e){t=this.normalizeName(t),this.setStyle(t,String(e));const s=qo.connect[t];if(null==s?void 0:s.subPart)s.combine.call(this,t);else if(this.combineParent(t),t.match(/-.*-/)){const e=t.replace(/-.*-/,"-");Fo.call(this,e)}}combineParent(t){for(var e;t.match(/-/);){const s=t;t=this.parentName(t);const i=qo.connect[t];if(!qo.connect[s]&&!(null===(e=null==i?void 0:i.children)||void 0===e?void 0:e.includes(s.substring(t.length+1))))break;i.combine.call(this,t)}if(!this.styles[t])return;const s=qo.connect[t];for(const e of(null==s?void 0:s.parts)||[])delete this.styles[this.childName(t,e)]}get(t){return t=this.normalizeName(t),Object.hasOwn(this.styles,t)?this.styles[t]:""}setStyle(t,e){var s;this.styles[t]=this.sanitizeValue(e),(null===(s=qo.connect[t])||void 0===s?void 0:s.children)&&qo.connect[t].split.call(this,t),""===e&&delete this.styles[t]}combineChildren(t){const e=this.parentName(t);for(const s of qo.connect[t].children){const t=this.childName(e,s);qo.connect[t].combine.call(this,t)}}parentName(t){const e=t.replace(/-[^-]*$/,"");return t===e?"":e}childName(t,e){var s;return e.match(/-/)?e:((null===(s=qo.connect[t])||void 0===s?void 0:s.subPart)&&(e+=t.replace(/.*-/,"-"),t=this.parentName(t)),t+"-"+e)}normalizeName(t){return t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}parse(t=""){const e=this.constructor.pattern;this.styles={};const s=t.replace(/\n/g," ").replace(e.comment,"").split(e.style);for(;s.length>1;){const[t,e,i]=s.splice(0,3);if(t.match(/[^\s\n;]/))return;this.set(e,i)}}}function Vo(t){return t.reduce((t,e)=>t+e,0)}function Xo(t){return t.reduce((t,e)=>Math.max(t,e),0)}if(qo.pattern={sanitize:/['";]/,value:/^((:?'(?:\\.|[^'])*(?:'|$)|"(?:\\.|[^"])*(?:"|$)|\n|\\.|[^'";])*?)[\s\n]*(?:;|$).*/,style:/([-a-z]+)[\s\n]*:[\s\n]*((?:'(?:\\.|[^'])*(?:'|$)|"(?:\\.|[^"])*(?:"|$)|\n|\\.|[^'";])*?)[\s\n]*(?:;|$)/g,comment:/\/\*[^]*?\*\//g},qo.connect={padding:{children:wo,split:Do,combine:Po},margin:{children:wo,split:Do,combine:Po},border:{children:wo,parts:ko,split:function(t){for(const e of qo.connect[t].children)this.setStyle(this.childName(t,e),this.styles[t])},combine:Fo},"border-top":{children:ko,split:Uo,combine:Ho},"border-right":{children:ko,split:Uo,combine:Ho},"border-bottom":{children:ko,split:Uo,combine:Ho},"border-left":{children:ko,split:Uo,combine:Ho},"border-width":{children:wo,split:Do,combine:Bo,subPart:!0},"border-style":{children:wo,split:Do,combine:Bo,subPart:!0},"border-color":{children:wo,split:Do,combine:Bo,subPart:!0},font:{children:["style","variant","weight","stretch","line-height","size","family"],split:function(t){const e=Oo(this.styles[t]),s={style:"",variant:[],weight:"",stretch:"",size:"",family:"","line-height":""};for(const t of e){s.family||(s.family=t);for(const e of Object.keys(Wo))if((Array.isArray(s[e])||""===s[e])&&t.match(Wo[e]))if(s.family===t&&(s.family=""),"size"===e){const[i,r]=t.split(/\//);s[e]=i,r&&(s["line-height"]=r)}else""===s.size&&(Array.isArray(s[e])?s[e].push(t):""===s[e]&&(s[e]=t))}zo.call(this,t,s),delete this.styles[t]},combine:function(t){}}},MathJax.loader&&MathJax.loader.checkVersion("core",ri,"core"),hi({_:{adaptors:{HTMLAdaptor:h,browserAdaptor:d},components:{global:t},core:{DOMAdaptor:c,FindMath:u,Handler:at,HandlerList:lt,InputJax:p,MathDocument:ot,MathItem:b,MathList:g,MmlTree:{Attributes:y,MML:st,MathMLVisitor:dt,MmlFactory:it,MmlNode:v,MmlNodes:{HtmlNode:et,TeXAtom:Z,maction:W,maligngroup:K,malignmark:$,math:T,mathchoice:tt,menclose:H,merror:F,mfenced:U,mfrac:O,mglyph:Y,mi:C,mmultiscripts:V,mn:A,mo:R,mpadded:j,mphantom:_,mroot:P,mrow:k,ms:w,mspace:I,msqrt:D,mstyle:B,msubsup:z,mtable:X,mtd:J,mtext:M,mtr:G,munderover:q,semantics:Q},MmlVisitor:ht,OperatorDictionary:L,SerializedMmlVisitor:ut},OutputJax:m,Tree:{Factory:E,Node:N,NodeFactory:x,Visitor:ct,Wrapper:pt,WrapperFactory:mt}},handlers:{html_ts:Nt,html:{HTMLDocument:xt,HTMLDomStrings:Et,HTMLHandler:yt,HTMLMathItem:gt,HTMLMathList:bt}},mathjax:ft,ui:{dialog:{DraggableDialog:Tt,InfoDialog:Ct}},util:{AsyncLoad:At,BBox:St,BitField:rt,Entities:Rt,FunctionList:n,LinkedList:f,Options:a,PrioritizedList:i,Retries:nt,StyleJson:vt,Styles:Mt,context:e,lengths:Lt,numeric:It,string:S}}}),MathJax.startup&&(MathJax.startup.registerConstructor("HTMLHandler",no),MathJax.startup.registerConstructor("browserAdaptor",Yi),MathJax.startup.useHandler("HTMLHandler"),MathJax.startup.useAdaptor("browserAdaptor")),MathJax.loader){const t=MathJax.config.loader;MathJax._.mathjax.mathjax.asyncLoad=e=>"node:"===e.substring(0,5)?t.require(e):MathJax.loader.load(e).then(t=>t[0])}class Go extends Qi{constructor(t){super(t),this.getPatterns()}getPatterns(){const t=this.options,e=[],s=[],i=[];this.end={},this.env=this.sub=0;let r=1;t.inlineMath.forEach(t=>this.addPattern(e,t,!1)),t.displayMath.forEach(t=>this.addPattern(e,t,!0)),e.length&&s.push(e.sort(Fr).join("|")),t.processEnvironments&&(s.push("\\\\begin\\s*\\{([^}]*)\\}"),this.env=r,r++),t.processEscapes&&i.push("\\\\([\\\\$])"),t.processRefs&&i.push("(\\\\(?:eq)?ref\\s*\\{[^}]*\\})"),i.length&&(s.push("("+i.join("|")+")"),this.sub=r),this.start=new RegExp(s.join("|"),"g"),this.hasPatterns=s.length>0}addPattern(t,e,s){const[i,r]=e;t.push(jr(i)),this.end[i]=[r,s,this.endPattern(r)]}endPattern(t,e){return new RegExp((e||jr(t))+"|\\\\(?:[a-zA-Z]|.)|[{}]","g")}findEnd(t,e,s,i){const[r,n,o]=i,a=o.lastIndex=s.index+s[0].length;let l,c=0;for(;l=o.exec(t);){if((l[1]||l[0])===r&&0===c)return nr(s[0],t.substring(a,l.index),l[0],e,s.index,l.index+l[0].length,n);"{"===l[0]?c++:"}"===l[0]&&c&&c--}return null}findMathInString(t,e,s){let i,r;for(this.start.lastIndex=0;i=this.start.exec(s);){if(void 0!==i[this.env]&&this.env){const t="\\\\end\\s*(\\{"+jr(i[this.env])+"\\})";r=this.findEnd(s,e,i,["{"+i[this.env]+"}",!0,this.endPattern(null,t)]),r&&(r.math=r.open+r.math+r.close,r.open=r.close="")}else if(void 0!==i[this.sub]&&this.sub){const t=i[this.sub],s=i.index+i[this.sub].length;r=2===t.length?nr("\\",t.substring(1),"",e,i.index,s):nr("",t,"",e,i.index,s,!1)}else r=this.findEnd(s,e,i,this.end[i[0]]);r&&(t.push(r),this.start.lastIndex=r.end.n)}}findMath(t){const e=[];if(this.hasPatterns)for(let s=0,i=t.length;sString.fromCodePoint(parseInt(t,16)),getChildren:t=>t.childNodes,getText:t=>t.getText(),appendChildren(t,e){for(const s of e)t.appendChild(s)},setAttribute(t,e,s){t.attributes.set(e,s)},setProperty(t,e,s){t.setProperty(e,s)},setProperties(t,e){for(const s of Object.keys(e)){const i=e[s];"texClass"===s?(t.texClass=i,t.setProperty(s,i)):"movablelimits"===s?(t.setProperty("movablelimits",i),(t.isKind("mo")||t.isKind("mstyle"))&&t.attributes.set("movablelimits",i)):"inferred"===s||(Jo.attrs.has(s)?t.setProperty(s,i):t.attributes.set(s,i))}},getProperty:(t,e)=>t.getProperty(e),getAttribute:(t,e)=>t.attributes.get(e),removeAttribute(t,e){t.attributes.unset(e)},removeProperties(t,...e){t.removeProperty(...e)},getChildAt:(t,e)=>t.childNodes[e],setChild(t,e,s){t.childNodes[e]=s,s&&(s.parent=t)},copyChildren(t,e){const s=t.childNodes;for(let t=0;tt.isKind(e),isEmbellished:t=>t.isEmbellished,getTexClass:t=>t.texClass,getCoreMO:t=>t.coreMO(),isNode:t=>t instanceof Nr||t instanceof Ar,isInferred:t=>t.isInferred,getForm(t){if(!t.isKind("mo"))return null;const e=t,s=e.getForms();for(const t of s){const s=this.getOp(e,t);if(s)return s}return null},getOp:(t,e="infix")=>Vr.OPTABLE[e][t.getText()]||null,getMoAttribute(t,e){var s,i;if(!t.attributes.isSet(e))for(const r of["infix","postfix","prefix"]){const n=null===(i=null===(s=this.getOp(t,r))||void 0===s?void 0:s[3])||void 0===i?void 0:i[e];if(void 0!==n)return n}return t.attributes.get(e)}},Ko=Jo,$o={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"},Form:{PREFIX:"prefix",INFIX:"infix",POSTFIX:"postfix"},LineBreak:{AUTO:"auto",NEWLINE:"newline",NOBREAK:"nobreak",GOODBREAK:"goodbreak",BADBREAK:"badbreak"},LineBreakStyle:{BEFORE:"before",AFTER:"after",DUPLICATE:"duplicate",INFIXLINBREAKSTYLE:"infixlinebreakstyle"},IndentAlign:{LEFT:"left",CENTER:"center",RIGHT:"right",AUTO:"auto",ID:"id",INDENTALIGN:"indentalign"},IndentShift:{INDENTSHIFT:"indentshift"},LineThickness:{THIN:"thin",MEDIUM:"medium",THICK:"thick"},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"},Align:{TOP:"top",BOTTOM:"bottom",CENTER:"center",BASELINE:"baseline",AXIS:"axis",LEFT:"left",RIGHT:"right"},Lines:{NONE:"none",SOLID:"solid",DASHED:"dashed"},Side:{LEFT:"left",RIGHT:"right",LEFTOVERLAP:"leftoverlap",RIGHTOVERLAP:"rightoverlap"},Width:{AUTO:"auto",FIT:"fit"},Actiontype:{TOGGLE:"toggle",STATUSLINE:"statusline",TOOLTIP:"tooltip",INPUT:"input"},Overflow:{LINBREAK:"linebreak",SCROLL:"scroll",ELIDE:"elide",TRUNCATE:"truncate",SCALE:"scale"},Unit:{EM:"em",EX:"ex",PX:"px",IN:"in",CM:"cm",MM:"mm",PT:"pt",PC:"pc"},Attr:{LATEX:"data-latex",LATEXITEM:"data-latex-item"}};function Yo(t,e,s){const i=e.attributes,r=s.attributes;t.forEach(t=>{const e=r.getExplicit(t);null!=e&&i.set(t,e)})}function Qo(t,e){const s=(t,e)=>t.getExplicitNames().filter(s=>s!==e&&("stretchy"!==s||t.getExplicit("stretchy"))&&"data-latex"!==s&&"data-latex-item"!==s),i=t.attributes,r=e.attributes,n=s(i,"lspace"),o=s(r,"rspace");if(n.length!==o.length)return!1;for(const t of n)if(i.getExplicit(t)!==r.getExplicit(t))return!1;return!0}function Zo(t,e,s){const i=[];for(const r of t.getList("m"+e+s)){const n=r.childNodes;if(n[r[e]]&&n[r[s]])continue;const o=r.parent,a=n[r[e]]?t.nodeFactory.create("node","m"+e,[n[r.base],n[r[e]]]):t.nodeFactory.create("node","m"+s,[n[r.base],n[r[s]]]);Ko.copyAttributes(r,a),o.replaceChild(a,r),i.push(r)}t.removeFromList("m"+e+s,i)}function ta(t,e,s){const i=[];for(const r of t.getList(e)){if(r.attributes.get("displaystyle"))continue;const e=r.childNodes[r.base],n=e.coreMO();if(e.getProperty("movablelimits")&&!n.attributes.hasExplicit("movablelimits")){const e=t.nodeFactory.create("node",s,r.childNodes);Ko.copyAttributes(r,e),r.parent.replaceChild(e,r),i.push(r)}}t.removeFromList(e,i)}const ea={cleanStretchy(t){var e;const s=t.data;for(const t of s.getList("fixStretchy"))if(Ko.getProperty(t,"fixStretchy")){const s=Ko.getForm(t);(null===(e=null==s?void 0:s[3])||void 0===e?void 0:e.stretchy)&&Ko.setAttribute(t,"stretchy",!1),Ko.removeProperties(t,"fixStretchy")}},cleanAttributes(t){t.data.root.walkTree(t=>{const e=new Set((t.getProperty("keep-attrs")||"").split(/ /)),s=t.attributes;s.unset($o.Attr.LATEXITEM);for(const t of s.getExplicitNames())e.has(t)||s.get(t)!==s.getInherited(t)||s.unset(t)})},combineRelations(t){const e=[];for(const s of t.data.getList("mo")){if(s.getProperty("relationsCombined")||!s.parent||s.parent&&!Ko.isType(s.parent,"mrow")||Ko.getTexClass(s)!==fr.REL)continue;let t;const i=s.parent.childNodes,r=i.indexOf(s)+1,n=Ko.getProperty(s,"variantForm");for(;r"data-latex"!==t.substring(0,10)).length){const r=t.childNodes[0].childNodes[0];i.forEach(t=>r.attributes.set(t,e.get(t))),t.parent.replaceChild(r,t),s.push(t)}}e.removeFromList("mstyle",s)}},sa=ea;var ia,ra;!function(t){t.HANDLER="handler",t.FALLBACK="fallback",t.ITEMS="items",t.TAGS="tags",t.OPTIONS="options",t.NODES="nodes",t.PREPROCESSORS="preprocessors",t.POSTPROCESSORS="postprocessors",t.INIT="init",t.CONFIG="config",t.PRIORITY="priority",t.PARSER="parser"}(ia||(ia={})),function(t){t.DELIMITER="delimiter",t.MACRO="macro",t.CHARACTER="character",t.ENVIRONMENT="environment"}(ra||(ra={}));const na=7.2;const oa={UNIT_CASES:new class{constructor(t){this.num="([-+]?([.,]\\d+|\\d+([.,]\\d*)?))",this.unit="",this.dimenEnd=/./,this.dimenRest=/./,this.map=new Map(t),this.updateDimen()}updateDimen(){this.unit=`(${Array.from(this.map.keys()).join("|")})`,this.dimenEnd=RegExp("^\\s*"+this.num+"\\s*"+this.unit+"\\s*$"),this.dimenRest=RegExp("^\\s*"+this.num+"\\s*"+this.unit+" ?")}set(t,e){return this.map.set(t,e),this.updateDimen(),this}get(t){return this.map.get(t)||this.map.get("pt")}delete(t){return!!this.map.delete(t)&&(this.updateDimen(),!0)}}([["em",1],["ex",.43],["pt",.1],["pc",1.2],["px",.1],["in",na],["cm",na/2.54],["mm",na/25.4],["mu",1/18]]),matchDimen(t,e=!1){const s=t.match(e?oa.UNIT_CASES.dimenRest:oa.UNIT_CASES.dimenEnd);return s?function([t,e,s]){return"mu"!==e?[t,e,s]:[oa.em(oa.UNIT_CASES.get(e)*parseFloat(t)).slice(0,-2),"em",s]}([s[1].replace(/,/,"."),s[4],s[0].length]):[null,null,0]},dimen2em(t){const[e,s]=oa.matchDimen(t),i=parseFloat(e||"1");return oa.UNIT_CASES.get(s)*i},em:t=>Math.abs(t)<6e-4?"0em":t.toFixed(3).replace(/\.?0+$/,"")+"em",trimSpaces(t){if("string"!=typeof t)return t;let e=t.trim();return e.match(/\\$/)&&t.match(/ $/)&&(e+=" "),e}};class aa{constructor(t,e,s){this._factory=t,this._env=e,this.global={},this.stack=[],this.global={isInner:s},this.stack=[this._factory.create("start",this.global)],e&&(this.stack[0].env=e),this.env=this.stack[0].env}set env(t){this._env=t}get env(){return this._env}Push(...t){for(const e of t){if(!e)continue;const t=Ko.isNode(e)?this._factory.create("mml",e):e;t.global=this.global;const[s,i]=this.stack.length?this.Top().checkItem(t):[null,!0];i&&(s?(this.Pop(),this.Push(...s)):(t.isKind("null")||this.stack.push(t),t.env?(t.copyEnv&&Object.assign(t.env,this.env),this.env=t.env):t.env=this.env))}}Pop(){const t=this.stack.pop();return t.isOpen||delete t.env,this.env=this.stack.length?this.Top().env:{},t}Top(t=1){return this.stack.length="0"&&i<="9")s[t]=e[parseInt(s[t],10)-1],"number"==typeof s[t]&&(s[t]=s[t].toString());else if("{"===i)if(i=s[t].substring(1),i>="0"&&i<="9")s[t]=e[parseInt(s[t].substring(1,s[t].length-1),10)-1],"number"==typeof s[t]&&(s[t]=s[t].toString());else{s[t].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/)&&(s[t]="%"+s[t])}}return s.join("")}constructor(t,e,...s){this.id=t,this.message=la.processString(e,s)}}la.pattern=/%(\d+|\{\d+\}|\{[a-z]+:%\d+(?:\|(?:%\{\d+\}|%.|[^}])*)+\}|.)/g;const ca=la;class ha{constructor(t){this._nodes=t,this.startStr="",this.startI=0,this.stopI=0}get nodes(){return this._nodes}Push(...t){this._nodes.push(...t)}Pop(){return this._nodes.pop()}get First(){return this._nodes[this.Size()-1]}set First(t){this._nodes[this.Size()-1]=t}get Last(){return this._nodes[0]}set Last(t){this._nodes[0]=t}Peek(t){return null==t&&(t=1),this._nodes.slice(this.Size()-t)}Size(){return this._nodes.length}Clear(){this._nodes=[]}toMml(t=!0,e){return 1!==this._nodes.length||e?this.create("node",t?"inferredMrow":"mrow",this._nodes,{}):this.First}create(t,...e){return this.factory.configuration.nodeFactory.create(t,...e)}}class da extends ha{constructor(t,...e){super(e),this.factory=t,this.global={},this._properties={},this.isOpen&&(this._env={})}get kind(){return"base"}get env(){return this._env}set env(t){this._env=t}get copyEnv(){return!0}getProperty(t){return this._properties[t]}setProperty(t,e){return this._properties[t]=e,this}get isOpen(){return!1}get isClose(){return!1}get isFinal(){return!1}isKind(t){return t===this.kind}checkItem(t){if(t.isKind("over")&&this.isOpen&&(t.setProperty("num",this.toMml(!1)),this.Clear()),t.isKind("cell")&&this.isOpen){if(t.getProperty("linebreak"))return da.fail;throw new ca("Misplaced","Misplaced %1",t.getName())}if(t.isClose&&this.getErrors(t.kind)){const[e,s]=this.getErrors(t.kind);throw new ca(e,s,t.getName())}return t.isFinal?(this.Push(t.First),da.fail):da.success}clearEnv(){for(const t of Object.keys(this.env))delete this.env[t]}setProperties(t){return Object.assign(this._properties,t),this}getName(){return this.getProperty("name")}toString(){return this.kind+"["+this.nodes.join("; ")+"]"}getErrors(t){return this.constructor.errors[t]||da.errors[t]}addLatexItem(t,e=""){const s=this.startStr.slice(this.startI,this.stopI);if(s){const i=e?e+s:s;t.attributes.set($o.Attr.LATEXITEM,i),"}"!==i&&t.attributes.set($o.Attr.LATEX,i)}}}da.fail=[null,!1],da.success=[null,!0],da.errors={end:["MissingBeginExtraEnd","Missing \\begin{%1} or extra \\end{%1}"],close:["ExtraCloseMissingOpen","Extra close brace or missing open brace"],right:["MissingLeftExtraRight","Missing \\left or extra \\right"],middle:["ExtraMiddle","Extra \\middle"]};class ua{constructor(t,e,s){this._string=t,this.configuration=s,this.macroCount=0,this.i=0,this.currentCS="",this.saveI=0;const i=Object.hasOwn(e,"isInner"),r=e.isInner;let n;if(delete e.isInner,e){n={};for(const t of Object.keys(e))n[t]=e[t]}this.configuration.pushParser(this),this.stack=new aa(this.itemFactory,n,!i||r),this.Parse(),this.Push(this.itemFactory.create("stop")),this.stack.env=n}get options(){return this.configuration.options}get itemFactory(){return this.configuration.itemFactory}get tags(){return this.configuration.tags}set string(t){this._string=t}get string(){return this._string}parse(t,e){const s=this.saveI;this.saveI=this.i-("character"===t&&"&"!==e[1]?1:0);const i=this.configuration.handlers.get(t).parse(e);return"macro"!==t&&this.updateResult(e[1],s),this.saveI=s,i}lookup(t,e){return this.configuration.handlers.get(t).lookup(e)}contains(t,e){return this.configuration.handlers.get(t).contains(e)}toString(){let t="";for(const e of Array.from(this.configuration.handlers.keys()))t+=e+": "+this.configuration.handlers.get(e)+"\n";return t}Parse(){let t;for(;this.it.includes(e),t=>t)}constructor(t,e,s){this.name=t,this.verify=e,this.convert=s}}const Ea={boolean:new ba("boolean",t=>"true"===t||"false"===t,t=>"true"===t),number:new ba("number",t=>!!t.match(/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[-+]?\d+)?$/),t=>parseFloat(t)),integer:new ba("integer",t=>!!t.match(/^[-+]?\d+$/),t=>parseInt(t)),string:new ba("string",t=>!0,t=>t),dimen:new ba("dimen",t=>null!==oa.matchDimen(t)[0],t=>t)};function xa(t,e){if(0===e)return t.replace(/^\s+/,"").replace(/([^\\\s]|^)((?:\\\\)*(?:\\\s)?)?\s+$/,"$1$2");for(;e>0;)t=t.trim().slice(1,-1),e--;return t}function ya(t,e,s=!1,i=!1){const r=t.length;let n=0,o="",a=0,l=0,c=!0;for(;an&&(l=n),c=!1}o+=i}if(n)throw new ca("ExtraOpenMissingClose","Extra open brace or missing close brace");return i&&l?["","",xa(o,1)]:[xa(o,s?Math.min(1,l):l),"",t.slice(a)]}const Na={cols:(...t)=>t.map(t=>oa.em(t)).join(" "),fenced(t,e,s,i,r="",n=""){const o=t.nodeFactory,a=o.create("node","mrow",[],{open:e,close:i,texClass:fr.INNER});let l;if(r)l=new ua("\\"+r+"l"+e,t.parser.stack.env,t).mml();else{const t=o.create("text",e);l=o.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:fr.OPEN},t)}if(Ko.appendChildren(a,[l,s]),r)l=new ua("\\"+r+"r"+i,t.parser.stack.env,t).mml();else{const t=o.create("text",i);l=o.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:fr.CLOSE},t)}return n&&l.attributes.set("mathcolor",n),Ko.appendChildren(a,[l]),a},fixedFence(t,e,s,i){const r=t.nodeFactory.create("node","mrow",[],{open:e,close:i,texClass:fr.ORD});return e&&Ko.appendChildren(r,[Na.mathPalette(t,e,"l")]),Ko.isType(s,"mrow")?Ko.appendChildren(r,Ko.getChildren(s)):Ko.appendChildren(r,[s]),i&&Ko.appendChildren(r,[Na.mathPalette(t,i,"r")]),r},mathPalette(t,e,s){"{"!==e&&"}"!==e||(e="\\"+e);const i="{\\big"+s+" "+e+"}";return new ua("\\mathchoice"+("{\\bigg"+s+" "+e+"}")+i+i+i,{},t).mml()},fixInitialMO(t,e){for(let s=0,i=e.length;s1&&(l=[t.create("node","mrow",l)]),l},internalText(t,e,s){e=e.replace(/\n+/g," ").replace(/^ +/,Co.nbsp).replace(/ +$/,Co.nbsp);const i=t.create("text",e);return t.create("node","mtext",[],s,i)},underOver(t,e,s,i,r){if(Na.checkMovableLimits(e),Ko.isType(e,"munderover")&&Ko.isEmbellished(e)){Ko.setProperties(Ko.getCoreMO(e),{lspace:0,rspace:0});const s=t.create("node","mo",[],{rspace:0});e=t.create("node","mrow",[s,e])}const n=t.create("node","munderover",[e]);Ko.setChild(n,"over"===i?n.over:n.under,s);let o=n;return r&&(o=t.create("node","TeXAtom",[t.create("node","mstyle",[n],{displaystyle:!0,scriptlevel:0})],{texClass:fr.OP,movesupsub:!0})),Ko.setProperty(o,"subsupOK",!0),o},checkMovableLimits(t){const e=Ko.isType(t,"mo")?Ko.getForm(t):null;(Ko.getProperty(t,"movablelimits")||e&&e[3]&&e[3].movablelimits)&&Ko.setProperties(t,{movablelimits:!1})},setArrayAlign:(t,e,s)=>(s||(e=oa.trimSpaces(e||"")),"t"===e?t.arraydef.align="baseline 1":"b"===e?t.arraydef.align="baseline -1":"c"===e?t.arraydef.align="axis":e&&(s?(s.string=`[${e}]`+s.string.slice(s.i),s.i=0):t.arraydef.align=e),t),substituteArgs(t,e,s){let i="",r="",n=0;for(;ne.length)throw new ca("IllegalMacroParam","Illegal macro parameter reference");r=Na.addArgs(t,Na.addArgs(t,r,i),e[parseInt(o,10)-1]),i=""}else i+=o}return Na.addArgs(t,r,i)},addArgs(t,e,s){if(s.match(/^[a-z]/i)&&e.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)&&(e+=" "),e.length+s.length>t.configuration.options.maxBuffer)throw new ca("MaxBufferSize","MathJax internal buffer size exceeded; is there a recursive macro call?");return e+s},checkMaxMacros(t,e=!0){if(!(++t.macroCount<=t.configuration.options.maxMacros))throw e?new ca("MaxMacroSub1","MathJax maximum macro substitution count exceeded; is here a recursive macro call?"):new ca("MaxMacroSub2","MathJax maximum substitution count exceeded; is there a recursive latex environment?")},checkEqnEnv(t,e=!0){const s=t.stack.Top(),i=s.First;if(!(s.getProperty("nestable")&&e&&!i||s.getProperty("nestStart"))&&(!s.isKind("start")||i))throw new ca("ErroneousNestingEq","Erroneous nesting of equation structures")},copyNode(t,e){const s=t.copy(),i=e.configuration;return s.walkTree(t=>{i.addNode(t.kind,t);const e=(t.getProperty("in-lists")||"").split(/,/);for(const s of e)s&&i.addNode(s,t)}),s},mmlFilterAttribute:(t,e,s)=>s,getFontDef(t){const e=t.stack.env.font;return e?{mathvariant:e}:{}},keyvalOptions(t,e=null,s=!1,i=!1){const r=function(t,e=!1){const s={};let i,r,n,o=t,a=!0;for(;o;)[r,i,o]=ya(o,["=",","],e,a),a=!1,"="===i?([n,i,o]=ya(o,[","],e),n="false"===n||"true"===n?JSON.parse(n):n,s[r]=n):r&&(s[r]=!0);return s}(t,i);if(e)for(const t of Object.keys(r))if(Object.hasOwn(e,t)){if(e[t]instanceof ba){const s=e[t],i=String(r[t]);if(!s.verify(i))throw new ca("InvalidValue","Value for key '%1' is not of the expected type",t);r[t]=s.convert(i)}}else{if(s)throw new ca("InvalidOption","Invalid option: %1",t);delete r[t]}return r},isLatinOrGreekChar:t=>!!t.normalize("NFD").match(/[a-zA-Z\u0370-\u03F0]/)};class va{constructor(){this.columnHandler={l:t=>t.calign[t.j++]="left",c:t=>t.calign[t.j++]="center",r:t=>t.calign[t.j++]="right",p:t=>this.getColumn(t,"top"),m:t=>this.getColumn(t,"middle"),b:t=>this.getColumn(t,"bottom"),w:t=>this.getColumn(t,"top",""),W:t=>this.getColumn(t,"top",""),"|":t=>this.addRule(t,"solid"),":":t=>this.addRule(t,"dashed"),">":t=>t.cstart[t.j]=(t.cstart[t.j]||"")+this.getBraces(t),"<":t=>t.cend[t.j-1]=(t.cend[t.j-1]||"")+this.getBraces(t),"@":t=>this.addAt(t,this.getBraces(t)),"!":t=>this.addBang(t,this.getBraces(t)),"*":t=>this.repeat(t),P:t=>this.macroColumn(t,">{$}p{#1}<{$}",1),M:t=>this.macroColumn(t,">{$}m{#1}<{$}",1),B:t=>this.macroColumn(t,">{$}b{#1}<{$}",1)," ":t=>{}},this.MAXCOLUMNS=1e4}process(t,e,s){const i={parser:t,template:e,i:0,j:0,c:"",cwidth:[],calign:[],cspace:[],clines:[],cstart:s.cstart,cend:s.cend,ralign:s.ralign,cextra:s.cextra};let r=0;for(;i.ithis.MAXCOLUMNS)throw new ca("MaxColumns","Too many column specifiers (perhaps looping column definitions?)");const t=i.template.codePointAt(i.i),e=i.c=String.fromCodePoint(t);if(i.i+=e.length,!Object.hasOwn(this.columnHandler,e))throw new ca("BadPreamToken","Illegal pream-token (%1)",e);this.columnHandler[e](i)}this.setColumnAlign(i,s),this.setColumnWidths(i,s),this.setColumnSpacing(i,s),this.setColumnLines(i,s),this.setPadding(i,s)}setColumnAlign(t,e){e.arraydef.columnalign=t.calign.join(" ")}setColumnWidths(t,e){if(!t.cwidth.length)return;const s=[...t.cwidth];s.lengtht||"auto").join(" ")}setColumnSpacing(t,e){if(!t.cspace.length)return;const s=[...t.cspace];s.lengtht||"1em").join(" ")}setColumnLines(t,e){if(!t.clines.length)return;const s=[...t.clines];s[0]&&e.frame.push(["left",s[0]]),s.length>t.calign.length?e.frame.push(["right",s.pop()]):s.length1&&(e.arraydef.columnlines=s.slice(1).map(t=>t||"none").join(" "))}setPadding(t,e){if(!t.cextra[0]&&!t.cextra[t.calign.length-1])return;const s=t.calign.length-1,i=t.cspace,r=t.cextra[s]?i[s]:null;e.arraydef["data-array-padding"]=`${i[0]||".5em"} ${r||".5em"}`}getColumn(t,e,s="left"){t.calign[t.j]=s||this.getAlign(t),t.cwidth[t.j]=this.getDimen(t),t.ralign[t.j]=[e,t.cwidth[t.j],t.calign[t.j]],t.j++}getDimen(t){const e=this.getBraces(t);if(!oa.matchDimen(e)[0])throw new ca("MissingColumnDimOrUnits","Missing dimension or its units for %1 column declaration",t.c);return e}getAlign(t){return Hi(this.getBraces(t).toLowerCase(),{l:"left",c:"center",r:"right"},"")}getBraces(t){for(;" "===t.template[t.i];)t.i++;if(t.i>=t.template.length)throw new ca("MissingArgForColumn","Missing argument for %1 column declaration",t.c);if("{"!==t.template[t.i])return t.template[t.i++];const e=++t.i;let s=1;for(;t.i0&&s--;)i.push(this.getBraces(t));t.template=Na.substituteArgs(t.parser,i,e)+t.template.slice(t.i),t.i=0}addRule(t,e){t.clines[t.j]&&this.addAt(t,"\\,"),t.clines[t.j]=e,"0"===t.cspace[t.j]&&(t.cstart[t.j]="\\hspace{.5em}")}addAt(t,e){const{cstart:s,cspace:i,j:r}=t;t.cextra[r]=!0,t.calign[r]="center",t.clines[r]&&(".5em"===i[r]?s[r-1]+="\\hspace{.25em}":i[r]||(t.cend[r-1]=(t.cend[r-1]||"")+"\\hspace{.5em}")),s[r]=e,i[r]="0",i[++t.j]="0"}addBang(t,e){const{cstart:s,cspace:i,j:r}=t;t.cextra[r]=!0,t.calign[r]="center",s[r]=("0"===i[r]&&t.clines[r]?"\\hspace{.25em}":"")+e,i[r]||(i[r]=".5em"),i[++t.j]=".5em"}repeat(t){const e=this.getBraces(t),s=this.getBraces(t),i=parseInt(e);if(String(i)!==e)throw new ca("ColArgNotNum","First argument to %1 column specifier must be a number","*");t.template=new Array(i).fill(s).join("")+t.template.substring(t.i),t.i=0}}const Ta=$o.Variant;class Ca{constructor(t,e=[]){this.options={},this.columnParser=new va,this.packageData=new Map,this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.handlers=t.handlers,this.nodeFactory=new ga,this.nodeFactory.configuration=this,this.nodeFactory.setCreators(t.nodes),this.itemFactory=new fa(t.items),this.itemFactory.configuration=this,Bi(this.options,...e),Bi(this.options,t.options),this.mathStyle=Ca.getVariant.get(this.options.mathStyle)||Ca.getVariant.get("TeX")}pushParser(t){this.parsers.unshift(t)}popParser(){this.parsers.shift()}get parser(){return this.parsers[0]}clear(){this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.tags.resetTag()}addNode(t,e){let s=this.nodeLists[t];if(s||(s=this.nodeLists[t]=[]),s.push(e),e.kind!==t){const s=Ko.getProperty(e,"in-lists")||"",i=(s?s.split(/,/):[]).concat(t).join(",");Ko.setProperty(e,"in-lists",i)}}getList(t){const e=this.nodeLists[t]||[],s=[];for(const t of e)this.inTree(t)&&s.push(t);return this.nodeLists[t]=s,s}removeFromList(t,e){const s=this.nodeLists[t]||[];for(const t of e){const e=s.indexOf(t);e>=0&&s.splice(e,1)}}inTree(t){for(;t&&t!==this.root;)t=t.parent;return!!t}}Ca.getVariant=new Map([["TeX",(t,e)=>e&&t.match(/^[\u0391-\u03A9\u03F4]/)?Ta.NORMAL:""],["ISO",t=>Ta.ITALIC],["French",t=>t.normalize("NFD").match(/^[a-z]/)?Ta.ITALIC:Ta.NORMAL],["upright",t=>Ta.NORMAL]]);const Aa=Ca;class La{constructor(t="???",e=""){this.tag=t,this.id=e}}class Sa{constructor(t="",e=!1,s=!1,i=null,r="",n="",o=!1,a=""){this.env=t,this.taggable=e,this.defaultTags=s,this.tag=i,this.tagId=r,this.tagFormat=n,this.noTag=o,this.labelId=a}}class Ra{constructor(){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 Sa,this.history=[],this.stack=[],this.enTag=function(t,e){const s=this.configuration.nodeFactory,i=s.create("node","mtd",[t]),r=s.create("node","mlabeledtr",[e,i]);return s.create("node","mtable",[r],{side:this.configuration.options.tagSide,minlabelspacing:this.configuration.options.tagIndent,displaystyle:!0})}}start(t,e,s){this.currentTag&&this.stack.push(this.currentTag);const i=this.label;this.currentTag=new Sa(t,e,s),this.label=i}get env(){return this.currentTag.env}end(){this.history.push(this.currentTag);const t=this.label;this.currentTag=this.stack.pop(),t&&!this.label&&(this.label=t)}tag(t,e){this.currentTag.tag=t,this.currentTag.tagFormat=e?t:this.formatTag(t),this.currentTag.noTag=!1}notag(){this.tag("",!0),this.currentTag.noTag=!0}get noTag(){return this.currentTag.noTag}set label(t){this.currentTag.labelId=t}get label(){return this.currentTag.labelId}formatUrl(t,e){return e+"#"+encodeURIComponent(t)}formatTag(t){return["(",t,")"]}formatRef(t){return this.formatTag(t)}formatId(t){return"mjx-eqn:"+t.replace(/\s/g,"_")}formatNumber(t){return t.toString()}autoTag(){null==this.currentTag.tag&&(this.counter++,this.tag(this.formatNumber(this.counter),!1))}clearTag(){this.tag(null,!0),this.currentTag.tagId=""}getTag(t=!1){if(t)return this.autoTag(),this.makeTag();const e=this.currentTag;return e.taggable&&!e.noTag&&(e.defaultTags&&this.autoTag(),e.tag)?this.makeTag():null}resetTag(){this.history=[],this.redo=!1,this.refUpdate=!1,this.clearTag()}reset(t=0){this.resetTag(),this.counter=this.allCounter=t,this.allLabels={},this.allIds={},this.label=""}startEquation(t){this.history=[],this.stack=[],this.clearTag(),this.currentTag=new Sa("",void 0,void 0),this.labels={},this.ids={},this.counter=this.allCounter,this.redo=!1;const e=t.inputData.recompile;e&&(this.refUpdate=!0,this.counter=e.counter)}finishEquation(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)}finalize(t,e){if(!e.display||this.currentTag.env||null==this.currentTag.tag)return t;const s=this.makeTag();return this.enTag(t,s)}makeId(){this.currentTag.tagId=this.formatId(this.configuration.options.useLabelIds&&this.label||this.currentTag.tag)}makeTag(){var t;this.makeId(),this.label&&(this.labels[this.label]=new La(this.currentTag.tag,this.currentTag.tagId),this.label="");const e=this.currentTag.tagFormat,s=Array.isArray(e)?e:(null===(t=e.match(/^(\(|\[|\{)(.*)(\}|\]|\))$/))||void 0===t?void 0:t.slice(1))||[e],i=new ua(s.map(t=>t?`\\text{${t}}`:"").join(""),{},this.configuration).mml();return this.configuration.nodeFactory.create("node","mtd",[i],{id:this.currentTag.tagId,rowalign:this.configuration.options.tagAlign})}}class Ma extends Ra{autoTag(){}getTag(){return this.currentTag.tag?super.getTag():null}}class Ia extends Ra{finalize(t,e){if(!e.display||this.history.find(function(t){return t.taggable}))return t;const s=this.getTag(!0);return this.enTag(t,s)}}const wa=new Map([["none",Ma],["all",Ia]]);let ka="none";const Oa={OPTIONS:{tags:ka,tagSide:"right",tagIndent:"0.8em",useLabelIds:!0,ignoreDuplicateLabels:!1,tagAlign:"baseline"},add(t,e){wa.set(t,e)},addTags(t){for(const e of Object.keys(t))Oa.add(e,t[e])},create(t){const e=wa.get(t)||wa.get(ka);if(!e)throw Error("Unknown tags class");return new e},setDefault(t){ka=t},getDefault:()=>Oa.create(ka)};class Da{constructor(t,e,s){this._token=t,this._char=e,this._attributes=s}get token(){return this._token}get char(){return this._char}get attributes(){return this._attributes}}class Pa{constructor(t,e,s=[]){this._token=t,this._func=e,this._args=s}get token(){return this._token}get func(){return this._func}get args(){return this._args}}function Ba(t){return void 0===t||t}class Fa{constructor(t,e){this._name=t,this._parser=e,Xa.register(this)}get name(){return this._name}parserFor(t){return this.contains(t)?this.parser:null}parse([t,e]){const s=this.parserFor(e),i=this.lookup(e);return s&&i?Ba(s(t,i)):null}set parser(t){this._parser=t}get parser(){return this._parser}}class ja extends Fa{constructor(t,e,s){super(t,e),this._regExp=s}contains(t){return this._regExp.test(t)}lookup(t){return this.contains(t)?t:null}}class _a extends Fa{constructor(){super(...arguments),this.map=new Map}lookup(t){return this.map.get(t)}contains(t){return this.map.has(t)}add(t,e){this.map.set(t,e)}remove(t){this.map.delete(t)}}class Ua extends _a{constructor(t,e,s){super(t,e);for(const t of Object.keys(s)){const e=s[t],[i,r]="string"==typeof e?[e,null]:e,n=new Da(t,i,r);this.add(t,n)}}}class Ha extends Ua{parse([t,e]){return super.parse([t,"\\"+e])}}class Wa extends _a{constructor(t,e,s={}){super(t,null);const i=t=>"string"==typeof t?s[t]:t;for(const[t,s]of Object.entries(e)){let e,r;Array.isArray(s)?(e=i(s[0]),r=s.slice(1)):(e=i(s),r=[]);const n=new Pa(t,e,r);this.add(t,n)}}parserFor(t){const e=this.lookup(t);return e?e.func:null}parse([t,e]){const s=this.lookup(e),i=this.parserFor(e);return s&&i?Ba(i(t,s.token,...s.args)):null}}class za extends Wa{parse([t,e]){const s=this.lookup(e),i=this.parserFor(e);if(!s||!i)return null;const r=t.currentCS;t.currentCS="\\"+e;const n=i(t,"\\"+s.token,...s.args);return t.currentCS=r,Ba(n)}}class qa extends Wa{constructor(t,e,s,i={}){super(t,s,i),this.parser=e}parse([t,e]){const s=this.lookup(e),i=this.parserFor(e);return s&&i?Ba(this.parser(t,s.token,i,s.args)):null}}const Va=new Map,Xa={register(t){Va.set(t.name,t)},getMap:t=>Va.get(t)};class Ga{constructor(){this._configuration=new gi,this._fallback=new bi}add(t,e,s=gi.DEFAULTPRIORITY){for(const e of t.slice().reverse()){const t=Xa.getMap(e);if(!t)return void this.warn(`Configuration '${e}' not found! Omitted.`);this._configuration.add(t,s)}e&&this._fallback.add(e,s)}remove(t,e=null){for(const e of t){const t=this.retrieve(e);t&&this._configuration.remove(t)}e&&this._fallback.remove(e)}parse(t){for(const{item:e}of this._configuration){const s=e.parse(t);if(s===Ga.FALLBACK)break;if(s)return s}const[e,s]=t;Array.from(this._fallback)[0].item(e,s)}lookup(t){const e=this.applicable(t);return e?e.lookup(t):null}contains(t){const e=this.applicable(t);return!(!e||e instanceof Ua&&null===e.lookup(t).char)}toString(){const t=[];for(const{item:e}of this._configuration)t.push(e.name);return t.join(", ")}applicable(t){for(const{item:e}of this._configuration)if(e.contains(t))return e;return null}retrieve(t){for(const{item:e}of this._configuration)if(e.name===t)return e;return null}warn(t){console.log("TexParser Warning: "+t)}}Ga.FALLBACK=Symbol("fallback");class Ja{constructor(){this.map=new Map}add(t,e,s=gi.DEFAULTPRIORITY){for(const i of Object.keys(t)){const r=i;let n=this.get(r);n||(n=new Ga,this.set(r,n)),n.add(t[r],e[r],s)}}remove(t,e){for(const s of Object.keys(t)){const i=this.get(s);i&&i.remove(t[s],e[s])}}set(t,e){this.map.set(t,e)}get(t){return this.map.get(t)}retrieve(t){for(const e of this.map.values()){const s=e.retrieve(t);if(s)return s}return null}keys(){return this.map.keys()}}class Ka{static makeProcessor(t,e){return Array.isArray(t)?t:[t,e]}static _create(t,e={}){var s;const i=null!==(s=e.priority)&&void 0!==s?s:gi.DEFAULTPRIORITY,r=e.init?this.makeProcessor(e.init,i):null,n=e.config?this.makeProcessor(e.config,i):null,o=(e.preprocessors||[]).map(t=>this.makeProcessor(t,i)),a=(e.postprocessors||[]).map(t=>this.makeProcessor(t,i)),l=e.parser||"tex";return new Ka(t,e[ia.HANDLER]||{},e[ia.FALLBACK]||{},e[ia.ITEMS]||{},e[ia.TAGS]||{},e[ia.OPTIONS]||{},e[ia.NODES]||{},o,a,r,n,i,l)}static create(t,e={}){const s=Ka._create(t,e);return Ya.set(t,s),s}static local(t={}){return Ka._create("",t)}constructor(t,e={},s={},i={},r={},n={},o={},a=[],l=[],c=null,h=null,d,u){this.name=t,this.handler=e,this.fallback=s,this.items=i,this.tags=r,this.options=n,this.nodes=o,this.preprocessors=a,this.postprocessors=l,this.initMethod=c,this.configMethod=h,this.priority=d,this.parser=u,this.handler=Object.assign({[ra.CHARACTER]:[],[ra.DELIMITER]:[],[ra.MACRO]:[],[ra.ENVIRONMENT]:[]},e)}get init(){return this.initMethod?this.initMethod[0]:null}get config(){return this.configMethod?this.configMethod[0]:null}}const $a=new Map,Ya={set(t,e){$a.set(t,e)},get:t=>$a.get(t),keys:()=>$a.keys()};class Qa{constructor(t,e=["tex"]){this.initMethod=new bi,this.configMethod=new bi,this.configurations=new gi,this.parsers=[],this.handlers=new Ja,this.items={},this.tags={},this.options={},this.nodes={},this.parsers=e;for(const e of t.slice().reverse())this.addPackage(e);for(const{item:t,priority:e}of this.configurations)this.append(t,e)}init(){this.initMethod.execute(this)}config(t){this.configMethod.execute(this,t);for(const e of this.configurations)this.addFilters(t,e.item)}addPackage(t){const e="string"==typeof t?t:t[0],s=this.getPackage(e);s&&this.configurations.add(s,"string"==typeof t?s.priority:t[1])}add(t,e,s={}){const i=this.getPackage(t);this.append(i),this.configurations.add(i,i.priority),this.init();const r=e.parseOptions;r.nodeFactory.setCreators(i.nodes);for(const t of Object.keys(i.items))r.itemFactory.setNodeClass(t,i.items[t]);Oa.addTags(i.tags),Bi(r.options,i.options),Fi(r.options,s),this.addFilters(e,i),i.config&&i.config(this,e)}getPackage(t){const e=Ya.get(t);if(e&&!this.parsers.includes(e.parser))throw Error(`Package '${t}' doesn't target the proper parser`);return e||this.warn(`Package '${t}' not found. Omitted.`),e}append(t,e){e=e||t.priority,t.initMethod&&this.initMethod.add(t.initMethod[0],t.initMethod[1]),t.configMethod&&this.configMethod.add(t.configMethod[0],t.configMethod[1]),this.handlers.add(t.handler,t.fallback,e),Object.assign(this.items,t.items),Object.assign(this.tags,t.tags),Bi(this.options,t.options),Object.assign(this.nodes,t.nodes)}addFilters(t,e){for(const[s,i]of e.preprocessors)t.preFilters.add(s,i);for(const[s,i]of e.postprocessors)t.postFilters.add(s,i)}warn(t){console.warn("MathJax Warning: "+t)}}class Za extends da{constructor(t,e){super(t),this.global=e}get kind(){return"start"}get isOpen(){return!0}checkItem(t){if(t.isKind("stop")){let t=this.toMml();return this.global.isInner||(t=this.factory.configuration.tags.finalize(t,this.env)),[[this.factory.create("mml",t)],!0]}return super.checkItem(t)}}class tl extends da{get kind(){return"stop"}get isClose(){return!0}}class el extends da{get kind(){return"open"}get isOpen(){return!0}checkItem(t){if(t.isKind("close")){const e=this.toMml(),s=this.create("node","TeXAtom",[e]);return t.addLatexItem(s),[[this.factory.create("mml",s)],!0]}return super.checkItem(t)}}el.errors=Object.assign(Object.create(da.errors),{stop:["ExtraOpenMissingClose","Extra open brace or missing close brace"]});class sl extends da{get kind(){return"close"}get isClose(){return!0}}class il extends da{get kind(){return"null"}}class rl extends da{get kind(){return"prime"}checkItem(t){const[e,s]=this.Peek(2),i=(Ko.isType(e,"msubsup")||Ko.isType(e,"msup"))&&!Ko.getChildAt(e,e.sup),r=(Ko.isType(e,"munderover")||Ko.isType(e,"mover"))&&!Ko.getChildAt(e,e.over)&&!Ko.getProperty(e,"subsupOK");if(!i&&!r){return[[this.create("node",e.getProperty("movesupsub")?"mover":"msup",[e,s]),t],!0]}const n=i?e.sup:e.over;return Ko.setChild(e,n,s),[[e,t],!0]}}class nl extends da{get kind(){return"subsup"}checkItem(t){if(t.isKind("open")||t.isKind("left"))return da.success;const e=this.First,s=this.getProperty("position");if(t.isKind("mml")){if(this.getProperty("primes"))if(2!==s)Ko.setChild(e,2,this.getProperty("primes"));else{Ko.setProperty(this.getProperty("primes"),"variantForm",!0);const e=this.create("node","mrow",[this.getProperty("primes"),t.First]);t.First=e}Ko.setChild(e,s,t.First),null!=this.getProperty("movesupsub")&&Ko.setProperty(e,"movesupsub",this.getProperty("movesupsub"));return[[this.factory.create("mml",e)],!0]}super.checkItem(t);const i=this.getErrors(["","sub","sup"][s]);throw new ca(i[0],i[1],...i.splice(2))}}nl.errors=Object.assign(Object.create(da.errors),{stop:["MissingScript","Missing superscript or subscript argument"],sup:["MissingOpenForSup","Missing open brace for superscript"],sub:["MissingOpenForSub","Missing open brace for subscript"]});class ol extends da{constructor(t){super(t),this.setProperty("name","\\over")}get kind(){return"over"}get isClose(){return!0}checkItem(t){if(t.isKind("over"))throw new ca("AmbiguousUseOf","Ambiguous use of %1",t.getName());if(t.isClose){let e=this.create("node","mfrac",[this.getProperty("num"),this.toMml(!1)]);return null!=this.getProperty("thickness")&&Ko.setAttribute(e,"linethickness",this.getProperty("thickness")),(this.getProperty("ldelim")||this.getProperty("rdelim"))&&(Ko.setProperty(e,"withDelims",!0),e=Na.fixedFence(this.factory.configuration,this.getProperty("ldelim"),e,this.getProperty("rdelim"))),e.attributes.set($o.Attr.LATEXITEM,this.getProperty("name")),[[this.factory.create("mml",e),t],!0]}return super.checkItem(t)}toString(){return"over["+this.getProperty("num")+" / "+this.nodes.join("; ")+"]"}}class al extends da{constructor(t,e){super(t),this.setProperty("delim",e)}get kind(){return"left"}get isOpen(){return!0}checkItem(t){if(t.isKind("right")){const e=Na.fenced(this.factory.configuration,this.getProperty("delim"),this.toMml(),t.getProperty("delim"),"",t.getProperty("color")),s=e.childNodes[0],i=e.childNodes[e.childNodes.length-1],r=this.factory.create("mml",e);return this.addLatexItem(s,"\\left"),t.addLatexItem(i,"\\right"),r.Peek()[0].attributes.set($o.Attr.LATEXITEM,"\\left"+t.startStr.slice(this.startI,t.stopI)),[[r],!0]}if(t.isKind("middle")){const e={stretchy:!0};t.getProperty("color")&&(e.mathcolor=t.getProperty("color"));const s=this.create("token","mo",e,t.getProperty("delim"));return t.addLatexItem(s,"\\middle"),this.Push(this.create("node","TeXAtom",[],{texClass:fr.CLOSE}),s,this.create("node","TeXAtom",[],{texClass:fr.OPEN})),this.env={},[[this],!0]}return super.checkItem(t)}}al.errors=Object.assign(Object.create(da.errors),{stop:["ExtraLeftMissingRight","Extra \\left or missing \\right"]});class ll extends da{constructor(t,e,s){super(t),this.setProperty("delim",e),s&&this.setProperty("color",s)}get kind(){return"middle"}get isClose(){return!0}}class cl extends da{constructor(t,e,s){super(t),this.setProperty("delim",e),s&&this.setProperty("color",s)}get kind(){return"right"}get isClose(){return!0}}class hl extends da{get kind(){return"break"}constructor(t,e,s){super(t),this.setProperty("linebreak",e),this.setProperty("insert",s)}checkItem(t){var e,s;const i=this.getProperty("linebreak");if(t.isKind("mml")){const r=t.First;if(r.isKind("mo")){if("after"!==((null===(s=null===(e=Ko.getOp(r))||void 0===e?void 0:e[3])||void 0===s?void 0:s.linebreakstyle)||Ko.getAttribute(r,"linebreakstyle")))return Ko.setAttribute(r,"linebreak",i),[[t],!0];if(!this.getProperty("insert"))return[[t],!0]}}const r=this.create("token","mspace",{linebreak:i});return[[this.factory.create("mml",r),t],!0]}}class dl extends da{get kind(){return"begin"}get isOpen(){return!0}checkItem(t){if(t.isKind("end")){if(t.getName()!==this.getName())throw new ca("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),t.getName());const e=this.toMml();return t.addLatexItem(e),[[this.factory.create("mml",e)],!0]}if(t.isKind("stop"))throw new ca("EnvMissingEnd","Missing \\end{%1}",this.getName());return super.checkItem(t)}}class ul extends da{get kind(){return"end"}get isClose(){return!0}}class pl extends da{get kind(){return"style"}checkItem(t){if(!t.isClose)return super.checkItem(t);const e=this.create("node","mstyle",this.nodes,this.getProperty("styles"));return[[this.factory.create("mml",e),t],!0]}}class ml extends da{get kind(){return"position"}checkItem(t){if(t.isClose)throw new ca("MissingBoxFor","Missing box for %1",this.getName());if(t.isFinal){let e=t.toMml();switch(this.getProperty("move")){case"vertical":return e=this.create("node","mpadded",[e],{height:this.getProperty("dh"),depth:this.getProperty("dd"),voffset:this.getProperty("dh")}),[[this.factory.create("mml",e)],!0];case"horizontal":return[[this.factory.create("mml",this.getProperty("left")),t,this.factory.create("mml",this.getProperty("right"))],!0]}}return super.checkItem(t)}}class fl extends da{get kind(){return"cell"}get isClose(){return!0}}class gl extends da{get isFinal(){return!0}get kind(){return"mml"}}class bl extends da{get kind(){return"fn"}checkItem(t){const e=this.First;if(e){if(t.isOpen)return da.success;if(!t.isKind("fn")){let s=t.First;if(!t.isKind("mml")||!s)return[[e,t],!0];if(Ko.isType(s,"mstyle")&&s.childNodes.length&&Ko.isType(s.childNodes[0].childNodes[0],"mspace")||Ko.isType(s,"mspace"))return[[e,t],!0];Ko.isEmbellished(s)&&(s=Ko.getCoreMO(s));const i=Ko.getForm(s);if(null!=i&&[0,0,1,1,0,1,1,0,0,0][i[2]])return[[e,t],!0]}if(e.isKind("TeXAtom")&&e.isEmpty)return[[e,t],!0];return[[e,this.create("token","mo",{texClass:fr.NONE},Co.ApplyFunction),t],!0]}return super.checkItem(t)}}class El extends da{constructor(){super(...arguments),this.remap=Xa.getMap("not_remap")}get kind(){return"not"}checkItem(t){let e,s,i;if(t.isKind("open")||t.isKind("left"))return da.success;if(t.isKind("mml")&&(Ko.isType(t.First,"mo")||Ko.isType(t.First,"mi")||Ko.isType(t.First,"mtext"))&&(e=t.First,s=Ko.getText(e),1===s.length&&!Ko.getProperty(e,"movesupsub")&&1===Ko.getChildren(e).length))return this.remap.contains(s)?(i=this.create("text",this.remap.lookup(s).char),Ko.setChild(e,0,i)):(i=this.create("text","\u0338"),Ko.appendChildren(e,[i])),[[t],!0];i=this.create("text","\u29f8");const r=this.create("node","mtext",[],{},i),n=this.create("node","mpadded",[r],{width:0});return e=this.create("node","TeXAtom",[n],{texClass:fr.REL}),[[e,t],!0]}}class xl extends da{get kind(){return"nonscript"}checkItem(t){if(t.isKind("mml")&&1===t.Size()){let e=t.First;if(e.isKind("mstyle")&&e.notParent&&(e=Ko.getChildren(Ko.getChildren(e)[0])[0]),e.isKind("mspace")){if(e!==t.First){const e=this.create("node","mrow",[t.Pop()]);t.Push(e)}this.factory.configuration.addNode("nonscript",t.First)}}return[[t],!0]}}class yl extends da{get kind(){return"dots"}checkItem(t){if(t.isKind("open")||t.isKind("left"))return da.success;let e=this.getProperty("ldots");const s=t.First;if(t.isKind("mml")&&Ko.isEmbellished(s)){const t=Ko.getTexClass(Ko.getCoreMO(s));t!==fr.BIN&&t!==fr.REL||(e=this.getProperty("cdots"))}return[[e,t],!0]}}class Nl extends da{constructor(){super(...arguments),this.table=[],this.row=[],this.frame=[],this.hfill=[],this.arraydef={},this.cstart=[],this.cend=[],this.cextra=[],this.atEnd=!1,this.ralign=[],this.breakAlign={cell:"",row:"",table:""},this.templateSubs=0}get kind(){return"array"}get isOpen(){return!0}get copyEnv(){return!1}checkItem(t){if(t.isClose&&!t.isKind("over")){if(t.getProperty("isEntry"))return this.EndEntry(),this.clearEnv(),this.StartEntry(),da.fail;if(t.getProperty("isCR"))return this.EndEntry(),this.EndRow(),this.clearEnv(),this.StartEntry(),da.fail;this.EndTable(),this.clearEnv();const e=this.factory.create("mml",this.createMml());if(this.getProperty("requireClose")){if(t.isKind("close"))return[[e],!0];throw new ca("MissingCloseBrace","Missing close brace")}return[[e,t],!0]}return super.checkItem(t)}createMml(){const t=this.arraydef.scriptlevel;delete this.arraydef.scriptlevel;let e=this.create("node","mtable",this.table,this.arraydef);return t&&e.setProperty("smallmatrix",!0),this.breakAlign.table&&Ko.setAttribute(e,"data-break-align",this.breakAlign.table),this.getProperty("arrayPadding")&&(Ko.setAttribute(e,"data-frame-styles",""),Ko.setAttribute(e,"framespacing",this.getProperty("arrayPadding"))),e=this.handleFrame(e),void 0!==t&&(e=this.create("node","mstyle",[e],{scriptlevel:t})),(this.getProperty("open")||this.getProperty("close"))&&(e=Na.fenced(this.factory.configuration,this.getProperty("open"),e,this.getProperty("close"))),e}handleFrame(t){if(!this.frame.length)return t;const e=new Map(this.frame),s=this.frame.reduce((t,[,e])=>e===t?e:"",this.frame[0][1]);if(s){if(4===this.frame.length)return Ko.setAttribute(t,"frame",s),Ko.removeAttribute(t,"data-frame-styles"),t;if("solid"===s)return Ko.setAttribute(t,"data-frame-styles",""),t=this.create("node","menclose",[t],{notation:Array.from(e.keys()).join(" "),"data-padding":0})}const i=wo.map(t=>e.get(t)||"none").join(" ");return Ko.setAttribute(t,"data-frame-styles",i),t}StartEntry(){const t=this.row.length;let e=this.cstart[t],s=this.cend[t];const i=this.ralign[t],r=this.cextra;if(!(e||s||i||r[t]||r[t+1]))return;let[n,o,a,l]=this.getEntry();if(!r[t]||this.atEnd&&!r[t+1]||(e+="&"),"&"!==a&&(l=!!o.trim()||!!(t||a&&"\\end"!==a.substring(0,4)),r[t+1]&&!r[t]&&(s=(s||"")+"&",this.atEnd=!0)),!l&&!n)return;const c=this.parser;if(l&&(e&&(o=Na.addArgs(c,e,o)),s&&(o=Na.addArgs(c,o,s)),i&&(o="\\text{"+o.trim()+"}"),(e||s||i)&&++this.templateSubs>c.configuration.options.maxTemplateSubtitutions))throw new ca("MaxTemplateSubs","Maximum template substitutions exceeded; is there an invalid use of \\\\ in the template?");n&&(o=Na.addArgs(c,n,o)),c.string=Na.addArgs(c,o,c.string),c.i=0}getEntry(){const t=this.parser,e=/^([^]*?)([&{}]|\\\\|\\(?:begin|end)\s*\{array\}|\\cr|\\)/;let s,i=0,r=0,n=t.i;const o=["","","",!1];for(;null!==(s=t.string.slice(n).match(e));)switch(n+=s[0].length,s[2]){case"\\":n++;break;case"{":i++;break;case"}":if(!i)return o;i--;break;case"\\begin{array}":i||r++;break;case"\\end{array}":if(!i&&r){r--;break}default:{if(i||r)continue;n-=s[2].length;let e=t.string.slice(t.i,n).trim();const o=e.match(/^(?:\s*\\(?:h(?:dash)?line|hfil{1,3}|rowcolor\s*\{.*?\}))+/);return o&&(e=e.slice(o[0].length)),t.string=t.string.slice(n),t.i=0,[(null==o?void 0:o[0])||"",e,s[2],!0]}}return o}EndEntry(){const t=this.create("node","mtd",this.nodes);this.hfill.length&&(0===this.hfill[0]&&Ko.setAttribute(t,"columnalign","right"),this.hfill[this.hfill.length-1]===this.Size()&&Ko.setAttribute(t,"columnalign",Ko.getAttribute(t,"columnalign")?"center":"left"));const e=this.ralign[this.row.length];if(e){const[s,i,r]=e,n=this.create("node","mpadded",t.childNodes[0].childNodes,{width:i,"data-overflow":"auto","data-align":r,"data-vertical-align":s});n.setProperty("vbox",s),t.childNodes[0].childNodes=[],t.appendChild(n)}else this.breakAlign.cell&&Ko.setAttribute(t,"data-vertical-align",this.breakAlign.cell);this.breakAlign.cell="",this.row.push(t),this.Clear(),this.hfill=[]}EndRow(){let t="mtr";this.getProperty("isNumbered")&&3===this.row.length?(this.row.unshift(this.row.pop()),t="mlabeledtr"):this.getProperty("isLabeled")&&(t="mlabeledtr",this.setProperty("isLabeled",!1));const e=this.create("node",t,this.row);this.breakAlign.row&&(Ko.setAttribute(e,"data-break-align",this.breakAlign.row),this.breakAlign.row=""),this.addLatexItem(e),this.table.push(e),this.row=[],this.atEnd=!1}EndTable(){(this.Size()||this.row.length)&&(this.EndEntry(),this.EndRow()),this.checkLines()}checkLines(){if(this.arraydef.rowlines){const t=this.arraydef.rowlines.split(/ /);t.length===this.table.length?(this.frame.push(["bottom",t.pop()]),t.length?this.arraydef.rowlines=t.join(" "):delete this.arraydef.rowlines):t.lengththis.maxrow&&(this.maxrow=this.row.length);const t=this.factory.configuration.tags.getTag();t&&(this.row=[t].concat(this.row),this.setProperty("isLabeled",!0)),this.factory.configuration.tags.clearTag(),super.EndRow()}EndTable(){super.EndTable(),this.factory.configuration.tags.end(),this.extendArray("columnalign",this.maxrow),this.extendArray("columnwidth",this.maxrow),this.extendArray("columnspacing",this.maxrow-1),this.extendArray("data-break-align",this.maxrow),this.addIndentshift()}extendArray(t,e){if(!this.arraydef[t])return;const s=this.arraydef[t].split(/ /),i=[...s];if(i.length>1){for(;i.length0){const t="center"===e?".7em":"2em";for(const e of this.table){const i=e.childNodes[e.isKind("mlabeledtr")?s+1:s];if(i){const e=this.create("node","mstyle",i.childNodes[0].childNodes,{indentshift:t});i.childNodes[0].childNodes=[],i.appendChild(e)}}}e=t[s]}}}class Tl extends dl{get kind(){return"mstyle"}constructor(t,e,s){super(t),this.attrList=e,this.setProperty("name",s)}checkItem(t){if(t.isKind("end")&&t.getName()===this.getName()){return[[this.create("node","mstyle",[this.toMml()],this.attrList)],!0]}return super.checkItem(t)}}class Cl extends da{constructor(t,...e){super(t),this.factory.configuration.tags.start("equation",!0,e[0])}get kind(){return"equation"}get isOpen(){return!0}checkItem(t){if(t.isKind("end")){const e=this.toMml(),s=this.factory.configuration.tags.getTag();return this.factory.configuration.tags.end(),[[s?this.factory.configuration.tags.enTag(e,s):e,t],!0]}if(t.isKind("stop"))throw new ca("EnvMissingEnd","Missing \\end{%1}",this.getName());return super.checkItem(t)}}const Al=1.2/.85,Ll={fontfamily:1,fontsize:1,fontweight:1,fontstyle:1,color:1,background:1,id:1,class:1,href:1,style:1};function Sl(t,e=1/0){const s=t.replace(/\s+/g,"").split("").map(t=>{const e={t:"top",b:"bottom",m:"middle",c:"center"}[t];if(!e)throw new ca("BadBreakAlign","Invalid alignment character: %1",t);return e});if(s.length>e)throw new ca("TooManyAligns","Too many alignment characters: %1",t);return 1===e?s[0]:s.join(" ")}function Rl(t,e){const s=t.stack.env,i=s.inRoot;s.inRoot=!0;const r=new ua(e,s,t.configuration);let n=r.mml();const o=r.stack.global;if(o.leftRoot||o.upRoot){const e={};o.leftRoot&&(e.width=o.leftRoot),o.upRoot&&(e.voffset=o.upRoot,e.height=o.upRoot),n=t.create("node","mpadded",[n],e)}return s.inRoot=i,n}const Ml={Open(t,e){t.Push(t.itemFactory.create("open"))},Close(t,e){t.Push(t.itemFactory.create("close"))},Bar(t,e){const s=t.create("token","mo",{stretchy:!1,texClass:fr.ORD},e);s.setProperty("keep-attrs","stretchy"),t.Push(s)},Tilde(t,e){t.Push(t.create("token","mtext",{},Co.nbsp))},Space(t,e){},Superscript(t,e){let s,i;t.GetNext().match(/\d/)&&(t.string=t.string.substring(0,t.i+1)+" "+t.string.substring(t.i+1));const r=t.stack.Top();r.isKind("prime")?([i,s]=r.Peek(2),t.stack.Pop()):(i=t.stack.Prev(),i||(i=t.create("token","mi",{},"")));const n=Ko.getProperty(i,"movesupsub");let o=Ko.isType(i,"msubsup")?i.sup:i.over;if(Ko.isType(i,"msubsup")&&!Ko.isType(i,"msup")&&Ko.getChildAt(i,i.sup)||Ko.isType(i,"munderover")&&!Ko.isType(i,"mover")&&Ko.getChildAt(i,i.over)&&!Ko.getProperty(i,"subsupOK"))throw new ca("DoubleExponent","Double exponent: use braces to clarify");Ko.isType(i,"msubsup")&&!Ko.isType(i,"msup")||(n?((!Ko.isType(i,"munderover")||Ko.isType(i,"mover")||Ko.getChildAt(i,i.over))&&(i=t.create("node","munderover",[i],{movesupsub:!0})),o=i.over):(i=t.create("node","msubsup",[i]),o=i.sup)),t.Push(t.itemFactory.create("subsup",i).setProperties({position:o,primes:s,movesupsub:n}))},Subscript(t,e){let s,i;t.GetNext().match(/\d/)&&(t.string=t.string.substring(0,t.i+1)+" "+t.string.substring(t.i+1));const r=t.stack.Top();r.isKind("prime")?([i,s]=r.Peek(2),t.stack.Pop()):(i=t.stack.Prev(),i||(i=t.create("token","mi",{},"")));const n=Ko.getProperty(i,"movesupsub");let o=Ko.isType(i,"msubsup")?i.sub:i.under;if(Ko.isType(i,"msubsup")&&!Ko.isType(i,"msup")&&Ko.getChildAt(i,i.sub)||Ko.isType(i,"munderover")&&!Ko.isType(i,"mover")&&Ko.getChildAt(i,i.under)&&!Ko.getProperty(i,"subsupOK"))throw new ca("DoubleSubscripts","Double subscripts: use braces to clarify");Ko.isType(i,"msubsup")&&!Ko.isType(i,"msup")||(n?((!Ko.isType(i,"munderover")||Ko.isType(i,"mover")||Ko.getChildAt(i,i.under))&&(i=t.create("node","munderover",[i],{movesupsub:!0})),o=i.under):(i=t.create("node","msubsup",[i]),o=i.sub)),t.Push(t.itemFactory.create("subsup",i).setProperties({position:o,primes:s,movesupsub:n}))},Prime(t,e){let s=t.stack.Prev();if(s||(s=t.create("token","mi")),Ko.isType(s,"msubsup")&&!Ko.isType(s,"msup")&&Ko.getChildAt(s,s.sup)||Ko.isType(s,"munderover")&&!Ko.isType(s,"mover")&&Ko.getChildAt(s,s.over)&&!Ko.getProperty(s,"subsupOK"))throw new ca("DoubleExponentPrime","Prime causes double exponent: use braces to clarify");let i="";t.i--;do{i+=Co.prime,t.i++,e=t.GetNext()}while("'"===e||e===Co.rsquo);i=["","\u2032","\u2033","\u2034","\u2057"][i.length]||i;const r=t.create("token","mo",{variantForm:!0},i);t.Push(t.itemFactory.create("prime",s,r))},Comment(t,e){for(;t.in.macroColumn(t,r,parseInt(i)),t.Push(t.itemFactory.create("null"))},BeginEnd(t,e){const s=t.GetArgument(e);if(s.match(/\\/))throw new ca("InvalidEnv","Invalid environment name '%1'",s);const i=t.configuration.handlers.get(ra.ENVIRONMENT).lookup(s);if(i&&"\\end"===e){if(!i.args[0]){const e=t.itemFactory.create("end").setProperty("name",s);return void t.Push(e)}t.stack.env.closing=s}Na.checkMaxMacros(t,!1),t.parse(ra.ENVIRONMENT,[t,s])},Array(t,e,s,i,r,n,o,a,l){r||(r=t.GetArgument("\\begin{"+e.getName()+"}"));const c=t.itemFactory.create("array");return"array"===e.getName()&&c.setProperty("arrayPadding",".5em .125em"),c.parser=t,c.arraydef={columnspacing:n||"1em",rowspacing:o||"4pt"},t.configuration.columnParser.process(t,r,c),s&&c.setProperty("open",t.convertDelimiter(s)),i&&c.setProperty("close",t.convertDelimiter(i)),"'"===(a||"").charAt(1)&&(c.arraydef["data-cramped"]=!0,a=a.charAt(0)),"D"===a?c.arraydef.displaystyle=!0:a&&(c.arraydef.displaystyle=!1),c.arraydef.scriptlevel="S"===a?1:0,l&&(c.arraydef.useHeight=!1),t.Push(e),c.StartEntry(),c},AlignedArray(t,e,s=""){const i=t.GetBrackets("\\begin{"+e.getName()+"}"),r=Ml.Array(t,e,null,null,null,null,null,s);return Na.setArrayAlign(r,i)},IndentAlign(t,e){const s=`\\begin{${e.getName()}}`,i=t.GetBrackets(s,""),r=t.GetBrackets(s,""),n=t.GetBrackets(s,"");if(i&&!oa.matchDimen(i)[0]||r&&!oa.matchDimen(r)[0]||n&&!oa.matchDimen(n)[0])throw new ca("BracketMustBeDimension","Bracket argument to %1 must be a dimension",s);const o=t.GetArgument(s);if(o&&!o.match(/^([lcr]{1,3})?$/))throw new ca("BadAlignment","Alignment must be one to three copies of l, c, or r");const a=[...o].map(t=>({l:"left",c:"center",r:"right"}[t]));1===a.length&&a.push(a[0]);const l={};for(const[t,e]of[["indentshiftfirst",i],["indentshift",r||i],["indentshiftlast",n],["indentalignfirst",a[0]],["indentalign",a[1]],["indentalignlast",a[2]]])e&&(l[t]=e);t.Push(t.itemFactory.create("mstyle",l,e.getName()))},Equation:(t,e,s,i=!0)=>(t.configuration.mathItem.display=i,t.stack.env.display=i,Na.checkEqnEnv(t),t.Push(e),t.itemFactory.create("equation",s).setProperty("name",e.getName())),EqnArray(t,e,s,i,r,n,o){const a=e.getName(),l="gather"===a||"gather*"===a;i&&Na.checkEqnEnv(t,!l),t.Push(e),r=(r=r.replace(/[^clr]/g,"").split("").join(" ")).replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center"),n=Sl(n);const c=t.itemFactory.create("eqnarray",a,s,i,t.stack.global);return c.arraydef={displaystyle:!0,columnalign:r,columnspacing:o||"1em",rowspacing:"3pt","data-break-align":n,side:t.options.tagSide,minlabelspacing:t.options.tagIndent},l&&c.setProperty("nestable",!0),c},HandleNoTag(t,e){t.tags.notag()},HandleLabel(t,e){const s=t.GetArgument(e);if(""!==s&&!t.tags.refUpdate){if(t.tags.label)throw new ca("MultipleCommand","Multiple %1",t.currentCS);if(t.tags.label=s,(t.tags.allLabels[s]||t.tags.labels[s])&&!t.options.ignoreDuplicateLabels)throw new ca("MultipleLabel","Label '%1' multiply defined",s);t.tags.labels[s]=new La}},HandleRef(t,e,s){const i=t.GetArgument(e);let r=t.tags.allLabels[i]||t.tags.labels[i];r||(t.tags.refUpdate||(t.tags.redo=!0),r=new La);let n=r.tag;s&&(n=t.tags.formatRef(n));const o=t.create("node","mrow",Na.internalMath(t,Array.isArray(n)?n.join(""):n),{href:t.tags.formatUrl(r.id,t.options.baseURL),class:"MathJax_ref"});t.Push(o)},Macro(t,e,s,i,r){if(i){const n=[];if(null!=r){const s=t.GetBrackets(e);n.push(null==s?r:s)}for(let s=n.length;s1&&(i.autoOP=!1)),!i.mathvariant&&Na.isLatinOrGreekChar(e)){const s=t.configuration.mathStyle(e);s&&(i.mathvariant=s)}const n=t.create("token","mi",i,e);t.Push(n)},digit(t,e){const s=t.configuration.options.numberPattern,i=t.string.slice(t.i-1).match(s);if(!i)return!1;const r=Na.getFontDef(t),n=t.create("token","mn",r,i[0].replace(/[{}]/g,""));return t.i+=i[0].length-1,t.Push(n),!0},controlSequence(t,e){const s=t.GetCS();t.parse(ra.MACRO,[t,s])},lcGreek(t,e){const s={mathvariant:t.configuration.mathStyle(e.char)||wl.ITALIC},i=t.create("token","mi",s,e.char);t.Push(i)},ucGreek(t,e){const s={mathvariant:t.stack.env.font||t.configuration.mathStyle(e.char,!0)||wl.NORMAL},i=t.create("token","mi",s,e.char);t.Push(i)},mathchar0mi(t,e){const s=e.attributes||{mathvariant:wl.ITALIC},i=t.create("token","mi",s,e.char);t.Push(i)},mathchar0mo(t,e){const s=e.attributes||{};s.stretchy=!1;const i=t.create("token","mo",s,e.char);Ko.setProperty(i,"fixStretchy",!0),t.configuration.addNode("fixStretchy",i),t.Push(i)},mathchar7(t,e){const s=e.attributes||{mathvariant:wl.NORMAL};t.stack.env.font&&(s.mathvariant=t.stack.env.font);const i=t.create("token","mi",s,e.char);t.Push(i)},delimiter(t,e){let s=e.attributes||{};s=Object.assign({fence:!1,stretchy:!1},s);const i=t.create("token","mo",s,e.char);"|"===e.char&&i.setProperty("keep-attrs","stretchy"),t.Push(i)},environment(t,e,s,i){const r=t.itemFactory.create("begin").setProperty("name",e);t.Push(s(t,r,...i.slice(1)))}},Ol=kl,Dl=yo(bo.thickmathspace),Pl=$o.Variant;new ja("letter",Ol.variable,/[a-z]/i),new ja("digit",Ol.digit,/[0-9.,]/),new ja("command",Ol.controlSequence,/^\\/),new Wa("special",{"{":Il.Open,"}":Il.Close,"~":Il.Tilde,"^":Il.Superscript,_:Il.Subscript,"|":Il.Bar," ":Il.Space,"\t":Il.Space,"\r":Il.Space,"\n":Il.Space,"'":Il.Prime,"%":Il.Comment,"&":Il.Entry,"#":Il.Hash,"\xa0":Il.Space,"\u2019":Il.Prime}),new Ua("lcGreek",Ol.lcGreek,{alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsilon:"\u03f5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",lambda:"\u03bb",mu:"\u03bc",nu:"\u03bd",xi:"\u03be",omicron:"\u03bf",pi:"\u03c0",rho:"\u03c1",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03d5",chi:"\u03c7",psi:"\u03c8",omega:"\u03c9",varepsilon:"\u03b5",vartheta:"\u03d1",varpi:"\u03d6",varrho:"\u03f1",varsigma:"\u03c2",varphi:"\u03c6"}),new Ua("ucGreek",Ol.ucGreek,{Gamma:"\u0393",Delta:"\u0394",Theta:"\u0398",Lambda:"\u039b",Xi:"\u039e",Pi:"\u03a0",Sigma:"\u03a3",Upsilon:"\u03a5",Phi:"\u03a6",Psi:"\u03a8",Omega:"\u03a9"}),new Ua("mathchar0mi",Ol.mathchar0mi,{AA:"\u212b",S:["\xa7",{mathvariant:Pl.NORMAL}],aleph:["\u2135",{mathvariant:Pl.NORMAL}],hbar:["\u210f",{variantForm:!0}],imath:"\u0131",jmath:"\u0237",ell:"\u2113",wp:["\u2118",{mathvariant:Pl.NORMAL}],Re:["\u211c",{mathvariant:Pl.NORMAL}],Im:["\u2111",{mathvariant:Pl.NORMAL}],partial:["\u2202",{mathvariant:Pl.ITALIC}],infty:["\u221e",{mathvariant:Pl.NORMAL}],prime:["\u2032",{variantForm:!0}],emptyset:["\u2205",{mathvariant:Pl.NORMAL}],nabla:["\u2207",{mathvariant:Pl.NORMAL}],top:["\u22a4",{mathvariant:Pl.NORMAL}],bot:["\u22a5",{mathvariant:Pl.NORMAL}],angle:["\u2220",{mathvariant:Pl.NORMAL}],triangle:["\u25b3",{mathvariant:Pl.NORMAL}],backslash:["\\",{mathvariant:Pl.NORMAL}],forall:["\u2200",{mathvariant:Pl.NORMAL}],exists:["\u2203",{mathvariant:Pl.NORMAL}],neg:["\xac",{mathvariant:Pl.NORMAL}],lnot:["\xac",{mathvariant:Pl.NORMAL}],flat:["\u266d",{mathvariant:Pl.NORMAL}],natural:["\u266e",{mathvariant:Pl.NORMAL}],sharp:["\u266f",{mathvariant:Pl.NORMAL}],clubsuit:["\u2663",{mathvariant:Pl.NORMAL}],diamondsuit:["\u2662",{mathvariant:Pl.NORMAL}],heartsuit:["\u2661",{mathvariant:Pl.NORMAL}],spadesuit:["\u2660",{mathvariant:Pl.NORMAL}]}),new Ua("mathchar0mo",Ol.mathchar0mo,{surd:["\u221a",{symmetric:!0}],coprod:["\u2210",{movesupsub:!0}],bigvee:["\u22c1",{movesupsub:!0}],bigwedge:["\u22c0",{movesupsub:!0}],biguplus:["\u2a04",{movesupsub:!0}],bigcap:["\u22c2",{movesupsub:!0}],bigcup:["\u22c3",{movesupsub:!0}],int:"\u222b",intop:["\u222b",{movesupsub:!0,movablelimits:!0}],iint:"\u222c",iiint:"\u222d",prod:["\u220f",{movesupsub:!0}],sum:["\u2211",{movesupsub:!0}],bigotimes:["\u2a02",{movesupsub:!0}],bigoplus:["\u2a01",{movesupsub:!0}],bigodot:["\u2a00",{movesupsub:!0}],oint:"\u222e",ointop:["\u222e",{movesupsub:!0,movablelimits:!0}],oiint:"\u222f",oiiint:"\u2230",bigsqcup:["\u2a06",{movesupsub:!0}],smallint:["\u222b",{largeop:!1}],triangleleft:"\u25c3",triangleright:"\u25b9",bigtriangleup:"\u25b3",bigtriangledown:"\u25bd",wedge:"\u2227",land:"\u2227",vee:"\u2228",lor:"\u2228",cap:"\u2229",cup:"\u222a",ddagger:"\u2021",dagger:"\u2020",sqcap:"\u2293",sqcup:"\u2294",uplus:"\u228e",amalg:"\u2a3f",diamond:"\u22c4",bullet:"\u2219",wr:"\u2240",div:"\xf7",odot:["\u2299",{largeop:!1}],oslash:["\u2298",{largeop:!1}],otimes:["\u2297",{largeop:!1}],ominus:["\u2296",{largeop:!1}],oplus:["\u2295",{largeop:!1}],mp:"\u2213",pm:"\xb1",circ:"\u2218",bigcirc:"\u25ef",setminus:"\u2216",cdot:"\u22c5",ast:"\u2217",times:"\xd7",star:"\u22c6",propto:"\u221d",sqsubseteq:"\u2291",sqsupseteq:"\u2292",parallel:"\u2225",mid:"\u2223",dashv:"\u22a3",vdash:"\u22a2",leq:"\u2264",le:"\u2264",geq:"\u2265",ge:"\u2265",lt:"<",gt:">",succ:"\u227b",prec:"\u227a",approx:"\u2248",succeq:"\u2ab0",preceq:"\u2aaf",supset:"\u2283",subset:"\u2282",supseteq:"\u2287",subseteq:"\u2286",in:"\u2208",ni:"\u220b",notin:"\u2209",owns:"\u220b",gg:"\u226b",ll:"\u226a",sim:"\u223c",simeq:"\u2243",perp:"\u27c2",equiv:"\u2261",asymp:"\u224d",smile:"\u2323",frown:"\u2322",ne:"\u2260",neq:"\u2260",cong:"\u2245",doteq:"\u2250",bowtie:"\u22c8",models:"\u22a7",notChar:"\u29f8",Leftrightarrow:"\u21d4",Leftarrow:"\u21d0",Rightarrow:"\u21d2",leftrightarrow:"\u2194",leftarrow:"\u2190",gets:"\u2190",rightarrow:"\u2192",to:["\u2192",{accent:!1}],mapsto:"\u21a6",leftharpoonup:"\u21bc",leftharpoondown:"\u21bd",rightharpoonup:"\u21c0",rightharpoondown:"\u21c1",nearrow:"\u2197",searrow:"\u2198",nwarrow:"\u2196",swarrow:"\u2199",rightleftharpoons:"\u21cc",hookrightarrow:"\u21aa",hookleftarrow:"\u21a9",longleftarrow:"\u27f5",Longleftarrow:"\u27f8",longrightarrow:"\u27f6",Longrightarrow:"\u27f9",Longleftrightarrow:"\u27fa",longleftrightarrow:"\u27f7",longmapsto:"\u27fc",ldots:"\u2026",cdots:"\u22ef",vdots:"\u22ee",ddots:"\u22f1",iddots:"\u22f0",dotsc:"\u2026",dotsb:"\u22ef",dotsm:"\u22ef",dotsi:"\u22ef",dotso:"\u2026",ldotp:[".",{texClass:fr.PUNCT}],cdotp:["\u22c5",{texClass:fr.PUNCT}],colon:[":",{texClass:fr.PUNCT}]}),new Ua("mathchar7",Ol.mathchar7,{_:"_","#":"#",$:"$","%":"%","&":"&",And:"&"}),new Ha("delimiter",Ol.delimiter,{"(":"(",")":")","[":"[","]":"]","<":"\u27e8",">":"\u27e9","\\lt":"\u27e8","\\gt":"\u27e9","/":"/","|":["|",{texClass:fr.ORD}],".":"","\\lmoustache":"\u23b0","\\rmoustache":"\u23b1","\\lgroup":"\u27ee","\\rgroup":"\u27ef","\\arrowvert":"\u23d0","\\Arrowvert":"\u2016","\\bracevert":"\u23aa","\\Vert":["\u2016",{texClass:fr.ORD}],"\\|":["\u2016",{texClass:fr.ORD}],"\\vert":["|",{texClass:fr.ORD}],"\\uparrow":"\u2191","\\downarrow":"\u2193","\\updownarrow":"\u2195","\\Uparrow":"\u21d1","\\Downarrow":"\u21d3","\\Updownarrow":"\u21d5","\\backslash":"\\","\\rangle":"\u27e9","\\langle":"\u27e8","\\rbrace":"}","\\lbrace":"{","\\}":"}","\\{":"{","\\rceil":"\u2309","\\lceil":"\u2308","\\rfloor":"\u230b","\\lfloor":"\u230a","\\lbrack":"[","\\rbrack":"]"}),new za("macros",{displaystyle:[Il.SetStyle,"D",!0,0],textstyle:[Il.SetStyle,"T",!1,0],scriptstyle:[Il.SetStyle,"S",!1,1],scriptscriptstyle:[Il.SetStyle,"SS",!1,2],rm:[Il.SetFont,Pl.NORMAL],mit:[Il.SetFont,Pl.ITALIC],oldstyle:[Il.SetFont,Pl.OLDSTYLE],cal:[Il.SetFont,Pl.CALLIGRAPHIC],it:[Il.SetFont,Pl.MATHITALIC],bf:[Il.SetFont,Pl.BOLD],sf:[Il.SetFont,Pl.SANSSERIF],tt:[Il.SetFont,Pl.MONOSPACE],frak:[Il.MathFont,Pl.FRAKTUR],Bbb:[Il.MathFont,Pl.DOUBLESTRUCK],mathrm:[Il.MathFont,Pl.NORMAL],mathup:[Il.MathFont,Pl.NORMAL],mathnormal:[Il.MathFont,""],mathbf:[Il.MathFont,Pl.BOLD],mathbfup:[Il.MathFont,Pl.BOLD],mathit:[Il.MathFont,Pl.MATHITALIC],mathbfit:[Il.MathFont,Pl.BOLDITALIC],mathbb:[Il.MathFont,Pl.DOUBLESTRUCK],mathfrak:[Il.MathFont,Pl.FRAKTUR],mathbffrak:[Il.MathFont,Pl.BOLDFRAKTUR],mathscr:[Il.MathFont,Pl.SCRIPT],mathbfscr:[Il.MathFont,Pl.BOLDSCRIPT],mathsf:[Il.MathFont,Pl.SANSSERIF],mathsfup:[Il.MathFont,Pl.SANSSERIF],mathbfsf:[Il.MathFont,Pl.BOLDSANSSERIF],mathbfsfup:[Il.MathFont,Pl.BOLDSANSSERIF],mathsfit:[Il.MathFont,Pl.SANSSERIFITALIC],mathbfsfit:[Il.MathFont,Pl.SANSSERIFBOLDITALIC],mathtt:[Il.MathFont,Pl.MONOSPACE],mathcal:[Il.MathFont,Pl.CALLIGRAPHIC],mathbfcal:[Il.MathFont,Pl.BOLDCALLIGRAPHIC],symrm:[Il.MathFont,Pl.NORMAL],symup:[Il.MathFont,Pl.NORMAL],symnormal:[Il.MathFont,""],symbf:[Il.MathFont,Pl.BOLD,Pl.BOLDITALIC],symbfup:[Il.MathFont,Pl.BOLD],symit:[Il.MathFont,Pl.ITALIC],symbfit:[Il.MathFont,Pl.BOLDITALIC],symbb:[Il.MathFont,Pl.DOUBLESTRUCK],symfrak:[Il.MathFont,Pl.FRAKTUR],symbffrak:[Il.MathFont,Pl.BOLDFRAKTUR],symscr:[Il.MathFont,Pl.SCRIPT],symbfscr:[Il.MathFont,Pl.BOLDSCRIPT],symsf:[Il.MathFont,Pl.SANSSERIF,Pl.SANSSERIFITALIC],symsfup:[Il.MathFont,Pl.SANSSERIF],symbfsf:[Il.MathFont,Pl.BOLDSANSSERIF],symbfsfup:[Il.MathFont,Pl.BOLDSANSSERIF],symsfit:[Il.MathFont,Pl.SANSSERIFITALIC],symbfsfit:[Il.MathFont,Pl.SANSSERIFBOLDITALIC],symtt:[Il.MathFont,Pl.MONOSPACE],symcal:[Il.MathFont,Pl.CALLIGRAPHIC],symbfcal:[Il.MathFont,Pl.BOLDCALLIGRAPHIC],textrm:[Il.HBox,null,Pl.NORMAL],textup:[Il.HBox,null,Pl.NORMAL],textnormal:[Il.HBox],textit:[Il.HBox,null,Pl.ITALIC],textbf:[Il.HBox,null,Pl.BOLD],textsf:[Il.HBox,null,Pl.SANSSERIF],texttt:[Il.HBox,null,Pl.MONOSPACE],Tiny:[Il.SetSize,.5],tiny:[Il.SetSize,.6],scriptsize:[Il.SetSize,.7],SMALL:[Il.SetSize,.7],Small:[Il.SetSize,.8],footnotesize:[Il.SetSize,.8],small:[Il.SetSize,.9],normalsize:[Il.SetSize,1],large:[Il.SetSize,1.095],Large:[Il.SetSize,1.2],LARGE:[Il.SetSize,1.44],huge:[Il.SetSize,1.728],Huge:[Il.SetSize,2.074],HUGE:[Il.SetSize,2.49],arcsin:Il.NamedFn,arccos:Il.NamedFn,arctan:Il.NamedFn,arg:Il.NamedFn,cos:Il.NamedFn,cosh:Il.NamedFn,cot:Il.NamedFn,coth:Il.NamedFn,csc:Il.NamedFn,deg:Il.NamedFn,det:Il.NamedOp,dim:Il.NamedFn,exp:Il.NamedFn,gcd:Il.NamedOp,hom:Il.NamedFn,inf:Il.NamedOp,ker:Il.NamedFn,lg:Il.NamedFn,lim:Il.NamedOp,liminf:[Il.NamedOp,"lim inf"],limsup:[Il.NamedOp,"lim sup"],ln:Il.NamedFn,log:Il.NamedFn,max:Il.NamedOp,min:Il.NamedOp,Pr:Il.NamedOp,sec:Il.NamedFn,sin:Il.NamedFn,sinh:Il.NamedFn,sup:Il.NamedOp,tan:Il.NamedFn,tanh:Il.NamedFn,limits:[Il.Limits,!0],nolimits:[Il.Limits,!1],overline:[Il.UnderOver,"2015"],underline:[Il.UnderOver,"2015"],overbrace:[Il.UnderOver,"23DE",!0],underbrace:[Il.UnderOver,"23DF",!0],overparen:[Il.UnderOver,"23DC"],underparen:[Il.UnderOver,"23DD"],overrightarrow:[Il.UnderOver,"2192"],underrightarrow:[Il.UnderOver,"2192"],overleftarrow:[Il.UnderOver,"2190"],underleftarrow:[Il.UnderOver,"2190"],overleftrightarrow:[Il.UnderOver,"2194"],underleftrightarrow:[Il.UnderOver,"2194"],overset:Il.Overset,underset:Il.Underset,overunderset:Il.Overunderset,stackrel:[Il.Macro,"\\mathrel{\\mathop{#2}\\limits^{#1}}",2],stackbin:[Il.Macro,"\\mathbin{\\mathop{#2}\\limits^{#1}}",2],over:Il.Over,overwithdelims:Il.Over,atop:Il.Over,atopwithdelims:Il.Over,above:Il.Over,abovewithdelims:Il.Over,brace:[Il.Over,"{","}"],brack:[Il.Over,"[","]"],choose:[Il.Over,"(",")"],frac:Il.Frac,sqrt:Il.Sqrt,root:Il.Root,uproot:[Il.MoveRoot,"upRoot"],leftroot:[Il.MoveRoot,"leftRoot"],left:Il.LeftRight,right:Il.LeftRight,middle:Il.LeftRight,llap:Il.Lap,rlap:Il.Lap,raise:Il.RaiseLower,lower:Il.RaiseLower,moveleft:Il.MoveLeftRight,moveright:Il.MoveLeftRight,",":[Il.Spacer,bo.thinmathspace],":":[Il.Spacer,bo.mediummathspace],">":[Il.Spacer,bo.mediummathspace],";":[Il.Spacer,bo.thickmathspace],"!":[Il.Spacer,bo.negativethinmathspace],enspace:[Il.Spacer,.5],quad:[Il.Spacer,1],qquad:[Il.Spacer,2],thinspace:[Il.Spacer,bo.thinmathspace],negthinspace:[Il.Spacer,bo.negativethinmathspace],"*":Il.DiscretionaryTimes,allowbreak:Il.AllowBreak,goodbreak:[Il.Linebreak,$o.LineBreak.GOODBREAK],badbreak:[Il.Linebreak,$o.LineBreak.BADBREAK],nobreak:[Il.Linebreak,$o.LineBreak.NOBREAK],break:Il.Break,hskip:Il.Hskip,hspace:Il.Hskip,kern:[Il.Hskip,!0],mskip:Il.Hskip,mspace:Il.Hskip,mkern:[Il.Hskip,!0],rule:Il.rule,Rule:[Il.Rule],Space:[Il.Rule,"blank"],nonscript:Il.Nonscript,big:[Il.MakeBig,fr.ORD,.85],Big:[Il.MakeBig,fr.ORD,1.15],bigg:[Il.MakeBig,fr.ORD,1.45],Bigg:[Il.MakeBig,fr.ORD,1.75],bigl:[Il.MakeBig,fr.OPEN,.85],Bigl:[Il.MakeBig,fr.OPEN,1.15],biggl:[Il.MakeBig,fr.OPEN,1.45],Biggl:[Il.MakeBig,fr.OPEN,1.75],bigr:[Il.MakeBig,fr.CLOSE,.85],Bigr:[Il.MakeBig,fr.CLOSE,1.15],biggr:[Il.MakeBig,fr.CLOSE,1.45],Biggr:[Il.MakeBig,fr.CLOSE,1.75],bigm:[Il.MakeBig,fr.REL,.85],Bigm:[Il.MakeBig,fr.REL,1.15],biggm:[Il.MakeBig,fr.REL,1.45],Biggm:[Il.MakeBig,fr.REL,1.75],mathord:[Il.TeXAtom,fr.ORD],mathop:[Il.TeXAtom,fr.OP],mathopen:[Il.TeXAtom,fr.OPEN],mathclose:[Il.TeXAtom,fr.CLOSE],mathbin:[Il.TeXAtom,fr.BIN],mathrel:[Il.TeXAtom,fr.REL],mathpunct:[Il.TeXAtom,fr.PUNCT],mathinner:[Il.TeXAtom,fr.INNER],vtop:[Il.VBox,"top"],vcenter:[Il.VBox,"center"],vbox:[Il.VBox,"bottom"],hsize:Il.Hsize,parbox:Il.ParBox,breakAlign:Il.BreakAlign,buildrel:Il.BuildRel,hbox:[Il.HBox,0],text:Il.HBox,mbox:[Il.HBox,0],fbox:Il.FBox,boxed:[Il.Macro,"\\fbox{$\\displaystyle{#1}$}",1],framebox:Il.FrameBox,makebox:Il.MakeBox,strut:Il.Strut,mathstrut:[Il.Macro,"\\vphantom{(}"],phantom:Il.Phantom,vphantom:[Il.Phantom,1,0],hphantom:[Il.Phantom,0,1],smash:Il.Smash,acute:[Il.Accent,"00B4"],grave:[Il.Accent,"0060"],ddot:[Il.Accent,"00A8"],dddot:[Il.Accent,"20DB"],ddddot:[Il.Accent,"20DC"],tilde:[Il.Accent,"007E"],bar:[Il.Accent,"00AF"],breve:[Il.Accent,"02D8"],check:[Il.Accent,"02C7"],hat:[Il.Accent,"005E"],vec:[Il.Accent,"2192",!1],dot:[Il.Accent,"02D9"],widetilde:[Il.Accent,"007E",!0],widehat:[Il.Accent,"005E",!0],matrix:Il.Matrix,array:Il.Matrix,pmatrix:[Il.Matrix,"(",")"],cases:[Il.Matrix,"{","","left left",null,".2em",null,!0],eqalign:[Il.Matrix,null,null,"right left",Dl,".5em","D"],displaylines:[Il.Matrix,null,null,"center",null,".5em","D"],cr:Il.Cr,"\\":Il.CrLaTeX,newline:[Il.CrLaTeX,!0],hline:Il.HLine,hdashline:[Il.HLine,"dashed"],eqalignno:[Il.Matrix,null,null,"right left",Dl,".5em","D",null,"right"],leqalignno:[Il.Matrix,null,null,"right left",Dl,".5em","D",null,"left"],hfill:Il.HFill,hfil:Il.HFill,hfilll:Il.HFill,bmod:[Il.Macro,`\\mmlToken{mo}[lspace="${Dl}" rspace="${Dl}"]{mod}`],pmod:[Il.Macro,"\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}",1],mod:[Il.Macro,"\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1",1],pod:[Il.Macro,"\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)",1],iff:[Il.Macro,"\\;\\Longleftrightarrow\\;"],skew:[Il.Macro,"{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}",3],pmb:[Il.Macro,"\\rlap{#1}\\kern1px{#1}",1],TeX:[Il.Macro,"T\\kern-.14em\\lower.5ex{E}\\kern-.115em X"],LaTeX:[Il.Macro,"L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX"],not:Il.Not,dots:Il.Dots,space:Il.Tilde,"\xa0":Il.Tilde," ":Il.Tilde,begin:Il.BeginEnd,end:Il.BeginEnd,label:Il.HandleLabel,ref:Il.HandleRef,nonumber:Il.HandleNoTag,newcolumntype:Il.NewColumnType,mathchoice:Il.MathChoice,mmlToken:Il.MmlToken}),new qa("environment",Ol.environment,{displaymath:[Il.Equation,null,!1],math:[Il.Equation,null,!1,!1],array:[Il.AlignedArray],darray:[Il.AlignedArray,null,"D"],equation:[Il.Equation,null,!0],eqnarray:[Il.EqnArray,null,!0,!0,"rcl","bmt",Na.cols(0,bo.thickmathspace),".5em"],indentalign:[Il.IndentAlign]}),new Ua("not_remap",null,{"\u2190":"\u219a","\u2192":"\u219b","\u2194":"\u21ae","\u21d0":"\u21cd","\u21d2":"\u21cf","\u21d4":"\u21ce","\u2208":"\u2209","\u220b":"\u220c","\u2223":"\u2224","\u2225":"\u2226","\u223c":"\u2241","~":"\u2241","\u2243":"\u2244","\u2245":"\u2247","\u2248":"\u2249","\u224d":"\u226d","=":"\u2260","\u2261":"\u2262","<":"\u226e",">":"\u226f","\u2264":"\u2270","\u2265":"\u2271","\u2272":"\u2274","\u2273":"\u2275","\u2276":"\u2278","\u2277":"\u2279","\u227a":"\u2280","\u227b":"\u2281","\u2282":"\u2284","\u2283":"\u2285","\u2286":"\u2288","\u2287":"\u2289","\u22a2":"\u22ac","\u22a8":"\u22ad","\u22a9":"\u22ae","\u22ab":"\u22af","\u227c":"\u22e0","\u227d":"\u22e1","\u2291":"\u22e2","\u2292":"\u22e3","\u22b2":"\u22ea","\u22b3":"\u22eb","\u22b4":"\u22ec","\u22b5":"\u22ed","\u2203":"\u2204"});const Bl=$o.Variant;function Fl(t,e){const s=t.stack.env.font,i=t.stack.env.italicFont,r=s?{mathvariant:s}:{},n=Xa.getMap("remap").lookup(e),o=Dr(e),a=o[3],l=t.create("token",a,r,n?n.char:e),c=Na.isLatinOrGreekChar(e)?t.configuration.mathStyle(e,!0)||i:"",h=o[4]||(s&&c===Bl.NORMAL?"":c);h&&l.attributes.set("mathvariant",h),"mo"===a&&(Ko.setProperty(l,"fixStretchy",!0),t.configuration.addNode("fixStretchy",l)),t.Push(l)}new Ua("remap",null,{"-":"\u2212","*":"\u2217","`":"\u2018"});class jl extends Ra{}const _l=Ka.create("base",{[ia.CONFIG]:function(t,e){const s=e.parseOptions.options;s.digits&&(s.numberPattern=s.digits),new ja("digit",Ol.digit,s.initialDigit),new ja("letter",Ol.variable,s.initialLetter);t.handlers.get(ra.CHARACTER).add(["letter","digit"],null,4)},[ia.HANDLER]:{[ra.CHARACTER]:["command","special"],[ra.DELIMITER]:["delimiter"],[ra.MACRO]:["delimiter","macros","lcGreek","ucGreek","mathchar0mi","mathchar0mo","mathchar7"],[ra.ENVIRONMENT]:["environment"]},[ia.FALLBACK]:{[ra.CHARACTER]:Fl,[ra.MACRO]:function(t,e){throw new ca("UndefinedControlSequence","Undefined control sequence %1","\\"+e)},[ra.ENVIRONMENT]:function(t,e){throw new ca("UnknownEnv","Unknown environment '%1'",e)}},[ia.ITEMS]:{[Za.prototype.kind]:Za,[tl.prototype.kind]:tl,[el.prototype.kind]:el,[sl.prototype.kind]:sl,[il.prototype.kind]:il,[rl.prototype.kind]:rl,[nl.prototype.kind]:nl,[ol.prototype.kind]:ol,[al.prototype.kind]:al,[ll.prototype.kind]:ll,[cl.prototype.kind]:cl,[hl.prototype.kind]:hl,[dl.prototype.kind]:dl,[ul.prototype.kind]:ul,[pl.prototype.kind]:pl,[ml.prototype.kind]:ml,[fl.prototype.kind]:fl,[gl.prototype.kind]:gl,[bl.prototype.kind]:bl,[El.prototype.kind]:El,[xl.prototype.kind]:xl,[yl.prototype.kind]:yl,[Nl.prototype.kind]:Nl,[vl.prototype.kind]:vl,[Cl.prototype.kind]:Cl,[Tl.prototype.kind]:Tl},[ia.OPTIONS]:{maxMacros:1e3,digits:"",numberPattern:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,initialDigit:/[0-9.,]/,identifierPattern:/^[a-zA-Z]+/,initialLetter:/[a-zA-Z]/,baseURL:pi.document&&0!==pi.document.getElementsByTagName("base").length?String(pi.document.location).replace(/#.*$/,""):""},[ia.TAGS]:{base:jl},[ia.POSTPROCESSORS]:[[function({data:t}){for(const e of t.getList("nonscript"))if(e.attributes.get("scriptlevel")>0){const s=e.parent;if(s.childNodes.splice(s.childIndex(e),1),t.removeFromList(e.kind,[e]),e.isKind("mrow")){const s=e.childNodes[0];t.removeFromList("mstyle",[s]),t.removeFromList("mspace",s.childNodes[0].childNodes)}}else e.isKind("mrow")&&(e.parent.replaceChild(e.childNodes[0],e),t.removeFromList("mrow",[e]))},-4]]});class Ul extends Zi{static configure(t){const e=new Qa(t,["tex"]);return e.init(),e}static tags(t,e){Oa.addTags(e.tags),Oa.setDefault(t.options.tags),t.tags=Oa.getDefault(),t.tags.configuration=t}constructor(t={}){const[e,s,i]=Ui(t,Ul.OPTIONS,Go.OPTIONS);super(s),this.findTeX=this.options.FindTeX||new Go(i);const r=this.options.packages,n=this.configuration=Ul.configure(r),o=this._parseOptions=new Aa(n,[this.options,Oa.OPTIONS]);Fi(o.options,e),n.config(this),Ul.tags(o,n),this.postFilters.addList([[sa.cleanSubSup,-7],[sa.setInherited,-6],[sa.checkScriptlevel,-5],[sa.moveLimits,-4],[sa.cleanStretchy,-3],[sa.cleanAttributes,-2],[sa.combineRelations,-1]])}setMmlFactory(t){super.setMmlFactory(t),this._parseOptions.nodeFactory.setMmlFactory(t)}get parseOptions(){return this._parseOptions}reset(t=0){this.parseOptions.tags.reset(t)}compile(t,e){let s,i;this.parseOptions.clear(),this.parseOptions.mathItem=t,this.executeFilters(this.preFilters,t,e,this.parseOptions),this.latex=t.math,this.parseOptions.tags.startEquation(t);try{i=new ua(this.latex,{display:t.display,isInner:!1},this.parseOptions),s=i.mml()}catch(t){if(!(t instanceof ca))throw t;this.parseOptions.error=!0,s=this.options.formatError(this,t)}return s=this.parseOptions.nodeFactory.create("node","math",[s]),s.attributes.set($o.Attr.LATEX,this.latex),t.display&&Ko.setAttribute(s,"display","block"),this.parseOptions.tags.finishEquation(t),this.parseOptions.root=s,this.executeFilters(this.postFilters,t,e,this.parseOptions),i&&i.stack.env.hsize&&(Ko.setAttribute(s,"maxwidth",i.stack.env.hsize),Ko.setAttribute(s,"overflow","linebreak")),this.mathNode=this.parseOptions.root,this.mathNode}findMath(t){return this.findTeX.findMath(t)}formatError(t){const e=t.message.replace(/\n.*/,"");return this.parseOptions.nodeFactory.create("error",e,t.id,this.latex)}}Ul.NAME="TeX",Ul.OPTIONS=Object.assign(Object.assign({},Zi.OPTIONS),{FindTeX:null,packages:["base"],maxBuffer:5120,maxTemplateSubtitutions:1e4,mathStyle:"TeX",formatError:(t,e)=>t.formatError(e)});class Hl extends Nl{constructor(t,...e){super(t),this.factory.configuration.tags.start("multline",!0,e[0])}get kind(){return"multline"}EndEntry(){this.table.length&&Na.fixInitialMO(this.factory.configuration,this.nodes);const t=this.getProperty("shove"),e=this.create("node","mtd",this.nodes,t?{columnalign:t}:{});this.setProperty("shove",null),this.row.push(e),this.Clear()}EndRow(){if(1!==this.row.length)throw new ca("MultlineRowsOneCol","The rows within the %1 environment must have exactly one column","multline");const t=this.create("node","mtr",this.row);this.table.push(t),this.row=[]}EndTable(){if(super.EndTable(),this.table.length){const t=this.table.length-1;let e=-1;Ko.getAttribute(Ko.getChildren(this.table[0])[0],"columnalign")||Ko.setAttribute(Ko.getChildren(this.table[0])[0],"columnalign",$o.Align.LEFT),Ko.getAttribute(Ko.getChildren(this.table[t])[0],"columnalign")||Ko.setAttribute(Ko.getChildren(this.table[t])[0],"columnalign",$o.Align.RIGHT);const s=this.factory.configuration.tags.getTag();if(s){e=this.arraydef.side===$o.Align.LEFT?0:this.table.length-1;const t=this.table[e],i=this.create("node","mlabeledtr",[s].concat(Ko.getChildren(t)));Ko.copyAttributes(t,i),this.table[e]=i}}this.factory.configuration.tags.end()}}class Wl extends vl{get kind(){return"flalign"}constructor(t,e,s,i,r){super(t),this.name=e,this.numbered=s,this.padded=i,this.center=r,this.factory.configuration.tags.start(e,s,s)}EndEntry(){super.EndEntry();const t=this.getProperty("xalignat");if(t&&this.row.length>t)throw new ca("XalignOverflow","Extra %1 in row of %2","&",this.name)}EndRow(){let t;const e=this.row,s=this.getProperty("xalignat");for(;e.lengththis.maxrow&&(this.maxrow=this.row.length),super.EndRow();const i=this.table[this.table.length-1];if(this.getProperty("zeroWidthLabel")&&i.isKind("mlabeledtr")){const t=Ko.getChildren(i)[0],e=this.factory.configuration.options.tagSide,s=Object.assign({width:0},"right"===e?{lspace:"-1width"}:{}),r=this.create("node","mpadded",Ko.getChildren(t),s);t.setChildren([r])}}EndTable(){if(super.EndTable(),this.center&&this.maxrow<=2){delete this.arraydef.width,delete this.global.indentalign}}}var zl;!function(t){t.NEW_DELIMITER="new-Delimiter",t.NEW_COMMAND="new-Command",t.NEW_ENVIRONMENT="new-Environment"}(zl||(zl={}));const ql=-100,Vl={GetCSname(t,e){if("\\"!==t.GetNext())throw new ca("MissingCS","%1 must be followed by a control sequence",e);const s=oa.trimSpaces(t.GetArgument(e)).substring(1);return this.checkProtectedMacros(t,s),s},GetCsNameArgument(t,e){let s=oa.trimSpaces(t.GetArgument(e));if("\\"===s.charAt(0)&&(s=s.substring(1)),!s.match(/^(.|[a-z]+)$/i))throw new ca("IllegalControlSequenceName","Illegal control sequence name for %1",e);return this.checkProtectedMacros(t,s),s},GetArgCount(t,e){let s=t.GetBrackets(e);if(s&&(s=oa.trimSpaces(s),!s.match(/^[0-9]+$/)))throw new ca("IllegalParamNumber","Illegal number of parameters specified in %1",e);return s},GetTemplate(t,e,s){let i=t.GetNext();const r=[];let n=0,o=t.i;for(;t.i0?[n.toString()].concat(r):n;t.i++}throw new ca("MissingReplacementString","Missing replacement string for definition of %1",e)},GetParameter(t,e,s){if(null==s)return t.GetArgument(e);let i=t.i,r=0,n=!1;for(;t.it.string.substring(t.i,t.i+e.length)!==e||e.match(/\\[a-z]+$/i)&&t.string.charAt(t.i+e.length).match(/[a-z]/i)?0:(t.i+=e.length,1),checkGlobal:(t,e,s)=>t.stack.env.isGlobal?t.configuration.packageData.get("begingroup").stack.checkGlobal(e,s):s.map(e=>t.configuration.handlers.retrieve(e)),checkProtectedMacros(t,e){var s;if(null===(s=t.options.protectedMacros)||void 0===s?void 0:s.includes(e))throw new ca("ProtectedMacro","The control sequence %1 can't be redefined",`\\${e}`)},addDelimiter(t,e,s,i){const r=e.substring(1);this.checkProtectedMacros(t,r);const[n,o]=Vl.checkGlobal(t,[r,e],[zl.NEW_COMMAND,zl.NEW_DELIMITER]);r!==e&&n.remove(r),o.add(e,new Da(e,s,i)),delete t.stack.env.isGlobal},addMacro(t,e,s,i,r=""){this.checkProtectedMacros(t,e);const n=Vl.checkGlobal(t,[e],[zl.NEW_COMMAND])[0];this.undefineDelimiter(t,"\\"+e),n.add(e,new Pa(r||e,s,i)),delete t.stack.env.isGlobal},addEnvironment(t,e,s,i){Vl.checkGlobal(t,[e],[zl.NEW_ENVIRONMENT])[0].add(e,new Pa(e,s,i)),delete t.stack.env.isGlobal},undefineMacro(t,e){const s=Vl.checkGlobal(t,[e],[zl.NEW_COMMAND])[0];s.remove(e),t.configuration.handlers.get(ra.MACRO).applicable(e)&&(s.add(e,new Pa(e,()=>Ga.FALLBACK,[])),this.undefineDelimiter(t,"\\"+e)),delete t.stack.env.isGlobal},undefineDelimiter(t,e){const s=Vl.checkGlobal(t,[e],[zl.NEW_DELIMITER])[0];s.remove(e),t.configuration.handlers.get(ra.DELIMITER).applicable(e)&&s.add(e,new Da(e,null,{})),delete t.stack.env.isGlobal}};function Xl(t){if(!t||t.isInferred&&0===t.childNodes.length)return[null,null];if(t.isKind("msubsup")&&Gl(t))return[t,null];const e=Ko.getChildAt(t,0);return t.isInferred&&e&&Gl(e)?(t.childNodes.splice(0,1),[e,t]):[null,t]}function Gl(t){const e=t.childNodes[0];return e&&e.isKind("mi")&&""===e.getText()}const Jl={AmsEqnArray(t,e,s,i,r,n,o,a){const l=t.GetBrackets("\\begin{"+e.getName()+"}"),c=Il.EqnArray(t,e,s,i,r,n,o,a);return Na.setArrayAlign(c,l,t)},AlignAt(t,e,s,i){const r=e.getName();let n,o="",a="";const l=[];i||(n=t.GetBrackets("\\begin{"+r+"}"));const c=t.GetArgument("\\begin{"+r+"}");if(c.match(/[^0-9]/))throw new ca("PositiveIntegerArg","Argument to %1 must be a positive integer","\\begin{"+r+"}");let h=parseInt(c,10);for(;h>0;)o+="rl",a+="bt",l.push("0em 0em"),h--;const d=l.join(" ");if(i)return Jl.EqnArray(t,e,s,i,o,a,d);const u=Jl.EqnArray(t,e,s,i,o,a,d);return Na.setArrayAlign(u,n,t)},Multline(t,e,s){Na.checkEqnEnv(t),t.Push(e);const i=t.options.ams.multlineIndent,r=t.itemFactory.create("multline",s,t.stack);return r.arraydef={displaystyle:!0,rowspacing:".5em",columnspacing:"100%",width:t.options.ams.multlineWidth,side:t.options.tagSide,minlabelspacing:t.options.tagIndent,"data-array-padding":`${i} ${i}`,"data-width-includes-label":!0},r},XalignAt(t,e,s,i){const r=t.GetArgument("\\begin{"+e.getName()+"}");if(r.match(/[^0-9]/))throw new ca("PositiveIntegerArg","Argument to %1 must be a positive integer","\\begin{"+e.getName()+"}");const n=i?"crl":"rlc",o=i?"mbt":"btm",a=i?"fit auto auto":"auto auto fit",l=Jl.FlalignArray(t,e,s,i,!1,n,o,a,!0);return l.setProperty("xalignat",2*parseInt(r)),l},FlalignArray(t,e,s,i,r,n,o,a,l=!1){Na.checkEqnEnv(t),t.Push(e),n=n.split("").join(" ").replace(/r/g,"right").replace(/l/g,"left").replace(/c/g,"center"),o=Sl(o);const c=t.itemFactory.create("flalign",e.getName(),s,i,r,t.stack);return c.arraydef={width:"100%",displaystyle:!0,columnalign:n,columnspacing:"0em",columnwidth:a,rowspacing:"3pt","data-break-align":o,side:t.options.tagSide,minlabelspacing:l?"0":t.options.tagIndent,"data-width-includes-label":!0},c.setProperty("zeroWidthLabel",l),c},HandleDeclareOp(t,e){const s=t.GetStar()?"*":"",i=Vl.GetCsNameArgument(t,e),r=t.GetArgument(e);Vl.addMacro(t,i,Jl.Macro,[`\\operatorname${s}{${r}}`]),t.Push(t.itemFactory.create("null"))},HandleOperatorName(t,e){const s=t.GetStar(),i=oa.trimSpaces(t.GetArgument(e));let r=new ua(i,Object.assign(Object.assign({},t.stack.env),{font:$o.Variant.NORMAL,multiLetterIdentifiers:t.options.ams.operatornamePattern,operatorLetters:!0,noAutoOP:!0}),t.configuration).mml();if(r.isKind("mi")?r.removeProperty("autoOP"):r=t.create("node","TeXAtom",[r]),Ko.setProperties(r,{movesupsub:s,movablelimits:!0,texClass:fr.OP}),!s){const e=t.GetNext(),s=t.i;"\\"===e&&++t.i&&"limits"!==t.GetCS()&&(t.i=s)}t.Push(t.itemFactory.create("fn",r))},SideSet(t,e){const[s,i]=Xl(t.ParseArg(e)),[r,n]=Xl(t.ParseArg(e)),o=t.ParseArg(e);let a=o;s&&(i?s.replaceChild(t.create("node","mphantom",[t.create("node","mpadded",[Na.copyNode(o,t)],{width:0})]),Ko.getChildAt(s,0)):(a=t.create("node","mmultiscripts",[o]),r&&Ko.appendChildren(a,[Ko.getChildAt(r,1)||t.create("node","none"),Ko.getChildAt(r,2)||t.create("node","none")]),Ko.setProperty(a,"scriptalign","left"),Ko.appendChildren(a,[t.create("node","mprescripts"),Ko.getChildAt(s,1)||t.create("node","none"),Ko.getChildAt(s,2)||t.create("node","none")]))),r&&a===o&&(r.replaceChild(o,Ko.getChildAt(r,0)),a=r);const l=t.create("node","TeXAtom",[],{texClass:fr.OP,movesupsub:!0,movablelimits:!0});i&&(s&&l.appendChild(s),l.appendChild(i)),l.appendChild(a),n&&l.appendChild(n),t.Push(l)},operatorLetter:(t,e)=>!!t.stack.env.operatorLetters&&Ol.variable(t,e),MultiIntegral(t,e,s){let i=t.GetNext();if("\\"===i){const r=t.i;i=t.GetArgument(e),t.i=r,"\\limits"===i&&(s="\\!\\!\\mathop{\\,\\,"+s+"}")}t.string=s+" "+t.string.slice(t.i),t.i=0},xArrow(t,e,s,i,r,n=0){const o={width:"+"+oa.em((i+r)/18),lspace:oa.em(i/18)},a=t.GetBrackets(e),l=t.ParseArg(e),c=t.create("node","mspace",[],{depth:".2em"});let h=t.create("token","mo",{stretchy:!0,texClass:fr.ORD},String.fromCodePoint(s));n&&h.attributes.set("minsize",oa.em(n)),h=t.create("node","mstyle",[h],{scriptlevel:0});const d=t.create("node","munderover",[h]);let u=t.create("node","mpadded",[l,c],o);if(Ko.setAttribute(u,"voffset","-.2em"),Ko.setAttribute(u,"height","-.2em"),Ko.setChild(d,d.over,u),a){const e=new ua(a,t.stack.env,t.configuration).mml(),s=t.create("node","mspace",[],{height:".75em"});u=t.create("node","mpadded",[e,s],o),Ko.setAttribute(u,"voffset",".15em"),Ko.setAttribute(u,"depth","-.15em"),Ko.setChild(d,d.under,u)}Ko.setProperty(d,"subsupOK",!0),t.Push(t.create("node","TeXAtom",[t.create("node","TeXAtom",[],{texClass:fr.NONE}),d],{texClass:fr.REL}))},HandleShove(t,e,s){const i=t.stack.Top();if("multline"!==i.kind)throw new ca("CommandOnlyAllowedInEnv","%1 only allowed in %2 environment",t.currentCS,"multline");if(i.Size())throw new ca("CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",t.currentCS);i.setProperty("shove",s)},CFrac(t,e){let s=oa.trimSpaces(t.GetBrackets(e,""));const i=t.GetArgument(e),r=t.GetArgument(e),n={l:$o.Align.LEFT,r:$o.Align.RIGHT,"":""},o=new ua("\\strut\\textstyle{"+i+"}",t.stack.env,t.configuration).mml(),a=new ua("\\strut\\textstyle{"+r+"}",t.stack.env,t.configuration).mml(),l=t.create("node","mfrac",[o,a]);if(s=n[s],null==s)throw new ca("IllegalAlign","Illegal alignment specified in %1",t.currentCS);s&&Ko.setProperties(l,{numalign:s,denomalign:s}),t.Push(l)},Genfrac(t,e,s,i,r,n){null==s&&(s=t.GetDelimiterArg(e)),null==i&&(i=t.GetDelimiterArg(e)),null==r&&(r=t.GetArgument(e)),null==n&&(n=oa.trimSpaces(t.GetArgument(e)));const o=t.ParseArg(e),a=t.ParseArg(e);let l=t.create("node","mfrac",[o,a]);if(""!==r&&Ko.setAttribute(l,"linethickness",r),(s||i)&&(Ko.setProperty(l,"withDelims",!0),l=Na.fixedFence(t.configuration,s,l,i)),""!==n){const e=parseInt(n,10),s=["D","T","S","SS"][e];if(null==s)throw new ca("BadMathStyleFor","Bad math style for %1",t.currentCS);l=t.create("node","mstyle",[l]),"D"===s?Ko.setProperties(l,{displaystyle:!0,scriptlevel:0}):Ko.setProperties(l,{displaystyle:!1,scriptlevel:e-1})}t.Push(l)},HandleTag(t,e){if(!t.tags.currentTag.taggable&&t.tags.env)throw new ca("CommandNotAllowedInEnv","%1 not allowed in %2 environment",t.currentCS,t.tags.env);if(t.tags.currentTag.tag)throw new ca("MultipleCommand","Multiple %1",t.currentCS);const s=t.GetStar(),i=oa.trimSpaces(t.GetArgument(e));t.tags.tag(i,s),t.Push(t.itemFactory.create("null"))},HandleNoTag:Il.HandleNoTag,HandleRef:Il.HandleRef,Macro:Il.Macro,Accent:Il.Accent,Tilde:Il.Tilde,Array:Il.Array,Spacer:Il.Spacer,NamedOp:Il.NamedOp,EqnArray:Il.EqnArray,Equation:Il.Equation};new Ua("AMSmath-mathchar0mo",Ol.mathchar0mo,{iiiint:["\u2a0c",{texClass:fr.OP}]}),new ja("AMSmath-operatorLetter",Jl.operatorLetter,/[-*]/i),new za("AMSmath-macros",{mathring:[Jl.Accent,"02DA"],nobreakspace:Jl.Tilde,negmedspace:[Jl.Spacer,bo.negativemediummathspace],negthickspace:[Jl.Spacer,bo.negativethickmathspace],idotsint:[Jl.MultiIntegral,"\\int\\cdots\\int"],dddot:[Jl.Accent,"20DB"],ddddot:[Jl.Accent,"20DC"],sideset:Jl.SideSet,boxed:[Jl.Macro,"\\fbox{$\\displaystyle{#1}$}",1],tag:Jl.HandleTag,notag:Jl.HandleNoTag,eqref:[Jl.HandleRef,!0],substack:[Jl.Macro,"\\begin{subarray}{c}#1\\end{subarray}",1],injlim:[Jl.NamedOp,"inj lim"],projlim:[Jl.NamedOp,"proj lim"],varliminf:[Jl.Macro,"\\mathop{\\underline{\\mmlToken{mi}{lim}}}"],varlimsup:[Jl.Macro,"\\mathop{\\overline{\\mmlToken{mi}{lim}}}"],varinjlim:[Jl.Macro,"\\mathop{\\underrightarrow{\\mmlToken{mi}{lim}}}"],varprojlim:[Jl.Macro,"\\mathop{\\underleftarrow{\\mmlToken{mi}{lim}}}"],DeclareMathOperator:Jl.HandleDeclareOp,operatorname:Jl.HandleOperatorName,genfrac:Jl.Genfrac,frac:[Jl.Genfrac,"","","",""],tfrac:[Jl.Genfrac,"","","","1"],dfrac:[Jl.Genfrac,"","","","0"],binom:[Jl.Genfrac,"(",")","0",""],tbinom:[Jl.Genfrac,"(",")","0","1"],dbinom:[Jl.Genfrac,"(",")","0","0"],cfrac:Jl.CFrac,shoveleft:[Jl.HandleShove,$o.Align.LEFT],shoveright:[Jl.HandleShove,$o.Align.RIGHT],xrightarrow:[Jl.xArrow,8594,5,10],xleftarrow:[Jl.xArrow,8592,10,5]}),new qa("AMSmath-environment",Ol.environment,{"equation*":[Jl.Equation,null,!1],"eqnarray*":[Jl.EqnArray,null,!1,!0,"rcl","bmt",Na.cols(0,bo.thickmathspace),".5em"],align:[Jl.EqnArray,null,!0,!0,"rl","bt",Na.cols(0,2)],"align*":[Jl.EqnArray,null,!1,!0,"rl","bt",Na.cols(0,2)],multline:[Jl.Multline,null,!0],"multline*":[Jl.Multline,null,!1],split:[Jl.EqnArray,null,!1,!1,"rl","bt",Na.cols(0)],gather:[Jl.EqnArray,null,!0,!0,"c","m"],"gather*":[Jl.EqnArray,null,!1,!0,"c","m"],alignat:[Jl.AlignAt,null,!0,!0],"alignat*":[Jl.AlignAt,null,!1,!0],alignedat:[Jl.AlignAt,null,!1,!1],aligned:[Jl.AmsEqnArray,null,null,null,"rl","bt",Na.cols(0,2),".5em","D"],gathered:[Jl.AmsEqnArray,null,null,null,"c","m",null,".5em","D"],xalignat:[Jl.XalignAt,null,!0,!0],"xalignat*":[Jl.XalignAt,null,!1,!0],xxalignat:[Jl.XalignAt,null,!1,!1],flalign:[Jl.FlalignArray,null,!0,!1,!0,"rlc","btm","auto auto fit"],"flalign*":[Jl.FlalignArray,null,!1,!1,!0,"rlc","btm","auto auto fit"],subarray:[Jl.Array,null,null,null,null,Na.cols(0),"0.1em","S",!0],smallmatrix:[Jl.Array,null,null,null,"c",Na.cols(1/3),".2em","S",!0],matrix:[Jl.Array,null,null,null,"c"],pmatrix:[Jl.Array,null,"(",")","c"],bmatrix:[Jl.Array,null,"[","]","c"],Bmatrix:[Jl.Array,null,"\\{","\\}","c"],vmatrix:[Jl.Array,null,"\\vert","\\vert","c"],Vmatrix:[Jl.Array,null,"\\Vert","\\Vert","c"],cases:[Jl.Array,null,"\\{",".","ll",null,".2em","T"]}),new Ha("AMSmath-delimiter",Ol.delimiter,{"\\lvert":["|",{texClass:fr.OPEN}],"\\rvert":["|",{texClass:fr.CLOSE}],"\\lVert":["\u2016",{texClass:fr.OPEN}],"\\rVert":["\u2016",{texClass:fr.CLOSE}]}),new Ua("AMSsymbols-mathchar0mi",Ol.mathchar0mi,{digamma:"\u03dd",varkappa:"\u03f0",varGamma:["\u0393",{mathvariant:$o.Variant.ITALIC}],varDelta:["\u0394",{mathvariant:$o.Variant.ITALIC}],varTheta:["\u0398",{mathvariant:$o.Variant.ITALIC}],varLambda:["\u039b",{mathvariant:$o.Variant.ITALIC}],varXi:["\u039e",{mathvariant:$o.Variant.ITALIC}],varPi:["\u03a0",{mathvariant:$o.Variant.ITALIC}],varSigma:["\u03a3",{mathvariant:$o.Variant.ITALIC}],varUpsilon:["\u03a5",{mathvariant:$o.Variant.ITALIC}],varPhi:["\u03a6",{mathvariant:$o.Variant.ITALIC}],varPsi:["\u03a8",{mathvariant:$o.Variant.ITALIC}],varOmega:["\u03a9",{mathvariant:$o.Variant.ITALIC}],beth:"\u2136",gimel:"\u2137",daleth:"\u2138",backprime:["\u2035",{variantForm:!0}],hslash:"\u210f",varnothing:["\u2205",{variantForm:!0}],blacktriangle:"\u25b4",triangledown:["\u25bd",{variantForm:!0}],blacktriangledown:"\u25be",square:"\u25fb",Box:"\u25fb",blacksquare:"\u25fc",lozenge:"\u25ca",Diamond:"\u25ca",blacklozenge:"\u29eb",circledS:["\u24c8",{mathvariant:$o.Variant.NORMAL}],bigstar:"\u2605",sphericalangle:"\u2222",measuredangle:"\u2221",nexists:"\u2204",complement:"\u2201",mho:"\u2127",eth:["\xf0",{mathvariant:$o.Variant.NORMAL}],Finv:"\u2132",diagup:"\u2571",Game:"\u2141",diagdown:"\u2572",Bbbk:["k",{mathvariant:$o.Variant.DOUBLESTRUCK}],yen:"\xa5",circledR:"\xae",checkmark:"\u2713",maltese:"\u2720"}),new Ua("AMSsymbols-mathchar0mo",Ol.mathchar0mo,{dotplus:"\u2214",ltimes:"\u22c9",smallsetminus:["\u2216",{variantForm:!0}],rtimes:"\u22ca",Cap:"\u22d2",doublecap:"\u22d2",leftthreetimes:"\u22cb",Cup:"\u22d3",doublecup:"\u22d3",rightthreetimes:"\u22cc",barwedge:"\u22bc",curlywedge:"\u22cf",veebar:"\u22bb",curlyvee:"\u22ce",doublebarwedge:"\u2a5e",boxminus:"\u229f",circleddash:"\u229d",boxtimes:"\u22a0",circledast:"\u229b",boxdot:"\u22a1",circledcirc:"\u229a",boxplus:"\u229e",centerdot:["\u22c5",{variantForm:!0}],divideontimes:"\u22c7",intercal:"\u22ba",leqq:"\u2266",geqq:"\u2267",leqslant:"\u2a7d",geqslant:"\u2a7e",eqslantless:"\u2a95",eqslantgtr:"\u2a96",lesssim:"\u2272",gtrsim:"\u2273",lessapprox:"\u2a85",gtrapprox:"\u2a86",approxeq:"\u224a",lessdot:"\u22d6",gtrdot:"\u22d7",lll:"\u22d8",llless:"\u22d8",ggg:"\u22d9",gggtr:"\u22d9",lessgtr:"\u2276",gtrless:"\u2277",lesseqgtr:"\u22da",gtreqless:"\u22db",lesseqqgtr:"\u2a8b",gtreqqless:"\u2a8c",doteqdot:"\u2251",Doteq:"\u2251",eqcirc:"\u2256",risingdotseq:"\u2253",circeq:"\u2257",fallingdotseq:"\u2252",triangleq:"\u225c",backsim:"\u223d",thicksim:["\u223c",{variantForm:!0}],backsimeq:"\u22cd",thickapprox:["\u2248",{variantForm:!0}],subseteqq:"\u2ac5",supseteqq:"\u2ac6",Subset:"\u22d0",Supset:"\u22d1",sqsubset:"\u228f",sqsupset:"\u2290",preccurlyeq:"\u227c",succcurlyeq:"\u227d",curlyeqprec:"\u22de",curlyeqsucc:"\u22df",precsim:"\u227e",succsim:"\u227f",precapprox:"\u2ab7",succapprox:"\u2ab8",vartriangleleft:"\u22b2",lhd:"\u22b2",vartriangleright:"\u22b3",rhd:"\u22b3",trianglelefteq:"\u22b4",unlhd:"\u22b4",trianglerighteq:"\u22b5",unrhd:"\u22b5",vDash:"\u22a8",Vdash:"\u22a9",Vvdash:"\u22aa",smallsmile:["\u2323",{variantForm:!0}],shortmid:["\u2223",{variantForm:!0}],smallfrown:["\u2322",{variantForm:!0}],shortparallel:["\u2225",{variantForm:!0}],bumpeq:"\u224f",between:"\u226c",Bumpeq:"\u224e",pitchfork:"\u22d4",varpropto:["\u221d",{variantForm:!0}],backepsilon:"\u220d",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",therefore:"\u2234",because:"\u2235",eqsim:"\u2242",vartriangle:["\u25b3",{variantForm:!0}],Join:"\u22c8",nless:"\u226e",ngtr:"\u226f",nleq:"\u2270",ngeq:"\u2271",nleqslant:["\u2a87",{variantForm:!0}],ngeqslant:["\u2a88",{variantForm:!0}],nleqq:["\u2270",{variantForm:!0}],ngeqq:["\u2271",{variantForm:!0}],lneq:"\u2a87",gneq:"\u2a88",lneqq:"\u2268",gneqq:"\u2269",lvertneqq:["\u2268",{variantForm:!0}],gvertneqq:["\u2269",{variantForm:!0}],lnsim:"\u22e6",gnsim:"\u22e7",lnapprox:"\u2a89",gnapprox:"\u2a8a",nprec:"\u2280",nsucc:"\u2281",npreceq:["\u22e0",{variantForm:!0}],nsucceq:["\u22e1",{variantForm:!0}],precneqq:"\u2ab5",succneqq:"\u2ab6",precnsim:"\u22e8",succnsim:"\u22e9",precnapprox:"\u2ab9",succnapprox:"\u2aba",nsim:"\u2241",ncong:"\u2247",nshortmid:["\u2224",{variantForm:!0}],nshortparallel:["\u2226",{variantForm:!0}],nmid:"\u2224",nparallel:"\u2226",nvdash:"\u22ac",nvDash:"\u22ad",nVdash:"\u22ae",nVDash:"\u22af",ntriangleleft:"\u22ea",ntriangleright:"\u22eb",ntrianglelefteq:"\u22ec",ntrianglerighteq:"\u22ed",nsubseteq:"\u2288",nsupseteq:"\u2289",nsubseteqq:["\u2288",{variantForm:!0}],nsupseteqq:["\u2289",{variantForm:!0}],subsetneq:"\u228a",supsetneq:"\u228b",varsubsetneq:["\u228a",{variantForm:!0}],varsupsetneq:["\u228b",{variantForm:!0}],subsetneqq:"\u2acb",supsetneqq:"\u2acc",varsubsetneqq:["\u2acb",{variantForm:!0}],varsupsetneqq:["\u2acc",{variantForm:!0}],leftleftarrows:"\u21c7",rightrightarrows:"\u21c9",leftrightarrows:"\u21c6",rightleftarrows:"\u21c4",Lleftarrow:"\u21da",Rrightarrow:"\u21db",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",leftarrowtail:"\u21a2",rightarrowtail:"\u21a3",looparrowleft:"\u21ab",looparrowright:"\u21ac",leftrightharpoons:"\u21cb",rightleftharpoons:["\u21cc",{variantForm:!0}],curvearrowleft:"\u21b6",curvearrowright:"\u21b7",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",Lsh:"\u21b0",Rsh:"\u21b1",upuparrows:"\u21c8",downdownarrows:"\u21ca",upharpoonleft:"\u21bf",upharpoonright:"\u21be",downharpoonleft:"\u21c3",restriction:"\u21be",multimap:"\u22b8",downharpoonright:"\u21c2",leftrightsquigarrow:"\u21ad",rightsquigarrow:"\u21dd",leadsto:"\u21dd",dashrightarrow:"\u21e2",dashleftarrow:"\u21e0",nleftarrow:"\u219a",nrightarrow:"\u219b",nLeftarrow:"\u21cd",nRightarrow:"\u21cf",nleftrightarrow:"\u21ae",nLeftrightarrow:"\u21ce"}),new Ha("AMSsymbols-delimiter",Ol.delimiter,{"\\ulcorner":"\u231c","\\urcorner":"\u231d","\\llcorner":"\u231e","\\lrcorner":"\u231f"}),new za("AMSsymbols-macros",{implies:[Jl.Macro,"\\;\\Longrightarrow\\;"],impliedby:[Jl.Macro,"\\;\\Longleftarrow\\;"]});class Kl extends da{get kind(){return"beginEnv"}get isOpen(){return!0}checkItem(t){if(t.isKind("end")){if(t.getName()!==this.getName())throw new ca("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 ca("EnvMissingEnd","Missing \\end{%1}",this.getName());return super.checkItem(t)}}const $l={NewCommand(t,e){const s=Vl.GetCsNameArgument(t,e),i=Vl.GetArgCount(t,e),r=t.GetBrackets(e),n=t.GetArgument(e);Vl.addMacro(t,s,$l.Macro,[n,i,r]),t.Push(t.itemFactory.create("null"))},NewEnvironment(t,e){const s=oa.trimSpaces(t.GetArgument(e)),i=Vl.GetArgCount(t,e),r=t.GetBrackets(e),n=t.GetArgument(e),o=t.GetArgument(e);Vl.addEnvironment(t,s,$l.BeginEnv,[!0,n,o,i,r]),t.Push(t.itemFactory.create("null"))},MacroDef(t,e){const s=Vl.GetCSname(t,e),i=Vl.GetTemplate(t,e,"\\"+s),r=t.GetArgument(e);i instanceof Array?Vl.addMacro(t,s,$l.MacroWithTemplate,[r].concat(i)):Vl.addMacro(t,s,$l.Macro,[r,i]),t.Push(t.itemFactory.create("null"))},Let(t,e){const s=Vl.GetCSname(t,e);let i=t.GetNext();"="===i&&(t.i++,i=t.GetNext());const r=t.configuration.handlers;if(t.Push(t.itemFactory.create("null")),"\\"===i){if(s===(e=Vl.GetCSname(t,e)))return;const i=r.get(ra.MACRO).applicable(e);if(i instanceof Wa){const r=i.lookup(e);return void Vl.addMacro(t,s,r.func,r.args,r.token)}if(i instanceof Ua&&!(i instanceof Ha)){const r=i.lookup(e),n=t=>i.parser(t,r);return void Vl.addMacro(t,s,n,[s,r.char])}const n=r.get(ra.DELIMITER).lookup("\\"+e);return n?void Vl.addDelimiter(t,"\\"+s,n.char,n.attributes):(Vl.checkProtectedMacros(t,s),Vl.undefineMacro(t,s),void Vl.undefineDelimiter(t,"\\"+s))}t.i++;const n=r.get(ra.DELIMITER).lookup(i);n?Vl.addDelimiter(t,"\\"+s,n.char,n.attributes):Vl.addMacro(t,s,$l.Macro,[i])},MacroWithTemplate(t,e,s,i,...r){const n=parseInt(i,10);if(r.length){const i=[];if(t.GetNext(),r[0]&&!Vl.MatchParam(t,r[0]))throw new ca("MismatchUseDef","Use of %1 doesn't match its definition",e);if(n){for(let s=0;src(t,e,r))):rc(t,e,r)}}function rc(t,e,s){const i=Ya.get(s);if(i){let r=sc[e]||{};i.options&&1===Object.keys(i.options).length&&i.options[s]&&(r={[s]:r}),t.configuration.add(s,t,r);const n=t.parseOptions.packageData.get("require").configured;i.preprocessors.length&&!n.has(s)&&(n.set(s,!0),to.retryAfter(Promise.resolve()))}}function nc(t,e){var s,i;const r=t.options.require,n=r.allow,o=("["===e.substring(0,1)?"":r.prefix)+e;if(!(Object.hasOwn(n,o)?n[o]:Object.hasOwn(n,e)?n[e]:r.defaultAllow))throw new ca("BadRequire",'Extension "%1" is not allowed to be loaded',o);const a=fi.packages.get(o);if(a||to.retryAfter(vi.load(o).catch(t=>{})),a.hasFailed)throw new ca("RequireFail",'Extension "%1" failed to load',e);const l=null===(s=Ci[o])||void 0===s?void 0:s.rendererExtensions,c=null===(i=qi.startup.document)||void 0===i?void 0:i.menu;l&&c&&c.addRequiredExtensions(l),ic(t.configuration.packageData.get("require").jax,o)}const oc={Require(t,e){const s=t.GetArgument(e);if(s.match(/[^_a-zA-Z0-9]/)||""===s)throw new ca("BadPackageName","Argument for %1 is not a valid package name",e);nc(t,s),t.Push(t.itemFactory.create("null"))}},ac={require:{allow:wi({base:!1,autoload:!1,configmacros:!1,tagformat:!1,setoptions:!1,texhtml:!1}),defaultAllow:!0,prefix:"tex"}};new za("require",{require:oc.Require});const lc=Ka.create("require",{[ia.HANDLER]:{[ra.MACRO]:["require"]},[ia.CONFIG]:function(t,e){e.parseOptions.packageData.set("require",{jax:e,required:[...e.options.packages],configured:new Map});const s=e.parseOptions.options.require,i=s.prefix;if(i.match(/[^_a-zA-Z0-9]/))throw Error("Illegal characters used in \\require prefix");Ci.paths[i]||(Ci.paths[i]="[mathjax]/input/tex/extensions"),s.prefix="["+i+"]/"},[ia.OPTIONS]:ac});function cc(t,e,s,i){if(fi.packages.has(t.options.require.prefix+s)){const r=t.options.autoload[s],[n,o]=2===r.length&&Array.isArray(r[0])?r:[r,[]];for(const t of n)hc.remove(t);for(const t of o)dc.remove(t);t.string=(i?e+" ":"\\begin{"+e.slice(1)+"}")+t.string.slice(t.i),t.i=0}nc(t,s)}const hc=new za("autoload-macros",{}),dc=new za("autoload-environments",{}),uc=Ka.create("autoload",{[ia.HANDLER]:{[ra.MACRO]:["autoload-macros"],[ra.ENVIRONMENT]:["autoload-environments"]},[ia.OPTIONS]:{autoload:wi({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:["data","href","class","style","cssId"],mhchem:["ce","pu"],newcommand:["newcommand","renewcommand","newenvironment","renewenvironment","def","let"],unicode:["unicode","U","char"],verb:["verb"]})},[ia.CONFIG]:function(t,e){const s=e.parseOptions,i=s.handlers.get(ra.MACRO),r=s.handlers.get(ra.ENVIRONMENT),n=s.options.autoload;s.packageData.set("autoload",{Autoload:cc});for(const t of Object.keys(n)){const e=n[t],[s,o]=2===e.length&&Array.isArray(e[0])?e:[e,[]];for(const e of s)i.lookup(e)&&"color"!==e||hc.add(e,new Pa(e,cc,[t,!0]));for(const e of o)r.lookup(e)||dc.add(e,new Pa(e,cc,[t,!1]))}s.packageData.get("require")||lc.config(t,e)},[ia.INIT]:function(t){t.options.require||Bi(t.options,lc.options)},[ia.PRIORITY]:10}),pc="configmacros-map",mc="configmacros-active-map",fc="configmacros-env-map";function gc(t,e,s){const i=s.parseOptions.handlers.retrieve(e),r=s.parseOptions.options[t];for(const t of Object.keys(r)){const e="string"==typeof r[t]?[r[t]]:r[t],s=Array.isArray(e[2])?new Pa(t,Yl.MacroWithTemplate,e.slice(0,2).concat(e[2])):new Pa(t,Yl.Macro,e);i.add(t,s)}}const bc=Ka.create("configmacros",{[ia.INIT]:function(t){new Wa(mc,{}),new za(pc,{}),new qa(fc,Ol.environment,{}),t.append(Ka.local({handler:{[ra.CHARACTER]:[mc],[ra.MACRO]:[pc],[ra.ENVIRONMENT]:[fc]},priority:3}))},[ia.CONFIG]:function(t,e){!function(t){gc("active",mc,t)}(e),function(t){gc("macros",pc,t)}(e),function(t){const e=t.parseOptions.handlers.retrieve(fc),s=t.parseOptions.options.environments;for(const t of Object.keys(s))e.add(t,new Pa(t,Yl.BeginEnv,[!0].concat(s[t])))}(e)},[ia.ITEMS]:{[Kl.prototype.kind]:Kl},[ia.OPTIONS]:{active:wi({}),macros:wi({}),environments:wi({})}});const Ec=Ka.create("noundefined",{[ia.FALLBACK]:{[ra.MACRO]:function(t,e){const s=t.create("text","\\"+e),i=t.options.noundefined,r={};for(const t of["color","background","size"])i[t]&&(r["math"+t]=i[t]);t.Push(t.create("node","mtext",[],r,s))}},[ia.OPTIONS]:{noundefined:{color:"red",background:"",size:""}},[ia.PRIORITY]:3});class xc extends ua{get texParser(){return this.configuration.packageData.get("textmacros").texParser}get tags(){return this.texParser.tags}constructor(t,e,s,i){super(t,e,s),this.level=i}mml(){return this.copyLists(),this.configuration.popParser(),null!=this.level?this.create("node","mstyle",this.nodes,{displaystyle:!1,scriptlevel:this.level}):1===this.nodes.length?this.nodes[0]:this.create("node","mrow",this.nodes)}copyLists(){const t=this.texParser.configuration;for(const[e,s]of Object.entries(this.configuration.nodeLists))for(const i of s)t.addNode(e,i);this.configuration.nodeLists={}}Parse(){this.text="",this.nodes=[],this.envStack=[],super.Parse()}saveText(){if(this.text){const t=this.stack.env.mathvariant,e=Na.internalText(this,this.text,t?{mathvariant:t}:{});this.text="",this.Push(e)}}Push(t){if(this.text&&this.saveText(),t instanceof tl)return super.Push(t);t instanceof pl?this.stack.env.mathcolor=this.stack.env.color:t instanceof Nr&&(this.addAttributes(t),this.nodes.push(t))}PushMath(t){const e=this.stack.env;for(const s of["mathsize","mathcolor"])e[s]&&!t.attributes.hasExplicit(s)&&(t.isToken||t.isKind("mstyle")||(t=this.create("node","mstyle",[t])),Ko.setAttribute(t,s,e[s]));t.isInferred&&(t=this.create("node","mrow",t.childNodes)),t.isKind("TeXAtom")||(t=this.create("node","TeXAtom",[t])),this.nodes.push(t)}addAttributes(t){const e=this.stack.env;if(t.isToken)for(const s of["mathsize","mathcolor","mathvariant"])e[s]&&!t.attributes.hasExplicit(s)&&Ko.setAttribute(t,s,e[s])}ParseTextArg(t,e){const s=this.GetArgument(t);return e=Object.assign(Object.assign({},this.stack.env),e),new xc(s,e,this.configuration).mml()}ParseArg(t){return new xc(this.GetArgument(t),this.stack.env,this.configuration).mml()}Error(t,e,...s){throw new ca(t,e,...s)}}const yc={Comment(t,e){for(;t.i":[yc.Spacer,bo.mediummathspace],";":[yc.Spacer,bo.thickmathspace],"!":[yc.Spacer,bo.negativethinmathspace],enspace:[yc.Spacer,.5],quad:[yc.Spacer,1],qquad:[yc.Spacer,2],thinspace:[yc.Spacer,bo.thinmathspace],negthinspace:[yc.Spacer,bo.negativethinmathspace],hskip:yc.Hskip,hspace:yc.Hskip,kern:yc.Hskip,mskip:yc.Hskip,mspace:yc.Hskip,mkern:yc.Hskip,rule:yc.rule,Rule:[yc.Rule],Space:[yc.Rule,"blank"],color:yc.CheckAutoload,textcolor:yc.CheckAutoload,colorbox:yc.CheckAutoload,fcolorbox:yc.CheckAutoload,href:yc.CheckAutoload,style:yc.CheckAutoload,class:yc.CheckAutoload,data:yc.CheckAutoload,cssId:yc.CheckAutoload,unicode:yc.CheckAutoload,U:yc.CheckAutoload,char:yc.CheckAutoload,ref:[yc.HandleRef,!1],eqref:[yc.HandleRef,!0],underline:[yc.UnderOver,"2015"],llap:yc.Lap,rlap:yc.Lap,phantom:yc.Phantom,vphantom:[yc.Phantom,1,0],hphantom:[yc.Phantom,0,1],smash:yc.Smash,mmlToken:yc.MmlToken});const vc=Ka.create("text-base",{[ia.PARSER]:"text",[ia.PRIORITY]:1,[ia.HANDLER]:{[ra.CHARACTER]:["command","text-special"],[ra.MACRO]:["text-macros"]},[ia.FALLBACK]:{[ra.CHARACTER]:(t,e)=>{t.text+=e},[ra.MACRO]:(t,e)=>{const s=t.texParser,i=s.lookup(ra.MACRO,e);i&&i._func!==yc.Macro&&t.Error("MathMacro","%1 is only supported in math mode","\\"+e),s.parse(ra.MACRO,[t,e])}},[ia.ITEMS]:{[Za.prototype.kind]:Za,[tl.prototype.kind]:tl,[gl.prototype.kind]:gl,[pl.prototype.kind]:pl}});function Tc(t,e,s,i){const r=t.configuration.packageData.get("textmacros");return t instanceof xc||(r.texParser=t),r.parseOptions.clear(),[new xc(e,i?{mathvariant:i}:{},r.parseOptions,s).mml()]}const Cc=Ka.create("textmacros",{[ia.PRIORITY]:1,[ia.CONFIG]:(t,e)=>{const s=new Qa(e.parseOptions.options.textmacros.packages,["tex","text"]);s.init();const i=new Aa(s,[]);i.options=e.parseOptions.options,s.config(e),Oa.addTags(s.tags),i.tags=Oa.getDefault(),i.tags.configuration=i,i.packageData=e.parseOptions.packageData,i.packageData.set("textmacros",{textConf:s,parseOptions:i,jax:e,texParser:null}),i.options.internalMath=Tc},[ia.PREPROCESSORS]:[t=>{const e=t.data.packageData.get("textmacros");e.parseOptions.nodeFactory.setMmlFactory(e.jax.mmlFactory)}],[ia.OPTIONS]:{textmacros:{packages:["text-base"]}}});MathJax.loader&&MathJax.loader.checkVersion("input/tex",ri,"input"),hi({_:{input:{tex_ts:ee,tex:{ColumnParser:qt,Configuration:$t,FilterUtil:Dt,FindTeX:wt,HandlerTypes:Pt,MapHandler:Kt,NodeFactory:Wt,NodeUtil:kt,ParseMethods:Zt,ParseOptions:Vt,ParseUtil:zt,Stack:Ft,StackItem:_t,StackItemFactory:Ht,Tags:Xt,TexConstants:Ot,TexError:jt,TexParser:Ut,Token:Gt,TokenMap:Jt,UnitUtil:Bt,ams:{AmsConfiguration:le,AmsItems:se,AmsMethods:re},autoload:{AutoloadConfiguration:he},base:{BaseConfiguration:te,BaseItems:Yt,BaseMethods:Qt},configmacros:{ConfigMacrosConfiguration:de},newcommand:{NewcommandConfiguration:ae,NewcommandItems:ne,NewcommandMethods:oe,NewcommandUtil:ie},noundefined:{NoUndefinedConfiguration:ue},require:{RequireConfiguration:ce},textmacros:{TextMacrosConfiguration:fe,TextMacrosMethods:me,TextParser:pe}}}}}),vi.preLoaded("input/tex-base","[tex]/ams","[tex]/newcommand","[tex]/textmacros","[tex]/noundefined","[tex]/require","[tex]/autoload","[tex]/configmacros"),function(t=[],e=!0){if(MathJax.startup){e&&(MathJax.startup.registerConstructor("tex",MathJax._.input.tex_ts.TeX),MathJax.startup.useInput("tex")),MathJax.config.tex||(MathJax.config.tex={});let s=MathJax.config.tex.packages;MathJax.config.tex.packages=t,s&&(Array.isArray(s)&&(s={"[+]":s.filter(e=>!t.includes(e))}),Pi(MathJax.config.tex,{packages:s}))}}(["base","ams","newcommand","textmacros","noundefined","require","autoload","configmacros"]);const Ac="http://www.w3.org/1998/Math/MathML";class Lc extends Qi{findMath(t){const e=new Set;this.findMathNodes(t,e),this.findMathPrefixed(t,e);const s=this.adaptor.root(this.adaptor.document);return"html"===this.adaptor.kind(s)&&0===e.size&&this.findMathNS(t,e),this.processMath(e)}findMathNodes(t,e){for(const s of this.adaptor.tags(t,"math"))e.add(s)}findMathPrefixed(t,e){const s=this.adaptor.root(this.adaptor.document);for(const i of this.adaptor.allAttributes(s))if("xmlns:"===i.name.substring(0,6)&&i.value===Ac){const s=i.name.substring(6);for(const i of this.adaptor.tags(t,s+":math"))e.add(i)}}findMathNS(t,e){for(const s of this.adaptor.tags(t,"math",Ac))e.add(s)}processMath(t){const e=this.adaptor,s=[];for(const i of t.values()){if("mjx-assistive-mml"===e.kind(e.parent(i)))continue;const t="block"===e.getAttribute(i,"display")||"display"===e.getAttribute(i,"mode"),r={node:i,n:0,delim:""},n={node:i,n:0,delim:""};s.push({math:e.outerHTML(i),start:r,end:n,display:t})}return s}}Lc.OPTIONS={};class Sc{constructor(t={}){const e=this.constructor;this.options=Fi(Bi({},e.OPTIONS),t)}setMmlFactory(t){this.factory=t}compile(t){const e=this.makeNode(t);return e.verifyTree(this.options.verify),e.setInheritedAttributes({},!1,0,!1),e.walkTree(this.markMrows),e}makeNode(t){const e=this.adaptor;let s=!1;const i=e.kind(t).replace(/^.*:/,"");let r=e.getAttribute(t,"data-mjx-texclass")||"";r&&(r=this.filterAttribute("data-mjx-texclass",r)||"");let n=r&&"mrow"===i?"TeXAtom":i;for(const o of this.filterClassList(e.allClasses(t)))o.match(/^MJX-TeXAtom-/)&&"mrow"===i?(r=o.substring(12),n="TeXAtom"):"MJX-fixedlimits"===o&&(s=!0);return this.factory.getNodeClass(n)?this.createMml(n,t,r,s):this.unknownNode(n,t)}createMml(t,e,s,i){const r=this.factory.create(t);return"TeXAtom"!==t||"OP"!==s||i||(r.setProperty("movesupsub",!0),r.attributes.setInherited("movablelimits",!0)),s&&(r.texClass=fr[s],r.setProperty("texClass",r.texClass)),this.addAttributes(r,e),this.checkClass(r,e),this.addChildren(r,e),r}unknownNode(t,e){return this.factory.getNodeClass("html")&&this.options.allowHtmlInTokenNodes?this.factory.create("html").setHTML(e,this.adaptor):(this.error('Unknown node type "'+t+'"'),null)}addAttributes(t,e){let s=!1;for(const i of this.adaptor.allAttributes(e)){const e=i.name,r=this.filterAttribute(e,i.value);if(null!==r&&"xmlns"!==e)if("data-mjx-"===e.substring(0,9))switch(e.substring(9)){case"alternate":t.setProperty("variantForm",!0);break;case"variant":t.attributes.set("mathvariant",r),t.setProperty("ignore-variant",!0),s=!0;break;case"smallmatrix":t.setProperty("smallmatrix",!0),t.setProperty("useHeight",!1);break;case"mathaccent":t.setProperty("mathaccent","true"===r);break;case"auto-op":t.setProperty("autoOP","true"===r);break;case"script-align":t.setProperty("scriptalign",r);break;case"vbox":t.setProperty("vbox",r);break;default:t.attributes.set(e,r)}else if("class"!==e){const i=r.toLowerCase();"true"===i||"false"===i?t.attributes.set(e,"true"===i):s&&"mathvariant"===e||t.attributes.set(e,r)}}}filterAttribute(t,e){return e}filterClassList(t){return t}addChildren(t,e){if(0===t.arity)return;const s=this.adaptor;for(const i of s.childNodes(e)){const e=s.kind(i);if("#comment"!==e)if("#text"===e)this.addText(t,i);else if(t.isKind("annotation-xml"))t.appendChild(this.factory.create("XML").setXML(i,s));else{const e=t.appendChild(this.makeNode(i));0===e.arity&&s.childNodes(i).length&&!e.isKind("html")&&(this.options.fixMisplacedChildren?this.addChildren(t,i):e.mError("There should not be children for "+e.kind+" nodes",this.options.verify,!0))}}t.isToken&&this.trimSpace(t)}addText(t,e){let s=this.adaptor.value(e);(t.isToken||t.getProperty("isChars"))&&t.arity?(t.isToken&&(s=Ro(s),s=this.normalizeSpace(s)),t.appendChild(this.factory.create("text").setText(s))):s.match(/\S/)&&this.error('Unexpected text node "'+s+'"')}checkClass(t,e){const s=[];for(const i of this.filterClassList(this.adaptor.allClasses(e)))"MJX-"===i.substring(0,4)?"MJX-variant"===i?t.setProperty("variantForm",!0):"MJX-TeXAtom"!==i.substring(0,11)&&t.attributes.set("mathvariant",this.fixCalligraphic(i.substring(3))):s.push(i);s.length&&t.attributes.set("class",s.join(" "))}fixCalligraphic(t){return t.replace(/caligraphic/,"calligraphic")}markMrows(t){if(t.isKind("mrow")&&!t.isInferred&&t.childNodes.length>=2){const e=t.childNodes[0],s=t.childNodes[t.childNodes.length-1];e.isKind("mo")&&e.attributes.get("fence")&&e.attributes.get("stretchy")&&s.isKind("mo")&&s.attributes.get("fence")&&s.attributes.get("stretchy")&&(e.childNodes.length&&t.setProperty("open",e.getText()),s.childNodes.length&&t.setProperty("close",s.getText()))}}normalizeSpace(t){return t.replace(/[\t\n\r]/g," ").replace(/ +/g," ")}trimSpace(t){let e=t.childNodes[0];e&&(e.isKind("text")&&e.setText(e.getText().replace(/^ +/,"")),e=t.childNodes[t.childNodes.length-1],e.isKind("text")&&e.setText(e.getText().replace(/ +$/,"")))}error(t){throw new Error(t)}}Sc.OPTIONS={MmlFactory:null,allowHtmlInTokenNodes:!1,fixMisplacedChildren:!0,verify:Object.assign({},Nr.verifyDefaults),translateEntities:!0};class Rc extends Zi{constructor(t={}){const[e,s,i]=Ui(t,Lc.OPTIONS,Sc.OPTIONS);super(e),this.findMathML=this.options.FindMathML||new Lc(s),this.mathml=this.options.MathMLCompile||new Sc(i),this.mmlFilters=new bi(this.options.mmlFilters)}setAdaptor(t){super.setAdaptor(t),this.findMathML.adaptor=t,this.mathml.adaptor=t}setMmlFactory(t){super.setMmlFactory(t),this.mathml.setMmlFactory(t)}get processStrings(){return!1}compile(t,e){let s=t.start.node;if(!s||!t.end.node||this.options.forceReparse||"#text"===this.adaptor.kind(s)){let i=this.executeFilters(this.preFilters,t,e,(t.math||"").trim());"html"===this.options.parseAs&&(i=`${i}`);const r=this.checkForErrors(this.adaptor.parse(i,"text/"+this.options.parseAs)),n=this.adaptor.body(r);1!==this.adaptor.childNodes(n).length&&this.error("MathML must consist of a single element"),s=this.adaptor.remove(this.adaptor.firstChild(n)),"math"!==this.adaptor.kind(s).replace(/^[a-z]+:/,"")&&this.error("MathML must be formed by a element, not <"+this.adaptor.kind(s)+">")}s=this.executeFilters(this.mmlFilters,t,e,s);let i=this.mathml.compile(s);return i=this.executeFilters(this.postFilters,t,e,i),t.display="block"===i.attributes.get("display"),i}checkForErrors(t){const e=this.adaptor.tags(this.adaptor.body(t),"parsererror")[0];return e&&(""===this.adaptor.textContent(e)&&this.error("Error processing MathML"),this.options.parseError.call(this,e)),t}error(t){throw new Error(t)}findMath(t){return this.findMathML.findMath(t)}}Rc.NAME="MathML",Rc.OPTIONS=Bi({parseAs:"html",forceReparse:!1,mmlFilters:[],FindMathML:null,MathMLCompile:null,parseError:function(t){this.error(this.adaptor.textContent(t).replace(/\n.*/g,""))}},Zi.OPTIONS),MathJax.loader&&MathJax.loader.checkVersion("input/mml",ri,"input"),hi({_:{input:{mathml_ts:Ee,mathml:{FindMathML:ge,MathMLCompile:be}}}}),MathJax.loader&&MathJax.loader.pathFilters.add(t=>(t.name=t.name.replace(/\/util\/entities\/.*?\.js/,"/input/mml/entities.js"),!0)),MathJax.startup&&(MathJax.startup.registerConstructor("mml",Rc),MathJax.startup.useInput("mml"));const Mc={None:"",Vertical:"v",Horizontal:"h"},Ic=Mc.Vertical,wc=Mc.Horizontal;var kc=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const Oc=.07,Dc=.07,Pc={dir:Mc.None};function Bc(t,e,s){return s?Bi(t,{[e]:s})[e]:t[e]}class Fc{get CLASS(){return this.constructor}static charOptions(t,e){const s=t[e];if(!Array.isArray(s))throw Error(`Character data hasn't been loaded for 0x${e.toString(16).toUpperCase()}`);return 3===s.length&&(s[3]={}),s[3]}static defineDynamicFiles(t,e=""){const s={};return(t||[]).forEach(([t,i,r])=>{s[t]={extension:e,file:t,variants:i,delimiters:r||[],promise:null,failed:!1,setup:e=>{s[t].failed=!0}}}),s}static dynamicSetup(t,e,s,i={},r=null){const n=t?this.dynamicExtensions.get(t):null;(t?n.files:this.dynamicFiles)[e].setup=e=>{Object.keys(s).forEach(t=>e.defineChars(t,s[t])),e.defineDelimiters(i),t&&this.adjustDelimiters(e.delimiters,Object.keys(i),n.sizeN,n.stretchN),r&&e.addDynamicFontCss(r)}}static adjustDelimiters(t,e,s,i){e.forEach(e=>{const r=t[parseInt(e)];"dir"in r&&(r.variants&&(r.variants=this.adjustArrayIndices(r.variants,s)),r.stretchv&&(r.stretchv=this.adjustArrayIndices(r.stretchv,i)))})}static adjustArrayIndices(t,e){return t.map(t=>t<0?e-1-t:t)}static addExtension(t,e=""){const s={name:t.name,prefix:e||`[${t.name}-extension]/${this.JAX.toLowerCase()}/dynamic`,files:this.defineDynamicFiles(t.ranges,t.name),sizeN:this.defaultSizeVariants.length,stretchN:this.defaultStretchVariants.length};this.dynamicExtensions.set(t.name,s);for(const[e,s]of[["options","OPTIONS"],["variants","defaultVariants"],["variantSmp","VariantSmp"],["cssFonts","defaultCssFonts"],["accentMap","defaultAccentMap"],["moMap","defaultMoMap"],["mnMap","defaultMnMap"],["parameters","defaultParams"],["chars","defaultChars"],["sizeVariants","defaultSizeVariants"],["stretchVariants","defaultStretchVariants"]])Bc(this,s,t[e]);t.delimiters&&(Object.assign(this.defaultDelimiters,t.delimiters),this.adjustDelimiters(this.defaultDelimiters,Object.keys(t.delimiters),s.sizeN,s.stretchN))}constructor(t=null){this.variant={},this.delimiters={},this.cssFontMap={},this.cssFontPrefix="",this.remapChars={},this.skewIcFactor=.75;const e=this.CLASS;this.options=Fi(Bi({},e.OPTIONS),t),this.params=Object.assign({},e.defaultParams),this.sizeVariants=[...e.defaultSizeVariants],this.stretchVariants=[...e.defaultStretchVariants],this.defineCssFonts(e.defaultCssFonts),this.cssFamilyPrefix=e.defaultCssFamilyPrefix,this.createVariants(e.defaultVariants),this.defineDelimiters(e.defaultDelimiters),Object.keys(e.defaultChars).forEach(t=>this.defineChars(t,e.defaultChars[t])),this.defineRemap("accent",e.defaultAccentMap),this.defineRemap("mo",e.defaultMoMap),this.defineRemap("mn",e.defaultMnMap),this.defineDynamicCharacters(e.dynamicFiles),e.dynamicExtensions.forEach(t=>this.defineDynamicCharacters(t.files))}setOptions(t){Bi(this.options,t)}addExtension(t,e=""){const s=this.constructor.JAX.toLowerCase(),i={name:t.name,prefix:e||`[${t.name}-extension]/${s}/dynamic`,files:this.CLASS.defineDynamicFiles(t.ranges,e),sizeN:this.sizeVariants.length,stretchN:this.stretchVariants.length};this.CLASS.dynamicExtensions.set(t.name,i),Bi(this.options,t.options||{}),Bi(this.params,t.parameters||{}),Bc(this,"sizeVariants",t.sizeVariants),Bc(this,"stretchVariants",t.stretchVariants),Bc(this.constructor,"VariantSmp",t.variantSmp),this.defineCssFonts(Bc({cssFonts:{}},"cssFonts",t.cssFonts)),this.createVariants(Bc({variants:[]},"variants",t.variants)),t.delimiters&&(this.defineDelimiters(Bc({delimiters:{}},"delimiters",t.delimiters)),this.CLASS.adjustDelimiters(this.delimiters,Object.keys(t.delimiters),i.sizeN,i.stretchN));for(const e of Object.keys(t.chars||{}))this.defineChars(e,t.chars[e]);return this.defineRemap("accent",t.accentMap),this.defineRemap("mo",t.moMap),this.defineRemap("mn",t.mnMap),t.ranges&&this.defineDynamicCharacters(i.files),[]}get styles(){return this._styles}set styles(t){this._styles=t}createVariant(t,e=null,s=null){const i={linked:[],chars:Object.create(e?this.variant[e].chars:{})};this.variant[s]&&(Object.assign(i.chars,this.variant[s].chars),this.variant[s].linked.push(i.chars),i.chars=Object.create(i.chars)),this.remapSmpChars(i.chars,t),this.variant[t]=i}remapSmpChars(t,e){const s=this.CLASS;let i=s.VariantSmp[e];if("string"==typeof i&&(i=s.VariantSmp[i]),!i)return;const r=s.SmpRemap,n=[null,null,s.SmpRemapGreekU,s.SmpRemapGreekL];for(const[e,o,a]of s.SmpRanges){const s=i[e];if(s){for(let e=o;e<=a;e++){if(930===e)continue;const i=s+e-o;t[e]=this.smpChar(r[i]||i)}if(n[e])for(const i of Object.keys(n[e]).map(t=>parseInt(t)))t[i]=this.smpChar(s+n[e][i])}}const o=i[5]||{};for(const e of Object.keys(o))t[e]=this.smpChar(i[5][e])}smpChar(t){return[,,,{smp:t}]}createVariants(t){for(const e of t)this.createVariant(e[0],e[1],e[2])}defineChars(t,e){const s=this.variant[t];Object.assign(s.chars,e);for(const t of s.linked)Object.assign(t,e)}defineCssFonts(t){Object.assign(this.cssFontMap,t);for(const e of Object.keys(t))"unknown"===this.cssFontMap[e][0]&&(this.cssFontMap[e][0]=this.options.unknownFamily)}defineDelimiters(t){Object.assign(this.delimiters,t)}defineRemap(t,e){e&&(Object.hasOwn(this.remapChars,t)||(this.remapChars[t]={}),Object.assign(this.remapChars[t],e))}defineDynamicCharacters(t){for(const e of Object.keys(t)){const s=t[e];for(const t of Object.keys(s.variants))this.defineChars(t,this.flattenRanges(s.variants[t],s));this.defineDelimiters(this.flattenRanges(s.delimiters,s))}}flattenRanges(t,e){const s={};for(const i of t)if(Array.isArray(i))for(let t=i[0];t<=i[1];t++)s[t]=e;else s[i]=e;return s}dynamicFileName(t){const e=t.extension?this.CLASS.dynamicExtensions.get(t.extension).prefix:this.options.dynamicPrefix;return t.file.match(/^(?:[/[]|[a-z]+:\/\/|[a-z]:)/i)?t.file:e+"/"+t.file.replace(/(\.js)?$/,".js")}loadDynamicFile(t){return kc(this,void 0,void 0,function*(){return t.failed?Promise.reject(new Error(`dynamic file '${t.file}' failed to load`)):(t.promise||(t.promise=po(this.dynamicFileName(t)).catch(e=>{t.failed=!0,console.warn(e)})),t.promise.then(()=>t.setup(this)))})}loadDynamicFiles(){const t=this.CLASS.dynamicFiles,e=Object.keys(t).map(e=>this.loadDynamicFile(t[e]));for(const t of this.CLASS.dynamicExtensions.values())e.push(...Object.keys(t.files).map(e=>this.loadDynamicFile(t.files[e])));return Promise.all(e)}loadDynamicFilesSync(){if(!to.asyncIsSynchronous)throw Error("MathJax(loadDynamicFilesSync): mathjax.asyncLoad must be specified and synchronous\n Try importing #js/../components/require.mjs and #js/util/asyncLoad/node.js");const t=this.CLASS.dynamicFiles;Object.keys(t).forEach(e=>this.loadDynamicFileSync(t[e]));for(const t of this.CLASS.dynamicExtensions.values())Object.keys(t.files).forEach(e=>this.loadDynamicFileSync(t.files[e]))}loadDynamicFileSync(t){if(!t.promise){t.promise=Promise.resolve();try{to.asyncLoad(this.dynamicFileName(t))}catch(e){t.failed=!0,console.warn(e)}t.setup(this)}}addDynamicFontCss(t,e){}getDelimiter(t){const e=this.delimiters[t];return e&&!("dir"in e)?(this.delimiters[t]=null,Pn(this.loadDynamicFile(e)),null):e}getSizeVariant(t,e){const s=this.getDelimiter(t);return s&&s.variants&&(e=s.variants[e]),this.sizeVariants[e]}getStretchVariant(t,e){const s=this.getDelimiter(t);return this.stretchVariants[s.stretchv?s.stretchv[e]:0]}getStretchVariants(t){return[0,1,2,3].map(e=>this.getStretchVariant(t,e))}getChar(t,e){const s=this.variant[t].chars[e];if(s&&!Array.isArray(s)){const i=this.variant[t];return delete i.chars[e],i.linked.forEach(t=>delete t[e]),Pn(this.loadDynamicFile(s)),null}return s}getVariant(t){return this.variant[t]}getCssFont(t){return this.cssFontMap[t]||["serif",!1,!1]}getFamily(t){return this.cssFamilyPrefix?this.cssFamilyPrefix+", "+t:t}getRemappedChar(t,e){return(this.remapChars[t]||{})[e]}}Fc.OPTIONS={unknownFamily:"serif",dynamicPrefix:"."},Fc.JAX="common",Fc.NAME="",Fc.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"],["-smallop","normal"],["-largeop","normal"],["-tex-calligraphic","italic"],["-tex-bold-calligraphic","bold-italic"],["-tex-oldstyle","normal"],["-tex-bold-oldstyle","bold"],["-tex-mathit","italic"],["-tex-variant","normal"]],Fc.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],"-smallop":["unknown",!1,!1],"-largeop":["unknown",!1,!1],"-tex-calligraphic":["cursive",!0,!1],"-tex-bold-calligraphic":["cursive",!0,!0],"-tex-oldstyle":["unknown",!1,!1],"-tex-bold-oldstyle":["unknown",!1,!0],"-tex-mathit":["unknown",!0,!1],"-tex-variant":["unknown",!1,!1]},Fc.defaultCssFamilyPrefix="",Fc.VariantSmp={bold:[119808,119834,120488,120514,120782,{988:120778,989:120779}],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]},Fc.SmpRanges=[[0,65,90],[1,97,122],[2,913,937],[3,945,969],[4,48,57]],Fc.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},Fc.SmpRemapGreekU={8711:25,1012:17},Fc.SmpRemapGreekL={977:27,981:29,982:31,1008:28,1009:30,1013:26,8706:25},Fc.defaultAccentMap={94:"\u02c6",126:"\u02dc",768:"\u02cb",769:"\u02ca",770:"\u02c6",771:"\u02dc",772:"\u02c9",774:"\u02d8",775:"\u02d9",776:"\xa8",778:"\u02da",780:"\u02c7",8594:"\u20d7"},Fc.defaultMoMap={45:"\u2212"},Fc.defaultMnMap={45:"\u2212"},Fc.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:.06,scriptspace:.05,nulldelimiterspace:.12,delimiterfactor:901,delimitershortfall:.3,rule_factor:1.25,min_rule_thickness:1.25,separation_factor:1.75,extra_ic:.033,extender_factor:.333},Fc.defaultDelimiters={},Fc.defaultChars={},Fc.defaultSizeVariants=[],Fc.defaultStretchVariants=[],Fc.dynamicFiles={},Fc.dynamicExtensions=new Map;class jc extends vo{static from(t,e,s=null){const i=new this;return Object.assign(i,t),i.lineLeading=e,s&&(i.indentData=s),i}constructor(t,e=null){super(t),this.indentData=null,this.isFirst=!1,this.originalL=this.L,e&&(this.start=e)}append(t){this.isFirst&&(t.originalL+=t.L,t.L=0),t.indentData&&(this.indentData=t.indentData),this.lineLeading=t.lineLeading,super.append(t),this.isFirst=t.isFirst}copy(){const t=jc.from(this,this.lineLeading);return t.indentData=this.indentData,t.lineLeading=this.lineLeading,t}getIndentData(t){let{indentalign:e,indentshift:s,indentalignfirst:i,indentshiftfirst:r,indentalignlast:n,indentshiftlast:o}=t.attributes.getAllAttributes();"indentalign"===i&&(i=t.attributes.getInherited("indentalign")),"indentshift"===r&&(r=t.attributes.getInherited("indentshift")),"indentalign"===n&&(n=e),"indentshift"===o&&(o=s),this.indentData=[[i,r],[e,s],[n,o]]}copyIndentData(t){return t.indentData.map(([t,e])=>[t,e])}}const _c=1e6;class Uc extends Gn{breakToWidth(t,e){}}class Hc extends Uc{constructor(){super(...arguments),this.PENALTY={newline:t=>0,nobreak:t=>_c,goodbreak:t=>t-200*this.state.depth,badbreak:t=>t+200*this.state.depth,auto:t=>t},this.FACTORS={depth:t=>t+800*this.state.depth,width:t=>t+Math.floor((this.state.width-this.state.w)/this.state.width*2500),tail:t=>t+Math.floor(this.state.width/Math.max(1e-4,this.state.mathLeft-this.state.w)*500),open:(t,e)=>{const s=e.node.prevClass;if(s===fr.BIN||s===fr.REL||s===fr.OP)return t+5e3;const i=this.getPrevious(e);if(i&&("postfix"!==i.attributes.get("form")||"nobreak"===i.attributes.get("linebreak")))return t+5e3;const r=e.node.Parent;if((null==r?void 0:r.isKind("mmultiscripts"))&&e.node===this.getFirstToken(r)){if(!!r.childNodes.filter(t=>t.isKind("mprescripts")).length)return _c}return t-500},close:(t,e)=>{var s;const i=e.node.Parent;return!(null==i?void 0:i.isKind("msubsup"))||i.isKind("mmultiscripts")&&(null===(s=i.childNodes[1])||void 0===s?void 0:s.isKind("mprescripts"))||e.node!==this.getLastToken(i.childNodes[0])?t+500:_c},space:(t,e)=>{const s=e;if(!s.canBreak)return _c;const i=s.getBBox().w;return i<0?_c:i<1?t:t-100*(i+4)},separator:t=>t+500,fuzz:t=>.99*t},this.TEXCLASS={[fr.BIN]:t=>t-250,[fr.REL]:t=>t-500}}breakToWidth(t,e){const s=this.state;this.state=this.createState(t),this.state.width=e;const i=t.breakCount;for(let s=0;s<=i;s++){(t.lineBBox[s]||t.getLineBBox(s)).w>e&&this.breakLineToWidth(t,s)}for(const[t,e]of this.state.breaks){if(null===e){const e=t.coreMO();e.setBreakStyle(e.node.attributes.get("linebreakstyle")||"before")}else t.setBreakAt(e);t.invalidateBBox()}this.state=s}createState(t){const e=t.getBBox().w;return{breaks:new Set,potential:[],width:0,w:0,prevWidth:0,prevBreak:null,depth:0,mathWidth:e,mathLeft:e}}breakLineToWidth(t,e){const s=this.state;s.potential=[],s.w=0,s.prevWidth=0,s.prevBreak=null,s.depth=0,this.visitNode(t,e)}addWidth(t,e=null){null===e&&(e=t.L+t.w+t.R),e&&(e*=t.rscale,this.state.w+=e,this.state.potential.length&&(this.state.potential[0][4]+=e),this.processBreak())}processBreak(){const t=this.state;for(;t.potential.length&&t.w>this.state.width;){const e=t.potential.pop(),[s,,i,r,n]=e;t.breaks.add(s),t.w=t.potential.reduce((t,e)=>t+e[4],r+n),t.prevBreak&&t.prevWidth+i<=t.width?(t.breaks.delete(t.prevBreak[0]),t.prevWidth+=i):t.prevWidth=i+r,t.potential.forEach(t=>t[2]-=i),t.prevBreak=e,t.mathLeft-=i}}pushBreak(t,e,s,i){var r;const n=this.state;if(!(e>=_c||0===n.w&&0===n.prevWidth)){for(;n.potential.length&&n.potential[0][1]>this.FACTORS.fuzz(e);){const t=n.potential.shift();n.potential.length&&(n.potential[0][4]+=t[4])}n.potential.unshift([[t,i],e,n.w-((null===(r=n.prevBreak)||void 0===r?void 0:r[3])||0),s,0])}}getBorderLR(t){var e;const s=t.styleData;if(!s)return[0,0];const i=(null===(e=null==s?void 0:s.border)||void 0===e?void 0:e.width)||[0,0,0,0],r=(null==s?void 0:s.padding)||[0,0,0,0];return[i[3]+r[3],i[1]+r[1]]}getFirstToken(t){return t.isToken?t:this.getFirstToken(t.childNodes[0])}getLastToken(t){return t.isToken?t:this.getLastToken(t.childNodes[t.childNodes.length-1])}visitNode(t,e){t&&(this.state.depth++,t.node.isEmbellished&&!t.node.isKind("mo")?this.visitEmbellishedOperator(t,e):super.visitNode(t,e),this.state.depth--)}visitDefault(t,e){var s;const i=t.getLineBBox(e);if(t.node.isToken||t.node.linebreakContainer||!(null===(s=t.childNodes)||void 0===s?void 0:s[0]))this.addWidth(i);else{const[s,r]=this.getBorderLR(t);0===e&&this.addWidth(i,i.L+s),this.visitNode(t.childNodes[0],e),e===t.breakCount&&this.addWidth(i,i.R+r)}}visitEmbellishedOperator(t,e){const s=t.coreMO(),i=jc.from(t.getOuterBBox(),t.linebreakOptions.lineleading);i.getIndentData(s.node);const r=s.getBreakStyle(s.node.attributes.get("linebreakstyle")),n=s.processIndent("",i.indentData[1][1],"",i.indentData[0][1],this.state.width)[1],o=this.moPenalty(s);if("before"===r)this.pushBreak(t,o,n-i.L,null),this.addWidth(i);else{this.addWidth(i);const e=("after"===r?0:s.multChar?s.multChar.getBBox().w:i.w)+n;this.pushBreak(t,o,e,null)}}visitMoNode(t,e){const s=t,i=jc.from(s.getOuterBBox(),s.linebreakOptions.lineleading);i.getIndentData(s.node);const r=s.getBreakStyle(s.node.attributes.get("linebreakstyle")),n=s.processIndent("",i.indentData[1][1],"",i.indentData[0][1],this.state.width)[1],o=this.moPenalty(s);if("before"===r)this.pushBreak(t,o,n-i.L,null),this.addWidth(i);else{this.addWidth(i);const e=("after"===r?0:s.multChar?s.multChar.getBBox().w:i.w)+n;this.pushBreak(t,o,e,null)}}moPenalty(t){const{linebreak:e,fence:s,form:i}=t.node.attributes.getList("linebreak","fence","form"),r=this.FACTORS;let n=r.tail(r.width(0));const o=s&&"prefix"===i||t.node.texClass===fr.OPEN,a=s&&"postfix"===i||t.node.texClass===fr.CLOSE;return o&&(n=r.open(n,t),this.state.depth++),a&&(n=r.close(n,t),this.state.depth--),n=(this.TEXCLASS[t.node.texClass]||(t=>t))(n),(this.PENALTY[e]||(t=>t))(r.depth(n))}getPrevious(t){let e=t.node,s=e.parent,i=s.childIndex(e);for(;s&&(s.notParent||s.isKind("mrow"))&&0===i;)e=s,s=e.parent,i=s.childIndex(e);if(!s||!i)return null;const r=s.childNodes[i-1];return r.isEmbellished?r.coreMO():null}visitMspaceNode(t,e){const s=t.getLineBBox(e),i=t;if(i.canBreak){const e=this.mspacePenalty(i);s.getIndentData(t.node);const r=t.processIndent("",s.indentData[1][1],"",s.indentData[0][1],this.state.width)[1];this.pushBreak(t,e,r-s.w,null)}this.addWidth(s)}mspacePenalty(t){const e=t.node.attributes.get("linebreak"),s=this.FACTORS,i=s.space(s.tail(s.width(0)),t);return(this.PENALTY[e]||(t=>t))(s.depth(i))}visitMtextNode(t,e){if(!t.getText().match(/ /))return void this.visitDefault(t,e);const s=t;s.clearBreakPoints();const i=s.textWidth(" "),r=t.getBBox(),[n,o]=this.getBorderLR(t);this.addWidth(r,r.L+n);const a=s.childNodes;for(const e of a.keys()){const n=a[e];if(n.node.isKind("text")){const o=n.node.getText().split(/ /),a=o.pop();for(const n of o.keys())this.addWidth(r,s.textWidth(o[n])),this.pushBreak(t,this.mtextPenalty(),-i,[e,n+1]),this.addWidth(r,i);this.addWidth(r,s.textWidth(a))}else this.addWidth(n.getBBox())}this.addWidth(r,r.R+o)}mtextPenalty(){const t=this.FACTORS;return t.depth(t.tail(t.width(0)))}visitMrowNode(t,e){const s=t.lineBBox[e]||t.getLineBBox(e),[i,r]=s.start||[0,0],[n,o]=s.end||[t.childNodes.length-1,0],[a,l]=this.getBorderLR(t);this.addWidth(s,s.L+a);for(let e=i;e<=n;e++)this.visitNode(t.childNodes[e],e===i?r:e===n?o:0);this.addWidth(s,s.R+l)}visitInferredMrowNode(t,e){this.state.depth--,this.visitMrowNode(t,e),this.state.depth++}visitMfracNode(t,e){const s=t;!s.node.attributes.get("bevelled")&&s.getOuterBBox().w>this.state.width&&(this.breakToWidth(s.childNodes[0],this.state.width),this.breakToWidth(s.childNodes[1],this.state.width)),this.visitDefault(t,e)}visitMsqrtNode(t,e){if(t.getOuterBBox().w>this.state.width){const e=t,s=e.childNodes[e.base];this.breakToWidth(s,this.state.width-e.rootWidth()),e.getStretchedSurd()}this.visitDefault(t,e)}visitMrootNode(t,e){this.visitMsqrtNode(t,e)}visitMsubNode(t,e){this.visitDefault(t,e);const s=t,i=s.getOffset()[0],r=s.scriptChild.getOuterBBox(),[n,o]=this.getBorderLR(t);this.addWidth(s.getLineBBox(e),i+n+r.rscale*r.w+s.font.params.scriptspace+o)}visitMsupNode(t,e){this.visitDefault(t,e);const s=t,i=s.getOffset()[0],r=s.scriptChild.getOuterBBox(),[n,o]=this.getBorderLR(t);this.addWidth(s.getLineBBox(e),i+n+r.rscale*r.w+s.font.params.scriptspace+o)}visitMsubsupNode(t,e){this.visitDefault(t,e);const s=t,i=s.subChild.getOuterBBox(),r=s.supChild.getOuterBBox(),n=s.getAdjustedIc(),o=Math.max(i.rscale*i.w,n+r.rscale*r.w)+s.font.params.scriptspace,[a,l]=this.getBorderLR(t);this.addWidth(t.getLineBBox(e),a+o+l)}visitMmultiscriptsNode(t,e){const s=t,i=s.scriptData;if(i.numPrescripts){const r=Math.max(i.psup.rscale*i.psup.w,i.psub.rscale*i.psub.w);this.addWidth(t.getLineBBox(e),r+s.font.params.scriptspace)}if(this.visitDefault(t,e),i.numScripts){const r=Math.max(i.sup.rscale*i.sup.w,i.sub.rscale*i.sub.w);this.addWidth(t.getLineBBox(e),r+s.font.params.scriptspace)}}visitMfencedNode(t,e){const s=t,i=t.getLineBBox(e),[r,n]=this.getBorderLR(t);0===e&&this.addWidth(i,i.L+r),this.visitNode(s.mrow,e),e===t.breakCount&&this.addWidth(i,i.R+n)}visitMactionNode(t,e){const s=t,i=t.getLineBBox(e),[r,n]=this.getBorderLR(t);0===e&&this.addWidth(i,i.L+r),this.visitNode(s.selected,e),e===t.breakCount&&this.addWidth(i,i.R+n)}}!function(){for(const t of Object.keys(Br.postfix)){const e=Br.postfix[t][3];e&&e.fence&&(e.linebreakstyle="after")}Br.infix["\u2061"]=[...Br.infix["\u2061"]],Br.infix["\u2061"][3]={linebreak:"nobreak"}}();const Wc="@mathjax/%%FONT%%-font";class zc extends tr{get forceInlineBreaks(){return!1}constructor(t={},e=null,s=null){const[i,r]=t.fontData instanceof Fc?[t.fontData.constructor,t.fontData]:[t.fontData||s,null],[n,o]=Ui(t,i.OPTIONS);super(n),this.factory=this.options.wrapperFactory||new e,this.factory.jax=this,this.styleJson=this.options.styleJson||new ao,this.font=r||new i(o),this.font.setOptions({mathmlSpacing:this.options.mathmlSpacing}),this.constructor.genericFont=i,this.unknownCache=new Map;const a=this.options.linebreaks.LinebreakVisitor||Hc;this.linebreaks=new a(this.factory)}setAdaptor(t){super.setAdaptor(t),"auto"===this.options.htmlHDW&&(this.options.htmlHDW=t.canMeasureNodes?"ignore":"force")}addExtension(t,e=""){return this.font.addExtension(t,e)}typeset(t,e){const s=this.constructor,i=s.genericFont;s.genericFont=this.font.constructor,this.setDocument(e);const r=this.createNode();try{this.toDOM(t,r,e)}finally{s.genericFont=i}return r}createNode(){const t=this.constructor.NAME;return this.html("mjx-container",{class:"MathJax",jax:t})}setScale(t,e){let s=this.getInitialScale()*this.options.scale;if("scale"===e.node.attributes.get("overflow")&&this.math.display){const t=e.getOuterBBox().w,i=Math.max(0,this.math.metrics.containerWidth-4)/this.pxPerEm;t>i&&t&&(s*=i/t)}1!==s&&this.adaptor.setStyle(t,"fontSize",xo(s))}getInitialScale(){return this.math.metrics.scale}toDOM(t,e,s=null){var i;this.setDocument(s),this.math=t,this.container=e,this.pxPerEm=t.metrics.ex/this.font.params.x_height,this.executeFilters(this.preFilters,t,s,e),this.nodeMap=new Map,t.root.attributes.getAllInherited().overflow=this.options.displayOverflow;const r=t.root.attributes.get("overflow");this.adaptor.setAttribute(e,"overflow",r);"linebreak"===r&&this.getLinebreakWidth();const n=this.options.linebreaks.inline&&!t.display;let o=!!t.root.getProperty("inlineMarked");!o||n&&this.forceInlineBreaks===t.root.getProperty("inlineForced")||(this.unmarkInlineBreaks(t.root),t.root.removeProperty("inlineMarked"),t.root.removeProperty("inlineForced"),o=!1),n&&!o&&(this.markInlineBreaks(null===(i=t.root.childNodes)||void 0===i?void 0:i[0]),t.root.setProperty("inlineMarked",!0),t.root.setProperty("inlineForced",this.forceInlineBreaks)),t.root.setTeXclass(null);const a=this.factory.wrap(t.root);this.setScale(e,a),this.processMath(a,e),this.nodeMap=null,this.executeFilters(this.postFilters,t,s,e)}getBBox(t,e){this.setDocument(e),this.math=t,t.root.setTeXclass(null),this.nodeMap=new Map;const s=this.factory.wrap(t.root).getOuterBBox();return this.nodeMap=null,s}getLinebreakWidth(){const t=this.math.metrics.containerWidth/this.pxPerEm,e=this.math.root.attributes.get("maxwidth")||this.options.linebreaks.width;this.containerWidth=Eo(e,t,1,this.pxPerEm)}markInlineBreaks(t){if(!t)return;const e=this.forceInlineBreaks;let s=!1,i=!1,r="";for(const n of t.childNodes)if(r)i=this.markInlineBreak(i,e,r,t,n),r="",s=!1;else if(n.isEmbellished){if(n===t.childNodes[0])continue;const o=n.coreMO(),a=o.texClass,l=o.attributes.get("linebreak"),c=o.attributes.get("linebreakstyle");(a===fr.BIN||a===fr.REL||a===fr.ORD&&o.hasSpacingAttributes()||"auto"!==l)&&"nobreak"!==l&&("before"===c?s&&"auto"===l||(i=this.markInlineBreak(i,e,l,t,n,o)):r=l),s="newline"===l&&"after"===c}else if(n.isKind("mspace")){const r=n.attributes.get("linebreak");"nobreak"!==r&&n.canBreak&&(i=this.markInlineBreak(i,e,r,t,n)),s="newline"===r}else s=!1,n.isKind("mstyle")&&!n.attributes.get("style")&&!n.attributes.hasExplicit("mathbackground")||n.isKind("semantics")?(this.markInlineBreaks(n.childNodes[0]),n.getProperty("process-breaks")&&(n.setProperty("inline-breaks",!0),n.childNodes[0].setProperty("inline-breaks",!0),t.parent.setProperty("process-breaks","true"))):n.isKind("mrow")&&n.attributes.get("data-semantic-added")&&(this.markInlineBreaks(n),n.getProperty("process-breaks")&&(n.setProperty("inline-breaks",!0),t.parent.setProperty("process-breaks","true")))}markInlineBreak(t,e,s,i,r,n=null){return r.setProperty("breakable",!0),e&&"newline"!==s?(r.setProperty("forcebreak",!0),null==n||n.setProperty("forcebreak",!0)):(r.removeProperty("forcebreak"),null==n||n.removeProperty("forcebreak"),"newline"===s&&r.setProperty("newline",!0)),t||(i.setProperty("process-breaks",!0),i.parent.setProperty("process-breaks",!0),t=!0),t}unmarkInlineBreaks(t){if(t&&(t.removeProperty("forcebreak"),t.removeProperty("breakable"),t.coreMO().removeProperty("forcebreak"),t.getProperty("process-breaks"))){t.removeProperty("process-breaks");for(const e of t.childNodes)this.unmarkInlineBreaks(e)}}getMetrics(t){this.setDocument(t);const e=this.adaptor,s=this.getMetricMaps(t);for(const i of t.math){const t=e.parent(i.start.node);if(i.state(){const s=this.wrap(t);return s.bbox.pwidth&&(e.notParent||e.isKind("math"))&&(this.bbox.pwidth=vo.fullWidth),s})}wrap(t,e=null){const s=this.factory.wrap(t,e||this);return e&&e.childNodes.push(s),this.jax.nodeMap.set(t,s),s}getBBox(t=!0){if(this.bboxComputed)return this.bbox;const e=t?this.bbox:vo.zero();return this.computeBBox(e),this.bboxComputed=t,e}getOuterBBox(t=!0){var e;const s=this.getBBox(t);if(!this.styleData)return s;const i=this.styleData.padding,r=(null===(e=this.styleData.border)||void 0===e?void 0:e.width)||[0,0,0,0],n=this.styleData.margin||[0,0,0,0],o=s.copy();for(const[,t,e]of vo.boxSides)o[e]+=i[t]+r[t]+n[t];return o}getUnbrokenHD(){const t=this.breakCount+1;let e=0,s=0;for(let i=0;ie&&(e=t),r>s&&(s=r)}return[e,s]}computeBBox(t,e=!1){t.empty();for(const e of this.childNodes)t.append(e.getOuterBBox());t.clean(),this.fixesPWidth&&this.setChildPWidths(e)&&this.computeBBox(t,!0)}getLineBBox(t){if(!this.lineBBox[t]){const e=this.breakCount;if(e){const s=this.embellishedBBox(t)||this.computeLineBBox(t);this.lineBBox[t]=s,0===t&&(!this.node.isKind("mo")&&this.node.isEmbellished?s.originalL=this.getBBox().L:s.L=this.getBBox().L),t===e&&(s.R=this.getBBox().R)}else{const e=this.getOuterBBox();this.lineBBox[t]=jc.from(e,this.linebreakOptions.lineleading)}}return this.lineBBox[t]}embellishedBBox(t){if(!this.node.isEmbellished||this.node.isKind("mo"))return null;const e=this.coreMO();return e.moLineBBox(t,e.embellishedBreakStyle,this.getOuterBBox())}computeLineBBox(t){return this.getChildLineBBox(this.childNodes[0],t)}getBreakNode(t){var e,s;if(!t.start)return[this,null];const[i,r]=t.start;if(this.node.isEmbellished)return[this,this.coreMO()];const n=(null===(s=null===(e=this.childNodes[0])||void 0===e?void 0:e.node)||void 0===s?void 0:s.isInferred)||this.node.isKind("semantics")?this.childNodes[0].childNodes:this.childNodes;return this.node.isToken||!n[i]?[this,null]:n[i].getBreakNode(n[i].getLineBBox(r))}getChildLineBBox(t,e){const s=this.breakCount;let i=t.getLineBBox(e);return(this.styleData||this.bbox.L||this.bbox.R)&&(i=i.copy()),this.addMiddleBorders(i),0===e?(i.L+=this.bbox.L,this.addLeftBorders(i)):e===s&&(i.R+=this.bbox.R,this.addRightBorders(i)),i}sideStyleSize(t){var e;const s=this.styleData.border,i=this.styleData.padding,r=this.styleData.margin;return((null===(e=null==s?void 0:s.width)||void 0===e?void 0:e[t])||0)+((null==i?void 0:i[t])||0)+((null==r?void 0:r[t])||0)}addLeftBorders(t){this.styleData&&(t.w+=this.sideStyleSize(3))}addMiddleBorders(t){this.styleData&&(t.h+=this.sideStyleSize(0),t.d+=this.sideStyleSize(2))}addRightBorders(t){this.styleData&&(t.w+=this.sideStyleSize(1))}setChildPWidths(t,e=null,s=!0){if(t)return!1;s&&(this.bbox.pwidth="");let i=!1;for(const r of this.childNodes){const n=r.getBBox();n.pwidth&&r.setChildPWidths(t,null===e?n.w:e,s)&&(i=!0)}return i}breakToWidth(t){}invalidateBBox(t=!0){(this.bboxComputed||this._breakCount>=0)&&(this.bboxComputed=!1,this.lineBBox=[],this._breakCount=-1,this.parent&&t&&this.parent.invalidateBBox())}copySkewIC(t){var e,s,i;const r=this.childNodes[0];(null===(e=null==r?void 0:r.bbox)||void 0===e?void 0:e.sk)&&(t.sk=r.bbox.sk),(null===(s=null==r?void 0:r.bbox)||void 0===s?void 0:s.dx)&&(t.dx=r.bbox.dx);const n=this.childNodes[this.childNodes.length-1];(null===(i=null==n?void 0:n.bbox)||void 0===i?void 0:i.ic)&&(t.ic=n.bbox.ic,t.w+=t.ic)}getStyles(){const t=this.node.attributes.getExplicit("style");if(!t)return;const e=this.styles=new qo(t);for(let t=0,s=Kc.removeStyles.length;t600?"bold":"normal"),s.family?e=this.explicitVariant(s.family,s.weight,s.style):(this.node.getProperty("variantForm")&&(e="-tex-variant"),e=(Kc.BOLDVARIANTS[s.weight]||{})[e]||e,e=(Kc.ITALICVARIANTS[s.style]||{})[e]||e)}this.variant=e}explicitVariant(t,e,s){let i=this.styles;return i||(i=this.styles=new qo),i.set("fontFamily",t),e&&i.set("fontWeight",e),s&&i.set("fontStyle",s),"-explicitFont"}getScale(){let t=1;const e=this.parent,s=e?e.bbox.scale:1,i=this.node.attributes,r=Math.min(i.get("scriptlevel"),2);let n=i.get("fontsize"),o=this.node.isToken||this.node.isKind("mstyle")?i.get("mathsize"):i.getInherited("mathsize");if(0!==r&&(t=Math.pow(i.get("scriptsizemultiplier"),r)),this.removedStyles&&this.removedStyles.fontSize&&!n&&(n=this.removedStyles.fontSize),n&&!i.hasExplicit("mathsize")&&(o=n),"1"!==o&&(t*=this.length2em(o,1,1)),0!==r){const e=this.length2em(i.get("scriptminsize"),.4,1);t0;if(this.bbox.L=n.isSet("lspace")?Math.max(0,this.length2em(n.get("lspace"))):Gc(o,r,t.lspace),this.bbox.R=n.isSet("rspace")?Math.max(0,this.length2em(n.get("rspace"))):Gc(o,r,t.rspace),!i)return;const a=s.childNodes[i-1];if(!a.isEmbellished)return;const l=this.jax.nodeMap.get(a).getBBox();l.R&&(this.bbox.L=Math.max(0,this.bbox.L-l.R))}getTeXSpacing(t,e){if(!e){const t=this.node.texSpacing();t&&(this.bbox.L=this.length2em(t))}if(t||e){const t=this.node.coreMO().attributes;t.isSet("lspace")&&(this.bbox.L=Math.max(0,this.length2em(t.get("lspace")))),t.isSet("rspace")&&(this.bbox.R=Math.max(0,this.length2em(t.get("rspace"))))}}isTopEmbellished(){return this.node.isEmbellished&&!(this.node.parent&&this.node.parent.isEmbellished)}core(){return this.jax.nodeMap.get(this.node.core())}coreMO(){return this.jax.nodeMap.get(this.node.coreMO())}coreRScale(){let t=this.bbox.rscale,e=this.coreMO();for(;e!==this&&e;)t*=e.bbox.rscale,e=e.parent;return t}getRScale(){let t=1,e=this;for(;e;)t*=e.bbox.rscale,e=e.parent;return t}getText(){let t="";if(this.node.isToken)for(const e of this.node.childNodes)e instanceof Lr&&(t+=e.getText());return t}canStretch(t){if(this.stretch=Pc,this.node.isEmbellished){const e=this.core();e&&e.node!==this.node&&e.canStretch(t)&&(this.stretch=e.stretch)}return this.stretch.dir!==Mc.None}getAlignShift(){let{indentalign:t,indentshift:e,indentalignfirst:s,indentshiftfirst:i}=this.node.attributes.getAllAttributes();return"indentalign"!==s&&(t=s),"indentshift"!==i&&(e=i),this.processIndent(t,e)}processIndent(t,e,s="",i="",r=this.metrics.containerWidth){if(!this.jax.math.display)return["left",0];s&&"auto"!==s||(s=this.jax.math.root.getProperty("inlineMarked")?"left":this.jax.options.displayAlign),i&&"auto"!==i||(i=this.jax.math.root.getProperty("inlineMarked")?"0":this.jax.options.displayIndent),"auto"===t&&(t=s),"auto"===e&&(e=i,"right"!==t||e.match(/^\s*0[a-z]*\s*$/)||(e=("-"+e.trim()).replace(/^--/,"")));return[t,this.length2em(e,r)]}getAlignX(t,e,s){return"right"===s?t-(e.w+e.R)*e.rscale:"left"===s?e.L*e.rscale:(t-e.w*e.rscale)/2}getAlignY(t,e,s,i,r){return"top"===r?t-s:"bottom"===r?i-e:"center"===r?(t-s-(e-i))/2:0}getWrapWidth(t){return this.childNodes[t].getBBox().w}getChildAlign(t){return"left"}percent(t){return xo(t)}em(t){return yo(t)}px(t,e=-mo){return No(t,e,this.metrics.em)}length2em(t,e=1,s=null){null===s&&(s=this.bbox.scale);const i=this.font.params.rule_thickness,r=Hi(t,{medium:1,thin:2/3,thick:5/3},0);return r?r*i:Eo(t,e,s,this.jax.pxPerEm)}unicodeChars(t,e=this.variant){let s=_r(t);const i=this.font.getVariant(e);if(i&&i.chars){const t=i.chars;s=s.map(e=>{var s,i;return(null===(i=null===(s=t[e])||void 0===s?void 0:s[3])||void 0===i?void 0:i.smp)||e})}return s}remapChars(t){return t}mmlText(t){return this.node.factory.create("text").setText(t)}mmlNode(t,e={},s=[]){return this.node.factory.create(t,e,s)}createMo(t){const e=this.node.factory,s=e.create("text").setText(t),i=e.create("mo",{stretchy:!0},[s]);i.inheritAttributesFrom(this.node),i.parent=this.node.parent;const r=this.wrap(i);return r.parent=this,r}getVariantChar(t,e){const s=this.font.getChar(t,e)||[0,0,0,{unknown:!0}];return 3===s.length&&(s[3]={}),s}html(t,e={},s=[]){return this.jax.html(t,e,s)}}Kc.kind="unknown",Kc.styles={},Kc.removeStyles=["fontSize","fontFamily","fontWeight","fontStyle","fontVariant","font"],Kc.skipAttributes={fontfamily:!0,fontsize:!0,fontweight:!0,fontstyle:!0,color:!0,background:!0,class:!0,href:!0,style:!0,xmlns:!0},Kc.BOLDVARIANTS={bold:{normal:"bold",italic:"bold-italic",fraktur:"bold-fraktur",script:"bold-script","sans-serif":"bold-sans-serif","sans-serif-italic":"sans-serif-bold-italic"},normal:{bold:"normal","bold-italic":"italic","bold-fraktur":"fraktur","bold-script":"script","bold-sans-serif":"sans-serif","sans-serif-bold-italic":"sans-serif-italic"}},Kc.ITALICVARIANTS={italic:{normal:"italic",bold:"bold-italic","sans-serif":"sans-serif-italic","bold-sans-serif":"sans-serif-bold-italic"},normal:{italic:"normal","bold-italic":"bold","sans-serif-italic":"sans-serif","sans-serif-bold-italic":"bold-sans-serif"}};const $c={"70.7%":"s","70%":"s","50%":"ss","60%":"Tn","85%":"sm","120%":"lg","144%":"Lg","173%":"LG","207%":"hg","249%":"HG"};class Yc extends Kc{toCHTML(t){this.toEmbellishedCHTML(t)||this.addChildren(this.standardChtmlNodes(t))}toEmbellishedCHTML(t){if(t.length<=1||!this.node.isEmbellished)return!1;const e=this.adaptor;t.forEach(t=>e.append(t,this.html("mjx-linestrut")));const s=this.coreMO().embellishedBreakStyle,i=[];for(const[r,n]of[[t[0],"before"],[t[1],"after"]])s!==n?(this.toCHTML([r]),i.push(this.dom[0]),"after"===n&&e.removeAttribute(this.dom[0],"space")):i.push(this.createChtmlNodes([r])[0]);return this.dom=i,!0}addChildren(t){for(const e of this.childNodes)e.toCHTML(t)}standardChtmlNodes(t){this.markUsed();const e=this.createChtmlNodes(t);return this.handleStyles(),this.handleScale(),this.handleBorders(),this.handleColor(),this.handleSpace(),this.handleAttributes(),this.handlePWidth(),e}markUsed(){this.jax.wrapperUsage.add(this.kind)}createChtmlNodes(t){this.dom=t.map(t=>this.html("mjx-"+this.node.kind)),t=this.handleHref(t);for(const e of t.keys())this.adaptor.append(t[e],this.dom[e]);return this.dom}handleHref(t){const e=this.node.attributes.get("href");return e?t.map(t=>this.adaptor.append(t,this.html("a",{href:e}))):t}handleStyles(){if(!this.styles)return;const t=this.styles.cssText;if(t){const e=this.adaptor;this.dom.forEach(s=>e.setAttribute(s,"style",t));const s=this.styles.get("font-family");s&&this.dom.forEach(t=>e.setStyle(t,"font-family",this.font.cssFamilyPrefix+", "+s))}}handleScale(){this.dom.forEach(t=>this.setScale(t,this.bbox.rscale))}setScale(t,e){const s=Math.abs(e-1)<.001?1:e;if(t&&1!==s){const e=this.percent(s);$c[e]?this.adaptor.setAttribute(t,"size",$c[e]):this.adaptor.setStyle(t,"fontSize",e)}return t}handleSpace(){const t=this.adaptor,e=!!this.node.getProperty("breakable")&&!this.node.getProperty("newline"),s=this.dom.length-1;for(const i of[[this.getLineBBox(0).L,"space","marginLeft",0],[this.getLineBBox(s).R,"rspace","marginRight",s]]){const[s,r,n,o]=i,a=this.em(s);if(e&&"space"===r){const e=t.node("mjx-break",Jc[a]?{size:Jc[a]}:{style:`letter-spacing: ${this.em(s-1)}`},[t.text(" ")]);t.insert(e,this.dom[o])}else s&&(Jc[a]?t.setAttribute(this.dom[o],r,Jc[a]):t.setStyle(this.dom[o],n,a))}}handleBorders(){var t,e;const s=null===(t=this.styleData)||void 0===t?void 0:t.border,i=null===(e=this.styleData)||void 0===e?void 0:e.padding,r=this.dom.length-1;if(!s||!r)return;const n=this.adaptor;for(const t of this.dom.keys()){const e=this.dom[t];t&&(s.width[3]&&n.setStyle(e,"border-left"," none"),i[3]&&n.setStyle(e,"padding-left","0")),t!==r&&(s.width[1]&&n.setStyle(e,"border-right","none"),i[1]&&n.setStyle(e,"padding-right","0"))}}handleColor(){var t;const e=this.adaptor,s=this.node.attributes,i=s.getExplicit("mathcolor")||s.getExplicit("color"),r=s.getExplicit("mathbackground")||s.getExplicit("background")||(null===(t=this.styles)||void 0===t?void 0:t.get("background-color"));i&&this.dom.forEach(t=>e.setStyle(t,"color",i)),r&&this.dom.forEach(t=>e.setStyle(t,"backgroundColor",r))}handleAttributes(){const t=this.adaptor,e=this.node.attributes,s=e.getAllDefaults(),i=Yc.skipAttributes;for(const r of e.getExplicitNames())if(!1===i[r]||!(r in s)&&!i[r]&&!t.hasAttribute(this.dom[0],r)){const s=e.getExplicit(r);this.dom.forEach(e=>t.setAttribute(e,r,s))}if(e.get("class")){const s=e.get("class").trim().split(/ +/);for(const e of s)this.dom.forEach(s=>t.addClass(s,e))}this.node.getProperty("inline-breaks")&&this.dom.forEach(e=>t.setAttribute(e,"inline-breaks","true"))}handlePWidth(){if(this.bbox.pwidth){const t=this.adaptor;this.bbox.pwidth===vo.fullWidth?this.dom.forEach(e=>t.setAttribute(e,"width","full")):this.dom.forEach(e=>t.setStyle(e,"width",this.bbox.pwidth))}}setIndent(t,e,s){const i=this.adaptor;if("center"===e||"left"===e){const e=this.getBBox().L;s+e&&i.setStyle(t,"margin-left",this.em(s+e))}if("center"===e||"right"===e){const e=this.getBBox().R;s+e&&i.setStyle(t,"margin-right",this.em(-s+e))}}drawBBox(){const{w:t,h:e,d:s,R:i}=this.getOuterBBox(),r=this.html("mjx-box",{style:{opacity:.25,"margin-left":this.em(-t-i)}},[this.html("mjx-box",{style:{height:this.em(e),width:this.em(t),"background-color":"red"}}),this.html("mjx-box",{style:{height:this.em(s),width:this.em(t),"margin-left":this.em(-t),"vertical-align":this.em(-s),"background-color":"green"}})]),n=this.dom[0]||this.parent.dom[0],o=this.adaptor.getAttribute(n,"size");o&&this.adaptor.setAttribute(r,"size",o);const a=this.adaptor.getStyle(n,"fontSize");a&&this.adaptor.setStyle(r,"fontSize",a),this.adaptor.append(this.adaptor.parent(n),r),this.adaptor.setStyle(n,"backgroundColor","#FFEE00")}html(t,e={},s=[]){return this.jax.html(t,e,s)}text(t){return this.jax.text(t)}char(t){return this.font.charSelector(t).substring(1)}}function Qc(t){return class extends t{getWrapWidth(t){return this.parent?this.getBBox().w:this.metrics.containerWidth/this.jax.pxPerEm}computeBBox(t,e=!1){super.computeBBox(t,e);const s=this.node.attributes;if(!this.parent&&this.jax.math.display&&"linebreak"===s.get("overflow")){const e=this.containerWidth;t.w>e&&this.childNodes[0].breakToWidth(e),t.updateFrom(this.childNodes[0].getBBox())}}}}Yc.kind="unknown",Yc.autoStyle=!0;const Zc=function(){var t;const e=Qc(Yc);return(t=class extends e{handleDisplay(t){const e=this.adaptor,[s,i]=this.getAlignShift();if("center"!==s&&e.setAttribute(t,"justify",s),this.bbox.pwidth===vo.fullWidth){if(e.setAttribute(t,"width","full"),this.jax.table){let{L:r,w:n,R:o}=this.jax.table.getOuterBBox();"right"===s?o=Math.max(o||-i,-i):"left"===s?r=Math.max(r||i,i):"center"===s&&(n+=2*Math.abs(i));const a=this.em(Math.max(0,r+n+o));e.setStyle(t,"min-width",a),e.setStyle(this.jax.table.dom[0],"min-width",a)}}else this.setIndent(this.dom[0],s,i)}handleInline(t){const e=this.adaptor,s=e.getStyle(this.dom[0],"margin-right");s&&(e.setStyle(this.dom[0],"margin-right",""),e.setStyle(t,"margin-right",s),e.setStyle(t,"width","0"))}toCHTML(t){super.toCHTML(t);const e=this.adaptor;"block"===this.node.attributes.get("display")?(e.setAttribute(this.dom[0],"display","true"),e.setAttribute(t[0],"display","true"),this.handleDisplay(t[0])):this.handleInline(t[0]),e.addClass(this.dom[0],`${this.font.cssFontPrefix}-N`)}setChildPWidths(t,e=null,s=!0){return!!this.parent&&super.setChildPWidths(t,e,s)}handleAttributes(){super.handleAttributes();const t=this.adaptor;this.node.getProperty("process-breaks")&&this.dom.forEach(e=>t.setAttribute(e,"breakable","true"))}}).kind=Rr.prototype.kind,t.styles={"mjx-math":{"line-height":0,"text-align":"left","text-indent":0,"font-style":"normal","font-weight":"normal","font-size":"100%","font-size-adjust":"none","letter-spacing":"normal","word-wrap":"normal","word-spacing":"normal",direction:"ltr",padding:"1px 0"},'mjx-container[jax="CHTML"][display="true"] mjx-math':{padding:0},"mjx-math[breakable]":{display:"inline"},'mjx-container[jax="CHTML"] mjx-break':{"white-space":"normal","line-height":"0","clip-path":"rect(0 0 0 0)","font-family":"MJX-BRK !important"},'mjx-break[size="0"]':{"letter-spacing":"-0.999em"},'mjx-break[size="1"]':{"letter-spacing":"-0.889em"},'mjx-break[size="2"]':{"letter-spacing":"-0.833em"},'mjx-break[size="3"]':{"letter-spacing":"-0.778em"},'mjx-break[size="4"]':{"letter-spacing":"-0.722em"},'mjx-break[size="5"]':{"letter-spacing":"-0.667em"}},t}();function th(t){return class extends t{computeBBox(t,e=!1){super.computeBBox(t),this.copySkewIC(t)}}}const eh=function(){var t;const e=th(Yc);return(t=class extends e{}).kind=Mr.prototype.kind,t}();class sh{constructor(){this.used=new Set,this.needsUpdate=[]}add(t){const e=JSON.stringify(t);this.used.has(e)||this.needsUpdate.push(t),this.used.add(e)}has(t){return this.used.has(JSON.stringify(t))}clear(){this.used.clear(),this.needsUpdate=[]}update(){const t=this.needsUpdate;return this.needsUpdate=[],t}}class ih extends Fc{constructor(){super(...arguments),this.charUsage=new sh,this.delimUsage=new sh,this.fontUsage={},this.newFonts=0}static charOptions(t,e){return super.charOptions(t,e)}static addFontURLs(t,e,s){for(const i of Object.keys(e)){const r=Object.assign({},e[i]);r.src=r.src.replace(/%%URL%%/,s),t[i]=r}}static addDynamicFontCss(t,e,s){const i={};for(const s of e){const e=s.slice(4);i[`@font-face /* ${e} */`]={"font-family":s,src:`url("%%URL%%/${s.toLowerCase()}.woff2") format("woff2")`},t[`.${e}`]={"font-family":`${this.defaultCssFamilyPrefix}, ${s}`}}this.addFontURLs(t,i,s)}static addExtension(t,e=""){super.addExtension(t,e),t.fonts&&this.addDynamicFontCss(this.defaultStyles,t.fonts,t.fontURL)}addExtension(t,e=""){if(super.addExtension(t,e),!t.fonts||!this.options.adaptiveCSS)return[];const s={},i=new ao;return this.constructor.addDynamicFontCss(s,t.fonts,t.fontURL),i.addStyles(s),i.getStyleRules()}adaptiveCSS(t){this.options.adaptiveCSS=t}clearCache(){this.options.adaptiveCSS&&(this.charUsage.clear(),this.delimUsage.clear())}createVariant(t,e=null,s=null){super.createVariant(t,e,s),this.variant[t].letter=this.constructor.defaultVariantLetters[t]}defineChars(t,e){super.defineChars(t,e);const s=this.variant[t].letter,i=this.constructor;for(const t of Object.keys(e)){const r=parseInt(t);if(!Array.isArray(e[r]))continue;const n=i.charOptions(e,r);void 0===n.f&&(n.f=s);for(const[t,e]of i.combiningChars)if(r>=t&&r<=e){n.cmb=!0;break}}}addDynamicFontCss(t,e=this.options.fontURL){this.constructor.addDynamicFontCss(this.fontUsage,t,e)}updateDynamicStyles(){const t=this.fontUsage;return this.fontUsage={},this.options.adaptiveCSS||this.updateStyles(t),t}get styles(){const t=this.constructor,e=Object.assign(Object.assign({},t.defaultStyles),this.fontUsage);return this.fontUsage={},t.addFontURLs(e,t.defaultFonts,this.options.fontURL),this.options.adaptiveCSS?this.updateStyles(e):this.allStyles(e),e}updateStyles(t){for(const e of this.delimUsage.update())this.addDelimiterStyles(t,e,this.getDelimiter(e));for(const[e,s]of this.charUsage.update()){const i=this.variant[e];this.addCharStyles(t,i.letter,s,i.chars[s])}return t}allStyles(t){var e;for(const e of Object.keys(this.delimiters)){const s=parseInt(e);this.addDelimiterStyles(t,s,this.delimiters[s])}for(const s of Object.keys(this.variant)){const i=this.variant[s],r=i.letter;for(const s of Object.keys(i.chars)){const n=parseInt(s),o=i.chars[n];!(null===(e=null==o?void 0:o[3])||void 0===e?void 0:e.smp)&&Array.isArray(o)&&(o.length<4&&(o[3]={}),this.addCharStyles(t,r,n,o))}}}addDelimiterStyles(t,e,s){if(!s.stretch)return;const i=s.c&&s.c!==e?this.charSelector(s.c):this.charSelector(e);s.dir===Mc.Vertical?this.addDelimiterVStyles(t,e,i,s):this.addDelimiterHStyles(t,e,i,s)}addDelimiterVStyles(t,e,s,i){const r=i.HDW,[n,o,a,l]=i.stretch,[c,h,d,u]=this.getStretchVariants(e),p=this.addDelimiterVPart(t,s,"beg",n,c,r);this.addDelimiterVPart(t,s,"ext",o,h,r);const m=this.addDelimiterVPart(t,s,"end",a,d,r);if(l){const e=this.addDelimiterVPart(t,s,"mid",l,u,r),i=this.em(e/2-.03);t[`mjx-stretchy-v${s} > mjx-ext:first-of-type`]={height:"50%","border-width":`${this.em1(p-.03)} 0 ${i}`},t[`mjx-stretchy-v${s} > mjx-ext:last-of-type`]={height:"50%","border-width":`${i} 0 ${this.em1(m-.03)}`}}else(m||p)&&(t[`mjx-stretchy-v${s} > mjx-ext`]["border-width"]=`${this.em1(p-.03)} 0 ${this.em1(m-.03)}`)}addDelimiterVPart(t,e,s,i,r,n){if(!i)return 0;let o=0;const[a,l,c]=this.getChar(r,i),h={width:this.em0(c)};if("ext"!==s){const t=c>n[2]?this.em((n[2]-c)/2):"auto",e="beg"===s?a:"end"===s?-l:(a-l)/2;h.margin=`${this.em(e)} ${t} ${this.em(-e)}`}else{o=Oc;const s=Math.max(Oc,a+l-Oc);h["line-height"]=this.em0(s);const i=a-s/2-Oc;i&&(t[`mjx-stretchy-v${e} > mjx-ext > mjx-spacer`]={"margin-top":this.em(i)})}return t[`mjx-stretchy-v${e} > mjx-${s}`]=h,Math.max(0,a+l-o)}addDelimiterHStyles(t,e,s,i){const r=[...i.HDW],[n,o,a,l]=i.stretch,[c,h,d,u]=this.getStretchVariants(e);if(i.hd&&!this.options.mathmlSpacing){const t=this.params.extender_factor;r[0]=r[0]*(1-t)+i.hd[0]*t,r[1]=r[1]*(1-t)+i.hd[1]*t}const p=this.addDelimiterHPart(t,s,"beg",n,c,r);this.addDelimiterHPart(t,s,"ext",o,h,r);const m=this.addDelimiterHPart(t,s,"end",a,d,r);if(l){const e=this.addDelimiterHPart(t,s,"mid",l,u,r),i=this.em0(e/2-.03);t[`mjx-stretchy-h${s} > mjx-ext:first-of-type`]={width:"50%","border-width":`0 ${i} 0 ${this.em0(p-.03)}`},t[`mjx-stretchy-h${s} > mjx-ext:last-of-type`]={width:"50%","border-width":`0 ${this.em0(m-.03)} 0 ${i}`}}else(p||m)&&(t[`mjx-stretchy-h${s} > mjx-ext`]["border-width"]=`0 ${this.em0(m-.06)} 0 ${this.em0(p-.06)}`);i.ext&&(t[`mjx-stretchy-h${s} > mjx-ext > mjx-spacer`]["letter-spacing"]=this.em(-i.ext-Dc))}addDelimiterHPart(t,e,s,i,r,n){if(!i)return 0;let[,,o,a]=this.getChar(r,i);const l={padding:this.padding(n,o-n[2])};if("ext"===s){const i=l.padding.split(/ /);i[1]=i[3]="0",l.padding=i.join(" "),!o&&a.dx&&(o=2*a.dx-.06),t[`mjx-stretchy-h${e} > mjx-${s} > mjx-spacer`]={"margin-left":this.em(-o/2)},a.cmb&&(t[`mjx-stretchy-h${e} > mjx-${s} > mjx-c`]={width:this.em(o),"text-align":"right"})}else"mid"===s?l.margin=`0 ${this.em(-o/2)}`:l["end"==s?"margin-left":"margin-right"]=this.em(-o),this.checkCombiningChar(a,l);return t[`mjx-stretchy-h${e} > mjx-${s}`]=l,o}addCharStyles(t,e,s,i){const r=i[3],n=void 0!==r.f?r.f:e,o=r.ff||(n?`${this.cssFontPrefix}-${n}`:""),a="mjx-c"+this.charSelector(s)+(o?"."+o:""),l=r.oc||r.ic||0,c={padding:this.padding(i,l)};r.oc&&(t[a+"[noic]"]={"padding-right":this.em(i[2])}),this.checkCombiningChar(r,c),t[a+(c["margin-left"]&&!o?`:not([class*="${this.cssFontPrefix}-"])`:"")]=c}checkCombiningChar(t,e){if(!t.cmb)return;const s=e.padding.split(/ /);e.width=s[1],s[1]="0",s[3]||s.pop(),e.padding=s.join(" "),"0"===e.width&&t.dx&&(e.width=this.em(2*t.dx),e["margin-left"]="-"+e.width)}em(t){return yo(t)}em0(t){return yo(Math.max(0,t))}em1(t){const e=yo(Math.max(0,t));return"0"===e?".1px":e}padding([t,e,s],i=0){return[t,s+i,e,0].map(this.em0).join(" ")}charSelector(t){return".mjx-c"+t.toString(16).toUpperCase()}}function rh(t,e){for(const s of Object.keys(e)){const i=parseInt(s),r=e[i];r.c&&(r.c=r.c.replace(/\\[0-9A-F]+/gi,t=>String.fromCodePoint(parseInt(t.substring(1),16)))),Object.assign(Fc.charOptions(t,i),r)}return t}function nh(t){return class extends t{get breakCount(){return this.breakStyle?1:0}get embellishedBreakCount(){return this.embellishedBreakStyle?1:0}get embellishedBreakStyle(){return this.breakStyle||this.getBreakStyle()}protoBBox(t){const e=this.stretch.dir!==Mc.None;e&&null===this.size&&this.getStretchedVariant([0]),e&&this.size<0||(super.computeBBox(t),0!==t.w||!this.node.attributes.hasExplicit("fence")||""!==this.node.getText()||this.node.texClass!==fr.OPEN&&this.node.texClass!==fr.CLOSE||this.jax.options.mathmlSpacing||(t.R=this.font.params.nulldelimiterspace),this.copySkewIC(t))}getAccentOffset(){const t=vo.empty();return this.protoBBox(t),-t.w/2}getCenterOffset(t=null){return t||(t=vo.empty(),super.computeBBox(t)),(t.h+t.d)/2+this.font.params.axis_height-t.h}getStretchedVariant(t,e=!1){if(this.stretch.dir===Mc.None)return;let s=this.getWH(t);const i=this.getSize("minsize",0),r=this.getSize("maxsize",1/0),n=this.node.getProperty("mathaccent");s=Math.max(i,Math.min(r,s));const o=this.font.params.delimiterfactor/1e3,a=this.font.params.delimitershortfall,l=i||e?s:n?Math.min(s/o,s+a):Math.max(s*o,s-a),c=this.getText().codePointAt(0);let h=this.stretch;this.size&&(this.stretch=h=this.font.getDelimiter(c),this.size=null);const d=h.c||c;let u=0;if(h.sizes)for(const t of h.sizes){if(t>=l)return n&&u&&u--,void this.setDelimSize(d,u);u++}h.stretch?(this.size=-1,this.invalidateBBox(),this.getStretchBBox(t,this.checkExtendedHeight(s,h),h)):this.setDelimSize(d,u-1)}setDelimSize(t,e){const s=this.stretch;this.variant=this.font.getSizeVariant(t,e),this.size=e;const i=s.schar&&s.schar[Math.min(e,s.schar.length-1)]||t;this.stretch=Object.assign(Object.assign({},s),{c:i}),this.childNodes[0].invalidateBBox()}getSize(t,e){const s=this.node.attributes;return s.isSet(t)&&(e=this.length2em(s.get(t),1,1)),e}getWH(t){if(0===t.length)return 0;if(1===t.length)return t[0];const[e,s]=t,i=this.font.params.axis_height;return this.node.attributes.get("symmetric")?2*Math.max(e-i,s+i):e+s}getStretchBBox(t,e,s){Object.hasOwn(s,"min")&&s.min>e&&(e=s.min);let[i,r,n]=s.HDW;if(this.stretch.dir===Mc.Vertical)[i,r]=this.getBaseline(t,e,s);else if(n=e,this.stretch.hd&&!this.jax.options.mathmlSpacing){const t=this.font.params.extender_factor;i=i*(1-t)+this.stretch.hd[0]*t,r=r*(1-t)+this.stretch.hd[1]*t}this.bbox.h=i,this.bbox.d=r,this.bbox.w=n}getBaseline(t,e,s){const i=2===t.length&&t[0]+t[1]===e,r=this.node.attributes.get("symmetric"),[n,o]=i?t:[e,0];let[a,l]=[n+o,0];if(r){const t=this.font.params.axis_height;i&&(a=2*Math.max(n-t,o+t)),l=a/2-t}else if(i)l=o;else{const[t,e]=s.HDW||[.75,.25];l=e*(a/(t+e))}return[a-l,l]}checkExtendedHeight(t,e){if(e.fullExt){const[s,i]=e.fullExt;t=i+Math.ceil(Math.max(0,t-i)/s)*s}return t}setBreakStyle(t=""){var e;if(this.breakStyle=(null===(e=this.node.parent)||void 0===e?void 0:e.isEmbellished)&&!t?"":this.getBreakStyle(t),this.breakCount&&this.multChar){const t=this.parent.node.childIndex(this.node),e=this.parent.node.childNodes[t+1];e&&e.setTeXclass(this.multChar.node)}}getBreakStyle(t=""){const e=this.node.attributes;let s=t||("newline"===e.get("linebreak")||this.node.getProperty("forcebreak")?e.get("linebreakstyle"):"");return"infixlinebreakstyle"===s&&(s=e.get(s)),s}getMultChar(){const t=this.node.attributes.get("linebreakmultchar");t&&"\u2062"===this.getText()&&"\u2062"!==t&&(this.multChar=this.createMo(t))}constructor(t,e,s=null){super(t,e,s),this.size=null,this.isAccent=this.node.isAccent,this.getMultChar(),this.setBreakStyle()}computeBBox(t,e=!1){if(this.protoBBox(t),this.node.attributes.get("symmetric")&&this.stretch.dir!==Mc.Horizontal){const e=this.getCenterOffset(t);t.h+=e,t.d-=e}this.node.getProperty("mathaccent")&&(this.stretch.dir===Mc.None||this.size>=0)&&(t.w=0)}computeLineBBox(t){return this.moLineBBox(t,this.breakStyle)}moLineBBox(t,e,s=null){const i=this.node.attributes.get("lineleading"),r=this.length2em(i,this.linebreakOptions.lineleading);if(0===t&&"before"===e){const t=jc.from(vo.zero(),r);return t.originalL=this.bbox.L,this.bbox.L=0,t}let n=jc.from(s||this.getOuterBBox(),r);return 1===t&&("after"===e?(n.w=n.h=n.d=0,n.isFirst=!0,this.bbox.R=0):"duplicate"===e?n.L=0:this.multChar&&(n=jc.from(this.multChar.getOuterBBox(),r)),n.getIndentData(this.node)),n}canStretch(t){if(this.stretch.dir!==Mc.None)return this.stretch.dir===t;if(!this.node.attributes.get("stretchy"))return!1;const e=this.getText();if(1!==Array.from(e).length)return!1;const s=this.font.getDelimiter(e.codePointAt(0));return this.stretch=s&&s.dir===t?s:Pc,this.stretch.dir!==Mc.None}getVariant(){this.node.attributes.get("largeop")?this.variant=this.node.attributes.get("displaystyle")?"-largeop":"-smallop":this.node.attributes.hasExplicit("mathvariant")||!1!==this.node.getProperty("pseudoscript")?super.getVariant():this.variant="-tex-variant"}remapChars(t){const e=this.node.getProperty("primes");if(e)return _r(e);if(1===t.length){const e=this.node.coreParent().parent,s=this.isAccent&&!e.isKind("mrow")?"accent":"mo",i=this.font.getRemappedChar(s,t[0]);i&&(t=this.unicodeChars(i,this.variant))}return t}}}ih.OPTIONS=Object.assign(Object.assign({},Fc.OPTIONS),{dynamicPrefix:"./chtml/dynamic",fontURL:"./chtml/woff2"}),ih.JAX="CHTML",ih.defaultVariantLetters={},ih.defaultStyles={},ih.defaultFonts={},ih.combiningChars=[[768,879],[8400,8447]];const oh=function(){var t;const e=nh(Yc);return t=class extends e{toCHTML(t){const e=this.adaptor,s=this.node.attributes,i=s.get("symmetric")&&this.stretch.dir!==Mc.Horizontal,r=this.stretch.dir!==Mc.None;r&&null===this.size&&this.getStretchedVariant([]),t.length>1&&t.forEach(t=>e.append(t,this.html("mjx-linestrut")));const n=this.standardChtmlNodes(t);if(n.length>1&&"duplicate"!==this.breakStyle){const t="after"===this.breakStyle?1:0;e.remove(n[t]),n[t]=null}if(r&&this.size<0)this.stretchHTML(n);else{if(i||s.get("largeop")){const t=this.em(this.getCenterOffset());"0"!==t&&n.forEach(s=>s&&e.setStyle(s,"verticalAlign",t))}this.node.getProperty("mathaccent")&&n.forEach(t=>{e.setStyle(t,"width","0"),e.setStyle(t,"margin-left",this.em(this.getAccentOffset()))}),n[0]&&this.addChildren([n[0]]),n[1]&&(this.multChar||this).addChildren([n[1]])}}stretchHTML(t){const e=this.getText().codePointAt(0);this.font.delimUsage.add(e),this.childNodes[0].markUsed();const s=this.stretch,i=s.stretch,r=this.font.getStretchVariants(e),n=[],o=[];for(let t=0;tt?o?t[0]+t[1]:t[2]:0);l=Math.max(0,l-n);const[d,u]=t[3]?[(r-h)/2-a,(r-h)/2-c]:[r-a-c,0];this.createPart("mjx-beg",t[0],e[0],s[0],i),this.createPart("mjx-ext",t[1],e[1],s[1],i,d,l,o,a,h/2||c),t[3]&&(this.createPart("mjx-mid",t[3],e[3],s[3],i),this.createPart("mjx-ext",t[1],e[1],s[1],i,u,l,o,h/2,c)),this.createPart("mjx-end",t[2],e[2],s[2],i)}createPart(t,e,s,i,r,n=0,o=0,a="",l=0,c=0){if(s){const h=e[3],d=h.f||("normal"===i?"":this.font.getVariant(i).letter),u=h.ff||(d?`${this.font.cssFontPrefix}-${d}`:""),p=h.c||String.fromCodePoint(s);let m=[];if("mjx-ext"===t&&(o||h.dx)){if(n<0&&a)return void r.push(this.html(t,Object.assign(Object.assign({},u?{class:u}:{}),{style:{"border-width":`${this.em(l+n/2)} 0 ${this.em(c+n/2)}`,"clip-path":"none"}})));o||(o=Math.max(Dc,2*h.dx-Dc));const e=Math.min(Math.ceil(n/o)+1,500);if(h.cmb){m.push(this.html("mjx-spacer"));for(let t=0;t`mjx-stretchy-h > mjx-${t}`).join(", ")]:{display:"inline-block",width:0,"text-align":"right"},"mjx-stretchy-h > mjx-ext":{"clip-path":"padding-box polygon(0 -1em, 100% -1em, 100% calc(100% + 1em), 0 calc(100% + 1em))",width:"100%",border:"0px solid transparent","box-sizing":"border-box","text-align":"left"},"mjx-stretchy-v":{display:"inline-block","text-align":"center"},[["beg","ext","end","mid"].map(t=>`mjx-stretchy-v > mjx-${t}`).join(", ")]:{display:"block",height:0,margin:"0 auto"},"mjx-stretchy-v > mjx-ext > mjx-spacer":{display:"block"},"mjx-stretchy-v > mjx-ext":{"clip-path":"padding-box polygon(-1em 0, calc(100% + 1em) 0, calc(100% + 1em) 100%, -1em 100%)",height:"100%",border:"0.1px solid transparent","box-sizing":"border-box","white-space":"pre"},"mjx-mark":{display:"inline-block",height:0}},t}();function ah(t){return class extends t{remapChars(t){if(t.length){const e=this.font.getRemappedChar("mn",t[0]);if(e){const s=this.unicodeChars(e,this.variant);1===s.length?t[0]=s[0]:t=s.concat(t.slice(1))}}return t}}}const lh=function(){var t;const e=ah(Yc);return(t=class extends e{}).kind=Ir.prototype.kind,t}();function ch(t){return class extends t{createText(t){const e=this.wrap(this.mmlText(t));return e.parent=this,e}constructor(t,e,s=null){super(t,e,s);const i=this.node.attributes,r=i.getList("lquote","rquote");"monospace"!==this.variant&&(i.isSet("lquote")||'"'!==r.lquote||(r.lquote="\u201c"),i.isSet("rquote")||'"'!==r.rquote||(r.rquote="\u201d")),this.childNodes.unshift(this.createText(r.lquote)),this.childNodes.push(this.createText(r.rquote))}}}const hh=function(){var t;const e=ch(Yc);return(t=class extends e{}).kind=Jr.prototype.kind,t}();function dh(t){var e;return e=class extends t{constructor(){super(...arguments),this.breakPoints=[]}textWidth(t){let e=this.textNode;if(!e){const t=this.node.factory.create("text");t.parent=this.node,e=this.textNode=this.factory.wrap(t),e.parent=this}return e.node.setText(t),e.invalidateBBox(!1),e.getBBox().w}get breakCount(){return this.breakPoints.length}getVariant(){const t=this.jax.options,e=this.jax.math.outputData,s=(!!e.merrorFamily||!!t.merrorFont)&&this.node.Parent.isKind("merror");if(e.mtextFamily||t.mtextFont||s){const i=this.node.attributes.get("mathvariant"),r=this.constructor.INHERITFONTS[i]||this.jax.font.getCssFont(i),n=r[0]||(s?e.merrorFamily||t.merrorFont:e.mtextFamily||t.mtextFont);return void(this.variant=this.explicitVariant(n,r[2]?"bold":"",r[1]?"italic":""))}super.getVariant()}setBreakAt(t){this.breakPoints.push(t)}clearBreakPoints(){this.breakPoints=[]}computeLineBBox(t){const e=jc.from(this.getOuterBBox(),this.linebreakOptions.lineleading);return this.breakCount?(e.w=this.getBreakWidth(t),0===t?(e.R=0,this.addLeftBorders(e)):(e.L=0,e.indentData=[["left","0"],["left","0"],["left","0"]],t===this.breakCount&&this.addRightBorders(e)),e):e}getBreakWidth(t){const e=this.childNodes;let[s,i]=this.breakPoints[t-1]||[0,0];const[r,n]=this.breakPoints[t]||[e.length,0];let o=e[s].node.getText().split(/ /);if(s===r)return this.textWidth(o.slice(i,n).join(" "));let a=this.textWidth(o.slice(i).join(" "));for(;++s1&&t.forEach(t=>this.adaptor.append(t,this.html("mjx-linestrut")));const e=this.standardChtmlNodes(t);let{w:s,h:i,d:r}=this.getBBox();s<0&&(this.adaptor.setStyle(e[0],"marginRight",this.em(s)),s=0),s&&!this.breakCount&&this.adaptor.setStyle(e[0],"width",this.em(s)),i=Math.max(0,i+r),i&&this.adaptor.setStyle(e[0],"height",this.em(Math.max(0,i))),r&&this.adaptor.setStyle(e[0],"verticalAlign",this.em(-r))}}).kind=Gr.prototype.kind,t}();function fh(t){return class extends t{get containerWidth(){const t=this.node.attributes,e=t.get("width").toString();return e.match(/^[-+]|%$/)||"linebreak"!==t.get("data-overflow")?this.parent.containerWidth:this.length2em(e)}getDimens(){const t=this.node.attributes.getList("width","height","depth","lspace","voffset"),e=this.childNodes[0].getOuterBBox();let{w:s,h:i,d:r}=e;const n=s,o=i,a=r;let l=0,c=0,h=0;""!==t.width&&(s=this.dimen(t.width,e,"w",0)),""!==t.height&&(i=this.dimen(t.height,e,"h",0)),""!==t.depth&&(r=this.dimen(t.depth,e,"d",0)),""!==t.voffset&&(c=this.dimen(t.voffset,e)),""!==t.lspace&&(l=this.dimen(t.lspace,e));const d=this.node.attributes.get("data-align");return d&&(h=this.getAlignX(s,e,d)),[o,a,n,i-o,r-a,s-n,l,c,h]}dimen(t,e,s="",i=null){const r=(t=String(t)).match(/width|height|depth/),n=r?e[r[0].charAt(0)]:s?e[s]:0;let o=this.length2em(t,n)||0;return t.match(/^[-+]/)&&s&&(o+=n),null!=i&&(o=Math.max(i,o)),o}setBBoxDimens(t){const[e,s,i,r,n,o]=this.getDimens();t.w=i+o,t.h=e+r,t.d=s+n}computeBBox(t,e=!1){this.setBBoxDimens(t);if(this.childNodes[0].getOuterBBox().w>t.w){const e=this.node.attributes.get("data-overflow");("linebreak"===e||"auto"===e&&"linebreak"===this.jax.math.root.attributes.get("overflow"))&&(this.childNodes[0].breakToWidth(t.w),this.setBBoxDimens(t))}this.setChildPWidths(e,t.w)}getWrapWidth(t){return this.getBBox().w}getChildAlign(t){return this.node.attributes.get("data-align")||"left"}}}const gh=function(){var t;const e=fh(Yc);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;let e=this.standardChtmlNodes(t);const s=[],i={},[,,r,n,o,a,l,c,h]=this.getDimens();if((a||this.childNodes[0].getBBox().pwidth)&&(i.width=this.em(r+a)),(n||o)&&(i.margin=this.em(n)+" 0 "+this.em(o)),l+h||c){i.position="relative";const t=this.html("mjx-rbox",{style:{left:this.em(l+h),top:this.em(-c),"max-width":i.width}});l+h&&this.childNodes[0].getBBox().pwidth&&(this.adaptor.setAttribute(t,"width","full"),this.adaptor.setStyle(t,"left",this.em(l))),s.push(t)}e=[this.adaptor.append(e[0],this.html("mjx-block",{style:i},s))],this.childNodes[0].childNodes.length?this.childNodes[0].toCHTML([s[0]||e[0]]):(n||o)&&this.adaptor.append(s[0]||e[0],this.html("mjx-box"))}}).kind=sn.prototype.kind,t.styles={"mjx-mpadded":{display:"inline-block"},"mjx-rbox":{display:"inline-block",position:"relative"}},t}(),bh=4,Eh=1,xh=2,yh=.067,Nh=.2,vh=yh+"em solid",Th={top:0,right:1,bottom:2,left:3},Ch=Object.keys(Th),Ah=t=>new Array(4).fill(t.thickness+t.padding),Lh=t=>new Array(4).fill(t.padding),Sh=t=>new Array(4).fill(t.thickness),Rh=t=>Math.max(t.padding,t.thickness*(t.arrowhead.x+t.arrowhead.dx+1)),Mh=(t,e)=>{if(t.childNodes[0]){const{h:s,d:i}=t.childNodes[0].getBBox();e[0]=e[2]=Math.max(0,t.thickness*t.arrowhead.y-(s+i)/2)}return e},Ih=(t,e)=>{if(t.childNodes[0]){const{w:s}=t.childNodes[0].getBBox();e[1]=e[3]=Math.max(0,t.thickness*t.arrowhead.y-s/2)}return e},wh={up:[-Math.PI/2,!1,!0,"verticalstrike"],down:[Math.PI/2,!1,!0,"verticakstrike"],right:[0,!1,!1,"horizontalstrike"],left:[Math.PI,!1,!1,"horizontalstrike"],updown:[Math.PI/2,!0,!0,"verticalstrike uparrow downarrow"],leftright:[0,!0,!1,"horizontalstrike leftarrow rightarrow"]},kh={updiagonal:[-1,0,!1,"updiagonalstrike northeastarrow"],northeast:[-1,0,!1,"updiagonalstrike updiagonalarrow"],southeast:[1,0,!1,"downdiagonalstrike"],northwest:[1,Math.PI,!1,"downdiagonalstrike"],southwest:[-1,Math.PI,!1,"updiagonalstrike"],northeastsouthwest:[-1,0,!0,"updiagonalstrike northeastarrow updiagonalarrow southwestarrow"],northwestsoutheast:[1,0,!0,"downdiagonalstrike northwestarrow southeastarrow"]},Oh={up:t=>Ih(t,[Rh(t),0,t.padding,0]),down:t=>Ih(t,[t.padding,0,Rh(t),0]),right:t=>Mh(t,[0,Rh(t),0,t.padding]),left:t=>Mh(t,[0,t.padding,0,Rh(t)]),updown:t=>Ih(t,[Rh(t),0,Rh(t),0]),leftright:t=>Mh(t,[0,Rh(t),0,Rh(t)])},Dh=function(t){return e=>{const s=Th[e];return[e,{renderer:t,bbox:t=>{const e=[0,0,0,0];return e[s]=t.thickness+t.padding,e},border:t=>{const e=[0,0,0,0];return e[s]=t.thickness,e}}]}},Ph=function(t){return(e,s,i)=>{const r=Th[s],n=Th[i];return[e,{renderer:t,bbox:t=>{const e=t.thickness+t.padding,s=[0,0,0,0];return s[r]=s[n]=e,s},border:t=>{const e=[0,0,0,0];return e[r]=e[n]=t.thickness,e},remove:s+" "+i}]}},Bh=function(t){return e=>{const s="mjx-"+e.charAt(0)+"strike";return[e+"diagonalstrike",{renderer:t(s),bbox:Ah}]}},Fh=function(t){return e=>{const[s,i,r,n]=kh[e];return[e+"arrow",{renderer:(e,n)=>{const[o,a]=e.arrowAW(),l=e.arrow(a,s*(o-i),r);t(e,l)},bbox:t=>{const{a:e,x:s,y:i}=t.arrowData(),[r,n,o]=[t.arrowhead.x,t.arrowhead.y,t.arrowhead.dx],[a,l]=t.getArgMod(r+o,n),c=i+(a>e?t.thickness*l*Math.sin(a-e):0),h=s+(a>Math.PI/2-e?t.thickness*l*Math.sin(a+e-Math.PI/2):0);return[c,h,c,h]},remove:n}]}},jh=function(t){return e=>{const[s,i,r,n]=wh[e];return[e+"arrow",{renderer:(e,n)=>{const{w:o,h:a,d:l}=e.getBBox(),[c,h]=r?[a+l,"X"]:[o,"Y"],d=e.getOffset(h),u=e.arrow(c,s,i,h,d);t(e,u)},bbox:Oh[e],remove:n}]}};function _h(t){return class extends t{getParameters(){const t=this.node.attributes,e=t.get("data-padding");void 0!==e&&(this.padding=this.length2em(e,Nh));const s=t.get("data-thickness");void 0!==s&&(this.thickness=this.length2em(s,yh));const i=t.get("data-arrowhead");if(void 0!==i){const[t,e,s]=Wr(i);this.arrowhead={x:t?parseFloat(t):bh,y:e?parseFloat(e):xh,dx:s?parseFloat(s):Eh}}}getNotations(){const t=this.constructor.notations;for(const e of Wr(this.node.attributes.get("notation"))){const s=t.get(e);s&&(this.notations[e]=s,s.renderChild&&(this.renderChild=s.renderer))}}removeRedundantNotations(){for(const t of Object.keys(this.notations))if(this.notations[t]){const e=this.notations[t].remove||"";for(const t of e.split(/ /))delete this.notations[t]}}initializeNotations(){for(const t of Object.keys(this.notations)){const e=this.notations[t].init;e&&e(this)}}getBBoxExtenders(){const t=[0,0,0,0];for(const e of Object.keys(this.notations))this.maximizeEntries(t,this.notations[e].bbox(this));return t}getPadding(){const t=[0,0,0,0];for(const e of Object.keys(this.notations)){const s=this.notations[e].border;s&&this.maximizeEntries(t,s(this))}return[0,1,2,3].map(e=>this.TRBL[e]-t[e])}maximizeEntries(t,e){for(let s=0;s.001?n:0}getArgMod(t,e){return[Math.atan2(e,t),Math.sqrt(t*t+e*e)]}arrow(t,e,s,i="",r=0){return null}arrowData(){const[t,e]=[this.padding,this.thickness],s=e*(this.arrowhead.x+Math.max(1,this.arrowhead.dx)),{h:i,d:r,w:n}=this.childNodes[0].getBBox(),o=i+r,a=Math.sqrt(o*o+n*n),l=Math.max(t,s*n/a),c=Math.max(t,s*o/a),[h,d]=this.getArgMod(n+2*l,o+2*c);return{a:h,W:d,x:l,y:c}}arrowAW(){const{h:t,d:e,w:s}=this.childNodes[0].getBBox(),[i,r,n,o]=this.TRBL;return this.getArgMod(o+s+r,i+t+e+n)}createMsqrt(t){const e=this.node.factory.create("msqrt");e.inheritAttributesFrom(this.node),e.childNodes[0]=t.node;const s=this.wrap(e);return s.parent=this,s}sqrtTRBL(){const t=this.msqrt.getBBox(),e=this.msqrt.childNodes[0].getBBox();return[t.h-e.h,0,t.d-e.d,t.w-e.w]}constructor(t,e,s=null){super(t,e,s),this.notations={},this.renderChild=null,this.msqrt=null,this.padding=Nh,this.thickness=yh,this.arrowhead={x:bh,y:xh,dx:Eh},this.TRBL=[0,0,0,0],this.getParameters(),this.getNotations(),this.removeRedundantNotations(),this.initializeNotations(),this.TRBL=this.getBBoxExtenders()}computeBBox(t,e=!1){const[s,i,r,n]=this.TRBL,o=this.childNodes[0].getBBox();t.combine(o,n,0),t.h+=s,t.d+=r,t.w+=i,this.setChildPWidths(e)}}}const Uh=function(t,e=""){return(s,i)=>{const r=s.adjustBorder(s.html("mjx-"+t));if(e){const t=s.getOffset(e);if(s.thickness!==yh||t){const i=`translate${e}(${s.Em(s.thickness/2-t)})`;s.adaptor.setStyle(r,"transform",i)}}s.adaptor.append(s.dom[0],r)}},Hh=function(t){return Dh((e,s)=>{e.adaptor.setStyle(s,"border-"+t,e.Em(e.thickness)+" solid")})(t)},Wh=function(t,e,s){return Ph((t,i)=>{const r=t.Em(t.thickness)+" solid";t.adaptor.setStyle(i,"border-"+e,r),t.adaptor.setStyle(i,"border-"+s,r)})(t,e,s)},zh=function(t,e){return Bh(t=>(s,i)=>{const{w:r,h:n,d:o}=s.getBBox(),[a,l]=s.getArgMod(r,n+o),c=e*s.thickness/2,h=s.adjustBorder(s.html(t,{style:{width:s.Em(l),transform:"rotate("+s.fixed(-e*a)+"rad) translateY("+c+"em)"}}));s.adaptor.append(s.dom[0],h)})(t)},qh=function(t){return Fh((t,e)=>{t.adaptor.append(t.dom[0],e)})(t)},Vh=function(t){return jh((t,e)=>{t.adaptor.append(t.dom[0],e)})(t)};function Xh(t,e){return Math.atan2(t,e).toFixed(3).replace(/\.?0+$/,"")}const Gh=Xh(Eh,xh),Jh=function(){var t;const e=_h(Yc);return(t=class extends e{adjustArrow(t,e){const s=this.thickness,i=this.arrowhead;if(i.x===bh&&i.y===xh&&i.dx===Eh&&s===yh)return;const[r,n]=[s*i.x,s*i.y].map(t=>this.em(t)),o=Xh(i.dx,i.y),[a,l,c,h,d]=this.adaptor.childNodes(t);this.adjustHead(l,[n,"0","1px",r],o),this.adjustHead(c,["1px","0",n,r],"-"+o),this.adjustHead(h,[n,r,"1px","0"],"-"+o),this.adjustHead(d,["1px",r,n,"0"],o),this.adjustLine(a,s,i.x,e)}adjustHead(t,e,s){t&&(this.adaptor.setStyle(t,"border-width",e.join(" ")),this.adaptor.setStyle(t,"transform","skewX("+s+"rad)"))}adjustLine(t,e,s,i){this.adaptor.setStyle(t,"borderTop",this.em(e)+" solid"),this.adaptor.setStyle(t,"top",this.em(-e/2)),this.adaptor.setStyle(t,"right",this.em(e*(s-1))),i&&this.adaptor.setStyle(t,"left",this.em(e*(s-1)))}moveArrow(t,e,s){if(!s)return;const i=this.adaptor.getStyle(t,"transform");this.adaptor.setStyle(t,"transform",`translate${e}(${this.em(-s)})${i?" "+i:""}`)}adjustBorder(t){return this.thickness!==yh&&this.adaptor.setStyle(t,"borderWidth",this.em(this.thickness)),t}adjustThickness(t){return this.thickness!==yh&&this.adaptor.setStyle(t,"strokeWidth",this.fixed(this.thickness)),t}fixed(t,e=3){return Math.abs(t)<6e-4?"0":t.toFixed(e).replace(/\.?0+$/,"")}Em(t){return super.em(t)}toCHTML(t){const e=this.adaptor,s=this.standardChtmlNodes(t),i=e.append(s[0],this.html("mjx-box"));this.renderChild?this.renderChild(this,i):this.childNodes[0].toCHTML([i]);for(const t of Object.keys(this.notations)){const e=this.notations[t];e.renderChild||e.renderer(this,i)}const r=this.getPadding();for(const t of Ch){const s=Th[t];r[s]>0&&e.setStyle(i,"padding-"+t,this.em(r[s]))}}arrow(t,e,s,i="",r=0){const n=this.getBBox().w,o={width:this.em(t)};n!==t&&(o.left=this.em((n-t)/2)),e&&(o.transform="rotate("+this.fixed(e)+"rad)");const a=this.html("mjx-arrow",{style:o},[this.html("mjx-aline"),this.html("mjx-rthead"),this.html("mjx-rbhead")]);return s&&(this.adaptor.append(a,this.html("mjx-lthead")),this.adaptor.append(a,this.html("mjx-lbhead")),this.adaptor.setAttribute(a,"double","true")),this.adjustArrow(a,s),this.moveArrow(a,i,r),a}}).kind=on.prototype.kind,t.styles={"mjx-menclose":{position:"relative"},"mjx-menclose > mjx-dstrike":{display:"inline-block",left:0,top:0,position:"absolute","border-top":vh,"transform-origin":"top left"},"mjx-menclose > mjx-ustrike":{display:"inline-block",left:0,bottom:0,position:"absolute","border-top":vh,"transform-origin":"bottom left"},"mjx-menclose > mjx-hstrike":{"border-top":vh,position:"absolute",left:0,right:0,bottom:"50%",transform:"translateY("+yo(yh/2)+")"},"mjx-menclose > mjx-vstrike":{"border-left":vh,position:"absolute",top:0,bottom:0,right:"50%",transform:"translateX("+yo(yh/2)+")"},"mjx-menclose > mjx-rbox":{position:"absolute",top:0,bottom:0,right:0,left:0,border:vh,"border-radius":yo(yh+Nh)},"mjx-menclose > mjx-cbox":{position:"absolute",top:0,bottom:0,right:0,left:0,border:vh,"border-radius":"50%"},"mjx-menclose > mjx-arrow":{position:"absolute",left:0,bottom:"50%",height:0,width:0},"mjx-menclose > mjx-arrow > mjx-aline":{display:"block",position:"absolute","box-sizing":"border-box","transform-origin":"bottom",left:0,top:yo(-yh/2),right:yo(yh*(bh-1)),height:0,"border-top":yo(yh)+" solid","border-left":0,"border-right":0},"mjx-menclose > mjx-arrow[double] > mjx-aline":{display:"block",position:"absolute","box-sizing":"border-box","transform-origin":"bottom",left:yo(yh*(bh-1)),height:0,"border-left":yo(yh*bh)+" solid","border-right":0},"mjx-menclose > mjx-arrow > mjx-rthead":{display:"block",position:"absolute","box-sizing":"border-box","transform-origin":"bottom",transform:"skewX("+Gh+"rad)",right:0,bottom:"-1px","border-left":yo(yh*bh)+" solid","border-right":0,"border-bottom":"1px solid transparent","border-top":yo(yh*xh)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-rbhead":{display:"block",position:"absolute","box-sizing":"border-box",transform:"skewX(-"+Gh+"rad)","transform-origin":"top",right:0,top:"-1px","border-left":yo(yh*bh)+" solid","border-right":0,"border-top":"1px solid transparent","border-bottom":yo(yh*xh)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-lthead":{display:"block",position:"absolute","box-sizing":"border-box",transform:"skewX(-"+Gh+"rad)","transform-origin":"bottom",left:0,bottom:"-1px","border-left":0,"border-right":yo(yh*bh)+" solid","border-bottom":"1px solid transparent","border-top":yo(yh*xh)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-lbhead":{display:"block",position:"absolute","box-sizing":"border-box",transform:"skewX("+Gh+"rad)","transform-origin":"top",left:0,top:"-1px","border-left":0,"border-right":yo(yh*bh)+" solid","border-top":"1px solid transparent","border-bottom":yo(yh*xh)+" solid transparent"},"mjx-menclose > mjx-dbox-top":{position:"absolute",top:0,bottom:"50%",left:0,width:yo(1.5*Nh),"border-width":yo(yh),"border-style":"solid solid none none","border-radius":"0 100% 0 0","box-sizing":"border-box"},"mjx-menclose > mjx-dbox-bot":{position:"absolute",top:"50%",bottom:0,left:0,width:yo(1.5*Nh),"border-width":yo(yh),"border-style":"none solid solid none","border-radius":"0 0 100% 0","box-sizing":"border-box"}},t.notations=new Map([Hh("top"),Hh("right"),Hh("bottom"),Hh("left"),Wh("actuarial","top","right"),Wh("madruwb","bottom","right"),zh("up",1),zh("down",-1),["horizontalstrike",{renderer:Uh("hstrike","Y"),bbox:t=>[0,t.padding,0,t.padding]}],["verticalstrike",{renderer:Uh("vstrike","X"),bbox:t=>[t.padding,0,t.padding,0]}],["box",{renderer:(t,e)=>{t.adaptor.setStyle(e,"border",t.Em(t.thickness)+" solid")},bbox:Ah,border:Sh,remove:"left right top bottom"}],["roundedbox",{renderer:Uh("rbox"),bbox:Ah}],["circle",{renderer:Uh("cbox"),bbox:Ah}],["phasorangle",{renderer:(t,e)=>{const{h:s,d:i}=t.getBBox(),[r,n]=t.getArgMod(1.75*t.padding,s+i),o=t.thickness*Math.sin(r)*.9;t.adaptor.setStyle(e,"border-bottom",t.Em(t.thickness)+" solid");const a=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.dom[0],a)},bbox:t=>{const e=t.padding/2,s=t.thickness;return[2*e,e,e+s,3*e+s]},border:t=>[0,0,t.thickness,0],remove:"bottom"}],Vh("up"),Vh("down"),Vh("left"),Vh("right"),Vh("updown"),Vh("leftright"),qh("updiagonal"),qh("northeast"),qh("southeast"),qh("northwest"),qh("southwest"),qh("northeastsouthwest"),qh("northwestsoutheast"),["longdiv",{renderer:(t,e)=>{const s=t.adaptor;s.setStyle(e,"border-top",t.Em(t.thickness)+" solid");const i=s.append(t.dom[0],t.html("mjx-dbox-top")),r=s.append(t.dom[0],t.html("mjx-dbox-bot")),n=t.thickness,o=t.padding;n!==yh&&(s.setStyle(i,"border-width",t.Em(n)),s.setStyle(r,"border-width",t.Em(n))),o!==Nh&&(s.setStyle(i,"width",t.Em(1.5*o)),s.setStyle(r,"width",t.Em(1.5*o)))},bbox:t=>{const e=t.padding,s=t.thickness;return[e+s,e,e,2*e+s/2]}}],["radical",{renderer:(t,e)=>{t.msqrt.toCHTML([e]);const s=t.sqrtTRBL();t.adaptor.setStyle(t.msqrt.dom[0],"margin",s.map(e=>t.Em(-e)).join(" "))},init:t=>{t.msqrt=t.createMsqrt(t.childNodes[0])},bbox:t=>t.sqrtTRBL(),renderChild:!0}]]),t}();function Kh(t){return class extends t{stretchChildren(){const t=[];for(const e of this.childNodes)e.canStretch(Mc.Vertical)&&t.push(e);const e=t.length,s=this.childNodes.length;if(e&&s>1){let i=0,r=0;const n=e>1&&e===s;for(const t of this.childNodes){const e=t.stretch.dir===Mc.None;if(n||e){const e=t.getBBox().rscale;let[s,n]=t.getUnbrokenHD();s*=e,n*=e,s>i&&(i=s),n>r&&(r=n)}}for(const e of t){const t=e.coreRScale();e.coreMO().getStretchedVariant([i/t,r/t])}}}get fixesPWidth(){return!1}get breakCount(){return this._breakCount<0&&(this._breakCount=this.childNodes.length?this.childNodes.reduce((t,e)=>t+e.breakCount,0):0),this._breakCount}breakTop(t,e){const s=this;return this.isStack?this.parent.breakTop(s,s):s}constructor(t,e,s=null){super(t,e,s),this.dh=0;const i=this;this.isStack=!this.parent||this.parent.node.isInferred||this.parent.breakTop(i,i)!==i,this.stretchChildren();for(const t of this.childNodes)if(t.bbox.pwidth){this.bbox.pwidth=vo.fullWidth;break}}computeBBox(t,e=!1){const s=this.breakCount;this.lineBBox=s?[new jc({h:.75,d:.25,w:0},[0,0])]:[],t.empty();for(const e of this.childNodes.keys()){const i=this.childNodes[e];t.append(i.getOuterBBox()),s&&this.computeChildLineBBox(i,e)}t.clean(),s&&!this.coreMO().node.isEmbellished&&this.computeLinebreakBBox(t),this.fixesPWidth&&this.setChildPWidths(e)&&this.computeBBox(t,!0),this.vboxAdjust(t)}computeLinebreakBBox(t){var e;t.empty();const s=this.isStack,i=this.lineBBox,r=i.length-1;if(s)for(const t of i.keys()){const e=i[t];this.addMiddleBorders(e),0===t&&this.addLeftBorders(e),t===r&&this.addRightBorders(e)}let n=0;for(const s of i.keys()){const r=i[s];t.combine(r,0,n),n-=Math.max(.25,r.d)+r.lineLeading+Math.max(.75,(null===(e=i[s+1])||void 0===e?void 0:e.h)||0)}s?(i[0].L=this.bbox.L,i[r].R=this.bbox.R):(t.w=Math.max(...this.lineBBox.map(t=>t.w)),this.shiftLines(t),this.jax.math.display||this.linebreakOptions.inline||(t.pwidth=vo.fullWidth,this.node.isInferred&&(this.parent.bbox.pwidth=vo.fullWidth))),t.clean()}vboxAdjust(t){if(!this.parent)return;const e=this.breakCount,s=this.parent.node.attributes.get("data-vertical-align");if(e&&"bottom"===s)this.dh=e?t.d-this.lineBBox[e-1].d:0;else{if(!("center"===s||e&&"middle"===s))return void(this.dh=0);{const{h:e,d:s}=t,i=this.font.params.axis_height;this.dh=(e+s)/2+i-e}}t.h+=this.dh,t.d-=this.dh}computeChildLineBBox(t,e){const s=this.lineBBox[this.lineBBox.length-1];s.end=[e,0],s.append(t.getLineBBox(0));const i=t.breakCount+1;if(1!==i)for(let s=1;st.w&&(t.w=p)}}setChildPWidths(t,e=null,s=!0){return this.breakCount?!t&&(null!==e&&this.bbox.w!==e&&(this.bbox.w=e,this.shiftLines(this.bbox)),!0):super.setChildPWidths(t,e,s)}breakToWidth(t){this.linebreaks.breakToWidth(this,t)}}}function $h(t){return class extends t{getScale(){this.bbox.scale=this.parent.bbox.scale,this.bbox.rscale=1}}}const Yh=function(){var t;const e=Kh(Yc);return t=class extends e{constructor(){super(...arguments),this.linebreakCount=0}toCHTML(t){const e=this.linebreakCount=this.isStack?0:this.breakCount;e||!this.node.isInferred?t=this.standardChtmlNodes(t):this.dom=t,this.addChildren(t),e?this.placeLines(t,e):(this.handleVerticalAlign(t[0]),this.handleNegativeWidth(t[0]))}placeLines(t,e){var s,i;this.getBBox();const r=this.lineBBox,n=this.adaptor,[o,a]=(null===(s=r[1].indentData)||void 0===s?void 0:s[0])||["left","0"];for(const s of t.keys()){const l=r[s],[c,h]=0===s?[o,a]:(null===(i=l.indentData)||void 0===i?void 0:i[s===e?2:1])||["left","0"],[d,u]=this.processIndent(c,h,o,a);n.setAttribute(t[s],"align",d),u&&n.setStyle(t[s],"margin-left",this.em(u)),s mjx-linebox":{display:"inline"},"mjx-linestack[breakable] > mjx-linebox::before":{"white-space":"pre",content:'"\\A"'},"mjx-linestack[breakable] > mjx-linebox::after":{"white-space":"normal",content:'" "',"letter-spacing":"-.999em","font-family":"MJX-BRK"},"mjx-linestack[breakable] > mjx-linebox:first-of-type::before":{display:"none"},"mjx-linestack[breakable] > mjx-linebox:last-of-type::after":{display:"none"},"mjx-linebox":{display:"block"},'mjx-linebox[align="left"]':{"text-align":"left"},'mjx-linebox[align="center"]':{"text-align":"center"},'mjx-linebox[align="right"]':{"text-align":"right"},"mjx-linestrut":{display:"inline-block",height:"1em","vertical-align":"-.25em"}},t}(),Qh=function(){var t;const e=$h(Yh);return(t=class extends e{}).kind=$r.prototype.kind,t}();function Zh(t){return class extends t{createMrow(){const t=this.node.factory.create("inferredMrow");t.inheritAttributesFrom(this.node),this.mrow=this.wrap(t),this.mrow.parent=this}addMrowChildren(){const t=this.node,e=this.mrow;this.addMo(t.open),this.childNodes.length&&e.childNodes.push(this.childNodes[0]);let s=0;for(const i of this.childNodes.slice(1))this.addMo(t.separators[s++]),e.childNodes.push(i);this.addMo(t.close),e.stretchChildren()}addMo(t){if(!t)return;const e=this.wrap(t);this.mrow.childNodes.push(e),e.parent=this.mrow}constructor(t,e,s=null){super(t,e,s),this.mrow=null,this.createMrow(),this.addMrowChildren()}computeBBox(t,e=!1){t.updateFrom(this.mrow.getOuterBBox()),this.setChildPWidths(e)}get breakCount(){return this.mrow.breakCount}computeLineBBox(t){return this.mrow.getLineBBox(t)}}}const td=function(){var t;const e=Zh(Yc);return(t=class extends e{toCHTML(t){const e=this.standardChtmlNodes(t);this.mrow.toCHTML(e)}}).kind=nn.prototype.kind,t}();function ed(t){return class extends t{getFractionBBox(t,e,s){const i=this.childNodes[0].getOuterBBox(),r=this.childNodes[1].getOuterBBox(),n=this.font.params.axis_height,{T:o,u:a,v:l}=this.getTUV(e,s);t.combine(i,0,n+o+Math.max(i.d*i.rscale,a)),t.combine(r,0,n-o-Math.max(r.h*r.rscale,l)),t.w+=2*this.pad+.2}getTUV(t,e){const s=this.font.params,i=s.axis_height,r=(t?3.5:1.5)*e;return{T:(t?3.5:1.5)*e,u:(t?s.num1:s.num2)-i-r,v:(t?s.denom1:s.denom2)+i-r}}getAtopBBox(t,e){const{u:s,v:i,nbox:r,dbox:n}=this.getUVQ(e);t.combine(r,0,s),t.combine(n,0,-i),t.w+=2*this.pad}getUVQ(t){const e=this.childNodes[0].getOuterBBox(),s=this.childNodes[1].getOuterBBox(),i=this.font.params;let[r,n]=t?[i.num1,i.denom1]:[i.num3,i.denom2];const o=(t?7:3)*i.rule_thickness;let a=r-e.d*e.scale-(s.h*s.scale-n);return a mjx-line, mjx-dtable > mjx-row":{"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":".075em solid",margin:".06em -.1em",overflow:"hidden"},'mjx-line[type="d"]':{margin:".18em -.1em"}},t}();function id(t){return class extends t{get base(){return 0}get root(){return null}combineRootBBox(t,e,s){}getPQ(t){const e=this.font.params.rule_thickness,s=this.font.params.surd_height,i=this.node.attributes.get("displaystyle")?this.font.params.x_height:e;return[i,t.h+t.d>this.surdH?(t.h+t.d-(this.surdH-e-s-i/2))/2:s+i/4]}getRootDimens(t,e){return[0,0,0,0]}rootWidth(){return 1.25}getStretchedSurd(){const t=this.font.params.rule_thickness,e=this.font.params.surd_height,s=this.node.attributes.get("displaystyle")?this.font.params.x_height:t,{h:i,d:r}=this.childNodes[this.base].getOuterBBox();this.surdH=i+r+t+e+s/4,this.surd.getStretchedVariant([this.surdH-r,r],!0)}constructor(t,e,s=null){super(t,e,s),this.surd=this.createMo("\u221a"),this.surd.canStretch(Mc.Vertical),this.getStretchedSurd()}computeBBox(t,e=!1){t.empty();const s=this.surd.getBBox(),i=new vo(this.childNodes[this.base].getOuterBBox()),r=this.getPQ(s)[1],n=this.font.params.rule_thickness,o=this.font.params.surd_height,a=i.h+r+n,[l]=this.getRootDimens(s,a);t.h=a+o,this.combineRootBBox(t,s,a),t.combine(s,l,a-s.h),t.combine(i,l+s.w,0),t.clean(),this.setChildPWidths(e)}invalidateBBox(){super.invalidateBBox(),this.surd.childNodes[0].invalidateBBox()}}}const rd=function(){var t;const e=id(Yc);return t=class extends e{toCHTML(t){const e=this.surd,s=this.childNodes[this.base],i=e.getBBox(),r=s.getOuterBBox(),[,n]=this.getPQ(i),o=this.font.params.surd_height,a=r.h+n+o,l=this.adaptor,c=this.standardChtmlNodes(t);let h,d,u,p;null!=this.root&&(u=l.append(c[0],this.html("mjx-root")),p=this.childNodes[this.root]);const m=l.append(c[0],this.html("mjx-sqrt",{},[h=this.html("mjx-surd"),d=this.html("mjx-box",{style:{paddingTop:this.em(n)}})]));.06!==o&&l.setStyle(d,"border-top-width",this.em(o*this.font.params.rule_factor)),this.addRoot(u,p,i,a),e.toCHTML([h]),s.toCHTML([d]),e.size<0&&l.addClass(m,"mjx-tall")}addRoot(t,e,s,i){}},t.kind=Qr.prototype.kind,t.styles={"mjx-root":{display:"inline-block","white-space":"nowrap"},"mjx-surd":{display:"inline-block","vertical-align":"top"},"mjx-sqrt":{display:"inline-block","padding-top":".075em"},"mjx-sqrt > mjx-box":{"border-top":".075em solid","padding-left":".03em","margin-left":"-.03em"},"mjx-sqrt.mjx-tall > mjx-box":{"padding-left":".3em","margin-left":"-.3em"}},t}();function nd(t){return class extends t{get root(){return 1}combineRootBBox(t,e,s){const i=this.childNodes[this.root].getOuterBBox(),r=this.getRootDimens(e,s)[1];t.combine(i,0,r)}getRootDimens(t,e){const s=this.surd,i=this.childNodes[this.root].getOuterBBox(),r=(s.size<0?.5:.6)*t.w,{w:n,rscale:o}=i,a=Math.max(n,r/o),l=Math.max(0,a-n);return[a*o-r,this.rootHeight(i,t,s.size,e),l]}rootHeight(t,e,s,i){const r=e.h+e.d;return(s<0?1.9:.55*r)-(r-i)+Math.max(0,t.d*t.rscale)}rootWidth(){const t=this.childNodes[this.root].getOuterBBox();return.4+t.w*t.rscale}}}const od=function(){var t;const e=nd(rd);return t=class extends e{addRoot(t,e,s,i){e.toCHTML([t]);const r=this.adaptor,[n,o,a]=this.getRootDimens(s,i);r.setStyle(t,"verticalAlign",this.em(o)),r.setStyle(t,"width",this.em(n)),a&&r.setStyle(r.firstChild(t),"paddingLeft",this.em(a))}},t.kind=Zr.prototype.kind,t}();function ad(t){var e;return(e=class extends t{get scriptChild(){return this.childNodes[this.node.sub]}getOffset(){return[this.baseIsChar?0:this.getAdjustedIc(),-this.getV()]}}).useIC=!1,e}function ld(t){return class extends t{get scriptChild(){return this.childNodes[this.node.sup]}getOffset(){return[this.getAdjustedIc()-(this.baseRemoveIc?0:this.baseIc),this.getU()]}}}function cd(t){var e;return e=class extends t{constructor(){super(...arguments),this.UVQ=null}get subChild(){return this.childNodes[this.node.sub]}get supChild(){return this.childNodes[this.node.sup]}get scriptChild(){return this.supChild}getUVQ(t=this.subChild.getOuterBBox(),e=this.supChild.getOuterBBox()){const s=this.baseCore,i=s.getLineBBox(s.breakCount);if(this.UVQ)return this.UVQ;const r=this.font.params,n=3*r.rule_thickness,o=this.length2em(this.node.attributes.get("subscriptshift"),r.sub2),a=this.baseCharZero(i.d*this.baseScale+r.sub_drop*t.rscale),l=e.d*e.rscale,c=t.h*t.rscale;let[h,d]=[this.getU(),Math.max(a,o)],u=h-l-(c-d);if(u0&&(h+=t,d-=t)}return h=Math.max(this.length2em(this.node.attributes.get("superscriptshift"),h),h),d=Math.max(this.length2em(this.node.attributes.get("subscriptshift"),d),d),u=h-l-(c-d),this.UVQ=[h,-d,u],this.UVQ}appendScripts(t){const[e,s]=[this.subChild.getOuterBBox(),this.supChild.getOuterBBox()],i=this.getBaseWidth(),r=this.getAdjustedIc(),[n,o]=this.getUVQ(),a=t.d-this.baseChild.getLineBBox(this.baseChild.breakCount).d;return t.combine(e,i+(this.baseIsChar?0:r),o-a),t.combine(s,i+r,n-a),t.w+=this.font.params.scriptspace,t}},e.useIC=!1,e}function hd(t){var e;return e=class extends t{get baseChild(){return this.childNodes[this.node.base]}get scriptChild(){return this.childNodes[1]}getBaseCore(){let t=this.getSemanticBase()||this.childNodes[0],e=null==t?void 0:t.node;for(;t&&(1===t.childNodes.length&&(e.isKind("mrow")||e.isKind("TeXAtom")||e.isKind("mstyle")||e.isKind("mpadded")&&!e.getProperty("vbox")||e.isKind("mphantom")||e.isKind("semantics"))||e.isKind("munderover")&&t.isMathAccent);)this.setBaseAccentsFor(t),t=t.childNodes[0],e=null==t?void 0:t.node;return t||(this.baseHasAccentOver=this.baseHasAccentUnder=!1),t||this.childNodes[0]}setBaseAccentsFor(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")))}getSemanticBase(){const t=this.node.attributes.getExplicit("data-semantic-fencepointer");return this.getBaseFence(this.baseChild,t)}getBaseFence(t,e){if(!t||!t.node.attributes||!e)return null;if(t.node.attributes.getExplicit("data-semantic-id")===e)return t;for(const s of t.childNodes){const t=this.getBaseFence(s,e);if(t)return t}return null}getBaseScale(){let t=this.baseCore,e=1;for(;t&&t!==this;){e*=t.getOuterBBox().rscale,t=t.parent}return e}getBaseIc(){return this.baseCore.getOuterBBox().ic*this.baseScale}getAdjustedIc(){return this.baseIc?1.05*this.baseIc+.05:0}isCharBase(){const 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}checkLineAccents(){if(this.node.isKind("munderover"))if(this.node.isKind("mover"))this.isLineAbove=this.isLineAccent(this.scriptChild);else if(this.node.isKind("munder"))this.isLineBelow=this.isLineAccent(this.scriptChild);else{const t=this;this.isLineAbove=this.isLineAccent(t.overChild),this.isLineBelow=this.isLineAccent(t.underChild)}}isLineAccent(t){const e=t.coreMO().node;return e.isToken&&"\u2015"===e.getText()}getBaseWidth(){const t=this.baseChild.getLineBBox(this.baseChild.breakCount);return t.w*t.rscale-(this.baseRemoveIc?this.baseIc:0)+this.font.params.extra_ic}getOffset(){return[0,0]}baseCharZero(t){const e=!!this.baseCore.node.attributes.get("largeop"),s=!(!this.baseCore.node.isKind("mo")||!this.baseCore.size),i=this.baseScale;return!this.baseIsChar||e||s||1!==i?t:0}getV(){const t=this.baseCore,e=t.getLineBBox(t.breakCount),s=this.scriptChild.getOuterBBox(),i=this.font.params,r=this.length2em(this.node.attributes.get("subscriptshift"),i.sub1);return Math.max(this.baseCharZero(e.d*this.baseScale+i.sub_drop*s.rscale),r,s.h*s.rscale-.8*i.x_height)}getU(){const t=this.baseCore,e=t.getLineBBox(t.breakCount),s=this.scriptChild.getOuterBBox(),i=this.font.params,r=this.node.attributes.getList("displaystyle","superscriptshift"),n=this.node.getProperty("texprimestyle")?i.sup3:r.displaystyle?i.sup1:i.sup2,o=this.length2em(r.superscriptshift,n);return Math.max(this.baseCharZero(e.h*this.baseScale-i.sup_drop*s.rscale),o,s.d*s.rscale+1/4*i.x_height)}hasMovableLimits(){const t=this.node.attributes.get("displaystyle"),e=this.baseChild.coreMO().node;return!t&&!!e.attributes.get("movablelimits")}getOverKU(t,e){const s=this.node.attributes.get("accent"),i=this.font.params,r=e.d*e.rscale,n=i.rule_thickness*i.separation_factor,o=this.baseHasAccentOver?n:0,a=this.isLineAbove?3*i.rule_thickness:n,l=(s?a:Math.max(i.big_op_spacing1,i.big_op_spacing3-Math.max(0,r)))-o;return[l,t.h*t.rscale+l+r]}getUnderKV(t,e){const s=this.node.attributes.get("accentunder"),i=this.font.params,r=e.h*e.rscale,n=i.rule_thickness*i.separation_factor,o=this.baseHasAccentUnder?n:0,a=this.isLineBelow?3*i.rule_thickness:n,l=(s?a:Math.max(i.big_op_spacing2,i.big_op_spacing4-r))-o;return[l,-(t.d*t.rscale+l+r)]}getDeltaW(t,e=[0,0,0]){const s=this.node.attributes.get("align"),i=t.map(t=>t.w*t.rscale);i[0]-=this.baseRemoveIc&&!this.baseCore.node.attributes.get("largeop")?this.baseIc:0;const r=Math.max(...i),n=[];let o=0;for(const t of i.keys())n[t]=("center"===s?(r-i[t])/2:"right"===s?r-i[t]:0)+e[t],n[t]n[e]+=t[e]?t[e].dx*t[0].rscale:0),n}getDelta(t,e=!1){const s=this.node.attributes.get("accent");let{sk:i,ic:r}=this.baseCore.getOuterBBox();return s&&(i-=t.getOuterBBox().sk),((s&&!e?i:0)+this.font.skewIcFactor*r)*this.baseScale}stretchChildren(){const t=[];for(const e of this.childNodes)e.canStretch(Mc.Horizontal)&&t.push(e);const e=t.length,s=this.childNodes.length;if(e&&s>1){let i=0;const r=e>1&&e===s;for(const t of this.childNodes){const e=t.stretch.dir===Mc.None;if(r||e){const{w:s,rscale:r}=t.getOuterBBox(e);s*r>i&&(i=s*r)}}for(const e of t){const t=e.coreMO();null===t.size&&t.getStretchedVariant([i/e.coreRScale()])}}}constructor(t,e,s=null){super(t,e,s),this.baseScale=1,this.baseIc=0,this.baseRemoveIc=!1,this.baseIsChar=!1,this.baseHasAccentOver=null,this.baseHasAccentUnder=null,this.isLineAbove=!1,this.isLineBelow=!1,this.isMathAccent=!1;const i=this.baseCore=this.getBaseCore();i&&(this.setBaseAccentsFor(i),this.baseScale=this.getBaseScale(),this.baseIc=this.getBaseIc(),this.baseIsChar=this.isCharBase(),this.isMathAccent=this.baseIsChar&&this.scriptChild&&void 0!==this.scriptChild.coreMO().node.getProperty("mathaccent"),this.checkLineAccents(),this.baseRemoveIc=!this.isLineAbove&&!this.isLineBelow&&(!this.constructor.useIC||this.isMathAccent))}computeBBox(t,e=!1){t.empty(),t.append(this.baseChild.getOuterBBox()),this.appendScripts(t),t.clean(),this.setChildPWidths(e)}appendScripts(t){const e=this.getBaseWidth(),[s,i]=this.getOffset();return t.combine(this.scriptChild.getOuterBBox(),e+s,i),t.w+=this.font.params.scriptspace,t}get breakCount(){return this._breakCount<0&&(this._breakCount=this.node.isEmbellished?this.coreMO().embellishedBreakCount:this.node.linebreakContainer?0:this.childNodes[0].breakCount),this._breakCount}breakTop(t,e){return this.node.linebreakContainer||!this.parent||this.node.childIndex(e.node)?t:this.parent.breakTop(t,this)}computeLineBBox(t){const e=this.breakCount;if(!e)return jc.from(this.getOuterBBox(),this.linebreakOptions.lineleading);const s=this.baseChild.getLineBBox(t).copy();return t=0||this.adaptor.setStyle(t,"marginBottom",this.em(e.d*e.rscale))}adjustUnderDepth(t,e){if(e.d>=0)return;const s=this.adaptor,i=this.em(e.d),r=this.html("mjx-box",{style:{"margin-bottom":i,"vertical-align":i}});for(const e of s.childNodes(s.firstChild(t)))s.append(r,e);s.append(s.firstChild(t),r)}adjustBaseHeight(t,e){if(this.node.attributes.get("accent")){const s=this.font.params.x_height*this.baseScale;e.h mjx-spacer":{display:"block"}},t}();function fd(t){return class extends t{get scriptChild(){return this.childNodes[this.node.under]}constructor(...t){super(...t),this.stretchChildren()}computeBBox(t,e=!1){if(this.hasMovableLimits())return void super.computeBBox(t,e);t.empty();const s=this.baseChild.getOuterBBox(),i=this.scriptChild.getOuterBBox(),r=this.getUnderKV(s,i)[1],n=this.isLineBelow?0:this.getDelta(this.scriptChild,!0),[o,a]=this.getDeltaW([s,i],[0,-n]);t.combine(s,o,0),t.combine(i,a,r),t.d+=this.font.params.big_op_spacing5,t.clean(),this.setChildPWidths(e)}}}function gd(t){return class extends t{get scriptChild(){return this.childNodes[this.node.over]}constructor(...t){super(...t),this.stretchChildren()}computeBBox(t){if(this.hasMovableLimits())return void super.computeBBox(t);t.empty();const e=this.baseChild.getOuterBBox(),s=this.scriptChild.getOuterBBox();this.node.attributes.get("accent")&&(e.h=Math.max(e.h,this.font.params.x_height*this.baseScale));const i=this.getOverKU(e,s)[1],r=this.isLineAbove?0:this.getDelta(this.scriptChild),[n,o]=this.getDeltaW([e,s],[0,r]);t.combine(e,n,0),t.combine(s,o,i),t.h+=this.font.params.big_op_spacing5,t.clean()}}}function bd(t){return class extends t{get underChild(){return this.childNodes[this.node.under]}get overChild(){return this.childNodes[this.node.over]}get subChild(){return this.underChild}get supChild(){return this.overChild}constructor(...t){super(...t),this.stretchChildren()}computeBBox(t){if(this.hasMovableLimits())return void super.computeBBox(t);t.empty();const e=this.overChild.getOuterBBox(),s=this.baseChild.getOuterBBox(),i=this.underChild.getOuterBBox();this.node.attributes.get("accent")&&(s.h=Math.max(s.h,this.font.params.x_height*this.baseScale));const r=this.getOverKU(s,e)[1],n=this.getUnderKV(s,i)[1],o=this.getDelta(this.overChild),a=this.getDelta(this.underChild,!0),[l,c,h]=this.getDeltaW([s,i,e],[0,this.isLineBelow?0:-a,this.isLineAbove?0:o]);t.combine(s,l,0),t.combine(e,h,r),t.combine(i,c,n);const d=this.font.params.big_op_spacing5;t.h+=d,t.d+=d,t.clean()}}}const Ed=function(){var t;const e=fd(ud);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;if(this.hasMovableLimits())return super.toCHTML(t),void this.adaptor.setAttribute(this.dom[0],"limits","false");this.dom=this.standardChtmlNodes(t);const e=this.adaptor.append(this.adaptor.append(this.dom[0],this.html("mjx-row")),this.html("mjx-base")),s=this.adaptor.append(this.adaptor.append(this.dom[0],this.html("mjx-row")),this.html("mjx-under"));this.baseChild.toCHTML([e]),this.scriptChild.toCHTML([s]);const i=this.baseChild.getOuterBBox(),r=this.scriptChild.getOuterBBox(),n=this.getUnderKV(i,r)[0],o=this.isLineBelow?0:this.getDelta(this.scriptChild,!0);this.adaptor.setStyle(s,"paddingTop",this.em(n)),this.setDeltaW([e,s],this.getDeltaW([i,r],[0,-o])),this.adjustUnderDepth(s,r)}}).kind=un.prototype.kind,t.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"}},t}(),xd=function(){var t;const e=gd(pd);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;if(this.hasMovableLimits())return super.toCHTML(t),void this.adaptor.setAttribute(this.dom[0],"limits","false");this.dom=this.standardChtmlNodes(t);const e=this.adaptor.append(this.dom[0],this.html("mjx-over")),s=this.adaptor.append(this.dom[0],this.html("mjx-base"));this.scriptChild.toCHTML([e]),this.baseChild.toCHTML([s]);const i=this.scriptChild.getOuterBBox(),r=this.baseChild.getOuterBBox();this.adjustBaseHeight(s,r);const n=this.getOverKU(r,i)[0],o=this.isLineAbove?0:this.getDelta(this.scriptChild);this.adaptor.setStyle(e,"paddingBottom",this.em(n)),this.setDeltaW([s,e],this.getDeltaW([r,i],[0,o])),this.adjustOverDepth(e,i)}}).kind=pn.prototype.kind,t.styles={'mjx-mover:not([limits="false"])':{"padding-top":".1em"},[["base","over"].map(t=>`mjx-mover:not([limits="false"]) > mjx-${t}`).join(", ")]:{display:"block","text-align":"left"}},t}(),yd=function(){var t;const e=bd(md);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;if(this.hasMovableLimits())return super.toCHTML(t),void this.adaptor.setAttribute(this.dom[0],"limits","false");this.dom=this.standardChtmlNodes(t);const e=this.adaptor.append(this.dom[0],this.html("mjx-over")),s=this.adaptor.append(this.adaptor.append(this.dom[0],this.html("mjx-box")),this.html("mjx-munder")),i=this.adaptor.append(this.adaptor.append(s,this.html("mjx-row")),this.html("mjx-base")),r=this.adaptor.append(this.adaptor.append(s,this.html("mjx-row")),this.html("mjx-under"));this.overChild.toCHTML([e]),this.baseChild.toCHTML([i]),this.underChild.toCHTML([r]);const n=this.overChild.getOuterBBox(),o=this.baseChild.getOuterBBox(),a=this.underChild.getOuterBBox();this.adjustBaseHeight(i,o);const l=this.getOverKU(o,n)[0],c=this.getUnderKV(o,a)[0],h=this.getDelta(this.overChild),d=this.getDelta(this.underChild,!0);this.adaptor.setStyle(e,"paddingBottom",this.em(l)),this.adaptor.setStyle(r,"paddingTop",this.em(c)),this.setDeltaW([i,r,e],this.getDeltaW([o,a,n],[0,this.isLineBelow?0:-d,this.isLineAbove?0:h])),this.adjustOverDepth(e,n),this.adjustUnderDepth(r,a)}}).kind=dn.prototype.kind,t.styles={'mjx-munderover:not([limits="false"])':{"padding-top":".1em"},[["over","box"].map(t=>`mjx-munderover:not([limits="false"]) > mjx-${t}`).join(", ")]:{display:"block"}},t}(),Nd={base:"subList",subList:"supList",supList:"subList",psubList:"psupList",psupList:"psubList"},vd=["sup","sup","psup","psub"];function Td(t){return class extends t{combinePrePost(t,e){const s=new vo(t);return s.combine(e,0,0),s}getScriptData(){const t=this.scriptData={base:null,sub:vo.empty(),sup:vo.empty(),psub:vo.empty(),psup:vo.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}getScriptBBoxLists(){const t={base:[],subList:[],supList:[],psubList:[],psupList:[]};let e="base";for(const s of this.childNodes)s.node.isKind("mprescripts")?e="psubList":(t[e].push(s.getOuterBBox()),e=Nd[e]);return this.firstPrescript=t.subList.length+t.supList.length+2,this.padLists(t.subList,t.supList),this.padLists(t.psubList,t.psupList),t}padLists(t,e){t.length>e.length&&e.push(vo.empty())}combineBBoxLists(t,e,s,i){for(let r=0;rt.h&&(t.h=o),a>t.d&&(t.d=a),c>e.h&&(e.h=c),h>e.d&&(e.d=h)}}getScaledWHD(t){const{w:e,h:s,d:i,rscale:r}=t;return[e*r,s*r,i*r]}getCombinedUV(){const t=this.scriptData,e=this.combinePrePost(t.sub,t.psub),s=this.combinePrePost(t.sup,t.psup);return this.getUVQ(e,s)}addPrescripts(t,e,s){const i=this.scriptData;if(i.numPrescripts){const r=this.font.params.scriptspace;t.combine(i.psup,r,e),t.combine(i.psub,r,s)}return t}addPostscripts(t,e,s){const i=this.scriptData;if(i.numScripts){const r=t.w;t.combine(i.sup,r,e),t.combine(i.sub,r,s),t.w+=this.font.params.scriptspace}return t}constructor(...t){super(...t),this.scriptData=null,this.firstPrescript=0,this.getScriptData()}appendScripts(t){t.empty();const[e,s]=this.getCombinedUV();return this.addPrescripts(t,e,s),t.append(this.scriptData.base),this.addPostscripts(t,e,s),t.clean(),t}computeLineBBox(t){const e=this.baseChild.breakCount,s=this.baseChild.getLineBBox(t).copy();let i=s;const[r,n]=this.getCombinedUV();return 0===t?(i=jc.from(this.addPrescripts(vo.zero(),r,n),this.linebreakOptions.lineleading),i.append(s),this.addLeftBorders(i),i.L=this.bbox.L):t===e&&(i=this.addPostscripts(i,r,n),this.addRightBorders(i),i.R=this.bbox.R),this.addMiddleBorders(i),i}getUVQ(t,e){if(!this.UVQ){let[s,i,r]=[0,0,0];0===t.w?s=this.getU():0===e.w?s=-this.getV():[s,i,r]=super.getUVQ(t,e),this.UVQ=[s,i,r]}return this.UVQ}}}const Cd=function(){var t;const e=Td(md);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;const e=this.standardChtmlNodes(t),s=this.scriptData,i=this.node.getProperty("scriptalign")||"right left",[r,n]=Wr(i+" "+i),[o,a]=this.getCombinedUV();if(s.numPrescripts){const t=this.addScripts(this.dom[0],o,-a,!0,s.psub,s.psup,this.firstPrescript,s.numPrescripts);"right"!==r&&this.adaptor.setAttribute(t,"script-align",r)}if(this.childNodes[0].toCHTML(e),s.numScripts){const t=this.addScripts(this.dom[this.dom.length-1],o,-a,!1,s.sub,s.sup,1,s.numScripts);"left"!==n&&this.adaptor.setAttribute(t,"script-align",n)}}addScripts(t,e,s,i,r,n,o,a){const l=this.adaptor,c=e-n.d+(s-r.h),h=e<0&&0===s?r.h+e:e,d=c>0?{style:{height:this.em(c)}}:{},u=h?{style:{"vertical-align":this.em(h)}}:{},p=this.html("mjx-row"),m=this.html("mjx-row",d),f=this.html("mjx-row"),g="mjx-"+(i?"pre":"")+"scripts",b=o+2*a;for(;o 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"},"mjx-none":{display:"inline-block",height:"1px"}},t}(),Ad=.333;function Ld(t){return class extends t{get tableRows(){return this.childNodes}findContainer(){let t=this,e=t.parent;for(;e&&(e.node.notParent||e.node.isKind("mrow"));)t=e,e=e.parent;this.container=e,this.containerI=t.node.childPosition()}getPercentageWidth(){if(this.hasLabels)this.bbox.pwidth=vo.fullWidth;else{const t=this.node.attributes.get("width");Hr(t)&&(this.bbox.pwidth=t)}}stretchRows(){const t=this.node.attributes.get("equalrows"),e=t?this.getEqualRowHeight():0,{H:s,D:i}=t?this.getTableData():{H:[0],D:[0]},r=this.tableRows;for(let n=0;ne&&(e=s)}}}}if(null!==e){const i=this.getTableData().W;for(const r of s){let s=r.getBBox().w;r.coreMO().getStretchedVariant([Math.max(e,s)/r.coreRScale()]),s=r.getBBox().w,s>i[t]&&(i[t]=s)}}}breakColumn(t,e,s){if("linebreak"!==this.jax.math.root.attributes.get("overflow")||!this.jax.math.display)return;const{H:i,D:r}=this.getTableData();let n=0,o=0;for(const s of this.tableRows){const a=s.getChild(t);if(a){const l=s.getBBox().rscale,c=a.getBBox();if(a&&c.w*l>e){a.childNodes[0].breakToWidth(e);const o=s.node.attributes.get("rowalign");this.updateHDW(a,t,n,o,i,r)}c.w*l>o&&(o=c.w*l)}const l=s.getBBox();l.h=i[n],l.d=r[n],n++}("fit"===s||"auto"===s||Hr(s)||o>this.cWidths[t])&&(this.cWidths[t]=o)}getTableData(){if(this.data)return this.data;const t=new Array(this.numRows).fill(0),e=new Array(this.numRows).fill(0),s=new Array(this.numCols).fill(0),i=new Array(this.numRows),r=new Array(this.numRows),n=[0],o=this.tableRows;for(let a=0;ao[e]&&(o[e]=c)}recordPWidthCell(t,e){t.childNodes[0]&&t.childNodes[0].getBBox().pwidth&&this.pwidthCells.push([t,e])}setColumnPWidths(){const t=this.cWidths;for(const[e,s]of this.pwidthCells)e.setChildPWidths(!1,t[s])&&(e.invalidateBBox(),e.getBBox())}getBBoxHD(t){const[e,s]=this.getAlignmentRow();if(null===s){const s=this.font.params.axis_height,i=t/2;return{top:[0,t],center:[i,i],bottom:[t,0],baseline:[i,i],axis:[i+s,i-s]}[e]||[i,i]}{const i=this.getVerticalPosition(s,e);return[i,t-i]}}getBBoxLR(){var t;if(this.hasLabels){const t=this.node.attributes,e=t.get("side");let[s,i]=this.getPadAlignShift(e);const r=this.hasLabels&&!!t.get("data-width-includes-label");return r&&this.frame&&this.fSpace[0]&&(s-=this.fSpace[0]),"center"!==i||r?"left"===e?[s,0]:[0,s]:[s,s]}return[(null===(t=this.bbox)||void 0===t?void 0:t.L)||0,0]}getPadAlignShift(t){const{L:e}=this.getTableData();let s=e+this.length2em(this.node.attributes.get("minlabelspacing"));const[i,r]=null==this.styles?["",""]:[this.styles.get("padding-left"),this.styles.get("padding-right")];(i||r)&&(s=Math.max(s,this.length2em(i||"0"),this.length2em(r||"0")));let[n,o]=this.getAlignShift();return n===t&&(o="left"===t?Math.max(s,o)-s:Math.min(-s,o)+s),[s,n,o]}getWidth(){return this.pWidth||this.getBBox().w}adjustWideTable(){const t=this.node.attributes;if("auto"!==t.get("width"))return;const[e,s]=this.getPadAlignShift(t.get("side")),i=Math.max(this.containerWidth/10,this.containerWidth-e-("center"===s?e:0));this.naturalWidth()>i&&this.adjustColumnWidths(i)}naturalWidth(){return Vo(this.getComputedWidths().concat(this.cLines,this.cSpace))+2*this.fLine+this.fSpace[0]+this.fSpace[2]}getEqualRowHeight(){const{H:t,D:e}=this.getTableData(),s=Array.from(t.keys()).map(s=>t[s]+e[s]);return Math.max(...s)}getComputedWidths(){const t=this.getTableData().W;let e=Array.from(t.keys()).map(e=>"number"==typeof this.cWidths[e]?this.cWidths[e]:t[e]);return this.node.attributes.get("equalcolumns")&&(e=Array(e.length).fill(Xo(e))),e}getColumnWidths(){const t=this.node.attributes.get("width");if(this.node.attributes.get("equalcolumns"))return this.getEqualColumns(t);const e=this.getColumnAttributes("columnwidth",0);return"auto"===t?this.getColumnWidthsAuto(e):Hr(t)?this.getColumnWidthsPercent(e):this.getColumnWidthsFixed(e,this.length2em(t))}getEqualColumns(t){const e=Math.max(1,this.numCols);let s;if("auto"===t){const{W:t}=this.getTableData();s=Xo(t)}else if(Hr(t))s=this.percent(1/e);else{const i=Vo([].concat(this.cLines,this.cSpace))+this.fSpace[0]+this.fSpace[2];s=Math.max(0,this.length2em(t)-i)/e}return Array(this.numCols).fill(s)}getColumnWidthsAuto(t){return t.map(t=>"auto"===t||"fit"===t?null:Hr(t)?t:this.length2em(t))}getColumnWidthsPercent(t){const e=t.includes("fit"),{W:s}=e?this.getTableData():{W:null};return Array.from(t.keys()).map(i=>{const r=t[i];return"fit"===r?null:"auto"===r?e?s[i]:null:Hr(r)?r:this.length2em(r)})}getColumnWidthsFixed(t,e){const s=Array.from(t.keys()),i=s.filter(e=>"fit"===t[e]),r=s.filter(e=>"auto"===t[e]),n=i.length||r.length,{W:o}=n?this.getTableData():{W:null},a=e-Vo([].concat(this.cLines,this.cSpace))-this.fSpace[0]-this.fSpace[2];let l=a;s.forEach(e=>{const s=t[e];l-="fit"===s||"auto"===s?o[e]:this.length2em(s,a)});const c=n&&l>0?l/n:0;return s.map(e=>{const s=t[e];return"fit"===s?o[e]+c:"auto"===s?o[e]+(0===i.length?c:0):this.length2em(s,a)})}adjustColumnWidths(t){const{W:e}=this.getTableData(),s=this.getColumnAttributes("columnwidth",0),i=Array.from(s.keys()),r=[...i.filter(t=>"fit"===s[t]).sort((t,s)=>e[s]-e[t]),...i.filter(t=>"auto"===s[t]).sort((t,s)=>e[s]-e[t]),...i.filter(t=>Hr(s[t])).sort((t,s)=>e[s]-e[t]),...i.filter(t=>"fit"!==s[t]&&"auto"!==s[t]&&!Hr(s[t])).sort((t,s)=>e[s]-e[t])];if(!r.length)return;this.cWidths=i.map(t=>"number"==typeof this.cWidths[t]?this.cWidths[t]:e[t]);const n=t-Vo([].concat(this.cLines,this.cSpace))-this.fSpace[0]-this.fSpace[2];let o=Vo(this.cWidths)-n,a=0,l=0;for(;lthis.cWidths[t]*=o)}getVerticalPosition(t,e){const s=this.node.attributes.get("equalrows"),{H:i,D:r}=this.getTableData(),n=s?this.getEqualRowHeight():0,o=this.getRowHalfSpacing();let a=this.fLine;for(let e=0;et/2);return t.unshift(this.fSpace[1]),t.push(this.fSpace[1]),t}getColumnHalfSpacing(){const t=this.cSpace.map(t=>t/2);return t.unshift(this.fSpace[0]),t.push(this.fSpace[2]),t}getAlignmentRow(){const[t,e]=Wr(this.node.attributes.get("align"));if(null==e)return[t,null];let s=parseInt(e);return s<0&&(s+=this.numRows+1),[t,s<1||s>this.numRows?null:s-1]}getColumnAttributes(t,e=1){const s=this.numCols-e,i=this.getAttributeArray(t);if(0===i.length)return null;for(;i.lengths&&i.splice(s),i}getRowAttributes(t,e=1){const s=this.numRows-e,i=this.getAttributeArray(t);if(0===i.length)return null;for(;i.lengths&&i.splice(s),i}getAttributeArray(t){const e=this.node.attributes.get(t);return e?Wr(e):[this.node.attributes.getDefault(t)]}addEm(t,e=1){return t?t.map(t=>this.em(t/e)):null}convertLengths(t){return t?t.map(t=>this.length2em(t)):null}constructor(t,e,s=null){super(t,e,s),this.numCols=0,this.numRows=0,this.data=null,this.pwidthCells=[],this.pWidth=0,this.adjustHD={top:(t,e,s,i,r)=>{t>s[r]&&(i[r]-=t-s[r],s[r]=t),t+e>s[r]+i[r]&&(i[r]=t+e-s[r])},bottom:(t,e,s,i,r)=>{e>i[r]&&(s[r]-=e-i[r],i[r]=e),t+e>s[r]+i[r]&&(s[r]=t+e-i[r])},center:(t,e,s,i,r)=>{t+e>s[r]+i[r]&&(s[r]=i[r]=(t+e)/2)},other:(t,e,s,i,r)=>{t>s[r]&&(s[r]=t),e>i[r]&&(i[r]=e)}},this.numCols=Xo(this.tableRows.map(t=>t.numCells)),this.numRows=this.childNodes.length,this.hasLabels=this.childNodes.reduce((t,e)=>t||e.node.isKind("mlabeledtr"),!1),this.findContainer(),this.isTop=!this.container||this.container.node.isKind("math")&&!this.container.parent,this.isTop&&(this.jax.table=this),this.getPercentageWidth();const i=this.node.attributes,r=i.get("frame");this.frame="none"!==r,this.fframe=this.frame||void 0!==i.get("data-frame-styles"),this.fLine=this.frame?.07:0,this.fSpace=this.getFrameSpacing(),this.cSpace=this.convertLengths(this.getColumnAttributes("columnspacing")),this.rSpace=this.convertLengths(this.getRowAttributes("rowspacing")),this.cLines=this.getColumnAttributes("columnlines").map(t=>"none"===t?0:.07),this.rLines=this.getRowAttributes("rowlines").map(t=>"none"===t?0:.07),this.cWidths=this.getColumnWidths(),this.adjustWideTable(),this.stretchColumns(),this.stretchRows()}getStyles(){super.getStyles();const t=this.node.attributes.get("data-frame-styles");if(!t)return;this.styles||(this.styles=new qo(""));const e=t.split(/ /);for(const t of wo.keys()){const s=e[t];"none"!==s&&this.styles.set(`border-${wo[t]}`,`.07em ${s}`)}}computeBBox(t,e=!1){const{H:s,D:i}=this.getTableData();let r,n;if(this.node.attributes.get("equalrows")){const t=this.getEqualRowHeight();r=Vo([].concat(this.rLines,this.rSpace))+t*this.numRows}else r=Vo(s.concat(i,this.rLines,this.rSpace));r+=2*(this.fLine+this.fSpace[1]),n=this.naturalWidth();const o=this.node.attributes.get("width");"auto"!==o&&(n=Math.max(this.length2em(o,0)+2*this.fLine,n));const[a,l]=this.getBBoxHD(r);t.h=a,t.d=l,t.w=n;const[c,h]=this.getBBoxLR();t.L=c,t.R=h,Hr(o)||this.setColumnPWidths()}setChildPWidths(t,e,s){const i=this.node.attributes.get("width");if(!Hr(i))return!1;this.hasLabels||(this.bbox.pwidth="",this.container.bbox.pwidth="");const{w:r,L:n,R:o}=this.bbox,a=this.node.attributes.get("data-width-includes-label"),l=Math.max(r,this.length2em(i,Math.max(e,n+r+o)))-(a?n+o:0),c=this.node.attributes.get("equalcolumns")?Array(this.numCols).fill(this.percent(1/Math.max(1,this.numCols))):this.getColumnAttributes("columnwidth",0);return this.cWidths=this.getColumnWidthsFixed(c,l),this.pWidth=this.naturalWidth(),this.isTop&&(this.bbox.w=this.pWidth),this.setColumnPWidths(),this.pWidth!==r&&this.parent.invalidateBBox(),this.pWidth!==r}getAlignShift(){return this.isTop?super.getAlignShift():[this.container.getChildAlign(this.containerI),0]}}}const Sd=function(){var t;const e=Ld(Yc);return t=class extends e{constructor(t,e,s=null){super(t,e,s),this.itable=this.html("mjx-itable"),this.labels=this.html("mjx-itable")}getAlignShift(){const t=super.getAlignShift();return this.isTop||(t[1]=0),t}toCHTML(t){const e=this.standardChtmlNodes(t);this.adaptor.append(e[0],this.html("mjx-table",{},[this.itable]));for(const t of this.childNodes)t.toCHTML([this.itable]);this.padRows(),this.handleColumnSpacing(),this.handleColumnLines(),this.handleColumnWidths(),this.handleRowSpacing(),this.handleRowLines(),this.handleRowHeights(),this.handleFrame(),this.handleWidth(),this.handleLabels(),this.handleAlign(),this.handleJustify(),this.shiftColor()}shiftColor(){const t=this.adaptor,e=t.getStyle(this.dom[0],"backgroundColor");e&&(t.setStyle(this.dom[0],"backgroundColor",""),t.setStyle(this.itable,"backgroundColor",e))}padRows(){const t=this.adaptor;for(const e of t.childNodes(this.itable))for(;t.childNodes(e).length1&&"0.4em"!==r||"0"!==r&&1===s)&&this.adaptor.setStyle(o,"paddingLeft",r),(s1&&"0.215em"!==r||s&&1===i)&&this.adaptor.setStyle(e.dom[0],"paddingTop",r),(i 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%"}},t}();function Rd(t){return class extends t{get numCells(){return this.childNodes.length}get labeled(){return!1}get tableCells(){return this.childNodes}getChild(t){return this.childNodes[t]}getChildBBoxes(){return this.childNodes.map(t=>t.getBBox())}stretchChildren(t=null){const e=[],s=this.labeled?this.childNodes.slice(1):this.childNodes;for(const t of s){const s=t.childNodes[0];s.canStretch(Mc.Vertical)&&e.push(s)}const i=e.length,r=this.childNodes.length;if(i&&r>1&&!t){let e=0,n=0;const o=i>1&&i===r;for(const t of s){const s=t.childNodes[0],i=s.stretch.dir===Mc.None;if(o||i){const{h:t,d:r}=s.getBBox(i);t>e&&(e=t),r>n&&(n=r)}}t=[e,n]}if(t)for(const s of e){const e=s.coreRScale();s.coreMO().getStretchedVariant(t.map(t=>t*e))}}get fixesPWidth(){return!1}}}function Md(t){return class extends t{get numCells(){return Math.max(0,this.childNodes.length-1)}get labeled(){return!0}get tableCells(){return this.childNodes.slice(1)}getChild(t){return this.childNodes[t+1]}getChildBBoxes(){return this.childNodes.slice(1).map(t=>t.getBBox())}}}const Id=function(){var t;const e=Rd(Yc);return(t=class extends e{toCHTML(t){super.toCHTML(t);const e=this.node.attributes.get("rowalign");"baseline"!==e&&this.adaptor.setAttribute(this.dom[0],"rowalign",e);const{h:s,d:i}=this.getBBox();this.adaptor.setStyle(this.dom[0],"height",this.em(s+i))}}).kind=En.prototype.kind,t.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"}},t}(),wd=function(){var t;const e=Md(Id);return(t=class extends e{toCHTML(t){super.toCHTML(t);const e=this.adaptor.firstChild(this.dom[0]);if(e){this.adaptor.remove(e);const t=this.node.attributes.get("rowalign"),s="baseline"!==t&&"axis"!==t?{rowalign:t}:{},i=this.html("mjx-mtr",s,[e]);this.adaptor.append(this.parent.labels,i)}}markUsed(){super.markUsed(),this.jax.wrapperUsage.add(Id.kind)}}).kind=xn.prototype.kind,t.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"}},t}();function kd(t){return class extends t{get fixesPWidth(){return!1}invalidateBBox(){this.bboxComputed=!1,this.lineBBox=[]}getWrapWidth(t){const e=this.parent.parent,s=this.parent,i=this.node.childPosition()-(s.labeled?1:0);return"number"==typeof e.cWidths[i]?e.cWidths[i]:e.getTableData().W[i]}getChildAlign(t){return this.node.attributes.get("columnalign")}}}const Od=function(){var t;const e=kd(Yc);return(t=class extends e{toCHTML(t){super.toCHTML(t);const e=this.node.attributes.get("rowalign"),s=this.node.attributes.get("columnalign");e!==this.parent.node.attributes.get("rowalign")&&this.adaptor.setAttribute(this.dom[0],"rowalign",e),"center"===s||"mlabeledtr"===this.parent.kind&&this===this.parent.childNodes[0]&&s===this.parent.parent.node.attributes.get("side")||this.adaptor.setStyle(this.dom[0],"textAlign",s),this.parent.parent.node.getProperty("useHeight")&&this.adaptor.append(this.dom[0],this.html("mjx-tstrut"))}}).kind=yn.prototype.kind,t.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"}},t}(),Dd={dx:".2em",dy:".1em",postDelay:600,clearDelay:100,hoverTimer:new Map,clearTimer:new Map,stopTimers:(t,e)=>{e.clearTimer.has(t)&&(clearTimeout(e.clearTimer.get(t)),e.clearTimer.delete(t)),e.hoverTimer.has(t)&&(clearTimeout(e.hoverTimer.get(t)),e.hoverTimer.delete(t))}};function Pd(t){return class extends t{get selected(){const t=this.node.attributes.get("selection"),e=Math.max(1,Math.min(this.childNodes.length,t))-1;return this.childNodes[e]||this.wrap(this.node.selected)}getParameters(){const t=this.node.attributes.get("data-offsets"),[e,s]=Wr(t||"");this.tipDx=this.length2em(e||Dd.dx),this.tipDy=this.length2em(s||Dd.dy)}constructor(t,e,s=null){super(t,e,s);const i=this.constructor.actions,r=this.node.attributes.get("actiontype"),[n,o]=i.get(r)||[(t,e)=>{},{}];this.action=n,this.data=o,this.getParameters()}computeBBox(t,e=!1){t.updateFrom(this.selected.getOuterBBox()),this.selected.setChildPWidths(e)}get breakCount(){return this.node.isEmbellished?this.selected.coreMO().embellishedBreakCount:this.selected.breakCount}computeLineBBox(t){return this.getChildLineBBox(this.selected,t)}}}const Bd=function(){var t;const e=Pd(Yc);return(t=class extends e{setEventHandler(t,e,s=null){(s?[s]:this.dom).forEach(s=>s.addEventListener(t,e))}Em(t){return this.em(t)}toCHTML(t){if(this.toEmbellishedCHTML(t))return;const e=this.standardChtmlNodes(t);this.selected.toCHTML(e),this.action(this,this.data)}}).kind=an.prototype.kind,t.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","line-height":0,padding:".2em",border:"1px solid #888","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"},"mjx-container [data-mjx-collapsed]":{color:"#55F"},"@media (prefers-color-scheme: dark) /* chtml maction */":{"mjx-tool > mjx-tip":{border:"1px solid #888","background-color":"#303030",color:"#E0E0E0","box-shadow":"2px 2px 5px #000"},"mjx-status":{"background-color":"#303030",color:"#E0E0E0"},"mjx-container [data-mjx-collapsed]":{color:"#88F"}}},t.actions=new Map([["toggle",[(t,e)=>{t.dom.forEach(e=>{t.adaptor.setAttribute(e,"toggle",t.node.attributes.get("selection"))});const s=t.factory.jax.math,i=t.factory.jax.document,r=t.node;t.setEventHandler("click",t=>{s.end.node||(s.start.node=s.end.node=s.typesetRoot,s.start.n=s.end.n=0),r.nextToggleSelection(),s.rerender(i,r.attributes.get("data-maction-id")?ar.ENRICHED:ar.RERENDER),t.stopPropagation()})},{}]],["tooltip",[(t,e)=>{const s=t.childNodes[1];if(s)if(s.node.isKind("mtext")){const e=s.node.getText();t.dom.forEach(s=>t.adaptor.setAttribute(s,"title",e))}else{const i=t.adaptor;for(const r of t.dom){const n=i.append(r,t.html("mjx-tool",{style:{bottom:t.Em(-t.tipDy),right:t.Em(-t.tipDx)}},[t.html("mjx-tip")]));s.toCHTML([i.firstChild(n)]),t.setEventHandler("mouseover",t=>{e.stopTimers(r,e);const s=setTimeout(()=>i.setStyle(n,"display","block"),e.postDelay);e.hoverTimer.set(r,s),t.stopPropagation()},r),t.setEventHandler("mouseout",t=>{e.stopTimers(r,e);const s=setTimeout(()=>i.setStyle(n,"display",""),e.clearDelay);e.clearTimer.set(r,s),t.stopPropagation()},r)}}},Dd]],["statusline",[(t,e)=>{const s=t.childNodes[1];if(s&&s.node.isKind("mtext")){const i=t.adaptor,r=s.node.getText();t.dom.forEach(t=>i.setAttribute(t,"statusline",r)),t.setEventHandler("mouseover",s=>{if(null===e.status){const s=i.body(i.document);e.status=i.append(s,t.html("mjx-status",{},[t.text(r)]))}s.stopPropagation()}),t.setEventHandler("mouseout",t=>{e.status&&(i.remove(e.status),e.status=null),t.stopPropagation()})}},{status:null}]]]),t}();function Fd(t){return class extends t{constructor(t,e,s=null){super(t,e,s),this.getParameters()}getParameters(){const{width:t,height:e,valign:s,src:i,index:r}=this.node.attributes.getList("width","height","valign","src","index");if(i)this.width="auto"===t?1:this.length2em(t),this.height="auto"===e?1:this.length2em(e),this.valign=this.length2em(s||"0");else{const t=String.fromCodePoint(parseInt(r)),e=this.node.factory;this.charWrapper=this.wrap(e.create("text").setText(t)),this.charWrapper.parent=this}}computeBBox(t,e=!1){this.charWrapper?t.updateFrom(this.charWrapper.getBBox()):(t.w=this.width,t.h=this.height+this.valign,t.d=-this.valign)}}}const jd=function(){var t;const e=Fd(Yc);return(t=class extends e{toCHTML(t){const e=this.standardChtmlNodes(t);if(this.charWrapper)return void this.charWrapper.toCHTML(e);const{src:s,alt:i}=this.node.attributes.getList("src","alt"),r={width:this.em(this.width),height:this.em(this.height)};this.valign&&(r.verticalAlign=this.em(this.valign));const n=this.html("img",{src:s,style:r,alt:i,title:i});this.adaptor.append(e[0],n)}}).kind=Tn.prototype.kind,t.styles={"mjx-mglyph > img":{display:"inline-block",border:0,padding:0}},t}();function _d(t){return class extends t{computeBBox(t,e=!1){if(this.childNodes.length){const{w:e,h:s,d:i}=this.childNodes[0].getBBox();t.w=e,t.h=s,t.d=i}}get breakCount(){return this.node.isEmbellished?this.coreMO().embellishedBreakCount:this.childNodes[0].breakCount}}}function Ud(t){class e extends t{constructor(t,e,s=null){super(t,e,s),this.rscale=this.getRScale()}computeBBox(t,e=!1){const s=this.node.getXML(),i=this.getHDW(s,"use","force"),{h:r,d:n,w:o}=i?this.splitHDW(i):this.measureXmlNode(s);t.w=o,t.h=r,t.d=n}getHTML(){let t=this.adaptor.clone(this.node.getXML());const e=this.getFontStyles();return(this.getHDW(t,"force")||1!==this.jax.options.scale)&&(t=this.addHDW(t,e)),this.html("mjx-html",{variant:this.parent.variant,style:e},[t])}getHDW(t,e,s=e){const i=this.jax.options.htmlHDW,r=this.adaptor.getAttribute(t,"data-mjx-hdw");return!r||i!==e&&i!==s?null:r}splitHDW(t){const e=1/this.metrics.scale,[s,i,r]=Wr(t).map(t=>this.length2em(t||"0")*e);return{h:s,d:i,w:r}}getFontStyles(){var t;const e=this.adaptor,s=this.metrics;return{"font-family":(null===(t=this.parent.styles)||void 0===t?void 0:t.get("font-family"))||s.family||e.fontFamily(e.parent(this.jax.math.start.node))||"initial","font-size":this.jax.fixed(s.em*this.rscale)+"px"}}measureXmlNode(t){const e=this.adaptor,s=this.html("mjx-xml-block",{style:{display:"inline-block"}},[e.clone(t)]),i=this.html("mjx-baseline",{style:{display:"inline-block",width:0,height:0}}),r=this.getFontStyles(),n=this.html("mjx-measure-xml",{style:r},[i,s]),o=this.jax.container;e.append(e.parent(this.jax.math.start.node),o),e.append(o,n);const a=this.metrics,l=a.em*a.scale*this.rscale,{left:c,right:h,bottom:d,top:u}=e.nodeBBox(s),p=(h-c)/l,m=(e.nodeBBox(i).top-u)/l,f=(d-u)/l-m;return e.remove(o),e.remove(n),{w:p,h:m,d:f}}getStyles(){}getScale(){}getVariant(){}}return e.autoStyle=!1,e.styles={"mjx-measure-xml":{position:"absolute",left:0,top:0,display:"inline-block","line-height":"normal","white-space":"normal"},"mjx-html":{display:"inline-block","line-height":"normal","text-align":"initial","white-space":"initial"},"mjx-html-holder":{display:"block",position:"absolute",top:0,left:0,bottom:0,right:0}},e}const Hd=function(){var t;const e=_d(Yc);return(t=class extends e{toCHTML(t){if(this.toEmbellishedCHTML(t))return;const e=this.standardChtmlNodes(t);this.childNodes.length&&this.childNodes[0].toCHTML(e)}}).kind=Cn.prototype.kind,t}(),Wd=function(){var t;return(t=class extends Yc{toCHTML(t){super.toCHTML(t)}computeBBox(){return this.bbox}}).kind=Ln.prototype.kind,t}(),zd=function(){var t;return(t=class extends Yc{}).kind=An.prototype.kind,t.styles={"mjx-annotation-xml":{"font-family":"initial","line-height":"normal"}},t}(),qd=function(){var t;const e=Ud(Yc);return(t=class extends e{toCHTML(t){this.markUsed(),this.dom=[this.adaptor.append(t[0],this.getHTML())]}addHDW(t,e){const s=this.jax.options.scale,{h:i,d:r,w:n}=this.bbox,o=s*this.metrics.scale;return e.width=this.em(n*o),e.height=this.em((i+r)*o),e["vertical-align"]=this.em(-r*o),e.position="relative",this.html("mjx-html-holder",{style:{transform:`scale(${this.jax.fixed(s)})`,"transform-origin":"top left"}},[t])}}).kind=Sr.prototype.kind,t}();function Vd(t){return class extends t{computeBBox(t,e=!1){super.computeBBox(t,e),this.childNodes[0]&&this.childNodes[0].bbox.ic&&(t.ic=this.childNodes[0].bbox.ic)}}}const Xd=function(){var t;const e=Vd(Yc);return(t=class extends e{toCHTML(t){super.toCHTML(t),this.dom.forEach(t=>this.adaptor.setAttribute(t,"texclass",gr[this.node.texClass]))}}).kind=Sn.prototype.kind,t}();function Gd(t){return class extends t{remappedText(t,e){const s=this.parent.stretch.c;return s?[s]:this.parent.remapChars(this.unicodeChars(t,e))}computeBBox(t,e=!1){const s=this.parent.variant,i=this.node.getText();if("-explicitFont"===s){const e=this.jax.getFontData(this.parent.styles),{w:r,h:n,d:o}=this.jax.measureText(i,s,e);t.h=n,t.d=o,t.w=r}else{const e=this.remappedText(i,s);let r="";t.empty();for(let i=0;i1&&(t.sk=0),t.clean()}}addUtextBBox(t,e,s){if(e){const{h:i,d:r,w:n}=this.jax.measureText(e,s);this.updateBBox(t,i,r,n)}return""}updateBBox(t,e,s,i){t.w+=i,e>t.h&&(t.h=e),s>t.d&&(t.d=s)}getStyles(){}getVariant(){}getScale(){}getSpace(){}}}const Jd=function(){var t;const e=Gd(Yc);return t=class extends e{toCHTML(t){this.markUsed();const e=t[0],s=this.adaptor,i=this.parent.variant,r=this.node.getText();if(0===r.length)return;const n=this.getBBox();if("-explicitFont"===i)s.append(e,this.jax.unknownText(r,i,n.w));else{let t="";const o=this.remappedText(r,i),a=o.length>1?this.em(this.parent.getBBox().h):"",l=o.length;for(let r=0;r mjx-math.NCM-N[breakable] > *':{"font-family":"MJX-NCM-ZERO, MJX-NCM-N"},".NCM-N":{"font-family":"MJX-NCM-ZERO, MJX-NCM-N"},".NCM-B":{"font-family":"MJX-NCM-ZERO, MJX-NCM-B"},".NCM-I":{"font-family":"MJX-NCM-ZERO, MJX-NCM-I"},".NCM-BI":{"font-family":"MJX-NCM-ZERO, MJX-NCM-BI"},".NCM-DS":{"font-family":"MJX-NCM-ZERO, MJX-NCM-DS"},".NCM-F":{"font-family":"MJX-NCM-ZERO, MJX-NCM-F"},".NCM-FB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-FB"},".NCM-SS":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SS"},".NCM-SSB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SSB"},".NCM-SSI":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SSI"},".NCM-SSBI":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SSBI"},".NCM-M":{"font-family":"MJX-NCM-ZERO, MJX-NCM-M"},".NCM-SO":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SO"},".NCM-LO":{"font-family":"MJX-NCM-ZERO, MJX-NCM-LO"},".NCM-S3":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S3"},".NCM-S4":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S4"},".NCM-S5":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S5"},".NCM-S6":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S6"},".NCM-S7":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S7"},".NCM-MI":{"font-family":"MJX-NCM-ZERO, MJX-NCM-MI"},".NCM-C":{"font-family":"MJX-NCM-ZERO, MJX-NCM-C"},".NCM-CB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-CB"},".NCM-OS":{"font-family":"MJX-NCM-ZERO, MJX-NCM-OS"},".NCM-OB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-OB"},".NCM-V":{"font-family":"MJX-NCM-ZERO, MJX-NCM-V"},".NCM-LT":{"font-family":"MJX-NCM-ZERO, MJX-NCM-LT"},".NCM-RB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-RB"},".NCM-EM":{"font-family":"MJX-NCM-ZERO, MJX-NCM-EM"},".NCM-B-a":{"font-family":"MJX-NCM-ZERO, MJX-NCM-B-a"},".NCM-U":{"font-family":"MJX-NCM-ZERO, MJX-NCM-U"},".NCM-U-a":{"font-family":"MJX-NCM-ZERO, MJX-NCM-U-a"},".NCM-S":{"font-family":"MJX-NCM-ZERO, MJX-NCM-S"},".NCM-SB":{"font-family":"MJX-NCM-ZERO, MJX-NCM-SB"}}),tu.defaultFonts=Object.assign(Object.assign({},ih.defaultFonts),{"@font-face /* MJX-NCM-ZERO */":{"font-family":"MJX-NCM-ZERO",src:'url("%%URL%%/mjx-ncm-zero.woff2") format("woff2")'},"@font-face /* MJX-BRK */":{"font-family":"MJX-BRK",src:'url("%%URL%%/mjx-ncm-brk.woff2") format("woff2")'},"@font-face /* MJX-NCM-N */":{"font-family":"MJX-NCM-N",src:'url("%%URL%%/mjx-ncm-n.woff2") format("woff2")'},"@font-face /* MJX-NCM-B */":{"font-family":"MJX-NCM-B",src:'url("%%URL%%/mjx-ncm-b.woff2") format("woff2")'},"@font-face /* MJX-NCM-I */":{"font-family":"MJX-NCM-I",src:'url("%%URL%%/mjx-ncm-i.woff2") format("woff2")'},"@font-face /* MJX-NCM-BI */":{"font-family":"MJX-NCM-BI",src:'url("%%URL%%/mjx-ncm-bi.woff2") format("woff2")'},"@font-face /* MJX-NCM-DS */":{"font-family":"MJX-NCM-DS",src:'url("%%URL%%/mjx-ncm-ds.woff2") format("woff2")'},"@font-face /* MJX-NCM-F */":{"font-family":"MJX-NCM-F",src:'url("%%URL%%/mjx-ncm-f.woff2") format("woff2")'},"@font-face /* MJX-NCM-FB */":{"font-family":"MJX-NCM-FB",src:'url("%%URL%%/mjx-ncm-fb.woff2") format("woff2")'},"@font-face /* MJX-NCM-SS */":{"font-family":"MJX-NCM-SS",src:'url("%%URL%%/mjx-ncm-ss.woff2") format("woff2")'},"@font-face /* MJX-NCM-SSB */":{"font-family":"MJX-NCM-SSB",src:'url("%%URL%%/mjx-ncm-ssb.woff2") format("woff2")'},"@font-face /* MJX-NCM-SSI */":{"font-family":"MJX-NCM-SSI",src:'url("%%URL%%/mjx-ncm-ssi.woff2") format("woff2")'},"@font-face /* MJX-NCM-SSBI */":{"font-family":"MJX-NCM-SSBI",src:'url("%%URL%%/mjx-ncm-ssbi.woff2") format("woff2")'},"@font-face /* MJX-NCM-M */":{"font-family":"MJX-NCM-M",src:'url("%%URL%%/mjx-ncm-m.woff2") format("woff2")'},"@font-face /* MJX-NCM-SO */":{"font-family":"MJX-NCM-SO",src:'url("%%URL%%/mjx-ncm-so.woff2") format("woff2")'},"@font-face /* MJX-NCM-LO */":{"font-family":"MJX-NCM-LO",src:'url("%%URL%%/mjx-ncm-lo.woff2") format("woff2")'},"@font-face /* MJX-NCM-S3 */":{"font-family":"MJX-NCM-S3",src:'url("%%URL%%/mjx-ncm-s3.woff2") format("woff2")'},"@font-face /* MJX-NCM-S4 */":{"font-family":"MJX-NCM-S4",src:'url("%%URL%%/mjx-ncm-s4.woff2") format("woff2")'},"@font-face /* MJX-NCM-S5 */":{"font-family":"MJX-NCM-S5",src:'url("%%URL%%/mjx-ncm-s5.woff2") format("woff2")'},"@font-face /* MJX-NCM-S6 */":{"font-family":"MJX-NCM-S6",src:'url("%%URL%%/mjx-ncm-s6.woff2") format("woff2")'},"@font-face /* MJX-NCM-S7 */":{"font-family":"MJX-NCM-S7",src:'url("%%URL%%/mjx-ncm-s7.woff2") format("woff2")'},"@font-face /* MJX-NCM-MI */":{"font-family":"MJX-NCM-MI",src:'url("%%URL%%/mjx-ncm-mi.woff2") format("woff2")'},"@font-face /* MJX-NCM-C */":{"font-family":"MJX-NCM-C",src:'url("%%URL%%/mjx-ncm-c.woff2") format("woff2")'},"@font-face /* MJX-NCM-CB */":{"font-family":"MJX-NCM-CB",src:'url("%%URL%%/mjx-ncm-cb.woff2") format("woff2")'},"@font-face /* MJX-NCM-OS */":{"font-family":"MJX-NCM-OS",src:'url("%%URL%%/mjx-ncm-os.woff2") format("woff2")'},"@font-face /* MJX-NCM-OB */":{"font-family":"MJX-NCM-OB",src:'url("%%URL%%/mjx-ncm-ob.woff2") format("woff2")'},"@font-face /* MJX-NCM-V */":{"font-family":"MJX-NCM-V",src:'url("%%URL%%/mjx-ncm-v.woff2") format("woff2")'},"@font-face /* MJX-NCM-LT */":{"font-family":"MJX-NCM-LT",src:'url("%%URL%%/mjx-ncm-lt.woff2") format("woff2")'},"@font-face /* MJX-NCM-RB */":{"font-family":"MJX-NCM-RB",src:'url("%%URL%%/mjx-ncm-rb.woff2") format("woff2")'},"@font-face /* MJX-NCM-EM */":{"font-family":"MJX-NCM-EM",src:'url("%%URL%%/mjx-ncm-em.woff2") format("woff2")'},"@font-face /* MJX-NCM-B-a */":{"font-family":"MJX-NCM-B-a",src:'url("%%URL%%/mjx-ncm-b-a.woff2") format("woff2")'},"@font-face /* MJX-NCM-U */":{"font-family":"MJX-NCM-U",src:'url("%%URL%%/mjx-ncm-u.woff2") format("woff2")'},"@font-face /* MJX-NCM-U-a */":{"font-family":"MJX-NCM-U-a",src:'url("%%URL%%/mjx-ncm-u-a.woff2") format("woff2")'},"@font-face /* MJX-NCM-S */":{"font-family":"MJX-NCM-S",src:'url("%%URL%%/mjx-ncm-s.woff2") format("woff2")'},"@font-face /* MJX-NCM-SB */":{"font-family":"MJX-NCM-SB",src:'url("%%URL%%/mjx-ncm-sb.woff2") format("woff2")'}}),tu.dynamicFiles=ih.defineDynamicFiles([["latin",{normal:[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7835],7838,[7840,7929],11377]}],["latin-b",{bold:[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["latin-i",{italic:[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929]]}],["latin-bi",{"bold-italic":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929]]}],["double-struck",{normal:[8450,8461,8469,8473,8474,8477,8484,[8508,8512],[8517,8521],120120,120121,[120123,120126],[120128,120132],120134,[120138,120144],[120146,120171],[120792,120801]],"double-struck":[305,567]}],["fraktur",{normal:[8460,8465,8476,8488,8493,120068,120069,[120071,120074],[120077,120084],[120086,120092],[120094,120119],[120172,120223]],fraktur:[305,567],"bold-fraktur":[305,567]}],["script",{normal:[8458,8459,8464,8466,8467,8472,8475,8492,[8495,8497],8499,8500,119964,119966,119967,119970,119973,119974,[119977,119980],[119982,119993],119995,[119997,120003],[120005,120067]],script:[],"bold-script":[]}],["sans-serif",{normal:[[8513,8516],[120224,120431],[120662,120777],[120802,120821]],"sans-serif":[[32,47],[58,64],[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[713,715],[728,730],732,[768,776],778,780,[913,929],[931,937],[945,969],977,978,981,982,1008,1009,[1012,1014],[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734],"bold-sans-serif":[32,33,[35,47],58,59,61,63,64,[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[713,715],[728,730],732,[768,776],778,780,978,1014,[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734],"sans-serif-italic":[[32,64],[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[713,715],[728,730],732,[768,776],778,780,[913,929],[931,937],[945,969],977,978,981,982,1008,1009,[1012,1014],[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734],"sans-serif-bold-italic":[32,33,[35,59],61,63,64,[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[713,715],[728,730],732,[768,776],778,780,978,1014,[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734]}],["sans-serif-r",{"sans-serif":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["sans-serif-b",{"bold-sans-serif":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["sans-serif-i",{"sans-serif-italic":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["sans-serif-bi",{"sans-serif-bold-italic":[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["sans-serif-ex",{"sans-serif":[161,162,164,166,[169,171],173,174,184,[186,191],[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879],3647,7620,7621,7624,7625,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9474,9553,9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59959,59962,59966,59970,59973,60163,60164,60168,60175,60177,60178,60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64260],65126],"bold-sans-serif":[161,162,164,166,[169,171],173,174,184,[186,191],[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879],3647,7620,7621,7624,7625,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9474,9553,9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64260],65126],"sans-serif-italic":[161,162,164,166,[169,171],173,174,184,[186,191],[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879],3647,7620,7621,7624,7625,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9474,9553,9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64260],65126],"sans-serif-bold-italic":[161,162,164,166,[169,171],173,174,184,[186,191],[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,879],3647,7620,7621,7624,7625,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9474,9553,9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64260],65126]}],["monospace",{normal:[[120432,120483],[120822,120831]],monospace:[[32,47],[58,64],[91,96],[123,126],160,163,165,167,168,172,[175,177],[180,183],215,240,247,305,567,710,711,[728,730],732,[768,776],778,780,[913,929],[931,937],[945,969],977,978,981,982,1008,1009,[1012,1014],[8208,8212],8214,8216,8217,8220,8221,8224,8225,8230,8260,8364,8486,8487,[8592,8595],8722,8734]}],["monospace-l",{monospace:[[192,214],[216,239],[241,246],[248,304],[306,566],[568,591],[7680,7699],[7704,7707],[7710,7719],[7722,7755],[7764,7779],[7784,7799],[7804,7833],7835,7838,[7840,7929],11377]}],["monospace-ex",{monospace:[161,162,164,166,[169,171],173,174,184,[186,191],[592,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,995],1010,1011,[1015,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309],3647,7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575,7620,7621,7624,7625,[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,[8592,8595],8730,8738,8960,9001,9002,9250,9251,9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,[9552,9579],9702,9773,9792,9834,9901,9902,9906,10013,10214,10215,11800,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198,[64256,64262],65126]}],["calligraphic",{"-tex-calligraphic":[[65,90]],"-tex-bold-calligraphic":[[65,90]]}],["math",{normal:[8714,8717,8731,8732,8762,8763,8782,8783,[8785,8787],[8790,8796],8798,8844,[8886,8889],[8891,8895],8903,[8912,8929],[8932,8937],[8946,8959],[10176,10199],[10202,10204],[10207,10213],[10625,10646],[10649,10740],10742,[10746,10751],10762,10763,[10781,10798],[10800,10814],[10816,10876],[10879,10884],[10893,10900],[10903,10926],[10939,10948],[10951,10954],[10957,10973],[10988,10993],[10998,11003],[11005,11007]]}],["symbols",{normal:[127,161,162,164,166,[169,171],173,174,178,179,[185,191],3647,8215,8218,8219,8222,8223,[8226,8229],8233,8240,8241,[8248,8259],[8261,8278],[8280,8286],8319,8320,8353,8358,[8361,8363],8369,8370,8448,8449,[8451,8454],8456,8457,8468,8470,8471,[8478,8483],8485,8489,8494,[8505,8507],[8522,8527],[8960,8966],[8977,8984],8986,8987,[8996,9e3],[9003,9114],9142,[9146,9165],9167,[9169,9179],[9186,9203],[9208,9215],9250,9251,11159,11193,11209,[11216,11241],[11248,11263],11800,12306,12310,12311,12336,[64256,64262],65126,65279]},[8215]],["symbols-b-i",{bold:[161,162,164,166,[169,171],173,174,[186,191],3647,8218,8219,8222,8223,8226,8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8319,8320,8353,8358,[8361,8363],8369,8370,8451,8470,8471,8478,8480,8482,8494,8960,9250,9251,11800,[64256,64262],65126],italic:[[161,167],[169,174],177,[181,183],[186,191],215,240,247,3647,8218,8219,[8222,8226],8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8320,8353,8358,8361,8363,8369,8370,8451,8470,8471,8478,8480,8482,8494,8960,9250,9251,11800,[64256,64262],65126],"bold-italic":[[161,167],[169,174],177,[181,183],[186,191],215,240,247,3647,8218,8219,[8222,8226],8233,8240,8241,[8249,8251],8253,8255,8256,8261,8262,8274,8276,8320,8353,8358,[8361,8363],8369,8370,8451,8470,8471,8478,8480,8482,8494,8960,9250,9251,11800,[64256,64262],65126]}],["greek",{normal:[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[11392,11507],[11513,11519]],bold:[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,987],[990,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[11392,11507],[11513,11519]],italic:[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[11392,11507],[11513,11519]],"bold-italic":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[11392,11507],[11513,11519]]}],["greek-ss",{"sans-serif":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190]],"bold-sans-serif":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8121],[8123,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190]],"sans-serif-italic":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190]],"sans-serif-bold-italic":[[880,887],[890,895],[900,906],908,[910,912],[938,944],[970,976],979,980,[983,1007],1010,1011,[1015,1023],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],8025,8027,8029,[8031,8061],[8064,8116],[8118,8121],[8123,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190]]}],["cyrillic",{normal:[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],bold:[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],italic:[[1024,1143],[1146,1158],[1160,1225],[1227,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],"bold-italic":[[1024,1143],[1146,1158],[1160,1225],[1227,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]]}],["cyrillic-ss",{"sans-serif":[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],"bold-sans-serif":[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],"sans-serif-italic":[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]],"sans-serif-bold-italic":[[1024,1143],[1146,1158],[1160,1230],[1232,1273],[1276,1279],1298,1299,[1306,1309]]}],["phonetics",{normal:[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],bold:[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],italic:[[592,685],687],"bold-italic":[[592,687]]}],["phonetics-ss",{"sans-serif":[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],"bold-sans-serif":[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],"sans-serif-italic":[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575],"sans-serif-bold-italic":[[592,687],7424,7431,7434,7435,7437,7448,7449,7452,[7491,7499],7501,[7503,7507],[7510,7512],7514,7515,7517,7518,7520,7521,7544,[7568,7571],7575]}],["hebrew",{normal:[[1425,1479],[1488,1514],[1519,1525],1527,[64285,64335]],bold:[[1425,1479],[1488,1515],[1519,1525],1527,[64285,64335]],italic:[[1425,1479],[1488,1514],[1519,1525],1527,[64285,64335]],"bold-italic":[[1425,1479],[1488,1515],[1519,1525],1527,[64285,64335]]}],["devanagari",{normal:[[2304,2431]],bold:[],italic:[],"bold-italic":[]}],["cherokee",{normal:[[5024,5109],[5112,5117]],bold:[[5024,5109],[5112,5117]],italic:[[5024,5115]],"bold-italic":[[5024,5115]]}],["arabic",{normal:[[126464,126498],126500,126503,[126505,126514],[126516,126519],126521,126523,126530,126535,126537,126539,[126541,126543],126545,126546,126548,126551,126553,126555,126557,126559,126561,126562,126564,[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],126704,126705],bold:[],italic:[],"bold-italic":[]}],["braille-d",{normal:[[10240,10495]]}],["braille",{"sans-serif":[[10240,10495]]}],["arrows",{normal:[8604,8605,8607,8609,8613,8615,8616,8621,[8623,8629],8632,8633,[8662,8665],[8668,8671],[8678,8692],[8695,8703],9166,10145,[10224,10228],10239,[10496,10505],[10508,10569],10572,10573,10575,10577,10580,10581,10584,10585,10588,10589,[10592,10601],[10608,10619],[11008,11026],[11056,11087],[11098,11123],[11126,11157],[11160,11192],[11244,11247]],"-largeop":[8593,8595,[8597,8603],[8606,8611],8613,8615,[8617,8622],[8624,8627],8630,8631,[8636,8655],8657,8659,[8661,8667],[8678,8681],8691,8693,8694,[11012,11015],11020,11021,11057],"-lf-tp":[[8678,8681],10503,11013,11014],"-rt-bt":[[8678,8681],10502,11015,11020],"-ex-md":[8678,8679,11013,11014]},[8607,8609,8613,8615,8621,8622,[8624,8627],[8662,8665],8668,8669,[8678,8681],8691,10145,10237,10238,10502,10503,10572,10573,10575,10577,10588,10589,10592,10593,[11012,11015],11020,11021,11057]],["marrows",{normal:[[129024,129035],[129040,129095],[129104,129113],[129120,129159],[129168,129197],129200,129201]}],["accents",{normal:[184,[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,879],7620,7621,7624,7625,[8403,8405],8408,[8413,8415],[8420,8427],8432],"-smallop":[785,[812,816],818,819,831,845],"-largeop":[785,[812,816]],"-size3":[785,[812,816]],"-size4":[785,[812,816]],"-size5":[785,[812,816]],"-size6":[785,[812,816]],"-size7":[785,[812,816]],"-ex-md":[818,819,831,845]},[785,[812,816],818,819,831,845,8425]],["accents-b-i",{bold:[184,[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879],7620,7621,7624,7625],italic:[184,[688,700],[702,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879]],"bold-italic":[184,[688,709],712,716,[718,727],731,[733,766],777,779,[781,823],[825,846],[848,879]]}],["shapes",{normal:[8962,[8998,9e3],9003,[9211,9214],[9472,9631],[9634,9641],[9644,9649],9672,9673,[9676,9678],[9680,9701],[9703,9710],[9712,9719],9728,9733,9734,9737,9761,9773,[9785,9790],9792,9794,[9824,9831],[9833,9835],[9837,9839],9854,[9856,9865],9893,[9898,9902],9906,10003,10013,10016,10026,10038,10045,10098,10099,10139,10145,[11026,11055],[11088,11097],[11194,11208],[11210,11215],11242,11243],bold:[9474,9553,9773,9792,9834,9901,9902,9906,10013],italic:[9773,9834,9901,9902,10013],"bold-italic":[9773,9834,9901,9902,10013]}],["mshapes",{normal:[[128896,128984],[128992,129003]]}],["variants",{"-tex-variant":[34,39,42,96,126,170,176,178,179,185,186,8212,8289,8304,8305,[8308,8334]]}],["PUA",{normal:[[57344,57395],[57409,57458],[59264,59274],59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198],bold:[59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,[61761,61766],[61771,61788],[61791,61797],61800,[61804,61810],61813,[61817,61819],[61822,61824],61826,61828,61829,[61832,61839],61842,61850,61854,61855,61857,61859,61860,[61863,61877],62082,62083,62110,62113,62116,[62119,62121],62124,62126,62127,[62560,62568],[62570,62578],63166,[63187,63190],63198],italic:[59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,61867,61868,[61873,61877],62082,62083,62110,62113,62116,62119,62120,[62560,62568],[62570,62578],63166,63172,[63174,63176],[63187,63190],63198],"bold-italic":[59395,[59908,59910],59913,59915,59917,59920,59927,59930,59932,59934,59935,59942,59946,59948,59951,59957,59962,59966,59970,59973,60163,60164,60168,[60175,60178],60182,60185,60190,60191,60200,60201,60203,60209,60213,60214,60218,60219,60224,60232,60233,60237,60257,60259,60261,60270,60271,[60424,60430],60432,60433,61699,61700,61705,[61719,61726],[61729,61731],[61734,61741],61743,[61747,61752],61757,61867,61868,[61873,61877],62082,62083,62110,62113,62116,62119,62120,[62560,62568],[62570,62578],63166,63172,[63174,63176],[63187,63190],63198]}]]);const eu={fontName:"mathjax-newcm",DefaultFont:tu},su=eu.fontName,iu=eu.DefaultFont;class ru extends zc{constructor(t={}){super(t,Yd,iu),this.chtmlStyles=null,this.font.adaptiveCSS(this.options.adaptiveCSS),this.wrapperUsage=new sh}addExtension(t,e=""){const s=super.addExtension(t,e);return s.length&&this.options.adaptiveCSS&&this.chtmlStyles&&this.adaptor.insertRules(this.chtmlStyles,s),[]}escaped(t,e){return this.setDocument(e),this.html("span",{},[this.text(t.math)])}styleSheet(t){if(this.chtmlStyles){const t=new ao;return this.options.adaptiveCSS&&(this.addWrapperStyles(t),this.updateFontStyles(t)),t.addStyles(this.font.updateDynamicStyles()),this.adaptor.insertRules(this.chtmlStyles,t.getStyleRules()),this.chtmlStyles}const e=this.chtmlStyles=super.styleSheet(t);return this.adaptor.setAttribute(e,"id",ru.STYLESHEETID),this.wrapperUsage.update(),e}updateFontStyles(t){t.addStyles(this.font.updateStyles({}))}addWrapperStyles(t){if(this.options.adaptiveCSS)for(const e of this.wrapperUsage.update()){const s=this.factory.getNodeClass(e);s&&this.addClassStyles(s,t)}else super.addWrapperStyles(t)}addClassStyles(t,e){const s=t;s.autoStyle&&"unknown"!==s.kind&&e.addStyles({["mjx-"+s.kind]:{display:"inline-block","text-align":"left"}}),this.wrapperUsage.add(s.kind),super.addClassStyles(t,e)}insertStyles(t){this.chtmlStyles&&this.adaptor.insertRules(this.chtmlStyles,new ao(t).getStyleRules())}processMath(t,e){t.toCHTML([e])}clearCache(){this.styleJson.clear(),this.font.clearCache(),this.wrapperUsage.clear(),this.chtmlStyles=null}reset(){this.clearCache()}unknownText(t,e,s=null){const i={},r=100/this.math.metrics.scale;if(100!==r&&(i["font-size"]=this.fixed(r,1)+"%",i.padding=yo(75/r)+" 0 "+yo(20/r)+" 0"),"-explicitFont"!==e){const s=_r(t);(1!==s.length||s[0]<119808||s[0]>120831)&&this.cssFontStyles(this.font.getCssFont(e),i)}return null!==s&&(i.width=this.fixed(s*this.math.metrics.scale)+"em"),this.html("mjx-utext",{variant:e,style:i},[this.text(t)])}measureTextNode(t){const e=this.adaptor,s=e.clone(t);e.setStyle(s,"font-family",e.getStyle(s,"font-family").replace(/MJXZERO, /g,""));const i=this.math.metrics.em,r={position:"absolute",top:0,left:0,"white-space":"nowrap","font-size":this.fixed(i,3)+"px"},n=this.html("mjx-measure-text",{style:r},[s]);e.append(e.parent(this.math.start.node),this.container),e.append(this.container,n);const o=e.nodeSize(s,i)[0];return e.remove(this.container),e.remove(n),{w:o,h:.75,d:.2}}}function nu(t,e){const s={};for(const i of Object.keys(t)){const r=t[i];for(const t of Object.keys(r)){s[t]||(s[t]={});const n=r[t];if(i)for(const t of Object.keys(n)){const s=n[parseInt(t)];s[3]||(s[3]={}),e?s[3].ff=e+"-"+i:s[3].f=i}Object.assign(s[t],n)}}return s}function ou(t,e,s,i=""){const r="https://cdn.jsdelivr.net"===(MathJax.config.loader?.paths?.fonts||"").substring(0,24)?"@%%VERSION%%":"",n=s.fontPath||`[fonts]/%%FONT%%-font${i}${r}`,o=t.match(/^[a-z]+:/)?(t.match(/[^/:\\]*$/)||[e])[0]:t;return ci(MathJax.config.loader,"paths",{[o+i]:o===t?n.replace(/%%FONT%%/g,t).replace(/%%VERSION%%/g,to.version):t}),`[${o}${i}]`}ru.NAME="CHTML",ru.OPTIONS=Object.assign(Object.assign({},zc.OPTIONS),{adaptiveCSS:!0,matchFontHeight:!0}),ru.commonStyles=Object.assign(Object.assign({},zc.commonStyles),{'mjx-container[jax="CHTML"]':{"white-space":"nowrap"},[["mjx-mo > mjx-c","mjx-mi > mjx-c","mjx-mn > mjx-c","mjx-ms > mjx-c","mjx-mtext > mjx-c"].join(", ")]:{"clip-path":"padding-box polygon("+["-1em -2px","calc(100% + 1em) -2px","calc(100% + 1em) calc(100% + 2px)","-1em calc(100% + 2px)"].join(", ")+")"},"mjx-stretchy-h":{"clip-path":"padding-box polygon(0 -2px, 100% -2px, 100% calc(100% + 2px), 0 calc(100% + 2px))"},"mjx-stretchy-v":{"clip-path":"padding-box polygon(-2px 0, calc(100% + 2px) 0, calc(100% + 2px) 100%, -2px 100%)"},'mjx-container [space="1"]':{"margin-left":".111em"},'mjx-container [space="2"]':{"margin-left":".167em"},'mjx-container [space="3"]':{"margin-left":".222em"},'mjx-container [space="4"]':{"margin-left":".278em"},'mjx-container [space="5"]':{"margin-left":".333em"},'mjx-container [rspace="1"]':{"margin-right":".111em"},'mjx-container [rspace="2"]':{"margin-right":".167em"},'mjx-container [rspace="3"]':{"margin-right":".222em"},'mjx-container [rspace="4"]':{"margin-right":".278em"},'mjx-container [rspace="5"]':{"margin-right":".333em"},'mjx-container [size="s"]':{"font-size":"70.7%"},'mjx-container [size="ss"]':{"font-size":"50%"},'mjx-container [size="Tn"]':{"font-size":"60%"},'mjx-container [size="sm"]':{"font-size":"85%"},'mjx-container [size="lg"]':{"font-size":"120%"},'mjx-container [size="Lg"]':{"font-size":"144%"},'mjx-container [size="LG"]':{"font-size":"173%"},'mjx-container [size="hg"]':{"font-size":"207%"},'mjx-container [size="HG"]':{"font-size":"249%"},'mjx-container [width="full"]':{width:"100%"},"mjx-box":{display:"inline-block"},"mjx-block":{display:"block"},"mjx-itable":{display:"inline-table"},"mjx-row":{display:"table-row"},[["cell","base","under","over","den"].map(t=>`mjx-row > mjx-${t}`).join(", ")]:{display:"table-cell"},"mjx-container [inline-breaks]":{display:"inline"},"mjx-container .mjx-selected":{outline:"2px solid black"},"@media (prefers-color-scheme: dark)":{"mjx-container .mjx-selected":{outline:"2px solid #C8C8C8"}},"mjx-mtext":{display:"inline-block"},"mjx-mstyle":{display:"inline-block"},"mjx-merror":{display:"inline-block",color:"red","background-color":"yellow"},"mjx-mphantom":{visibility:"hidden"}}),ru.STYLESHEETID="MJX-CHTML-styles",MathJax.loader&&MathJax.loader.checkVersion("output/chtml",ri,"output"),hi({_:{output:{chtml_ts:Ds,chtml:{DefaultFont:Os,DynamicFonts:Ps,FontData:ke,Notation:Ge,Usage:we,Wrapper:Le,WrapperFactory:ks,Wrappers_ts:ws,Wrappers:{HtmlNode:Is,TeXAtom:Ss,TextNode:Ms,maction:ys,math:Re,menclose:Je,mfenced:Qe,mfrac:ts,mglyph:vs,mi:Ie,mmultiscripts:us,mn:Be,mo:De,mpadded:qe,mroot:rs,mrow:$e,ms:je,mspace:We,msqrt:ss,msubsup:ls,mtable:ms,mtd:Es,mtext:Ue,mtr:gs,munderover:hs,scriptbase:as,semantics:As}},common_ts:Te,common:{Direction:xe,FontData:ye,LineBBox:Ne,LinebreakVisitor:ve,Notation:Ve,Wrapper:Ae,WrapperFactory:Ce,Wrappers:{TeXAtom:Ls,TextNode:Rs,XmlNode:Cs,maction:xs,math:Se,menclose:Xe,mfenced:Ye,mfrac:Ze,mglyph:Ns,mi:Me,mmultiscripts:ds,mn:Pe,mo:Oe,mpadded:ze,mroot:is,mrow:Ke,ms:Fe,mspace:He,msqrt:es,msubsup:ns,mtable:ps,mtd:bs,mtext:_e,mtr:fs,munderover:cs,scriptbase:os,semantics:Ts}}}}});const au={config(t,e,s,i){if(MathJax.loader){ci(MathJax.config,t,MathJax.config.output||{});let e=MathJax.config[t],r=e.font||e.fontData||s;"string"!=typeof r&&(e.fontData=r,e.font=r=r.NAME),"["!==r.charAt(0)&&(r=ou(r,t,e));const n=r.substring(1,r.length-1),o=function(t,e){const s=[];for(const i of e.fontExtensions||[]){const r=`${ou(i,t,e,"-extension")}/${t}`;s.push(r)}return s}(t,e);if(o.length&&MathJax.loader.addPackageData(`${r}/${t}`,{extraLoads:o}),n===s&&i){const e=MathJax.config.loader[`${r}/${t}`]?.extraLoads;e&&MathJax.loader.addPackageData(`output/${t}`,{extraLoads:e}),hi({_:{output:{fonts:{[n]:{[t+"_ts"]:{[i.NAME+"Font"]:i}}}}}}),ci(MathJax,"config",{output:{font:r},[t]:{fontData:i,dynamicPrefix:`${r}/${t}/dynamic`}}),"chtml"===t&&ci(MathJax.config,t,{fontURL:fi.resolvePath(`${r}/${t}/woff2`,!1)})}else MathJax.loader.addPackageData(`output/${t}`,{extraLoads:[`${r}/${t}`]})}MathJax.startup&&(MathJax.startup.registerConstructor(t,e),MathJax.startup.useOutput(t))},loadFont:(t,e,s,i)=>MathJax.loader?(i&&MathJax.loader.preLoaded(`[${s}]/${e}`),fi.loadPromise(`output/${e}`).then(t)):t};var lu;au.config("chtml",ru,su,iu),function(t){t[t.RETURN=13]="RETURN",t[t.ESCAPE=27]="ESCAPE",t[t.SPACE=32]="SPACE",t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN"}(lu||(lu={}));const cu="click",hu="dblclick",du="mousedown",uu="mouseup",pu="mouseover",mu="mouseout",fu="selectstart";class gu{constructor(){this.bubble=!1}bubbleKey(){this.bubble=!0}keydown(t){switch(t.keyCode){case lu.ESCAPE:this.escape(t);break;case lu.RIGHT:this.right(t);break;case lu.LEFT:this.left(t);break;case lu.UP:this.up(t);break;case lu.DOWN:this.down(t);break;case lu.RETURN:case lu.SPACE:this.space(t);break;default:return}this.bubble?this.bubble=!1:this.stop(t)}escape(t){}space(t){}left(t){}right(t){}up(t){}down(t){}stop(t){t&&(t.stopPropagation(),t.preventDefault(),t.cancelBubble=!0)}mousedown(t){return this.stop(t)}mouseup(t){return this.stop(t)}mouseover(t){return this.stop(t)}mouseout(t){return this.stop(t)}click(t){return this.stop(t)}addEvents(t){t.addEventListener(du,this.mousedown.bind(this)),t.addEventListener(uu,this.mouseup.bind(this)),t.addEventListener(pu,this.mouseover.bind(this)),t.addEventListener(mu,this.mouseout.bind(this)),t.addEventListener(cu,this.click.bind(this)),t.addEventListener("keydown",this.keydown.bind(this)),t.addEventListener("dragstart",this.stop.bind(this)),t.addEventListener(fu,this.stop.bind(this)),t.addEventListener("contextmenu",this.stop.bind(this)),t.addEventListener(hu,this.stop.bind(this))}}class bu extends gu{addAttributes(t){for(const e in t)this.html.setAttribute(e,t[e])}get html(){return this._html||this.generateHtml(),this._html}set html(t){this._html=t,this.addEvents(t)}generateHtml(){const t=document.createElement("div");t.classList.add(this.className),t.setAttribute("role",this.role),this.html=t}focus(){const t=this.html;t.setAttribute("tabindex","0"),setTimeout(()=>t.focus(),50)}unfocus(){const t=this.html;t.hasAttribute("tabindex")&&t.setAttribute("tabindex","-1");try{t.blur()}catch(t){}t.blur()}}class Eu extends bu{constructor(){super(...arguments),this.posted=!1}isPosted(){return this.posted}post(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)}unpost(){if(!this.posted)return;const t=this.html;t.parentNode&&t.parentNode.removeChild(t),this.posted=!1}}function xu(t){return"CtxtMenu_"+t}function yu(t){return xu(t)}function Nu(t){return xu(t)}const vu={ATTACHED:yu("Attached"),CONTEXTMENU:yu("ContextMenu"),MENU:yu("Menu"),MENUARROW:yu("MenuArrow"),MENUACTIVE:yu("MenuActive"),MENUCHECK:yu("MenuCheck"),MENUCLOSE:yu("MenuClose"),MENUCOMBOBOX:yu("MenuComboBox"),MENUDISABLED:yu("MenuDisabled"),MENUFRAME:yu("MenuFrame"),MENUITEM:yu("MenuItem"),MENULABEL:yu("MenuLabel"),MENURADIOCHECK:yu("MenuRadioCheck"),MENUINPUTBOX:yu("MenuInputBox"),MENURULE:yu("MenuRule"),MENUSLIDER:yu("MenuSlider"),MOUSEPOST:yu("MousePost"),RTL:yu("RTL"),INFO:yu("Info"),INFOCLOSE:yu("InfoClose"),INFOCONTENT:yu("InfoContent"),INFOSIGNATURE:yu("InfoSignature"),INFOTITLE:yu("InfoTitle"),SLIDERVALUE:yu("SliderValue"),SLIDERBAR:yu("SliderBar"),SELECTION:yu("Selection"),SELECTIONBOX:yu("SelectionBox"),SELECTIONMENU:yu("SelectionMenu"),SELECTIONDIVIDER:yu("SelectionDivider"),SELECTIONITEM:yu("SelectionItem")},Tu={COUNTER:Nu("Counter"),KEYDOWNFUNC:Nu("keydownFunc"),CONTEXTMENUFUNC:Nu("contextmenuFunc"),OLDTAB:Nu("Oldtabindex"),TOUCHFUNC:Nu("TouchFunc")};class Cu extends bu{constructor(t,e){super(),this._menu=t,this._type=e,this.className=vu.MENUITEM,this.role="menuitem",this.hidden=!1}get menu(){return this._menu}set menu(t){this._menu=t}get type(){return this._type}hide(){this.hidden=!0,this.menu.generateMenu()}show(){this.hidden=!1,this.menu.generateMenu()}isHidden(){return this.hidden}}function Au(t){const e=t.menu;e.baseMenu?e.baseMenu.unpost():e.unpost()}function Lu(t){const e=t.menu;return(e.baseMenu?e.baseMenu:e).store.active}function Su(t,e){console.error("ContextMenu Error: "+e)}function Ru(){return Mu++}let Mu=0;class Iu extends Cu{constructor(t,e,s,i){super(t,e),this._content=s,this.disabled=!1,this.callbacks=[],this._id=i||s}get content(){return this._content}set content(t){this._content=t,this.generateHtml(),this.menu&&this.menu.generateHtml()}get id(){return this._id}press(){this.disabled||(this.executeAction(),this.executeCallbacks_())}executeAction(){}registerCallback(t){-1===this.callbacks.indexOf(t)&&this.callbacks.push(t)}unregisterCallback(t){const e=this.callbacks.indexOf(t);-1!==e&&this.callbacks.splice(e,1)}mousedown(t){this.press(),this.stop(t)}mouseover(t){this.focus(),this.stop(t)}mouseout(t){this.deactivate(),this.stop(t)}generateHtml(){super.generateHtml();const t=this.html;t.setAttribute("aria-disabled","false"),t.textContent=this.content}activate(){this.disabled||this.html.classList.add(vu.MENUACTIVE)}deactivate(){this.html.classList.remove(vu.MENUACTIVE)}focus(){this.menu.focused=this,super.focus(),this.activate()}unfocus(){this.deactivate(),super.unfocus()}escape(t){Au(this)}up(t){this.menu.up(t)}down(t){this.menu.down(t)}left(t){this.menu.left(t)}right(t){this.menu.right(t)}space(t){this.press()}disable(){this.disabled=!0;const t=this.html;t.classList.add(vu.MENUDISABLED),t.setAttribute("aria-disabled","true")}enable(){this.disabled=!1;const t=this.html;t.classList.remove(vu.MENUDISABLED),t.removeAttribute("aria-disabled")}executeCallbacks_(){for(const t of this.callbacks)try{t(this)}catch(t){Su(0,"Callback for menu entry "+this.id+" failed.")}}}class wu extends Iu{static fromJson(t,{content:e,menu:s,id:i},r){const n=new this(r,e,i),o=t.get("subMenu")(t,s,n);return n.submenu=o,n}constructor(t,e,s){super(t,"submenu",e,s),this._submenu=null}set submenu(t){this._submenu=t}get submenu(){return this._submenu}mouseover(t){this.focus(),this.stop(t)}mouseout(t){this.stop(t)}unfocus(){if(this.submenu.isPosted()){if(this.menu.focused!==this)return super.unfocus(),void this.menu.unpostSubmenus();this.html.setAttribute("tabindex","-1"),this.html.blur()}else super.unfocus()}focus(){super.focus(),this.submenu.isPosted()||this.disabled||this.submenu.post()}executeAction(){this.submenu.isPosted()?this.submenu.unpost():this.submenu.post()}generateHtml(){super.generateHtml();const t=this.html;this.span=document.createElement("span"),this.span.textContent="\u25ba",this.span.classList.add(vu.MENUARROW),this.span.setAttribute("aria-hidden","true"),t.appendChild(this.span),t.setAttribute("aria-haspopup","true")}left(t){this.submenu.isPosted()?this.submenu.unpost():super.left(t)}right(t){this.submenu.isPosted()?this.submenu.down(t):this.submenu.post()}toJson(){return{type:""}}}class ku extends Eu{constructor(){super(...arguments),this.className=vu.CONTEXTMENU,this.role="menu",this._items=[],this._baseMenu=null}set baseMenu(t){this._baseMenu=t}get baseMenu(){return this._baseMenu}get items(){return this._items}set items(t){this._items=t}get pool(){return this.variablePool}get focused(){return this._focused}set focused(t){if(this._focused===t)return;this._focused||this.unfocus();const e=this._focused;this._focused=t,e&&e.unfocus()}up(t){const e=this.items.filter(t=>t instanceof Iu&&!t.isHidden());if(0===e.length)return;if(!this.focused)return void e[e.length-1].focus();let s=e.indexOf(this.focused);-1!==s&&(s=s?--s:e.length-1,e[s].focus())}down(t){const e=this.items.filter(t=>t instanceof Iu&&!t.isHidden());if(0===e.length)return;if(!this.focused)return void e[0].focus();let s=e.indexOf(this.focused);-1!==s&&(s++,s=s===e.length?0:s,e[s].focus())}generateHtml(){super.generateHtml(),this.generateMenu()}generateMenu(){const t=this.html;t.classList.add(vu.MENU);for(const e of this.items){if(!e.isHidden()){t.appendChild(e.html);continue}const s=e.html;s.parentNode&&s.parentNode.removeChild(s)}}post(t,e){this.variablePool.update(),super.post(t,e)}unpostSubmenus(){const t=this.items.filter(t=>t instanceof wu);for(const e of t)e.submenu.unpost(),e!==this.focused&&e.unfocus()}unpost(){super.unpost(),this.unpostSubmenus(),this.focused=null}find(t){for(const e of this.items)if("rule"!==e.type){if(e.id===t)return e;if("submenu"===e.type){const s=e.submenu.find(t);if(s)return s}}return null}}class Ou{constructor(t){this.menu=t,this.store=[],this._active=null,this.counter=0,this.attachedClass=vu.ATTACHED+"_"+Ru(),this.taborder=!0,this.attrMap={}}set active(t){do{if(-1!==this.store.indexOf(t)){this._active=t;break}t=t.parentNode}while(t)}get active(){return this._active}next(){const t=this.store.length;if(0===t)return this.active=null,null;let e=this.store.indexOf(this.active);return e=-1===e?0:et.setAttribute("tabindex","0"))}removeTaborder_(){this.store.forEach(t=>t.setAttribute("tabindex","-1"))}addTabindex(t){t.hasAttribute("tabindex")&&t.setAttribute(Tu.OLDTAB,t.getAttribute("tabindex")),t.setAttribute("tabindex","0")}removeTabindex(t){t.hasAttribute(Tu.OLDTAB)?(t.setAttribute("tabindex",t.getAttribute(Tu.OLDTAB)),t.removeAttribute(Tu.OLDTAB)):t.removeAttribute("tabindex")}addEvents(t){t.hasAttribute(Tu.COUNTER)||(this.addEvent(t,"contextmenu",this.menu.post.bind(this.menu)),this.addEvent(t,"keydown",this.keydown.bind(this)),t.setAttribute(Tu.COUNTER,this.counter.toString()),this.counter++)}addEvent(t,e,s){const i=Tu[e.toUpperCase()+"FUNC"];this.attrMap[i+this.counter]=s,t.addEventListener(e,s)}removeEvents(t){if(!t.hasAttribute(Tu.COUNTER))return;const e=t.getAttribute(Tu.COUNTER);this.removeEvent(t,"contextmenu",e),this.removeEvent(t,"keydown",e),t.removeAttribute(Tu.COUNTER)}removeEvent(t,e,s){const i=Tu[e.toUpperCase()+"FUNC"],r=this.attrMap[i+s];t.removeEventListener(e,r)}keydown(t){t.keyCode===lu.SPACE&&(this.menu.post(t),t.preventDefault(),t.stopImmediatePropagation())}}class Du{constructor(){this.pool={}}insert(t){this.pool[t.name]=t}lookup(t){return this.pool[t]}remove(t){delete this.pool[t]}update(){for(const t in this.pool)this.pool[t].update()}}class Pu extends ku{static fromJson(t,{pool:e,items:s,id:i=""}){const r=new this(t);r.id=i;const n=t.get("variable");e.forEach(e=>n(t,e,r.pool));const o=t.get("items")(t,s,r);return r.items=o,r}constructor(t){super(),this.factory=t,this.id="",this.moving=!1,this._store=new Ou(this),this.widgets=[],this.variablePool=new Du}generateHtml(){this.isPosted()&&this.unpost(),super.generateHtml(),this._frame=document.createElement("div"),this._frame.classList.add(vu.MENUFRAME);const t="left: 0px; top: 0px; z-index: 200; width: 100%; height: 100%; border: 0px; padding: 0px; margin: 0px;";this._frame.setAttribute("style","position: absolute; "+t);const e=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))}display(){document.body.appendChild(this.frame),this.frame.appendChild(this.html),this.focus()}escape(t){this.unpost(),this.unpostWidgets()}unpost(){if(super.unpost(),this.widgets.length>0)return;this.frame.parentNode.removeChild(this.frame);const t=this.store;this.moving||t.insertTaborder(),t.active.focus()}left(t){this.move_(this.store.previous())}right(t){this.move_(this.store.next())}get frame(){return this._frame}get store(){return this._store}post(t,e){if(void 0!==e)return this.moving||this.store.removeTaborder(),void super.post(t,e);const s=t;let i,r,n;if(s instanceof Event?(i=s.target,this.stop(s)):i=s,s instanceof MouseEvent&&(r=s.pageX,n=s.pageY,r||n||!s.clientX||(r=s.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,n=s.clientY+document.body.scrollTop+document.documentElement.scrollTop)),!r&&!n&&i){const t=window.pageXOffset||document.documentElement.scrollLeft,e=window.pageYOffset||document.documentElement.scrollTop,s=i.getBoundingClientRect();r=(s.right+s.left)/2+t,n=(s.bottom+s.top)/2+e}this.store.active=i,this.anchor=this.store.active;const o=this.html;r+o.offsetWidth>document.body.offsetWidth-5&&(r=document.body.offsetWidth-o.offsetWidth-5),this.post(r,n)}registerWidget(t){this.widgets.push(t)}unregisterWidget(t){const e=this.widgets.indexOf(t);e>-1&&this.widgets.splice(e,1),0===this.widgets.length&&this.unpost()}unpostWidgets(){this.widgets.forEach(t=>t.unpost())}toJson(){return{type:""}}move_(t){this.anchor&&t!==this.anchor&&(this.moving=!0,this.unpost(),this.post(t),this.moving=!1)}}class Bu extends ku{static fromJson(t,{items:e},s){const i=new this(s),r=t.get("items")(t,e,i);return i.items=r,i}constructor(t){super(),this._anchor=t,this.variablePool=this.anchor.menu.pool,this.setBaseMenu()}get anchor(){return this._anchor}post(){if(!this.anchor.menu.isPosted())return;let t=this.anchor.html;const e=this.html,s=this.baseMenu.frame,i=t.offsetWidth;let r=i-2,n=0;for(;t&&t!==s;)r+=t.offsetLeft,n+=t.offsetTop,t=t.parentNode;r+e.offsetWidth>document.body.offsetWidth-5&&(r=Math.max(5,r-i-e.offsetWidth+6)),super.post(r,n)}display(){this.baseMenu.frame.appendChild(this.html)}setBaseMenu(){let t=this;do{t=t.anchor.menu}while(t instanceof Bu);this.baseMenu=t}left(t){this.focused=null,this.anchor.focus()}toJson(){return{type:""}}}class Fu extends Iu{generateHtml(){super.generateHtml();const t=this.html;this.span||this.generateSpan(),t.appendChild(this.span),this.update()}register(){this.variable.register(this)}unregister(){this.variable.unregister(this)}update(){this.updateAria(),this.span&&this.updateSpan()}}class ju extends Fu{static fromJson(t,{content:e,variable:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"radio",e,i),this.role="menuitemradio",this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.id),Au(this)}generateSpan(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(vu.MENURADIOCHECK),this.span.setAttribute("aria-hidden","true")}updateAria(){this.html.setAttribute("aria-checked",this.variable.getValue()===this.id?"true":"false")}updateSpan(){this.span.style.display=this.variable.getValue()===this.id?"":"none"}toJson(){return{type:""}}}class _u extends Cu{static fromJson(t,e,s){return new this(s)}constructor(t){super(t,"rule"),this.className=vu.MENUITEM,this.role="separator"}generateHtml(){super.generateHtml();const t=this.html;t.classList.add(vu.MENURULE),t.setAttribute("aria-orientation","vertical")}addEvents(t){}toJson(){return{type:"rule"}}}class Uu extends Iu{static fromJson(t,{content:e,action:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"command",e,i),this.command=s}mousedown(t){this.stop(t)}mouseup(t){this.press(),this.stop(t)}executeAction(){try{this.command(Lu(this))}catch(t){Su(0,"Illegal command callback.")}Au(this)}toJson(){return{type:""}}}class Hu{static fromJson(t,{name:e,getter:s,setter:i},r){const n=new this(e,s,i);r.insert(n)}constructor(t,e,s){this._name=t,this.getter=e,this.setter=s,this.items=[]}get name(){return this._name}getValue(t){try{return this.getter(t)}catch(t){return Su(0,"Command of variable "+this.name+" failed."),null}}setValue(t,e){try{this.setter(t,e)}catch(t){Su(0,"Command of variable "+this.name+" failed.")}this.update()}register(t){-1===this.items.indexOf(t)&&this.items.push(t)}unregister(t){const e=this.items.indexOf(t);-1!==e&&this.items.splice(e,1)}update(){this.items.forEach(t=>t.update())}registerCallback(t){this.items.forEach(e=>e.registerCallback(t))}unregisterCallback(t){this.items.forEach(e=>e.unregisterCallback(t))}toJson(){return{type:"variable",name:this.name,getter:this.getter.toString(),setter:this.setter.toString()}}}class Wu extends Fu{static fromJson(t,{content:e,variable:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"checkbox",e,i),this.role="menuitemcheckbox",this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(!this.variable.getValue()),Au(this)}generateSpan(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(vu.MENUCHECK),this.span.setAttribute("aria-hidden","true")}updateAria(){this.html.setAttribute("aria-checked",this.variable.getValue()?"true":"false")}updateSpan(){this.span.style.display=this.variable.getValue()?"":"none"}toJson(){return{type:""}}}class zu extends Fu{static fromJson(t,{content:e,variable:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"combobox",e,i),this.role="combobox",this.inputEvent=!1,this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.input.value,Lu(this))}space(t){super.space(t),Au(this)}focus(){super.focus(),this.input.focus()}unfocus(){super.unfocus(),this.updateSpan()}generateHtml(){super.generateHtml();this.html.classList.add(vu.MENUCOMBOBOX)}generateSpan(){this.span=document.createElement("span"),this.span.classList.add(vu.MENUINPUTBOX),this.input=document.createElement("input"),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.setAttribute("size","10em"),this.input.setAttribute("type","text"),this.input.setAttribute("tabindex","-1"),this.span.appendChild(this.input)}inputKey(t){this.bubbleKey(),this.inputEvent=!0}keydown(t){if(this.inputEvent&&t.keyCode!==lu.ESCAPE&&t.keyCode!==lu.RETURN)return this.inputEvent=!1,void t.stopPropagation();super.keydown(t),t.stopPropagation()}updateAria(){}updateSpan(){let t;try{t=this.variable.getValue(Lu(this))}catch(e){t=""}this.input.value=t}toJson(){return{type:""}}}class qu extends Iu{static fromJson(t,{content:e,id:s},i){return new this(i,e,s)}constructor(t,e,s){super(t,"label",e,s)}generateHtml(){super.generateHtml();this.html.classList.add(vu.MENULABEL)}toJson(){return{type:""}}}class Vu extends Fu{static fromJson(t,{content:e,variable:s,id:i},r){return new this(r,e,s,i)}constructor(t,e,s,i){super(t,"slider",e,i),this.role="slider",this.labelId="ctx_slideLabel"+Ru(),this.valueId="ctx_slideValue"+Ru(),this.inputEvent=!1,this.variable=t.pool.lookup(s),this.register()}executeAction(){this.variable.setValue(this.input.value,Lu(this)),this.update()}space(t){super.space(t),Au(this)}focus(){super.focus(),this.input.focus()}unfocus(){super.unfocus(),this.updateSpan()}generateHtml(){super.generateHtml();this.html.classList.add(vu.MENUSLIDER),this.valueSpan=document.createElement("span"),this.valueSpan.setAttribute("id",this.valueId),this.valueSpan.classList.add(vu.SLIDERVALUE),this.html.appendChild(this.valueSpan)}generateSpan(){this.span=document.createElement("span"),this.labelSpan=document.createElement("span"),this.labelSpan.setAttribute("id",this.labelId),this.labelSpan.appendChild(this.html.childNodes[0]),this.html.appendChild(this.labelSpan),this.input=document.createElement("input"),this.input.setAttribute("type","range"),this.input.setAttribute("min","0"),this.input.setAttribute("max","100"),this.input.setAttribute("aria-valuemin","0"),this.input.setAttribute("aria-valuemax","100"),this.input.setAttribute("aria-labelledby",this.labelId),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.addEventListener("input",this.executeAction.bind(this)),this.input.classList.add(vu.SLIDERBAR),this.span.appendChild(this.input)}inputKey(t){this.inputEvent=!0}mousedown(t){t.stopPropagation()}mouseup(t){Au(this),t.stopPropagation()}keydown(t){const e=t.keyCode;return e===lu.UP||e===lu.DOWN?(t.preventDefault(),void super.keydown(t)):this.inputEvent&&e!==lu.ESCAPE&&e!==lu.RETURN?(this.inputEvent=!1,void t.stopPropagation()):(super.keydown(t),void t.stopPropagation())}updateAria(){const t=this.variable.getValue();t&&this.input&&(this.input.setAttribute("aria-valuenow",t),this.input.setAttribute("aria-valuetext",t+"%"))}updateSpan(){let t;try{t=this.variable.getValue(Lu(this)),this.valueSpan.innerHTML=t+"%"}catch(e){t=""}this.input.value=t}toJson(){return{type:""}}}class Xu extends Eu{constructor(t){super(),this.element=t,this.className=vu.MENUCLOSE,this.role="button"}generateHtml(){const t=document.createElement("span");t.classList.add(this.className),t.setAttribute("role",this.role),t.setAttribute("tabindex","0");const e=document.createElement("span");e.textContent="\xd7",t.appendChild(e),this.html=t}display(){}unpost(){super.unpost(),this.element.unpost()}keydown(t){this.bubbleKey(),super.keydown(t)}space(t){this.unpost(),this.stop(t)}mousedown(t){this.unpost(),this.stop(t)}}class Gu extends Eu{constructor(t,e,s){super(),this.title=t,this.signature=s,this.className=vu.INFO,this.role="dialog",this.contentDiv=this.generateContent(),this.close=this.generateClose(),this.content=e||function(){return""}}attachMenu(t){this.menu=t}generateHtml(){super.generateHtml();const t=this.html;t.appendChild(this.generateTitle()),t.appendChild(this.contentDiv),t.appendChild(this.generateSignature()),t.appendChild(this.close.html),t.setAttribute("tabindex","0")}post(){super.post();const t=document.documentElement,e=this.html,s=window.innerHeight||t.clientHeight||t.scrollHeight||0,i=Math.floor(-e.offsetWidth/2),r=Math.floor((s-e.offsetHeight)/3);e.setAttribute("style","margin-left: "+i+"px; top: "+r+"px;"),window.event instanceof MouseEvent&&e.classList.add(vu.MOUSEPOST),e.focus()}display(){this.menu.registerWidget(this),this.contentDiv.innerHTML=this.content();const t=this.menu.html;t.parentNode&&t.parentNode.removeChild(t),this.menu.frame.appendChild(this.html)}click(t){}keydown(t){this.bubbleKey(),super.keydown(t)}escape(t){this.unpost()}unpost(){super.unpost(),this.html.classList.remove(vu.MOUSEPOST),this.menu.unregisterWidget(this)}generateClose(){const t=new Xu(this),e=t.html;return e.classList.add(vu.INFOCLOSE),e.setAttribute("aria-label","Close Dialog Box"),t}generateTitle(){const t=document.createElement("span");return t.innerHTML=this.title,t.classList.add(vu.INFOTITLE),t}generateContent(){const t=document.createElement("div");return t.classList.add(vu.INFOCONTENT),t.setAttribute("tabindex","0"),t}generateSignature(){const t=document.createElement("span");return t.innerHTML=this.signature,t.classList.add(vu.INFOSIGNATURE),t}toJson(){return{type:""}}}class Ju extends ku{static fromJson(t,{title:e,values:s,variable:i},r){const n=new this(r),o=t.get("label")(t,{content:e||"",id:e||"id"},n),a=t.get("rule")(t,{},n),l=s.map(e=>t.get("radio")(t,{content:e,variable:i,id:e},n)),c=[o,a].concat(l);return n.items=c,n}constructor(t){super(),this.anchor=t,this.className=vu.SELECTIONMENU,this.variablePool=this.anchor.menu.pool,this.baseMenu=this.anchor.menu}generateHtml(){super.generateHtml(),this.items.forEach(t=>t.html.classList.add(vu.SELECTIONITEM))}display(){}right(t){this.anchor.right(t)}left(t){this.anchor.left(t)}}class Ku extends Gu{static fromJson(t,{title:e,signature:s,selections:i,order:r,grid:n},o){const a=new this(e,s,r,n);a.attachMenu(o);const l=i.map(e=>t.get("selectionMenu")(t,e,a));return a.selections=l,a}constructor(t,e,s="none",i="vertical"){super(t,null,e),this.style=s,this.grid=i,this._selections=[],this.prefix="ctxt-selection",this._balanced=!0}attachMenu(t){this.menu=t}get selections(){return this._selections}set selections(t){this._selections=[],t.forEach(t=>this.addSelection(t))}addSelection(t){t.anchor=this,this._selections.push(t)}rowDiv(t){const e=document.createElement("div");this.contentDiv.appendChild(e);const s=t.map(t=>(e.appendChild(t.html),t.html.id||(t.html.id=this.prefix+Ru()),t.html.getBoundingClientRect())),i=s.map(t=>t.width),r=i.reduce((t,e)=>t+e,0),n=s.reduce((t,e)=>Math.max(t,e.height),0);return e.classList.add(vu.SELECTIONDIVIDER),e.setAttribute("style","height: "+n+"px;"),[e,r,n,i]}display(){if(super.display(),this.order(),!this.selections.length)return;const t=[];let e=0,s=[];const i=this.getChunkSize(this.selections.length);for(let r=0;rt.html.style.height=l+"px"),s=this.combineColumn(s,c)}this._balanced&&(this.balanceColumn(t,s),e=s.reduce((t,e)=>t+e,20)),t.forEach(t=>t.style.width=e+"px")}getChunkSize(t){switch(this.grid){case"square":return Math.floor(Math.sqrt(t));case"horizontal":return Math.floor(t/Ku.chunkSize);default:return Ku.chunkSize}}balanceColumn(t,e){t.forEach(t=>{const s=Array.from(t.children);for(let t,i=0;t=s[i];i++)t.style.width=e[i]+"px"})}combineColumn(t,e){let s=[],i=0;for(;t[i]||e[i];){if(!t[i]){s=s.concat(e.slice(i));break}if(!e[i]){s=s.concat(t.slice(i));break}s.push(Math.max(t[i],e[i])),i++}return s}left(t){this.move(t,t=>(0===t?this.selections.length:t)-1)}right(t){this.move(t,t=>t===this.selections.length-1?0:t+1)}generateHtml(){super.generateHtml(),this.html.classList.add(vu.SELECTION)}generateContent(){const t=super.generateContent();return t.classList.add(vu.SELECTIONBOX),t.removeAttribute("tabindex"),t}findSelection(t){const e=t.target;let s=null;if(e.id&&(s=this.selections.find(t=>t.html.id===e.id)),!s){const t=e.parentElement.id;s=this.selections.find(e=>e.html.id===t)}return s}move(t,e){const s=this.findSelection(t);s.focused&&s.focused.unfocus();const i=e(this.selections.indexOf(s));this.selections[i].focus()}order(){this.selections.sort(Ku.orderMethod.get(this.style))}toJson(){return{type:""}}}Ku.chunkSize=4,Ku.orderMethod=new Map([["alphabetical",(t,e)=>t.items[0].content.localeCompare(e.items[0].content)],["none",(t,e)=>1],["decreasing",(t,e)=>{const s=t.items.length,i=e.items.length;return s{const s=t.items.length,i=e.items.length;return sthis.factory.add(t,e))}get factory(){return this._factory}items(t,e,s){const i=[];for(const t of e){const e=this.parse(t,s);e&&(s.items.push(e),t.disabled&&e.disable(),t.hidden&&i.push(e))}return i.forEach(t=>t.hide()),s.items}parse(t,...e){var{type:s}=t,i=Yu(t,["type"]);const r=this.factory.get(s);return r?r(this.factory,i,...e):null}}function Zu(t){return"."+(vu[t]||t)}function tp(t,e=";"){return"{\n "+t.join(e+"\n ")+";\n}"}const ep={};ep[Zu("MENU")]=tp(["position: absolute","background-color: white","color: black","width: auto","padding: 5px 0px","border: 1px solid #CCCCCC","margin: 0","cursor: default","font: menu","text-align: left","text-indent: 0","text-transform: none","line-height: normal","letter-spacing: normal","word-spacing: normal","word-wrap: normal","white-space: nowrap","float: none","z-index: 1001","border-radius: 5px","box-shadow: 0px 10px 20px #808080"]),ep[Zu("MENUITEM")]=tp(["padding: 1px 2em","background: transparent"]),ep[Zu("MENUARROW")]=tp(["position: absolute","right: 0.5em","padding-top: 0.25em","color: #666666","font-family: null","font-size: 0.75em"]),ep[Zu("MENUACTIVE")+" "+Zu("MENUARROW")]=tp(["color: white"]),ep[Zu("MENUARROW")+Zu("RTL")]=tp(["left: 0.5em","right: auto"]),ep[Zu("MENUCHECK")]=tp(["position: absolute","left: 0.7em","font-family: null"]),ep[Zu("MENUCHECK")+Zu("RTL")]=tp(["right: 0.7em","left: auto"]),ep[Zu("MENURADIOCHECK")]=tp(["position: absolute","left: 0.7em"]),ep[Zu("MENURADIOCHECK")+Zu("RTL")]=tp(["right: 0.7em","left: auto"]),ep[Zu("MENUINPUTBOX")]=tp(["padding-left: 1em","right: 0.5em","color: #666666","font-family: null"]),ep[Zu("MENUINPUTBOX")+Zu("RTL")]=tp(["left: 0.1em"]),ep[Zu("MENUCOMBOBOX")]=tp(["left: 0.1em","padding-bottom: 0.5em"]),ep[Zu("MENUSLIDER")]=tp(["left: 0.1em"]),ep[Zu("SLIDERVALUE")]=tp(["position: absolute","right: 0.1em","padding-top: 0.25em","color: #333333","font-size: 0.75em"]),ep[Zu("MENUACTIVE")+" "+Zu("SLIDERVALUE")]=tp(["color: #DDDDDD"]),ep[Zu("SLIDERBAR")]=tp(["outline: none","background: #D3D3D3"]),ep[Zu("MENULABEL")]=tp(["padding: 1px 2em 3px 1.33em","font-style: italic"]),ep[Zu("MENURULE")]=tp(["border-top: 1px solid #DDDDDD","margin: 4px 3px"]),ep[Zu("MENUDISABLED")]=tp(["color: #999"]),ep[Zu("MENUACTIVE")]=tp(["background-color: #606872","color: white"]),ep[Zu("MENUDISABLED")+":focus"]=tp(["background-color: #E8E8E8"]),ep[Zu("MENULABEL")+":focus"]=tp(["background-color: #E8E8E8"]),ep[Zu("CONTEXTMENU")+":focus"]=tp(["outline: none"]),ep[Zu("CONTEXTMENU")+" "+Zu("MENUITEM")+":focus"]=tp(["outline: none"]),ep[Zu("SELECTIONMENU")]=tp(["position: relative","float: left","border-bottom: none","box-shadow: none ! important","border-radius: 0px !important"]),ep[Zu("SELECTIONITEM")]=tp(["padding-right: 1em"]),ep[Zu("SELECTION")]=tp(["right: 40%","width: 50%"]),ep[Zu("SELECTIONBOX")]=tp(["padding: 0em","max-height: 20em","max-width: none","background-color: #FFFFFF"]),ep[Zu("SELECTIONDIVIDER")]=tp(["clear: both","border-top: 2px solid #000000"]),ep[Zu("MENU")+" "+Zu("MENUCLOSE")]=tp(["top: -10px","left: -10px"]),ep["@media (prefers-color-scheme: dark) /* menu */"]=tp([Zu("MENU")+" "+tp(["color: #E0E0E0","background-color: #242436","box-shadow: 0px 10px 20px #000","border: 1px solid #808080"]),Zu("SLIDERVALUE")+" "+tp(["color: #D0D0D0"]),Zu("MENUDISABLED")+":focus "+tp(["background-color: #383838"]),Zu("MENULABEL")+":focus "+tp(["background-color: #585858"]),Zu("MENURULE")+" "+tp(["border-top: 1px solid #808080"]),Zu("SELECTIONDIVIDER")+" "+tp(["border-top: 2px solid #808080"])],"");const sp={};sp[Zu("MENUCLOSE")]=tp(["position: absolute","cursor: pointer","display: inline-block","border: 2px solid #AAA","border-radius: 18px",'font-family: "Courier New", Courier',"font-size: 24px","color: #F0F0F0"]),sp[Zu("MENUCLOSE")+" span"]=tp(["display: block","background-color: #AAA","border: 1.5px solid","border-radius: 18px","line-height: 0","padding: 8px 0 6px"]),sp[Zu("MENUCLOSE")+":hover"]=tp(["color: white !important","border: 2px solid #CCC !important"]),sp[Zu("MENUCLOSE")+":hover span"]=tp(["background-color: #CCC !important"]),sp[Zu("MENUCLOSE")+":hover:focus"]=tp(["outline: none"]);function ip(t,e=document,s="MJX-Menu-styles"){if(e.head.querySelector("#"+s))return;const i=e.createElement("style");i.id=s;const r=[];for(const e in t)r.push(`${e} ${t[e]}`);i.textContent=r.join("\n"),e.head.appendChild(i)}class rp extends Pu{constructor(){super(...arguments),this.mathItem=null,this.nofocus=!1,this.errorMsg=""}post(t,e){var s,i;if(this.mathItem){const r=null===(i=null===(s=this.mathItem)||void 0===s?void 0:s.explorers)||void 0===i?void 0:i.speech;(null==r?void 0:r.active)&&(r.restarted=r.semanticFocus()),void 0!==e&&(this.getOriginalMenu(),this.getSemanticsMenu(),this.getSpeechMenu(),this.getBrailleMenu(),this.getSvgMenu(),this.getErrorMessage(),this.dynamicSubmenus()),super.post(t,e)}}unpost(){this.posted&&super.unpost(),this.mathItem&&(this.mathItem.outputData.nofocus=this.nofocus),this.mathItem=null,this.nofocus=!1}findID(...t){let e=this,s=null;for(const i of t){if(!e)return null;for(s of e.items){if(s.id===i){e=s instanceof wu?s.submenu:null;break}e=s=null}}return s}setJax(t){this.jax=t}getOriginalMenu(){const t=this.mathItem.inputJax.name,e=this.findID("Show","Original");e.content="MathML"===t?"Original MathML":t+" Commands";this.findID("Copy","Original").content=e.content}getSemanticsMenu(){const t=this.findID("Settings","MathmlIncludes","semantics");"MathML"===this.mathItem.inputJax.name?t.disable():t.enable()}getSpeechMenu(){const t=this.mathItem.outputData.speech;this.findID("Show","Speech")[t?"enable":"disable"](),this.findID("Copy","Speech")[t?"enable":"disable"]()}getBrailleMenu(){const t=this.mathItem.outputData.braille;this.findID("Show","Braille")[t?"enable":"disable"](),this.findID("Copy","Braille")[t?"enable":"disable"]()}getSvgMenu(){const t=this.jax.SVG;this.findID("Show","SVG")[t?"enable":"disable"](),this.findID("Copy","SVG")[t?"enable":"disable"]()}getErrorMessage(){const t=this.mathItem.root.childNodes[0].childNodes;let e=!0;if(this.errorMsg="",1===t.length&&t[0].isKind("merror")){const s=t[0].attributes;this.errorMsg=s.get("data-mjx-error")||s.get("data-mjx-message")||"",e=!this.errorMsg}this.findID("Show","Error")[e?"disable":"enable"](),this.findID("Copy","Error")[e?"disable":"enable"]()}dynamicSubmenus(){for(const[t,[e,s]]of rp.DynamicSubmenus){const i=this.find(t);i&&e(this,i,t=>{var e;i.submenu=t,!(null===(e=null==t?void 0:t.items)||void 0===e?void 0:e.length)||s&&!this.settings[s]?i.disable():i.enable()})}}}rp.DynamicSubmenus=new Map;class np extends Ku{constructor(t,e,s,i,r,n){super(t,e,i,r),this.attachMenu(n);const o=n.factory;this.selections=s.map(t=>o.get("selectionMenu")(o,t,this))}post(){const t=Array.from(Object.values(this.menu.jax)).filter(t=>!!t)[0],e=new uo({title:this.title,message:"",adaptor:t.adaptor,styles:{"mjx-dialog > div":{padding:0}}});e.attach(),this.contentDiv=e.content,this.display()}display(){const t=this;if(t.order(),!this.selections.length)return;const e=[];let s=0,i=[];const r=t.getChunkSize(this.selections.length);for(let n=0;nt.html.style.height=c+"px"),i=t.combineColumn(i,h)}t._balanced&&(t.balanceColumn(e,i),s=i.reduce((t,e)=>t+e-2,20)),e.forEach(t=>t.style.width=s+"px")}}var op,ap,lp;!function(t){t.DOMAIN="domain",t.STYLE="style",t.LOCALE="locale",t.TOPIC="topic",t.MODALITY="modality"}(op||(op={}));class cp{static createProp(...t){const e=hp.DEFAULT_ORDER,s={};for(let i=0,r=t.length,n=e.length;it.push(this.getProperty(e).slice())),t}toString(){const t=[];return this.order.forEach(e=>t.push(e+": "+this.getProperty(e).toString())),t.join("\n")}}class hp extends cp{static createCstr(...t){const e=hp.DEFAULT_ORDER,s={};for(let i=0,r=t.length,n=e.length;i{const s=e.indexOf(t);return-1!==s&&e.splice(s,1)})}constructor(t,e){const s={};for(const[e,i]of Object.entries(t))s[e]=[i];super(s,e),this.components=t}getComponents(){return this.components}getValue(t){return this.components[t]}getValues(){return this.order.map(t=>this.getValue(t))}allProperties(){const t=super.allProperties();for(let e,s,i=0;e=t[i],s=this.order[i];i++){const t=this.getValue(s);-1===e.indexOf(t)&&e.unshift(t)}return t}toString(){return this.getValues().join(".")}equal(t){const e=t.getAxes();if(this.order.length!==e.length)return!1;for(let s,i=0;s=e[i];i++){const e=this.getValue(s);if(!e||t.getValue(s)!==e)return!1}return!0}}hp.DEFAULT_ORDER=[op.LOCALE,op.MODALITY,op.DOMAIN,op.STYLE,op.TOPIC],hp.BASE_LOCALE="base",hp.DEFAULT_VALUE="default",hp.DEFAULT_VALUES={[op.LOCALE]:"en",[op.DOMAIN]:hp.DEFAULT_VALUE,[op.STYLE]:hp.DEFAULT_VALUE,[op.TOPIC]:hp.DEFAULT_VALUE,[op.MODALITY]:"speech"};class dp{constructor(t){this.order=t}parse(t){const e=t.split("."),s={};if(e.length>this.order.length)throw new Error("Invalid dynamic constraint: "+s);let i=0;for(let t,r=0;t=this.order[r],e.length;r++,i++){const i=e.shift();s[t]=i}return new hp(s,this.order.slice(0,i))}}class up{constructor(t,e=new cp(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 cp(t.getProperties(),t.getOrder()),this.order=this.reference.getOrder()}match(t){const e=t.getAxes();return e.length===this.reference.getAxes().length&&e.every(e=>{const s=t.getValue(e);return s===this.reference.getValue(e)||-1!==this.fallback.getProperty(e).indexOf(s)})}compare(t,e){let s=!1;for(let i,r=0;i=this.order[r];r++){const r=t.getValue(i),n=e.getValue(i);if(!s){const t=this.reference.getValue(i);if(t===r&&t!==n)return-1;if(t===n&&t!==r)return 1;if(t===r&&t===n)continue;t!==r&&t!==n&&(s=!0)}const o=this.fallback.getProperty(i),a=o.indexOf(r),l=o.indexOf(n);if(a{var t;return"undefined"!=typeof require||"undefined"!=typeof process&&null!=(null===(t=process.versions)||void 0===t?void 0:t.node)&&"undefined"!=typeof require?require:t=>null},Mp={extRequire:t=>"undefined"!=typeof process&&"undefined"!=typeof require?Rp()(t):null,windowSupported:Ap,documentSupported:Lp,webworker:Sp,xmldom:yp,document:Np,fs:Lp||Sp?null:Rp()("fs"),url:fp.url,jsonPath:function(){if(Lp||Sp)return fp.url;if(process.env.SRE_JSON_PATH||r.g.SRE_JSON_PATH)return process.env.SRE_JSON_PATH||r.g.SRE_JSON_PATH;try{return Rp().resolve("speech-rule-engine").replace(/sre\.js$/,"")+"mathmaps"}catch(t){}try{return Rp().resolve(".").replace(/sre\.js$/,"")+"mathmaps"}catch(t){}return"undefined"!=typeof __dirname?__dirname+(__dirname.match(/lib?$/)?"/mathmaps":"/lib/mathmaps"):process.cwd()+"/lib/mathmaps"}(),xpath:Cp};function Ip(t){return t.match("/$")?t:t+"/"}class wp{static getInstance(){return wp.instance=wp.instance||new wp,wp.instance}init(t){return t&&this.startDebugFile_(t),this.isActive_=!0,this.fileHandle}output(...t){this.isActive_&&this.output_(t)}generate(t){this.isActive_&&this.output_(t.apply(t,[]))}exit(t=()=>{}){this.stream_&&this.fileHandle.then(()=>{this.isActive_&&this.stream_&&(this.stream_.end("","",t),this.stream_=null)}),this.isActive_=!1}constructor(){this.isActive_=!1,this.fileHandle=Promise.resolve(),this.stream_=null}startDebugFile_(t){this.fileHandle=Mp.fs.promises.open(t,"w"),this.fileHandle=this.fileHandle.then(e=>{this.stream_=e.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.stream_?this.fileHandle.then(()=>this.outputFunction.apply(this.outputFunction,["Speech Rule Engine Debugger:"].concat(t))):console.info(...["Speech Rule Engine Debugger:"].concat(t))}}class kp{constructor(t={}){this.delay=!1,this.domain="clearspeak",this.style=hp.DEFAULT_VALUES[op.STYLE],this.locale=hp.DEFAULT_VALUES[op.LOCALE],this.subiso="",this.modality=hp.DEFAULT_VALUES[op.MODALITY],this.speech=pp.NONE,this.markup=mp.NONE,this.mark=!0,this.automark=!1,this.character=!0,this.cleanpause=!0,this.cayleyshort=!0,this.linebreaks=!1,this.rate="100",this.walker="Table",this.structure=!1,this.aria=!1,this.tree=!1,this.strict=!1,this.pprint=!1,this.rules="",this.prune="",this.set(t)}set(t){this.ensureDomain(t);for(const[e,s]of Object.entries(t))(kp.BINARY_FEATURES.includes(e)||kp.STRING_FEATURES.includes(e))&&(this[e]=s)}json(){const t={};return[].concat(kp.STRING_FEATURES,kp.BINARY_FEATURES).forEach(e=>t[e]=this[e]),t}ensureDomain(t){if(t.modality&&"speech"!==t.modality||!t.modality&&"speech"!==this.modality)return;if(!t.domain&&!t.locale)return;if("default"===t.domain)return void(t.domain="mathspeak");const e=t.locale||this.locale,s=t.domain||this.domain;-1===Op.indexOf(e)||"mathspeak"===s?"en"!==e?"mathspeak"!==s&&"clearspeak"!==s&&(t.domain="mathspeak"):-1===Dp.indexOf(s)&&(t.domain="mathspeak"):t.domain="mathspeak"}}kp.BINARY_FEATURES=["automark","mark","character","cleanpause","strict","structure","aria","pprint","cayleyshort","linebreaks","tree"],kp.STRING_FEATURES=["markup","style","domain","speech","walker","locale","delay","modality","rate","rules","subiso","prune"];const Op=["ca","da","es"],Dp=["chromevox","clearspeak","mathspeak","emacspeak","html"];class Pp extends Error{constructor(t=""){super(),this.message=t,this.name="SRE Error"}}class Bp{set defaultLocale(t){this._defaultLocale=fp.ensureLocale(t,this._defaultLocale)}get defaultLocale(){return this._defaultLocale}static getInstance(){return Bp.instance=Bp.instance||new Bp,Bp.instance}static defaultEvaluator(t,e){return t}static evaluateNode(t){return Bp.nodeEvaluator(t)}getRate(){const t=parseInt(this.options.rate,10);return isNaN(t)?100:t}setDynamicCstr(t){if(this.defaultLocale&&(hp.DEFAULT_VALUES[op.LOCALE]=this.defaultLocale),t){const e=Object.keys(t);for(let s=0;s[ \f\n\r\t\v\u200b]+<").trim()}(t),i=!!s.match(/&(?!lt|gt|amp|quot|apos)\w+;/g);if(!s)throw new Pp("Empty input!");try{const t=e.parseFromString(s,i?"text/html":"text/xml");return Bp.getInstance().mode===ap.HTTP?(jp.currentDocument=t,i?t.body.childNodes[0]:t.documentElement):t.documentElement}catch(t){throw new Pp("Illegal input: "+t.message)}}function Xp(t,e){t.parentNode&&(t.parentNode.insertBefore(e,t),t.parentNode.removeChild(t))}function Gp(t){return Mp.document.createElement(t)}function Jp(t){let e="",s=/(>)(<)(\/*)/g,i=0,r=(t=t.replace(s,"$1\r\n$2$3")).split("\r\n");for(s=/(\.)*(<)(\/*)/g,r=r.map(t=>t.replace(s,"$1\r\n$2$3").split("\r\n")).reduce((t,e)=>t.concat(e),[]);r.length;){let t=r.shift();if(!t)continue;let s=0;if(t.match(/^<\w[^>/]*>[^>]+$/)){const e=Kp(t,r[0]);e[0]?e[1]?(t+=r.shift().slice(0,-e[1].length),e[1].trim()&&r.unshift(e[1])):t+=r.shift():s=1}else if(t.match(/^<\/\w/))0!==i&&(i-=1);else if(t.match(/^<\w[^>]*[^/]>.*$/))s=1;else if(t.match(/^<\w[^>]*\/>.+$/)){const e=t.indexOf(">")+1,s=t.slice(e);s.trim()&&r.unshift(),t=t.slice(0,e)+s}else s=0;e+=new Array(i+1).join(" ")+t+"\r\n",i+=s}return e}function Kp(t,e){if(!e)return[!1,""];const s=t.match(/^<([^> ]+).*>/),i=e.match(/^<\/([^>]+)>(.*)/);return s&&i&&s[1]===i[1]?[!0,i[2]]:[!1,""]}function $p(t){return t.tagName.toUpperCase()}function Yp(t){return(new Mp.xmldom.XMLSerializer).serializeToString(t)}!function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",t[t.NOTATION_NODE=12]="NOTATION_NODE"}(zp||(zp={}));class Qp{constructor(t,e,s){this.domain=t,this.name=e,this.func=s,this.active=!1}annotate(t){t.childNodes.forEach(this.annotate.bind(this)),t.contentNodes.forEach(this.annotate.bind(this)),t.addAnnotation(this.domain,this.func(t))}}class Zp{constructor(t,e,s,i={}){this.domain=t,this.name=e,this.func=s,this.def=i,this.active=!1}visit(t,e){let s=this.func(t,e);t.addAnnotation(this.domain,s[0]);for(let e,i=0;e=t.childNodes[i];i++)s=this.visit(e,s[1]);for(let e,i=0;e=t.contentNodes[i];i++)s=this.visit(e,s[1]);return s}}const tm=new Map,em=new Map;function sm(t){const e=t.domain+":"+t.name;t instanceof Qp?tm.set(e,t):em.set(e,t)}function im(t,e){const s=t+":"+e,i=tm.get(s)||em.get(s);i&&(i.active=!0)}var rm,nm,om;function am(t){const e=t.toString(16).toUpperCase();return e.length>3?e:("000"+e).slice(-4)}function lm([t,e],s){const i=parseInt(t,16),r=parseInt(e,16),n=[];for(let t=i;t<=r;t++){let e=am(t);!1!==s[e]&&(e=s[e]||e,n.push(e))}return n}function cm(t,e={}){return lm(t,e).map(t=>String.fromCodePoint(parseInt(t,16)))}!function(t){t.BOLD="bold",t.BOLDFRAKTUR="bold-fraktur",t.BOLDITALIC="bold-italic",t.BOLDSCRIPT="bold-script",t.DOUBLESTRUCK="double-struck",t.DOUBLESTRUCKITALIC="double-struck-italic",t.FULLWIDTH="fullwidth",t.FRAKTUR="fraktur",t.ITALIC="italic",t.MONOSPACE="monospace",t.NORMAL="normal",t.SCRIPT="script",t.SANSSERIF="sans-serif",t.SANSSERIFITALIC="sans-serif-italic",t.SANSSERIFBOLD="sans-serif-bold",t.SANSSERIFBOLDITALIC="sans-serif-bold-italic"}(rm||(rm={})),function(t){t.SUPER="super",t.SUB="sub",t.CIRCLED="circled",t.PARENTHESIZED="parenthesized",t.PERIOD="period",t.NEGATIVECIRCLED="negative-circled",t.DOUBLECIRCLED="double-circled",t.CIRCLEDSANSSERIF="circled-sans-serif",t.NEGATIVECIRCLEDSANSSERIF="negative-circled-sans-serif",t.COMMA="comma",t.SQUARED="squared",t.NEGATIVESQUARED="negative-squared"}(nm||(nm={})),function(t){t.LATINCAP="latinCap",t.LATINSMALL="latinSmall",t.GREEKCAP="greekCap",t.GREEKSMALL="greekSmall",t.DIGIT="digit"}(om||(om={}));const hm=[{interval:["1D400","1D419"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLD},{interval:["1D41A","1D433"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLD},{interval:["1D56C","1D585"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLDFRAKTUR},{interval:["1D586","1D59F"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLDFRAKTUR},{interval:["1D468","1D481"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLDITALIC},{interval:["1D482","1D49B"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLDITALIC},{interval:["1D4D0","1D4E9"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLDSCRIPT},{interval:["1D4EA","1D503"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLDSCRIPT},{interval:["1D538","1D551"],base:om.LATINCAP,subst:{"1D53A":"2102","1D53F":"210D","1D545":"2115","1D547":"2119","1D548":"211A","1D549":"211D","1D551":"2124"},capital:!0,category:"Lu",font:rm.DOUBLESTRUCK},{interval:["1D552","1D56B"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.DOUBLESTRUCK},{interval:["1D504","1D51D"],base:om.LATINCAP,subst:{"1D506":"212D","1D50B":"210C","1D50C":"2111","1D515":"211C","1D51D":"2128"},capital:!0,category:"Lu",font:rm.FRAKTUR},{interval:["1D51E","1D537"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.FRAKTUR},{interval:["FF21","FF3A"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.FULLWIDTH},{interval:["FF41","FF5A"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.FULLWIDTH},{interval:["1D434","1D44D"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.ITALIC},{interval:["1D44E","1D467"],base:om.LATINSMALL,subst:{"1D455":"210E"},capital:!1,category:"Ll",font:rm.ITALIC},{interval:["1D670","1D689"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.MONOSPACE},{interval:["1D68A","1D6A3"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.MONOSPACE},{interval:["0041","005A"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.NORMAL},{interval:["0061","007A"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.NORMAL},{interval:["1D49C","1D4B5"],base:om.LATINCAP,subst:{"1D49D":"212C","1D4A0":"2130","1D4A1":"2131","1D4A3":"210B","1D4A4":"2110","1D4A7":"2112","1D4A8":"2133","1D4AD":"211B"},capital:!0,category:"Lu",font:rm.SCRIPT},{interval:["1D4B6","1D4CF"],base:om.LATINSMALL,subst:{"1D4BA":"212F","1D4BC":"210A","1D4C4":"2134"},capital:!1,category:"Ll",font:rm.SCRIPT},{interval:["1D5A0","1D5B9"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIF},{interval:["1D5BA","1D5D3"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIF},{interval:["1D608","1D621"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFITALIC},{interval:["1D622","1D63B"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFITALIC},{interval:["1D5D4","1D5ED"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFBOLD},{interval:["1D5EE","1D607"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFBOLD},{interval:["1D63C","1D655"],base:om.LATINCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFBOLDITALIC},{interval:["1D656","1D66F"],base:om.LATINSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFBOLDITALIC},{interval:["0391","03A9"],base:om.GREEKCAP,subst:{"03A2":"03F4"},capital:!0,category:"Lu",font:rm.NORMAL},{interval:["03B0","03D0"],base:om.GREEKSMALL,subst:{"03B0":"2207","03CA":"2202","03CB":"03F5","03CC":"03D1","03CD":"03F0","03CE":"03D5","03CF":"03F1","03D0":"03D6"},capital:!1,category:"Ll",font:rm.NORMAL},{interval:["1D6A8","1D6C0"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLD},{interval:["1D6C1","1D6E1"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLD},{interval:["1D6E2","1D6FA"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.ITALIC},{interval:["1D6FB","1D71B"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.ITALIC},{interval:["1D71C","1D734"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.BOLDITALIC},{interval:["1D735","1D755"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.BOLDITALIC},{interval:["1D756","1D76E"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFBOLD},{interval:["1D76F","1D78F"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFBOLD},{interval:["1D790","1D7A8"],base:om.GREEKCAP,subst:{},capital:!0,category:"Lu",font:rm.SANSSERIFBOLDITALIC},{interval:["1D7A9","1D7C9"],base:om.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:rm.SANSSERIFBOLDITALIC},{interval:["0030","0039"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.NORMAL},{interval:["2070","2079"],base:om.DIGIT,subst:{2071:"00B9",2072:"00B2",2073:"00B3"},offset:0,category:"No",font:nm.SUPER},{interval:["2080","2089"],base:om.DIGIT,subst:{},offset:0,category:"No",font:nm.SUB},{interval:["245F","2473"],base:om.DIGIT,subst:{"245F":"24EA"},offset:0,category:"No",font:nm.CIRCLED},{interval:["3251","325F"],base:om.DIGIT,subst:{},offset:21,category:"No",font:nm.CIRCLED},{interval:["32B1","32BF"],base:om.DIGIT,subst:{},offset:36,category:"No",font:nm.CIRCLED},{interval:["2474","2487"],base:om.DIGIT,subst:{},offset:1,category:"No",font:nm.PARENTHESIZED},{interval:["2487","249B"],base:om.DIGIT,subst:{2487:"1F100"},offset:0,category:"No",font:nm.PERIOD},{interval:["2775","277F"],base:om.DIGIT,subst:{2775:"24FF"},offset:0,category:"No",font:nm.NEGATIVECIRCLED},{interval:["24EB","24F4"],base:om.DIGIT,subst:{},offset:11,category:"No",font:nm.NEGATIVECIRCLED},{interval:["24F5","24FE"],base:om.DIGIT,subst:{},offset:1,category:"No",font:nm.DOUBLECIRCLED},{interval:["277F","2789"],base:om.DIGIT,subst:{"277F":"1F10B"},offset:0,category:"No",font:nm.CIRCLEDSANSSERIF},{interval:["2789","2793"],base:om.DIGIT,subst:{2789:"1F10C"},offset:0,category:"No",font:nm.NEGATIVECIRCLEDSANSSERIF},{interval:["FF10","FF19"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.FULLWIDTH},{interval:["1D7CE","1D7D7"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.BOLD},{interval:["1D7D8","1D7E1"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.DOUBLESTRUCK},{interval:["1D7E2","1D7EB"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.SANSSERIF},{interval:["1D7EC","1D7F5"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.SANSSERIFBOLD},{interval:["1D7F6","1D7FF"],base:om.DIGIT,subst:{},offset:0,category:"Nd",font:rm.MONOSPACE},{interval:["1F101","1F10A"],base:om.DIGIT,subst:{},offset:0,category:"No",font:nm.COMMA},{interval:["24B6","24CF"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.CIRCLED},{interval:["24D0","24E9"],base:om.LATINSMALL,subst:{},capital:!1,category:"So",font:nm.CIRCLED},{interval:["1F110","1F129"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.PARENTHESIZED},{interval:["249C","24B5"],base:om.LATINSMALL,subst:{},capital:!1,category:"So",font:nm.PARENTHESIZED},{interval:["1F130","1F149"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.SQUARED},{interval:["1F170","1F189"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.NEGATIVESQUARED},{interval:["1F150","1F169"],base:om.LATINCAP,subst:{},capital:!0,category:"So",font:nm.NEGATIVECIRCLED}],dm=new Map;function um(t,e){return t+e.split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}for(const t of hm){const e=um(t.base,t.font),s=cm(t.interval,t.subst);let i=dm.get(e);i?i.unicode=i.unicode.concat(s):(i=t,i.unicode=s,dm.set(e,i))}var pm;!function(t){t.PUNCTUATION="punctuation",t.FENCE="fence",t.NUMBER="number",t.IDENTIFIER="identifier",t.TEXT="text",t.OPERATOR="operator",t.RELATION="relation",t.LARGEOP="largeop",t.FUNCTION="function",t.ACCENT="accent",t.FENCED="fenced",t.FRACTION="fraction",t.PUNCTUATED="punctuated",t.RELSEQ="relseq",t.MULTIREL="multirel",t.INFIXOP="infixop",t.PREFIXOP="prefixop",t.POSTFIXOP="postfixop",t.APPL="appl",t.INTEGRAL="integral",t.BIGOP="bigop",t.SQRT="sqrt",t.ROOT="root",t.LIMUPPER="limupper",t.LIMLOWER="limlower",t.LIMBOTH="limboth",t.SUBSCRIPT="subscript",t.SUPERSCRIPT="superscript",t.UNDERSCORE="underscore",t.OVERSCORE="overscore",t.TENSOR="tensor",t.TABLE="table",t.MULTILINE="multiline",t.MATRIX="matrix",t.VECTOR="vector",t.CASES="cases",t.ROW="row",t.LINE="line",t.CELL="cell",t.ENCLOSE="enclose",t.INFERENCE="inference",t.RULELABEL="rulelabel",t.CONCLUSION="conclusion",t.PREMISES="premises",t.UNKNOWN="unknown",t.EMPTY="empty"}(pm||(pm={}));const mm=Object.assign({},pm);var fm;!function(t){t.COMMA="comma",t.SEMICOLON="semicolon",t.ELLIPSIS="ellipsis",t.FULLSTOP="fullstop",t.QUESTION="question",t.EXCLAMATION="exclamation",t.QUOTES="quotes",t.DASH="dash",t.TILDE="tilde",t.PRIME="prime",t.DEGREE="degree",t.VBAR="vbar",t.COLON="colon",t.OPENFENCE="openfence",t.CLOSEFENCE="closefence",t.APPLICATION="application",t.DUMMY="dummy",t.UNIT="unit",t.LABEL="label",t.OPEN="open",t.CLOSE="close",t.TOP="top",t.BOTTOM="bottom",t.NEUTRAL="neutral",t.METRIC="metric",t.LATINLETTER="latinletter",t.GREEKLETTER="greekletter",t.OTHERLETTER="otherletter",t.NUMBERSET="numbersetletter",t.INTEGER="integer",t.FLOAT="float",t.OTHERNUMBER="othernumber",t.INFTY="infty",t.MIXED="mixed",t.MULTIACCENT="multiaccent",t.OVERACCENT="overaccent",t.UNDERACCENT="underaccent",t.UNDEROVER="underover",t.SUBSUP="subsup",t.LEFTSUB="leftsub",t.LEFTSUPER="leftsuper",t.RIGHTSUB="rightsub",t.RIGHTSUPER="rightsuper",t.LEFTRIGHT="leftright",t.ABOVEBELOW="abovebelow",t.INTERVAL="interval",t.SETEMPTY="set empty",t.SETEXT="set extended",t.SETSINGLE="set singleton",t.SETCOLLECT="set collection",t.STRING="string",t.SPACE="space",t.ANNOTATION="annotation",t.TEXT="text",t.SEQUENCE="sequence",t.ENDPUNCT="endpunct",t.STARTPUNCT="startpunct",t.NEGATIVE="negative",t.POSITIVE="positive",t.NEGATION="negation",t.MULTIOP="multiop",t.PREFIXOP="prefix operator",t.POSTFIXOP="postfix operator",t.LIMFUNC="limit function",t.INFIXFUNC="infix function",t.PREFIXFUNC="prefix function",t.POSTFIXFUNC="postfix function",t.SIMPLEFUNC="simple function",t.COMPFUNC="composed function",t.SUM="sum",t.INTEGRAL="integral",t.GEOMETRY="geometry",t.BOX="box",t.BLOCK="block",t.ADDITION="addition",t.MULTIPLICATION="multiplication",t.SUBTRACTION="subtraction",t.IMPLICIT="implicit",t.DIVISION="division",t.VULGAR="vulgar",t.EQUALITY="equality",t.INEQUALITY="inequality",t.ARROW="arrow",t.ELEMENT="element",t.NONELEMENT="nonelement",t.REELEMENT="reelement",t.RENONELEMENT="renonelement",t.SET="set",t.DETERMINANT="determinant",t.ROWVECTOR="rowvector",t.BINOMIAL="binomial",t.SQUAREMATRIX="squarematrix",t.CYCLE="cycle",t.MULTILINE="multiline",t.MATRIX="matrix",t.VECTOR="vector",t.CASES="cases",t.TABLE="table",t.CAYLEY="cayley",t.PROOF="proof",t.LEFT="left",t.RIGHT="right",t.UP="up",t.DOWN="down",t.FINAL="final",t.SINGLE="single",t.HYP="hyp",t.AXIOM="axiom",t.LOGIC="logic",t.UNKNOWN="unknown",t.MGLYPH="mglyph"}(fm||(fm={}));const gm=Object.assign({},fm);var bm;!function(t){t.CALIGRAPHIC="caligraphic",t.CALIGRAPHICBOLD="caligraphic-bold",t.OLDSTYLE="oldstyle",t.OLDSTYLEBOLD="oldstyle-bold",t.UNKNOWN="unknown"}(bm||(bm={}));const Em=Object.assign(Object.assign(Object.assign({},rm),bm),nm);var xm;!function(t){t.ALLLETTERS="allLetters",t.D="d",t.BAR="bar",t.TILDE="tilde",t.CURLY="curly",t.PAREN="paren",t.BRACKET="bracket",t.FLOOR="floor",t.CEIL="ceil"}(xm||(xm={}));const ym=Object.assign(Object.assign({},om),xm);var Nm=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);rparseInt(t,16))):e.push(parseInt(s,16));return e}(e);for(const e of r)i[e]||(t.set(String.fromCodePoint(e),String.fromCodePoint(e+s)),i[e]=!0,i[e+s]=!0)}const Rm=["0028","0029","207D","207E","208D","208E","2768","2769","276A","276B","27EE","27EF","FE59","FE5A","FF08","FF09"],Mm=["005B","005D","2045","2046","298B","298C","298D","298E","298F","2990","FF3B","FF3D"],Im=["007B","007D","2774","2775","FE5B","FE5C","FF5B","FF5D"],wm=["2308","2309","2E22","2E23","300C","300E","FF62"],km=["230A","230B","2E24","2E25","300D","300F","FF63"];function Om(t,e){for(const s of t){const t=String.fromCodePoint(parseInt(s,16));Am.Secondary.set(t,e),Am.FencesSecondary.set(t,e)}}const Dm=["cos","cot","csc","sec","sin","tan","arccos","arccot","arccsc","arcsec","arcsin","arctan"].concat(["cosh","coth","csch","sech","sinh","tanh","arcosh","arcoth","arcsch","arsech","arsinh","artanh"],["deg","det","dim","hom","ker","Tr"],["log","ln","lg","exp","gcd","lcm","arg","im","re","Pr"]);function Pm(t,e,s,i,r,n=[],o={},a={}){const l=dm.get(um(t,i));l&&(l.unicode.forEach(t=>{Am.Meaning.set(t,{type:e,role:s,font:r}),n.forEach(e=>Am.Secondary.set(t,e))}),function(t,e){for(const[s,i]of Object.entries(e)){const e=t[s];void 0!==e&&Am.Meaning.set(e,i)}}(l.unicode,o),function(t,e){for(const[s,i]of Object.entries(e)){const e=t[s];void 0!==e&&Am.Secondary.set(e,i)}}(l.unicode,a))}[{set:["23","26","40","5c","a1","a7","b6","bf","2017",["2022","2025"],"2027","203b","203c",["2041","2043"],["2047","2049"],["204b","204d"],"2050","2055","2056",["2058","205e"],"2234","2235","fe45","fe46","fe5f","fe60","fe68","fe6b","ff03","ff06","ff0f","ff20","ff3c"],type:mm.PUNCTUATION,role:gm.UNKNOWN},{set:["22","ab","bb","2dd",["2018","201f"],"2039","203a",["301d","301f"],"fe10","ff02","ff07"],type:mm.PUNCTUATION,role:gm.QUOTES},{set:["3b","204f","2a1f","2a3e","fe14","fe54","ff1b"],type:mm.PUNCTUATION,role:gm.SEMICOLON},{set:["3f","203d","fe16","fe56","ff1f"],type:mm.PUNCTUATION,role:gm.QUESTION},{set:["21","fe15","fe57","ff01"],type:mm.PUNCTUATION,role:gm.EXCLAMATION},{set:["5e","60","a8","aa","b4","ba","2c7",["2d8","2da"],"2040","207a","207d","207e","ff3e","ff40"],type:mm.PUNCTUATION,role:gm.OVERACCENT},{set:["b8","2db","2038","203f","2054","208a","208d","208e"],type:mm.PUNCTUATION,role:gm.UNDERACCENT},{set:["3a","2982","fe13","fe30","fe55","ff1a"],type:mm.PUNCTUATION,role:gm.COLON},{set:["2c","2063","fe50","ff0c"],type:mm.PUNCTUATION,role:gm.COMMA},{set:["2026",["22ee","22f1"],"fe19"],type:mm.PUNCTUATION,role:gm.ELLIPSIS},{set:["2e","fe52","ff0e"],type:mm.PUNCTUATION,role:gm.FULLSTOP},{set:["2d","207b","208b","2212","2796","fe63","ff0d"],type:mm.OPERATOR,role:gm.DASH,secondary:ym.BAR},{set:["5f","af",["2010","2015"],"203e","208b",["fe49","fe4f"],"fe58","ff3f","ffe3"],type:mm.PUNCTUATION,role:gm.DASH,secondary:ym.BAR},{set:["7e","2dc","2f7","303","330","334","2053","223c","223d","301c","ff5e"],type:mm.OPERATOR,role:gm.TILDE,secondary:ym.TILDE},{set:["27","2b9","2ba",["2032","2037"],"2057"],type:mm.PUNCTUATION,role:gm.PRIME},{set:["b0"],type:mm.PUNCTUATION,role:gm.DEGREE},{set:["2b","b1","2064","2213","2214","2228","222a",["228c","228e"],"2294","2295","229d","229e","22bb","22bd","22c4","22ce","22d3","2304","271b","271c","2795","27cf","29fa","29fb","29fe",["2a22","2a28"],"2a2d","2a2e","2a39","2a42","2a45","2a46","2a48","2a4a","2a4c","2a4f","2a50","2a52","2a54","2a56","2a57","2a59","2a5b","2a5d",["2a61","2a63"],"2adc","2add","fe62","ff0b"],type:mm.OPERATOR,role:gm.ADDITION},{set:["2a","b7","d7","2020","2021","204e","2051","2062",["2217","2219"],"2227","2229","2240","2293","2297",["2299","229b"],"22a0","22a1","22b9","22bc",["22c5","22cc"],"22cf","22d2","22d4","2303","2305","2306","25cb","2715","2716","27ce","27d1",["29d1","29d7"],"29e2","2a1d",["2a2f","2a37"],["2a3b","2a3d"],"2a40","2a43","2a44","2a47","2a49","2a4b","2a4d","2a4e","2a51","2a53","2a55","2a58","2a5a","2a5c",["2a5e","2a60"],"2ada","2adb","fe61","ff0a"],type:mm.OPERATOR,role:gm.MULTIPLICATION},{set:["2d","af","2010","2011","2052","207b","208b","2212","2216","2238","2242","2296","229f","2796","29ff",["2a29","2a2c"],"2a3a","2a41","fe63","ff0d"],type:mm.OPERATOR,role:gm.SUBTRACTION},{set:["2f","f7","2044","2215","2298","2797","27cc","29bc",["29f5","29f9"],"2a38"],type:mm.OPERATOR,role:gm.DIVISION},{set:["25","2030","2031","ff05","fe6a"],type:mm.OPERATOR,role:gm.POSTFIXOP},{set:["ac","2200","2201","2203","2204","2206",["221a","221c"],"2310","ffe2"],type:mm.OPERATOR,role:gm.PREFIXOP},{set:["2320","2321","23aa","23ae","23af","23b2","23b3","23b6","23b7"],type:mm.OPERATOR,role:gm.PREFIXOP},{set:["1d7ca","1d7cb"],type:mm.OPERATOR,role:gm.PREFIXOP,font:Em.BOLD},{set:["3d","7e","207c","208c","221d","2237",["223a","223f"],"2243","2245","2248",["224a","224e"],["2251","225f"],"2261","2263","229c","22cd","22d5","29e4","29e6","2a66","2a67",["2a6a","2a6c"],["2a6c","2a78"],"fe66","ff1d"],type:mm.RELATION,role:gm.EQUALITY},{set:["3c","3e","2241","2242","2244","2246","2247","2249","224f","2250","2260","2262",["2264","2281"],"22b0","22b1",["22d6","22e1"],["22e6","22e9"],["2976","2978"],"29c0","29c1","29e1","29e3","29e5",["2a79","2abc"],["2af7","2afa"],"fe64","fe65","ff1c","ff1e"],type:mm.RELATION,role:gm.INEQUALITY},{set:[["2282","228b"],["228f","2292"],["22b2","22b8"],"22d0","22d1",["22e2","22e5"],["22ea","22ed"],"27c3","27c4",["27c7","27c9"],["27d5","27d7"],"27dc",["2979","297b"],"29df",["2abd","2ad8"]],type:mm.RELATION,role:gm.SET},{set:["2236",["27e0","27e5"],"292b","292c",["29b5","29bb"],"29be","29bf",["29c2","29d0"]],type:mm.RELATION,role:gm.UNKNOWN},{set:["2205",["29b0","29b4"]],type:mm.IDENTIFIER,role:gm.SETEMPTY},{set:["1ab2","221e",["29dc","29de"]],type:mm.IDENTIFIER,role:gm.INFTY},{set:["22a2","22a3",["22a6","22af"],"27da","27db","27dd","27de","2ade",["2ae2","2ae6"],"2aec","2aed"],type:mm.RELATION,role:gm.LOGIC},{set:["22a4","22a5","22ba","27d8","27d9","27df","2adf","2ae0",["2ae7","2aeb"],"2af1"],type:mm.IDENTIFIER,role:gm.LOGIC},{set:[["2190","21ff"],"2301","2324","238b","2794",["2798","27af"],["27b1","27be"],["27f0","27ff"],["2900","292a"],["292d","2975"],["297c","297f"],["2b00","2b11"],["2b30","2b4c"],["ffe9","ffec"]],type:mm.RELATION,role:gm.ARROW},{set:["2208","220a",["22f2","22f9"],"22ff","27d2","2ad9"],type:mm.OPERATOR,role:gm.ELEMENT},{set:["2209"],type:mm.OPERATOR,role:gm.NONELEMENT},{set:["220b","220d",["22fa","22fe"]],type:mm.OPERATOR,role:gm.REELEMENT},{set:["220c"],type:mm.OPERATOR,role:gm.RENONELEMENT},{set:[["220f","2211"],["22c0","22c3"],["2a00","2a0b"],"2a3f","2afc","2aff"],type:mm.LARGEOP,role:gm.SUM},{set:["2140"],type:mm.LARGEOP,role:gm.SUM,font:Em.DOUBLESTRUCK},{set:[["222b","2233"],["2a0c","2a17"],["2a17","2a1c"]],type:mm.LARGEOP,role:gm.INTEGRAL},{set:[["2500","257F"]],type:mm.RELATION,role:gm.BOX},{set:[["2580","259F"]],type:mm.IDENTIFIER,role:gm.BLOCK},{set:[["25A0","25FF"],["2B12","2B2F"],["2B50","2B59"]],type:mm.RELATION,role:gm.GEOMETRY},{set:["220e","2300","2302","2311","29bd","29e0",["29e8","29f3"],"2a1e","2afe","ffed","ffee"],type:mm.OPERATOR,role:gm.GEOMETRY},{set:[["221f","2222"],"22be","22bf",["2312","2314"],"237c","27c0",["299b","29af"]],type:mm.OPERATOR,role:gm.GEOMETRY},{set:["24",["a2","a5"],"b5","2123",["2125","2127"],"212a","212b","fe69","ff04","ffe0","ffe1","ffe5","ffe6"],type:mm.IDENTIFIER,role:gm.UNKNOWN},{set:["a9","ae","210f","2114","2116","2117",["211e","2122"],"212e","2132",["2139","213b"],["2141","2144"],"214d","214e",["1f12a","1f12c"],"1f18a"],type:mm.IDENTIFIER,role:gm.OTHERLETTER},{set:["2224","2226","2239","2307","27b0","27bf","27c1","27c2","27ca","27cb","27cd","27d0","27d3","27d4","2981","2999","299a","29e7","29f4","2a20","2a21","2a64","2a65","2a68","2a69","2ae1",["2aee","2af0"],"2af2","2af3","2af5","2af6","2afb","2afd"],type:mm.OPERATOR,role:gm.UNKNOWN},{set:["2605","2606","26aa","26ab",["2720","274d"]],type:mm.OPERATOR,role:gm.UNKNOWN},{set:[["2145","2149"]],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.DOUBLESTRUCKITALIC,secondary:ym.ALLLETTERS},{set:[["213c","213f"]],type:mm.IDENTIFIER,role:gm.GREEKLETTER,font:Em.DOUBLESTRUCK,secondary:ym.ALLLETTERS},{set:["3d0","3d7","3f6",["1d26","1d2a"],"1d5e","1d60",["1d66","1d6a"]],type:mm.IDENTIFIER,role:gm.GREEKLETTER,font:Em.NORMAL,secondary:ym.ALLLETTERS},{set:[["2135","2138"]],type:mm.IDENTIFIER,role:gm.OTHERLETTER,font:Em.NORMAL,secondary:ym.ALLLETTERS},{set:["131","237"],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.NORMAL},{set:["1d6a4","1d6a5"],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.ITALIC},{set:["2113","2118"],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.SCRIPT},{set:[["c0","d6"],["d8","f6"],["f8","1bf"],["1c4","2af"],["1d00","1d25"],["1d6b","1d9a"],["1e00","1ef9"],["363","36f"],["1dd3","1de6"],["1d62","1d65"],"1dca","2071","207f",["2090","209c"],"2c7c"],type:mm.IDENTIFIER,role:gm.LATINLETTER,font:Em.NORMAL},{set:[["00bc","00be"],["2150","215f"],"2189"],type:mm.NUMBER,role:gm.FLOAT},{set:["23E8",["3248","324f"]],type:mm.NUMBER,role:gm.INTEGER},{set:[["214A","214C"],"2705","2713","2714","2717","2718"],type:mm.IDENTIFIER,role:gm.UNKNOWN},{set:["20","a0","ad",["2000","200f"],["2028","202f"],["205f","2060"],"206a","206b","206e","206f","feff",["fff9","fffb"]],type:mm.TEXT,role:gm.SPACE},{set:["7c","a6","2223","23b8","23b9","23d0","2758",["fe31","fe34"],"ff5c","ffe4","ffe8"],type:mm.FENCE,role:gm.NEUTRAL},{set:["2016","2225","2980","2af4"],type:mm.FENCE,role:gm.METRIC}].forEach(t=>{var{set:e}=t,s=Nm(t,["set"]);return Lm(function(t){let e=[];for(const s of t)Array.isArray(s)?e=e.concat(cm(s)):e.push(String.fromCodePoint(parseInt(s,16)));return e}(e),s)}),Sm(Am.FencesVert,["23b4",["23dc","23e1"],["fe35","fe44"],"fe47"]),Sm(Am.FencesHoriz,["28","2045","207D","208D",["2308","230f"],["231c","231f"],"2329","23b0",["2768","2775"],"27c5",["27e6","27ef"],["2983","2998"],["29d8","29db"],"29fc",["2e22","2e29"],["3008","3011"],["3014","301b"],"fd3e","fe17",["fe59","fe5e"],"ff08","ff5f","ff62"]),Sm(Am.FencesHoriz,["5b","7b","ff3b","ff5b"],2),Sm(Am.FencesHoriz,[["239b","23a6"]],3),Sm(Am.FencesHoriz,[["23a7","23a9"]],4),Lm([...Am.FencesHoriz.keys()],{type:mm.FENCE,role:gm.OPEN}),Lm([...Am.FencesHoriz.values()],{type:mm.FENCE,role:gm.CLOSE}),Lm([...Am.FencesVert.keys()],{type:mm.FENCE,role:gm.TOP}),Lm([...Am.FencesVert.values()],{type:mm.FENCE,role:gm.BOTTOM}),Om(Rm,ym.PAREN),Om(Im,ym.CURLY),Om(Mm,ym.BRACKET),Om(wm,ym.CEIL),Om(km,ym.FLOOR),function(){for(const[t,e]of Object.entries(Em)){const s=!!nm[t]?Em.UNKNOWN:e===Em.FULLWIDTH?Em.NORMAL:e;Pm(om.LATINCAP,mm.IDENTIFIER,gm.LATINLETTER,e,s,[ym.ALLLETTERS]),Pm(om.LATINSMALL,mm.IDENTIFIER,gm.LATINLETTER,e,s,[ym.ALLLETTERS],{},{3:ym.D}),Pm(om.GREEKCAP,mm.IDENTIFIER,gm.GREEKLETTER,e,s,[ym.ALLLETTERS]),Pm(om.GREEKSMALL,mm.IDENTIFIER,gm.GREEKLETTER,e,s,[ym.ALLLETTERS],{0:{type:mm.OPERATOR,role:gm.PREFIXOP,font:s},26:{type:mm.OPERATOR,role:gm.PREFIXOP,font:s}}),Pm(om.DIGIT,mm.NUMBER,gm.INTEGER,e,s)}}(),Lm(["inf","lim","liminf","limsup","max","min","sup","injlim","projlim"],{type:mm.FUNCTION,role:gm.LIMFUNC}),Lm(Dm,{type:mm.FUNCTION,role:gm.PREFIXFUNC}),Lm(["mod","rem"],{type:mm.OPERATOR,role:gm.PREFIXFUNC});const Bm=[];function Fm(t,e){for(let s,i=0;s=Bm[i];i++){const i=s.compare(t,e);if(0!==i)return i}return 0}function jm(t){if(t.length<=1)return t;const e=t.slice();!function(t){t.sort(Fm)}(e);const s=[];let i;do{i=e.pop(),s.push(i)}while(i&&e.length&&0===Fm(e[e.length-1],i));return s}function _m(t,e){return t.match(/^.+:.+$/)||!e?t:t+":"+e}new class{constructor(t,e=null){this.comparator=t,this.type=e,function(t){Bm.push(t)}(this)}compare(t,e){return this.type&&this.type===t.type&&this.type===e.type?this.comparator(t,e):0}}(function(t,e){return t.role===gm.SIMPLEFUNC?1:e.role===gm.SIMPLEFUNC?-1:0},mm.IDENTIFIER);class Um extends Map{set(t,e){return super.set(_m(t,e.font),e),this}setNode(t){this.set(t.textContent,t.meaning())}get(t,e=null){return super.get(_m(t,e))}getNode(t){return this.get(t.textContent,t.font)}}class Hm extends Map{add(t,e){const s=this.get(t);s?s.push(e):super.set(t,[e])}get(t,e=null){return super.get(_m(t,e))}getNode(t){return this.get(t.textContent,t.font)}minimize(){for(const[t,e]of this)1===e.length&&this.delete(t)}isMultiValued(){for(const t of this.values())if(t.length>1)return!0;return!1}}class Wm extends Hm{add(t,e){super.add(_m(t,e.font),e)}addNode(t){this.add(t.textContent,t)}toString(){const t=[];for(const[e,s]of this){const i=Array(e.length+3).join(" "),r=s.map(t=>t.toString()).join("\n"+i);t.push(e+": "+r)}return t.join("\n")}collateMeaning(){const t=new zm;for(const[e,s]of this)t.set(e,s.map(t=>t.meaning()));return t}}class zm extends Hm{add(t,e){const s=this.get(t,e.font);s&&s.find(function(t){return i=e,(s=t).type===i.type&&s.role===i.role&&s.font===i.font;var s,i})||super.add(_m(t,e.font),e)}addNode(t){this.add(t.textContent,t.meaning())}toString(){const t=[];for(const[e,s]of this){const i=Array(e.length+3).join(" "),r=s.map(t=>`{type: ${t.type}, role: ${t.role}, font: ${t.font}}`).join("\n"+i);t.push(e+": "+r)}return t.join("\n")}reduce(){for(const[t,e]of this)1!==e.length&&this.set(t,jm(e))}default(){const t=new Um;for(const[e,s]of this)1===s.length&&t.set(e,s[0]);return t}newDefault(){const t=this.default();this.reduce();const e=this.default();return t.size!==e.size?e:null}}var qm;!function(t){t.ANNOTATION="ANNOTATION",t.ANNOTATIONXML="ANNOTATION-XML",t.MACTION="MACTION",t.MALIGNGROUP="MALIGNGROUP",t.MALIGNMARK="MALIGNMARK",t.MATH="MATH",t.MENCLOSE="MENCLOSE",t.MERROR="MERROR",t.MFENCED="MFENCED",t.MFRAC="MFRAC",t.MGLYPH="MGLYPH",t.MI="MI",t.MLABELEDTR="MLABELEDTR",t.MMULTISCRIPTS="MMULTISCRIPTS",t.MN="MN",t.MO="MO",t.MOVER="MOVER",t.MPADDED="MPADDED",t.MPHANTOM="MPHANTOM",t.MPRESCRIPTS="MPRESCRIPTS",t.MROOT="MROOT",t.MROW="MROW",t.MS="MS",t.MSPACE="MSPACE",t.MSQRT="MSQRT",t.MSTYLE="MSTYLE",t.MSUB="MSUB",t.MSUBSUP="MSUBSUP",t.MSUP="MSUP",t.MTABLE="MTABLE",t.MTD="MTD",t.MTEXT="MTEXT",t.MTR="MTR",t.MUNDER="MUNDER",t.MUNDEROVER="MUNDEROVER",t.NONE="NONE",t.SEMANTICS="SEMANTICS"}(qm||(qm={}));const Vm=Object.values(qm),Xm=[qm.MO,qm.MI,qm.MN,qm.MTEXT,qm.MS,qm.MSPACE],Gm=[qm.MERROR,qm.MPHANTOM,qm.MALIGNGROUP,qm.MALIGNMARK,qm.MPRESCRIPTS,qm.ANNOTATION,qm.ANNOTATIONXML],Jm=[qm.MATH,qm.MROW,qm.MPADDED,qm.MACTION,qm.NONE,qm.MSTYLE,qm.SEMANTICS],Km=[qm.MROOT,qm.MSQRT],$m=["aria-label","exact-speech","alt"];function Ym(t){return!!t&&$p(t)===qm.MATH}function Qm(t){return!!t&&(Gm.includes($p(t))||!Vm.includes($p(t)))}function Zm(t){return!!t&&Jm.includes($p(t))}function tf(t){return!!t&&$p(t)===qm.MGLYPH&&!function(t){return!!t&&Xm.includes($p(t))}(t.parentNode)}function ef(t){const e=[];for(let s,i=0;s=t[i];i++){if(s.nodeType!==zp.ELEMENT_NODE)continue;const t=$p(s);Gm.includes(t)||(Jm.includes(t)&&0===s.childNodes.length||e.push(s))}return e}function sf(t,e){var s;if(null===(s=e.attributes)||void 0===s?void 0:s.length){const s=e.attributes;for(let e=s.length-1;e>=0;e--){const i=s[e].name;i.match(/^ext/)&&(t.attributes[i]=s[e].value,t.nobreaking=!0),$m.includes(i)&&(t.attributes["ext-speech"]=s[e].value,t.nobreaking=!0),"href"===i&&(t.attributes.href=s[e].value,t.nobreaking=!0),"data-latex"!==i.toLowerCase()&&"latex"!==i.toLowerCase()||(t.attributes.latex=s[e].value),i.match(/texclass$/)&&(t.attributes.texclass=s[e].value),"color"!==i&&"mathcolor"!==i||(t.attributes.color=s[e].value)}}}function rf(t){return t&&t.embellished&&t.childNodes.length>0?rf(t.childNodes[0]):t}function nf(t,e,s){s&&t.reverse();const i=[];for(let r,n=0;r=t[n];n++){if(e(r))return s?{head:t.slice(n+1).reverse(),div:r,tail:i.reverse()}:{head:i,div:r,tail:t.slice(n+1)};i.push(r)}return s?{head:[],div:null,tail:i.reverse()}:{head:i,div:null,tail:[]}}function of(t,e){let s=t;const i=[],r=[];let n=null;do{n=nf(s,e),r.push(n.head),i.push(n.div),s=n.tail}while(n.div);return i.pop(),{rel:i,comp:r}}function af(t,e){if(t.mathmlTree)return;const s=new Set;if(e.forEach(t=>{var e;return s.add((null===(e=t.mathmlTree)||void 0===e?void 0:e.parentElement)||null)}),1===s.size&&!s.has(null)){const i=[...s][0];return Zm(i)&&i.childNodes.length===e.length?void(t.mathmlTree=i):void 0}if(s.has(null)&&s.size<=2&&(s.delete(null),t.mathml.forEach(e=>{e.parentElement&&!t.mathml.includes(e)&&s.add(e.parentElement)})),1===s.size&&!s.has(null)){const e=[...s][0];if(Zm(e)&&qp(e.childNodes).every(e=>t.mathml.includes(e)))return void(t.mathmlTree=e)}}var lf;!function(t){t.EMBELLISHED="embellished",t.FENCEPOINTER="fencepointer",t.FONT="font",t.ID="id",t.ANNOTATION="annotation",t.ROLE="role",t.TYPE="type",t.CHILDREN="children",t.CONTENT="content",t.TEXT="$t"}(lf||(lf={}));class cf{static fromXml(t){const e=parseInt(t.getAttribute("id"),10),s=new cf(e);return s.type=t.tagName,cf.setAttribute(s,t,"role"),cf.setAttribute(s,t,"font"),cf.setAttribute(s,t,"embellished"),cf.setAttribute(s,t,"fencepointer","fencePointer"),t.getAttribute("annotation")&&s.parseAnnotation(t.getAttribute("annotation")),sf(s,t),cf.processChildren(s,t),s}static setAttribute(t,e,s,i){i=i||s;const r=e.getAttribute(s);r&&(t[i]=r)}static processChildren(t,e){for(const s of qp(e.childNodes)){if(s.nodeType===zp.TEXT_NODE){t.textContent=s.textContent;continue}const e=qp(s.childNodes).map(cf.fromXml);e.forEach(e=>e.parent=t),"CONTENT"===$p(s)?t.contentNodes=e:t.childNodes=e}}constructor(t){this.id=t,this.mathml=[],this.parent=null,this.type=mm.UNKNOWN,this.role=gm.UNKNOWN,this.font=Em.UNKNOWN,this.embellished=null,this.fencePointer="",this.childNodes=[],this.textContent="",this.mathmlTree=null,this.contentNodes=[],this.annotation={},this.attributes={},this.nobreaking=!1,this.noupdate=!1}querySelectorAll(t){let e=[];for(let s,i=0;s=this.childNodes[i];i++)e=e.concat(s.querySelectorAll(t));for(let s,i=0;s=this.contentNodes[i];i++)e=e.concat(s.querySelectorAll(t));return t(this)&&e.unshift(this),e}xml(t,e){const s=function(s,i){const r=i.map(function(s){return s.xml(t,e)}),n=t.createElementNS("",s);for(let t,e=0;t=r[e];e++)n.appendChild(t);return n},i=t.createElementNS("",this.type);return e||this.xmlAttributes(i),i.textContent=this.textContent,this.contentNodes.length>0&&i.appendChild(s(lf.CONTENT,this.contentNodes)),this.childNodes.length>0&&i.appendChild(s(lf.CHILDREN,this.childNodes)),i}toString(t=!1){const e=Vp("");return Yp(this.xml(e.ownerDocument,t))}allAttributes(){const t=[];return t.push([lf.ROLE,this.role]),this.font!==Em.UNKNOWN&&t.push([lf.FONT,this.font]),Object.keys(this.annotation).length&&t.push([lf.ANNOTATION,this.annotationXml()]),this.embellished&&t.push([lf.EMBELLISHED,this.embellished]),this.fencePointer&&t.push([lf.FENCEPOINTER,this.fencePointer]),t.push([lf.ID,this.id.toString()]),t}annotationXml(){const t=[];for(const[e,s]of Object.entries(this.annotation))s.forEach(s=>t.push(e+":"+s));return t.join(";")}attributesXml(){const t=[];for(const[e,s]of Object.entries(this.attributes))t.push(e+":"+cf.escapeValue(s));return t.join(";")}toJson(){const t={};t[lf.TYPE]=this.type;const e=this.allAttributes();for(let s,i=0;s=e[i];i++)t[s[0]]=s[1].toString();return this.textContent&&(t[lf.TEXT]=this.textContent),this.childNodes.length&&(t[lf.CHILDREN]=this.childNodes.map(function(t){return t.toJson()})),this.contentNodes.length&&(t[lf.CONTENT]=this.contentNodes.map(function(t){return t.toJson()})),t}updateContent(t,e){const s=e?t.replace(/^[ \f\n\r\t\v\u200b]*/,"").replace(/[ \f\n\r\t\v\u200b]*$/,""):t.trim();if(t=t&&!s?t:s,this.textContent===t)return;const i=Am.Meaning.get(t.replace(/\s/g," "));this.textContent=t,this.role=i.role,this.type=i.type,this.font=i.font}addMathmlNodes(t){for(let e,s=0;e=t[s];s++)-1===this.mathml.indexOf(e)&&this.mathml.push(e)}appendChild(t){this.childNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this}replaceChild(t,e){const s=this.childNodes.indexOf(t);if(-1===s)return;t.parent=null,e.parent=this,this.childNodes[s]=e;const i=t.mathml.filter(function(t){return-1===e.mathml.indexOf(t)}),r=e.mathml.filter(function(e){return-1===t.mathml.indexOf(e)});this.removeMathmlNodes(i),this.addMathmlNodes(r)}appendContentNode(t){t&&(this.contentNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this)}removeContentNode(t){if(t){const e=this.contentNodes.indexOf(t);-1!==e&&this.contentNodes.slice(e,1)}}equals(t){if(!t)return!1;if(this.type!==t.type||this.role!==t.role||this.textContent!==t.textContent||this.childNodes.length!==t.childNodes.length||this.contentNodes.length!==t.contentNodes.length)return!1;for(let e,s,i=0;e=this.childNodes[i],s=t.childNodes[i];i++)if(!e.equals(s))return!1;for(let e,s,i=0;e=this.contentNodes[i],s=t.contentNodes[i];i++)if(!e.equals(s))return!1;return!0}displayTree(){console.info(this.displayTree_(0))}addAnnotation(t,e){e&&this.addAnnotation_(t,e)}getAnnotation(t){const e=this.annotation[t];return e||[]}hasAnnotation(t,e){const s=this.annotation[t];return!!s&&-1!==s.indexOf(e)}parseAnnotation(t){const e=t.split(";");for(let t=0,s=e.length;t0&&mf(e[e.length-1],gm.OPENFENCE)}function kf(t){return t.childNodes.every(function(t){return t.childNodes.length<=1})}function Of(t){return uf(t,mm.LINE)&&t.contentNodes.length&&mf(t.contentNodes[0],gm.LABEL)}function Df(t){return uf(t,mm.LARGEOP)||uf(t,mm.LIMBOTH)||uf(t,mm.LIMLOWER)||uf(t,mm.LIMUPPER)||uf(t,mm.FUNCTION)&&mf(t,gm.LIMFUNC)||(uf(t,mm.OVERSCORE)||uf(t,mm.UNDERSCORE))&&Df(t.childNodes[0])}function Pf(t,e,s){return 1===e.length&&(t[s].type===mm.PUNCTUATION||t[s].embellished===mm.PUNCTUATION)&&t[s]===e[0]}function Bf(t){return uf(t,mm.IDENTIFIER)&&mf(t,gm.SIMPLEFUNC)}const Ff=[mm.PUNCTUATION,mm.PUNCTUATED,mm.RELSEQ,mm.MULTIREL,mm.TABLE,mm.MULTILINE,mm.CASES,mm.INFERENCE],jf=[mm.LIMUPPER,mm.LIMLOWER,mm.LIMBOTH,mm.SUBSCRIPT,mm.SUPERSCRIPT,mm.UNDERSCORE,mm.OVERSCORE,mm.TENSOR];function _f(t){const e=t.type;return-1===Ff.indexOf(e)&&(e!==mm.INFIXOP||t.role===gm.IMPLICIT)&&(e===mm.FENCED?t.role!==gm.LEFTRIGHT||_f(t.childNodes[0]):-1===jf.indexOf(e)||_f(t.childNodes[0]))}function Uf(t){return function(t){return t.type===mm.NUMBER&&(t.role===gm.INTEGER||t.role===gm.FLOAT)}(t)||t.role===gm.VULGAR||t.role===gm.MIXED}function Hf(t){const e=t.childNodes;return t.role===gm.UNIT&&(!e.length||e[0].role===gm.UNIT)}function Wf(t){const e=t.childNodes;return t.type===mm.INFIXOP&&(t.role===gm.MULTIPLICATION||t.role===gm.IMPLICIT)&&e.length&&(Hf(e[0])||Uf(e[0]))&&t.childNodes.slice(1).every(Hf)}function zf(t){return t.type===mm.INFIXOP&&(t.role===gm.IMPLICIT||t.role===gm.UNIT&&!!t.contentNodes.length&&t.contentNodes[0].textContent===vm.invisibleTimes)}function qf(t){return t.type===mm.INFIXOP&&t.role===gm.IMPLICIT}function Vf(t){return t.role===gm.NEUTRAL||t.role===gm.METRIC}function Xf(t,e){return Vf(t)&&Vf(e)&&rf(t).textContent===rf(e).textContent}function Gf(t){return!!Vf(t)&&(!t.embellished||t.type!==mm.SUPERSCRIPT&&t.type!==mm.SUBSCRIPT&&(t.type!==mm.TENSOR||t.childNodes[3].type===mm.EMPTY&&t.childNodes[4].type===mm.EMPTY))}function Jf(t){return!!Vf(t)&&(!t.embellished||(t.type!==mm.TENSOR||t.childNodes[1].type===mm.EMPTY&&t.childNodes[2].type===mm.EMPTY))}function Kf(t){return[gm.ELEMENT,gm.NONELEMENT,gm.REELEMENT,gm.RENONELEMENT].includes(t.role)}const $f={factory:null,options:new kp,updateFactory:function(t){$f.factory=t},heuristics:new Map,flags:{combine_juxtaposition:!0,convert_juxtaposition:!0,multioperator:!0},blacklist:{},add:function(t){const e=t.name;$f.heuristics.set(e,t),$f.flags[e]||($f.flags[e]=!1)},run:function(t,e,s){const i=$f.heuristics.get(t);return i&&!$f.blacklist[t]&&($f.flags[t]||i.applicable(e))?i.apply(e):s?s(e):e}};class Yf{static getInstance(){return Yf.instance=Yf.instance||new Yf,Yf.instance}static tableToMultiline(t){if(!kf(t))return $f.run("rewrite_subcases",t,Yf.classifyTable);t.type=mm.MULTILINE;for(let e,s=0;e=t.childNodes[s];s++)Yf.rowToLine_(e,gm.MULTILINE);return 1===t.childNodes.length&&!Of(t.childNodes[0])&&If(t.childNodes[0].childNodes[0])&&Yf.tableToMatrixOrVector_(Yf.rewriteFencedLine_(t)),Yf.classifyMultiline(t)}static number(t){t.type!==mm.UNKNOWN&&t.type!==mm.IDENTIFIER||(t.type=mm.NUMBER),Yf.meaningFromContent(t,Yf.numberRole_),Yf.exprFont_(t)}static classifyMultiline(t){return Yf.binomialForm_(t),Yf.classifyMultiline_(t),t}static classifyMultiline_(t){let e=0;const s=t.childNodes.length;let i;for(;e=s)return;const r=i.childNodes[0].role;r!==gm.UNKNOWN&&t.childNodes.every(function(t){const e=t.childNodes[0];return!e||e.role===r&&(uf(e,mm.RELATION)||uf(e,mm.RELSEQ))})&&(t.role=r)}static classifyTable(t){const e=Yf.computeColumns_(t);return Yf.classifyByColumns_(t,e,gm.EQUALITY)||Yf.classifyByColumns_(t,e,gm.INEQUALITY,[gm.EQUALITY])||Yf.classifyByColumns_(t,e,gm.ARROW)||Yf.detectCaleyTable(t),t}static detectCaleyTable(t){if(!t.mathmlTree)return!1;const e=t.mathmlTree,s=e.getAttribute("columnlines"),i=e.getAttribute("rowlines");return!(!s||!i)&&(!(!Yf.cayleySpacing(s)||!Yf.cayleySpacing(i))&&(t.role=gm.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,s){const i=Yf.separateSemantics(e);return Yf.getInstance().proof(t,i,s)}static findSemantics(t,e,s){const i=null==s?null:s,r=Yf.getSemantics(t);return!!r&&(!!r[e]&&(null==i||r[e]===i))}static getSemantics(t){const e=t.getAttribute("semantics");return e?Yf.separateSemantics(e):null}static removePrefix(t){const[,...e]=t.split("_");return e.join("_")}static separateSemantics(t){const e={};return t.split(";").forEach(function(t){const[s,i]=t.split(":");e[Yf.removePrefix(s)]=i}),e}static matchSpaces_(t,e){for(let s,i=0;s=e[i];i++){const e=t[i].mathmlTree,r=t[i+1].mathmlTree;if(!e||!r)continue;const n=e.nextSibling;if(!n||n===r)continue;const o=Yf.getSpacer_(n);o&&o!==r&&(s.addMathmlNodes([o]),s.mathmlTree=o,s.role=gm.SPACE)}}static getSpacer_(t){if($p(t)===qm.MSPACE)return t;for(;Zm(t)&&1===t.childNodes.length;)if($p(t=t.childNodes[0])===qm.MSPACE)return t;return null}static fenceToPunct_(t){const e=Yf.FENCE_TO_PUNCT_[t.role];if(e){for(;t.embellished;)t.embellished=mm.PUNCTUATION,mf(t,gm.SUBSUP)||mf(t,gm.UNDEROVER)||(t.role=e),t=t.childNodes[0];t.type=mm.PUNCTUATION,t.role=e}}static classifyFunction_(t,e){if(t.type===mm.APPL||t.type===mm.BIGOP||t.type===mm.INTEGRAL)return"";if(e[0]&&e[0].textContent===vm.functionApplication){Yf.getInstance().funcAppls[t.id]=e.shift();let s=gm.SIMPLEFUNC;return $f.run("simple2prefix",t),t.role!==gm.PREFIXFUNC&&t.role!==gm.LIMFUNC||(s=t.role),Yf.propagateFunctionRole_(t,s),"prefix"}const s=Yf.CLASSIFY_FUNCTION_[t.role];return s||((i=t).type===mm.IDENTIFIER||i.role===gm.LATINLETTER||i.role===gm.GREEKLETTER||i.role===gm.OTHERLETTER?"simple":"");var i}static propagateFunctionRole_(t,e){if(t){if(t.type===mm.INFIXOP)return;mf(t,gm.SUBSUP)||mf(t,gm.UNDEROVER)||(t.role=e),Yf.propagateFunctionRole_(t.childNodes[0],e)}}static getFunctionOp_(t,e){if(e(t))return t;for(let s,i=0;s=t.childNodes[i];i++){const t=Yf.getFunctionOp_(s,e);if(t)return t}return null}static tableToMatrixOrVector_(t){const e=t.childNodes[0];uf(e,mm.MULTILINE)?Yf.tableToVector_(t):Yf.tableToMatrix_(t),t.contentNodes.forEach(e.appendContentNode.bind(e));for(let t,s=0;t=e.childNodes[s];s++)Yf.assignRoleToRow_(t,Yf.getComponentRoles_(e));return e.parent=null,e}static tableToVector_(t){const e=t.childNodes[0];e.type=mm.VECTOR,1!==e.childNodes.length?Yf.binomialForm_(e):Yf.tableToSquare_(t)}static binomialForm_(t){mf(t,gm.UNKNOWN)&&(2===t.childNodes.length&&(t.role=gm.BINOMIAL,t.childNodes[0].role=gm.BINOMIAL,t.childNodes[1].role=gm.BINOMIAL))}static tableToMatrix_(t){const e=t.childNodes[0];e.type=mm.MATRIX,e.childNodes&&e.childNodes.length>0&&e.childNodes[0].childNodes&&e.childNodes.length===e.childNodes[0].childNodes.length?Yf.tableToSquare_(t):e.childNodes&&1===e.childNodes.length&&(e.role=gm.ROWVECTOR)}static tableToSquare_(t){const e=t.childNodes[0];mf(e,gm.UNKNOWN)&&(Vf(t)?e.role=gm.DETERMINANT:e.role=gm.SQUAREMATRIX)}static getComponentRoles_(t){const e=t.role;return e&&e!==gm.UNKNOWN?e:t.type.toLowerCase()||gm.UNKNOWN}static tableToCases_(t,e){for(let e,s=0;e=t.childNodes[s];s++)Yf.assignRoleToRow_(e,gm.CASES);return t.type=mm.CASES,t.appendContentNode(e),kf(t)&&Yf.binomialForm_(t),t}static rewriteFencedLine_(t){const e=t.childNodes[0],s=t.childNodes[0].childNodes[0],i=t.childNodes[0].childNodes[0].childNodes[0];return s.parent=t.parent,t.parent=s,i.parent=e,s.childNodes=[t],e.childNodes=[i],s}static rowToLine_(t,e){const s=e||gm.UNKNOWN;uf(t,mm.ROW)&&(t.type=mm.LINE,t.role=s,1===t.childNodes.length&&uf(t.childNodes[0],mm.CELL)&&(t.childNodes=t.childNodes[0].childNodes,t.childNodes.forEach(function(e){e.parent=t})))}static assignRoleToRow_(t,e){uf(t,mm.LINE)?t.role=e:uf(t,mm.ROW)&&(t.role=e,t.childNodes.forEach(function(t){uf(t,mm.CELL)&&(t.role=e)}))}static nextSeparatorFunction_(t){let e;if(t){if(t.match(/^\s+$/))return null;e=t.replace(/\s/g,"").split("").filter(function(t){return t})}else e=[","];return function(){return e.length>1?e.shift():e[0]}}static meaningFromContent(t,e){const s=[...t.textContent].filter(t=>t.match(/[^\s]/)),i=s.map(t=>Am.Meaning.get(t));e(t,s,i)}static numberRole_(t,e,s){if(t.role===gm.UNKNOWN)return s.every(function(t){return t.type===mm.NUMBER&&t.role===gm.INTEGER||t.type===mm.PUNCTUATION&&t.role===gm.COMMA})?(t.role=gm.INTEGER,void("0"===e[0]&&t.addAnnotation("general","basenumber"))):void(s.every(function(t){return t.type===mm.NUMBER&&t.role===gm.INTEGER||t.type===mm.PUNCTUATION})?t.role=gm.FLOAT:t.role=gm.OTHERNUMBER)}static exprFont_(t){t.font===Em.UNKNOWN&&Yf.compSemantics(t,"font",Em)}static compSemantics(t,e,s){const i=[...t.textContent].map(t=>Am.Meaning.get(t)).reduce(function(t,i){return t&&i[e]&&i[e]!==s.UNKNOWN&&i[e]!==t?t===s.UNKNOWN?i[e]:null:t},s.UNKNOWN);i&&(t[e]=i)}static purgeFences_(t){const e=t.rel,s=t.comp,i=[],r=[];for(;e.length>0;){const t=e.shift();let n=s.shift();Lf(t)?(i.push(t),r.push(n)):(Yf.fenceToPunct_(t),n.push(t),n=n.concat(s.shift()),s.unshift(n))}return r.push(s.shift()),{rel:i,comp:r}}static rewriteFencedNode_(t){const e=t.contentNodes[0],s=t.contentNodes[1];let i=Yf.rewriteFence_(t,e);return t.contentNodes[0]=i.fence,i=Yf.rewriteFence_(i.node,s),t.contentNodes[1]=i.fence,t.contentNodes[0].parent=t,t.contentNodes[1].parent=t,function(t){const e=Am.FencesSecondary.get(t.contentNodes[0].textContent),s=Am.FencesSecondary.get(t.contentNodes[1].textContent);e===s&&t.addAnnotation("fences",e)}(t),i.node.parent=null,i.node}static rewriteFence_(t,e){if(!e.embellished)return{node:t,fence:e};const s=e.childNodes[0],i=Yf.rewriteFence_(t,s);return uf(e,mm.SUPERSCRIPT)||uf(e,mm.SUBSCRIPT)||uf(e,mm.TENSOR)?(mf(e,gm.SUBSUP)||(e.role=t.role),s!==i.node&&(e.replaceChild(s,i.node),s.parent=t),Yf.propagateFencePointer_(e,s),{node:e,fence:i.fence}):(e.replaceChild(s,i.fence),e.mathmlTree&&-1===e.mathml.indexOf(e.mathmlTree)&&e.addMathmlNodes([e.mathmlTree]),{node:i.node,fence:e})}static propagateFencePointer_(t,e){t.fencePointer=e.fencePointer||e.id.toString(),t.embellished=null}static classifyByColumns_(t,e,s,i=[]){const r=[s].concat(i);return!!(3===e.length&&Yf.testColumns_(e,1,t=>Yf.isPureRelation_(t,r))||2===e.length&&(Yf.testColumns_(e,1,t=>Yf.isEndRelation_(t,r)||Yf.isPureRelation_(t,r))||Yf.testColumns_(e,0,t=>Yf.isEndRelation_(t,r,!0)||Yf.isPureRelation_(t,r))))&&(t.role=s,!0)}static isEndRelation_(t,e,s){const i=s?t.childNodes.length-1:0;return uf(t,mm.RELSEQ)&&e.some(e=>mf(t,e))&&uf(t.childNodes[i],mm.EMPTY)}static isPureRelation_(t,e){return uf(t,mm.RELATION)&&e.some(e=>mf(t,e))}static computeColumns_(t){const e=[];for(let s,i=0;s=t.childNodes[i];i++)for(let t,i=0;t=s.childNodes[i];i++){e[i]?e[i].push(t):e[i]=[t]}return e}static testColumns_(t,e,s){const i=t[e];return!!i&&(i.some(function(t){return t.childNodes.length&&s(t.childNodes[0])})&&i.every(function(t){return!t.childNodes.length||s(t.childNodes[0])}))}setNodeFactory(t){Yf.getInstance().factory_=t,$f.updateFactory(Yf.getInstance().factory_)}getNodeFactory(){return Yf.getInstance().factory_}identifierNode(t,e,s){if("MathML-Unit"!==s||(i=t,[gm.DEGREE].includes(i.role)||[].includes(i.type))){if(!e&&1===t.textContent.length&&(t.role===gm.INTEGER||t.role===gm.LATINLETTER||t.role===gm.GREEKLETTER)&&t.font===Em.NORMAL)return t.font=Em.ITALIC,$f.run("simpleNamedFunction",t)}else t.type=mm.IDENTIFIER,t.role=gm.UNIT;var i;return t.type===mm.UNKNOWN&&(t.type=mm.IDENTIFIER),Yf.exprFont_(t),$f.run("simpleNamedFunction",t)}implicitNode(t){if(t=Yf.getInstance().getMixedNumbers_(t),t=Yf.getInstance().combineUnits_(t),1===(t=Yf.getInstance().combineScripts_(t)).length)return t[0];const e=Yf.getInstance().implicitNode_(t);return $f.run("combine_juxtaposition",e)}text(t,e){if(Yf.exprFont_(t),t.type=mm.TEXT,e===qm.ANNOTATIONXML)return t.role=gm.ANNOTATION,t;if(e===qm.MS)return t.role=gm.STRING,t;if(e===qm.MSPACE||t.textContent.match(/^\s*$/))return t.role=gm.SPACE,t;if(/\s/.exec(t.textContent))return t.role=gm.TEXT,t;const s=[...t.textContent];if(1!==s.length)return t.role=gm.UNKNOWN,t;const i=Am.Meaning.get(s[0]);return i.type===mm.UNKNOWN||i.type===mm.IDENTIFIER||(t.type=i.type,t.role=i.role,t.font=i.font,t.addAnnotation("general","text")),t}row(t){return 0===(t=t.filter(function(t){return!uf(t,mm.EMPTY)||t.hasAnnotation("empty","MFENCED")})).length?Yf.getInstance().factory_.makeEmptyNode():(t=Yf.getInstance().getFencesInRow_(t),t=Yf.getInstance().tablesInRow(t),t=Yf.getInstance().getPunctuationInRow_(t),t=Yf.getInstance().getTextInRow_(t),t=Yf.getInstance().getFunctionsInRow_(t),Yf.getInstance().relationsInRow_(t))}limitNode(t,e){if(!e.length)return Yf.getInstance().factory_.makeEmptyNode();let s=e[0],{length:i}=Yf.MML_TO_LIMIT_[t];if(e=e.slice(0,i+1),[t,e]=Yf.getInstance().cleanLimitNode(t,e,i),!e[1])return s;let{type:r,length:n}=Yf.MML_TO_LIMIT_[t];if(1===n&&e[1].role===gm.DEGREE)return Yf.getInstance().row([e[0],e[1]]);if($f.run("op_with_limits",e),Df(s)){if(1===n&&ff(e[1])||2===n&&ff(e[1])&&ff(e[2])){let i=Yf.MML_TO_BOUNDS_[t];return Yf.getInstance().accentNode_(s,e,i.type,i.length,i.accent)}if(2===n){if(ff(e[1]))return s=Yf.getInstance().accentNode_(s,[s,e[1]],{MSUBSUP:mm.SUBSCRIPT,MUNDEROVER:mm.UNDERSCORE}[t],1,!0),e[2]?Yf.getInstance().makeLimitNode_(s,[s,e[2]],null,mm.LIMUPPER):s;if(e[2]&&ff(e[2]))return s=Yf.getInstance().accentNode_(s,[s,e[2]],{MSUBSUP:mm.SUPERSCRIPT,MUNDEROVER:mm.OVERSCORE}[t],1,!0),Yf.getInstance().makeLimitNode_(s,[s,e[1]],null,mm.LIMLOWER);e[n]||(r=mm.LIMLOWER)}return Yf.getInstance().makeLimitNode_(s,e,null,r)}const o=Yf.MML_TO_BOUNDS_[t];return Yf.getInstance().accentNode_(s,e,o.type,o.length,o.accent)}cleanLimitNode(t,e,s){const i=t=>(t=>!t||uf(t,mm.EMPTY))(t)||(t=>t&&uf(t,mm.TEXT)&&mf(t,gm.SPACE))(t);if(1===s)return i(e[1])?(e[0].noupdate=!0,[t,[Zf([t],e[0])]]):[t,e];const r=e[1],n=e[2];return i(r)&&i(n)?(e[0].noupdate=!0,[t,[Zf([t],e[0])]]):i(r)?[t===qm.MSUBSUP?qm.MSUP:qm.MOVER,[e[0],n]]:i(n)?[t===qm.MSUBSUP?qm.MSUB:qm.MUNDER,[e[0],r]]:[t,e]}tablesInRow(t){let e=of(t,Mf),s=[];for(let t,i=0;t=e.rel[i];i++)s=s.concat(e.comp.shift()),s.push(Yf.tableToMatrixOrVector_(t));s=s.concat(e.comp.shift()),e=of(s,Rf),s=[];for(let t,i=0;t=e.rel[i];i++){const i=e.comp.shift();wf(0,i)&&Yf.tableToCases_(t,i.pop()),s=s.concat(i),(s.length||e.comp[0].length)&&(t=Yf.rewriteTrivialTable(t)),s.push(t)}return s.concat(e.comp.shift())}mfenced(t,e,s,i){if(s&&i.length>0){const t=Yf.nextSeparatorFunction_(s),e=[i.shift()];i.forEach(s=>{e.push(Yf.getInstance().factory_.makeContentNode(t())),e.push(s)}),i=e}return t&&e?Yf.getInstance().horizontalFencedNode_(Yf.getInstance().factory_.makeContentNode(t),Yf.getInstance().factory_.makeContentNode(e),i):(t&&i.unshift(Yf.getInstance().factory_.makeContentNode(t)),e&&i.push(Yf.getInstance().factory_.makeContentNode(e)),Yf.getInstance().row(i))}fractionLikeNode(t,e,s,i){let r;if(!i&&function(t){if(!t)return!1;if(["negativeveryverythinmathspace","negativeverythinmathspace","negativethinmathspace","negativemediummathspace","negativethickmathspace","negativeverythickmathspace","negativeveryverythickmathspace"].includes(t))return!0;const e=t.match(/[0-9.]+/);return!!e&&0===parseFloat(e[0])}(s)){const s=Yf.getInstance().factory_.makeBranchNode(mm.LINE,[t],[]),i=Yf.getInstance().factory_.makeBranchNode(mm.LINE,[e],[]);return r=Yf.getInstance().factory_.makeBranchNode(mm.MULTILINE,[s,i],[]),Yf.classifyMultiline(r)}return r=Yf.getInstance().fractionNode_(t,e),i&&r.addAnnotation("general","bevelled"),r}tensor(t,e,s,i,r){const n=Yf.getInstance().factory_.makeBranchNode(mm.TENSOR,[t,Yf.getInstance().scriptNode_(e,gm.LEFTSUB),Yf.getInstance().scriptNode_(s,gm.LEFTSUPER),Yf.getInstance().scriptNode_(i,gm.RIGHTSUB),Yf.getInstance().scriptNode_(r,gm.RIGHTSUPER)],[]);return n.role=t.role,n.embellished=Nf(t),n}pseudoTensor(t,e,s){const i=t=>!uf(t,mm.EMPTY),r=e.filter(i).length,n=s.filter(i).length;if(!r&&!n)return t;const o=r?n?qm.MSUBSUP:qm.MSUB:qm.MSUP,a=[t];return r&&a.push(Yf.getInstance().scriptNode_(e,gm.RIGHTSUB,!0)),n&&a.push(Yf.getInstance().scriptNode_(s,gm.RIGHTSUPER,!0)),Yf.getInstance().limitNode(o,a)}font(t){const e=Yf.MATHJAX_FONTS[t];return e||t}proof(t,e,s){if(e.inference||e.axiom||console.log("Noise"),e.axiom){const e=Yf.getInstance().cleanInference(t.childNodes),i=e.length?Yf.getInstance().factory_.makeBranchNode(mm.INFERENCE,s(e),[]):Yf.getInstance().factory_.makeEmptyNode();return i.role=gm.AXIOM,i.mathmlTree=t,i}const i=Yf.getInstance().inference(t,e,s);return e.proof&&(i.role=gm.PROOF,i.childNodes[0].role=gm.FINAL),i}inference(t,e,s){if(e.inferenceRule){const e=Yf.getInstance().getFormulas(t,[],s);return Yf.getInstance().factory_.makeBranchNode(mm.INFERENCE,[e.conclusion,e.premises],[])}const i=e.labelledRule,r=qp(t.childNodes),n=[];"left"!==i&&"both"!==i||n.push(Yf.getInstance().getLabel(t,r,s,gm.LEFT)),"right"!==i&&"both"!==i||n.push(Yf.getInstance().getLabel(t,r,s,gm.RIGHT));const o=Yf.getInstance().getFormulas(t,r,s),a=Yf.getInstance().factory_.makeBranchNode(mm.INFERENCE,[o.conclusion,o.premises],n);return a.mathmlTree=t,a}getLabel(t,e,s,i){const r=Yf.getInstance().findNestedRow(e,"prooflabel",i),n=Yf.getInstance().factory_.makeBranchNode(mm.RULELABEL,s(qp(r.childNodes)),[]);return n.role=i,n.mathmlTree=r,n}getFormulas(t,e,s){const i=e.length?Yf.getInstance().findNestedRow(e,"inferenceRule"):t,r="up"===Yf.getSemantics(i).inferenceRule,n=r?i.childNodes[1]:i.childNodes[0],o=r?i.childNodes[0]:i.childNodes[1],a=n.childNodes[0].childNodes[0],l=qp(a.childNodes[0].childNodes),c=[];let h=1;for(const t of l)h%2&&c.push(t.childNodes[0]),h++;const d=s(c),u=s(qp(o.childNodes[0].childNodes))[0],p=Yf.getInstance().factory_.makeBranchNode(mm.PREMISES,d,[]);p.mathmlTree=a;const m=Yf.getInstance().factory_.makeBranchNode(mm.CONCLUSION,[u],[]);return m.mathmlTree=o.childNodes[0].childNodes[0],{conclusion:m,premises:p}}findNestedRow(t,e,s){return Yf.getInstance().findNestedRow_(t,e,0,s)}cleanInference(t){return qp(t).filter(function(t){return"MSPACE"!==$p(t)})}operatorNode(t){return t.type===mm.UNKNOWN&&(t.type=mm.OPERATOR),$f.run("multioperator",t)}static rewriteTrivialTable(t){return uf(e=t,mm.MULTILINE)&&1===e.childNodes.length&&e.childNodes[0].childNodes.length&&!Of(e.childNodes[0])?Yf.getInstance().unwrapTrivialTable(t):t;var e}unwrapTrivialTable(t){if(!t.childNodes[0].childNodes.length)return Yf.getInstance().factory_.makeEmptyNode();const e=t.childNodes[0].childNodes[0];return e.parent=null,Zf([qm.MTD,qm.MTR,qm.MTABLE],e),e}constructor(){this.funcAppls={},this.splitRoles=new Map([[gm.SUBTRACTION,gm.NEGATIVE],[gm.ADDITION,gm.POSITIVE]]),this.splitOps=["\u2212","-","\u2010","\u2011","+"],this.factory_=new hf,$f.updateFactory(this.factory_)}implicitNode_(t){const e=Yf.getInstance().factory_.makeMultipleContentNodes(t.length-1,vm.invisibleTimes);Yf.matchSpaces_(t,e);const s=Yf.getInstance().infixNode_(t,e[0]);return s.role=gm.IMPLICIT,e.forEach(function(t){t.parent=s}),s.contentNodes=e,s}infixNode_(t,e){let s=Yf.getInstance().factory_.makeBranchNode(mm.INFIXOP,t,[e],rf(e).textContent);return s.role=e.role,s=$f.run("propagateInterval",s),$f.run("propagateSimpleFunction",s)}explicitMixed_(t){const e=of(t,function(t){return t.textContent===vm.invisiblePlus});if(!e.rel.length)return t;let s=[];for(let t,i=0;t=e.rel[i];i++){const r=e.comp[i],n=e.comp[i+1],o=r.length-1;if(r[o]&&n[0]&&uf(r[o],mm.NUMBER)&&!mf(r[o],gm.MIXED)&&uf(n[0],mm.FRACTION)){const t=Yf.getInstance().factory_.makeBranchNode(mm.NUMBER,[r[o],n[0]],[]);t.role=gm.MIXED,s=s.concat(r.slice(0,o)),s.push(t),n.shift()}else s=s.concat(r),s.push(t)}return s.concat(e.comp[e.comp.length-1])}concatNode_(t,e,s){if(0===e.length)return t;const i=e.map(function(t){return rf(t).textContent}).join(" "),r=Yf.getInstance().factory_.makeBranchNode(s,[t],e,i);return e.length>1&&(r.role=gm.MULTIOP),af(r,[t,...e]),r}multiopNode_(t){const e=Yf.getInstance().factory_.makeBranchNode(mm.OPERATOR,t,[]);return e.role=gm.MULTIOP,af(e,t),e}prefixNode_(t,e){const s=this.splitSingles(e);let i=t;for(;s.length>0;){const t=s.pop();i=Yf.getInstance().concatNode_(i,t,mm.PREFIXOP),1===t.length&&-1!==this.splitOps.indexOf(t[0].textContent)&&(i.role=this.splitRoles.get(t[0].role))}return i}splitSingles(t){let e=0;const s=[];let i=0;for(;iuf(t,mm.SUPERSCRIPT)&&uf(t.childNodes[0],mm.EMPTY)||uf(t,mm.SUBSCRIPT)&&uf(t.childNodes[0],mm.EMPTY));if(!e.rel.length)return t;let s=[];do{const t=e.comp.shift(),i=e.rel.shift();if(!t.length){s.push(i);continue}const r=t.pop();uf(r,mm.NUMBER)||uf(r,mm.IDENTIFIER)?(i.childNodes[0]=r,r.parent=i,i.role=r.type.toLowerCase(),i.addAnnotation("collapsed",r.type.toLowerCase()),s=s.concat(t),s.push(i)):uf(r,mm.SUBSCRIPT)&&uf(i,mm.SUPERSCRIPT)?(i.childNodes[0]=r,r.parent=i,i.role=r.type.toLowerCase(),i.addAnnotation("collapsed",r.type.toLowerCase()),r.role=gm.SUBSUP,s=s.concat(t),s.push(i)):(s=s.concat(t),s.push(r),s.push(i))}while(e.rel.length);return s=s.concat(e.comp.pop()),s}combineUnits_(t){const e=of(t,function(t){return!mf(t,gm.UNIT)});if(t.length===e.rel.length)return e.rel;const s=[];let i,r;do{const t=e.comp.shift();i=e.rel.shift();let n=null;r=s.pop(),r&&(t.length&&Uf(r)?t.unshift(r):s.push(r)),1===t.length&&(n=t.pop()),t.length>1&&(n=Yf.getInstance().implicitNode_(t),n.role=gm.UNIT),n&&s.push(n),i&&s.push(i)}while(i);return s}getMixedNumbers_(t){const e=of(t,function(t){return uf(t,mm.FRACTION)&&mf(t,gm.VULGAR)});if(!e.rel.length)return t;let s=[];for(let t,i=0;t=e.rel[i];i++){const r=e.comp[i],n=r.length-1;if(r[n]&&uf(r[n],mm.NUMBER)&&(mf(r[n],gm.INTEGER)||mf(r[n],gm.FLOAT))){const e=Yf.getInstance().factory_.makeBranchNode(mm.NUMBER,[r[n],t],[]);e.role=gm.MIXED,s=s.concat(r.slice(0,n)),s.push(e)}else s=s.concat(r),s.push(t)}return s.concat(e.comp[e.comp.length-1])}getTextInRow_(t){if(0===t.length)return t;if(1===t.length)return t[0].type===mm.TEXT&&t[0].role===gm.UNKNOWN&&(t[0].role=gm.ANNOTATION),t;const{rel:e,comp:s}=of(t,t=>uf(t,mm.TEXT)&&!t.annotation.factor);if(0===e.length)return t;const i=[];let r=s.shift();for(;e.length>0;){let t=e.shift(),n=s.shift();const o=[];for(;!n.length&&e.length&&t.role!==gm.SPACE&&e[0].role!==gm.SPACE;)o.push(t),t=e.shift(),n=s.shift();if(o.length&&(o.push(t),t=Yf.getInstance().dummyNode_(o)),t.role!==gm.UNKNOWN){const e=Qf(r,t,n);if(e){r=e;continue}r.length&&i.push(Yf.getInstance().row(r)),i.push(t),r=n;continue}const a=Am.Meaning.get(t.textContent);if(a.type!==mm.UNKNOWN){t.type=a.type,t.role=a.role,t.font=a.font,t.addAnnotation("general","text"),r.push(t),r=r.concat(n);continue}if(Yf.meaningFromContent(t,(t,e,s)=>{if(t.role===gm.UNKNOWN){if(Yf.numberRole_(t,e,s),t.role===gm.OTHERNUMBER)return s.some(t=>t.type!==mm.NUMBER&&t.type!==mm.IDENTIFIER)?(t.type=mm.TEXT,void(t.role=gm.ANNOTATION)):void(t.role=gm.UNKNOWN);t.type=mm.NUMBER}}),t.role===gm.UNKNOWN&&(e.length||n.length?n.length&&n[0].type===mm.FENCED?(t.type=mm.FUNCTION,t.role=gm.PREFIXFUNC):t.role=gm.TEXT:(t.type=mm.IDENTIFIER,t.role=gm.UNIT)),t.type!==mm.TEXT){r.push(t),r=r.concat(n);continue}const l=Qf(r,t,n);l?r=l:(r.length&&i.push(Yf.getInstance().row(r)),i.push(t),r=n)}return r.length>0&&i.push(Yf.getInstance().row(r)),i.length>1?[Yf.getInstance().dummyNode_(i)]:i}relationsInRow_(t){const e=of(t,Tf),s=e.rel[0];if(!s)return Yf.getInstance().operationsInRow_(t);if(1===t.length)return t[0];const i=e.comp.map(Yf.getInstance().operationsInRow_);let r;return e.rel.some(function(t){return!t.equals(s)})?(r=Yf.getInstance().factory_.makeBranchNode(mm.MULTIREL,i,e.rel),e.rel.every(function(t){return t.role===s.role})&&(r.role=s.role),r):(r=Yf.getInstance().factory_.makeBranchNode(mm.RELSEQ,i,e.rel,rf(s).textContent),r.role=s.role,r)}operationsInRow_(t){if(0===t.length)return Yf.getInstance().factory_.makeEmptyNode();if(1===(t=Yf.getInstance().explicitMixed_(t)).length)return t[0];const e=[];for(;t.length>0&&vf(t[0]);)e.push(t.shift());if(0===t.length)return Yf.getInstance().multiopNode_(e);if(1===t.length)return Yf.getInstance().prefixNode_(t[0],e);const s=nf(t=$f.run("convert_juxtaposition",t),vf),i=Yf.getInstance().wrapFactor(e,s);return Yf.getInstance().addFactor(i,s)}wrapPostfix(t){var e;(null===(e=t.div)||void 0===e?void 0:e.role)===gm.POSTFIXOP&&(t.tail.length&&t.tail[0].type!==mm.OPERATOR?t.div.role=gm.DIVISION:(t.head=[Yf.getInstance().postfixNode_(Yf.getInstance().implicitNode(t.head),[t.div])],t.div=t.tail.shift(),Yf.getInstance().wrapPostfix(t)))}wrapFactor(t,e){return Yf.getInstance().wrapPostfix(e),Yf.getInstance().prefixNode_(Yf.getInstance().implicitNode(e.head),t)}addFactor(t,e){return e.div?Yf.getInstance().operationsTree_(e.tail,t,e.div):(Wf(t)&&(t.role=gm.UNIT),t)}operationsTree_(t,e,s,i=[]){if(0===t.length){if(i.unshift(s),e.type===mm.INFIXOP){const t=Yf.getInstance().postfixNode_(e.childNodes.pop(),i);return e.appendChild(t),e}return Yf.getInstance().postfixNode_(e,i)}const r=nf(t,vf);if(0===r.head.length)return i.push(r.div),Yf.getInstance().operationsTree_(r.tail,e,s,i);const n=Yf.getInstance().wrapFactor(i,r),o=Yf.getInstance().appendOperand_(e,s,n);return Yf.getInstance().addFactor(o,r)}appendOperand_(t,e,s){if(t.type!==mm.INFIXOP)return Yf.getInstance().infixNode_([t,s],e);const i=Yf.getInstance().appendDivisionOp_(t,e,s);return i||(Yf.getInstance().appendExistingOperator_(t,e,s)?t:e.role===gm.MULTIPLICATION?Yf.getInstance().appendMultiplicativeOp_(t,e,s):Yf.getInstance().appendAdditiveOp_(t,e,s))}appendDivisionOp_(t,e,s){return e.role===gm.DIVISION?zf(t)?Yf.getInstance().infixNode_([t,s],e):Yf.getInstance().appendLastOperand_(t,e,s):t.role===gm.DIVISION?Yf.getInstance().infixNode_([t,s],e):null}appendLastOperand_(t,e,s){let i=t,r=t.childNodes[t.childNodes.length-1];for(;r&&r.type===mm.INFIXOP&&!zf(r);)i=r,r=i.childNodes[t.childNodes.length-1];const n=Yf.getInstance().infixNode_([i.childNodes.pop(),s],e);return i.appendChild(n),t}appendMultiplicativeOp_(t,e,s){if(zf(t))return Yf.getInstance().infixNode_([t,s],e);let i=t,r=t.childNodes[t.childNodes.length-1];for(;r&&r.type===mm.INFIXOP&&!zf(r);)i=r,r=i.childNodes[t.childNodes.length-1];const n=Yf.getInstance().infixNode_([i.childNodes.pop(),s],e);return i.appendChild(n),t}appendAdditiveOp_(t,e,s){return Yf.getInstance().infixNode_([t,s],e)}appendExistingOperator_(t,e,s){return!(!t||t.type!==mm.INFIXOP||zf(t))&&(t.contentNodes[0].equals(e)?(t.appendContentNode(e),t.appendChild(s),!0):Yf.getInstance().appendExistingOperator_(t.childNodes[t.childNodes.length-1],e,s))}getFencesInRow_(t){let e=of(t,Af);e=Yf.purgeFences_(e);const s=e.comp.shift();return Yf.getInstance().fences_(e.rel,e.comp,[],[s])}fences_(t,e,s,i){if(0===t.length&&0===s.length)return i[0];const r=$f.run("bracketed_interval",[t[0],t[1],...e[0]||[]],()=>null);if(r){t.shift(),t.shift(),e.shift();const n=i.pop()||[];return i.push([...n,r,...e.shift()]),Yf.getInstance().fences_(t,e,s,i)}const n=t=>mf(t,gm.OPEN);if(0===t.length){const t=i.shift();for(;s.length>0;){if(n(s[0])){const e=s.shift();Yf.fenceToPunct_(e),t.push(e)}else{const e=nf(s,n),r=e.head.length-1,o=Yf.getInstance().neutralFences_(e.head,i.slice(0,r));i=i.slice(r),t.push(...o),e.div&&e.tail.unshift(e.div),s=e.tail}t.push(...i.shift())}return t}const o=s[s.length-1],a=t[0].role;if(a===gm.OPEN||Vf(t[0])&&(!o||!Xf(t[0],o))){s.push(t.shift());const r=e.shift();return r&&i.push(r),Yf.getInstance().fences_(t,e,s,i)}if(o&&a===gm.CLOSE&&o.role===gm.OPEN){const r=Yf.getInstance().horizontalFencedNode_(s.pop(),t.shift(),i.pop());return i.push(i.pop().concat([r],e.shift())),Yf.getInstance().fences_(t,e,s,i)}if(o&&Xf(t[0],o)){if(!Gf(o)||!Jf(t[0])){s.push(t.shift());const r=e.shift();return r&&i.push(r),Yf.getInstance().fences_(t,e,s,i)}const r=Yf.getInstance().horizontalFencedNode_(s.pop(),t.shift(),i.pop());return i.push(i.pop().concat([r],e.shift())),Yf.getInstance().fences_(t,e,s,i)}if(o&&a===gm.CLOSE&&Vf(o)&&s.some(n)){const r=nf(s,n,!0),o=i.pop(),a=i.length-r.tail.length+1,l=Yf.getInstance().neutralFences_(r.tail,i.slice(a));i=i.slice(0,a);const c=Yf.getInstance().horizontalFencedNode_(r.div,t.shift(),i.pop().concat(l,o));return i.push(i.pop().concat([c],e.shift())),Yf.getInstance().fences_(t,e,r.head,i)}const l=t.shift();return Yf.fenceToPunct_(l),i.push(i.pop().concat([l],e.shift())),Yf.getInstance().fences_(t,e,s,i)}neutralFences_(t,e){if(0===t.length)return t;if(1===t.length)return Yf.fenceToPunct_(t[0]),t;const s=t.shift();if(!Gf(s)){Yf.fenceToPunct_(s);const i=e.shift();return i.unshift(s),i.concat(Yf.getInstance().neutralFences_(t,e))}const i=nf(t,function(t){return Xf(t,s)});if(!i.div){Yf.fenceToPunct_(s);const i=e.shift();return i.unshift(s),i.concat(Yf.getInstance().neutralFences_(t,e))}if(!Jf(i.div))return Yf.fenceToPunct_(i.div),t.unshift(s),Yf.getInstance().neutralFences_(t,e);const r=Yf.getInstance().combineFencedContent_(s,i.div,i.head,e);if(i.tail.length>0){const t=r.shift(),e=Yf.getInstance().neutralFences_(i.tail,r);return t.concat(e)}return r[0]}combineFencedContent_(t,e,s,i){if(0===s.length){const s=Yf.getInstance().horizontalFencedNode_(t,e,i.shift());return i.length>0?i[0].unshift(s):i=[[s]],i}const r=i.shift(),n=s.length-1,o=i.slice(0,n),a=(i=i.slice(n)).shift(),l=Yf.getInstance().neutralFences_(s,o);r.push(...l),r.push(...a);const c=Yf.getInstance().horizontalFencedNode_(t,e,r);return i.length>0?i[0].unshift(c):i=[[c]],i}horizontalFencedNode_(t,e,s){const i=Yf.getInstance().row(s);uf(i,mm.EMPTY)&&!i.mathmlTree&&t.mathmlTree&&t.mathmlTree.nextSibling!==e.mathmlTree&&(i.mathmlTree=t.mathmlTree.nextSibling,i.addMathmlNodes([t.mathmlTree.nextSibling]));let r=Yf.getInstance().factory_.makeBranchNode(mm.FENCED,[i],[t,e]);return t.role===gm.OPEN?(Yf.getInstance().classifyHorizontalFence_(r),r=$f.run("propagateComposedFunction",r)):r.role=t.role,r=$f.run("detect_cycle",r),Yf.rewriteFencedNode_(r)}classifyHorizontalFence_(t){if($f.run("interval_heuristic",t),t.role===gm.INTERVAL)return;t.role=gm.LEFTRIGHT;const e=t.childNodes;if(!function(t){return function(t){return!!t&&-1!==["{","\ufe5b","\uff5b"].indexOf(t.textContent)}(t.contentNodes[0])&&function(t){return!!t&&-1!==["}","\ufe5c","\uff5d"].indexOf(t.textContent)}(t.contentNodes[1])}(t)||e.length>1)return;if(0===e.length||e[0].type===mm.EMPTY)return void(t.role=gm.SETEMPTY);const s=e[0].type;if(1===e.length&&_f(e[0]))return void(t.role=gm.SETSINGLE);const i=e[0].role;if(s===mm.PUNCTUATED&&i===gm.SEQUENCE){if(e[0].contentNodes[0].role!==gm.COMMA)return 1!==e[0].contentNodes.length||e[0].contentNodes[0].role!==gm.VBAR&&e[0].contentNodes[0].role!==gm.COLON?void 0:(t.role=gm.SETEXT,void Yf.getInstance().setExtension_(t));t.role=gm.SETCOLLECT}}setExtension_(t){const e=t.childNodes[0].childNodes[0];e&&e.type===mm.INFIXOP&&1===e.contentNodes.length&&Kf(e.contentNodes[0])&&(e.addAnnotation("set","intensional"),e.contentNodes[0].addAnnotation("set","intensional"))}getPunctuationInRow_(t){if(t.length<=1)return t;const e=t=>{const e=t.type;return"punctuation"===e||"text"===e||"operator"===e||"relation"===e},s=of(t,function(s){if(!Cf(s))return!1;if(Cf(s)&&!mf(s,gm.ELLIPSIS))return!0;const i=t.indexOf(s);if(0===i)return!t[1]||!e(t[1]);const r=t[i-1];if(i===t.length-1)return!e(r);const n=t[i+1];return!e(r)||!e(n)});if(0===s.rel.length)return t;let i=[],r=s.comp.shift();r.length>0&&i.push(Yf.getInstance().row(r));let n=0;for(;s.comp.length>0;){let t=[];const e=n;do{t.push(s.rel[n++]),r=s.comp.shift()}while(s.rel[n]&&r&&0===r.length);t=$f.run("ellipses",t),s.rel.splice(e,n-e,...t),n=e+t.length,i=i.concat(t),r&&r.length>0&&i.push(Yf.getInstance().row(r))}return 1===i.length&&1===s.rel.length?i:[Yf.getInstance().punctuatedNode_(i,s.rel)]}punctuatedNode_(t,e){const s=Yf.getInstance().factory_.makeBranchNode(mm.PUNCTUATED,t,e);if(e.length===t.length){const t=e[0].role;if(t!==gm.UNKNOWN&&e.every(function(e){return e.role===t}))return s.role=t,s}const i=e[0];return Pf(t,e,0)?s.role=i.childNodes.length&&!i.embellished?i.role:gm.STARTPUNCT:Pf(t,e,t.length-1)?s.role=i.childNodes.length&&!i.embellished?i.role:gm.ENDPUNCT:e.every(t=>mf(t,gm.DUMMY))?s.role=gm.TEXT:e.every(t=>mf(t,gm.SPACE))?s.role=gm.SPACE:s.role=gm.SEQUENCE,s}dummyNode_(t){const e=Yf.getInstance().factory_.makeMultipleContentNodes(t.length-1,vm.invisibleComma);return e.forEach(function(t){t.role=gm.DUMMY}),Yf.getInstance().punctuatedNode_(t,e)}accentRole_(t,e){if(!ff(t))return!1;const s=t.textContent,i=Am.Secondary.get(s,ym.BAR)||Am.Secondary.get(s,ym.TILDE)||t.role;return t.role=e===mm.UNDERSCORE?gm.UNDERACCENT:gm.OVERACCENT,t.addAnnotation("accent",i),!0}accentNode_(t,e,s,i,r){const n=(e=e.slice(0,i+1))[1],o=e[2];let a;if(!r&&o&&(a=Yf.getInstance().factory_.makeBranchNode(mm.SUBSCRIPT,[t,n],[]),a.role=gm.SUBSUP,e=[a,o],s=mm.SUPERSCRIPT),r){const i=Yf.getInstance().accentRole_(n,s);if(o){Yf.getInstance().accentRole_(o,mm.OVERSCORE)&&!i?(a=Yf.getInstance().factory_.makeBranchNode(mm.OVERSCORE,[t,o],[]),e=[a,n],s=mm.UNDERSCORE):(a=Yf.getInstance().factory_.makeBranchNode(mm.UNDERSCORE,[t,n],[]),e=[a,o],s=mm.OVERSCORE),a.role=gm.UNDEROVER}}return Yf.getInstance().makeLimitNode_(t,e,a,s)}makeLimitNode_(t,e,s,i){if(i===mm.LIMUPPER&&t.type===mm.LIMLOWER)return t.childNodes.push(e[1]),e[1].parent=t,t.type=mm.LIMBOTH,t;if(i===mm.LIMLOWER&&t.type===mm.LIMUPPER)return t.childNodes.splice(1,-1,e[1]),e[1].parent=t,t.type=mm.LIMBOTH,t;const r=Yf.getInstance().factory_.makeBranchNode(i,e,[]),n=Nf(t);return s&&(s.embellished=n),r.embellished=n,r.role=t.role,r}getFunctionsInRow_(t,e){const s=e||[];if(0===t.length)return s;const i=t.shift(),r=Yf.classifyFunction_(i,t);if(!r)return s.push(i),Yf.getInstance().getFunctionsInRow_(t,s);const n=Yf.getInstance().getFunctionsInRow_(t,[]),o=Yf.getInstance().getFunctionArgs_(i,n,r);return s.concat(o)}getFunctionArgs_(t,e,s){let i,r,n;switch(s){case"integral":{const s=Yf.getInstance().getIntegralArgs_(e);if(!s.intvar&&!s.integrand.length)return s.rest.unshift(t),s.rest;const i=Yf.getInstance().row(s.integrand);return n=Yf.getInstance().integralNode_(t,i,s.intvar),$f.run("intvar_from_fraction",n),s.rest.unshift(n),s.rest}case"prefix":if(e[0]&&e[0].type===mm.FENCED){const s=e.shift();return Vf(s)||(s.role=gm.LEFTRIGHT),n=Yf.getInstance().functionNode_(t,s),e.unshift(n),e}if(i=nf(e,gf),i.head.length)r=Yf.getInstance().row(i.head),i.div&&i.tail.unshift(i.div);else{if(!i.div||!uf(i.div,mm.APPL))return e.unshift(t),e;r=i.div}return n=Yf.getInstance().functionNode_(t,r),i.tail.unshift(n),i.tail;case"bigop":return i=nf(e,bf),i.head.length?(r=Yf.getInstance().row(i.head),n=Yf.getInstance().bigOpNode_(t,r),i.div&&i.tail.unshift(i.div),i.tail.unshift(n),i.tail):(e.unshift(t),e);default:{if(0===e.length)return[t];const s=e[0];return s.type===mm.FENCED&&!Vf(s)&&function(t){const e=t.childNodes;if(0===e.length)return!0;if(e.length>1)return!1;const s=e[0];if(s.type===mm.INFIXOP){if(s.role!==gm.IMPLICIT)return!1;if(s.childNodes.some(t=>uf(t,mm.INFIXOP)))return!1}return!0}(s)?(s.role=gm.LEFTRIGHT,Yf.propagateFunctionRole_(t,gm.SIMPLEFUNC),n=Yf.getInstance().functionNode_(t,e.shift()),e.unshift(n),e):(e.unshift(t),e)}}}getIntegralArgs_(t,e=[]){if(0===t.length){const t=nf(e,bf);return t.div&&t.tail.unshift(t.div),{integrand:t.head,intvar:null,rest:t.tail}}$f.run("intvar_from_implicit",t);const s=t[0];if(yf(s)){const{integrand:s,rest:i}=Yf.getInstance().getIntegralArgs_(e);return{integrand:s,intvar:null,rest:i.concat(t)}}if(xf(s))return s.role=gm.INTEGRAL,{integrand:e,intvar:s,rest:t.slice(1)};if(t[1]&&Ef(s,t[1])){const i=Yf.getInstance().prefixNode_(t[1],[s]);return i.role=gm.INTEGRAL,{integrand:e,intvar:i,rest:t.slice(2)}}return e.push(t.shift()),Yf.getInstance().getIntegralArgs_(t,e)}functionNode_(t,e){const s=Yf.getInstance().factory_.makeContentNode(vm.functionApplication),i=Yf.getInstance().funcAppls[t.id];i&&(s.mathmlTree=i.mathmlTree,s.addMathmlNodes(i.mathml),s.annotation=i.annotation,s.attributes=i.attributes,delete Yf.getInstance().funcAppls[t.id]),s.type=mm.PUNCTUATION,s.role=gm.APPLICATION;const r=Yf.getFunctionOp_(t,function(t){return uf(t,mm.FUNCTION)||uf(t,mm.IDENTIFIER)&&mf(t,gm.SIMPLEFUNC)});return Yf.getInstance().functionalNode_(mm.APPL,[t,e],r,[s])}bigOpNode_(t,e){const s=Yf.getFunctionOp_(t,t=>uf(t,mm.LARGEOP));return Yf.getInstance().functionalNode_(mm.BIGOP,[t,e],s,[])}integralNode_(t,e,s){e=e||Yf.getInstance().factory_.makeEmptyNode(),s=s||Yf.getInstance().factory_.makeEmptyNode();const i=Yf.getFunctionOp_(t,t=>uf(t,mm.LARGEOP));return Yf.getInstance().functionalNode_(mm.INTEGRAL,[t,e,s],i,[])}functionalNode_(t,e,s,i){const r=e[0];let n;s&&(n=s.parent,i.push(s));const o=Yf.getInstance().factory_.makeBranchNode(t,e,i);return o.role=r.role,n&&(s.parent=n),o}fractionNode_(t,e){const s=Yf.getInstance().factory_.makeBranchNode(mm.FRACTION,[t,e],[]);return s.role=s.childNodes.every(function(t){return uf(t,mm.NUMBER)&&mf(t,gm.INTEGER)})?gm.VULGAR:s.childNodes.every(Hf)?gm.UNIT:gm.DIVISION,$f.run("propagateSimpleFunction",s)}scriptNode_(t,e,s){let i;switch(t.length){case 0:i=Yf.getInstance().factory_.makeEmptyNode();break;case 1:if(i=t[0],s)return i;break;default:i=Yf.getInstance().dummyNode_(t),i.addAnnotation("general","script")}return i.role=e,i}findNestedRow_(t,e,s,i){if(s>3)return null;for(let r,n=0;r=t[n];n++){const t=$p(r);if(t!==qm.MSPACE){if(t===qm.MROW)return Yf.getInstance().findNestedRow_(qp(r.childNodes),e,s+1,i);if(Yf.findSemantics(r,e,i))return r}}return null}}function Qf(t,e,s){const i=t[t.length-1];if(i&&(i.type===mm.RELATION||i.type===mm.OPERATOR))return e.addAnnotation("factor",i.type),[...t,e,...s];const r=s[0];return!r||r.type!==mm.RELATION&&r.type!==mm.OPERATOR?null:(e.addAnnotation("factor",r.type),[...t,e,...s])}function Zf(t,e){return t.forEach(t=>e.addAnnotation("empty",t)),e}Yf.FENCE_TO_PUNCT_={[gm.METRIC]:gm.METRIC,[gm.NEUTRAL]:gm.VBAR,[gm.OPEN]:gm.OPENFENCE,[gm.CLOSE]:gm.CLOSEFENCE},Yf.MML_TO_LIMIT_={[qm.MSUB]:{type:mm.LIMLOWER,length:1},[qm.MUNDER]:{type:mm.LIMLOWER,length:1},[qm.MSUP]:{type:mm.LIMUPPER,length:1},[qm.MOVER]:{type:mm.LIMUPPER,length:1},[qm.MSUBSUP]:{type:mm.LIMBOTH,length:2},[qm.MUNDEROVER]:{type:mm.LIMBOTH,length:2}},Yf.MML_TO_BOUNDS_={[qm.MSUB]:{type:mm.SUBSCRIPT,length:1,accent:!1},[qm.MSUP]:{type:mm.SUPERSCRIPT,length:1,accent:!1},[qm.MSUBSUP]:{type:mm.SUBSCRIPT,length:2,accent:!1},[qm.MUNDER]:{type:mm.UNDERSCORE,length:1,accent:!0},[qm.MOVER]:{type:mm.OVERSCORE,length:1,accent:!0},[qm.MUNDEROVER]:{type:mm.UNDERSCORE,length:2,accent:!0}},Yf.CLASSIFY_FUNCTION_={[gm.INTEGRAL]:"integral",[gm.SUM]:"bigop",[gm.PREFIXFUNC]:"prefix",[gm.LIMFUNC]:"prefix",[gm.SIMPLEFUNC]:"prefix",[gm.COMPFUNC]:"prefix"},Yf.MATHJAX_FONTS={"-tex-caligraphic":Em.CALIGRAPHIC,"-tex-caligraphic-bold":Em.CALIGRAPHICBOLD,"-tex-calligraphic":Em.CALIGRAPHIC,"-tex-calligraphic-bold":Em.CALIGRAPHICBOLD,"-tex-oldstyle":Em.OLDSTYLE,"-tex-oldstyle-bold":Em.OLDSTYLEBOLD,"-tex-mathit":Em.ITALIC};class tg extends df{static getAttribute_(t,e,s){if(!t.hasAttribute(e))return s;const i=t.getAttribute(e);return i.match(/^\s*$/)?null:i}constructor(t){super("MathML"),this.options=t,$f.options=t,this.parseMap_=new Map([[qm.SEMANTICS,this.semantics_.bind(this)],[qm.MATH,this.rows_.bind(this)],[qm.MROW,this.rows_.bind(this)],[qm.MPADDED,this.rows_.bind(this)],[qm.MSTYLE,this.rows_.bind(this)],[qm.MFRAC,this.fraction_.bind(this)],[qm.MSUB,this.limits_.bind(this)],[qm.MSUP,this.limits_.bind(this)],[qm.MSUBSUP,this.limits_.bind(this)],[qm.MOVER,this.limits_.bind(this)],[qm.MUNDER,this.limits_.bind(this)],[qm.MUNDEROVER,this.limits_.bind(this)],[qm.MROOT,this.root_.bind(this)],[qm.MSQRT,this.sqrt_.bind(this)],[qm.MTABLE,this.table_.bind(this)],[qm.MLABELEDTR,this.tableLabeledRow_.bind(this)],[qm.MTR,this.tableRow_.bind(this)],[qm.MTD,this.tableCell_.bind(this)],[qm.MS,this.text_.bind(this)],[qm.MTEXT,this.text_.bind(this)],[qm.MSPACE,this.space_.bind(this)],[qm.ANNOTATIONXML,this.text_.bind(this)],[qm.MI,this.identifier_.bind(this)],[qm.MN,this.number_.bind(this)],[qm.MO,this.operator_.bind(this)],[qm.MFENCED,this.fenced_.bind(this)],[qm.MENCLOSE,this.enclosed_.bind(this)],[qm.MMULTISCRIPTS,this.multiscripts_.bind(this)],[qm.ANNOTATION,this.empty_.bind(this)],[qm.NONE,this.empty_.bind(this)],[qm.MACTION,this.action_.bind(this)],[qm.MPHANTOM,this.phantom_.bind(this)]]);const e={type:mm.IDENTIFIER,role:gm.NUMBERSET,font:Em.DOUBLESTRUCK};["C","H","N","P","Q","R","Z","\u2102","\u210d","\u2115","\u2119","\u211a","\u211d","\u2124"].forEach((t=>this.getFactory().defaultMap.set(t,e)).bind(this))}parse(t){Yf.getInstance().setNodeFactory(this.getFactory());const e=qp(t.childNodes),s=$p(t),i=this.parseMap_.get(s),r=(i||this.dummy_.bind(this))(t,e);return r.noupdate?r:(sf(r,t),-1!==[qm.MATH,qm.MROW,qm.MPADDED,qm.MSTYLE,qm.SEMANTICS,qm.MACTION].indexOf(s)||(r.mathml.unshift(t),r.mathmlTree=t),r)}semantics_(t,e){return e.length?this.parse(e[0]):this.getFactory().makeEmptyNode()}rows_(t,e){const s=t.getAttribute("semantics");if(s&&s.match("bspr_"))return Yf.proof(t,s,this.parseList.bind(this));let i;if(1===(e=ef(e)).length)i=this.parse(e[0]),i.type!==mm.EMPTY||i.mathmlTree||(i.mathmlTree=t);else{const s=$f.run("function_from_identifiers",t);i=s&&s!==t?s:Yf.getInstance().row(this.parseList(e))}return i.mathml.unshift(t),i}fraction_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();const s=this.parse(e[0]),i=e[1]?this.parse(e[1]):this.getFactory().makeEmptyNode();return Yf.getInstance().fractionLikeNode(s,i,t.getAttribute("linethickness"),"true"===t.getAttribute("bevelled"))}limits_(t,e){return Yf.getInstance().limitNode($p(t),this.parseList(e))}root_(t,e){return e[1]?this.getFactory().makeBranchNode(mm.ROOT,[this.parse(e[1]),this.parse(e[0])],[]):this.sqrt_(t,e)}sqrt_(t,e){const s=this.parseList(ef(e));return this.getFactory().makeBranchNode(mm.SQRT,[Yf.getInstance().row(s)],[])}table_(t,e){const s=t.getAttribute("semantics");if(s&&s.match("bspr_"))return Yf.proof(t,s,this.parseList.bind(this));const i=this.getFactory().makeBranchNode(mm.TABLE,this.parseList(e),[]);return i.mathmlTree=t,Yf.tableToMultiline(i)}tableRow_(t,e){const s=this.getFactory().makeBranchNode(mm.ROW,this.parseList(e),[]);return s.role=gm.TABLE,s}tableLabeledRow_(t,e){var s;if(!e.length)return this.tableRow_(t,e);const i=this.parse(e[0]);i.role=gm.LABEL,(null===(s=i.childNodes[0])||void 0===s?void 0:s.type)===mm.TEXT&&(i.childNodes[0].role=gm.LABEL);const r=this.getFactory().makeBranchNode(mm.ROW,this.parseList(e.slice(1)),[i]);return r.role=gm.TABLE,r}tableCell_(t,e){const s=this.parseList(ef(e));let i;i=s.length?1===s.length&&uf(s[0],mm.EMPTY)?s:[Yf.getInstance().row(s)]:[];const r=this.getFactory().makeBranchNode(mm.CELL,i,[]);return r.role=gm.TABLE,r}phantom_(t,e){let s;return e.length?(s=this.getFactory().makeUnprocessed(t),s.type=mm.TEXT,s.role=gm.SPACE):s=this.empty_(t,e),s}space_(t,e){const s=t.getAttribute("width"),i=s&&s.match(/[a-z]*$/);if(!i)return this.empty_(t,e);const r=i[0],n=parseFloat(s.slice(0,i.index)),o={cm:.4,pc:.5,em:.5,ex:1,in:.15,pt:5,mm:5}[r];if(!o||isNaN(n)||n{uf(t,mm.EMPTY)&&t.addAnnotation("empty","MFENCED")});const i=tg.getAttribute_(t,"separators",","),r=tg.getAttribute_(t,"open","("),n=tg.getAttribute_(t,"close",")"),o=Yf.getInstance().mfenced(r,n,i,s);o.mathmlTree=t,o.addMathmlNodes([t]);return Yf.getInstance().tablesInRow([o])[0]}enclosed_(t,e){const s=this.parseList(ef(e)),i=this.getFactory().makeBranchNode(mm.ENCLOSE,[Yf.getInstance().row(s)],[]);return i.role=t.getAttribute("notation")||gm.UNKNOWN,i}multiscripts_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();const s=this.parse(e.shift());if(!e.length)return s;const i=[],r=[],n=[],o=[];let a=!1,l=0;for(let t,s=0;t=e[s];s++)$p(t)!==qm.MPRESCRIPTS?(a?1&l?i.push(t):r.push(t):1&l?n.push(t):o.push(t),l++):(a=!0,l=0);return ef(i).length||ef(r).length?Yf.getInstance().tensor(s,this.parseList(r),this.parseList(i),this.parseList(o),this.parseList(n)):Yf.getInstance().pseudoTensor(s,this.parseList(o),this.parseList(n))}empty_(t,e){const s=this.getFactory().makeEmptyNode();return s.addMathmlNodes([t]),s.mathmlTree=t,s}action_(t,e){const s=e[t.hasAttribute("selection")?parseInt(t.getAttribute("selection"),10)-1:0],i=this.parse(s);return i.mathmlTree=s,i}dummy_(t,e){const s=this.getFactory().makeUnprocessed(t);return s.role=t.tagName,s.textContent=t.textContent,s}leaf_(t,e){if(1===e.length&&e[0].nodeType!==zp.TEXT_NODE){const s=this.getFactory().makeUnprocessed(t);return s.role=e[0].tagName,sf(s,e[0]),s}const s=this.getFactory().makeLeafNode(t.textContent,Yf.getInstance().font(t.getAttribute("mathvariant")));return t.hasAttribute("data-latex")&&Am.LatexCommands.set(t.getAttribute("data-latex"),t.textContent),s}}class eg{constructor(t,e,s=t=>!1){this.name=t,this.apply=e,this.applicable=s}}class sg extends eg{}class ig extends eg{}function rg(t,e){const s=[];for(;t.length||e.length;)t.length&&s.push(t.shift()),e.length&&s.push(e.shift());return s}const ng="data-semantic-";var og;!function(t){t.ADDED="data-semantic-added",t.ALTERNATIVE="data-semantic-alternative",t.CHILDREN="data-semantic-children",t.COLLAPSED="data-semantic-collapsed",t.CONTENT="data-semantic-content",t.EMBELLISHED="data-semantic-embellished",t.FENCEPOINTER="data-semantic-fencepointer",t.FONT="data-semantic-font",t.ID="data-semantic-id",t.ANNOTATION="data-semantic-annotation",t.ATTRIBUTES="data-semantic-attributes",t.OPERATOR="data-semantic-operator",t.OWNS="data-semantic-owns",t.PARENT="data-semantic-parent",t.POSTFIX="data-semantic-postfix",t.PREFIX="data-semantic-prefix",t.ROLE="data-semantic-role",t.SPEECH="data-semantic-speech",t.STRUCTURE="data-semantic-structure",t.SUMMARY="data-semantic-summary",t.TYPE="data-semantic-type"}(og||(og={}));const ag=[og.ADDED,og.ALTERNATIVE,og.CHILDREN,og.COLLAPSED,og.CONTENT,og.EMBELLISHED,og.FENCEPOINTER,og.FONT,og.ID,og.ANNOTATION,og.ATTRIBUTES,og.OPERATOR,og.OWNS,og.PARENT,og.POSTFIX,og.PREFIX,og.ROLE,og.SPEECH,og.STRUCTURE,og.SUMMARY,og.TYPE];function lg(t){return t.map(function(t){return t.id}).join(",")}function cg(t,e){t.setAttribute(og.TYPE,e.type);const s=e.allAttributes();for(let e,i=0;e=s[i];i++)t.setAttribute(ng+e[0].toLowerCase(),e[1]);e.childNodes.length&&t.setAttribute(og.CHILDREN,lg(e.childNodes)),e.contentNodes.length&&t.setAttribute(og.CONTENT,lg(e.contentNodes)),e.parent&&t.setAttribute(og.PARENT,e.parent.id.toString());const i=e.attributesXml();i&&t.setAttribute(og.ATTRIBUTES,i),function(t,e){const s=[];e.role===gm.MGLYPH&&s.push("image");e.attributes.href&&s.push("link");s.length&&t.setAttribute(og.POSTFIX,s.join(" "))}(t,e)}function hg(){const t=Gp("mrow");return t.setAttribute(og.ADDED,"true"),t}class dg{static fromTree(t){return dg.fromNode(t.root)}static fromNode(t){return new dg(dg.fromNode_(t))}static fromString(t){return new dg(dg.fromString_(t))}static simpleCollapseStructure(t){return"number"==typeof t}static contentCollapseStructure(t){return!!t&&!dg.simpleCollapseStructure(t)&&"c"===t[0]}static interleaveIds(t,e){return rg(dg.collapsedLeafs(t),dg.collapsedLeafs(e))}static collapsedLeafs(...t){return t.reduce((t,e)=>{return t.concat((s=e,dg.simpleCollapseStructure(s)?[s]:dg.contentCollapseStructure(s[1])?s.slice(2):s.slice(1)));var s},[])}static fromStructure(t,e,s){return new dg(dg.tree_(t,e.root,s))}static combineContentChildren(t,e,s,i){switch(t){case mm.RELSEQ:case mm.INFIXOP:case mm.MULTIREL:return rg(i,s);case mm.PREFIXOP:return s.concat(i);case mm.POSTFIXOP:return i.concat(s);case mm.MATRIX:case mm.VECTOR:case mm.FENCED:return i.unshift(s[0]),i.push(s[1]),i;case mm.CASES:return i.unshift(s[0]),i;case mm.APPL:return[i[0],s[0],i[1]];case mm.ROOT:return[i[0],i[1]];case mm.ROW:case mm.LINE:return s.length&&i.push(s[0]),i;default:return i}}static makeSexp_(t){return dg.simpleCollapseStructure(t)?t.toString():dg.contentCollapseStructure(t)?"(c "+t.slice(1).map(dg.makeSexp_).join(" ")+")":"("+t.map(dg.makeSexp_).join(" ")+")"}static fromString_(t){let e=t.replace(/\(/g,"[");return e=e.replace(/\)/g,"]"),e=e.replace(/ /g,","),e=e.replace(/c/g,'"c"'),JSON.parse(e)}static fromNode_(t){if(!t)return[];const e=t.contentNodes;let s;e.length&&(s=e.map(dg.fromNode_),s.unshift("c"));const i=t.childNodes;if(!i.length)return e.length?[t.id,s]:t.id;const r=i.map(dg.fromNode_);return e.length&&r.unshift(s),r.unshift(t.id),r}static tree_(t,e,s,i=0,r=1,n=1){if(!e)return[];const o=e.id,a=[o];!function(t){if(Bp.getInstance().mode!==ap.HTTP)return;let e=t;for(;e&&!e.evaluate;)e=e.parentNode;e&&e.evaluate?jp.currentDocument=e:t.ownerDocument&&(jp.currentDocument=t.ownerDocument)}(t);const l=function(t,e){let s;try{s=Wp(t,e,jp.result.ORDERED_NODE_ITERATOR_TYPE)}catch(t){return[]}const i=[];for(let t=s.iterateNext();t;t=s.iterateNext())i.push(t);return i}(`.//self::*[@${og.ID}=${o}]`,t)[0];if(!e.childNodes.length)return dg.addAria(l,i,r,n,s),e.id;const c=dg.combineContentChildren(e.type,e.role,e.contentNodes.map(function(t){return t}),e.childNodes.map(function(t){return t}));l&&dg.addOwns_(l,c);for(let e,r=0,n=c.length;e=c[r];r++)a.push(dg.tree_(t,e,s,i+1,r+1,n));return dg.addAria(l,i,r,n,s),a}static addAria(t,e,s,i,r){const n=r.tree?e?"treeitem":"tree":"treeitem";r.aria&&t&&(t.setAttribute("aria-level",e.toString()),t.setAttribute("aria-posinset",s.toString()),t.setAttribute("aria-setsize",i.toString()),t.setAttribute("role",n),t.hasAttribute(og.OWNS)&&t.setAttribute("aria-owns",t.getAttribute(og.OWNS)))}static addOwns_(t,e){const s=t.getAttribute(og.COLLAPSED),i=s?dg.realLeafs_(dg.fromString(s).array):e.map(t=>t.id);t.setAttribute(og.OWNS,i.join(" "))}static realLeafs_(t){if(dg.simpleCollapseStructure(t))return[t];if(dg.contentCollapseStructure(t))return[];let e=[];for(let s=1;sdg.simpleCollapseStructure(t)?t:dg.contentCollapseStructure(t)?t[1]:t[0])}subtreeNodes(t){if(!this.isRoot(t))return[];const e=(t,s)=>{dg.simpleCollapseStructure(t)?s.push(t):(dg.contentCollapseStructure(t)&&(t=t.slice(1)),t.forEach(t=>e(t,s)))},s=this.levelsMap[t],i=[];return e(s.slice(1),i),i}}function ug(t,e,s){let i=null;if(!t.length)return i;const r=s[s.length-1],n=r&&r.length,o=e&&e.length,a=Yf.getInstance();if(n&&o){if(e[0].type===mm.INFIXOP&&e[0].role===gm.IMPLICIT)return i=t.pop(),r.push(a.postfixNode_(r.pop(),t)),i;i=t.shift();const s=a.prefixNode_(e.shift(),t);return e.unshift(s),i}return n?(r.push(a.postfixNode_(r.pop(),t)),i):(o&&e.unshift(a.prefixNode_(e.shift(),t)),i)}function pg(t,e,s){if(!e.length)return t;const i=t.pop(),r=e.shift(),n=s.shift();if(r.type===mm.INFIXOP&&(r.role===gm.IMPLICIT||r.role===gm.UNIT)){wp.getInstance().output("Juxta Heuristic Case 2");const o=(i?[i,r]:[r]).concat(n);return pg(t.concat(o),e,s)}if(!i)return wp.getInstance().output("Juxta Heuristic Case 3"),pg([r].concat(n),e,s);const o=n.shift();if(!o){wp.getInstance().output("Juxta Heuristic Case 9");const n=$f.factory.makeBranchNode(mm.INFIXOP,[i,e.shift()],[r],r.textContent);return n.role=gm.IMPLICIT,$f.run("combine_juxtaposition",n),e.unshift(n),pg(t,e,s)}if(vf(i)||vf(o))return wp.getInstance().output("Juxta Heuristic Case 4"),pg(t.concat([i,r,o]).concat(n),e,s);let a=null;return qf(i)&&qf(o)?(wp.getInstance().output("Juxta Heuristic Case 5"),i.contentNodes.push(r),i.contentNodes=i.contentNodes.concat(o.contentNodes),i.childNodes.push(o),i.childNodes=i.childNodes.concat(o.childNodes),o.childNodes.forEach(t=>t.parent=i),r.parent=i,i.addMathmlNodes(r.mathml),i.addMathmlNodes(o.mathml),a=i):qf(i)?(wp.getInstance().output("Juxta Heuristic Case 6"),i.contentNodes.push(r),i.childNodes.push(o),o.parent=i,r.parent=i,i.addMathmlNodes(r.mathml),i.addMathmlNodes(o.mathml),a=i):qf(o)?(wp.getInstance().output("Juxta Heuristic Case 7"),o.contentNodes.unshift(r),o.childNodes.unshift(i),i.parent=o,r.parent=o,o.addMathmlNodes(r.mathml),o.addMathmlNodes(i.mathml),a=o):(wp.getInstance().output("Juxta Heuristic Case 8"),a=$f.factory.makeBranchNode(mm.INFIXOP,[i,o],[r],r.textContent),a.role=gm.IMPLICIT),t.push(a),pg(t.concat(n),e,s)}function mg(t){return t.childNodes[0]&&t.childNodes[0].childNodes[0]&&$p(t.childNodes[0])===qm.MPADDED&&$p(t.childNodes[0].childNodes[0])===qm.MPADDED&&$p(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1])===qm.MPHANTOM}$f.add(new sg("combine_juxtaposition",function(t){for(let e,s=t.childNodes.length-1;e=t.childNodes[s];s--)qf(e)&&!e.nobreaking&&(t.childNodes.splice(s,1,...e.childNodes),t.contentNodes.splice(s,0,...e.contentNodes),e.childNodes.concat(e.contentNodes).forEach(function(e){e.parent=t}),t.addMathmlNodes(e.mathml));return t})),$f.add(new sg("propagateSimpleFunction",t=>(t.type!==mm.INFIXOP&&t.type!==mm.FRACTION||!t.childNodes.every(Bf)||(t.role=gm.COMPFUNC),t),t=>"clearspeak"===$f.options.domain)),$f.add(new sg("simpleNamedFunction",t=>(t.role!==gm.UNIT&&-1!==["f","g","h","F","G","H"].indexOf(t.textContent)&&(t.role=gm.SIMPLEFUNC),t),t=>"clearspeak"===$f.options.domain)),$f.add(new sg("propagateComposedFunction",t=>(t.type===mm.FENCED&&t.childNodes[0].role===gm.COMPFUNC&&(t.role=gm.COMPFUNC),t),t=>"clearspeak"===$f.options.domain)),$f.add(new sg("multioperator",t=>{t.role!==gm.UNKNOWN||t.textContent.length<=1||(Yf.compSemantics(t,"role",gm),Yf.compSemantics(t,"type",mm))})),$f.add(new ig("convert_juxtaposition",t=>{let e=of(t,function(t){return t.textContent===vm.invisibleTimes&&t.type===mm.OPERATOR});e=e.rel.length?function(t){const e=[],s=[];let i=t.comp.shift(),r=null,n=[];for(;t.comp.length;)if(n=[],i.length)r&&e.push(r),s.push(i),r=t.rel.shift(),i=t.comp.shift();else{for(r&&n.push(r);!i.length&&t.comp.length;)i=t.comp.shift(),n.push(t.rel.shift());r=ug(n,i,s)}n.length||i.length?(e.push(r),s.push(i)):(n.push(r),ug(n,i,s));return{rel:e,comp:s}}(e):e,t=e.comp[0];for(let s,i,r=1;s=e.comp[r],i=e.rel[r-1];r++)t.push(i),t=t.concat(s);return e=of(t,function(t){return t.textContent===vm.invisibleTimes&&(t.type===mm.OPERATOR||t.type===mm.INFIXOP)}),e.rel.length?pg(e.comp.shift(),e.rel,e.comp):t})),$f.add(new sg("simple2prefix",t=>(t.textContent.length>1&&!t.textContent[0].match(/[A-Z]/)&&(t.role=gm.PREFIXFUNC),t),t=>"braille"===$f.options.modality&&t.type===mm.IDENTIFIER)),$f.add(new sg("detect_cycle",t=>{t.type=mm.MATRIX,t.role=gm.CYCLE;const e=t.childNodes[0];return e.type=mm.ROW,e.role=gm.CYCLE,e.textContent="",e.contentNodes=[],t},t=>t.type===mm.FENCED&&t.childNodes[0].type===mm.INFIXOP&&t.childNodes[0].role===gm.IMPLICIT&&t.childNodes[0].childNodes.every(function(t){return t.type===mm.NUMBER})&&t.childNodes[0].contentNodes.every(function(t){return t.role===gm.SPACE}))),$f.add(new ig("intvar_from_implicit",function(t){const e=t[0].childNodes;t.splice(0,1,...e),t.forEach(t=>t.parent=null)},t=>t[0]&&zf(t[0]))),$f.add(new sg("intvar_from_fraction",function(t){const e=t.childNodes[1],s=e.childNodes[0];if(xf(s))return void(s.role=gm.INTEGRAL);if(!zf(s))return;const i=s.childNodes.length,r=s.childNodes[i-2],n=s.childNodes[i-1];if(xf(n))return void(n.role=gm.INTEGRAL);if(Ef(r,n)){const t=Yf.getInstance().prefixNode_(n,[r]);t.role=gm.INTEGRAL,2===i?e.childNodes[0]=t:(s.childNodes.pop(),s.contentNodes.pop(),s.childNodes[i-2]=t,t.parent=s)}},t=>{if(t.type!==mm.INTEGRAL)return!1;const[,e,s]=t.childNodes;return s.type===mm.EMPTY&&e.type===mm.FRACTION})),$f.add(new sg("rewrite_subcases",function(t){t.addAnnotation("Emph","top");let e=[];if(t.hasAnnotation("Emph","left")){const s=gg(t.childNodes[0].childNodes[0].childNodes[0],!0);s.forEach(t=>t.addAnnotation("Emph","left")),e=e.concat(s);for(let e,s=0;e=t.childNodes[s];s++)e.childNodes.shift()}if(e.push(t),t.hasAnnotation("Emph","right")){const s=gg(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1].childNodes[0]);s.forEach(t=>t.addAnnotation("Emph","left")),e=e.concat(s),t.childNodes[0].childNodes.pop()}Yf.tableToMultiline(t);const s=Yf.getInstance().row(e),i=t.annotation.Emph;return t.annotation.Emph=["table"],i.forEach(t=>s.addAnnotation("Emph",t)),s},t=>{let e=!0,s=!0;const i=t.childNodes[0].childNodes[0];if(!i)return!1;if(mg(i.mathmlTree)){for(let s,i=1;s=t.childNodes[i];i++)if(s.childNodes[0].childNodes.length){e=!1;break}}else e=!1;e&&t.addAnnotation("Emph","left");if(mg(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1].mathmlTree)){const e=t.childNodes[0].childNodes.length;for(let i,r=1;i=t.childNodes[r];r++)if(i.childNodes.length>=e){s=!1;break}}else s=!1;return s&&t.addAnnotation("Emph","right"),e||s}));const fg=[mm.PUNCTUATED,mm.RELSEQ,mm.MULTIREL,mm.INFIXOP,mm.PREFIXOP,mm.POSTFIXOP];function gg(t,e){if(!t.childNodes.length)return Eg(t),[t];let s=null;if(t.type===mm.PUNCTUATED&&(e?t.role===gm.ENDPUNCT:t.role===gm.STARTPUNCT)){const i=t.childNodes;Eg(i[e?i.length-1:0])&&(t=i[e?0:i.length-1],s=i[e?i.length-1:0])}if(-1!==fg.indexOf(t.type)){const i=t.childNodes;Eg(i[e?i.length-1:0]);const r=dg.combineContentChildren(t.type,t.role,t.contentNodes,t.childNodes);return s&&(e?r.push(s):r.unshift(s)),r}return s?e?[t,s]:[s,t]:[t]}const bg={[gm.METRIC]:gm.METRIC,[gm.VBAR]:gm.NEUTRAL,[gm.OPENFENCE]:gm.OPEN,[gm.CLOSEFENCE]:gm.CLOSE};function Eg(t){if(t.type!==mm.PUNCTUATION)return!1;const e=bg[t.role];return!!e&&(t.role=e,t.type=mm.FENCE,t.addAnnotation("Emph","fence"),!0)}function xg(t,e,s,i=s){const r=[];for(;t&&t.role===s;)r.push(t),t=e.shift();return r.length?(t&&e.unshift(t),[1===r.length?r[0]:yg(r,i),e]):[t,e]}function yg(t,e){const s=$f.factory.makeBranchNode(mm.PUNCTUATION,t,[]);return s.role=e,s}function Ng(t){return["[","\uff3b"].includes(t)}function vg(t){return["]","\uff3d"].includes(t)}function Tg(t){return["(","\u207d","\u208d"].includes(t)}function Cg(t){return[")","\u207e","\u208e"].includes(t)}function Ag(t){return t.role===gm.INFTY||t.type===mm.PREFIXOP&&t.childNodes[0].role===gm.INFTY}function Lg(t){const e=t.childNodes[0];if(t.type!==mm.FENCED||(null==e?void 0:e.type)!==mm.PUNCTUATED||3!==(null==e?void 0:e.childNodes.length)||1!==(null==e?void 0:e.contentNodes.length)||(null==e?void 0:e.childNodes[1].role)!==gm.COMMA)return!1;const s=t.childNodes[0].childNodes[0],i=t.childNodes[0].childNodes[2],r=t.contentNodes[0].textContent,n=t.contentNodes[1].textContent;return!!(Ng(r)&&Cg(n)||Tg(r)&&vg(n))||!(!Tg(r)||!Cg(n)||!Ag(s)&&!Ag(i))}function Sg(t){return wg(t)||function(t){return Mg(t)||t.type===mm.INFIXOP&&t.role===gm.IMPLICIT&&(2===t.childNodes.length&&(Mg(t.childNodes[0])||wg(t.childNodes[0]))&&Mg(t.childNodes[1])||3===t.childNodes.length&&wg(t.childNodes[0])&&Mg(t.childNodes[1])&&Mg(t.childNodes[2]))}(t)||function(t){return t.type===mm.PUNCTUATED&&t.role===gm.ENDPUNCT&&2===t.childNodes.length&&t.childNodes[1].role===gm.DEGREE&&(Mg(t.childNodes[0])||Ig(t.childNodes[0])||t.childNodes[0].type===mm.PREFIXOP&&t.childNodes[0].role===gm.NEGATIVE&&(Mg(t.childNodes[0].childNodes[0])||Ig(t.childNodes[0].childNodes[0])))}(t)||function(t){return t.type===mm.PREFIXOP&&t.role===gm.NEGATIVE&&Rg(t.childNodes[0])&&t.childNodes[0].type!==mm.PREFIXOP&&t.childNodes[0].type!==mm.APPL&&t.childNodes[0].type!==mm.PUNCTUATED}(t)||function(t){return t.type===mm.APPL&&(t.childNodes[0].role===gm.PREFIXFUNC||t.childNodes[0].role===gm.SIMPLEFUNC)&&(Rg(t.childNodes[1])||t.childNodes[1].type===mm.FENCED&&Rg(t.childNodes[1].childNodes[0]))}(t)}function Rg(t){return t.hasAnnotation("clearspeak","simple")}function Mg(t){return t.type===mm.IDENTIFIER&&(t.role===gm.LATINLETTER||t.role===gm.GREEKLETTER||t.role===gm.OTHERLETTER||t.role===gm.SIMPLEFUNC)}function Ig(t){return t.type===mm.NUMBER&&(t.role===gm.INTEGER||t.role===gm.FLOAT)}function wg(t){return Ig(t)||function(t){if(kg("Fraction_Over")||kg("Fraction_FracOver"))return!1;if(t.type!==mm.FRACTION||t.role!==gm.VULGAR)return!1;if(kg("Fraction_Ordinal"))return!0;const e=parseInt(t.childNodes[0].textContent,10),s=parseInt(t.childNodes[1].textContent,10);return e>0&&e<20&&s>0&&s<11}(t)}function kg(t){return Bp.getInstance().options.style===t}function Og(t){return t.type===mm.TEXT&&t.role!==gm.LABEL||t.type===mm.PUNCTUATED&&t.role===gm.TEXT&&Ig(t.childNodes[0])&&function(t){for(let e=0;e{const e=[];let s=t.shift();for(;s;)[s,t]=xg(s,t,gm.FULLSTOP,gm.ELLIPSIS),[s,t]=xg(s,t,gm.DASH),e.push(s),s=t.shift();return e},t=>t.length>1)),$f.add(new ig("op_with_limits",t=>{const e=t[0];return e.type=mm.LARGEOP,e.role=gm.SUM,t},t=>(t[0].type===mm.OPERATOR||t[0].type===mm.IDENTIFIER&&"OP"===t[0].attributes.texclass)&&t.slice(1).some(t=>t.type===mm.RELSEQ||t.type===mm.MULTIREL||t.type===mm.INFIXOP&&t.role===gm.ELEMENT||t.type===mm.PUNCTUATED&&t.role===gm.SEQUENCE))),$f.add(new class extends eg{}("function_from_identifiers",t=>{const e=qp(t.childNodes).map(t=>t.textContent.trim()).join("");if(Am.Meaning.get(e).type===mm.UNKNOWN)return t;const s=$f.factory.makeLeafNode(e,Yf.getInstance().font(t.getAttribute("mathvariant")));return s.mathmlTree=t,s},t=>{const e=qp(t.childNodes);return!(e.length<2)&&e.every(t=>$p(t)===qm.MI&&Am.Meaning.get(t.textContent.trim()).role===gm.LATINLETTER)})),$f.add(new ig("bracketed_interval",t=>{const e=t[0],s=t[1],i=t.slice(2),r=Yf.getInstance().row(i),n=$f.factory.makeBranchNode(mm.FENCED,[r],[e,s]);return n.role=gm.INTERVAL,n},t=>{const e=t[0],s=t[1],i=t.slice(2);if(!(e&&s&&(vg(e.textContent)&&(Ng(s.textContent)||vg(s.textContent))||Ng(s.textContent)&&(Ng(e.textContent)||vg(e.textContent)))))return!1;if(1===i.length&&i[0].type===mm.PUNCTUATED&&1===i[0].contentNodes.length)return!0;const r=of(i,Cf);return!(1!==r.rel.length||!r.comp[0].length||!r.comp[1].length)})),$f.add(new sg("interval_heuristic",t=>(t.role=gm.INTERVAL,t),t=>Lg(t))),$f.add(new sg("propagateInterval",t=>(t.childNodes.forEach(t=>{Lg(t)&&(t.role=gm.INTERVAL)}),t),t=>Kf(t))),sm(new Qp("clearspeak","simple",function(t){return Sg(t)?"simple":""})),im("clearspeak","simple"),sm(new Qp("clearspeak","unit",function(t){return Og(t)?"unit":""})),im("clearspeak","unit");const Dg=[mm.MULTIREL,mm.RELSEQ,mm.APPL,mm.ROW,mm.LINE],Pg=[mm.SUBSCRIPT,mm.SUPERSCRIPT,mm.OVERSCORE,mm.UNDERSCORE];function Bg(t,e){const s=t.parent;if(!s)return!1;const i=s.type;return-1!==Dg.indexOf(i)||i===mm.PREFIXOP&&s.role===gm.NEGATIVE&&!e.script&&!e.enclosed||i===mm.PREFIXOP&&s.role===gm.GEOMETRY||!(i!==mm.PUNCTUATED||e.enclosed&&s.role!==gm.TEXT)}sm(new Zp("nemeth","number",function(t,e){return t.childNodes.length?(-1!==Pg.indexOf(t.type)&&(e.script=!0),t.type===mm.FENCED?(e.number=!1,e.enclosed=!0,["",e]):t.type===mm.PREFIXOP&&t.role!==gm.GEOMETRY&&t.role!==gm.NEGATIVE?(e.number=!1,["",e]):(Bg(t,e)&&(e.number=!0,e.enclosed=!1),["",e])):(Bg(t,e)&&(e.number=!0,e.script=!1,e.enclosed=!1),[e.number?"number":"",{number:!1,enclosed:e.enclosed,script:e.script}])},{number:!0})),im("nemeth","number"),sm(new Zp("depth","depth",function(t){return t.parent?[parseInt(t.parent.annotation.depth[0])+1]:[1]})),im("depth","depth");class Fg{static empty(){const t=Vp(""),e=new Fg(t,new kp);return e.mathml=t,e}static fromNode(t,e){const s=Fg.empty();return s.root=t,e&&(s.mathml=e),s}static fromRoot(t,e){let s=t;for(;s.parent;)s=s.parent;const i=Fg.fromNode(s);return e&&(i.mathml=e),i}static fromXml(t){const e=Fg.empty();return t.childNodes[0]&&(e.root=cf.fromXml(t.childNodes[0])),e}constructor(t,e){this.mathml=t,this.options=e,this.parser=new tg(e),this.root=this.parser.parse(t),this.root=Yf.rewriteTrivialTable(this.root),this.collator=this.parser.getFactory().leafMap.collateMeaning();const s=this.collator.newDefault();s&&(this.parser=new tg(e),this.parser.getFactory().defaultMap=s,this.root=this.parser.parse(t)),jg.visit(this.root,{}),function(t){for(const e of tm.values())e.active&&e.annotate(t);for(const e of em.values())e.active&&e.visit(t,Object.assign({},e.def))}(this.root)}xml(t){const e=Vp(""),s=this.root.xml(e.ownerDocument,t);return e.appendChild(s),e}toString(t){return Yp(this.xml(t))}formatXml(t){return Jp(this.toString(t))}displayTree(){this.root.displayTree()}replaceNode(t,e){const s=t.parent;s?s.replaceChild(t,e):this.root=e}toJson(){const t={};return t.stree=this.root.toJson(),t}}const jg=new Zp("general","unit",(t,e)=>(Wf(t)&&(t.role=gm.UNIT),!1));function _g(t,e){return new Fg(t,e)}const Ug=[],Hg=!0,Wg=new Map;function zg(t){wp.getInstance().generate(()=>["WALKING START: ",t.toString()]);const e=function(t){for(let e,s=0;e=Ug[s];s++)if(e.test(t))return e.constr(t);return null}(t);let s;if(e)return s=e.getMathml(),wp.getInstance().generate(()=>["WALKING END: ",t.toString()]),sb(s);if(1===t.mathml.length){if(wp.getInstance().output("Walktree Case 0"),!t.childNodes.length)return wp.getInstance().output("Walktree Case 0.1"),s=t.mathml[0],cg(s,t),wp.getInstance().generate(()=>["WALKING END: ",t.toString()]),sb(s);const e=t.childNodes[0];if(1===t.childNodes.length&&e.type===mm.EMPTY)return wp.getInstance().output("Walktree Case 0.2"),s=t.mathml[0],cg(s,t),s.appendChild(zg(e)),wp.getInstance().generate(()=>["WALKING END: ",t.toString()]),sb(s);t.childNodes.forEach(t=>{t.mathml.length||t.addMathmlNodes([hb(t)])})}const i=t.contentNodes.map(lb);db(t,i);const r=t.childNodes.map(zg),n=dg.combineContentChildren(t.type,t.role,i,r);if(s=t.mathmlTree,null===s)wp.getInstance().output("Walktree Case 1"),s=qg(n,t);else{s=cb(s);const t=Zg(n);wp.getInstance().output("Walktree Case 2"),t?(wp.getInstance().output("Walktree Case 2.1"),s=ob(t)):(wp.getInstance().output("Walktree Case 2.2"),s=ub(s))}return function(t,e,s){if(!e.length)return;if(1===e.length&&t===e[0])return;const i=s.role===gm.IMPLICIT&&$f.flags.combine_juxtaposition?function(t,e,s){const i=[];let r=qp(t.childNodes),n=!1;for(;r.length;){const t=r.shift();if(t.hasAttribute(og.TYPE)){i.push(t);continue}const s=Xg(t,e);0!==s.length&&(1!==s.length?(n?t.setAttribute("AuxiliaryImplicit",!0):n=!0,r=s.concat(r)):i.push(t))}const o=[],a=s.childNodes.map(function(t){return t.mathmlTree});for(;a.length;){const t=a.pop();if(t){if(-1!==i.indexOf(t))break;-1!==e.indexOf(t)&&o.unshift(t)}}return i.concat(o)}(t,e,s):qp(t.childNodes);if(!i.length)return void e.forEach(function(e){t.appendChild(e)});let r=0;for(;e.length;){const s=e[0];if(i[r]===s||Yg(i[r],s)){e.shift(),r++;continue}if(i[r]&&-1===e.indexOf(i[r])){r++;continue}if($g(s,t)){e.shift();continue}const n=i[r];if(!n){if(s.parentNode){t=ob(s),e.shift();continue}const i=e[1];if(i&&i.parentNode){Jg(t=ob(i),s,i),e.shift(),e.shift();continue}Jg(t,s,null),e.shift();continue}Gg(t,n,s),e.shift()}}(s,n,t),Wg.has(t.id)||(Wg.set(t.id,!0),cg(s,t)),wp.getInstance().generate(()=>["WALKING END: ",t.toString()]),sb(s,t)}function qg(t,e){const s=function(t){const e=Zg(t);if(!e)return{type:Qg.INVALID,node:null};const s=Zg(t.slice().reverse());if(e===s)return{type:Qg.VALID,node:e};const i=tb(e),r=function(t,e){let s=0;for(;t[s]&&-1===e.indexOf(t[s]);)s++;return t.slice(0,s+1)}(i,t),n=tb(s,function(t){return-1!==r.indexOf(t)}),o=n[0],a=r.indexOf(o);if(-1===a)return{type:Qg.INVALID,node:null};return{type:r.length!==i.length?Qg.PRUNED:eb(r[a+1],n[1])?Qg.VALID:Qg.INVALID,node:o}}(t);let i=s.node;const r=s.type;if(r!==Qg.VALID||!Zm(i)||!i.parentNode&&e.parent)if(wp.getInstance().output("Walktree Case 1.1"),i=hg(),r===Qg.PRUNED)wp.getInstance().output("Walktree Case 1.1.0"),i=function(t,e,s){let i=ib(e);if(Ym(i)){wp.getInstance().output("Walktree Case 1.1.0.0"),Vg(i,t),qp(i.childNodes).forEach(function(e){t.appendChild(e)});const e=t;t=i,i=e}const r=s.indexOf(e);return s[r]=i,Xp(i,t),t.appendChild(i),s.forEach(function(e){t.appendChild(e)}),t}(i,s.node,t);else if(t[0]){wp.getInstance().output("Walktree Case 1.1.1");const e=Zg(t);if(e){const s=function(t,e){const s=qp(t.childNodes);let i=1/0,r=-1/0;return e.forEach(function(t){const e=s.indexOf(t);-1!==e&&(i=Math.min(i,e),r=Math.max(r,e))}),s.slice(i,r+1)}(ob(e),t);Xp(e,i),s.forEach(function(t){i.appendChild(t)})}else Vg(i,t[0]),i=t[0]}return e.mathmlTree||(e.mathmlTree=i),i}function Vg(t,e){for(const s of ag)t.hasAttribute(s)&&(e.setAttribute(s,t.getAttribute(s)),t.removeAttribute(s))}function Xg(t,e){const s=[];let i=qp(t.childNodes);for(;i.length;){const t=i.shift();t.nodeType===zp.ELEMENT_NODE&&(t.hasAttribute(og.TYPE)||-1!==e.indexOf(t)?s.push(t):i=qp(t.childNodes).concat(i))}return s}function Gg(t,e,s){let i=e,r=ob(i);for(;r&&Kg(r,i)&&!i.hasAttribute("AuxiliaryImplicit")&&r!==t;)i=r,r=ob(i);r&&(Jg(r,s,i),i.removeAttribute("AuxiliaryImplicit"))}function Jg(t,e,s){$p(t)===qm.MACTION?Jg(ob(t),e,t):t.insertBefore(e,s)}function Kg(t,e){if($p(t)!==qm.MACTION)return t.firstChild===e;const s=parseInt(t.getAttribute("selection"))||1;return t.childNodes[s-1]===e}function $g(t,e){if(!t)return!1;do{if((t=ob(t))===e)return!0}while(t);return!1}function Yg(t,e){const s=vm.functionApplication;if(t&&e&&t.textContent&&e.textContent&&t.textContent===s&&e.textContent===s&&"true"===e.getAttribute(og.ADDED)){for(let s,i=0;s=t.attributes[i];i++)e.hasAttribute(s.nodeName)||e.setAttribute(s.nodeName,s.nodeValue);return Xp(t,e),!0}return!1}var Qg;function Zg(t){let e=0,s=null;for(;!s&&e!1),i=[t];for(;!s(t)&&!Ym(t)&&t.parentNode;)t=ob(t),i.unshift(t);return i}function eb(t,e){return!(!t||!e||t.previousSibling||e.nextSibling)}function sb(t,e){var s;let i=e&&!e.hasAnnotation("empty","MFENCED")&&e.getAnnotation("empty");for(;!Ym(t)&&(rb(t)||i&&t.parentNode&&i.includes(null===(s=ob(t).tagName)||void 0===s?void 0:s.toUpperCase()));)t=ob(t);return t}function ib(t){const e=qp(t.childNodes);if(!e)return t;const s=e.filter(function(t){return t.nodeType===zp.ELEMENT_NODE&&!Qm(t)});return 1===s.length&&Zm(s[0])&&!s[0].hasAttribute(og.TYPE)?ib(s[0]):t}function rb(t){const e=ob(t);return!(!e||!Zm(e))&&qp(e.childNodes).every(function(e){return e===t||nb(e)})}function nb(t){if(t.nodeType!==zp.ELEMENT_NODE)return!0;if(!t||Qm(t))return!0;const e=qp(t.childNodes);return!(!Zm(t)&&e.length||function(t){return!!t&&Km.includes($p(t))}(t)||t.hasAttribute(og.TYPE)||tf(t))&&qp(t.childNodes).every(nb)}function ob(t){return t.parentNode}function ab(t,e){const s=new dg(e);t.setAttribute(og.COLLAPSED,s.toString())}function lb(t){if(t.mathml.length)return zg(t);const e=Hg?hb(t):hg();return t.addMathmlNodes([e]),e}function cb(t){if($p(t)!==qm.MFENCED)return t;const e=hg();for(let s,i=0;s=t.attributes[i];i++)-1===["open","close","separators"].indexOf(s.name)&&e.setAttribute(s.name,s.value);return qp(t.childNodes).forEach(function(t){e.appendChild(t)}),Xp(t,e),e}function hb(t){const e=Gp("mo"),s=(i=t.textContent,Mp.document.createTextNode(i));var i;return e.appendChild(s),cg(e,t),e.setAttribute(og.ADDED,"true"),e}function db(t,e){const s=t.type+(t.textContent?","+t.textContent:"");e.forEach(function(t){ub(t).setAttribute(og.OPERATOR,s)})}function ub(t){if(Qm(t))return t;const e=qp(t.childNodes);if(!e)return t;const s=e.filter(function(t){return!nb(t)}),i=[];for(let t,e=0;t=s[e];e++)if(Zm(t)&&t.getAttribute(og.TYPE)!==mm.PUNCTUATION){const e=ub(t);e&&e!==t&&i.push(e)}else i.push(t);return 1===i.length?i[0]:t}function pb(t){return Jp(t.toString()).toString().replace(new RegExp(ng,"g"),"")}function mb(t,e){const s=!!e,i=e||[],r=t.parent,n=t.contentNodes.map(function(t){return t.id});n.unshift("c");const o=[t.id,n];for(let e,n=0;e=t.childNodes[n];n++){const t=zg(e);i.push(t);const n=ub(t);r&&!s&&n.setAttribute(og.PARENT,r.id.toString()),o.push(e.id)}return o}!function(t){t.VALID="valid",t.INVALID="invalid",t.PRUNED="pruned"}(Qg||(Qg={}));class fb{constructor(t){this.semantic=t}}class gb extends fb{static test(t){return!t.mathmlTree&&t.type===mm.LINE&&t.role===gm.BINOMIAL}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){if(!this.semantic.childNodes.length)return this.mml;const t=this.semantic.childNodes[0];if(this.mml=zg(t),this.mml.hasAttribute(og.TYPE)){const t=hg();Xp(this.mml,t),t.appendChild(this.mml),this.mml=t}return cg(this.mml,this.semantic),this.mml}}class bb extends fb{static test(t){var e,s;return!!t.getAnnotation("collapsed").length&&(null===(s=null===(e=t.mathmlTree)||void 0===e?void 0:e.parentNode)||void 0===s?void 0:s.childNodes.length)>2}getMathml(){zg(this.semantic.childNodes[0]),zg(this.semantic.childNodes[1]);const t=this.semantic.mathmlTree,e=qg([this.semantic.childNodes[0].mathmlTree,t],this.semantic);return cg(e,this.semantic),e}}class Eb extends fb{static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;const e=$p(t.mathmlTree),s=t.childNodes[0].role;return e===qm.MSUBSUP&&s===gm.SUBSUP||e===qm.MUNDEROVER&&s===gm.UNDEROVER}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=this.semantic.childNodes[0],e=t.childNodes[0],s=this.semantic.childNodes[1],i=t.childNodes[1],r=zg(s),n=zg(e),o=zg(i);return cg(this.mml,this.semantic),this.mml.setAttribute(og.CHILDREN,lg([e,i,s])),[n,o,r].forEach(t=>ub(t).setAttribute(og.PARENT,this.mml.getAttribute(og.ID))),this.mml.setAttribute(og.TYPE,t.role),ab(this.mml,[this.semantic.id,[t.id,e.id,i.id],s.id]),this.mml}}class xb extends fb{static multiscriptIndex(t){return t.type===mm.PUNCTUATED&&t.contentNodes[0].role===gm.DUMMY&&t.hasAnnotation("general","script")?mb(t):(zg(t),t.id)}static createNone_(t){const e=Gp("none");return t&&cg(e,t),e.setAttribute(og.ADDED,"true"),e}constructor(t){super(t),this.mml=t.mathmlTree}completeMultiscript(t,e){const s=qp(this.mml.childNodes).slice(1);let i=0;const r=t=>{for(const e of t){const t=s[i];if(t&&e===parseInt(t.getAttribute(og.ID)))t.setAttribute(og.PARENT,this.semantic.id.toString()),i++;else if(t&&e===parseInt(ub(t).getAttribute(og.ID)))ub(t).setAttribute(og.PARENT,this.semantic.id.toString()),i++;else{const s=this.semantic.querySelectorAll(t=>t.id===e);this.mml.insertBefore(xb.createNone_(s[0]),t||null)}}};r(t),s[i]&&$p(s[i])!==qm.MPRESCRIPTS?this.mml.insertBefore(s[i],Gp("mprescripts")):i++,r(e)}}class yb extends xb{static test(t){if(!t.mathmlTree)return!1;return $p(t.mathmlTree)===qm.MMULTISCRIPTS&&(t.type===mm.SUPERSCRIPT||t.type===mm.SUBSCRIPT)}constructor(t){super(t)}getMathml(){let t,e,s;if(cg(this.mml,this.semantic),this.semantic.childNodes[0]&&this.semantic.childNodes[0].role===gm.SUBSUP){const i=this.semantic.childNodes[0];t=i.childNodes[0],e=xb.multiscriptIndex(this.semantic.childNodes[1]),s=xb.multiscriptIndex(i.childNodes[1]);const r=[this.semantic.id,[i.id,t.id,s],e];ab(this.mml,r),this.mml.setAttribute(og.TYPE,i.role),this.completeMultiscript(dg.interleaveIds(s,e),[])}else{t=this.semantic.childNodes[0],e=xb.multiscriptIndex(this.semantic.childNodes[1]);const s=[this.semantic.id,t.id,e];ab(this.mml,s)}const i=dg.collapsedLeafs(s||[],e);return ub(zg(t)).setAttribute(og.PARENT,this.semantic.id.toString()),i.unshift(t.id),this.mml.setAttribute(og.CHILDREN,i.join(",")),this.mml}}class Nb extends xb{static test(t){return!!t.mathmlTree&&t.type===mm.TENSOR}constructor(t){super(t)}getMathml(){zg(this.semantic.childNodes[0]);const t=xb.multiscriptIndex(this.semantic.childNodes[1]),e=xb.multiscriptIndex(this.semantic.childNodes[2]),s=xb.multiscriptIndex(this.semantic.childNodes[3]),i=xb.multiscriptIndex(this.semantic.childNodes[4]);cg(this.mml,this.semantic);const r=[this.semantic.id,this.semantic.childNodes[0].id,t,e,s,i];ab(this.mml,r);const n=dg.collapsedLeafs(t,e,s,i);return n.unshift(this.semantic.childNodes[0].id),this.mml.setAttribute(og.CHILDREN,n.join(",")),this.completeMultiscript(dg.interleaveIds(s,i),dg.interleaveIds(t,e)),this.mml}}class vb extends fb{static test(t){return!(!t.mathmlTree||!t.fencePointer||t.mathmlTree.getAttribute("data-semantic-type"))}static makeEmptyNode_(t){const e=hg(),s=new cf(t);return s.type=mm.EMPTY,s.mathmlTree=e,s}static fencedMap_(t,e){e[t.id]=t.mathmlTree,t.embellished&&vb.fencedMap_(t.childNodes[0],e)}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=[]}getMathml(){this.getFenced_(),this.fencedMml=zg(this.fenced),this.getFencesMml_(),this.fenced.type!==mm.EMPTY||this.fencedMml.parentNode||(this.fencedMml.setAttribute(og.ADDED,"true"),this.cfenceMml.parentNode.insertBefore(this.fencedMml,this.cfenceMml)),this.getFencedMml_();return this.rewrite_()}fencedElement(t){return t.type===mm.FENCED||t.type===mm.MATRIX||t.type===mm.VECTOR}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],vb.fencedMap_(this.ofence,this.ofenceMap),vb.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),s=Object.keys(this.cfenceMap);for(;!(this.ofenceMml&&this.cfenceMml||t===this.fenced);)-1===e.indexOf(t.fencePointer)||this.ofenceMml||(this.ofenceMml=t.mathmlTree),-1===s.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=sb(this.ofenceMml)),this.cfenceMml&&(this.cfenceMml=sb(this.cfenceMml))}rewrite_(){let t=this.semantic,e=null;const s=this.introduceNewLayer_();for(cg(s,this.fenced.parent);!this.fencedElement(t);){const i=t.mathmlTree,r=this.specialCase_(t,i);if(r)t=r;else{cg(i,t);const e=[];for(let s,i=1;s=t.childNodes[i];i++)e.push(zg(s));t=t.childNodes[0]}const n=Gp("dummy"),o=i.childNodes[0];Xp(i,n),Xp(s,i),Xp(i.childNodes[0],s),Xp(n,o),e||(e=i)}return zg(this.ofence),zg(this.cfence),this.cleanupParents_(),e||s}specialCase_(t,e){const s=$p(e);let i,r=null;if(s===qm.MSUBSUP?(r=t.childNodes[0],i=Eb):s===qm.MMULTISCRIPTS&&(t.type===mm.SUPERSCRIPT||t.type===mm.SUBSCRIPT?i=yb:t.type===mm.TENSOR&&(i=Nb),r=i&&t.childNodes[0]&&t.childNodes[0].role===gm.SUBSUP?t.childNodes[0]:t),!r)return null;const n=r.childNodes[0],o=vb.makeEmptyNode_(n.id);return r.childNodes[0]=o,e=new i(t).getMathml(),r.childNodes[0]=n,this.parentCleanup.push(e),r.childNodes[0]}introduceNewLayer_(){const t=this.fullFence(this.ofenceMml),e=this.fullFence(this.cfenceMml);let s=hg();if(Xp(this.fencedMml,s),this.fencedMmlNodes.forEach(t=>s.appendChild(t)),s.insertBefore(t,this.fencedMml),s.appendChild(e),!s.parentNode){const t=hg();for(;s.childNodes.length>0;)t.appendChild(s.childNodes[0]);s.appendChild(t),s=t}return s}fullFence(t){const e=this.fencedMml.parentNode;let s=t;for(;s.parentNode&&s.parentNode!==e;)s=s.parentNode;return s}cleanupParents_(){this.parentCleanup.forEach(function(t){const e=t.childNodes[1].getAttribute(og.PARENT);t.childNodes[0].setAttribute(og.PARENT,e)})}}class Tb extends fb{static test(t){return!!t.mathmlTree&&t.hasAnnotation("Emph","top")}constructor(t){super(t),this.mrows=[],this.mml=t.mathmlTree}getMathml(){if(this.recurseToTable(this.semantic),this.mrows.length){const t=hg();this.mml.parentNode.insertBefore(t,this.mml);for(const e of this.mrows)t.appendChild(e);t.appendChild(this.mml)}return this.mml}recurseToTable(t){var e,s;if(t.hasAnnotation("Emph","top")||t.hasAnnotation("Emph","fence")||!t.hasAnnotation("Emph","left")&&!t.hasAnnotation("Emph","right")){if(!t.mathmlTree||$p(t.mathmlTree)===qm.MTABLE&&(null===(e=t.annotation.Emph)||void 0===e?void 0:e.length)&&"table"!==t.annotation.Emph[0]){const e=hg();cg(e,t),this.mrows.unshift(e)}else{if($p(t.mathmlTree)===qm.MTABLE&&(null===(s=t.annotation.Emph)||void 0===s?void 0:s.length)&&"table"===t.annotation.Emph[0])return void this.finalizeTable(t);cg(t.mathmlTree,t)}if(t.childNodes.forEach(this.recurseToTable.bind(this)),t.textContent||"punctuated"===t.type){const e=t.contentNodes.map(t=>{const e=lb(t);return e.hasAttribute("data-semantic-added")?this.mrows.unshift(e):this.recurseToTable(t),e});return void db(t,e)}t.contentNodes.forEach(this.recurseToTable.bind(this))}else zg(t)}finalizeTable(t){cg(t.mathmlTree,t),t.contentNodes.forEach(t=>{zg(t)}),t.childNodes.forEach(t=>{zg(t)})}}class Cb extends fb{static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;const e=$p(t.mathmlTree),s=t.type;return(s===mm.LIMUPPER||s===mm.LIMLOWER)&&(e===qm.MSUBSUP||e===qm.MUNDEROVER)||s===mm.LIMBOTH&&(e===qm.MSUB||e===qm.MUNDER||e===qm.MSUP||e===qm.MOVER)}static walkTree_(t){t&&zg(t)}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=this.semantic.childNodes;return this.semantic.type!==mm.LIMBOTH&&this.mml.childNodes.length>=3&&(this.mml=qg([this.mml],this.semantic)),cg(this.mml,this.semantic),t[0].mathmlTree||(t[0].mathmlTree=this.semantic.mathmlTree),t.forEach(Cb.walkTree_),this.mml}}class Ab extends fb{static test(t){return!!t.mathmlTree&&t.type===mm.LINE}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){return this.semantic.contentNodes.length&&zg(this.semantic.contentNodes[0]),this.semantic.childNodes.length&&zg(this.semantic.childNodes[0]),cg(this.mml,this.semantic),this.mml}}class Lb extends fb{static test(t){return!!t.mathmlTree&&(t.type===mm.INFERENCE||t.type===mm.PREMISES)}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){return this.semantic.childNodes.length?(this.semantic.contentNodes.forEach(function(t){zg(t),cg(t.mathmlTree,t)}),this.semantic.childNodes.forEach(function(t){zg(t)}),cg(this.mml,this.semantic),this.mml.getAttribute("data-semantic-id")===this.mml.getAttribute("data-semantic-parent")&&this.mml.removeAttribute("data-semantic-parent"),this.mml):this.mml}}class Sb extends fb{static test(t){return t.type===mm.MATRIX||t.type===mm.VECTOR||t.type===mm.CASES}constructor(t){super(t),this.inner=[],this.mml=t.mathmlTree}getMathml(){const t=lb(this.semantic.contentNodes[0]),e=this.semantic.contentNodes[1]?lb(this.semantic.contentNodes[1]):null;if(this.inner=this.semantic.childNodes.map(zg),this.mml)if($p(this.mml)===qm.MFENCED){const s=this.mml.childNodes;this.mml.insertBefore(t,s[0]||null),e&&this.mml.appendChild(e),this.mml=cb(this.mml)}else{const s=[t,this.mml];e&&s.push(e),this.mml=qg(s,this.semantic)}else this.mml=qg([t].concat(this.inner,[e]),this.semantic);return cg(this.mml,this.semantic),this.mml}}class Rb extends fb{static test(t){return t.type===mm.PUNCTUATED&&(t.role===gm.TEXT||t.contentNodes.every(t=>t.role===gm.DUMMY))}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=[],e=mb(this.semantic,t);return this.mml=qg(t,this.semantic),cg(this.mml,this.semantic),this.mml.removeAttribute(og.CONTENT),ab(this.mml,e),this.mml}}function Mb(t,e){const s=function(t){return t.cloneNode(!0)}(t),i=function(t,e,s){return wp.getInstance().generate(()=>["Original MathML",pb(t)]),Wg.clear(),zg(e.root),s.structure&&t.setAttribute(og.STRUCTURE,dg.fromStructure(t,e,s).toString()),wp.getInstance().generate(()=>["Semantic Tree\n",pb(e),"Semantically enriched MathML\n",pb(t)]),t}(s,_g(s,e),e);return i}Ug.push({test:Cb.test,constr:t=>new Cb(t)},{test:vb.test,constr:t=>new vb(t)},{test:bb.test,constr:t=>new bb(t)},{test:Eb.test,constr:t=>new Eb(t)},{test:Nb.test,constr:t=>new Nb(t)},{test:yb.test,constr:t=>new yb(t)},{test:Ab.test,constr:t=>new Ab(t)},{test:gb.test,constr:t=>new gb(t)},{test:Lb.test,constr:t=>new Lb(t)},{test:Tb.test,constr:t=>new Tb(t)},{test:Sb.test,constr:t=>new Sb(t)},{test:Rb.test,constr:t=>new Rb(t)});const Ib=new cp({AbsoluteValue:["Auto","AbsEnd","Cardinality","Determinant"],Bar:["Auto","Conjugate"],Caps:["Auto","SayCaps"],CombinationPermutation:["Auto","ChoosePermute"],Currency:["Auto","Position","Prefix"],Ellipses:["Auto","AndSoOn"],Enclosed:["Auto","EndEnclose"],Exponent:["Auto","AfterPower","Ordinal","OrdinalPower","Exponent"],Fraction:["Auto","EndFrac","FracOver","General","GeneralEndFrac","Ordinal","Over","OverEndFrac","Per"],Functions:["Auto","None","Reciprocal"],Inference:["Auto","Long"],ImpliedTimes:["Auto","MoreImpliedTimes","None"],Log:["Auto","LnAsNaturalLog"],Matrix:["Auto","Combinatoric","EndMatrix","EndVector","SilentColNum","SpeakColNum","Vector"],MultiLineLabel:["Auto","Case","Constraint","Equation","Line","None","Row","Step"],MultiLineOverview:["Auto","None"],MultiLinePausesBetweenColumns:["Auto","Long","Short"],MultsymbolDot:["Auto","Dot"],MultsymbolX:["Auto","By","Cross"],Paren:["Auto","CoordPoint","Interval","Silent","Speak","SpeakNestingLevel"],Prime:["Auto","Angle","Length"],Roots:["Auto","PosNegSqRoot","PosNegSqRootEnd","RootEnd"],SetMemberSymbol:["Auto","Belongs","Element","Member","In"],Sets:["Auto","SilentBracket","woAll"],TriangleSymbol:["Auto","Delta"],Trig:["Auto","ArcTrig","TrigInverse","Reciprocal"],VerticalLine:["Auto","Divides","Given","SuchThat"]}),wb="Auto";function kb(t){const e=t.split(":"),s={},i=Ib.getProperties(),r=Object.keys(i);for(let t,n=0;t=e[n];n++){const e=t.split("_");if(-1===r.indexOf(e[0]))continue;const n=e[1];n&&n!==wb&&-1!==i[e[0]].indexOf(n)&&(s[e[0]]=e[1])}return s}function Ob(t){const e=Object.keys(t),s=[];for(let i=0;iBp.getInstance().setup(t),Bb=()=>Bp.getInstance().json(),Fb=t=>function(t,e){const s=Vp(t);try{return Mb(s,e)}catch(t){return console.error(t),s}}(t,Bp.getInstance().options),jb=Vp,_b=function(t,e,s){if("default"===t)return e+"_"+s;const i=kb(t);return i[e]=s,Ob(i)},Ub=kb,Hb=Ob;var Wb=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};let zb={},qb=null;function Vb(t){var e,s;const i=null==t?void 0:t.match(/^clearspeak-(.*)/);return qb=null!==(s=null!==(e=i&&i[1])&&void 0!==e?e:qb)&&void 0!==s?s:"default",qb}const Xb=new Map;const Gb=new Map;let Jb=0;function Kb(t,e){const s=Xb.get(e);!function(t,e){const s=t.pool.lookup("speechRules"),i=Vb(t.settings.speechRules);zb=Ub(i);for(const i of e)t.factory.get("variable")(t.factory,{name:"csprf_"+i,setter:t=>{zb[i]=t,s.setValue("clearspeak-"+Hb(zb))},getter:()=>zb[i]||"Auto"},t.pool)}(t,Object.keys(s));const i=[];for(const t of Object.getOwnPropertyNames(s))i.push({title:t,values:s[t].map(e=>e.replace(RegExp("^"+t+"_"),"")),variable:"csprf_"+t});const r=new np("Clearspeak Preferences","",i,"alphabetical","square",t);return{type:"command",id:"ClearspeakPreferences",content:"Select Preferences",action:()=>r.post()}}function $b(t,e,s){return Wb(this,void 0,void 0,function*(){var i,r;const n=i=>{s(t.factory.get("subMenu")(t.factory,{items:i,id:"Clearspeak"},e))};if(!t.settings.speech||!t.settings.enrich)return void n([]);const o=t.pool.lookup("locale").getValue();if(yield function(t,e){return Wb(this,void 0,void 0,function*(){Xb.has(e)||(yield t.mathItem.generatorPool.getLocalePreferences(Xb))})}(t,o),!Xb.get(o))return void n([]);const a=Kb(t,o);let l=[];if(t.settings.speech){const e=t.mathItem,s=null===(i=null==e?void 0:e.explorers)||void 0===i?void 0:i.speech,n=Vb(t.settings.speechRules);l=l.concat(function(t){return[{type:"radio",content:"No Preferences",id:"clearspeak-default",variable:"speechRules"},{type:"radio",content:"Current Preferences",id:"clearspeak-"+t,variable:"speechRules"},{type:"rule"}]}(n));const a=null==s?void 0:s.refocus,c=null!==(r=null==a?void 0:a.getAttribute("data-semantic-id"))&&void 0!==r?r:null,h=Jb++;yield e.generatorPool.getRelevantPreferences(e,c,Gb,h);const d=Gb.get(h);if(Gb.delete(h),d){const t=function(t,e,s){const i=Xb.get(s);return[{type:"label",content:"Preferences for "+e},{type:"rule"}].concat(i[e].map(function(e){const[s,i]=e.split("_");return{type:"radioCompare",content:i,id:"clearspeak-"+_b(t,s,i),variable:"speechRules",comparator:(t,e)=>{if(t===e)return!0;if("Auto"!==i)return!1;const[r,n]=t.split("-"),[o]=e.split("-");return r===o&&!Ub(n)[s]}}}))}(n,d,o);l=l.concat(t)}}l.splice(2,0,a),n(l)})}rp.DynamicSubmenus.set("Clearspeak",[$b,"speech"]);let Yb=null;function Qb(t,e,s){if(Yb)return void s(Yb);const i=[];for(const t of Db.keys())"nemeth"!==t&&"euro"!==t&&i.push({type:"radio",id:t,content:Db.get(t)||t,variable:"locale"});i.sort((t,e)=>t.content.localeCompare(e.content,"en")),Yb=t.factory.get("subMenu")(t.factory,{items:i,id:"Language"},e),s(Yb)}rp.DynamicSubmenus.set("A11yLanguage",[Qb,"speech"]);const Zb="MacOS"===pi.os;function tE(t){const e=pi.document,s=e.createElement("textarea");s.value=t,s.setAttribute("readonly",""),s.style.cssText="height: 1px; width: 1px; padding: 1px; position: absolute; left: -10px",e.body.appendChild(s),s.select();try{e.execCommand("copy")}catch(t){alert(`Can't copy to clipboard: ${t.message}`)}e.body.removeChild(s)}function eE(t,e,s){return(i,r,n)=>{!function(t,e,s){if(!t)return;for(const i of t.childNodes)if(i.isKind("annotation")){const t=iE(i,e);if(t){const e=i.childNodes.reduce((t,e)=>t+e.toString(),"");s.push([t,e])}}}(function(t){var e;let s=null===(e=t.mathItem)||void 0===e?void 0:e.root;for(;s&&!s.isKind("semantics");){if(s.isToken||1!==s.childNodes.length)return null;s=s.childNodes[0]}return s}(i),e,s),n(nE(i,r,s,t))}}function sE(t){return(e,s,i)=>{const r=t.slice();t.length=0,i(nE(e,s,r,()=>tE(rE.trim())))}}function iE(t,e){const s=t.attributes.get("encoding");for(const t of Object.keys(e))if(e[t].includes(s))return t;return null}let rE="";function nE(t,e,s,i){return t.factory.get("subMenu")(t.factory,{items:s.map(([t,e])=>({type:"command",id:t,content:t,action:()=>{rE=e,i()}})),id:"annotations"},e)}class oE extends uo{static post(t){return super.post(t)}html(t){var e;null!==(e=t.extraNodes)&&void 0!==e||(t.extraNodes=[]);const s=t.adaptor.node("input",{type:"button",value:"Copy to Clipboard","data-drag":"none"});return s.addEventListener("click",this.copyToClipboard.bind(this)),t.extraNodes.push(s),t.code&&(t.message="
"+this.formatSource(t.message)+"
"),super.html(t)}formatSource(t){return t.trim().replace(/&/g,"&").replace(//g,">")}}class aE extends ju{static fromJson(t,{content:e,variable:s,id:i,comparator:r},n){return new this(n,e,s,i,r)}constructor(t,e,s,i,r){super(t,e,s,i),this.comparator=r,this.role="menuitemradiocompare"}updateAria(){this.html.setAttribute("aria-checked",this.comparator(this.variable.getValue(),this.id)?"true":"false")}updateSpan(){this.span.style.display=this.comparator(this.variable.getValue(),this.id)?"":"none"}}class lE extends Yn{constructor(){super(...arguments),this.options={filterSRE:!0,filterTex:!0,texHints:!0,semantics:!1},this.mathItem=null}visitTree(t,e=null,s={}){return this.mathItem=e,Fi(this.options,s),this.visitNode(t,"")}visitTeXAtomNode(t,e){return this.options.texHints?super.visitDefault(t,e):t.childNodes[0]&&1===t.childNodes[0].childNodes.length?this.visitNode(t.childNodes[0],e):`${e}\n`+this.childNodeMml(t,e+" ","\n")+`${e}`}visitMathNode(t,e){if(!this.options.semantics||"TeX"!==this.mathItem.inputJax.name)return super.visitDefault(t,e);const s=t.childNodes.length&&t.childNodes[0].childNodes.length>1;return`${e}\n${e} \n`+(s?e+" \n":"")+this.childNodeMml(t,e+(s?" ":" "),"\n")+(s?e+" \n":"")+`${e} `+this.mathItem.math+`\n${e} \n${e}`}getAttributeList(t){const e=super.getAttributeList(t);if(this.options.filterTex&&(delete e["data-latex"],delete e["data-latex-item"]),this.options.filterSRE){const t=Object.keys(e).filter(t=>t.match(/^(?:data-semantic-.*?|data-speech-node|role|aria-(?:level|posinset|setsize|owns))$/));for(const s of t)delete e[s]}return e}}var cE=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const hE=di;class dE{get isLoading(){return dE.loading>0}get loadingPromise(){return this.isLoading?(dE._loadingPromise||(dE._loadingPromise=new Promise((t,e)=>{dE._loadingOK=t,dE._loadingFailed=e})),dE._loadingPromise):Promise.resolve()}about(){const t=[];if(t.push("Input Jax: "+this.document.inputJax.map(t=>t.name).join(", ")),t.push("Output Jax: "+this.document.outputJax.name),t.push("Document Type: "+this.document.kind),hE&&hE.loader){t.push("
Modules Loaded:");const e=hE._.components.package.Package,s=hE.loader.versions;for(const i of Array.from(e.packages.keys()).sort(this.sortPackages)){const r=s.get(e.resolvePath(i));r&&t.push(`    ${i} (${r})`)}}uo.post({title:"MathJax v"+to.version+"",message:t.join("
"),adaptor:this.document.adaptor,styles:{".mjx-dialog":{"max-height":"calc(min(20em, 85%))"},"mjx-dialog > div":{"white-space":"nowrap"},"dialog.mjx-dialog-help > mjx-dialog > div":{"white-space":"normal"},"mjx-v":{"font-size":"80%"}},extraNodes:[this.document.adaptor.node("a",{href:"https://www.mathjax.org","data-drag":"false",target:"_blank"},[this.document.adaptor.text("https://www.mathjax.org")])]})}sortPackages(t,e){const[s,i]=t.includes("/")?t.split(/\//):["",t],[r,n]=e.includes("/")?e.split(/\//):["",e];return s===r?iMathJax 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, the mechanism used to display equations,"," how to handle equations that are too wide, and the language to use for"," MathJax's menus and error messages (not yet implemented in v4).","

","

Accessibility: MathJax can work with screen"," readers to make mathematics accessible to the visually impaired."," Turn on speech or braille generation to enable creation of speech strings"," and the ability to investigate expressions interactively. You can control"," the style of the explorer in its menu.

","
","

Math Zoom: If you are having difficulty reading an"," equation, MathJax can enlarge it to help you see it better, or"," you can scale 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"),adaptor:this.document.adaptor,extraNodes:[this.document.adaptor.node("a",{href:"https://www.mathjax.org","data-drag":"none"},[this.document.adaptor.text("https://www.mathjax.org")])]})}mathMLCode(){oE.post({title:"MathJax MathML Expression",message:this.menu.mathItem?this.toMML(this.menu.mathItem):"",adaptor:this.document.adaptor,code:!0})}originalText(){var t,e;oE.post({title:"MathJax Original Source",message:null!==(e=null===(t=this.menu.mathItem)||void 0===t?void 0:t.math)&&void 0!==e?e:"",adaptor:this.document.adaptor,code:!0})}annotationBox(){oE.post({title:"MathJax Annotation Text",message:rE,adaptor:this.document.adaptor,code:!0})}svgImage(){return cE(this,void 0,void 0,function*(){oE.post({title:"MathJax SVG Image",message:yield this.toSVG(this.menu.mathItem),adaptor:this.document.adaptor,code:!0})})}speechText(){var t,e,s;oE.post({title:"MathJax Speech Text",message:null!==(s=null===(e=null===(t=this.menu.mathItem)||void 0===t?void 0:t.outputData)||void 0===e?void 0:e.speech)&&void 0!==s?s:"",adaptor:this.document.adaptor,code:!0})}brailleText(){var t,e,s;oE.post({title:"MathJax Braille Text",message:null!==(s=null===(e=null===(t=this.menu.mathItem)||void 0===t?void 0:t.outputData)||void 0===e?void 0:e.braille)&&void 0!==s?s:"",adaptor:this.document.adaptor,code:!0})}errorMessage(){oE.post({title:"MathJax Error Message",message:this.menu.mathItem?this.menu.errorMsg:"",adaptor:this.document.adaptor,code:!0})}zoomBox(){let t="";if(this.menu.mathItem){const e=this.menu.mathItem.typesetRoot,s=this.document.adaptor.fontSize(e),i=e.cloneNode(!0);i.style.margin="0";t=`
${i.outerHTML}
`}uo.post({title:"MathJax Zoomed Expression",message:t,adaptor:this.document.adaptor,styles:{"mjx-dialog > div":{padding:"1.8em"}}})}constructor(t,e={}){this.settings=null,this.defaultSettings=null,this.menu=null,this.current=null,this.MmlVisitor=new lE,this.jax={CHTML:null,SVG:null},this.rerenderStart=ar.LAST,this.requiredExtensions=[],this.document=t,this.options=Fi(Bi({},this.constructor.OPTIONS),e),this.initSettings(),this.mergeUserSettings(),this.initMenu(),this.applySettings()}initSettings(){var t;this.settings=this.options.settings,this.jax=this.options.jax;const e=this.document.outputJax;this.jax[e.name]=e,this.settings.renderer=e.name,this.settings.scale=e.options.scale,e.options.displayOverflow&&(this.settings.overflow=e.options.displayOverflow.substring(0,1).toUpperCase()+e.options.displayOverflow.substring(1).toLowerCase()),this.settings.breakInline=null===(t=e.options.linebreaks)||void 0===t?void 0:t.inline,this.defaultSettings=Object.assign({},this.document.options.a11y,this.settings),this.setA11y({roleDescription:this.settings.roleDescription})}initMenu(){const t=new Qu([["contextMenu",rp.fromJson.bind(rp)],["radioCompare",aE.fromJson.bind(aE)]]);this.menu=t.parse({type:"contextMenu",id:"MathJax_Menu",pool:[this.variable("showSRE"),this.variable("showTex"),this.variable("texHints"),this.variable("semantics"),this.variable("zoom"),this.variable("zscale"),this.variable("renderer",t=>this.setRenderer(t)),this.variable("overflow",t=>this.setOverflow(t)),this.variable("breakInline",t=>this.setInlineBreaks(t)),this.variable("alt"),this.variable("cmd"),this.variable("ctrl"),this.variable("shift"),this.variable("scale",t=>this.setScale(t)),this.a11yVar("speech",t=>this.setSpeech(t)),this.a11yVar("braille",t=>this.setBraille(t)),this.variable("brailleCode",t=>this.setBrailleCode(t)),this.a11yVar("brailleSpeech",t=>this.setBrailleSpeech(t)),this.a11yVar("brailleCombine",t=>this.setBrailleCombine(t)),this.a11yVar("highlight",t=>this.setHighlight(t)),this.a11yVar("backgroundColor",t=>this.setColor("bg",t)),this.a11yVar("backgroundOpacity",t=>this.setColor("bg",null,t)),this.a11yVar("foregroundColor",t=>this.setColor("fg",t)),this.a11yVar("foregroundOpacity",t=>this.setColor("fg",null,t)),this.a11yVar("subtitles"),this.a11yVar("viewBraille"),this.a11yVar("voicing"),this.a11yVar("roleDescription",()=>this.setRoleDescription()),this.a11yVar("help"),this.a11yVar("locale",t=>this.setLocale(t)),this.variable("speechRules",t=>{const[e,s]=t.split("-");this.document.options.sre.domain=e,this.document.options.sre.style=s,this.rerender(ar.COMPILED)}),this.a11yVar("magnification"),this.a11yVar("magnify"),this.a11yVar("treeColoring"),this.a11yVar("infoType"),this.a11yVar("infoRole"),this.a11yVar("infoPrefix"),this.variable("autocollapse"),this.variable("collapsible",t=>this.setCollapsible(t)),this.variable("enrich",t=>this.setEnrichment(t)),this.a11yVar("inTabOrder",t=>this.setTabOrder(t)),this.a11yVar("tabSelects"),this.variable("assistiveMml",t=>this.setAssistiveMml(t))],items:[this.submenu("Show","Show Math As",[this.command("MathMLcode","MathML Code",()=>this.mathMLCode()),this.command("Original","Original Form",()=>this.originalText()),this.rule(),this.command("Speech","Speech Text",()=>this.speechText(),{disabled:!0}),this.command("Braille","Braille Code",()=>this.brailleText(),{disabled:!0}),this.command("SVG","SVG Image",()=>this.svgImage(),{disabled:!0}),this.submenu("ShowAnnotation","Annotation"),this.rule(),this.command("Error","Error Message",()=>this.errorMessage(),{disabled:!0})]),this.submenu("Copy","Copy to Clipboard",[this.command("MathMLcode","MathML Code",()=>this.copyMathML()),this.command("Original","Original Form",()=>this.copyOriginal()),this.rule(),this.command("Speech","Speech Text",()=>this.copySpeechText(),{disabled:!0}),this.command("Braille","Braille Code",()=>this.copyBrailleText(),{disabled:!0}),this.command("SVG","SVG Image",()=>this.copySvgImage(),{disabled:!0}),this.submenu("CopyAnnotation","Annotation"),this.rule(),this.command("Error","Error Message",()=>this.copyErrorMessage(),{disabled:!0})]),this.rule(),this.submenu("Settings","Math Settings",[this.submenu("Renderer","Math Renderer",this.radioGroup("renderer",[["CHTML"],["SVG"]])),this.submenu("Overflow","Wide Expressions",[this.radioGroup("overflow",[["Overflow"],["Scroll"],["Linebreak"],["Scale"],["Truncate"],["Elide"]]),this.rule(),this.checkbox("BreakInline","Allow In-line Breaks","breakInline")]),this.rule(),this.submenu("MathmlIncludes","MathML/SVG has",[this.checkbox("showSRE","Semantic attributes","showSRE"),this.checkbox("showTex","LaTeX attributes","showTex"),this.checkbox("texHints","TeX hints","texHints"),this.checkbox("semantics","Original as annotation","semantics")]),this.submenu("Language","Language"),this.rule(),this.submenu("ZoomTrigger","Zoom Trigger",[this.command("ZoomNow","Zoom Once Now",()=>this.zoom(null,"")),this.rule(),this.radioGroup("zoom",[["Click"],["DoubleClick","Double-Click"],["NoZoom","No Zoom"]]),this.rule(),this.label("TriggerRequires","Trigger Requires:"),this.checkbox(Zb?"Option":"Alt",Zb?"Option":"Alt","alt"),this.checkbox("Command","Command","cmd",{hidden:!Zb}),this.checkbox("Control","Control","ctrl",{hidden:Zb}),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...",()=>this.scaleAllMath()),this.rule(),this.command("Reset","Reset to defaults",()=>this.resetDefaults())]),this.rule(),this.label("Accessibility","\xa0\xa0 Accessibility:"),this.submenu("Speech","\xa0 \xa0 Speech",[this.checkbox("Generate","Generate","speech"),this.checkbox("Subtitles","Show Subtitles","subtitles"),this.checkbox("Auto Voicing","Auto Voicing","voicing"),this.rule(),this.label("Rules","Rules:"),this.submenu("Mathspeak","Mathspeak",this.radioGroup("speechRules",[["mathspeak-default","Verbose"],["mathspeak-brief","Brief"],["mathspeak-sbrief","Superbrief"]])),this.submenu("Clearspeak","Clearspeak",this.radioGroup("speechRules",[["clearspeak-default","Auto"]])),this.rule(),this.submenu("A11yLanguage","Language")]),this.submenu("Braille","\xa0 \xa0 Braille",[this.checkbox("Generate","Generate","braille"),this.checkbox("Subtitles","Show Subtitles","viewBraille"),this.checkbox("BrailleSpeech","Replace Speech","brailleSpeech",{hidden:!0}),this.checkbox("BrailleCombine","Combine with Speech","brailleCombine"),this.rule(),this.label("Code","Code Format:"),this.radioGroup("brailleCode",[["nemeth","Nemeth"],["ueb","UEB"],["euro","Euro"]])]),this.submenu("Explorer","\xa0 \xa0 Explorer",[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")]),this.rule(),this.submenu("Role Description","Describe math as",[this.radioGroup("roleDescription",[["MathJax expression"],["MathJax"],["math"],["clickable math"],["explorable math"],["none"]])]),this.checkbox("Math Help","Help message on focus","help")]),this.submenu("Options","\xa0 \xa0 Options",[this.checkbox("Enrich","Semantic Enrichment","enrich"),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.submenu("TabSelects","Tabbing Focuses on",[this.radioGroup("tabSelects",[["all","Whole Expression"],["last","Last Explored Node"]])]),this.rule(),this.checkbox("AssistiveMml","Include Hidden MathML","assistiveMml")]),this.rule(),this.command("About","About MathJax",()=>this.about()),this.command("Help","MathJax Help",()=>this.help())]});const e=this.menu;e.settings=this.settings,e.findID("Settings","Overflow","Elide").disable(),e.findID("Braille","ueb").hide(),e.setJax(this.jax),this.checkLoadableItems();const s=[];rp.DynamicSubmenus.set("ShowAnnotation",[eE(()=>this.annotationBox(),this.options.annotationTypes,s),""]),rp.DynamicSubmenus.set("CopyAnnotation",[sE(s),""]),function(t){ip(Object.assign(Object.assign({},ep),sp),t)}(this.document.document)}checkLoadableItems(){var t,e,s,i,r,n;if(hE&&hE._&&hE.loader&&hE.startup){const o=this.settings,a=this.document.options;(o.enrich||o.speech&&a.enableSpeech||o.braille&&a.enableBraille)&&!(null===(e=null===(t=hE._)||void 0===t?void 0:t.a11y)||void 0===e?void 0:e.explorer)&&this.loadA11y("explorer"),o.collapsible&&!(null===(i=null===(s=hE._)||void 0===s?void 0:s.a11y)||void 0===i?void 0:i.complexity)&&this.loadA11y("complexity"),o.assistiveMml&&!(null===(n=null===(r=hE._)||void 0===r?void 0:r.a11y)||void 0===n?void 0:n["assistive-mml"])&&this.loadA11y("assistive-mml")}else{const t=this.menu;for(const e of Object.keys(this.jax))this.jax[e]||t.findID("Settings","Renderer",e).disable();t.findID("Speech").disable(),t.findID("Braille").disable(),t.findID("Explorer").disable(),t.findID("Options","AutoCollapse").disable(),t.findID("Options","Collapsible").disable(),t.findID("Options","Enrich").disable(),t.findID("Options","AssistiveMml").disable()}}enableAccessibilityItems(t,e){const s=this.menu.findID(t).submenu;for(const t of s.items.slice(1))t instanceof _u||(!e||t instanceof wu&&!t.submenu.items.length?t.disable():t.enable())}mergeUserSettings(){try{const t=localStorage.getItem(dE.MENU_STORAGE);if(!t)return;const e=JSON.parse(t);Object.assign(this.settings,e),this.setA11y(e)}catch(t){console.log("MathJax localStorage error: "+t.message)}}saveUserSettings(){const t={};for(const e of Object.keys(this.settings))this.settings[e]!==this.defaultSettings[e]&&(t[e]=this.settings[e]);try{Object.keys(t).length?localStorage.setItem(dE.MENU_STORAGE,JSON.stringify(t)):localStorage.removeItem(dE.MENU_STORAGE)}catch(t){console.log("MathJax localStorage error: "+t.message)}}setA11y(t){var e,s;(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)&&hE._.a11y.explorer_ts.setA11yOptions(this.document,t)}getA11y(t){var e,s;if(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)return void 0!==this.document.options.a11y[t]?this.document.options.a11y[t]:this.document.options.sre[t]}applySettings(){this.setTabOrder(this.settings.inTabOrder);this.document.options.enableAssistiveMml=this.settings.assistiveMml,this.enableAccessibilityItems("Speech",this.settings.speech),this.enableAccessibilityItems("Braille",this.settings.braille),this.setAccessibilityMenus();const t=this.settings.renderer.replace(/[^a-zA-Z0-9]/g,"")||"CHTML";(dE._loadingPromise||Promise.resolve()).then(()=>{const e=this.settings;if(this.applyRendererOptions(this.document.outputJax),!e.speechRules){const t=this.document.options.sre;e.speechRules=`${t.domain||"clearspeak"}-${t.style||"default"}`}t!==this.defaultSettings.renderer&&this.document.whenReady(()=>this.setRenderer(t,!1))})}setOverflow(t){this.document.outputJax.options.displayOverflow=t.toLowerCase(),dE.loading||this.document.rerenderPromise()}setInlineBreaks(t){this.document.outputJax.options.linebreaks.inline=t,dE.loading||this.document.rerenderPromise()}setScale(t){this.document.outputJax.options.scale=parseFloat(t),dE.loading||this.document.rerenderPromise()}setRenderer(t,e=!0){if(Object.hasOwn(this.jax,t)&&this.jax[t])return this.applyRendererOptions(this.jax[t]),this.setOutputJax(t,e);const s=t.toLowerCase();return new Promise((i,r)=>{this.loadComponent("output/"+s,()=>{const n=hE.startup;if(!(s in n.constructors))return r(new Error(`Component ${s} not loaded`));n.useOutput(s,!0),n.output=this.applyRendererOptions(n.getOutputJax()),n.output.setAdaptor(this.document.adaptor),n.output.initialize(),this.jax[t]=n.output,this.setOutputJax(t,e).then(()=>i()).catch(t=>r(t))})})}applyRendererOptions(t){const e=this.settings,s=t.options;return s.scale=parseFloat(e.scale),s.displayOverflow=e.overflow.toLowerCase(),s.linebreaks&&(s.linebreaks.inline=e.breakInline),t}setOutputJax(t,e=!0){this.jax[t].setAdaptor(this.document.adaptor),this.document.outputJax=this.jax[t];const s=this.loadRequiredExtensions();return e?s.then(()=>to.handleRetriesFor(()=>this.rerender())):s.then(()=>{})}loadRequiredExtensions(){const t=this.document.outputJax.name.toLowerCase(),e=[];for(const s of this.requiredExtensions)e.push(hE.loader.load(`[${s}]/${t}`));return this.requiredExtensions=[],Promise.all(e)}addRequiredExtensions(t){if(t){const e=new Set([...this.requiredExtensions,...t]);this.requiredExtensions=[...e]}}setTabOrder(t){const e=this.menu.findID("Options","TabSelects");t?e.enable():e.disable(),this.menu.store.inTaborder(t)}setAssistiveMml(t){var e,s;this.document.options.enableAssistiveMml=t,t&&this.noRerender(()=>{this.settings.speech&&this.menu.pool.lookup("speech").setValue(!1),this.settings.braille&&this.menu.pool.lookup("braille").setValue(!1)}),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s["assistive-mml"])?this.rerender():this.loadA11y("assistive-mml")}setAccessibilityMenus(){const t=this.settings.enrich,e=t?"enable":"disable";["Speech","Braille","Explorer"].forEach(t=>this.menu.findID(t)[e]());const s=this.document.options;s.enableSpeech=s.enableBraille=s.enableExplorer=t,t||(this.settings.collapsible=!1,this.document.options.enableCollapsible=!1)}setSpeech(t){var e,s;this.enableAccessibilityItems("Speech",t),this.document.options.enableSpeech=t,t&&(this.settings.assistiveMml&&this.noRerender(()=>this.menu.pool.lookup("assistiveMml").setValue(!1)),this.settings.brailleSpeech&&this.noRerender(()=>this.menu.pool.lookup("brailleSpeech").setValue(!1))),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)?this.rerender(ar.COMPILED):this.loadA11y("explorer")}setBraille(t){var e,s;this.enableAccessibilityItems("Braille",t),this.document.options.enableBraille=t,t&&this.settings.assistiveMml&&this.noRerender(()=>this.menu.pool.lookup("assistiveMml").setValue(!1)),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)?this.rerender(ar.COMPILED):this.loadA11y("explorer")}setBrailleCode(t){this.document.options.sre.braille=t,this.rerender(ar.COMPILED)}setBrailleSpeech(t){t&&this.settings.speech?this.noRerender(()=>this.menu.pool.lookup("speech").setValue(!1)):this.enableAccessibilityItems("Speech",!0),this.settings.brailleCombine=this.document.options.a11y.brailleCombine=!1,this.rerender(ar.COMPILED)}setBrailleCombine(t){this.settings.brailleSpeech&&this.menu.pool.lookup("brailleSpeech").setValue(!1),this.settings.brailleSpeech=this.document.options.a11y.brailleSpeech=!1,this.rerender(ar.COMPILED)}setLocale(t){this.document.options.sre.locale=t,this.rerender(ar.COMPILED)}setRoleDescription(){this.rerender(ar.COMPILED)}setEnrichment(t){var e,s;this.document.options.enableEnrichment=t,this.setAccessibilityMenus(),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.explorer)?this.rerender(ar.COMPILED):this.loadA11y("explorer")}setCollapsible(t){var e,s;this.document.options.enableComplexity=t,t&&!this.settings.enrich&&(this.settings.enrich=this.document.options.enableEnrichment=!0,this.setAccessibilityMenus()),t||this.menu.pool.lookup("highlight").setValue("None"),!t||(null===(s=null===(e=hE._)||void 0===e?void 0:e.a11y)||void 0===s?void 0:s.complexity)?this.rerender(ar.COMPILED):this.loadA11y("complexity")}setHighlight(t){var e,s;if("None"!==t){if(!this.settings.collapsible){const t=this.menu.pool.lookup("collapsible");t.setValue(!0),null===(s=null===(e=t.items[0])||void 0===e?void 0:e.executeCallbacks_)||void 0===s||s.call(e)}dE.loadingPromises.has("a11y/complexity")||this.rerender(ar.COMPILED)}}setColor(t,e,s){const i=this.document.options.a11y;e||(e=i["fg"===t?"foregroundColor":"backgroundColor"]),s||(s=i["fg"===t?"foregroundOpacity":"backgroundOpacity"]),hE._.a11y.explorer.Region.LiveRegion.setColor(t,1,e.toLowerCase(),parseInt(s)/100)}scaleAllMath(){const t=(100*parseFloat(this.settings.scale)).toFixed(1).replace(/.0$/,""),e=prompt("Scale all mathematics (compared to surrounding text) by",t+"%");if(this.current){const t=this.menu.mathItem.explorers.speech;t.refocus=this.current,t.focus()}if(e)if(e.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)){const t=parseFloat(e)/100;t?this.menu.pool.lookup("scale").setValue(String(t)):alert("The scale should not be zero")}else alert("The scale should be a percentage (e.g., 120%)")}resetDefaults(){this.noRerender(()=>{const t=this.menu.pool,e=this.defaultSettings;for(const s of Object.keys(e)){const i=t.lookup(s);if(i){if(i.getValue()!==e[s]){i.setValue(e[s]);const t=i.items[0];t&&t.executeCallbacks_()}}else Object.hasOwn(this.settings,s)&&(this.settings[s]=e[s])}}),this.rerender(ar.COMPILED)}checkComponent(t){const e=dE.loadingPromises.get(t);e&&to.retryAfter(e)}loadComponent(t,e){if(dE.loadingPromises.has(t))return;const s=hE.loader;if(!s)return;dE.loading++;const i=s.load(t).then(()=>{dE.loading--,dE.loadingPromises.delete(t),0===dE.loading&&dE._loadingPromise&&(dE._loadingPromise=null,dE._loadingOK()),e()}).catch(t=>{dE._loadingPromise?(dE._loadingPromise=null,dE._loadingFailed(t)):console.log(t)});dE.loadingPromises.set(t,i)}loadA11y(t){const e=!ar.ENRICHED;this.loadComponent("a11y/"+t,()=>{var s,i;const r=hE.startup;to.handlers.unregister(r.handler),r.handler=r.getHandler(),to.handlers.register(r.handler);const n=this.document;this.document=r.document=r.getDocument(),this.document.processed=n.processed,this.document.menu=this,n.webworker&&(this.document.webworker=n.webworker),this.setA11y(this.settings),this.defaultSettings=Object.assign({},this.document.options.a11y,(null===(i=null===(s=hE.config)||void 0===s?void 0:s.options)||void 0===i?void 0:i.a11y)||{},this.defaultSettings),this.document.outputJax.reset(),this.transferMathList(n),this.document.processed=n.processed,dE._loadingPromise||(this.document.outputJax.reset(),to.handleRetriesFor(()=>{this.rerender("complexity"===t||e?ar.COMPILED:ar.TYPESET)}))})}transferMathList(t){const e=this.document.options.MathItem;for(const s of t.math){const t=new e;Object.assign(t,s),this.document.math.push(t)}}toMML(t){return this.MmlVisitor.visitTree(t.root,t,{filterSRE:!this.settings.showSRE,filterTex:!this.settings.showTex,texHints:this.settings.texHints,semantics:this.settings.semantics&&"MathML"!==t.inputJax.name})}toSVG(t){return cE(this,void 0,void 0,function*(){const e=this.jax.SVG;if(!e)return"SVG can't be produced.
Try switching to SVG output first.";const s=e.adaptor,i=e.options.fontCache,r=!!t.root.getProperty("process-breaks");if("global"!==i&&(t.display||!r)&&"SVG"===s.getAttribute(t.typesetRoot,"jax"))for(const e of s.childNodes(t.typesetRoot))if("svg"===s.kind(e))return this.formatSvg(s.serializeXML(e));return this.typesetSVG(t,i,r)})}typesetSVG(t,e,s){return cE(this,void 0,void 0,function*(){const i=this.jax.SVG,r=i.html("div");"global"===e&&(i.options.fontCache="local");const n=t.root;return t.root=n.copy(!0),t.root.setInheritedAttributes({},t.display,0,!1),s&&(i.unmarkInlineBreaks(t.root),t.root.setProperty("inlineMarked",!1)),yield to.handleRetriesFor(()=>{i.toDOM(t,r,i.document)}),t.root=n,i.options.fontCache=e,this.formatSvg(i.adaptor.serializeXML(r))})}formatSvg(t){const e=this.constructor.SvgCss,s=(t=(t=t.match(/^/)?t.replace(//,``):t.replace(/^()/,`$1`)).replace(/ (?:role|focusable)=".*?"/g,"").replace(/"currentColor"/g,'"black"')).split(/(<\/?[a-zA-Z].*?>)/);for(let t=2,e="";t\n${t}`}zoom(t,e){t&&!this.isZoomEvent(t,e)||this.zoomBox()}isZoomEvent(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)}rerender(t=ar.TYPESET){this.rerenderStart=Math.min(t,this.rerenderStart),!dE.loading&&hE.startup.hasTypeset&&this.document.whenReady(()=>cE(this,void 0,void 0,function*(){this.rerenderStart<=ar.COMPILED&&this.document.reset({inputJax:[]}),yield this.document.rerenderPromise(this.rerenderStart),this.rerenderStart=ar.LAST}))}noRerender(t){dE.loading++;try{t(),dE.loading--}catch(t){throw dE.loading--,t}}copyMathML(){tE(this.toMML(this.menu.mathItem))}copyOriginal(){tE(this.menu.mathItem.math.trim())}copySvgImage(){this.toSVG(this.menu.mathItem).then(t=>{tE(t)})}copySpeechText(){tE(this.menu.mathItem.outputData.speech)}copyBrailleText(){tE(this.menu.mathItem.outputData.braille)}copyErrorMessage(){tE(this.menu.errorMsg.trim())}addMenu(t){this.addEvents(t),this.menu.store.insert(t.typesetRoot),t.typesetRoot.tabIndex=this.settings.inTabOrder?0:-1}addEvents(t){const e=t.typesetRoot;e.addEventListener("mousedown",()=>{var e,s;this.menu.mathItem=t,this.current=null===(s=null===(e=t.explorers)||void 0===e?void 0:e.speech)||void 0===s?void 0:s.current},!0),e.addEventListener("contextmenu",()=>{var e;this.menu.mathItem=t;const s=null===(e=t.explorers)||void 0===e?void 0:e.speech;s&&(t.outputData.nofocus=!this.current,s.refocus=this.current)},!0),e.addEventListener("keydown",()=>this.menu.mathItem=t,!0),e.addEventListener("click",t=>this.zoom(t,"Click"),!0),e.addEventListener("dblclick",t=>this.zoom(t,"DoubleClick"),!0)}clear(){this.menu.store.clear()}variable(t,e){return{name:t,getter:()=>this.settings[t],setter:s=>{this.settings[t]=s,e&&e(s),this.saveUserSettings()}}}a11yVar(t,e){return{name:t,getter:()=>this.getA11y(t),setter:s=>{this.settings[t]=s,this.setA11y({[t]:s}),e&&e(s),this.saveUserSettings()}}}submenu(t,e,s=[],i=!1){let r=[];for(const t of s)Array.isArray(t)?r=r.concat(t):r.push(t);return{type:"submenu",id:t,content:e,menu:{items:r},disabled:0===r.length||i}}command(t,e,s,i={}){return Object.assign({type:"command",id:t,content:e,action:s},i)}checkbox(t,e,s,i={}){return Object.assign({type:"checkbox",id:t,content:e,variable:s},i)}radioGroup(t,e){return e.map(e=>this.radio(e[0],e[1]||e[0],t))}radio(t,e,s,i={}){return Object.assign({type:"radio",id:t,content:e,variable:s},i)}label(t,e){return{type:"label",id:t,content:e}}rule(){return{type:"rule"}}}function uE(t){return class extends t{addMenu(t,e=!1){this.state()>=ar.CONTEXT_MENU||(this.isEscaped||!t.options.enableMenu&&!e||t.menu.addMenu(this),this.state(ar.CONTEXT_MENU))}getMenus(t){t.menu.menu.store.sort()}checkLoading(t){t.checkLoading()}}}function pE(t){var e;return e=class extends t{constructor(...t){super(...t),this.menu=new this.options.MenuClass(this,this.options.menuOptions);const e=this.constructor.ProcessBits;e.has("context-menu")||e.allocate("context-menu"),this.options.MathItem=uE(this.options.MathItem);const s=this.menu.settings,i=this.options,r=i.enableEnrichment=s.enrich;i.enableSpeech=s.speech&&r,i.enableBraille=s.braille&&r,i.enableComplexity=s.collapsible&&r,i.enableExplorer=r}addMenu(){if(!this.processed.isSet("context-menu")){for(const t of this.math)t.addMenu(this);this.processed.set("context-menu")}return this}getMenus(){this.menu.menu.store.sort()}checkLoading(){let t=!0;try{this._checkLoading(),t=!1}catch(t){if(!t.retry)throw t}return t}_checkLoading(){return this.menu.isLoading&&to.retryAfter(this.menu.loadingPromise.catch(t=>console.log(t))),this.options.enableComplexity&&this.menu.checkComponent("a11y/complexity"),this.options.enableExplorer&&this.menu.checkComponent("a11y/explorer"),this}state(t,e=!1){return super.state(t,e),tconsole.warn("Enrichment Error:",s)},t.OPTIONS),{MenuClass:dE,menuOptions:dE.OPTIONS,enableMenu:!0,sre:t.OPTIONS.sre||wi({}),a11y:t.OPTIONS.a11y||wi({}),renderActions:wi(Object.assign(Object.assign({},t.OPTIONS.renderActions),{addMenu:[ar.CONTEXT_MENU],getMenus:[ar.INSERTED+5,!1],checkLoading:[ar.UNPROCESSED+1,t=>t.checkLoading(),"",!1]}))}),e}function mE(t){return t.documentClass=pE(t.documentClass),t}dE.MENU_STORAGE="MathJax-Menu-Settings",dE.OPTIONS={settings:{showSRE:!1,showTex:!1,texHints:!0,semantics:!1,zoom:"NoZoom",zscale:"200%",renderer:"CHTML",alt:!0,cmd:!1,ctrl:!1,shift:!1,scale:1,overflow:"Scroll",breakInline:!0,autocollapse:!1,collapsible:!1,enrich:!0,assistiveMml:!1,speech:!0,braille:!0,brailleCode:"nemeth",brailleSpeech:!1,brailleCombine:!1,speechRules:"clearspeak-default",roleDescription:"math",inTabOrder:!0,tabSelects:"all",help:!0},jax:{CHTML:null,SVG:null},annotationTypes:wi({TeX:["TeX","LaTeX","application/x-tex"],StarMath:["StarMath 5.0"],Maple:["Maple"],ContentMathML:["MathML-Content","application/mathml-content+xml"],OpenMath:["OpenMath"]})},dE.SvgCss=["svg a{fill:blue;stroke:blue}",'[data-mml-node="merror"]>g{fill:red;stroke:red}','[data-mml-node="merror"]>rect[data-background]{fill:yellow;stroke:none}',"[data-frame],[data-line]{stroke-width:70px;fill:none}",".mjx-dashed{stroke-dasharray:140}",".mjx-dotted{stroke-linecap:round;stroke-dasharray:0,140}","use[data-c]{stroke-width:3px}"].join("\n"),dE.loading=0,dE.loadingPromises=new Map,dE._loadingPromise=null,dE._loadingOK=null,dE._loadingFailed=null,lr("CONTEXT_MENU",170),MathJax.loader&&MathJax.loader.checkVersion("ui/menu",ri,"ui"),hi({_:{a11y:{speech:{SpeechMenu:js}},ui:{menu:{AnnotationMenu:Us,MJContextMenu:Bs,Menu:zs,MenuHandler:qs,MenuUtil:_s,MmlVisitor:Ws,RadioCompare:Hs}}}}),MathJax.startup&&ui&&MathJax.startup.extendHandler(t=>mE(t),20),MathJax.loader&&MathJax.loader.checkVersion("a11y/sre",ri,"a11y"),hi({_:{a11y:{sre_ts:Fs}}}),lr("ENRICHED",ar.COMPILED+10);class fE extends Yn{visitTree(t,e){this.mactionId=0;const s=super.visitTree(t);return this.mactionId&&(e.inputData.hasMaction=!0),s}visitHtmlNode(t,e){return t.getSerializedXML()}visitMactionNode(t,e){const[s,i]=0===t.childNodes.length?["",""]:["\n",e],r=this.childNodeMml(t,e+" ",s);let n=this.getAttributes(t);if("toggle"===t.attributes.get("actiontype")){const e=++this.mactionId;t.setProperty("mactionId",e),n=` data-maction-id="${e}" selection="${t.attributes.get("selection")}"`+n.replace(/ selection="\d+"/,"").replace(/ data-maction-id="\d+"/,"")}return`${e}`+(r.match(/\S/)?s+r+i:"")+""}}function gE(t,e,s){return class extends t{constructor(){super(...arguments),this.toMathML=s}serializeMml(t){if("outerHTML"in t)return t.outerHTML;if("undefined"!=typeof Element&&"undefined"!=typeof window&&t instanceof Element){const e=window.document.createElement("div");return e.appendChild(t),e.innerHTML}return t.toString()}enrich(t,s=!1){if(!(this.state()>=ar.ENRICHED)){if(!this.isEscaped&&(t.options.enableEnrichment||s)){const s=new t.options.MathItem("",e);try{let e;e=this.inputData.originalMml?this.adjustSelections():this.inputData.originalMml=this.toMathML(this.root,this);const i=Fb(e);this.inputData.enrichedMml=s.math=this.serializeMml(i),s.math=s.math.replace(/ role="treeitem"/g,' data-speech-node="true"').replace(/ aria-level/g," data-semantic-level-number").replace(/ aria-(?:posinset|owns|setsize)=".*?"/g,""),s.display=this.display,s.compile(t),this.root=s.root}catch(e){t.options.enrichError(t,this,e)}}this.state(ar.ENRICHED)}}toEnriched(t){return this.serializeMml(Fb(t))}unEnrich(t){const s=this.inputData.originalMml;if(!s)return;const i=new t.options.MathItem("",e);i.math=s,i.display=this.display,i.compile(t),this.root=i.root}adjustSelections(){const t=this.inputData.originalMml;if(!this.inputData.hasMaction)return t;const e=[];return this.root.walkTree(t=>{t.isKind("maction")&&(e[t.attributes.get("data-maction-id")]=t)}),t.replace(/(data-maction-id="(\d+)" selection=)"\d+"/g,(t,s,i)=>`${s}"${e[i].attributes.get("selection")}"`)}}}function bE(t,e){var s;return(s=class extends t{constructor(...t){super(...t),e.setMmlFactory(this.mmlFactory);const s=this.constructor.ProcessBits;s.has("enriched")||s.allocate("enriched");const i=new fE(this.mmlFactory);this.options.MathItem=gE(this.options.MathItem,e,(t,e)=>i.visitTree(t,e))}enrich(){if(!this.processed.isSet("enriched")){if(this.options.enableEnrichment){Pb(this.options.sre);for(const t of this.math)t.enrich(this)}this.processed.set("enriched")}return this}enrichError(t,e,s){console.warn("Enrichment error:",s)}state(t,e=!1){if(super.state(t,e),t=ar.COMPILED))for(const t of this.math)t.unEnrich(this);return this}}).OPTIONS=Object.assign(Object.assign({},t.OPTIONS),{enableEnrichment:!0,enrichError:(t,e,s)=>t.enrichError(t,e,s),renderActions:wi(Object.assign(Object.assign({},t.OPTIONS.renderActions),{enrich:[ar.ENRICHED]})),sre:wi({speech:"none",locale:"en",domain:"clearspeak",style:"default",braille:"nemeth",structure:!0,aria:!0})}),s}function EE(t,e){return e.setAdaptor(t.adaptor),t.documentClass=bE(t.documentClass,e),t}MathJax.loader&&MathJax.loader.checkVersion("a11y/semantic-enrich",ri,"a11y"),hi({_:{a11y:{"semantic-enrich":Vs}}}),MathJax.startup&&MathJax.startup.extendHandler(t=>EE(t,new Rc({allowHtmlInTokenNodes:!0})));const xE=["pitch","rate","volume"];function yE(t){const e=jb(t),s=[],i=[];return NE(Array.from(e.childNodes),s,i),[i.join(" "),s]}function NE(t,e,s,i={}){for(const r of t){if(3===r.nodeType){const t=r.textContent.trim();t&&(s.push(t),e.push(Object.assign({text:t},i)));continue}if(1===r.nodeType){const t=r,n=t.tagName;if("speak"===n)continue;if("prosody"===n){NE(Array.from(r.childNodes),e,s,TE(t,i));continue}switch(n){case"break":e.push({pause:t.getAttribute("time")});break;case"mark":e.push({mark:t.getAttribute("name")});break;case"say-as":{const r=t.textContent;e.push(Object.assign({text:r,character:!0},i)),s.push(r);break}}}}}const vE={pitch:(t,e)=>t/100*1,volume:(t,e)=>t/100*.5,rate:(t,e)=>t/100*1};function TE(t,e){const s={};for(const i of xE)if(t.hasAttribute(i)){const[r,n]=AE(t.getAttribute(i));if(!r){s[i]="volume"===i?.5:1;continue}let o=e[i];o=o||("volume"===i?.5:1);const a=vE[i](parseInt(n,10),r);s[i]="-"===r?o-a:o+a}return s}const CE=/([+-]?)([0-9]+)%/;function AE(t){const e=t.match(CE);return e?[e[1],e[2]]:(console.warn("Something went wrong with the prosody matching."),["","100"])}function LE(t,e,s,i=" "){if(!t)return"";const r=[t];return e&&r.unshift(e),s&&r.push(s),r.join(i)}function SE(t,e="en",s="100"){return yE(`${t}`)}function RE(){const t=new AudioContext,e=t.createOscillator();e.frequency.value=300,e.connect(t.destination),e.start(t.currentTime),e.stop(t.currentTime+.05)}var ME,IE;!function(t){t[t.NONE=0]="NONE",t[t.DEPTH=1]="DEPTH",t[t.SUMMARY=2]="SUMMARY"}(ME||(ME={})),function(t){t.SPEECH="data-semantic-speech-none",t.SPEECH_SSML="data-semantic-speech",t.SUMMARY="data-semantic-summary-none",t.SUMMARY_SSML="data-semantic-summary",t.PREFIX="data-semantic-prefix-none",t.PREFIX_SSML="data-semantic-prefix",t.POSTFIX="data-semantic-postfix-none",t.POSTFIX_SSML="data-semantic-postfix",t.BRAILLE="data-semantic-braille"}(IE||(IE={}));class wE{constructor(){this.promise=Promise.resolve(),this.adaptor=null,this._options={},this._init=!1}set element(t){this._element=t}get element(){return this._element}set options(t){this._options=Object.assign({},(null==t?void 0:t.sre)||{},{enableSpeech:t.enableSpeech,enableBraille:t.enableBraille}),delete this._options.custom}get options(){return this._options}init(t,e,s){this.options=t,this._init||(this.adaptor=e,this.webworker=s,this._init=!0)}update(t){Object.assign(this.options,t)}Speech(t){const e=t.outputData.mml,s=Object.assign({},this.options,{modality:"speech"});return this.promise=this.webworker.Speech(e,s,t)}SpeechFor(t,e){const s=Object.assign({},this.options,{modality:"speech"});return this.webworker.speechFor(e,s,t)}cancel(t){var e;null===(e=this.webworker)||void 0===e||e.Cancel(t)}updateRegions(t,e,s){e.Update(this.getLabel(t)),s.Update(this.getBraille(t))}getOptions(t){var e,s,i,r;return{locale:null!==(e=this.adaptor.getAttribute(t,"data-semantic-locale"))&&void 0!==e?e:"",domain:null!==(s=this.adaptor.getAttribute(t,"data-semantic-domain"))&&void 0!==s?s:"",style:null!==(i=this.adaptor.getAttribute(t,"data-semantic-style"))&&void 0!==i?i:"",domain2style:null!==(r=this.adaptor.getAttribute(t,"data-semantic-domain2style"))&&void 0!==r?r:""}}nextRules(t){const e=this.getOptions(t.typesetRoot);return this.update(e),this.promise=this.webworker.nextRules(t.outputData.mml,Object.assign({},this.options,{modality:"speech"}),t)}nextStyle(t,e){const s=this.getOptions(e.typesetRoot);return this.update(s),this.promise=this.webworker.nextStyle(e.outputData.mml,Object.assign({},this.options,{modality:"speech"}),this.adaptor.getAttribute(t,"data-semantic-id"),e)}getLabel(t,e="",s=" "){const i=this.adaptor;return LE(i.getAttribute(t,IE.SPEECH_SSML),i.getAttribute(t,IE.PREFIX_SSML),i.getAttribute(t,IE.POSTFIX_SSML),s)||i.getAttribute(t,"aria-label")}getBraille(t){const e=this.adaptor;return e.getAttribute(t,"aria-braillelabel")||e.getAttribute(t,IE.BRAILLE)}getLocalePreferences(t){return this.promise=this.webworker.clearspeakLocalePreferences(this.options,t)}getRelevantPreferences(t,e,s,i){const r=t.outputData.mml;return this.promise=this.webworker.clearspeakRelevantPreferences(r,e,s,i)}}var kE=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};class OE{constructor(t,e,s,i){this.cmd=t,this.item=e,this.resolve=s,this.reject=i}}class DE{constructor(t,e){this.adaptor=t,this.options=e,this.ready=!1,this.tasks=[],this.Commands={Ready(t,e){t.ready=!0,t.postNext()},Finished(t,e){const s=t.tasks.shift();e.success?s.resolve(e.result):s.reject(e.error),t.postNext()},Log(t,e){t.options.debug&&console.log("Log:",e)}}}Start(){return kE(this,void 0,void 0,function*(){if(this.ready)throw Error("Worker already started");this.worker=yield this.adaptor.createWorker(this.Listener.bind(this),this.options)})}debug(t,...e){this.options.debug&&console.info(t,...e)}Listener(t){this.debug("Worker >>> Client:",t.data),Object.hasOwn(this.Commands,t.data.cmd)?this.Commands[t.data.cmd](this,t.data.data):this.debug("Invalid command from worker: "+t.data.cmd)}Post(t,e){const s=new Promise((s,i)=>{this.tasks.push(new OE(t,e,s,i))});return this.ready&&1===this.tasks.length&&this.postNext(),s}postNext(){if(this.tasks.length){const t=Object.assign({},this.tasks[0].cmd,{debug:this.options.debug});this.worker.postMessage(t)}}Cancel(t){const e=this.tasks.findIndex(e=>e.item===t);e>0&&(this.tasks[e].reject(`Task ${this.tasks[e].cmd.cmd} cancelled`),this.tasks.splice(e,1))}Setup(t){return this.Post({cmd:"setup",data:{domain:t.domain,style:t.style,locale:t.locale,modality:t.modality}})}Speech(t,e,s){return kE(this,void 0,void 0,function*(){this.Attach(s,e.enableSpeech,e.enableBraille,yield this.Post({cmd:"speech",data:{mml:t,options:e}},s))})}nextRules(t,e,s){return kE(this,void 0,void 0,function*(){this.Attach(s,e.enableSpeech,e.enableBraille,yield this.Post({cmd:"nextRules",data:{mml:t,options:e}},s))})}nextStyle(t,e,s,i){return kE(this,void 0,void 0,function*(){this.Attach(i,e.enableSpeech,e.enableBraille,yield this.Post({cmd:"nextStyle",data:{mml:t,options:e,nodeId:s}},i))})}speechFor(t,e,s){return kE(this,void 0,void 0,function*(){const i=yield this.Post({cmd:"speech",data:{mml:t,options:e}},s);return JSON.parse(i)})}Attach(t,e,s,i){const r=JSON.parse(i),n=t.typesetRoot;if(!n)return;this.setSpecialAttributes(n,r.options,"data-semantic-",["locale","domain","style","domain2style"]);const o=this.adaptor;this.setSpecialAttributes(n,r.translations,"data-semantic-");for(const[t,e]of Object.entries(r.mactions)){let s=o.getElement("#"+t,n);s&&o.childNodes(s)[0]&&(s=o.childNodes(s)[0],"rect"===o.kind(s)&&(s=o.next(s)),o.setAttribute(s,"data-semantic-type","dummy"),this.setSpecialAttributes(s,e,""))}for(const t of o.childNodes(n))"mjx-math"!==o.kind(t)&&"svg"!==o.kind(t)||this.setSpeechAttributes(t,"",r,e,s);e&&(r.label&&(o.setAttribute(n,IE.SPEECH,r.label),o.setAttribute(n,IE.SPEECH_SSML,r.ssml),t.outputData.speech=r.label),o.setAttribute(n,"data-speech-attached","true")),s&&(r.braillelabel&&(o.setAttribute(n,IE.BRAILLE,r.braillelabel),t.outputData.braille=r.braillelabel),r.braille&&o.setAttribute(n,"data-braille-attached","true"))}setSpeechAttribute(t,e,s,i){var r,n;const o=this.adaptor,a=o.getAttribute(t,"data-semantic-id");if(o.removeAttribute(t,"data-speech-node"),s&&e.speech[a]["speech-none"]){o.setAttribute(t,"data-speech-node","true");for(let[s,i]of Object.entries(e.speech[a]))s=s.replace(/-ssml$/,""),i&&o.setAttribute(t,`data-semantic-${s}`,i)}if(i&&(null===(n=null===(r=e.braille)||void 0===r?void 0:r[a])||void 0===n?void 0:n["braille-none"])){o.setAttribute(t,"data-speech-node","true");const s=e.braille[a]["braille-none"];o.setAttribute(t,IE.BRAILLE,s)}}setSpeechAttributes(t,e,s,i,r){const n=this.adaptor;if(!t||"#text"===n.kind(t)||"#comment"===n.kind(t))return e;n.hasAttribute(t,"data-semantic-id")&&(this.setSpeechAttribute(t,s,i,r),e||n.hasAttribute(t,"data-semantic-parent")||(e=n.getAttribute(t,"data-semantic-id")));for(const o of Array.from(n.childNodes(t)))e=this.setSpeechAttributes(o,e,s,i,r);return e}setSpecialAttributes(t,e,s,i){if(e){i=i||Object.keys(e);for(const r of i){const i=e[r];i&&this.adaptor.setAttribute(t,`${s}${r.toLowerCase()}`,i)}}}Detach(t){const e=t.typesetRoot;this.adaptor.removeAttribute(e,"data-speech-attached"),this.adaptor.removeAttribute(e,"data-braille-attached"),this.detachSpeech(e)}detachSpeech(t){const e=this.adaptor,s=e.childNodes(t);if(s){if("#text"!==e.kind(t))for(const s of["none","summary-none","speech","speech-none","summary","braille"])e.removeAttribute(t,`data-semantic-${s}`);for(const t of s)this.detachSpeech(t)}}Terminate(){this.debug("Terminating pending tasks");for(const t of this.tasks)t.reject(`${t.cmd.data.cmd} cancelled by WorkerHandler termination`);return this.tasks=[],this.debug("Terminating worker"),this.worker.terminate()}Stop(){return kE(this,void 0,void 0,function*(){if(!this.worker)throw Error("Worker has not been started");yield this.Terminate(),this.worker=null,this.ready=!1})}clearspeakLocalePreferences(t,e){return kE(this,void 0,void 0,function*(){yield this.Post({cmd:"localePreferences",data:{options:t}}).then(s=>{e.set(t.locale,JSON.parse(s))})})}clearspeakRelevantPreferences(t,e,s,i){return kE(this,void 0,void 0,function*(){yield this.Post({cmd:"relevantPreferences",data:{mml:t,id:e}}).then(t=>{s.set(i,t)})})}}const PE=di.config||{},BE=()=>(PE?.loader?.paths?.mathjax||PE?.__dirname||"/")+"/sre";var FE=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};function jE(t){return class extends t{constructor(){super(...arguments),this.generatorPool=new wE}attachSpeech(t){if(this.outputData.speechPromise=null,this.state()>=ar.ATTACHSPEECH)return;if(this.state(ar.ATTACHSPEECH),this.isEscaped||!t.options.enableSpeech&&!t.options.enableBraille||!t.options.enableEnrichment)return;t.getWebworker(),this.generatorPool.init(t.options,t.adaptor,t.webworker),this.outputData.mml=this.toMathML(this.root,this);const e=this.generatorPool.Speech(this).catch(e=>t.options.speechError(t,this,e));t.savePromise(e),this.outputData.speechPromise=e}detachSpeech(t){t.webworker.Detach(this)}speechFor(t){return FE(this,void 0,void 0,function*(){t=this.toEnriched(t);const e=yield this.generatorPool.SpeechFor(this,t);return[e.label,e.braillelabel]})}clear(){this.generatorPool.cancel(this)}}}function _E(t){var e;return e=class extends t{constructor(...t){super(...t),this.webworker=null;const e=this.constructor.ProcessBits;e.has("attach-speech")||e.allocate("attach-speech"),this.options.MathItem=jE(this.options.MathItem)}getWebworker(){this.webworker||(this.webworker=new DE(this.adaptor,this.options.worker),this.webworker.Start())}attachSpeech(){if(!this.processed.isSet("attach-speech")){const t=this.options;if(t.enableEnrichment&&(t.enableSpeech||t.enableBraille)){this.getWebworker();for(const t of this.math)t.attachSpeech(this)}this.processed.set("attach-speech")}return this}speechError(t,e,s){console.warn("Speech generation error:",s)}state(t,e=!1){if(super.state(t,e),t=ar.TYPESET))for(const t of this.math)t.detachSpeech(this);return this}done(){const t=Object.create(null,{done:{get:()=>super.done}});return FE(this,void 0,void 0,function*(){var e;return yield null===(e=this.webworker)||void 0===e?void 0:e.Stop(),t.done.call(this)})}},e.OPTIONS=Object.assign(Object.assign({},t.OPTIONS),{enableSpeech:!0,enableBraille:!0,speechError:(t,e,s)=>t.speechError(t,e,s),renderActions:wi(Object.assign(Object.assign({},t.OPTIONS.renderActions),{attachSpeech:[ar.ATTACHSPEECH]})),worker:{path:BE(),maps:BE().replace(/[cm]js\/a11y\/sre$/,"bundle/sre/mathmaps"),worker:"speech-worker.js",debug:!1},a11y:wi({speech:!0,braille:!0})}),e}function UE(t,e){return!t.documentClass.prototype.enrich&&e&&(t=EE(t,e)),t.documentClass=_E(t.documentClass),t}if(lr("ATTACHSPEECH",ar.INSERTED+10),MathJax.loader&&MathJax.loader.checkVersion("a11y/speech",ri,"a11y"),hi({_:{a11y:{speech_ts:Ks,speech:{GeneratorPool:Gs,SpeechUtil:Xs,WebWorker:Js}}}}),MathJax.loader){let t=fi.resolvePath("[sre]",!1),e=fi.resolvePath("[mathmaps]",!1);if(pi.window)t=new URL(t,location).href,e=new URL(e,location).href;else{const s="undefined"!=typeof require?require:MathJax.config.loader.require;s?.resolve?(t=pi.path(s.resolve(`${t}/require.mjs`)).replace(/\/[^\/]*$/,""),e=pi.path(s.resolve(`${e}/base.json`)).replace(/\/[^\/]*$/,"")):t=e=""}t&&ci(MathJax.config,"options",{worker:{path:t,maps:e}})}MathJax.startup&&MathJax.startup.extendHandler(t=>UE(t));class HE{constructor(t){this.document=t,this.CLASS=this.constructor,this.AddStyles()}static get sheetId(){return"MJX-"+this.name+"-styles"}static get styleSheet(){return document.head.querySelector("#"+this.sheetId)}AddStyles(){const t=this.CLASS.sheetId;if(!this.CLASS.style||this.document.adaptor.head().querySelector("#"+t))return;const e=this.document.adaptor.node("style",{id:t});e.innerHTML=this.CLASS.style.cssText,this.document.adaptor.head().appendChild(e)}AddElement(){if(this.div)return;const t=this.document.adaptor.node("div");t.classList.add(this.CLASS.className),this.div=t,this.inner=this.document.adaptor.node("div"),this.div.appendChild(this.inner),this.document.adaptor.body(this.document.adaptor.document).appendChild(this.div)}Show(t){this.AddElement(),this.position(t),this.div.classList.add(this.CLASS.className+"_Show")}Hide(){this.div&&(this.div.remove(),this.div=null,this.inner=null)}stackRegions(t){const e=t.getBoundingClientRect();let s=0,i=Number.POSITIVE_INFINITY;const r=this.document.adaptor.document.getElementsByClassName(this.CLASS.className+"_Show");for(let t,e=0;t=r[e];e++)t!==this.div&&(s=Math.max(t.getBoundingClientRect().bottom,s),i=Math.min(t.getBoundingClientRect().left,i));const n=(s||e.bottom+10)+window.scrollY,o=(i div`]:{"border-radius":"inherit",padding:"0 2px"},"@media (prefers-color-scheme: dark)":{["."+qE.className]:{"background-color":"#222025","box-shadow":"0px 5px 20px #000",border:"1px solid #7C7C7C"}}});class VE extends zE{static setColor(t,e,s,i){const r=this.styleSheet;if(r){const n=r.sheet.cssRules[0].style,o=`--mjx-${t}${e}-color`,a=`rgba(var(--mjx-${t}-${s}), ${1===i?1:`var(--mjx-${t}${e}-alpha)`})`;n.getPropertyValue(o)!==a&&n.setProperty(o,a);const l=`--mjx-${t}${e}-alpha`;n.getPropertyValue(l)!==String(i)&&(n.setProperty(l,i),r.sheet.cssRules[1].cssRules[0].style.setProperty(l,Math.pow(i,.7071)))}}}VE.className="MJX_LiveRegion",VE.priority={primary:1,secondary:2},VE.style=new ao({":root":{"--mjx-fg-red":"255, 0, 0","--mjx-fg-green":"0, 255, 0","--mjx-fg-blue":"0, 0, 255","--mjx-fg-yellow":"255, 255, 0","--mjx-fg-cyan":"0, 255, 255","--mjx-fg-magenta":"255, 0, 255","--mjx-fg-white":"255, 255, 255","--mjx-fg-black":"0, 0, 0","--mjx-bg-red":"255, 0, 0","--mjx-bg-green":"0, 255, 0","--mjx-bg-blue":"0, 0, 255","--mjx-bg-yellow":"255, 255, 0","--mjx-bg-cyan":"0, 255, 255","--mjx-bg-magenta":"255, 0, 255","--mjx-bg-white":"255, 255, 255","--mjx-bg-black":"0, 0, 0","--mjx-live-bg-color":"white","--mjx-live-shadow-color":"#888","--mjx-live-border-color":"#CCCCCC","--mjx-bg1-color":"rgba(var(--mjx-bg-blue), var(--mjx-bg1-alpha))","--mjx-fg1-color":"rgba(var(--mjx-fg-black), 1)","--mjx-bg2-color":"rgba(var(--mjx-bg-red), 1)","--mjx-fg2-color":"rgba(var(--mjx-fg-black), 1)","--mjx-bg1-alpha":.2,"--mjx-fg1-alpha":1,"--mjx-bg2-alpha":1,"--mjx-fg2-alpha":1},"@media (prefers-color-scheme: dark)":{":root":{"--mjx-bg-blue":"132, 132, 255","--mjx-bg-white":"0, 0, 0","--mjx-bg-black":"255, 255, 255","--mjx-fg-white":"0, 0, 0","--mjx-fg-black":"255, 255, 255","--mjx-live-bg-color":"#222025","--mjx-live-shadow-color":"black","--mjx-live-border-color":"#7C7C7C","--mjx-bg1-alpha":.3,"--mjx-fg1-alpha":1,"--mjx-bg2-alpha":1,"--mjx-fg2-alpha":1}},[`.${VE.className}`]:{position:"absolute",top:0,display:"none",width:"auto",height:"auto",padding:0,opacity:1,"z-index":"202",left:0,right:0,margin:"0 auto","background-color":"var(--mjx-live-bg-color)","box-shadow":"0px 5px 20px var(--mjx-live-shadow-color)",border:"2px solid var(--mjx-live-border-color)"},[`.${VE.className}_Show`]:{display:"block"},[`.${VE.className} > div`]:{color:"var(--mjx-fg1-color)","background-color":"var(--mjx-bg1-color)"},"mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect)":{color:"var(--mjx-fg1-color) ! important",fill:"var(--mjx-fg1-color) ! important"},[["mjx-container:not([data-mjx-clone-container])","[data-sre-highlight-1]:not([data-sre-enclosed], rect)"].join(" ")]:{"background-color":"var(--mjx-bg1-color) ! important"},"mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed])":{fill:"var(--mjx-bg1-color) ! important"},"mjx-container [data-sre-highlight-2]":{color:"var(--mjx-fg2-color) ! important","background-color":"var(--mjx-bg2-color) ! important",fill:"var(--mjx-fg2-color) ! important"},"mjx-container rect[data-sre-highlight-2]":{fill:"var(--mjx-bg2-color) ! important"}});class XE extends VE{constructor(){super(...arguments),this.active=!1,this.node=null,this.clear=!1,this.voiceRequest=!1,this.voiceCancelled=!1}Show(t){super.Update("\xa0"),this.node=t,super.Show(t)}Update(t){if(this.voiceRequest)return void this.makeVoice(t);speechSynthesis.onvoiceschanged=(()=>this.voiceRequest=!0).bind(this);new Promise(t=>{setTimeout(()=>{this.voiceRequest?t(!0):setTimeout(()=>{this.voiceRequest=!0,t(!0)},100)},100)}).then(()=>this.makeVoice(t))}makeVoice(t){this.active=this.document.options.a11y.voicing&&!!speechSynthesis.getVoices().length,speechSynthesis.cancel(),this.clear=!0;const[e,s]=SE(t,this.document.options.sre.locale,this.document.options.sre.rate);super.Update(e),this.active&&e&&this.makeUtterances(s,this.document.options.sre.locale)}makeUtterances(t,e){this.voiceCancelled=!1;let s=null;for(const i of t)if(i.mark){if(!s){this.highlightNode(i.mark,!0);continue}s.addEventListener("end",t=>{this.voiceCancelled||this.highlightNode(i.mark)})}else{if(i.pause){const t=parseInt(i.pause.match(/^[0-9]+/)[0]);if(isNaN(t)||!s)continue;s.addEventListener("end",e=>{speechSynthesis.pause(),setTimeout(()=>{speechSynthesis.resume()},t)});continue}s=new SpeechSynthesisUtterance(i.text),i.rate&&(s.rate=i.rate),i.pitch&&(s.pitch=i.pitch),s.lang=e,speechSynthesis.speak(s)}s&&s.addEventListener("end",t=>{this.highlighter.unhighlight()})}Hide(){this.cancelVoice(),super.Hide()}cancelVoice(){this.voiceCancelled=!0,speechSynthesis.cancel(),this.highlighter.unhighlight()}highlightNode(t,e=!1){this.highlighter.unhighlight();const s=Array.from(this.node.querySelectorAll(`[data-semantic-id="${t}"]`));this.clear&&!e||this.highlighter.highlight(s),this.clear=!1}}XE.style=null;class GE extends HE{position(t){const e=t.getBoundingClientRect(),s=this.div.getBoundingClientRect();let i,r=e.left+e.width/2-s.width/2;switch(r=r<0?0:r,r+=window.scrollX,this.document.options.a11y.align){case"top":i=e.top-s.height-10;break;case"bottom":i=e.bottom+10;break;default:i=e.top+e.height/2-s.height/2}i+=window.scrollY,i=i<0?0:i,this.div.style.top=i+"px",this.div.style.left=r+"px"}Show(t){this.AddElement(),this.div.style.fontSize=this.document.options.a11y.magnify,this.Update(t),super.Show(t)}Clear(){this.div&&(this.inner.textContent="",this.inner.style.top="",this.inner.style.backgroundColor="")}Update(t){if(!this.div)return;this.Clear();const e=this.cloneNode(t),s=e.querySelector("[data-mjx-clone]");this.inner.style.backgroundColor=t.style.backgroundColor,s.style.backgroundColor="",s.classList.remove("mjx-selected"),this.inner.appendChild(e),this.position(t)}cloneNode(t){let e=t.cloneNode(!0);if(e.setAttribute("data-mjx-clone","true"),"MJX-CONTAINER"!==e.nodeName){"g"!==e.nodeName&&(e.style.marginLeft=e.style.marginRight="0");const s=t.closest("mjx-container");if("MJX-MATH"!==e.nodeName&&"svg"!==e.nodeName){let i=s.firstChild;"MJX-BBOX"===i.nodeName&&(i=i.nextSibling),e=i.cloneNode(!1).appendChild(e).parentElement;const r=Array.from(s.querySelectorAll("[data-sre-enclosed]"));"svg"===i.nodeName?this.svgClone(t,r,e,s):this.chtmlClone(t,r,e)}e=s.cloneNode(!1).appendChild(e).parentElement,e.style.margin="0",e.style.minWidth=""}return e.setAttribute("data-mjx-clone-container","true"),e}chtmlClone(t,e,s){for(const i of e)if(i!==t){const t=i.getAttribute("data-semantic-id");t&&s.querySelector(`[data-semantic-id="${t}"]`)||s.appendChild(i.cloneNode(!0))}}svgClone(t,e,s,i){var r;let{x:n,y:o,width:a,height:l}=t.getBBox();if(e.length){s.firstChild.remove();const r=i.querySelector("g").cloneNode(!1);for(const s of e){const e=r.appendChild(s.cloneNode(!0));s===t&&e.setAttribute("data-mjx-clone","true");const[i,n]=this.xy(s);e.setAttribute("transform",`translate(${i}, ${n})`)}s.appendChild(r);const c=t.previousSibling,h=c.getBBox();a=h.width,l=h.height;const[d,u]=this.xy(c);n=d,o=u+h.y}const c=i.querySelector("g");if("full"===i.getAttribute("width")&&c.firstChild.lastChild===t)return s.innerHTML="",s.appendChild(i.cloneNode(!0).firstChild),s.querySelector(".mjx-selected").setAttribute("data-mjx-clone","true"),void(null===(r=s.querySelector("[data-sre-highlighter-added]"))||void 0===r||r.remove());s.firstChild.setAttribute("transform","scale(1, -1)");const h=parseFloat((s.getAttribute("viewBox")||s.getAttribute("data-mjx-viewBox")).split(/ /)[2]),d=parseFloat(s.style.minWidth||s.getAttribute("width"));s.setAttribute("viewBox",[n,-(o+l),a,l].join(" ")),s.removeAttribute("style"),s.setAttribute("width",d/h*a+"ex"),s.setAttribute("height",d/h*l+"ex")}xy(t){const e=DOMPoint.fromPoint({x:0,y:0}).matrixTransform(t.getCTM().inverse());return[-e.x,-e.y]}}GE.className="MJX_HoverRegion",GE.style=new ao({[`.${GE.className}`]:{display:"block",position:"absolute",width:"max-content",height:"auto",padding:0,opacity:1,"z-index":"202",margin:"0 auto","background-color":"white","line-height":0,"box-shadow":"0px 10px 20px #888",border:"2px solid #CCCCCC"},[`.${GE.className} > div`]:{overflow:"hidden",color:"var(--mjx-fg1-color)","background-color":"var(--mjx-bg1-color)"},"@media (prefers-color-scheme: dark)":{["."+GE.className]:{"background-color":"#222025","box-shadow":"0px 5px 20px #000",border:"1px solid #7C7C7C"}},"mjx-container[data-mjx-clone-container]":{padding:"2px ! important"},"mjx-math > mjx-mlabeledtr":{display:"inline-block","margin-right":".5em ! important"},"mjx-math > mjx-mtd":{float:"right"}});class JE{get highlighter(){return this.pool.highlighter}static stopEvent(t){t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopImmediatePropagation?t.stopImmediatePropagation():t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}static create(t,e,s,i,...r){return new this(t,e,s,i,...r)}constructor(t,e,s,i,...r){this.document=t,this.pool=e,this.region=s,this.node=i,this.stoppable=!0,this.events=[],this._active=!1}Events(){return this.events}get active(){return this._active}set active(t){this._active=t}Attach(){this.AddEvents()}Detach(){this.RemoveEvents()}Start(){this.active=!0}Stop(){this.active&&(this.region.Clear(),this.region.Hide(),this.active=!1)}AddEvents(){for(const[t,e]of this.events)this.node.addEventListener(t,e)}RemoveEvents(){for(const[t,e]of this.events)this.node.removeEventListener(t,e)}Update(t=!1){}stopEvent(t){this.stoppable&&JE.stopEvent(t)}}var KE=function(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{l(i.next(t))}catch(t){n(t)}}function a(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}l((i=i.apply(t,e||[])).next())})};const $E="Windows"===pi.os,YE=Array(40).fill("\u2800").join(""),QE="[data-speech-node]";function ZE(t){return t.matches("mjx-container")}function tx(t,e=!0){return t.shiftKey&&e||t.metaKey||t.altKey||t.ctrlKey}class ex extends JE{static helpMessage(t,e,s){return`\n

Exploring expressions ${t}

\n\n

The mathematics on this page is being rendered by MathJax, which\n generates both the text spoken by screen readers, as well as the\n visual layout for sighted users.

\n\n

Expressions typeset by MathJax can be explored interactively, and\n are focusable. You can use the Tab key to move to a typeset\n expression${e}. Initially, the expression will be read in full,\n but you can use the following keys to explore the expression\n further:

\n\n
    \n\n
  • Down Arrow moves one level deeper into the\n expression to allow you to explore the current subexpression term by\n term.
  • \n\n
  • Up Arrow moves back up a level within the\n expression.
  • \n\n
  • Right Arrow moves to the next term in the\n current subexpression.
  • \n\n
  • Left Arrow moves to the next term in the\n current subexpression.
  • \n\n
  • Shift+Arrow moves to a\n neighboring cell within a table.
  • \n\n
  • 0-9+0-9 jumps to a cell\n by its index in the table, where 0 = 10.
  • \n\n
  • Home takes you to the top of the\n expression.
  • \n\n
  • Enter or Return clicks a\n link or activates an active subexpression.
  • \n\n
  • Space opens the MathJax contextual menu\n where you can view or copy the source format of the expression, or\n modify MathJax's settings.
  • \n\n
  • Escape exits the expression\n explorer.
  • \n\n
  • x gives a summary of the current\n subexpression.
  • \n\n
  • z gives the full text of a collapsed\n expression.
  • \n\n
  • d gives the current depth within the\n expression.
  • \n\n
  • s starts or stops auto-voicing with\n synchronized highlighting.
  • \n\n
  • v marks the current position in the\n expression.
  • \n\n
  • p cycles through the marked positions in\n the expression.
  • \n\n
  • u clears all marked positions and returns\n to the starting position.
  • \n\n
  • > cycles through the available speech\n rule sets (MathSpeak, ClearSpeak).
  • \n\n
  • < cycles through the verbosity levels\n for the current rule set.
  • \n\n
  • b toggles whether Braille notation is combined\n with speech text for tactile Braille devices, as discussed\n below.\n\n
  • h produces this help listing.
  • \n
\n\n

The MathJax contextual menu allows you to enable or disable speech\n or Braille generation for mathematical expressions, the language to\n use for the spoken mathematics, and other features of MathJax. In\n particular, the Explorer submenu allows you to specify how the\n mathematics should be identified in the page (e.g., by saying "math"\n when the expression is spoken), and whether or not to include a\n message about the letter "h" bringing up this dialog box. Turning off\n speech and Braille will disable the expression explorer, its\n highlighting, and its help icon.

\n\n

Support for tactile Braille devices varies across screen readers,\n browsers, and operative systems. If you are using a Braille output\n device, you may need to select the "Combine with Speech" option in the\n contextual menu's Braille submenu in order to obtain Nemeth or Euro\n Braille output rather than the speech text on your Braille\n device. ${s}

\n\n

The contextual menu also provides options for viewing or copying a\n MathML version of the expression or its original source format,\n creating an SVG version of the expression, and viewing various other\n information.

\n\n

Finally, selecting the "Insert Hidden MathML" item from the options\n submenu will turn of MathJax's speech and Braille generation and\n instead use visually hidden MathML that some screen readers can voice,\n though support for this is not universal across all screen readers and\n operating systems. Selecting speech or Braille generation in their\n submenus will remove the hidden MathML again.

\n\n

For more help, see the MathJax accessibility documentation.

\n `}get generators(){var t;return null===(t=this.item)||void 0===t?void 0:t.generatorPool}get role(){return this.item.ariaRole}get description(){return this.item.roleDescription}get none(){return this.document.options.a11y.brailleSpeech?this.item.brailleNone:this.item.none}get brailleNone(){return this.item.brailleNone}FocusIn(t){t.target.closest("mjx-html")||(this.item.outputData.nofocus?this.item.outputData.nofocus=!1:(this.clicked||(this.Start(),this.backTab=t.target===this.img),this.clicked=null))}FocusOut(t){this.current&&!this.focusSpeech&&(this.document.options.keepRegions||(this.setCurrent(null),this.Stop()),document.hasFocus()||this.focusTop())}KeyDown(t){if(this.pendingIndex.shift(),this.region.cancelVoice(),tx(t,!1))return;const e=this.constructor,s=1===t.key.length?t.key.toLowerCase():t.key,[i,r]=e.keyMap.get(s)||[],n=i?void 0===r||this.active?i(this,t):r:this.undefinedKey(t);n||(this.stopEvent(t),!1===n&&this.sound&&this.NoMove())}MouseDown(t){var e;if(this.pendingIndex=[],this.region.cancelVoice(),tx(t)||2===t.buttons)return void(this.item.outputData.nofocus=!0);const s=this.findClicked(t.target,t.x,t.y);s!==this.document.infoIcon?(null===(e=document.getSelection())||void 0===e||e.removeAllRanges(),t.target.getAttribute("sre-highlighter-added")?this.refocus=s:this.clicked=s):this.stopEvent(t)}Click(t){if(tx(t)||2===t.buttons||"Range"===document.getSelection().type)return void this.FocusOut(null);const e=this.findClicked(t.target,t.x,t.y);if(e===this.document.infoIcon)return this.stopEvent(t),void this.help();this.clicked||e&&!this.node.contains(e)||(this.refocus=e,this.triggerLinkMouse()||this.Start())}DblClick(t){var e;const s=null!==(e=document.getSelection().direction)&&void 0!==e?e:"none";tx(t)||2===t.buttons||"none"!==s?this.FocusOut(null):(this.refocus=this.rootNode(),this.Start())}spaceKey(){return this.refocus=this.current,!0}hKey(){if(!this.document.options.enableExplorerHelp)return!0;this.refocus=this.current,this.help()}escapeKey(t){return t.target.closest("mjx-html")?(this.refocus=t.target.closest(QE),this.Start()):(this.Stop(),this.focusTop(),this.setCurrent(null)),!0}tabKey(t){var e;const s=null!==(e=this.current)&&void 0!==e?e:this.node.contains(document.activeElement)?document.activeElement:null;if(0===this.tabs.length||!s)return!0;if(this.backTab)return!t.shiftKey||void this.tabTo(this.tabs[this.tabs.length-1]);const[i,r,n]=t.shiftKey?[this.tabs.slice(0).reverse(),Node.DOCUMENT_POSITION_PRECEDING,this.current&&this.isLink()?this.getAnchor():s]:[this.tabs,Node.DOCUMENT_POSITION_FOLLOWING,s];for(const t of i)if(n.compareDocumentPosition(t)&r)return void this.tabTo(t);return t.shiftKey&&this.current===this.rootNode()&&this.tabOut(),!0}tabTo(t){t.getAttribute("data-mjx-href")?this.setCurrent(this.linkFor(t)):t.focus()}tabOut(){const t=Array.from(this.node.querySelectorAll("mjx-html"));t.length&&(t.forEach(t=>{t.style.display="none"}),setTimeout(()=>{t.forEach(t=>{t.style.display=""})},0))}enterKey(t){if(this.active)if(this.triggerLinkKeyboard(t))this.Stop();else{const t=this.actionable(this.current);if(t)return this.refocus=t,void t.dispatchEvent(new Event("click"));const e=this.getInternalTabs(this.current).filter(t=>!t.getAttribute("data-mjx-href"));if(e.length)return void e[0].focus()}else this.Start()}homeKey(){this.setCurrent(this.rootNode())}moveDown(t){return t?this.moveToNeighborCell(1,0):this.moveTo(this.firstNode(this.current))}moveUp(t){return t?this.moveToNeighborCell(-1,0):this.moveTo(this.getParent(this.current))}moveRight(t){return t?this.moveToNeighborCell(0,1):this.moveTo(this.nextSibling(this.current))}moveLeft(t){return t?this.moveToNeighborCell(0,-1):this.moveTo(this.prevSibling(this.current))}moveTo(t){if(!t)return!1;this.setCurrent(t)}moveToNeighborCell(t,e){const s=this.tableCell(this.current);if(!s)return!1;const[i,r]=this.cellPosition(s);if(null==i)return!1;const n=this.cellAt(this.cellTable(s),i+t,r+e);if(!n)return!1;this.setCurrent(n)}undefinedKey(t){return!this.active||tx(t)}addMark(){this.current===this.marks[this.marks.length-1]?this.setCurrent(this.current):(this.currentMark=this.marks.length-1,this.marks.push(this.current),this.speak("Position marked"))}prevMark(){if(this.currentMark<0){if(0===this.marks.length)return void this.setCurrent(this.lastMark||this.rootNode());this.currentMark=this.marks.length-1}const t=this.currentMark;this.setCurrent(this.marks[t]),this.currentMark=t-1}clearMarks(){this.marks=[],this.currentMark=-1,this.prevMark()}autoVoice(){const t=!this.document.options.a11y.voicing;this.document.menu?this.document.menu.menu.pool.lookup("voicing").setValue(t):this.document.options.a11y.voicing=t,this.Update()}toggleBraille(){const t=!this.document.options.a11y.brailleCombine;this.document.menu?this.document.menu.menu.pool.lookup("brailleCombine").setValue(t):this.document.options.a11y.brailleCombine=t}numberKey(t){if(!this.tableCell(this.current))return!1;if(0===t&&(t=10),this.pendingIndex.length){const e=this.cellTable(this.tableCell(this.current)),s=this.cellAt(e,this.pendingIndex[0]-1,t-1);if(this.pendingIndex=[],this.speak(String(t)),!s)return!1;setTimeout(()=>this.setCurrent(s),500)}else this.pendingIndex=[null,t],this.speak(`Jump to row ${t} and column`)}depth(){var t,e,s;if("d"===this.speechType)return void this.setCurrent(this.current);this.speechType="d";const i=[[null!==(t=this.node.getAttribute("data-semantic-level"))&&void 0!==t?t:"Level",null!==(e=this.current.getAttribute("data-semantic-level-number"))&&void 0!==e?e:"0"].join(" ").trim()],r=this.actionable(this.current);r&&i.unshift(null!==(s=this.node.getAttribute("1"===r.getAttribute("toggle")?"data-semantic-expandable":"data-semantic-collapsible"))&&void 0!==s?s:""),this.speak(i.join(" "),this.current.getAttribute(IE.BRAILLE))}summary(){if("x"===this.speechType)return void this.setCurrent(this.current);this.speechType="x";const t=this.current.getAttribute(IE.SUMMARY);this.speak(t,this.current.getAttribute(IE.BRAILLE),this.SsmlAttributes(this.current,IE.SUMMARY_SSML))}nextRules(){this.node.removeAttribute("data-speech-attached"),this.restartAfter(this.generators.nextRules(this.item))}nextStyle(){this.node.removeAttribute("data-speech-attached"),this.restartAfter(this.generators.nextStyle(this.current,this.item))}details(){const t=this.actionable(this.current);if(!t||!t.getAttribute("data-collapsible")||"1"!==t.getAttribute("toggle")||"z"===this.speechType)return void this.setCurrent(this.current);this.speechType="z";const e=this.nodeId(this.current);let s;this.item.root.walkTree(t=>{t.attributes.get("data-semantic-id")===e&&(s=t)});let i=this.item.toMathML(s,this.item);s.isKind("math")||(i=`${i}`),i=i.replace(/ (?:data-semantic-|aria-|data-speech-|data-latex).*?=".*?"/g,""),this.item.speechFor(i).then(([t,e])=>this.speak(t,e))}help(){if(!this.document.options.enableExplorerHelp)return;const t=this.constructor,[e,s,i]=t.helpData.get(pi.os);uo.post({title:"MathJax Expression Explorer Help",message:t.helpMessage(e,s,i),node:this.node,adaptor:this.document.adaptor,styles:{".mjx-dialog":{"max-height":"calc(min(35em, 90%))"},"mjx-dialog mjx-title":{"font-size":"133%",margin:".5em 1.75em"},"mjx-dialog h2":{"font-size":"20px",margin:".5em 0"},"mjx-dialog ul":{"list-style-type":"none"},"mjx-dialog li":{"margin-bottom":".5em"}}})}setCurrent(t,e=!1){if(this.backTab=!1,this.speechType="",document.hasFocus()||(this.refocus=this.current),this.node.setAttribute("aria-busy","true"),this.current){this.pool.unhighlight();for(const t of Array.from(this.node.querySelectorAll(".mjx-selected")))t.classList.remove("mjx-selected");"last"===this.document.options.a11y.tabSelects&&(this.refocus=this.current),t||(this.lastMark=this.current,this.removeSpeech()),this.current=null}if(this.current=t,this.currentMark=-1,this.current){const s=[...this.getSplitNodes(this.current)];this.highlighter.encloseNodes(s,this.node);for(const t of s)t.getAttribute("data-sre-enclosed")||t.classList.add("mjx-selected");this.pool.highlight(s),this.addSpeech(t,e),this.node.setAttribute("tabindex","-1"),this.Update()}this.node.removeAttribute("aria-busy")}getSplitNodes(t){const e=this.nodeId(t);if(!e)return[t];if(this.cacheParts.has(e))return this.cacheParts.get(e);const s=Array.from(this.node.querySelectorAll(`[data-semantic-id="${e}"]`)),i=this.subtree(e,s);return this.cacheParts.set(e,[...s,...i]),this.cacheParts.get(e)}subtree(t,e){const s=this.subtrees.get(t),i=new Set;for(const t of e)Array.from(t.querySelectorAll("[data-semantic-id]")).forEach(t=>i.add(this.nodeId(t)));return[...function(t,e){if(!t)return new Set;if(!e)return t;return new Set([...t].filter(t=>!e.has(t)))}(s,i)].map(t=>this.getNode(t)).filter(t=>null!==t)}addSpeech(t,e){var s;if(!this.document.options.enableSpeech&&!this.document.options.enableBraille)return;this.anchors.length?setTimeout(()=>{var t;return null===(t=this.img)||void 0===t?void 0:t.remove()},10):null===(s=this.img)||void 0===s||s.remove();let i=this.addComma([t.getAttribute(IE.PREFIX),t.getAttribute(IE.SPEECH),t.getAttribute(IE.POSTFIX)]).join(" ").trim();if(e){let t=this.description===this.none?"":", "+this.description;this.document.options.a11y.help&&this.document.options.enableExplorerHelp&&(t+=", press h for help"),i+=t}this.speak(i,t.getAttribute(IE.BRAILLE),this.SsmlAttributes(t,IE.SPEECH_SSML))}addComma(t){return t[2]&&(t[1]||t[0])&&(t[1]+=","),t}removeSpeech(){this.speech&&(this.unspeak(this.speech),this.speech=null,this.img&&this.node.append(this.img),this.node.setAttribute("tabindex",this.tabIndex))}speak(t,e="",s=null,i=this.none){const r=this.speech,n=this.speech=document.createElement("mjx-speech");if(n.setAttribute("role",this.role),n.setAttribute("aria-label",t||this.none),n.setAttribute("aria-roledescription",i||this.none),n.setAttribute(IE.SPEECH,t),s&&(n.setAttribute(IE.PREFIX_SSML,s[0]||""),n.setAttribute(IE.SPEECH_SSML,s[1]||""),n.setAttribute(IE.POSTFIX_SSML,s[2]||"")),e&&(this.document.options.a11y.brailleSpeech&&(n.setAttribute("aria-label",e),n.setAttribute("aria-roledescription",this.brailleNone)),n.setAttribute("aria-braillelabel",e),n.setAttribute("aria-brailleroledescription",this.brailleNone),this.document.options.a11y.brailleCombine&&n.setAttribute("aria-label",e+YE+t)),n.setAttribute("tabindex","0"),$E){const t=document.createElement("mjx-speech-container");t.setAttribute("role","application"),t.setAttribute("aria-roledescription",this.none),t.setAttribute("aria-brailleroledescription",this.brailleNone),t.append(n),this.node.append(t),n.setAttribute("role","img")}else this.node.append(n);this.focusSpeech=!0,n.focus(),this.focusSpeech=!1,this.Update(),r&&setTimeout(()=>this.unspeak(r),100)}unspeak(t){$E&&(t=t.parentElement),t.remove()}attachSpeech(){var t;const e=this.item,s=this.node;if(!s.hasAttribute("has-speech")){for(const t of Array.from(s.childNodes))t.setAttribute("aria-hidden","true");s.setAttribute("has-speech","true")}const i=e.roleDescription,r=(s.getAttribute(IE.SPEECH)||"")+(i?", "+i:"");null===(t=this.img)||void 0===t||t.remove(),this.img=this.document.adaptor.node("mjx-speech",{"aria-label":r,role:"img","aria-roledescription":e.none});const n=s.getAttribute(IE.BRAILLE);n&&(this.document.options.a11y.brailleSpeech&&(this.img.setAttribute("aria-label",n),this.img.setAttribute("aria-roledescription",this.brailleNone)),this.img.setAttribute("aria-braillelabel",n),this.img.setAttribute("aria-brailleroledescription",this.brailleNone),this.document.options.a11y.brailleCombine&&this.img.setAttribute("aria-label",n+YE+r)),s.appendChild(this.img),this.adjustAnchors(),this.getTabs()}detachSpeech(){var t;const e=this.node;null===(t=this.img)||void 0===t||t.remove(),e.removeAttribute("has-speech");for(const t of Array.from(e.childNodes))t.removeAttribute("aria-hidden");this.restoreAnchors()}adjustAnchors(){this.anchors=Array.from(this.node.querySelectorAll("a[href]"));for(const t of this.anchors){const e=t.getAttribute("href");t.setAttribute("data-mjx-href",e),t.removeAttribute("href")}this.anchors.length&&this.img.setAttribute("tabindex","0")}restoreAnchors(){for(const t of this.anchors)t.setAttribute("href",t.getAttribute("data-mjx-href")),t.removeAttribute("data-mjx-href");this.anchors=[]}getTabs(){this.tabs=this.getInternalTabs(this.node)}getInternalTabs(t){return Array.from(t.querySelectorAll('button, [data-mjx-href], input, select, textarea, [tabindex]:not([tabindex="-1"],mjx-speech)'))}focus(){this.node.focus()}nodeId(t){return t.getAttribute("data-semantic-id")}parentId(t){return t.getAttribute("data-semantic-parent")}getNode(t){return t?this.node.querySelector(`[data-semantic-id="${t}"]`):null}getParent(t){return this.getNode(this.parentId(t))}childArray(t){return t?t.getAttribute("data-semantic-children").split(/,/):[]}isCell(t){return!!t&&this.cellTypes.includes(t.getAttribute("data-semantic-type"))}isRow(t){return!!t&&"row"===t.getAttribute("data-semantic-type")}tableCell(t){for(;t&&t!==this.node;){if(this.isCell(t))return t;t=t.parentNode}return null}cellTable(t){const e=this.getParent(t);return this.isRow(e)?this.getParent(e):e}cellPosition(t){const e=this.getParent(t),s=this.childArray(e).indexOf(this.nodeId(t));if(!this.isRow(e))return[s,1];const i=this.getParent(e);return[this.childArray(i).indexOf(this.nodeId(e)),s]}cellAt(t,e,s){const i=this.getNode(this.childArray(t)[e]);if(!this.isRow(i))return 1===s?i:null;return this.getNode(this.childArray(i)[s])}firstNode(t){const e=t.getAttribute("data-semantic-owns");if(!e)return t.querySelector(QE);const s=e.split(/ /);for(const t of s){const e=this.getNode(t);if(null==e?void 0:e.hasAttribute("data-speech-node"))return e}return t.querySelector(QE)}rootNode(){const t=this.node.querySelector("[data-semantic-structure]");if(!t)return this.node.querySelector(QE);const e=t.getAttribute("data-semantic-structure").split(/ /)[0].replace("(","");return this.getNode(e)}nextSibling(t){var e;const s=this.parentId(t);if(!s)return null;const i=null===(e=this.getNode(s).getAttribute("data-semantic-owns"))||void 0===e?void 0:e.split(/ /);if(!i)return null;let r,n=i.indexOf(this.nodeId(t));do{r=this.getNode(i[++n])}while(r&&!r.hasAttribute("data-speech-node"));return r}prevSibling(t){var e;const s=this.parentId(t);if(!s)return null;const i=null===(e=this.getNode(s).getAttribute("data-semantic-owns"))||void 0===e?void 0:e.split(/ /);if(!i)return null;let r,n=i.indexOf(this.nodeId(t));do{r=this.getNode(i[--n])}while(r&&!r.hasAttribute("data-speech-node"));return r}findClicked(t,e,s){const i=this.document.infoIcon;if(i===t||i.contains(t))return i;if("SVG"!==this.node.getAttribute("jax"))return t.closest(QE);let r=null,n=this.node;for(;n;){n.matches(QE)&&(r=n);const t=Array.from(n.childNodes);n=null;for(const i of t)if(i!==this.speech&&i!==this.img&&i.tagName&&"rect"!==i.tagName.toLowerCase()){const{left:t,right:r,top:o,bottom:a}=i.getBoundingClientRect();if(t<=e&&e<=r&&o<=s&&s<=a){n=i;break}}}return r}isLink(t=this.current){var e;return!!(null===(e=null==t?void 0:t.getAttribute("data-semantic-attributes"))||void 0===e?void 0:e.includes("href:"))}getAnchor(t=this.current){const e=t.closest("a");return e&&this.node.contains(e)?e:null}linkFor(t){return null==t?void 0:t.querySelector('[data-semantic-attributes*="href:"]')}parentLink(t){const e=null==t?void 0:t.closest('[data-semantic-attributes*="href:"]');return e&&this.node.contains(e)?e:null}focusTop(){this.focusSpeech=!0,this.node.focus(),this.focusSpeech=!1}SsmlAttributes(t,e){return[t.getAttribute(IE.PREFIX_SSML),t.getAttribute(e),t.getAttribute(IE.POSTFIX_SSML)]}restartAfter(t){return KE(this,void 0,void 0,function*(){yield t,this.attachSpeech();const e=this.current;this.current=null,this.pool.unhighlight(),this.setCurrent(e)})}constructor(t,e,s,i,r,n,o,a){super(t,e,null,i),this.document=t,this.pool=e,this.region=s,this.node=i,this.brailleRegion=r,this.magnifyRegion=n,this.item=a,this.sound=!1,this.current=null,this.clicked=null,this.refocus=null,this.focusSpeech=!1,this.restarted=null,this.speech=null,this.speechType="",this.img=null,this.attached=!1,this.eventsAttached=!1,this.marks=[],this.currentMark=-1,this.lastMark=null,this.pendingIndex=[],this.cellTypes=["cell","line"],this.backTab=!1,this.events=super.Events().concat([["focusin",this.FocusIn.bind(this)],["focusout",this.FocusOut.bind(this)],["keydown",this.KeyDown.bind(this)],["mousedown",this.MouseDown.bind(this)],["click",this.Click.bind(this)],["dblclick",this.DblClick.bind(this)]]),this.subtrees=null,this.cacheParts=new Map}findStartNode(){let t=this.refocus||this.current;return!t&&this.restarted&&(t=this.node.querySelector(this.restarted)),this.refocus=this.restarted=null,t}Start(){const t=Object.create(null,{Start:{get:()=>super.Start}});return KE(this,void 0,void 0,function*(){if(this.subtrees||(this.subtrees=new Map,this.getSubtrees()),!this.attached||this.active)return;if(this.document.activeItem=this.item,this.item.state(){t.contains(document.activeElement)&&(e instanceof KeyboardEvent?(this.clicked=null,"Tab"!==e.key&&"Escape"!==e.key&&e.stopPropagation()):this.clicked=e.target)};t.addEventListener("mousedown",e),t.addEventListener("click",e),t.addEventListener("keydown",e),t.addEventListener("dblclick",e)}}actionable(t){const e=null==t?void 0:t.parentNode;return e&&this.highlighter.isMactionNode(e)?e:null}triggerLinkKeyboard(t){return this.current?this.triggerLink(this.current):t.target instanceof HTMLAnchorElement&&(t.target.dispatchEvent(new MouseEvent("click")),!0)}triggerLink(t){if(this.isLink(t)){const e=this.getAnchor(t);return e.classList.add("mjx-visited"),setTimeout(()=>this.FocusOut(null),50),window.location.href=e.getAttribute("data-mjx-href"),!0}return!1}triggerLinkMouse(){const t=this.parentLink(this.refocus);return!!this.triggerLink(t)}semanticFocus(){const t=[];let e="data-semantic-id",s=this.current||this.refocus||this.node;const i=this.actionable(s);i&&(e=i.hasAttribute("data-maction-id")?"data-maction-id":"id",s=i,t.push(QE));const r=s.getAttribute(e);return r&&t.unshift(`[${e}="${r}"]`),t.join(" ")}getSubtrees(){const t=this.node.querySelector("[data-semantic-structure]");if(!t)return;const e=t.getAttribute("data-semantic-structure");const s=function(t){const e=[[]];for(const s of t)if("("===s){const t=[];e[e.length-1].push(t),e.push(t)}else")"===s?e.pop():e[e.length-1].push(s);return e[0][0]}(e.replace(/\(/g," ( ").replace(/\)/g," ) ").trim().split(/\s+/));sx(s,this.subtrees)}}function sx(t,e){if("string"==typeof t)return e.has(t)||e.set(t,new Set),new Set;const[s,...i]=t,r=s,n=new Set;for(const t of i){const s="string"==typeof t?t:t[0],i=sx(t,e);n.add(s),i.forEach(t=>n.add(t))}return e.set(r,n),n}ex.helpData=new Map([["MacOS",["on MacOS and iOS using VoiceOver",", or the VoiceOver arrow keys to select an expression",""]],["Windows",["in Windows using NVDA or JAWS",". The screen reader should enter focus or forms mode automatically\n when the expression gets the browser focus, but if not, you can toggle\n focus mode using NVDA+space in NVDA; for JAWS, Enter should start\n forms mode while Numpad Plus leaves it. Also note that you can use\n the NVDA or JAWS key plus the arrow keys to explore the expression\n even in browse mode, and you can use NVDA+shift+arrow keys to\n navigate out of an expression that has the focus in NVDA","NVDA users need to select this option, while JAWS users should be able\n to get Braille output without changing this setting."]],["Unix",["in Unix using Orca",", and Orca should enter focus mode automatically. If not, use the\n Orca+a key to toggle focus mode on or off. Also note that you can use\n Orca+arrow keys to explore expressions even in browse mode",""]],["unknown",["with a Screen Reader.","",""]]]),ex.keyMap=new Map([["Tab",[(t,e)=>t.tabKey(e)]],["Escape",[(t,e)=>t.escapeKey(e)]],["Enter",[(t,e)=>t.enterKey(e)]],["Home",[t=>t.homeKey()]],["ArrowDown",[(t,e)=>t.moveDown(e.shiftKey),!0]],["ArrowUp",[(t,e)=>t.moveUp(e.shiftKey),!0]],["ArrowLeft",[(t,e)=>t.moveLeft(e.shiftKey),!0]],["ArrowRight",[(t,e)=>t.moveRight(e.shiftKey),!0]],[" ",[t=>t.spaceKey()]],["h",[t=>t.hKey()]],[">",[t=>t.nextRules(),!1]],["<",[t=>t.nextStyle(),!1]],["x",[t=>t.summary(),!1]],["z",[t=>t.details(),!1]],["d",[t=>t.depth(),!1]],["v",[t=>t.addMark(),!1]],["p",[t=>t.prevMark(),!1]],["u",[t=>t.clearMarks(),!1]],["s",[t=>t.autoVoice(),!1]],["b",[t=>t.toggleBraille(),!1]],...[..."0123456789"].map(t=>[t,[e=>e.numberKey(parseInt(t)),!1]])]);class ix extends JE{constructor(){super(...arguments),this.events=super.Events().concat([["mouseover",this.MouseOver.bind(this)],["mouseout",this.MouseOut.bind(this)]])}MouseOver(t){this.Start()}MouseOut(t){this.Stop()}}class rx extends ix{constructor(t,e,s,i,r,n){super(t,e,s,i),this.document=t,this.pool=e,this.region=s,this.node=i,this.nodeQuery=r,this.nodeAccess=n}MouseOut(t){this.highlighter.unhighlight(),this.region.Hide(),super.MouseOut(t)}MouseOver(t){super.MouseOver(t);const e=t.target,[s,i]=this.getNode(e);s&&(this.highlighter.unhighlight(),this.highlighter.highlight([s]),this.region.Update(i),this.region.Show(s))}getNode(t){const e=t;for(;t&&t!==this.node;){if(this.nodeQuery(t))return[t,this.nodeAccess(t)];t=t.parentNode}for(t=e;t;){if(this.nodeQuery(t))return[t,this.nodeAccess(t)];const e=t.childNodes[0];t=e&&"defs"===e.tagName?t.childNodes[1]:e}return[null,null]}}class nx extends rx{}class ox extends rx{}class ax extends rx{constructor(t,e,s,i){super(t,e,new WE(t),i,t=>this.highlighter.isMactionNode(t),()=>{}),this.document=t,this.pool=e,this.node=i}}class lx extends JE{constructor(t,e,s,i,r){super(t,e,null,i),this.document=t,this.pool=e,this.region=s,this.node=i,this.mml=r,this.stoppable=!1}Attach(){super.Attach(),this.Start()}Detach(){this.Stop(),super.Detach()}}class cx extends lx{Start(){this.active||(this.active=!0,this.highlighter.highlightAll(this.node))}Stop(){this.active&&this.highlighter.unhighlightAll(),this.active=!1}}class hx extends lx{constructor(){super(...arguments),this.contrast=new dx,this.leaves=[],this.modality="data-semantic-foreground"}Start(){this.active||(this.active=!0,this.node.hasAttribute("hasforegroundcolor")||(this.colorLeaves(),this.node.setAttribute("hasforegroundcolor","true")),this.leaves.forEach(t=>this.colorize(t)))}Stop(){this.active&&this.leaves.forEach(t=>this.uncolorize(t)),this.active=!1}colorLeaves(){this.leaves=Array.from(this.node.querySelectorAll("[data-semantic-id]:not([data-semantic-children])"));for(const t of this.leaves)t.setAttribute(this.modality,this.contrast.generate()),this.contrast.increment()}colorize(t){t.hasAttribute(this.modality)&&(t.setAttribute(this.modality+"-old",t.style.color),t.style.color=t.getAttribute(this.modality))}uncolorize(t){const e=this.modality+"-old";t.hasAttribute(e)&&(t.style.color=t.getAttribute(e))}}class dx{constructor(){this.hue=10,this.sat=100,this.light=50,this.incr=53}generate(){return dx.hsl2rgb(this.hue,this.sat,this.light)}increment(){this.hue=(this.hue+this.incr)%360}static hsl2rgb(t,e,s){e=e>1?e/100:e,s=s>1?s/100:s;const i=(1-Math.abs(2*s-1))*e,r=i*(1-Math.abs(t/60%2-1)),n=s-i/2;let o=0,a=0,l=0;return 0<=t&&t<60?[o,a,l]=[i,r,0]:60<=t&&t<120?[o,a,l]=[r,i,0]:120<=t&&t<180?[o,a,l]=[0,i,r]:180<=t&&t<240?[o,a,l]=[0,r,i]:240<=t&&t<300?[o,a,l]=[r,0,i]:300<=t&&t<360&&([o,a,l]=[i,0,r]),`rgb(${255*(o+n)}, ${255*(a+n)}, ${255*(l+n)})`}}const ux={color:"blue",alpha:.2},px={color:"black",alpha:1},mx={ENCLOSED:"data-sre-enclosed",BBOX:"data-sre-highlighter-bbox",ADDED:"data-sre-highlighter-added"};class fx{constructor(t){this.currentHighlights=[],this.priority=t,this.ATTR="data-sre-highlight-"+t}highlight(t){this.currentHighlights.push(t);for(const e of t)this.highlightNode(e),this.setHighlighted(e)}highlightAll(t){const e=this.getMactionNodes(t);for(const t of e)this.highlight([t])}unhighlight(){const t=this.currentHighlights.pop();t&&t.forEach(t=>{this.isHighlighted(t)&&(this.unhighlightNode(t),this.unsetHighlighted(t))})}unhighlightAll(){for(;this.currentHighlights.length>0;)this.unhighlight()}encloseNodes(t,e){if(1===t.length)return t;const s=this.constructor,i=s.lineSelector,r=s.lineAttr,n=new Map;for(const e of t){const t=e.closest(i),s=t?t.getAttribute(r):"";n.has(s)||n.set(s,[]),n.get(s).push(e)}for(const s of n.values())if(s.length>1){let[i,r,n,o]=[1/0,1/0,-1/0,-1/0];for(const t of s){t.setAttribute(mx.ENCLOSED,"true");const{left:e,top:s,right:a,bottom:l}=t.getBoundingClientRect();s===l&&e===a||(eo&&(o=l),a>n&&(n=a))}const a=this.createEnclosure(i,o,n-i,o-r,e,s[0]);t.push(a)}return t}setColorCSS(t,e,s){var i,r;const n=null!==(i=e.color)&&void 0!==i?i:s.color,o=null!==(r=e.alpha)&&void 0!==r?r:s.alpha;VE.setColor(t,this.priority,n,o)}setColor(t,e){this.setColorCSS("fg",e,px),this.setColorCSS("bg",t,ux)}isHighlighted(t){return t.hasAttribute(this.ATTR)}setHighlighted(t){t.setAttribute(this.ATTR,"true")}unsetHighlighted(t){t.removeAttribute(this.ATTR),t.removeAttribute(mx.ENCLOSED)}}class gx extends fx{highlightNode(t){if(this.isHighlighted(t)||"svg"===t.tagName||"MJX-CONTAINER"===t.tagName||t.hasAttribute(mx.BBOX)||t.hasAttribute(mx.ENCLOSED))return;const{x:e,y:s,width:i,height:r}=t.getBBox(),n=this.createRect(e,s,i,r,t.getAttribute("transform"));this.setHighlighted(n),t.parentNode.insertBefore(n,t)}unhighlightNode(t){if(t.hasAttribute(mx.BBOX))return void t.remove();const e=t.previousSibling;(null==e?void 0:e.hasAttribute(mx.ADDED))&&e.remove()}createEnclosure(t,e,s,i,r,n){const[o,a]=this.screen2svg(t,e,n),[l,c]=this.screen2svg(t+s,e-i,n),h=this.createRect(o,a,l-o,c-a,n.getAttribute("transform"));return h.setAttribute(mx.BBOX,"true"),n.parentNode.insertBefore(h,n),h}screen2svg(t,e,s){const i=s,r=DOMPoint.fromPoint({x:t,y:e}).matrixTransform(i.getScreenCTM().inverse());return[r.x,r.y]}createRect(t,e,s,i,r){const n=document.createElementNS("http://www.w3.org/2000/svg","rect");return n.setAttribute(mx.ADDED,"true"),n.setAttribute("x",String(t-40)),n.setAttribute("y",String(e-40)),n.setAttribute("width",String(s+80)),n.setAttribute("height",String(i+80)),r&&n.setAttribute("transform",r),n}isMactionNode(t){return"maction"===t.getAttribute("data-mml-node")}getMactionNodes(t){return Array.from(t.querySelectorAll('[data-mml-node="maction"]'))}}gx.lineSelector="[data-mjx-linebox]",gx.lineAttr="data-mjx-lineno";class bx extends fx{highlightNode(t){}unhighlightNode(t){"mjx-bbox"===t.tagName.toLowerCase()&&t.remove()}createEnclosure(t,e,s,i,r){const n=r.getBoundingClientRect(),o=document.createElement("mjx-bbox");return o.style.width=s+"px",o.style.height=i+"px",o.style.left=t-n.left+"px",o.style.top=e-i-n.top+"px",o.style.position="absolute",r.prepend(o),o}isMactionNode(t){var e;return"mjx-maction"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase())}getMactionNodes(t){return Array.from(t.querySelectorAll("mjx-maction"))}}function Ex(t,e,s,i){const r=new xx[i](t);return r.setColor(e,s),r}bx.lineSelector="mjx-linebox",bx.lineAttr="lineno";const xx={SVG:gx,CHTML:bx,generic:bx};class yx{constructor(t){this.document=t,this.speechRegion=new XE(this.document),this.brailleRegion=new VE(this.document),this.magnifier=new GE(this.document),this.tooltip1=new qE(this.document),this.tooltip2=new qE(this.document),this.tooltip3=new qE(this.document)}}const Nx={speech:(t,e,s,...i)=>{const r=ex.create(t,e,t.explorerRegions.speechRegion,s,t.explorerRegions.brailleRegion,t.explorerRegions.magnifier,i[0],i[1]);return r.sound=!0,r},mouseMagnifier:(t,e,s,...i)=>ox.create(t,e,t.explorerRegions.magnifier,s,t=>t.hasAttribute("data-semantic-type"),t=>t),hover:(t,e,s,...i)=>ax.create(t,e,null,s),infoType:(t,e,s,...i)=>nx.create(t,e,t.explorerRegions.tooltip1,s,t=>t.hasAttribute("data-semantic-type"),t=>t.getAttribute("data-semantic-type")),infoRole:(t,e,s,...i)=>nx.create(t,e,t.explorerRegions.tooltip2,s,t=>t.hasAttribute("data-semantic-role"),t=>t.getAttribute("data-semantic-role")),infoPrefix:(t,e,s,...i)=>nx.create(t,e,t.explorerRegions.tooltip3,s,t=>{var e;return null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-semantic-prefix-none")},t=>{var e;return null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"data-semantic-prefix-none")}),flame:(t,e,s,...i)=>cx.create(t,e,null,s),treeColoring:(t,e,s,...i)=>hx.create(t,e,null,s,...i)};class vx{constructor(){this.explorers={},this.attached=[],this._restart=[],this.speechExplorerKeys=["speech","braille","keyMagnifier"]}get highlighter(){if(this._renderer!==this.document.outputJax.name)return this._renderer=this.document.outputJax.name,this.setPrimaryHighlighter(),this._highlighter;const[t,e]=this.colorOptions();return this._highlighter.setColor(e,t),this._highlighter}init(t,e,s,i){this.document=t,this.mml=s,this.node=e,this.setPrimaryHighlighter();for(const t of Object.keys(Nx))this.explorers[t]=Nx[t](this.document,this,this.node,this.mml,i);this.setSecondaryHighlighter(),this.attach()}attach(){this.attached=[];const t=[],e=this.document.options.a11y;for(const[s,i]of Object.entries(this.explorers))i instanceof ex?(i.stoppable=!1,t.unshift(i),this.speechExplorerKeys.some(t=>this.document.options.a11y[t])?(i.Attach(),this.attached.push(s)):i.Detach()):e[s]||"speech"===s&&(e.braille||e.keyMagnifier)?(i.Attach(),this.attached.push(s)):i.Detach();for(const e of t)if(e.attached){e.stoppable=!0;break}}reattach(){for(const t of this.attached){const e=this.explorers[t];e.active&&(this._restart.push(t),e.Stop())}}restart(){this._restart.forEach(t=>{this.explorers[t].Start()}),this._restart=[]}setPrimaryHighlighter(){const[t,e]=this.colorOptions();this._highlighter=Ex(VE.priority.primary,e,t,this.document.outputJax.name)}setSecondaryHighlighter(){this.secondaryHighlighter=Ex(VE.priority.secondary,{color:"red",alpha:.8},{color:"black"},this.document.outputJax.name),this.speech.region.highlighter=this.secondaryHighlighter}highlight(t){this.highlighter.highlight(t)}unhighlight(){this.secondaryHighlighter.unhighlight(),this.highlighter.unhighlight()}get speech(){return this.explorers.speech}colorOptions(){const t=this.document.options.a11y;return[{color:t.foregroundColor.toLowerCase(),alpha:t.foregroundOpacity/100},{color:t.backgroundColor.toLowerCase(),alpha:t.backgroundOpacity/100}]}}const Tx="Unix"===pi.os;function Cx(t,e){var s;return s=class extends t{constructor(){super(...arguments),this.refocus=null}get ariaRole(){return this.constructor.ariaRole}get roleDescription(){const t=this.constructor;return"none"===t.roleDescription?t.none:t.roleDescription}get none(){return this.constructor.none}get brailleNone(){return this.constructor.brailleNone}attachSpeech(t){var e,s;super.attachSpeech(t),null===(s=null===(e=this.outputData.speechPromise)||void 0===e?void 0:e.then(()=>this.explorers.speech.attachSpeech()))||void 0===s||s.then(()=>{var t;(null===(t=this.explorers)||void 0===t?void 0:t.speech)&&(this.explorers.speech.restarted=this.refocus),this.refocus=null,this.explorers&&this.explorers.restart()})}detachSpeech(t){super.detachSpeech(t),this.explorers.speech.detachSpeech()}explorable(t,s=!1){if(!(this.state()>=ar.EXPLORER)){if(!this.isEscaped&&(t.options.enableExplorer||s)){const s=this.typesetRoot,i=e(this.root);this.explorers||(this.explorers=new vx),this.explorers.init(t,s,i,this)}this.state(ar.EXPLORER)}}state(t=null,e=!1){if(tsetTimeout(()=>t.remove(),100))}}},s.ariaRole=Tx?"tree":"application",s.roleDescription="math",s.none="\x91",s.brailleNone="\u2800",s}function Ax(t){var e;return e=class extends t{constructor(...t){super(...t),this.explorerRegions=null,this.activeItem=null;const e=this.constructor.ProcessBits;e.has("explorer")||e.allocate("explorer");const s=new Yn(this.mmlFactory),i=this.options;i.a11y.speechRules||(i.a11y.speechRules=`${i.sre.domain}-${i.sre.style}`);const r=i.MathItem=Cx(i.MathItem,t=>s.visitTree(t));r.roleDescription=i.roleDescription,this.explorerRegions=new yx(this),"addStyles"in this&&this.addStyles(this.constructor.speechStyles);const n=this.adaptor,o="http://www.w3.org/2000/svg";this.infoIcon=n.node("mjx-help",{},[n.node("svg",{viewBox:"0 0 18 18",xmlns:o,"aria-hidden":"true"},[n.node("circle",{stroke:"none"},[],o),n.node("circle",{},[],o),n.node("line",{x1:9,y1:9,x2:9,y2:13},[],o),n.node("line",{x1:9,y1:5.5,x2:9,y2:5.5},[],o)],o)]),this.tmpFocus=n.node("mjx-focus",{tabIndex:0,style:{outline:"none",display:"block",position:"absolute",top:0,left:"-10px",width:"1px",height:"1px",overflow:"hidden"},role:r.ariaRole,"aria-label":r.none,"aria-roledescription":r.none})}explorable(){if(!this.processed.isSet("explorer")){if(this.options.enableExplorer)for(const t of this.math)t.explorable(this);this.processed.set("explorer")}return this}rerender(t){const e=this.activeItem,s=null==e?void 0:e.setTemporaryFocus(this);return super.rerender(t),null==e||e.clearTemporaryFocus(s),this}state(t,e=!1){return super.state(t,e),t mjx-help":{display:"none",position:"absolute",top:"-.3em",right:"-.5em",width:".6em",height:".6em",cursor:"pointer"},'mjx-container[display="true"] > mjx-help':{position:"sticky",inset:"-100% 0 100% 0",margin:"-.3em -.5em 0 -.1em",right:0,top:"initial"},"mjx-help > svg":{stroke:"black",width:"100%",height:"100%"},"mjx-help > svg > circle":{"stroke-width":"1.5px",cx:"9px",cy:"9px",r:"9px",fill:"white"},"mjx-help > svg > circle:nth-child(2)":{fill:"var(--mjx-bg1-color)",r:"7px"},"mjx-help > svg > line":{"stroke-width":"2.5px","stroke-linecap":"round"},"mjx-help:hover > svg > circle:nth-child(2)":{fill:"white"},"mjx-container.mjx-explorer-active > mjx-help":{display:"inline-flex","align-items":"center"},"@media (prefers-color-scheme: dark) /* explorer */":{"mjx-help > svg":{stroke:"#E0E0E0"},"mjx-help > svg > circle":{fill:"#404040"},"mjx-help > svg > circle:nth-child(2)":{fill:"rgba(132, 132, 255, .3)"},"mjx-help:hover > svg > circle:nth-child(2)":{stroke:"#AAAAAA",fill:"#404040"}}},e}function Lx(t,e=null){return t.documentClass.prototype.attachSpeech||(t=UE(t,e)),t.documentClass=Ax(t.documentClass),t}function Sx(t,e){var s;const i=Bb();for(const s in e)void 0!==t.options.a11y[s]?Rx(t,s,e[s]):void 0!==i[s]&&(t.options.sre[s]=e[s]);e.roleDescription&&(t.options.MathItem.roleDescription=e.roleDescription);for(const e of t.math)null===(s=null==e?void 0:e.explorers)||void 0===s||s.attach()}function Rx(t,e,s){switch(e){case"speechRules":{const[e,i]=s.split("-");t.options.sre.domain=e,t.options.sre.style=i;break}case"magnification":switch(s){case"None":t.options.a11y.magnification=s,t.options.a11y.keyMagnifier=!1,t.options.a11y.mouseMagnifier=!1;break;case"Keyboard":t.options.a11y.magnification=s,t.options.a11y.keyMagnifier=!0,t.options.a11y.mouseMagnifier=!1;break;case"Mouse":t.options.a11y.magnification=s,t.options.a11y.keyMagnifier=!1,t.options.a11y.mouseMagnifier=!0}break;case"highlight":switch(s){case"None":t.options.a11y.highlight=s,t.options.a11y.hover=!1,t.options.a11y.flame=!1;break;case"Hover":t.options.a11y.highlight=s,t.options.a11y.hover=!0,t.options.a11y.flame=!1;break;case"Flame":t.options.a11y.highlight=s,t.options.a11y.hover=!1,t.options.a11y.flame=!0}break;case"locale":t.options.sre.locale=s;break;default:t.options.a11y[e]=s}}lr("EXPLORER",ar.INSERTED+30),MathJax.loader&&MathJax.loader.checkVersion("a11y/explorer",ri,"a11y"),hi({_:{a11y:{explorer_ts:ii,explorer:{Explorer:Ys,ExplorerPool:si,Highlighter:ei,KeyExplorer:Qs,MouseExplorer:Zs,Region:$s,TreeExplorer:ti}}}}),MathJax.startup&&ui&&MathJax.startup.extendHandler(t=>Lx(t)),vi.preLoaded("a11y/sre","a11y/semantic-enrich","a11y/speech","a11y/explorer","input/mml"),vi.preLoaded("loader","startup","core","input/tex","input/mml","output/chtml","ui/menu"),vi.saveVersion("tex-mml-chtml"),function(t,e){au.loadFont(t,"chtml",su,e)}(function(t){return vi.load(...Ci.load).then(()=>(t||function(){})()).then(()=>Ci.ready()).catch(t=>Ci.failed(t))},!0)})()})(); diff --git a/tbx/docmakerdoc/DocMakerTask.md b/tbx/docmakerdoc/DocMakerTask.md index b8eeb40..022e71a 100644 --- a/tbx/docmakerdoc/DocMakerTask.md +++ b/tbx/docmakerdoc/DocMakerTask.md @@ -4,28 +4,25 @@ Custom build task for generating documentation ## Syntax -`plan("doc") = DocMakerTask(md)` creates a documentation generation task, named `"doc"`, for the Markdown documents `md`, in the build plan `plan`. -Multiple documents may also be specified using `DocMakerTask(md1,md2,...)`. +`plan("doc") = DocMakerTask(md)` creates a documentation generation task, named `"doc"`, for the Markdown documents `md`, in the build plan `plan`. Multiple documents may also be specified using `DocMakerTask(md1,md2,...)`. -`plan("doc") = DocMakerTask(...,"Theme",t)` sets the theme `t`. Available themes are `light`, `dark`, and `auto` (responsive, default). For viewing as part of the MATLAB documentation, especially prior to R2025a, light mode works best. For viewing standalone, responsive mode works well. +`plan("doc") = DocMakerTask(...,"Theme",t)` sets the theme `t`. Available themes are `light`, `dark`, and `auto` (responsive, default). For viewing as part of the MATLAB documentation, especially prior to R2025a, light mode works best. For viewing standalone, responsive mode works well. `plan("doc") = DocMakerTask(...,"Stylesheets",css)` includes the stylesheet(s) `css`. -`plan("doc") = DocMakerTask(...,"Scripts",js)` includes the script(s) `js`. Scripts are included at the end of the body in the order specified to ensure that the HTML content is loaded and rendered before the scripts run. :test_tube: +`plan("doc") = DocMakerTask(...,"Scripts",js)` includes the script(s) `js`. Scripts are included at the end of the body in the order specified to ensure that the HTML content is loaded and rendered before the scripts run. :test_tube: -`plan("doc") = DocMakerTask(...,"Root",r)` publishes to the root folder `r`, placing stylesheets and scripts in the subfolder `resources`. The root folder must be a common ancestor of the Markdown documents. If not specified, the root folder is the lowest common ancestor. +`plan("doc") = DocMakerTask(...,"Root",r)` publishes to the root folder `r`, placing stylesheets and scripts in the subfolder `resources`. The root folder must be a common ancestor of the Markdown documents. If not specified, the root folder is the lowest common ancestor. -`plan("doc") = DocMakerTask(...,"Interpreter",in)` uses the interpreter `in` to postprocess -inline or display LaTeX expressions. Available interpreters -are `latex` or `none` (default). Specify inline LaTeX expressions between -single dollar symbols (`$`), and display LaTeX expressions between -double dollar symbols (`$$`). +`plan("doc") = DocMakerTask(...,"Interpreter",in)` uses the interpreter `in` to postprocess inline or display LaTeX expressions. Available interpreters are `latex` or `none` (default). Specify inline LaTeX expressions between single dollar symbols (`$`), and display LaTeX expressions between double dollar symbols (`$$`). -`plan("doc") = DocMakerTask(...,"Level",n)` specifies the batching level `n`. With level 0 (default), all blocks in a document are run in a single batch. With level `n`, each level-n heading is run as a separate batch, with the workspace cleared and figures closed between batches. With level 7, each block is run as a separate batch. +`plan("doc") = DocMakerTask(...,"Converter",c)` uses the Markdown converter `c` to convert Markdown documents and `helptoc.md`. Available converters are `cmark` (bundled cmark-gfm, default), `github` (GitHub Markdown API on GitHub.com), and `gitlab` (GitLab Markdown API on GitLab.com). See [Markdown conversion](conversion.md) for converter details, setup, platform support, and version details. -`plan("doc") = DocMakerTask(...,"FigureSize",s)` sets the default figure size `s`. Size is `[width height]` in default figure `Units`. +`plan("doc") = DocMakerTask(...,"Level",n)` specifies the batching level `n`. With level 0 (default), all blocks in a document are run in a single batch. With level `n`, each level-n heading is run as a separate batch, with the workspace cleared and figures closed between batches. With level 7, each block is run as a separate batch. -`plan("doc") = DocMakerTask(...,"FigureTheme",t)` sets the figure theme `t`. Available themes are `none` (as is, default), `light`, `dark`, and `auto` (responsive). For viewing as part of the MATLAB documentation, especially prior to R2025a, light mode works best. For viewing standalone, responsive mode works well. +`plan("doc") = DocMakerTask(...,"FigureSize",s)` sets the default figure size `s`. Size is `[width height]` in default figure `Units`. + +`plan("doc") = DocMakerTask(...,"FigureTheme",t)` sets the figure theme `t`. Available themes are `none` (as is, default), `light`, `dark`, and `auto` (responsive). For viewing as part of the MATLAB documentation, especially prior to R2025a, light mode works best. For viewing standalone, responsive mode works well. | Name | Description | Type | Required | @@ -36,14 +33,14 @@ double dollar symbols (`$$`). | `js`:arrow_right: | JavaScript script(s), as an absolute or relative path; wildcards are [supported](https://www.mathworks.com/help/matlab/ref/dir.html#bsnswnx-1-name) | string(s) | :test_tube: | | `r`:arrow_right: | root folder, as an absolute or relative path; default is the lowest common ancestor of `md` | string | | | `in`:arrow_right: | LaTeX interpreter: `latex` or `none`; default is `none` | string | | +| `c`:arrow_right: | Markdown converter: `cmark`, `github`, or `gitlab`; default is `cmark` | string | | | `n`:arrow_right: | batching level, from 0 to 7; default is 0 | double | :test_tube: | | `s`:arrow_right: | default figure size, in default figure `Units` | double | | | `t`:arrow_right: | figure theme: `none`, `light`, `dark`, or `auto`; default is `none` | string(s) | | ## Examples -Add a documentation generation task to the build plan for all Markdown documents in the folder `doc`. Use light theme for the -documentation files and figure snapshots, and specify a figure size of 600-by-400 pixels. +Add a documentation generation task to the build plan for all Markdown documents in the folder `doc`. Use light theme for the documentation files and figure snapshots, and specify a figure size of 600-by-400 pixels. ```matlab md = fullfile(doc, "**", "*.md"); % Markdown documents plan("doc") = DocMakerTask(md, "Theme", "light", ... @@ -61,4 +58,4 @@ For further examples of using the task inputs, see [`docconvert`](docconvert.md) ___ -[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [build](DocMakerTask.md) :factory: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/about.md b/tbx/docmakerdoc/about.md index 91b2bcc..2ecb7c0 100644 --- a/tbx/docmakerdoc/about.md +++ b/tbx/docmakerdoc/about.md @@ -2,20 +2,18 @@ ## Contributors -DocMaker is developed by [David Sampson](https://www.mathworks.com/matlabcentral/profile/authors/16247) from [MathWorks](https://www.mathworks.com/services/consulting.html) on [GitHub](https://github.com/mathworks/docmaker). +DocMaker is developed by [David Sampson](https://www.mathworks.com/matlabcentral/profile/authors/16247) and [Ken Deeley](https://www.mathworks.com/matlabcentral/profile/authors/2987674) from [MathWorks](https://www.mathworks.com/services/consulting.html) on [GitHub](https://github.com/mathworks/docmaker). -DocMaker uses the [GitHub Markdown API](https://docs.github.com/en/rest/markdown) or the [GitLab Markdown API](https://docs.gitlab.com/api/markdown/) for converting Markdown to HTML, and the [GitHub Markdown CSS](https://github.com/sindresorhus/github-markdown-css) by [Sindre Sorhus](https://github.com/sindresorhus) for HTML styling. - -The author thanks [Ken Deeley](https://www.mathworks.com/matlabcentral/profile/authors/2987674) from MathWorks for his support during the development of DocMaker. +DocMaker converts Markdown to HTML using [cmark-gfm](https://github.com/github/cmark-gfm), [gemoji](https://github.com/github/gemoji), and [GitHub Markdown CSS](https://github.com/sindresorhus/github-markdown-css). ## History The [release notes](changelog.md) detail new features, bug fixes, and compatibility considerations for each version. -DocMaker replaces a previous MathWorks internal documentation tool, *DocTools*, by [Ben Tordoff](https://www.mathworks.com/matlabcentral/profile/authors/1297191). DocMaker seeks to improve on DocTools by supporting authoring in Markdown. +DocMaker replaces a previous MathWorks internal documentation tool, *DocTools*, by [Ben Tordoff](https://www.mathworks.com/matlabcentral/profile/authors/1297191). DocMaker seeks to improve on DocTools by supporting authoring in Markdown. -DocMaker was developed to build documentation for [GUI Layout Toolbox](http://www.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox), [Package Jockey](https://insidelabs-git.mathworks.com/dsampson/pj), and [DocMaker](https://github.com/mathworks/docmaker) itself! The features of DocMaker reflect the needs of these projects. +DocMaker was developed to build documentation for [GUI Layout Toolbox](http://www.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox), [Package Jockey](https://insidelabs-git.mathworks.com/dsampson/pj), and [DocMaker](https://github.com/mathworks/docmaker) itself! The features of DocMaker reflect the needs of these projects. ___ -[home](index.md) :house: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/api.md b/tbx/docmakerdoc/api.md index 0456cc9..fbb2c0e 100644 --- a/tbx/docmakerdoc/api.md +++ b/tbx/docmakerdoc/api.md @@ -4,6 +4,7 @@ * [docrun](docrun.md) :runner: - run MATLAB scripts and save generated figures to image files * [docindex](docindex.md) :scroll: - create documentation index files * [docdelete](docdelete.md) :recycle: - delete generated artifacts +* [DocMakerTask](DocMakerTask.md) :factory: - custom build task for generating documentation * [docmaker.Workspace](workspace.md) :construction_worker: - assign variables and evaluate expressions ___ diff --git a/tbx/docmakerdoc/automation.md b/tbx/docmakerdoc/automation.md index abf65bd..a5f0e94 100644 --- a/tbx/docmakerdoc/automation.md +++ b/tbx/docmakerdoc/automation.md @@ -2,19 +2,19 @@ You can automate documentation generation as part of toolbox publishing using projects, source control integration, and (from R2022b) the [MATLAB Build Tool](https://www.mathworks.com/help/matlab/matlab_prog/overview-of-matlab-build-tool.html). -Here we set out an example using DocMaker itself. You can adapt this example to your needs. +Here we set out an example using DocMaker itself. You can adapt this example to your needs. ## Provisioning DocMaker You should install DocMaker in both the developer and automation environments. -A basic option is to script installation from a known location at project startup. The latest installer is available at: +A basic option is to script installation from a known location at project startup. The latest installer is available at: ``` https://github.com/mathworks/docmaker/releases/latest/download/MATLAB_DocMaker.mltbx ``` -For specific versions, replace `latest` with the version tag, e.g. `v1.0` for version 1.0. You can download the installer using [`websave`](https://www.mathworks.com/help/matlab/ref/websave.html), and then install the toolbox using [`matlab.addons.install`](https://www.mathworks.com/help/matlab/ref/matlab.addons.install.html). +For specific versions, replace `latest` with the version tag, e.g. `v1.0.0` for version 1.0.0. You can download the installer using [`websave`](https://www.mathworks.com/help/matlab/ref/websave.html), and then install the toolbox using [`matlab.addons.install`](https://www.mathworks.com/help/matlab/ref/matlab.addons.install.html). A better option is to use a package manager such as [Package Jockey](https://insidelabs-git.mathworks.com/dsampson/pj) from [MathWorks Consulting](https://www.mathworks.com/consulting/). @@ -24,11 +24,13 @@ Check that DocMaker is available using `ver`. s = ver("docmaker") ``` -By default, DocMaker uses the GitHub Markdown API at `api.github.com` to convert Markdown to HTML. You can [configure Markdown conversion](conversion.md) to use another converter technology or service instance or to authenticate with an access token. +By default, `Converter="cmark"` converts Markdown locally using [cmark-gfm](https://github.com/github/cmark-gfm) and [gemoji](https://github.com/github/gemoji), so network access is not required. Set `Converter` to `github` or `gitlab` in `docconvert` or `DocMakerTask` to use a hosted Markdown API. See [Markdown conversion](conversion.md) for platform and authentication details. + +The published DocMaker toolbox includes the platform-specific MEX binaries for Windows x64, Linux x86-64, Intel macOS, and Apple Silicon macOS. ## Organizing files -You should organize your toolbox project files, separating code, documentation, tests, releases, etc. into folders. For DocMaker, this looks like: +You should organize your toolbox project files, separating code, documentation, tests, releases, etc. into folders. For DocMaker, this looks like: ``` docmaker @@ -43,9 +45,9 @@ docmaker.prj README.md ``` -`docmaker.prj` is the MATLAB project file. `tbx` is the toolbox root folder -- the folder containing the shipping files -- with code in `docmaker`, and documentation in `docmakerdoc`. +`docmaker.prj` is the MATLAB project file. `tbx` is the toolbox root folder -- the folder containing the shipping files -- with code in `docmaker`, and documentation in `docmakerdoc`. -Track your files with Git. Only DocMaker *source* artifacts (`*.md`, `*.m`) should be tracked. You can exclude *generated* artifacts via `.gitignore` entries: +Track your files with Git. Only DocMaker *source* artifacts (`*.md`, `*.m`) should be tracked. You can exclude *generated* artifacts via `.gitignore` entries: ``` tbx/docmakerdoc/**/*.html @@ -58,7 +60,7 @@ tbx/docmakerdoc/helpsearch-v* ### Alternative layout -Some authors prefer to separate documentation input from output. This looks like: +Some authors prefer to separate documentation input from output. This looks like: ``` docmaker @@ -68,11 +70,11 @@ docmaker |- docmakerdoc ``` -with Markdown documents in `doc` and generated HTML documents, index files and other resources in `tbx/docmakerdoc`. Since DocMaker generates output in place, the output needs to be moved to the shipping folder as a second step. +with Markdown documents in `doc` and generated HTML documents, index files and other resources in `tbx/docmakerdoc`. Since DocMaker generates output in place, the output needs to be moved to the shipping folder as a second step. ## Generating documentation -Create a build task `docTask` to generate the documentation. The input is the documentation root folder. The outputs are the HTML documents, resources folder, index files, and search database folder generated. +Create a build task `docTask` to generate the documentation. The input is the documentation root folder. The outputs are the HTML documents, resources folder, index files, and search database folder generated. ```matlab plan("doc").Inputs = doc; % source folder, /tbx/docmakerdoc @@ -96,10 +98,9 @@ docindex(doc) % index end ``` -The task will be skipped if the input and output have not changed since the last successful run. Furthermore `buildtool clean` will remove generated artifacts, without the need to call `docdelete` explicitly. +The task will be skipped if the input and output have not changed since the last successful run. Furthermore `buildtool clean` will remove generated artifacts, without the need to call `docdelete` explicitly. -In MATLAB R2025a or later, you can use the provided [`DocMakerTask`](DocMakerTask.md) to simplify this process, without the need to write a task function. This task works -in the same way as the steps above. +In MATLAB R2025a or later, you can use the provided [`DocMakerTask`](DocMakerTask.md) to simplify this process, without the need to write a task function. This task works in the same way as the steps above. ```matlab md = fullfile( doc, "**", "*.md" ); % Markdown documents @@ -149,7 +150,7 @@ Since [`movefile`](https://www.mathworks.com/help/matlab/ref/movefile.html) is n ## Packaging the toolbox -Use [`packageToolbox`](https://www.mathworks.com/help/matlab/ref/matlab.addons.toolbox.packagetoolbox.html) with [`ToolboxOptions`](https://www.mathworks.com/help/matlab/ref/matlab.addons.toolbox.toolboxoptions.html) to package the toolbox. If your documentation source is located under the toolbox root then you may wish to remove the source from the list of packaged files. +Use [`packageToolbox`](https://www.mathworks.com/help/matlab/ref/matlab.addons.toolbox.packagetoolbox.html) with [`ToolboxOptions`](https://www.mathworks.com/help/matlab/ref/matlab.addons.toolbox.toolboxoptions.html) to package the toolbox. If your documentation source is located under the toolbox root then you may wish to remove the source from the list of packaged files. ```matlab o = matlab.addons.toolbox.ToolboxOptions("tbx",id,...); @@ -158,4 +159,4 @@ o.ToolboxFiles(o.ToobloxFiles.endsWith(".md")) = []; % remove Markdown documents ___ -[home](index.md) :house: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/changelog.md b/tbx/docmakerdoc/changelog.md index 994aa74..f838977 100644 --- a/tbx/docmakerdoc/changelog.md +++ b/tbx/docmakerdoc/changelog.md @@ -1,5 +1,11 @@ # Release notes +## Version 0.9.0 + +* Added support for local Markdown conversion using [cmark-gfm](https://github.com/github/cmark-gfm) and [gemoji](https://github.com/github/gemoji) +* Added `Converter` option to `docconvert`, `docindex`, and `DocMakerTask`: `cmark` (default), `github` (GitHub.com), or `gitlab` (GitLab.com) +* Removed support for private GitHub and GitLab instances + ## Version 0.8.0 * Added support for LaTeX expressions using [MathJax](https://www.mathjax.org/) via the `Interpreter="latex"` option in `docconvert` @@ -23,4 +29,4 @@ ___ -:copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +:copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/conversion.md b/tbx/docmakerdoc/conversion.md index 07413e1..5ad90cb 100644 --- a/tbx/docmakerdoc/conversion.md +++ b/tbx/docmakerdoc/conversion.md @@ -1,76 +1,31 @@ # Markdown conversion -DocMaker supports conversion from Markdown to HTML using services from GitHub and GitLab. +## cmark-gfm -## GitHub +DocMaker uses [cmark-gfm](https://github.com/github/cmark-gfm) to convert Markdown to HTML. cmark-gfm is GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C. Emoji support is included by [gemoji](https://github.com/github/gemoji). The converter is bundled with the toolbox, works offline, and supports all platforms (Windows x64, Linux x86-64, Intel macOS, and Apple Silicon macOS). -By default, DocMaker converts Markdown to HTML using the [GitHub Markdown API](https://docs.github.com/en/rest/markdown). +*cmark-gfm is the default converter, and is strongly recommended. It's faster :rocket: than hosted services, and your content stays local :lock:.* -You can use `api.github.com` or your own private instance. To override the default GitHub hostname: +## GitHub Markdown API -1. set the environment variable `DOCMAKER_GITHUB_HOSTNAME` (recommended for build runners :infinity:), or -2. set the preference `github_hostname` in the group `docmaker` (recommended for local machines :computer:) +DocMaker also supports [GitHub Markdown API](https://docs.github.com/en/rest/markdown) to convert Markdown to HTML using GitHub's rendering engine. -Requests to this service are rate limited, and [authenticated requests](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api) get a higher limit. To authenticate, [generate a GitHub access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) (with no permissions), and register the token with MATLAB: +GitHub rate-limits API requests, and authenticated requests have a higher limit. A GitHub access token with no permissions is sufficient. To authenticate, set the MATLAB secret `DOCMAKER_GITHUB_TOKEN` or the environment variable of the same name. Use secrets for local development on R2024a and later, and environment variables for build runners and earlier MATLAB versions. Without a token, requests are anonymous. -1. set the environment variable `DOCMAKER_GITHUB_TOKEN` (recommended for build runners :infinity:), or -2. set the secret `DocMaker GitHub token` (recommended for local machines :computer: from R2024a), or -3. set the preference `github_hostname` in the group `docmaker` (recommended for local machines :computer: prior to R2024a) +GitHub Markdown API requires network access and sends document contents to GitHub. See the [GitHub API terms of service](https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#h-api-terms) and [privacy statement](https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement) for further information. -See the [GitHub API terms of service](https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#h-api-terms) and [privacy statement](https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement) for further information. +The GitHub Markdown API supports GitHub.com only; private GitHub instances are not supported. -## GitLab +## GitLab Markdown API -As an alternative, DocMaker can convert Markdown to HTML using the [GitLab Markdown API](https://docs.gitlab.com/api/markdown/). +DocMaker also supports the [GitLab Markdown API](https://docs.gitlab.com/api/markdown/) to convert Markdown to HTML using GitLab's rendering engine. -To use GitLab for Markdown conversion: +The GitLab Markdown API requires authentication. A GitLab access token with `api` scope is sufficient. To authenticate, set the MATLAB Secret `DOCMAKER_GITLAB_TOKEN` or the environment variable of the same name. Use secrets for local development on R2024a and later, and environment variables for build runners and earlier MATLAB versions. -1. set the environment variable `DOCMAKER_CONVERTER` (recommended for build runners :infinity:), or -2. set the preference `converter` in the group `docmaker` (recommended for local machines :computer:) +The GitLab Markdown API requires network access and sends document contents to GitLab. See the [GitLab API terms of use](https://handbook.gitlab.com/handbook/legal/api-terms/) and [privacy statement](https://about.gitlab.com/privacy/) for further information. -You can use `gitlab.com` or your own private instance. To override the default GitLab hostname: - -1. set the environment variable `DOCMAKER_GITLAB_HOSTNAME` (recommended for build runners :infinity:), or -2. set the preference `gitlab_hostname` in the group `docmaker` (recommended for local machines :computer:) - -Requests to this service require [authentication](https://docs.gitlab.com/api/rest/authentication/). To authenticate, [generate a GitLab access token](https://docs.gitlab.com/user/profile/personal_access_tokens/) (with API permissions), and register the token with MATLAB: - -1. set the environment variable `DOCMAKER_GITLAB_TOKEN` (recommended for build runners :infinity:), or -2. set the secret `DocMaker GitLab token` (recommended for local machines :lock: from R2024a), or -3. set the preference `gitlab_hostname` in the group `docmaker` (recommended for local machines :unlock: prior to R2024a) - -See the [GitLab API terms of use](https://handbook.gitlab.com/handbook/legal/api-terms/) and [privacy statement](https://about.gitlab.com/privacy/) for further information. - -## Example - -You can configure your local machine to use your own private GitLab instance to convert Markdown to HTML with: - -```matlab -setpref("docmaker","converter","GitLab") % use GitLab -setpref("docmaker","gitlab_hostname","gitlab.acme.com") % your GitLab -setSecret("DocMaker GitLab token") % and enter your token -``` - -You can debug your DocMaker converter settings using `docmaker.converter` :test_tube:: - -```matlab -docmaker.converter -``` - -## Summary - -You can use various settings mechanisms to control the converter technology, service instance, and authentication: - -| Description | Environment variable :infinity: | Secret :computer::lock: | Preference :computer::unlock: | Default | -| --- | --- | --- | --- | --- | -| converter | `DOCMAKER_CONVERTER` | `DocMaker converter` | `converter` | `GitHub` | -| GitHub hostname | `DOCMAKER_GITHUB_HOSTNAME` | `DocMaker GitHub hostname` | `github_hostname` | `api.github.com` | -| GitHub access token | `DOCMAKER_GITHUB_TOKEN` | `DocMaker GitHub token` | `github_token` | | -| GitLab hostname | `DOCMAKER_GITLAB_HOSTNAME` | `DocMaker GitLab hostname` | `gitlab_hostname` | `gitlab.com` | -| GitLab access token | `DOCMAKER_GITLAB_TOKEN` | `DocMaker GitLab token` | `gitlab_token` | | - -Use environment variables for build runners, secrets for tokens on local computers, and preferences for non-sensitive data on local computers. In case of conflict, environment variables trump secrets, which trump preferences. +The GitLab Markdown API supports GitLab.com only; private GitLab instances are not supported. ___ -[home](index.md) :house: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [build](DocMakerTask.md) :factory: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/docconvert.md b/tbx/docmakerdoc/docconvert.md index 6158fcb..70321e9 100644 --- a/tbx/docmakerdoc/docconvert.md +++ b/tbx/docmakerdoc/docconvert.md @@ -8,15 +8,17 @@ Convert Markdown documents to HTML Multiple documents may also be specified using `docconvert(md1,md2,...)`. -`docconvert(...,"Theme",t)` sets the theme `t`. Available themes are `light`, `dark`, and `auto` (responsive, default). For viewing as part of the MATLAB documentation, especially prior to R2025a, light mode works best. For viewing standalone, responsive mode works well. +`docconvert(...,"Theme",t)` sets the theme `t`. Available themes are `light`, `dark`, and `auto` (responsive, default). For viewing as part of the MATLAB documentation, especially prior to R2025a, light mode works best. For viewing standalone, responsive mode works well. `docconvert(...,"Stylesheets",css)` includes the stylesheet(s) `css`. -`docconvert(...,"Scripts",js)` includes the script(s) `js`. Scripts are included at the end of the body in the order specified to ensure that the HTML content is loaded and rendered before the scripts run. :test_tube: +`docconvert(...,"Scripts",js)` includes the script(s) `js`. Scripts are included at the end of the body in the order specified to ensure that the HTML content is loaded and rendered before the scripts run. :test_tube: -`docconvert(...,"Root",r)` publishes to the root folder `r`, placing stylesheets and scripts in the subfolder `resources`. The root folder must be a common ancestor of the Markdown documents. If not specified, the root folder is the lowest common ancestor. +`docconvert(...,"Root",r)` publishes to the root folder `r`, placing stylesheets and scripts in the subfolder `resources`. The root folder must be a common ancestor of the Markdown documents. If not specified, the root folder is the lowest common ancestor. -`docconvert(...,"Interpreter",in)` uses the text interpreter in. Available interpreters are "latex" (LaTeX markup) and "none" (literal text, default). Use single dollar signs `$...$` to display equations inline, and double dollar signs `$$...$$` to display equations on their own line, centered. +`docconvert(...,"Interpreter",in)` uses the text interpreter `in`. Available interpreters are `latex` (LaTeX) and `none` (literal text, default). Use single dollar signs `$...$` to display equations inline, and double dollar signs `$$...$$` to display equations centered on their own line. + +`docconvert(...,"Converter",c)` uses the Markdown converter `c`. Available converters are `cmark` (bundled cmark-gfm, default), `github` (GitHub Markdown API on GitHub.com), and `gitlab` (GitLab Markdown API on GitLab.com). See [Markdown conversion](conversion.md) for converter details, setup, platform support, and version details. `[html,res] = docconvert(...)` returns the names of the HTML document(s) `html` and the resources folder `res` created. @@ -28,6 +30,7 @@ Multiple documents may also be specified using `docconvert(md1,md2,...)`. | `js`:arrow_right: | JavaScript script(s), as an absolute or relative path; wildcards are [supported](https://www.mathworks.com/help/matlab/ref/dir.html#bsnswnx-1-name) | string(s) | :test_tube: | | `r`:arrow_right: | root folder, as an absolute or relative path; default is the lowest common ancestor of `md` | string | | | `in`:arrow_right: | text interpreter: `latex` or `none`; default is `none` | string | | +| `c`:arrow_right: | Markdown converter: `cmark`, `github`, or `gitlab`; default is `cmark` | string | | | :arrow_right:`html` | HTML document(s) created, as an absolute path | string(s) | | | :arrow_right:`res` | resources folder created, as an absolute path | string | | @@ -36,7 +39,7 @@ Multiple documents may also be specified using `docconvert(md1,md2,...)`. ```matlab docconvert("mickey/pluto.md") ``` -converts a single Markdown document `mickey/pluto.md` to HTML `mickey/pluto.html`. Note that this path is *relative*. +converts a single Markdown document `mickey/pluto.md` to HTML `mickey/pluto.html`. Note that this path is *relative*. ```matlab docconvert("C:\daisy\mickey\pluto.md") @@ -79,7 +82,7 @@ sets the root folder to `mickey`, rather than the lowest common ancestor `mickey The conversion consists of 7 steps: 1. Read the Markdown document -2. Convert Markdown to an HTML fragment using the [GitHub Markdown API](https://docs.github.com/en/rest/markdown) service +2. Convert Markdown to an HTML fragment 3. Tidy up the HTML fragment in preparation for XML postprocessing 4. Replace `.md` links in the fragment to `.html` -- Markdown links to Markdown, HTML links to HTML 5. Build an HTML document around the HTML fragment @@ -101,14 +104,14 @@ h2 { Since cascading stylesheets [*cascade*](https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade), later styles override earlier styles. -This feature depends on reverse-engineering the HTML generated by the [GitHub Markdown API](https://docs.github.com/en/rest/markdown) service, although much of the behavior is obvious. +Default styling follows the HTML structure generated by cmark-gfm. ### Postprocessing -Generated HTML may be postprocessed in the browser using JavaScript. Postprocessing code may be included by specifying the optional input `Scripts`. Scripts are included at the end of the body in the order specified to ensure that the HTML content is loaded and rendered before the scripts run. +Generated HTML may be postprocessed in the browser using JavaScript. Postprocessing code may be included by specifying the optional input `Scripts`. Scripts are included at the end of the body in the order specified to ensure that the HTML content is loaded and rendered before the scripts run. This feature is experimental :test_tube: and may be removed in a future version. ___ -[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [build](DocMakerTask.md) :factory: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/docdelete.md b/tbx/docmakerdoc/docdelete.md index 12ef96b..00e5eb9 100644 --- a/tbx/docmakerdoc/docdelete.md +++ b/tbx/docmakerdoc/docdelete.md @@ -19,7 +19,7 @@ Delete generated artifacts ```matlab docdelete("mickey/goofy") ``` -deletes artifacts in the folder `mickey/goofy`. Note that this path is *relative*. +deletes artifacts in the folder `mickey/goofy`. Note that this path is *relative*. ```matlab docconvert("C:\daisy\mickey\goofy") @@ -36,4 +36,4 @@ The deletion consists of 4 steps: ___ -[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [build](DocMakerTask.md) :factory: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/docindex.md b/tbx/docmakerdoc/docindex.md index 832b8c9..9629cd9 100644 --- a/tbx/docmakerdoc/docindex.md +++ b/tbx/docmakerdoc/docindex.md @@ -6,11 +6,14 @@ Create documentation index files `docindex(d)` creates documentation index files `info.xml` and `helptoc.xml` and search database `helpsearch_v4` in the folder `d`. +`docindex(...,"Converter",c)` uses the Markdown converter `c` to convert `helptoc.md`. Available converters are `cmark` (bundled cmark-gfm, default), `github` (GitHub Markdown API on GitHub.com), and `gitlab` (GitLab Markdown API on GitLab.com). See [Markdown conversion](conversion.md) for converter details, setup, platform support, and version details. + `[xml,db] = docindex(...)` returns the names of the index files `xml` and search database folder `db` created. | Name | Description | Type | Required | | :-: | --- | :-: | :-: | | `d`:arrow_right: | documentation folder, as an absolute or relative path | string | yes | +| `c`:arrow_right: | Markdown converter: `cmark`, `github`, or `gitlab`; default is `cmark` | string | | | :arrow_right:`xml` | index files created, as an absolute path | strings | | | :arrow_right:`db` | search database folder created, as an absolute path | string | | @@ -19,7 +22,7 @@ Create documentation index files ```matlab docindex("mickey/goofy") ``` -indexes documentation in the folder `mickey/goofy`. Note that this path is *relative*. +indexes documentation in the folder `mickey/goofy`. Note that this path is *relative*. ```matlab docindex("C:\daisy\mickey\goofy") @@ -30,7 +33,7 @@ also indexes documentation, this time specified using an *absolute* path. ### `info.xml` and `helptoc.xml` -`info.xml` enables MATLAB to find and identify your HTML help files. `helptoc.xml` contains the table of contents for your documentation that is displayed in the Contents sidebar of the Help browser. The MATLAB documentation contains [further details](https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.html), that you do not need to know about anymore once you are generating rather than hand-writing these files. +`info.xml` enables MATLAB to find and identify your HTML help files. `helptoc.xml` contains the table of contents for your documentation that is displayed in the Contents sidebar of the Help browser. The MATLAB documentation contains [further details](https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.html), that you do not need to know about anymore once you are generating rather than hand-writing these files. ### Table of contents requirements @@ -49,7 +52,7 @@ For example: * [Dewey](dewey.md) ``` -If you need a list item to group child items, specify an empty link URL, e.g. `* [Function reference]()`. Other content in `helptoc.md` -- including additional links and normal text in list items -- is ignored. +If you need a list item to group child items, specify an empty link URL, e.g. `* [Function reference]()`. Other content in `helptoc.md` -- including additional links and normal text in list items -- is ignored. ### Steps @@ -65,4 +68,4 @@ The indexing consists of 4 steps: ___ -[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [build](DocMakerTask.md) :factory: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/docrun.md b/tbx/docmakerdoc/docrun.md index 31ee469..7aad912 100644 --- a/tbx/docmakerdoc/docrun.md +++ b/tbx/docmakerdoc/docrun.md @@ -8,11 +8,11 @@ Run MATLAB code in HTML documents and insert output Multiple documents may also be specified using `docrun(html1,html2,...)`. -`docrun(...,"Level",n)` specifies the batching level `n`. With level 0 (default), all blocks in a document are run in a single batch. With level `n`, each level-n heading is run as a separate batch, with the workspace cleared and figures closed between batches. With level 7, each block is run as a separate batch. +`docrun(...,"Level",n)` specifies the batching level `n`. With level 0 (default), all blocks in a document are run in a single batch. With level `n`, each level-n heading is run as a separate batch, with the workspace cleared and figures closed between batches. With level 7, each block is run as a separate batch. -`docrun(...,"FigureSize",s)` sets the default figure size `s`. Size is `[width height]` in default figure `Units`. +`docrun(...,"FigureSize",s)` sets the default figure size `s`. Size is `[width height]` in default figure `Units`. -`docrun(...,"Theme",t)` sets the theme `t`. Available themes are `none` (as is, default), `light`, `dark`, and `auto` (responsive). For viewing as part of the MATLAB documentation, especially prior to R2025a, light mode works best. For viewing standalone, responsive mode works well. +`docrun(...,"Theme",t)` sets the theme `t`. Available themes are `none` (as is, default), `light`, `dark`, and `auto` (responsive). For viewing as part of the MATLAB documentation, especially prior to R2025a, light mode works best. For viewing standalone, responsive mode works well. `html = docrun(...)` returns the names of the HTML document(s) modified. @@ -29,7 +29,7 @@ Multiple documents may also be specified using `docrun(html1,html2,...)`. ```matlab docrun("mickey/pluto.html") ``` -processes a single HTML document `mickey/pluto.html`. Note that this path is *relative*. +processes a single HTML document `mickey/pluto.html`. Note that this path is *relative*. ```matlab docrun("C:\daisy\mickey\pluto.html") @@ -59,12 +59,12 @@ generates output in light mode. ```matlab docrun("mickey/pluto.html","Theme","auto") ``` -generates responsive output -- light in light mode, dark in dark mode. If `Theme` is not specified -- or is specified as `none` -- then output is generated in the current MATLAB mode. +generates responsive output -- light in light mode, dark in dark mode. If `Theme` is not specified -- or is specified as `none` -- then output is generated in the current MATLAB mode. ```matlab docrun("mickey/pluto.html","FigureSize",[600 400]) ``` -sets the default figure size to 600 wide by 400 high. The previous default figure size is restored when `docrun` completes. +sets the default figure size to 600 wide by 400 high. The previous default figure size is restored when `docrun` completes. ## Description @@ -83,7 +83,7 @@ Each run consists of 6 steps: ### Including MATLAB code -You can include MATLAB [code blocks](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks) in Markdown documents using ` ```matlab `. The raw Markdown looks like: +You can include MATLAB [code blocks](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks) in Markdown documents using ` ```matlab `. The raw Markdown looks like: ```` ```matlab @@ -103,11 +103,11 @@ plot(x,sin(x)) ### Executing MATLAB code -`docrun` runs arbitrary MATLAB code blocks in HTML documents. This is a potential vector for malicious attacks. **Only run code from people or organizations you trust.** +`docrun` runs arbitrary MATLAB code blocks in HTML documents. This is a potential vector for malicious attacks. **Only run code from people or organizations you trust.** -`docrun` evaluates each code block in turn in a MATLAB [workspace](workspace.md) that is *private* to the document. Variables created in earlier blocks are available for use in later blocks. +`docrun` evaluates each code block in turn in a MATLAB [workspace](workspace.md) that is *private* to the document. Variables created in earlier blocks are available for use in later blocks. -If an error occurs in one block then `docrun` rethrows the error as a warning (identifier `docmaker:EvalError`) and moves on to the next block. However, it is likely that an error in an earlier block will lead to further errors in later blocks. +If an error occurs in one block then `docrun` rethrows the error as a warning (identifier `docmaker:EvalError`) and moves on to the next block. However, it is likely that an error in an earlier block will lead to further errors in later blocks. If you wish to display *but not evaluate* MATLAB code, add trailing whitespace to the last line of the code block, and `docrun` will leave it be. @@ -136,14 +136,14 @@ Error messages are also inserted, with the offending statement indicated. m = magick(4) ``` -`docrun` inserts MATLAB outputs into HTML documents in `
`s with `class` `highlight-output-matlab`. Previous outputs are removed. +`docrun` inserts MATLAB outputs into HTML documents in `
`s with `class` `highlight-output-matlab`. Previous outputs are removed. ### Display scaling Display scaling is a feature that adjusts the size of elements on screen to ensure they are easily readable and usable, regardless of the resolution of your display. This is particularly useful for high-resolution displays, where elements can appear too small to see comfortably at the native resolution. -`docrun` uses `getframe` to capture screenshots. `getframe` captures screenshots using native resolution, to maximize quality. In versions prior to 0.4, this led to inconsistencies in image sizes between applications and machines. From version 0.4, `docrun` includes scaled image sizes in the generated HTML. +`docrun` uses `getframe` to capture screenshots. `getframe` captures screenshots using native resolution, to maximize quality. In versions prior to 0.4.0, this led to inconsistencies in image sizes between applications and machines. From version 0.4.0, `docrun` includes scaled image sizes in the generated HTML. ___ -[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [build](DocMakerTask.md) :factory: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/helptoc.md b/tbx/docmakerdoc/helptoc.md index 8750986..2b5b8a7 100644 --- a/tbx/docmakerdoc/helptoc.md +++ b/tbx/docmakerdoc/helptoc.md @@ -2,15 +2,15 @@ * [DocMaker](index.md) * [Release notes](changelog.md) - * [Markdown conversion](conversion.md) - * [Build automation](automation.md) - * [DocMakerTask](DocMakerTask.md) * [Function reference](api.md) * [docconvert](docconvert.md) * [docrun](docrun.md) * [docindex](docindex.md) * [docdelete](docdelete.md) + * [DocMakerTask](DocMakerTask.md) * [docmaker.Workspace](workspace.md) + * [Build automation](automation.md) + * [Markdown conversion](conversion.md) * [About DocMaker](about.md) * [Licenses](license.md) diff --git a/tbx/docmakerdoc/index.md b/tbx/docmakerdoc/index.md index ae4b155..fcd3f9b 100644 --- a/tbx/docmakerdoc/index.md +++ b/tbx/docmakerdoc/index.md @@ -7,37 +7,29 @@ With DocMaker, you can: * run MATLAB code blocks in documents and include textual and graphical output * create MATLAB documentation index files from a Markdown table of contents -This is DocMaker version 0.8. The [release notes](changelog.md) detail new features, bug fixes, and compatibility considerations for each version. +This is DocMaker version 0.9.0. The [release notes](changelog.md) detail new features, bug fixes, and compatibility considerations for each version. ## Getting started ### System requirements -DocMaker requires [MATLAB](https://www.mathworks.com/support/requirements/matlab-system-requirements.html) R2021a or later to *generate* documentation. +DocMaker requires [MATLAB](https://www.mathworks.com/support/requirements/matlab-system-requirements.html) R2021a or later, and runs on all supported platforms: Windows x64, Linux x86-64, Intel macOS, and Apple Silicon macOS. -[`docconvert`](docconvert.md) and [`docindex`](docindex.md) require network access to a GitHub or GitLab instance to process Markdown documents and generate DocMaker artifacts. - -Documentation generated by DocMaker can be *viewed* in much older releases of MATLAB, and offline. +Documentation generated by DocMaker can be *viewed* in much older releases of MATLAB. ### Installation -DocMaker is distributed as a MATLAB toolbox file (`.mltbx`). See the MATLAB documentation for [instructions](https://www.mathworks.com/help/matlab/matlab_prog/create-and-share-custom-matlab-toolboxes.html) on installing and uninstalling toolboxes. - -By default, DocMaker uses the GitHub Markdown API at `api.github.com` to convert Markdown to HTML. You can [configure Markdown conversion](conversion.md) to: - -* use another converter technology -* use another service instance -* authenticate with an access token. +DocMaker is distributed as a MATLAB toolbox file (`.mltbx`). See the MATLAB documentation for [instructions](https://www.mathworks.com/help/matlab/matlab_prog/create-and-share-custom-matlab-toolboxes.html) on installing and uninstalling toolboxes. ## Working with DocMaker ### Writing documentation -Write documentation in Markdown using your favorite editor. Include code, images, and links. You can use the DocMaker documentation as inspiration for your own documentation! +Write documentation in Markdown using your favorite editor. Include code, images, and links. You can use the DocMaker documentation as inspiration for your own documentation! -Include MATLAB code blocks using ` ```matlab ` fenced code blocks. Typically, you want to evaluate MATLAB code blocks and insert the output into the documentation. To designate a MATLAB code block as for *display only*, not evaluation, add trailing whitespace to the last line. +Include MATLAB code blocks using ` ```matlab ` fenced code blocks. Typically, you want to evaluate MATLAB code blocks and insert the output into the documentation. To designate a MATLAB code block as for *display only*, not evaluation, add trailing whitespace to the last line. -Write a table of contents called `helptoc.md`, also in Markdown. This document should contain: +Write a table of contents called `helptoc.md`, also in Markdown. This document should contain: * a level-1 heading `# Heading` with the name of the toolbox * a nested list of links to your Markdown documents @@ -52,11 +44,11 @@ For example: * [Dewey](dewey.md) ``` -If you need a list item to group child items, specify an empty link URL, e.g. `* [Function reference]()`. Other content in `helptoc.md` -- including additional links and normal text in list items -- is ignored by but harmless to [`docindex`](docindex.md). +If you need a list item to group child items, specify an empty link URL, e.g. `* [Function reference]()`. Other content in `helptoc.md` -- including additional links and normal text in list items -- is ignored by but harmless to [`docindex`](docindex.md). ### Publishing documentation -First, use [`docconvert`](docconvert.md) to convert your Markdown documents to HTML. Next, use [`docrun`](docrun.md) to run MATLAB code blocks in the HTML documents and insert textual and graphical output. Finally, use [`docindex`](docindex.md) to generate documentation index files. Here is a complete example, to generate the DocMaker documentation: +First, use [`docconvert`](docconvert.md) to convert your Markdown documents to HTML. Next, use [`docrun`](docrun.md) to run MATLAB code blocks in the HTML documents and insert textual and graphical output. Finally, use [`docindex`](docindex.md) to generate documentation index files. Here is a complete example, to generate the DocMaker documentation: ```matlab docconvert tbx/docmakerdoc/**/*.md @@ -72,4 +64,4 @@ You can incorporate documentation into your software delivery pipeline by integr ___ -[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [build](DocMakerTask.md) :factory: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/license.md b/tbx/docmakerdoc/license.md index bb221c9..b8939ef 100644 --- a/tbx/docmakerdoc/license.md +++ b/tbx/docmakerdoc/license.md @@ -1,38 +1,241 @@ # Licenses -This software is licensed under a **BSD license**: +This software is licensed under the **modified BSD license**: ``` -Copyright (c) 2024, The MathWorks, Inc. -All rights reserved. +Copyright 2024-2026 The MathWorks, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS +IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` + +## Third-party licenses + +[cmark-gfm](https://github.com/github/cmark-gfm) is licensed under the **simplified BSD License**: + +``` +Copyright (c) 2014, John MacFarlane + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the distribution - * Neither the name of the The MathWorks, Inc. nor the names - of its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +----- + +houdini.h, houdini_href_e.c, houdini_html_e.c, houdini_html_u.c + +derive from https://github.com/vmg/houdini (with some modifications) + +Copyright (C) 2012 Vicent Martí + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +----- + +buffer.h, buffer.c, chunk.h + +are derived from code (C) 2012 Github, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +----- + +utf8.c and utf8.c + +are derived from utf8proc +(), +(C) 2009 Public Software Group e. V., Berlin, Germany. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +----- + +The normalization code in normalize.py was derived from the +markdowntest project, Copyright 2013 Karl Dubost: + +The MIT License (MIT) + +Copyright (c) 2013 Karl Dubost + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +----- + +The CommonMark spec (test/spec.txt) is + +Copyright (C) 2014-15 John MacFarlane + +Released under the Creative Commons CC-BY-SA 4.0 license: +. + +----- + +The test software in test/ is + +Copyright (c) 2014, John MacFarlane + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ``` -## Third-party licenses +[gemoji](https://github.com/github/gemoji) is licensed under the **MIT License**: + +``` +Copyright (c) 2019 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. +``` [github-markdown-css](https://github.com/sindresorhus/github-markdown-css) is licensed under the **MIT License**: @@ -41,21 +244,21 @@ MIT License Copyright (c) Sindre Sorhus (https://sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` @@ -267,4 +470,4 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ___ -:copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +:copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tbx/docmakerdoc/workspace.md b/tbx/docmakerdoc/workspace.md index c6abfdc..1562040 100644 --- a/tbx/docmakerdoc/workspace.md +++ b/tbx/docmakerdoc/workspace.md @@ -36,7 +36,7 @@ Private workspace for assigning variables and evaluating expressions `evalin(w,s)` evaluates the statement(s) `s` in the workspace `w`. -`[o1,o2,...] = evalin(w,s)` evaluates the statement `s` in the workspace `w`, and returns the outputs `o1`, `o2`, etc. It is not possible to return outputs from multiple statements or assignments. +`[o1,o2,...] = evalin(w,s)` evaluates the statement `s` in the workspace `w`, and returns the outputs `o1`, `o2`, etc. It is not possible to return outputs from multiple statements or assignments. `c = evalinc(w,s)` evaluates the statement(s) `s` in the workspace `w`, and returns the command window output `c`. @@ -138,10 +138,10 @@ w2 ## Details -`docmaker.Workspace` extends [`assignin`](https://www.mathworks.com/help/matlab/ref/assignin.html) and [`evalin`](https://www.mathworks.com/help/matlab/ref/evalin.html) from `base` and `caller` to workspace *objects*. `docmaker.Workspace` also adds `evalinc` -- "`evalin` with capture". `evalin` is to `evalinc` as [`eval`](https://www.mathworks.com/help/matlab/ref/eval.html) is to [`evalc`](https://www.mathworks.com/help/matlab/ref/evalc.html). +`docmaker.Workspace` extends [`assignin`](https://www.mathworks.com/help/matlab/ref/assignin.html) and [`evalin`](https://www.mathworks.com/help/matlab/ref/evalin.html) from `base` and `caller` to workspace *objects*. `docmaker.Workspace` also adds `evalinc` -- "`evalin` with capture". `evalin` is to `evalinc` as [`eval`](https://www.mathworks.com/help/matlab/ref/eval.html) is to [`evalc`](https://www.mathworks.com/help/matlab/ref/evalc.html). `docmaker.Workspace` was previously a standalone implementation, first implemented 20 years ago, but now uses `matlab.lang.internal.WorkspaceData` :heart:. ___ -[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 \ No newline at end of file +[home](index.md) :house: | [convert](docconvert.md) :arrow_right: | [run](docrun.md) :runner: | [index](docindex.md) :scroll: | [delete](docdelete.md) :recycle: | [build](DocMakerTask.md) :factory: | [workspace](workspace.md) :construction_worker: | [about](about.md) :hatching_chick: | :copyright: [MathWorks](https://www.mathworks.com/services/consulting.html) 2024-2026 diff --git a/tests/Example.md b/tests/Example.md index f53fdda..e88e015 100644 --- a/tests/Example.md +++ b/tests/Example.md @@ -2,4 +2,4 @@ ```matlab x = magic( 5 ) -``` \ No newline at end of file +``` diff --git a/tests/ImageTest.md b/tests/ImageTest.md index d2004e7..e2bfb94 100644 --- a/tests/ImageTest.md +++ b/tests/ImageTest.md @@ -1,6 +1,6 @@ -# Image Rendering Test +# Image Conversion Test -This page tests whether DocMaker correctly renders images in the MATLAB Help Browser. +This fixture checks that DocMaker preserves standard Markdown image URLs and alternative text. ## Inline Image @@ -10,5 +10,4 @@ Here is an image referenced with standard markdown syntax: ## Text After Image -If you can see the image above, rendering is working correctly. -If the image is invisible or broken, it confirms the lazy-loading bug. +The generated HTML should keep the image URL and alternative text. diff --git a/tests/LaTeXExample.md b/tests/LaTeXExample.md index 2a12a38..cdfb28d 100644 --- a/tests/LaTeXExample.md +++ b/tests/LaTeXExample.md @@ -6,4 +6,4 @@ $$ \int_{-\infty}^\infty f(x) dx = 1 $$ $$ \Phi = \frac{\dot{m}_{th} + \dot{m}}{2} ht_{in} - \frac{\dot{m}_{th} - \dot{m}}{2} ht_{out} $$ -The cost was $2.00. \ No newline at end of file +The cost was $2.00. diff --git a/tests/helptoc.md b/tests/helptoc.md index 98d274a..90ba72e 100644 --- a/tests/helptoc.md +++ b/tests/helptoc.md @@ -1,3 +1,3 @@ # MATLAB DocMaker Tests -* [Example](Example.md) \ No newline at end of file +* [Example](Example.md) diff --git a/tests/tDocMaker.m b/tests/tDocMaker.m index 8c1fc2d..e646bd7 100644 --- a/tests/tDocMaker.m +++ b/tests/tDocMaker.m @@ -1,5 +1,7 @@ classdef tDocMaker < matlab.unittest.TestCase - %TDOCMAKER Infrastructure for DocMaker tests. + %tDocMaker Infrastructure for DocMaker tests. + % + % Copyright 2026 The MathWorks, Inc. properties ( Access = protected ) % Temporary folder. @@ -42,4 +44,4 @@ function copyExampleMarkdownFiles( testCase ) end % methods ( TestMethodSetup ) -end % classdef \ No newline at end of file +end % classdef diff --git a/tests/tDocMakerTask.m b/tests/tDocMakerTask.m index ee9c428..c5678fd 100644 --- a/tests/tDocMakerTask.m +++ b/tests/tDocMakerTask.m @@ -1,9 +1,11 @@ classdef tDocMakerTask < matlab.unittest.TestCase - %TDOCMAKERTASK Tests for DocMakerTask. + %tDocMakerTask Tests for DocMakerTask. + % + % Copyright 2026 The MathWorks, Inc. properties ( Access = private ) % Custom build task. - Task(:, 1) matlab.buildtool.Task {mustBeScalarOrEmpty} + Task {mustBeScalarOrEmpty} % matlab.buildtool.Task, but this fails before R2022b % Tests folder. TestsFolder(:, 1) string {mustBeFolder, mustBeScalarOrEmpty} % Test file name. @@ -72,9 +74,28 @@ function tTaskArgumentsAreSetCorrectly( testCase ) fc( ind ), ... "The task output search index folder was not set " + ... "correctly." ) + testCase.verifyEqual( testCase.Task.Converter, "cmark" ) end % tTaskArgumentsAreSetCorrectly + function tTaskAcceptsGithubConverter( testCase ) + + md = fullfile( testCase.TestsFolder, testCase.TestFile ); + task = DocMakerTask( md, "Converter", "github" ); + + testCase.verifyEqual( task.Converter, "github" ) + + end % tTaskAcceptsGithubConverter + + function tTaskAcceptsGitlabConverter( testCase ) + + md = fullfile( testCase.TestsFolder, testCase.TestFile ); + task = DocMakerTask( md, "Converter", "gitlab" ); + + testCase.verifyEqual( task.Converter, "gitlab" ) + + end % tTaskAcceptsGitlabConverter + function tExecutingTaskIsWarningFree( testCase ) taskRunner = @() testCase.Task.buildDoc(); @@ -101,4 +122,4 @@ function tExecutingTaskIsWarningFree( testCase ) end % methods ( Test ) -end % classdef \ No newline at end of file +end % classdef diff --git a/tests/tGitLab.m b/tests/tGitLab.m deleted file mode 100644 index 2d11e74..0000000 --- a/tests/tGitLab.m +++ /dev/null @@ -1,106 +0,0 @@ -classdef tGitLab < matlab.unittest.TestCase - %TGITLAB Tests for GitLab Markdown conversion helpers. - - methods ( Test ) - - function tCleanGitLabImagesUsesDataSource( testCase ) - - doc = parseXml( "
" ); - - docmaker.cleanGitLabImages( doc ) - - img = doc.getElementsByTagName( "img" ).item( 0 ); - testCase.verifyEqual( ... - string( img.getAttribute( "src" ) ), ... - "images/ImageTest.png", ... - "GitLab data-src was not promoted to src." ) - testCase.verifyFalse( img.hasAttribute( "data-src" ), ... - "GitLab data-src attribute was not removed." ) - testCase.verifyFalse( img.hasAttribute( "class" ), ... - "GitLab lazy class was not removed." ) - testCase.verifyFalse( img.hasAttribute( "decoding" ), ... - "GitLab async decoding attribute was not removed." ) - - end % tCleanGitLabImagesUsesDataSource - - function tCleanGitLabImagesPreservesOtherAttributes( testCase ) - - doc = parseXml( "
" ); - - docmaker.cleanGitLabImages( doc ) - - img = doc.getElementsByTagName( "img" ).item( 0 ); - testCase.verifyEqual( ... - string( img.getAttribute( "class" ) ), "border", ... - "Non-lazy image classes were not preserved." ) - testCase.verifyEqual( ... - string( img.getAttribute( "alt" ) ), "Cluster State", ... - "Image alt text was not preserved." ) - testCase.verifyEqual( ... - string( img.getAttribute( "data-sourcepos" ) ), ... - "1:1-1:39", ... - "GitLab source position metadata was not preserved." ) - - end % tCleanGitLabImagesPreservesOtherAttributes - - function tGitLabImageFixtureIsRenderable( testCase ) - - markdownFile = fullfile( fixtureFolder(), "ImageTest.md" ); - markdown = string( fileread( markdownFile ) ); - testCase.verifyTrue( contains( markdown, ... - "![Cluster State](ImageTest.png)" ), ... - "The GitLab image bug fixture lost its image reference." ) - - doc = parseXml( "

" ); - - docmaker.cleanGitLabImages( doc ) - - img = doc.getElementsByTagName( "img" ).item( 0 ); - testCase.verifyEqual( ... - string( img.getAttribute( "src" ) ), ... - "ImageTest.png", ... - "Cleaned GitLab image output should be renderable." ) - testCase.verifyFalse( img.hasAttribute( "data-src" ), ... - "Cleaned GitLab image output should not use data-src." ) - testCase.verifyFalse( img.hasAttribute( "class" ), ... - "Cleaned GitLab image output should not keep lazy class." ) - testCase.verifyFalse( img.hasAttribute( "decoding" ), ... - "Cleaned GitLab image output should not keep decoding." ) - - end % tGitLabImageFixtureIsRenderable - - end % methods ( Test ) - -end % classdef - -function folder = fixtureFolder() -%fixtureFolder Location of the GitLab image bug fixture - -folder = fileparts( mfilename( "fullpath" ) ); - -end % fixtureFolder - -function doc = parseXml( xml ) -%parseXml Parse an XML string into a DOM document - -parser = matlab.io.xml.dom.Parser(); -doc = parser.parseString( xml ); - -end % parseXml diff --git a/tests/tMarkdownConversion.m b/tests/tMarkdownConversion.m new file mode 100644 index 0000000..a64479a --- /dev/null +++ b/tests/tMarkdownConversion.m @@ -0,0 +1,119 @@ +classdef tMarkdownConversion < matlab.unittest.TestCase + %tMarkdownConversion Tests for local Markdown conversion. + % + % Copyright 2026 The MathWorks, Inc. + + methods ( Test ) + + function tConvertsGitHubFlavoredMarkdown( testCase ) + + markdown = strjoin( [ ... + "# GFM"; ... + ""; ... + "| A | B |"; ... + "| --- | --- |"; ... + "| 1 | 2 |"; ... + ""; ... + "~~deleted~~"; ... + ""; ... + "- [ ] pending"; ... + ""; ... + "```matlab"; ... + "x = magic( 5 )"; ... + "```" ], newline ); + doc = docmaker.md2xml( markdown ); + + testCase.verifyEqual( ... + doc.getElementsByTagName( "table" ).getLength(), 1 ) + testCase.verifyEqual( ... + doc.getElementsByTagName( "del" ).getLength(), 1 ) + testCase.verifyEqual( ... + doc.getElementsByTagName( "input" ).getLength(), 1 ) + + pre = doc.getElementsByTagName( "pre" ).item( 0 ); + testCase.verifyEqual( ... + string( pre.getParentNode().getAttribute( "class" ) ), ... + "highlight highlight-source-matlab" ) + testCase.verifyEqual( ... + string( pre.TextContent ), "x = magic( 5 )" ) + + end % tConvertsGitHubFlavoredMarkdown + + function tNormalizesGitHubHtml( testCase ) + + html = strjoin( [ ... + "

GitHub

"; ... + "
" + ... + "
x = 1
"; ... + "
y = 2" + newline() + ...
+                "
"; ... + "
  • task
" ], ... + newline() ); + doc = docmaker.html2xml( html ); + + testCase.verifyEqual( ... + doc.getElementsByTagName( "h1" ).getLength(), 1 ) + testCase.verifyEqual( ... + doc.getElementsByTagName( "input" ).getLength(), 1 ) + + pres = doc.getElementsByTagName( "pre" ); + testCase.verifyTrue( docmaker.hasclass( ... + pres.item( 0 ).getParentNode(), "highlight-source-matlab" ) ) + testCase.verifyTrue( docmaker.hasclass( ... + pres.item( 1 ).getParentNode(), "highlight-source-matlab" ) ) + testCase.verifyEqual( ... + string( doc.getElementsByTagName( "code" ).item( 0 ).TextContent ), ... + "y = 2" ) + + end % tNormalizesGitHubHtml + + function tNormalizesGitLabHtml( testCase ) + + html = strjoin( [ ... + "

" + ... + "

"; ... + "
" + ... + "
" + ...
+                "x = 1
" ], newline() ); + doc = docmaker.html2xml( html ); + docmaker.gitlabfixxml( doc ) + + img = doc.getElementsByTagName( "img" ).item( 0 ); + testCase.verifyEqual( ... + string( img.getAttribute( "src" ) ), "image.png" ) + testCase.verifyFalse( img.hasAttribute( "data-src" ) ) + testCase.verifyFalse( img.hasAttribute( "decoding" ) ) + testCase.verifyEqual( ... + string( img.getAttribute( "class" ) ), "border" ) + testCase.verifyEqual( ... + doc.getElementsByTagName( "a" ).getLength(), 0 ) + + pre = doc.getElementsByTagName( "pre" ).item( 0 ); + codeBlock = pre.getParentNode(); + testCase.verifyTrue( ... + docmaker.hasclass( codeBlock, "highlight" ) ) + testCase.verifyTrue( ... + docmaker.hasclass( codeBlock, "highlight-source-matlab" ) ) + + end % tNormalizesGitLabHtml + + function tConvertsImageMarkdownFixture( testCase ) + + testsFolder = fileparts( mfilename( "fullpath" ) ); + markdownFile = fullfile( testsFolder, "ImageTest.md" ); + markdown = string( fileread( markdownFile ) ); + doc = docmaker.md2xml( markdown ); + + img = doc.getElementsByTagName( "img" ).item( 0 ); + testCase.verifyEqual( ... + string( img.getAttribute( "src" ) ), "ImageTest.png" ) + testCase.verifyEqual( ... + string( img.getAttribute( "alt" ) ), "Cluster State" ) + + end % tConvertsImageMarkdownFixture + + end % methods ( Test ) + +end % classdef diff --git a/tests/tdocconvert.m b/tests/tdocconvert.m index 266f183..d6b8519 100644 --- a/tests/tdocconvert.m +++ b/tests/tdocconvert.m @@ -1,5 +1,7 @@ classdef tdocconvert < tDocMaker - %TDOCCONVERT Tests for docconvert. + %tdocconvert Tests for docconvert. + % + % Copyright 2026 The MathWorks, Inc. methods ( Test ) @@ -49,4 +51,4 @@ function tLaTeXConversionProducesCorrectHTMLFile( testCase ) end % methods ( Test ) -end % classdef \ No newline at end of file +end % classdef diff --git a/tests/tdocdelete.m b/tests/tdocdelete.m index c868ffa..e0f8b38 100644 --- a/tests/tdocdelete.m +++ b/tests/tdocdelete.m @@ -1,5 +1,7 @@ classdef tdocdelete < tDocMaker - %TDOCDELETE Tests for docdelete. + %tdocdelete Tests for docdelete. + % + % Copyright 2026 The MathWorks, Inc. methods ( Test ) @@ -42,6 +44,11 @@ function tFilesAreRemovedAfterConversionAndRunning( testCase ) function tFilesAreRemovedAfterCompleteBuild( testCase ) + testCase.assumeTrue( ... + ~isMATLABReleaseOlderThan( "R2022b" ), ... + "builddocsearchdb cannot index the temporary test help " + ... + "location in R2022a or earlier." ) + outputFiles = docconvert( testCase.ExampleFile, ... "Root", testCase.Folder ); docrun( outputFiles ) @@ -68,4 +75,4 @@ function tFilesAreRemovedAfterCompleteBuild( testCase ) end % methods ( Test ) -end % classdef \ No newline at end of file +end % classdef diff --git a/tests/tdocindex.m b/tests/tdocindex.m index b93866f..2df72a3 100644 --- a/tests/tdocindex.m +++ b/tests/tdocindex.m @@ -1,14 +1,22 @@ classdef tdocindex < tDocMaker - %TDOCINDEX Tests for docindex. + %tdocindex Tests for docindex. + % + % Copyright 2026 The MathWorks, Inc. methods ( Test ) function tIndexCreatesExpectedFiles( testCase ) + testCase.assumeTrue( ... + ~isMATLABReleaseOlderThan( "R2022b" ), ... + "builddocsearchdb cannot index the temporary test help " + ... + "location in R2022a or earlier." ) + outputFile = docconvert( testCase.ExampleFile, ... "Root", testCase.Folder ); docrun( outputFile ) - [files, folders] = docindex( testCase.Folder ); + [files, folders] = docindex( testCase.Folder, ... + "Converter", "cmark" ); testCase.verifyEqual( files(1), ... fullfile( testCase.Folder, "info.xml" ), ... "docindex did not generate info.xml." ) @@ -22,6 +30,14 @@ function tIndexCreatesExpectedFiles( testCase ) end % tIndexCreatesExpectedFiles + function tIndexRejectsInvalidConverter( testCase ) + + testCase.verifyError( ... + @() docindex( testCase.Folder, "Converter", "invalid" ), ... + "MATLAB:validators:mustBeMember" ) + + end % tIndexRejectsInvalidConverter + end % methods ( Test ) -end % classdef \ No newline at end of file +end % classdef diff --git a/tests/tdocrun.m b/tests/tdocrun.m index 9fff4ee..256962f 100644 --- a/tests/tdocrun.m +++ b/tests/tdocrun.m @@ -1,5 +1,7 @@ classdef tdocrun < tDocMaker - %TDOCRUN Tests for docrun. + %tdocrun Tests for docrun. + % + % Copyright 2026 The MathWorks, Inc. methods ( Test ) @@ -21,4 +23,4 @@ function tRunningModifiesHTMLFile( testCase ) end % methods ( Test ) -end % classdef \ No newline at end of file +end % classdef